package M;

import android.view.View;
import android.view.ViewGroup;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.NoSuchElementException;
import n4.u0;

/* JADX INFO: renamed from: M.s, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class C0188s implements Iterator, Q6.a {

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

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    public Iterator f4130r;

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

    public C0188s(B6.b bVar) {
        this.f4129q = 0;
        this.f4131s = new ArrayList();
        this.f4130r = bVar;
    }

    @Override // java.util.Iterator
    public final boolean hasNext() {
        switch (this.f4129q) {
        }
        return this.f4130r.hasNext();
    }

    @Override // java.util.Iterator
    public final Object next() {
        switch (this.f4129q) {
            case u0.f15495q /* 0 */:
                Object next = this.f4130r.next();
                View view = (View) next;
                ViewGroup viewGroup = view instanceof ViewGroup ? (ViewGroup) view : null;
                B6.b bVar = viewGroup != null ? new B6.b(1, viewGroup) : null;
                ArrayList arrayList = (ArrayList) this.f4131s;
                if (bVar == null || !bVar.hasNext()) {
                    while (!this.f4130r.hasNext() && !arrayList.isEmpty()) {
                        this.f4130r = (Iterator) B6.k.n0(arrayList);
                        if (arrayList.isEmpty()) {
                            throw new NoSuchElementException("List is empty.");
                        }
                        arrayList.remove(B6.l.V(arrayList));
                    }
                } else {
                    arrayList.add(this.f4130r);
                    this.f4130r = bVar;
                }
                return next;
            default:
                return ((O6.l) ((W6.f) this.f4131s).f7203c).b(this.f4130r.next());
        }
    }

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

    public C0188s(W6.f fVar) {
        this.f4129q = 1;
        this.f4131s = fVar;
        this.f4130r = ((W6.h) fVar.f7202b).iterator();
    }
}
