package d1;

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

/* loaded from: classes.dex */
public abstract class e implements Iterator, en.a {

    /* renamed from: p, reason: collision with root package name */
    private final u[] f15732p;

    /* renamed from: q, reason: collision with root package name */
    private int f15733q;

    /* renamed from: r, reason: collision with root package name */
    private boolean f15734r = true;

    public e(t tVar, u[] uVarArr) {
        this.f15732p = uVarArr;
        uVarArr[0].i(tVar.p(), tVar.m() * 2);
        this.f15733q = 0;
        c();
    }

    private final void a() {
        if (!hasNext()) {
            throw new NoSuchElementException();
        }
    }

    private final void c() {
        if (this.f15732p[this.f15733q].e()) {
            return;
        }
        for (int i10 = this.f15733q; -1 < i10; i10--) {
            int e10 = e(i10);
            if (e10 == -1 && this.f15732p[i10].f()) {
                this.f15732p[i10].h();
                e10 = e(i10);
            }
            if (e10 != -1) {
                this.f15733q = e10;
                return;
            }
            if (i10 > 0) {
                this.f15732p[i10 - 1].h();
            }
            this.f15732p[i10].i(t.f15752e.a().p(), 0);
        }
        this.f15734r = false;
    }

    private final int e(int i10) {
        if (this.f15732p[i10].e()) {
            return i10;
        }
        if (!this.f15732p[i10].f()) {
            return -1;
        }
        t b10 = this.f15732p[i10].b();
        if (i10 == 6) {
            this.f15732p[i10 + 1].i(b10.p(), b10.p().length);
        } else {
            this.f15732p[i10 + 1].i(b10.p(), b10.m() * 2);
        }
        return e(i10 + 1);
    }

    /* JADX INFO: Access modifiers changed from: protected */
    public final Object b() {
        a();
        return this.f15732p[this.f15733q].a();
    }

    /* JADX INFO: Access modifiers changed from: protected */
    public final u[] d() {
        return this.f15732p;
    }

    /* JADX INFO: Access modifiers changed from: protected */
    public final void f(int i10) {
        this.f15733q = i10;
    }

    @Override // java.util.Iterator
    public boolean hasNext() {
        return this.f15734r;
    }

    @Override // java.util.Iterator
    public Object next() {
        a();
        Object next = this.f15732p[this.f15733q].next();
        c();
        return next;
    }

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