package C3;

import java.util.Iterator;
import java.util.NoSuchElementException;
import n4.u0;
import u.AbstractC1563h;

/* JADX INFO: loaded from: classes.dex */
public final class K extends k0 {

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

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

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

    /* JADX INFO: renamed from: t, reason: collision with root package name */
    public final Iterator f1206t;

    /* JADX INFO: renamed from: u, reason: collision with root package name */
    public final /* synthetic */ Object f1207u;

    public K() {
        this.f1203q = 2;
    }

    /* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
    @Override // java.util.Iterator
    public final boolean hasNext() {
        Object next;
        int i = this.f1203q;
        if (i == 4) {
            throw new IllegalStateException();
        }
        int iC = AbstractC1563h.c(i);
        if (iC == 0) {
            return true;
        }
        if (iC == 2) {
            return false;
        }
        this.f1203q = 4;
        switch (this.f1205s) {
            case u0.f15495q /* 0 */:
                do {
                    Iterator it = this.f1206t;
                    if (!it.hasNext()) {
                        this.f1203q = 3;
                        next = null;
                    } else {
                        next = it.next();
                    }
                    break;
                } while (!((B3.h) this.f1207u).apply(next));
                break;
            default:
                do {
                    Iterator it2 = this.f1206t;
                    if (!it2.hasNext()) {
                        this.f1203q = 3;
                        next = null;
                    } else {
                        next = it2.next();
                    }
                    break;
                } while (!((e0) this.f1207u).f1269r.contains(next));
                break;
        }
        this.f1204r = next;
        if (this.f1203q == 3) {
            return false;
        }
        this.f1203q = 1;
        return true;
    }

    @Override // java.util.Iterator
    public final Object next() {
        if (!hasNext()) {
            throw new NoSuchElementException();
        }
        this.f1203q = 2;
        Object obj = this.f1204r;
        this.f1204r = null;
        return obj;
    }

    /* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
    public K(Iterator it, B3.h hVar) {
        this();
        this.f1205s = 0;
        this.f1206t = it;
        this.f1207u = hVar;
    }

    /* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
    public K(e0 e0Var) {
        this();
        this.f1205s = 1;
        this.f1207u = e0Var;
        this.f1206t = e0Var.f1268q.iterator();
    }
}
