package I0;

import i0.AbstractC2254r;
import java.util.AbstractList;
import java.util.ConcurrentModificationException;
import java.util.ListIterator;
import java.util.NoSuchElementException;
import y4.C3273a;
import y4.C3274b;

/* JADX INFO: renamed from: I0.p, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class C0307p implements ListIterator, K4.a {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final /* synthetic */ int f2445a;

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

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

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

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public final Object f2449e;

    /* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
    public C0307p(r rVar, int i6, int i7) {
        this(rVar, (i7 & 1) != 0 ? 0 : i6, 0, rVar.f2455a.f21377b);
        this.f2445a = 0;
    }

    public void a() {
        if (((AbstractList) ((C3273a) this.f2449e).f26206e).modCount != this.f2448d) {
            throw new ConcurrentModificationException();
        }
    }

    @Override // java.util.ListIterator
    public final void add(Object obj) {
        switch (this.f2445a) {
            case 0:
                throw new UnsupportedOperationException("Operation is not supported for read-only collection");
            case 1:
                a();
                int i6 = this.f2446b;
                this.f2446b = i6 + 1;
                C3273a c3273a = (C3273a) this.f2449e;
                c3273a.add(i6, obj);
                this.f2447c = -1;
                this.f2448d = ((AbstractList) c3273a).modCount;
                return;
            default:
                b();
                int i7 = this.f2446b;
                this.f2446b = i7 + 1;
                C3274b c3274b = (C3274b) this.f2449e;
                c3274b.add(i7, obj);
                this.f2447c = -1;
                this.f2448d = ((AbstractList) c3274b).modCount;
                return;
        }
    }

    public void b() {
        if (((AbstractList) ((C3274b) this.f2449e)).modCount != this.f2448d) {
            throw new ConcurrentModificationException();
        }
    }

    @Override // java.util.ListIterator, java.util.Iterator
    public final boolean hasNext() {
        switch (this.f2445a) {
            case 0:
                if (this.f2446b < this.f2448d) {
                }
                break;
            case 1:
                if (this.f2446b < ((C3273a) this.f2449e).f26204c) {
                }
                break;
            default:
                if (this.f2446b < ((C3274b) this.f2449e).f26209b) {
                }
                break;
        }
        return false;
    }

    @Override // java.util.ListIterator
    public final boolean hasPrevious() {
        switch (this.f2445a) {
            case 0:
                if (this.f2446b > this.f2447c) {
                }
                break;
            case 1:
                if (this.f2446b > 0) {
                }
                break;
            default:
                if (this.f2446b > 0) {
                }
                break;
        }
        return false;
    }

    @Override // java.util.ListIterator, java.util.Iterator
    public final Object next() {
        switch (this.f2445a) {
            case 0:
                n.J j4 = ((r) this.f2449e).f2455a;
                int i6 = this.f2446b;
                this.f2446b = i6 + 1;
                Object objB = j4.b(i6);
                kotlin.jvm.internal.o.f(objB, "null cannot be cast to non-null type androidx.compose.ui.Modifier.Node");
                return (AbstractC2254r) objB;
            case 1:
                a();
                int i7 = this.f2446b;
                C3273a c3273a = (C3273a) this.f2449e;
                if (i7 >= c3273a.f26204c) {
                    throw new NoSuchElementException();
                }
                this.f2446b = i7 + 1;
                this.f2447c = i7;
                return c3273a.f26202a[c3273a.f26203b + i7];
            default:
                b();
                int i8 = this.f2446b;
                C3274b c3274b = (C3274b) this.f2449e;
                if (i8 >= c3274b.f26209b) {
                    throw new NoSuchElementException();
                }
                this.f2446b = i8 + 1;
                this.f2447c = i8;
                return c3274b.f26208a[i8];
        }
    }

    @Override // java.util.ListIterator
    public final int nextIndex() {
        switch (this.f2445a) {
        }
        return this.f2446b;
    }

    @Override // java.util.ListIterator
    public final Object previous() {
        switch (this.f2445a) {
            case 0:
                n.J j4 = ((r) this.f2449e).f2455a;
                int i6 = this.f2446b - 1;
                this.f2446b = i6;
                Object objB = j4.b(i6);
                kotlin.jvm.internal.o.f(objB, "null cannot be cast to non-null type androidx.compose.ui.Modifier.Node");
                return (AbstractC2254r) objB;
            case 1:
                a();
                int i7 = this.f2446b;
                if (i7 <= 0) {
                    throw new NoSuchElementException();
                }
                int i8 = i7 - 1;
                this.f2446b = i8;
                this.f2447c = i8;
                C3273a c3273a = (C3273a) this.f2449e;
                return c3273a.f26202a[c3273a.f26203b + i8];
            default:
                b();
                int i9 = this.f2446b;
                if (i9 <= 0) {
                    throw new NoSuchElementException();
                }
                int i10 = i9 - 1;
                this.f2446b = i10;
                this.f2447c = i10;
                return ((C3274b) this.f2449e).f26208a[i10];
        }
    }

    @Override // java.util.ListIterator
    public final int previousIndex() {
        switch (this.f2445a) {
        }
        return this.f2446b - 1;
    }

    @Override // java.util.ListIterator, java.util.Iterator
    public final void remove() {
        switch (this.f2445a) {
            case 0:
                throw new UnsupportedOperationException("Operation is not supported for read-only collection");
            case 1:
                a();
                int i6 = this.f2447c;
                if (i6 == -1) {
                    throw new IllegalStateException("Call next() or previous() before removing element from the iterator.");
                }
                C3273a c3273a = (C3273a) this.f2449e;
                c3273a.remove(i6);
                this.f2446b = this.f2447c;
                this.f2447c = -1;
                this.f2448d = ((AbstractList) c3273a).modCount;
                return;
            default:
                b();
                int i7 = this.f2447c;
                if (i7 == -1) {
                    throw new IllegalStateException("Call next() or previous() before removing element from the iterator.");
                }
                C3274b c3274b = (C3274b) this.f2449e;
                c3274b.remove(i7);
                this.f2446b = this.f2447c;
                this.f2447c = -1;
                this.f2448d = ((AbstractList) c3274b).modCount;
                return;
        }
    }

    @Override // java.util.ListIterator
    public final void set(Object obj) {
        switch (this.f2445a) {
            case 0:
                throw new UnsupportedOperationException("Operation is not supported for read-only collection");
            case 1:
                a();
                int i6 = this.f2447c;
                if (i6 == -1) {
                    throw new IllegalStateException("Call next() or previous() before replacing element from the iterator.");
                }
                ((C3273a) this.f2449e).set(i6, obj);
                return;
            default:
                b();
                int i7 = this.f2447c;
                if (i7 == -1) {
                    throw new IllegalStateException("Call next() or previous() before replacing element from the iterator.");
                }
                ((C3274b) this.f2449e).set(i7, obj);
                return;
        }
    }

    public C0307p(C3274b c3274b, int i6) {
        this.f2445a = 2;
        this.f2449e = c3274b;
        this.f2446b = i6;
        this.f2447c = -1;
        this.f2448d = ((AbstractList) c3274b).modCount;
    }

    public C0307p(r rVar, int i6, int i7, int i8) {
        this.f2445a = 0;
        this.f2449e = rVar;
        this.f2446b = i6;
        this.f2447c = i7;
        this.f2448d = i8;
    }

    public C0307p(C3273a c3273a, int i6) {
        this.f2445a = 1;
        this.f2449e = c3273a;
        this.f2446b = i6;
        this.f2447c = -1;
        this.f2448d = ((AbstractList) c3273a).modCount;
    }
}
