/*
 * Decompiled with CFR 0.152.
 */
import java.util.Enumeration;
import java.util.Vector;

public final class cj
extends t {
    private jt h;
    private ct i;
    private iy j;
    private hx k;

    public final cq d() {
        return jy.g;
    }

    public final void a() {
        this.f();
    }

    public cj(eb eb2) {
        super(eb2);
    }

    public final void a(jt jt2) {
        this.h = jt2;
        this.n();
    }

    public final void a(ht ht2) {
        this.j.a(ht2, 0, 0);
    }

    public final void b() {
        this.j = null;
        this.k = null;
    }

    public final void f() {
        this.j = this.s.b(false, false);
        this.k = (hx)this.j.a();
        dz.a(this.k, lh.d(241), jj.a());
        this.i = new ct(dz.a(this.k));
    }

    public final int a(nj nj2) {
        switch (this.j.b(nj2)) {
            case -3: {
                return this.a(pb.a(7));
            }
        }
        return 3;
    }

    public final cq e() {
        gm gm2 = this.k.r();
        if (gm2 != null && gm2 instanceof pj) {
            if (((pj)gm2).f()) {
                return jy.l;
            }
            return jy.c;
        }
        return null;
    }

    public final void g_() {
        if (this.t) {
            int n = -1;
            if (this.k != null) {
                n = this.k.g(this.k.q());
            }
            this.f();
            if (n != -1) {
                this.k.l(this.k.h(n));
            }
        }
    }

    public final boolean a(boolean n) {
        if (!this.i.c) {
            Throwable throwable2;
            block7: {
                Vector vector = this.i.b;
                synchronized (vector) {
                    try {
                        if (!this.i.b.isEmpty()) {
                            Enumeration enumeration = this.i.b.elements();
                            while (enumeration.hasMoreElements()) {
                                this.k.d((gm)enumeration.nextElement());
                            }
                            this.i.g();
                            return true;
                        }
                    }
                    catch (Throwable throwable2) {
                        break block7;
                    }
                }
                return this.a(this.j);
            }
            throw throwable2;
        }
        for (n = this.k.m() - 1; n > 0; --n) {
            this.k.b_(n);
        }
        this.i.c = false;
        return true;
    }

    public final int a(pb pb2) {
        if (pb2.c != 8) {
            gm gm2;
            if (pb2.c == 7 && (gm2 = this.k.r()) != null && gm2 instanceof pj) {
                pj pj2 = (pj)gm2;
                if (pj2.f()) {
                    pj pj3 = this.i.a;
                    if (pj3 != null && pj3.k().equals(pj2.k())) {
                        this.i.a(pj2.n);
                        return 3;
                    }
                    this.i.a(pj2);
                    return 3;
                }
                jt jt2 = this.h;
                gm2 = this.k.r();
                pj2 = gm2 instanceof pj ? (pj)gm2 : null;
                jt2.a(pj2.l());
                return 1;
            }
            this.j.a(pb2);
            return 3;
        }
        if (!this.i.d()) {
            if (!this.i.e()) {
                pj pj4;
                if (this.i.f() && (pj4 = this.i.a) != null && (pj4 = pj4.n) != null) {
                    this.i.a(pj4);
                    return 3;
                }
            } else {
                gm gm3 = this.k.r();
                if (!(gm3 instanceof pj)) {
                    this.i.a();
                    return 3;
                }
                if (!((pj)gm3).f()) {
                    this.i.a();
                    return 3;
                }
            }
        }
        return 2;
    }
}

