package defpackage;

import androidx.media3.container.NalUnitUtil;
import java.util.Iterator;
import java.util.NoSuchElementException;
import kotlin.Metadata;

/* JADX INFO: loaded from: classes3.dex */
@Metadata(d1 = {"\u0000\n\n\u0002\u0018\u0002\n\u0002\u0010(\n\u0000\b\n\u0018\u00002\b\u0012\u0004\u0012\u00028\u00000\u0001¨\u0006\u0002"}, d2 = {"Lkj9;", "", "kotlin-stdlib"}, k = 1, mv = {2, 1, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
public final class kj9 implements Iterator<Object>, f25 {
    public final Iterator a;
    public int b = -1;
    public Object c;
    public final /* synthetic */ lj9 d;

    public kj9(lj9 lj9Var) {
        this.d = lj9Var;
        this.a = lj9Var.a.getA();
    }

    public final void a() {
        Iterator it = this.a;
        if (it.hasNext()) {
            Object next = it.next();
            if (((Boolean) this.d.b.invoke(next)).booleanValue()) {
                this.b = 1;
                this.c = next;
                return;
            }
        }
        this.b = 0;
    }

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

    @Override // java.util.Iterator
    public final Object next() {
        if (this.b == -1) {
            a();
        }
        if (this.b == 0) {
            throw new NoSuchElementException();
        }
        Object obj = this.c;
        this.c = null;
        this.b = -1;
        return obj;
    }

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