/*
 * Decompiled with CFR 0.152.
 */
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Date;
import java.util.Enumeration;
import java.util.Hashtable;

/*
 * Duplicate member names - consider using --renamedupmembers true
 */
public abstract class mo
extends bj
implements jf,
jr,
hh {
    private static final Object F = new Object();
    private static final String K;
    private static final String L;
    private static final String M;
    private static final String N;
    private final int H;
    private static int G;
    private int T;
    private int I;
    private long J;
    private boolean O;
    private boolean P;
    private fk Q;
    private fk R;
    private boolean S;
    public int r;
    public int A;
    public int B;
    public int[] C;
    public lk[] D;
    public boolean E;
    public int a;
    public int b;
    public fu c;
    public boolean d;
    public Date e;
    public int f;
    public fk k;
    public fk[] l;
    public fk m;
    public fk[] n;
    public lk o;
    public lk p;
    public int q;
    public String s;
    public gu[] t;
    public lh[] u;
    public lk[] v;
    public int w;
    public int x;
    public int y;
    public byte z;

    public abstract int e();

    public abstract int f();

    public static String X() {
        return M;
    }

    public static String W() {
        return N;
    }

    public String a(int n, fu fu2) {
        if (n == this.a() - 1) {
            return ps.a('e');
        }
        return ps.a('t');
    }

    public final boolean a(DataInput dataInput) {
        boolean bl2 = this.a(ar.a(la.F, dataInput), null);
        long l = System.currentTimeMillis() - this.J;
        if (this.t()) {
            me.a((short)22, "T", "" + l);
            return bl2;
        }
        me.a((short)22, "r", "" + l);
        return bl2;
    }

    public final iv[] a(int n, int n2) {
        gu gu2 = this.K();
        if (gu2 != null) {
            if (n >= 0 && n2 >= 0) {
                int n3 = gu2.e(n);
                n2 = gu2.e(n2);
                iv[] ivArray = new iv[n2 - n3 + 1];
                for (n = n3; n <= n2; ++n) {
                    ivArray[n - n3] = gu2.a[n];
                }
                return ivArray;
            }
            return gu2.a;
        }
        return null;
    }

    public static lk a(iv iv2, int n) {
        if (n != 1) {
            lk lk2 = new lk(la.g);
            lk2.b(13, gu.a(iv2));
            lk2.h(1, 4);
            return lk2;
        }
        return gu.c(iv2);
    }

    public final int d(int n) {
        return n;
    }

    public final void m(int n) {
        this.x = n;
        this.y = 0;
    }

    public static int a(mo mo2, int n) {
        mo2.T = n;
        return n;
    }

    public static int b(mo mo2, int n) {
        mo2.y = n;
        return n;
    }

    public final lk j(int n) {
        return this.v[n];
    }

    public final iv[] c() {
        return this.a(-1, -1);
    }

    public final aq P() {
        return new aq(this.k, this.m, this.o);
    }

    public mo(jr jr2, fu fu2) {
        this(jr2.B_(), jr2.b(), jr2.d(), fu2);
    }

    public mo(fk fk2, fk fk3, lk lk2, fu fu2) {
        this(fu2);
        this.k = fk2;
        this.m = fk3;
        this.o = lk2;
        this.t = null;
        this.A = -1;
        this.J = System.currentTimeMillis();
    }

    static {
        G = 1;
        K = lh.d(521);
        L = lh.d(354);
        M = lh.d(266);
        N = lh.d(371);
    }

    public static void a(lk lk2, fk fk2) {
        lk2.a(2, gu.a(fk2));
    }

    public final int x() {
        return this.H + this.x;
    }

    public final int z() {
        return 28;
    }

    public final int H() {
        return this.u.length;
    }

    public static int a(mo mo2) {
        return mo2.T;
    }

    public final int w() {
        return this.y;
    }

    public final byte i() {
        return this.z;
    }

    public static fk b(mo mo2) {
        return mo2.m;
    }

    public final fk b() {
        return this.m;
    }

    public final fk B_() {
        return this.k;
    }

    public final iv[] F() {
        return this.K().c;
    }

    public final lk D() {
        return this.K().a;
    }

    public final int A() {
        return this.K().d;
    }

    public final int y() {
        return this.K().b;
    }

    public final boolean B() {
        return this.K().b;
    }

    public final boolean z() {
        return this.K().f;
    }

    public final boolean y_() {
        return true;
    }

    public final boolean A_() {
        return false;
    }

    public final boolean s() {
        switch (this.b) {
            case 1: 
            case 3: 
            case 4: 
            case 5: 
            case 6: {
                return true;
            }
        }
        return false;
    }

    public static boolean n() {
        return !lh.r();
    }

    public static int c(lk lk2) {
        if (!lk2.h(13)) {
            return 1;
        }
        return 4;
    }

    public static int d(lk lk2) {
        byte[] byArray = lk2.c(9);
        if (byArray != null) {
            return byArray.length / 4 + 1;
        }
        return 1;
    }

    private static boolean f(lk lk2) {
        int n = lk2.d(6);
        return n == 0 || n == 1;
    }

    public final lh i(int n) {
        if (n >= 0 && n < this.u.length) {
            return this.u[n];
        }
        return null;
    }

    public final cn a(ck ck2) {
        if (this.x >= 0 && this.x < this.t.length) {
            gu gu2 = this.t[this.x];
            return ck2.a(new iv[]{gu2.b, gu2.h}, gu.a(gu2));
        }
        return null;
    }

    public final gu K() {
        if (this.t != null) {
            return this.t[this.x];
        }
        return null;
    }

    public final boolean S() {
        return this.b == 3 && !this.P;
    }

    public final boolean R() {
        return this.b == 3 && !this.O;
    }

    public final boolean u() {
        return this.j != bj.g;
    }

    public final boolean m() {
        return this.I == 1;
    }

    public final boolean t() {
        return this.a == 1;
    }

    public final boolean J() {
        return this.v.length > 0;
    }

    public final boolean r() {
        return this.l != null || this.n != null;
    }

    public final boolean l() {
        return this.I == 0;
    }

    public final boolean z_() {
        return !this.t();
    }

    public final int L() {
        gu gu2 = this.K();
        if (gu2 != null) {
            return gu2.r();
        }
        return 0;
    }

    public final int a() {
        gu gu2 = this.K();
        if (gu2 != null) {
            return gu2.s();
        }
        return 0;
    }

    public final boolean l(int n) {
        return this.K().f(n);
    }

    public final int a(int n) {
        return this.K().d(n);
    }

    public final long f(int n) {
        return this.K().e(n);
    }

    public final void h(int n) {
        this.K().h(n);
    }

    public final void g(int n) {
        this.K().g(n);
    }

    public final pz c(int n) {
        return this.K().a(n);
    }

    public final gu k(int n) {
        return this.K().b(n);
    }

    public final pz j() {
        return this.c(this.y);
    }

    public final void V() {
        this.k = this.Q;
        this.m = this.R;
    }

    public final void U() {
        this.Q = this.k;
        this.R = this.m;
    }

    public final void w() {
        this.a = 1;
        this.E = true;
    }

    public final void q() {
        this.d = true;
    }

    public final void p() {
        this.d = false;
    }

    public final void b(fk fk2) {
        this.m = fk2;
    }

    public final void a(fk fk2) {
        this.k = fk2;
    }

    public final void a(byte by2) {
        this.z = by2;
    }

    public final void b(int n) {
        this.y = n;
        if (n >= 0) {
            if (this.z == 0) {
                this.z = 1;
                return;
            }
        } else {
            this.z = 0;
        }
    }

    public final boolean I() {
        block2: {
            for (int i = 0; i < this.L(); ++i) {
                if (this.k(i).q() < 0) {
                    continue;
                }
                break block2;
            }
            return false;
        }
        return true;
    }

    public final boolean Q() {
        block2: {
            for (int i = 0; i < this.t.length; ++i) {
                if (this.t[i] == null || this.t[i].a == null) {
                    continue;
                }
                break block2;
            }
            return false;
        }
        return true;
    }

    public final boolean M() {
        boolean bl2 = this.k != null && this.k.d();
        return bl2 || this.m != null && this.m.d();
    }

    public final boolean T() {
        if (this.k != null && !ed.b(this.k.f) || this.m != null && !ed.b(this.m.f)) {
            return true;
        }
        return this.K().b();
    }

    public static fk a(fk fk2, fk fk3) {
        if (fk2 != null && !fk2.b()) {
            String string = fk2.a != 4 && fk2.a != 3 ? (ed.b(fk3.e) ? fk3.b : fk3.e) : fk2.e;
            return fk.a(fk2, string, fk3.f);
        }
        return fk3;
    }

    public static lk a(lk lk2, byte[] byArray) {
        lk lk3 = new lk(null);
        lk3.b(8, lk2);
        if (byArray != null) {
            lk3.b(9, byArray);
        }
        return lk3;
    }

    private static lk a(fk fk2, fk[] fkArray) {
        lk lk2 = new lk(la.B).a(5);
        int n = fkArray != null ? 1 : 0;
        lk2.h(6, n);
        lk2.a(7, gu.a(fk2));
        if (fkArray != null) {
            for (n = 0; n < fkArray.length; ++n) {
                fk fk3 = fkArray[n];
                if (fk3.equals(fk2)) continue;
                lk2.a(7, gu.a(fk3));
            }
        }
        return lk2;
    }

    /*
     * Enabled aggressive block sorting
     */
    public static fk[] a(lk lk2) {
        fk[] fkArray;
        block4: {
            block3: {
                int n = lk2.d(6);
                int n2 = lk2.i(7);
                if (n != 2 && n != 1) break block3;
                fkArray = new fk[n2];
                for (n = 0; n < n2; ++n) {
                    fkArray[n] = fk.a(lk2.e(7, n), lk2);
                }
                if (fkArray.length > 1) break block4;
            }
            return null;
        }
        return fkArray;
    }

    public mo(fu fu2) {
        Throwable throwable2;
        block3: {
            int n;
            this.I = -1;
            this.b = -1;
            this.u = new lh[0];
            this.v = new lk[0];
            this.C = new int[0];
            this.D = new lk[0];
            this.c = fu2;
            Object object = F;
            synchronized (object) {
                try {
                    G = n = G + 1;
                }
                catch (Throwable throwable2) {
                    break block3;
                }
            }
            this.H = n;
            this.J = System.currentTimeMillis();
            return;
        }
        throw throwable2;
    }

    public static mo a(DataInput dataInput, fu fu2) {
        lk lk2 = new lk(la.aC);
        lk2.a((InputStream)((Object)dataInput), dataInput.readInt());
        int n = lk2.f(2).d(2);
        mo mo2 = n != 1 ? (n != 2 ? new by(fu2) : new bp(fu2)) : new gc(fu2);
        if (!mo2.b(lk2)) {
            throw new IOException("Malformed directions stream.");
        }
        return mo2;
    }

    public final String O() {
        StringBuffer stringBuffer = new StringBuffer();
        String string = ku.b(this.D());
        String string2 = ku.b(this.K().c);
        string = !ed.b(string) && !ed.b(string2) ? ed.a(K, string, string2) : "";
        if (this.z()) {
            string2 = ku.a(this.y());
            if (!ed.b(string)) {
                stringBuffer.append(ed.a(L, string, string2));
            } else {
                stringBuffer.append(string2);
            }
        }
        if (stringBuffer.length() == 0 && this.A() > 0) {
            stringBuffer.append(oq.a(this.A(), this.B));
        }
        if (this.S) {
            if (stringBuffer.length() > 0) {
                stringBuffer.append(" ");
            }
            stringBuffer.append(this.K().b);
        }
        return stringBuffer.toString();
    }

    public final lk o() {
        lk lk2 = new lk(la.A);
        if (this.c != null) {
            lk2.h(2, this.c.c);
            long[] lArray = this.c.b();
            for (int i = 0; i < lArray.length; ++i) {
                lk2.a(3, lArray[i]);
            }
        }
        lk lk3 = new lk(null);
        lk3.a(16, 0);
        lk2.b(1, lk3);
        return lk2;
    }

    public final boolean b(lk lk2) {
        boolean bl2;
        lk[] lkArray = new lk[lk2.i(3)];
        for (bl2 = false; bl2 < lkArray.length; bl2 += 1) {
            lkArray[bl2] = lk2.e(3, bl2 ? 1 : 0);
        }
        if (lk2.h(1)) {
            this.c(lk2.g(1));
        }
        this.A = (int)ar.e(lk2, 5);
        bl2 = this.a(lk2.f(2), lkArray);
        if (this.p != null) {
            this.e = new Date(this.p.e(1) * (long)1000);
        }
        if (bl2) {
            this.m((int)ar.e(lk2, 4));
        }
        return bl2;
    }

    private static Hashtable i(lk lk2) {
        Hashtable<Long, Long> hashtable = new Hashtable<Long, Long>();
        int n = lk2.i(8);
        for (int i = 0; i < n; ++i) {
            lk lk3 = lk2.e(8, i);
            int n2 = lk3.i(9);
            for (int k = 0; k < n2; ++k) {
                lk lk4 = lk3.e(9, k);
                int n3 = lk4.i(10);
                for (int i2 = 0; i2 < n3; ++i2) {
                    lk lk5 = lk4.e(10, i2);
                    if (!lk5.h(12)) continue;
                    Long l = new Long(lk5.e(12));
                    hashtable.put(l, l);
                }
            }
        }
        return hashtable;
    }

    public final boolean a(lk lk2, lk[] lkArray) {
        int n;
        lk lk3;
        lk lk4;
        int n2;
        block18: {
            block19: {
                block21: {
                    block20: {
                        if (this.t()) break block19;
                        this.t = null;
                        this.w = 0;
                        this.B = lk2.d(13);
                        if (lk2.i(2) <= 0) break block20;
                        this.I = lk2.c(2, 0);
                        this.x = this.f();
                        this.b = lk2.d(1);
                        n2 = this.b == 3 ? 0 : 1;
                        this.O = n2;
                        n2 = this.b != 3 ? 1 : 0;
                        this.P = n2;
                        if (lk2.h(3)) {
                            this.p = lk2.f(3);
                            this.q = ar.c(lk2, 4);
                        }
                        this.s = lk2.g(11);
                        if (lk2.i(5) != 2) break block21;
                        lk4 = lk2.e(5, 0);
                        lk3 = lk4.e(7, 0);
                        this.O = mo.f(lk4);
                        if (this.O) {
                            this.k = lkArray != null && lkArray.length >= 1 ? fk.b(lkArray[0], lk3) : mo.a(this.k, fk.a(lk3, lk4));
                        }
                        this.l = mo.a(lk4);
                        n = this.O;
                        n2 = lk4.d(6) == 2 ? 1 : 0;
                        this.O = n | n2;
                        lk4 = lk2.e(5, 1);
                        lk3 = lk4.e(7, 0);
                        this.P = mo.f(lk4);
                        if (this.P) {
                            this.m = lkArray != null && lkArray.length >= 2 ? fk.b(lkArray[1], lk3) : mo.a(this.m, fk.a(lk3, lk4));
                        }
                        this.n = mo.a(lk4);
                        n = this.P;
                        n2 = lk4.d(6) != 2 ? 0 : 1;
                        this.P = n | n2;
                        this.w = lk2.i(8);
                        if (this.w > this.e()) {
                            this.w = this.e();
                            this.b = 4;
                        }
                        this.t = new gu[this.w];
                        this.S = true;
                        try {
                            for (n2 = 0; n2 < this.w; ++n2) {
                                lk4 = lk2.e(8, n2);
                                gu[] guArray = this.t;
                                lk4 = lk4.f(9);
                                gu gu2 = new gu(this, lk4);
                                if (!gu2.a) {
                                    gu2 = null;
                                }
                                guArray[n2] = gu2;
                                if (!ed.b(this.t[n2].b)) continue;
                                this.S = false;
                            }
                        }
                        catch (OutOfMemoryError outOfMemoryError) {
                            this.w = n2;
                            this.t[this.w] = null;
                            if (this.w != 0) break block18;
                            this.b = 4;
                        }
                    }
                    this.b = 4;
                }
                return true;
            }
            boolean bl2 = false;
            this.E = false;
            if (this.t == null || this.t.length == 0) {
                this.t = new gu[]{new gu(this, false)};
                bl2 = true;
            }
            if (lk2.d(1) == 0 && lk2.i(8) > 0) {
                lk2 = lk2.e(8, 0);
                gu.a(this.t[0], lk2.f(9), bl2);
            } else {
                gu.a(this.t[0], 0);
            }
            this.d = true;
            return true;
        }
        n = lk2.i(12);
        this.u = new lh[n];
        for (n2 = 0; n2 < n; ++n2) {
            lk4 = lk2.e(12, n2);
            this.u[n2] = new lh(this, lk4.g(1), lk4.g(2), ar.a(lk4, 3));
        }
        n = lk2.i(16);
        this.v = new lk[n];
        for (n2 = 0; n2 < n; ++n2) {
            this.v[n2] = lk2.e(16, n2);
        }
        if (this.c != null) {
            lk4 = lk2.f(10);
            if (lk4 != null) {
                this.c.a(lk4.d(17));
            }
            Hashtable hashtable = this.c.a(mo.i(lk2));
            if (lk4 != null) {
                n = lk4.i(1);
                for (n2 = 0; n2 < n; ++n2) {
                    lk3 = lk4.e(1, n2);
                    if (lk3 == null) continue;
                    long l = lk3.e(2);
                    if (hashtable != null && hashtable.containsKey(new Long(l))) continue;
                    this.c.a(lk3.c(3), l);
                }
            }
        }
        n = lk2.i(14);
        this.C = new int[n];
        this.D = new lk[n];
        for (n2 = 0; n2 < n; ++n2) {
            lk4 = lk2.e(14, n2);
            this.C[n2] = lk4.d(1);
            this.D[n2] = lk4;
        }
        this.d = true;
        return true;
    }

    public final void b(DataOutput dataOutput) {
        int n;
        lk lk2 = new lk(la.aC);
        lk lk3 = new lk(la.F);
        lk3.h(1, this.b);
        lk3.h(2, this.I);
        if (this.e != null) {
            lk3.b(3, ku.a(this.e));
        }
        lk3.h(4, this.f);
        lk3.h(13, this.B);
        lk3.a(5, mo.a(this.k, this.l));
        lk3.a(5, mo.a(this.m, this.n));
        for (n = 0; n < this.w; ++n) {
            lk lk4 = lk3.a(8);
            lk lk5 = new lk(la.H);
            this.t[n].e(lk5);
            lk4.a(9, lk5);
            lk3.a(8, lk4);
        }
        for (n = 0; n < this.u.length; ++n) {
            lk3.a(12, this.u[n].a());
        }
        for (n = 0; n < this.v.length; ++n) {
            lk3.a(16, this.v[n]);
        }
        if (this.c != null) {
            Hashtable hashtable = mo.i(lk3);
            lk lk6 = new lk(la.B);
            lk6.h(17, this.c.c);
            Enumeration enumeration = hashtable.keys();
            while (enumeration.hasMoreElements()) {
                long l = (Long)enumeration.nextElement();
                byte[] byArray = this.c.b(l);
                if (byArray == null || byArray.length == 0) continue;
                lk lk7 = lk6.a(1);
                lk7.b(2, l);
                lk7.b(3, byArray);
                lk6.a(1, lk7);
            }
            lk3.b(10, lk6);
        }
        for (n = 0; n < this.D.length; ++n) {
            lk3.a(14, this.D[n]);
        }
        lk2.b(2, lk3);
        lk2.a(3, this.k.a());
        lk2.a(3, this.m.a());
        if (!ed.b(this.v())) {
            lk2.b(1, this.v());
        }
        if (this.z != 3) {
            lk2.h(5, this.y);
        }
        lk2.h(4, this.x);
        dataOutput.writeInt(lk2.b());
        lk2.a((OutputStream)((Object)dataOutput));
    }

    public final lk e(int n) {
        lk lk2 = new lk(la.E);
        lk2.a(1, n);
        mo.a(lk2, this.k);
        mo.a(lk2, this.m);
        lk2.h(5, this.e());
        lk2.h(7, this.a);
        if (this.o != null) {
            lk2.b(9, this.o);
        }
        lk2.a(11, true);
        for (n = 0; n < this.D.length; ++n) {
            lk2.a(10, this.D[n]);
        }
        return lk2;
    }
}

