package a.i.b.a.c.g;

import com.tencent.matrix.trace.core.AppMethodBeat;
import java.util.Iterator;
import java.util.NoSuchElementException;
import java.util.Stack;

class u$b implements Iterator<p> {
    private final Stack<u> BAo;
    private p BAp;

    /* synthetic */ u$b(d dVar, byte b) {
        this(dVar);
    }

    public final /* synthetic */ Object next() {
        AppMethodBeat.i(121591);
        p eiD = eiD();
        AppMethodBeat.o(121591);
        return eiD;
    }

    private u$b(d dVar) {
        AppMethodBeat.i(121586);
        this.BAo = new Stack();
        this.BAp = g(dVar);
        AppMethodBeat.o(121586);
    }

    private p g(d dVar) {
        AppMethodBeat.i(121587);
        d dVar2 = dVar;
        while (dVar2 instanceof u) {
            u uVar = (u) dVar2;
            this.BAo.push(uVar);
            dVar2 = u.a(uVar);
        }
        p pVar = (p) dVar2;
        AppMethodBeat.o(121587);
        return pVar;
    }

    private p eiC() {
        AppMethodBeat.i(121588);
        while (!this.BAo.isEmpty()) {
            Object obj;
            p g = g(u.b((u) this.BAo.pop()));
            if (g.size() == 0) {
                obj = 1;
                continue;
            } else {
                obj = null;
                continue;
            }
            if (obj == null) {
                AppMethodBeat.o(121588);
                return g;
            }
        }
        AppMethodBeat.o(121588);
        return null;
    }

    public final boolean hasNext() {
        return this.BAp != null;
    }

    public final p eiD() {
        AppMethodBeat.i(121589);
        if (this.BAp == null) {
            NoSuchElementException noSuchElementException = new NoSuchElementException();
            AppMethodBeat.o(121589);
            throw noSuchElementException;
        }
        p pVar = this.BAp;
        this.BAp = eiC();
        AppMethodBeat.o(121589);
        return pVar;
    }

    public final void remove() {
        AppMethodBeat.i(121590);
        UnsupportedOperationException unsupportedOperationException = new UnsupportedOperationException();
        AppMethodBeat.o(121590);
        throw unsupportedOperationException;
    }
}
