/*
 * Decompiled with CFR 0.152.
 */
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.util.Hashtable;
import java.util.Vector;

public final class en
extends ep
implements kv,
nf {
    private final gd d;
    private ft a;
    private Vector b = new Vector();
    private int c = -1;
    private Hashtable e;

    public final void a() {
    }

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

    public en(eb eb2, hj hj2, gd gd2) {
        super(eb2, hj2);
        this.d = gd2;
        this.a = this.s.a(false, false);
        nz.a(this);
    }

    public final boolean a(boolean bl2) {
        return this.a(this.a);
    }

    public final int a(nj nj2) {
        return this.a.b(nj2);
    }

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

    private void a(no no2) {
        this.a.b(no2.F);
        this.g_();
    }

    public final int a(pb pb2) {
        if (pb2.c != 8 && pb2.c != 5) {
            if (pb2.c != 6) {
                return this.a.a(pb2);
            }
            this.m().a(new pb(10, 10, 7, false));
            return -2;
        }
        if (this.c <= 0) {
            this.o();
            return -2;
        }
        this.a((no)this.b.elementAt(--this.c));
        this.l();
        return -2;
    }

    public final cq e() {
        gm gm2 = this.a.r();
        if (!lh.t() && gm2 != null && !(gm2 instanceof hx)) {
            return jy.c;
        }
        return null;
    }

    private no m() {
        if (this.c >= 0 && this.c < this.b.size()) {
            return (no)this.b.elementAt(this.c);
        }
        return null;
    }

    public final void b() {
        this.c = -1;
        if (this.b.size() > 1) {
            this.b.setSize(1);
        }
    }

    private void l() {
        if (this.b.size() > this.c + 2) {
            this.b.setSize(this.c + 2);
        }
    }

    public final void af() {
        if (this.c > 0) {
            this.b.setElementAt(this.b.elementAt(this.c), 0);
            this.c = 0;
        }
        if (this.b.size() > this.c + 1) {
            this.b.setSize(this.c + 1);
        }
    }

    public final void g_() {
        this.a.d(this.a.p, this.a.q, this.s.n(), this.s.a(false));
        no no2 = this.m();
        if (no2 != null) {
            hx hx2 = no2.F;
            hx2.l(this.a.x_());
            hx2.m(this.a.c());
            no2.a(hx2.a(), Integer.MAX_VALUE);
        }
    }

    public final void a(String string) {
        if (string.startsWith("http:")) {
            string = "gmm:" + string.substring(5);
        }
        this.c = -1;
        this.a(null, 1, string, 1, null);
    }

    /*
     * Enabled force condition propagation
     * Lifted jumps to return sites
     */
    private Object a(String string, int n) {
        le le2;
        Object object;
        String string2 = string.startsWith("gmm:") ? "http" + string.substring(3) : string;
        for (int i = 0; i < this.b.size(); ++i) {
            no no2 = (no)this.b.elementAt(i);
            object = no2.a(string, n, null);
            if (object == null) {
                object = no2.a(string2, n, null);
            }
            if (object != null) return object;
        }
        if (n != 2) return null;
        string = gu.g().x();
        if (!string2.startsWith(string)) return null;
        if (!(string = string2.substring(string.length())).startsWith("/file/clienticons/")) return null;
        n = (string = string.substring("/file/clienticons/".length())).indexOf(46);
        if (n == -1) {
            return null;
        }
        try {
            Character c = new Character((char)Integer.parseInt(string.substring(0, n), 16));
            if (this.e == null) {
                this.e = new Hashtable();
            }
            if ((le2 = (le)this.e.get(c)) == null && (object = this.s.k).a((char)(n = (int)c.charValue()))) {
                le2 = lh.k().g().a(object.c((char)n), object.b((char)n));
                object.a((char)n, le2.c(), 0, 0);
                this.e.put(c, le2);
            }
        }
        catch (NumberFormatException numberFormatException) {
            return null;
        }
        if (le2 == null) return null;
        return le2;
    }

    /*
     * WARNING - void declaration
     * Enabled aggressive block sorting
     * Enabled unnecessary exception pruning
     * Enabled aggressive exception aggregation
     */
    public final void a(no no2, int n, String string, int n2, byte[] object) {
        if (n2 == 1) {
            block17: {
                void var5_10;
                if (!string.startsWith("gmm:")) {
                    this.d.c(string);
                    return;
                }
                n2 = string.indexOf(35);
                String string2 = n2 == -1 ? string : string.substring(0, n2);
                Object var5_6 = null;
                if (n != 2) {
                    for (n = 0; n < this.b.size(); ++n) {
                        no2 = (no)this.b.elementAt(n);
                        if (!no2.y.equals(string2)) {
                            continue;
                        }
                        break block17;
                    }
                    Object object2 = this.a(string2, 1);
                }
                hx hx2 = ps.a(this.a);
                hx2.u = true;
                no2 = new no(hx2.a(), this, string2, hx2, false);
                no2.u = true;
                try {
                    void var8_16;
                    void var5_8;
                    if (!(var5_8 instanceof byte[])) {
                        Object var5_9 = null;
                        byte[] byArray = ("<html><body>" + lh.d(578) + "</body></html>").getBytes("UTF-8");
                    } else {
                        byte[] byArray = (byte[])var5_8;
                    }
                    no2.a(new ByteArrayInputStream((byte[])var8_16), "UTF-8");
                    hx2.d(no2);
                }
                catch (IOException iOException) {
                    throw new RuntimeException(iOException.toString());
                }
                this.a(no2);
                ++this.c;
                if (this.c < this.b.size()) {
                    this.b.setElementAt(no2, this.c);
                    this.l();
                } else {
                    this.b.addElement(no2);
                }
                hx2.d(2);
                if (var5_10 == null) {
                    ck.e().a(new lh(no2, string, 1));
                    return;
                }
                if (n2 == -1) return;
                no2.b(string.substring(n2 + 1));
                return;
            }
            if (n > this.c) {
                this.b.setElementAt(no2, this.c + 1);
                n = this.c + 1;
            }
            this.c = n;
            this.l();
            this.a(no2);
            if (n2 != -1) {
                no2.b(string.substring(n2 + 1));
                return;
            }
            if (no2.m() <= 0) return;
            no2.F.d(2);
            return;
        }
        Object object3 = this.a(string, n2);
        if (object3 != null) {
            no2.a(string, object3);
            return;
        }
        ck.e().a(new lh(no2, string, n2));
    }
}

