/*
 * Decompiled with CFR 0.152.
 */
import com.google.googlenav.GoogleNav;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.util.Date;

/*
 * Duplicate member names - consider using --renamedupmembers true
 */
public final class ij
implements jf,
mt {
    private final w a;
    private final int a;
    private final cq c;
    private final cq d;
    private final kh d;
    private final oj e;
    private final w i;
    private final lh i;
    private final ck j;
    public final iv a;
    public final GoogleNav a;
    public final be a;
    public final gh a;
    public final gh b;
    public final gd b;
    public final iz b;
    public final bu c;
    public final iv c;
    public final iv d;
    public final ff d;
    private static int k = 10;
    private le a;
    private int b;
    private gu c;
    private gu d;
    private String e;
    private long g;
    public byte[] a;
    public String a;
    public le b;
    public String b;
    public int c;
    public le c;
    public int d;
    public cl e;
    public int e;
    public String f;

    public void l() {
        this.g = 0L;
    }

    public void f() {
        this.d = null;
        this.c = null;
        this.e = null;
        this.g = 0L;
    }

    public void a(String string, gu gu2, int n, int n2) {
        ij.c(gu2);
        this.e = null;
        gr.a("queryMemory").c(string);
        if (n != 0 || n2 != 0) {
            this.j.a(n, n2);
        }
        switch (gu2.a) {
            case 2: {
                if (this.i.m()) {
                    if (!this.i.i()) {
                        this.e = string;
                        this.g = System.currentTimeMillis() + (long)12000;
                        this.b.a(lh.d(579), 2);
                        break;
                    }
                    this.j.a(this.i.m());
                    break;
                }
                this.b.a(lh.d(329), 2);
                break;
            }
            case 1: {
                this.b.a(gu2.b);
                break;
            }
            case 0: {
                string = string + " loc: " + gu2.a;
                ij.c(gu2);
            }
        }
        if (this.e == null) {
            this.a(string, 2);
        }
    }

    /*
     * Enabled aggressive block sorting
     */
    public void a(gu gu2, gu gu3) {
        boolean bl2 = this.c != null;
        this.f();
        if (!bl2) {
            ij.b(gu2);
            ij.b(gu3);
        }
        if (!this.i.m() || bl2 && !this.i.i()) {
            if (gu2.a == 2) {
                gu2 = new gu(4, false);
            }
            if (gu3.a == 2) {
                gu3 = new gu(4, false);
            }
        }
        if (this.i.i() || gu2.a != 2 && gu3.a != 2) {
            if (gu2.a != 4 && gu3.a != 4) {
                this.b.a(new aq(this.a(gu2), this.a(gu3)), true);
                return;
            } else {
                this.b.a(gu2, gu3);
                return;
            }
        }
        if (gu2.a == 2 && gu3.a == 2) return;
        this.c = gu2;
        this.d = gu3;
        this.g = System.currentTimeMillis() + (long)12000;
    }

    /*
     * Enabled aggressive block sorting
     */
    public boolean a(gu gu2, String string, String string2, String string3, int n, int n2) {
        iv iv2;
        if (n != 0 || n2 != 0) {
            this.j.a(n, n2);
        }
        switch (gu2.a) {
            case 0: {
                this.a = string;
                this.b = string2;
                this.f = string3;
                this.a(gu2.a, 1);
                return true;
            }
            case 3: {
                iv2 = this.j.d();
                break;
            }
            case 2: {
                if (this.i.m()) {
                    if (!this.i.i()) {
                        this.a = string;
                        this.b = string2;
                        this.f = string3;
                        this.g = System.currentTimeMillis() + (long)12000;
                        return true;
                    }
                    iv2 = this.i.m();
                    break;
                }
            }
            default: {
                return false;
            }
            case 1: {
                iv2 = gu2.b;
            }
        }
        this.a.a(string, string2, null, string3, iv2, n, n2);
        this.h();
        return true;
    }

    public void a(ps ps2, ij ij2) {
        if (ps2.l == null) {
            if (ps2.l != 7) {
                this.a.a(ps2);
            }
            if (!ps2.g()) {
                boolean bl2;
                if (ps2.a() == 1 && (bl2 = ij2.a != null && ij2.g == 0L)) {
                    ar ar2 = (ar)ps2.c(0);
                    bl2 = ed.b(ij2.b);
                    String string = bl2 ? ar2.b() : ij2.b;
                    String string2 = bl2 ? ar2.c() : null;
                    ij2.a.a(ij2.a, string, string2, ij2.f, ar2.a(), 0, 0);
                } else if (ps2.a() > 0 || ps2.l()) {
                    if (ps2.l != 7) {
                        if (!ps2.l()) {
                            if (ps2.m() && !ps2.e) {
                                this.a(ps2, 0);
                            } else {
                                this.a(ps2, true);
                            }
                        }
                    } else {
                        this.c.a(ps2, true);
                    }
                }
            } else {
                this.a(ps2, 0);
            }
            if (ps2.a() == 1 && ps2.c(0).l() == 10) {
                ij.a((ar)ps2.c(0));
            }
            ij2.h();
            return;
        }
        br br2 = ps2.l;
        this.b.a(ps2, br2, 4);
    }

    public void a(gd gd2) {
        switch (this.b.l) {
            case 0: {
                ps ps2 = this.b.s();
                ps2.i = this.b.r().e;
                if (ps2.l != 7) {
                    this.a.a(ps2);
                }
                int n = ps2.l;
                String string = null;
                if (ps2.g()) {
                    if (ed.b(ps2.c)) {
                        string = this.b.u();
                        ar ar2 = (ar)ps2.c(this.b.s().b);
                        this.a(new ps(new ar[]{ar2}, ps2.i.a(ar2.a()), ps2.o, ps2.g), true);
                        ij.a(ar2);
                    } else {
                        string = this.b.t();
                        gd2.a(string, n, 4, -1, ps2.i, "o", null);
                    }
                } else if (ps2.m()) {
                    string = this.b.u();
                    this.a.o();
                    gd2.a(string, n, 5, -1, ps2.i, "o", null);
                }
                gr gr2 = gr.a("queryMemory");
                gr2.d(ps2.b);
                gr2.c(string);
            }
            default: {
                return;
            }
            case 1: 
        }
        gd2.a(this.b.m, true);
    }

    public void a(eb eb2) {
        switch (this.b.l) {
            case 0: {
                if (!this.b.q()) {
                    eb2.b("o");
                    return;
                }
                this.a(this.b.s(), true);
                return;
            }
            case 1: {
                eb2.e(this.b.m);
            }
            default: {
                return;
            }
            case 2: 
            case 3: 
        }
        eb2.d(this.b.m);
    }

    /*
     * Enabled aggressive block sorting
     */
    public void a(int n, gh gh2) {
        if (n != this.a) {
            if (n != this.d) {
                if (n != this.b) {
                    if (n != this.e) {
                        throw new RuntimeException("Unsupported direction: " + n);
                    }
                    n = gh2 != null ? gh2.c() : Integer.MAX_VALUE;
                    if ((n = ij.b(n, this.b.c() + this.b.c - this.c(this.b.c), this.a.c())) <= this.b.c()) return;
                    this.b.a = n - this.b.c;
                    return;
                }
                n = gh2 == null ? Integer.MIN_VALUE : gh2.e();
                if ((n = ij.a(n, this.b.a - this.b.c + this.c(this.b.c), this.a.a)) >= this.b.a) return;
                this.b.a = n;
                return;
            }
            n = gh2 != null ? gh2.a() : Integer.MAX_VALUE;
            if ((n = ij.b(n, this.b.a() + this.b.d - this.c(this.b.d), this.a.a())) <= this.b.a()) return;
            this.b.b = n - this.b.d;
            return;
        }
        n = gh2 != null ? gh2.f() : Integer.MIN_VALUE;
        if ((n = ij.a(n, this.b.b - this.b.d + this.c(this.b.d), this.a.b)) >= this.b.b) return;
        this.b.b = n;
    }

    /*
     * Enabled aggressive block sorting
     */
    public boolean a(int n) {
        if (n != this.a) {
            if (n != this.d) {
                if (n != this.e) {
                    if (n != this.b) {
                        throw new RuntimeException("Unsupported direction: " + n);
                    }
                    if (this.b.a == this.a.a) return true;
                    return false;
                }
                if (this.b.c() < this.a.c()) return false;
                return true;
            }
            if (this.b.a() < this.a.a()) return false;
            return true;
        }
        if (this.b.b == this.a.b) return true;
        return false;
    }

    /*
     * Enabled aggressive block sorting
     */
    public boolean a(gh gh2, int n) {
        if (n != this.a) {
            if (n != this.d) {
                if (n != this.b) {
                    if (n != this.e) {
                        throw new RuntimeException("Unsupported direction: " + n);
                    }
                    if (gh2.e() > this.b.c()) return true;
                    return false;
                }
                if (gh2.c() < this.b.a) return true;
                return false;
            }
            if (gh2.f() <= this.b.a()) return false;
            return true;
        }
        if (gh2.a() < this.b.b) return true;
        return false;
    }

    public ij(kh kh2) {
        this.f = "";
        this.b = "";
        this.d = kh2;
        this.i = jj.a(false);
        this.a = jj.a(1, true, -5592406);
        lh lh2 = lh.k();
        this.b = "v" + lh2.a();
        try {
            this.b = lh2.g().a("/splash_screen_icon.png");
            this.a = lh2.g().a("/splash_screen_text.png");
            int n = this.i.l() / 3;
            this.e = new oj(0, 0, 0, 0, this.i, this.i, this.a.a(), n, "");
            this.e.c = 1;
            this.e.c(-16777216, -16777216);
        }
        catch (IOException iOException) {
            throw new RuntimeException("/splash_screen_icon.png or /splash_screen_text.png");
        }
        gu gu2 = gu.g();
        if (gu2.y()) {
            this.f = "TEST VERSION - DO NOT DISTRIBUTE";
        }
        if (gu2.h()) {
            this.c = gu2.f();
        }
    }

    public void c(ht ht2) {
        int n;
        int n2 = this.d.b();
        int n3 = this.d.c();
        ht2.a(-1);
        ht2.c(0, 0, n2, n3);
        ht2.a(-16777216);
        String[] stringArray = ed.a(this.f, '\n');
        int n4 = this.i.l() + 4;
        int n5 = 0;
        for (n = 0; n < stringArray.length; ++n) {
            ht2.a(stringArray[n], 0, n5);
            n5 += n4;
        }
        n = (n3 - (this.b.b() + this.a.b() + this.e.s + this.i.l()) - k * 3) / 2;
        ht2.a(this.b, (n2 - this.b.a()) / 2, n);
        ht2.a(this.a, (n2 - this.a.a()) / 2, n += this.b.b() + k);
        this.e.a(ht2, (n2 - this.e.r) / 2, n += this.a.b() + k);
        ht2.a(this.a);
        ht2.a(this.b, (n2 - this.a.a(this.b)) / 2, n += this.e.s + k);
        if (this.c != null) {
            ht2.a(this.c, (n2 - this.c.a()) / 2, n3 - this.c.b() - k);
        }
        return;
    }

    public void a(ht ht2, int n, int n2) {
        long l = System.currentTimeMillis();
        if (this.g == 0L) {
            this.g = l + (long)500;
        }
        int n3 = l >= this.g ? (int)((l - this.g) % (long)this.c) : 0;
        n3 = this.b * n3 / this.c;
        ht2.a(this.d);
        int n4 = ht2.g();
        int n5 = ht2.h();
        ht2.a(n, ht2.f(), this.e, ht2.d());
        this.a.a(ht2, this.b, n - n3, n2);
        this.a.a(ht2, this.b, n + this.b - n3, n2);
        ht2.a(n4, ht2.f(), n5, ht2.d());
    }

    /*
     * Enabled aggressive block sorting
     */
    public boolean a(DataInput object) {
        Date date = null;
        int n = object.readUnsignedByte();
        if (n == 2) {
            date = new Date(object.readLong());
        }
        if (n != 3) {
            if (n == 0) return true;
            boolean bl2 = false;
            String string = object.readUTF();
            String string2 = object.readUTF();
            this.e = object.readUTF();
            String string3 = lh.d(568);
            if (n == 2) {
                string3 = ed.a(lh.d(569), date.toString());
                bl2 = new Date().getTime() >= date.getTime();
            }
            cq[] cqArray = null;
            if (this.e != null) {
                cqArray = !bl2 ? new cq[]{this.c, this.d} : new cq[]{this.c};
            }
            object = lh.d(565);
            if (this.e != null) {
                object = ed.a(lh.d(570), lh.d(571));
            }
            string3 = ed.a(lh.d(563), new String[]{string3, lh.k().a(), string, string2, object});
            this.b.a.a(lh.d(572), string3, bl2, cqArray, this);
            return true;
        }
        String string = object.readUTF();
        String string4 = object.readUTF();
        cq[] cqArray = !object.readBoolean() ? new cq[]{this.d} : null;
        if (string4.length() <= 0) return true;
        this.b.a.a(string, string4, true, cqArray, this);
        return true;
    }

    public static ij a(String string) {
        String[] stringArray = ed.a(string, '\u0004');
        iv iv2 = iv.a(stringArray[0]);
        string = stringArray.length > 1 ? stringArray[1] : "";
        String string2 = stringArray.length > 2 ? stringArray[2] : "";
        String string3 = stringArray.length > 3 ? stringArray[3] : "";
        iv iv3 = stringArray.length > 4 ? iv.a(stringArray[4]) : null;
        iv iv4 = stringArray.length > 5 ? iv.a(stringArray[5]) : null;
        return new ij(iv2, string, string2, string3, iv3, iv4);
    }

    public void b(int n, int n2, int n3, int n4) {
        boolean bl2 = false;
        int n5 = n2 + n4;
        int n6 = n + n3;
        if (this.b.d > n4 || this.b.b < n2 || this.b.a() > n5) {
            if (n2 >= this.b.b) {
                if (n5 > this.b.a()) {
                    bl2 = true;
                    this.b.b = Math.min(n2, n5 - this.b.d);
                }
            } else {
                this.b.b = Math.max(n2, n5 - this.b.d);
                bl2 = true;
            }
        }
        if (this.b.c > n3 || this.b.a < n || this.b.c() > n6) {
            if (n >= this.b.a) {
                if (n6 > this.b.c()) {
                    bl2 = true;
                    this.b.a = Math.min(n, n6 - this.b.c);
                }
            } else {
                bl2 = true;
                this.b.a = Math.max(n, n6 - this.b.c);
            }
        }
        if (bl2) {
            this.g();
        }
    }

    private void g() {
        int n = this.a.a;
        int n2 = this.a.c();
        int n3 = this.a.b;
        int n4 = this.a.a();
        if (this.b.c() > n2) {
            this.b.a = n2 - this.b.c;
        }
        if (this.b.a < n) {
            this.b.a = n;
        }
        if (this.b.a() > n4) {
            this.b.b = n4 - this.b.d;
        }
        if (this.b.b < n3) {
            this.b.b = n3;
        }
    }

    public boolean a(int n, int n2) {
        if (this.b.c == n && this.b.d == n2) {
            return false;
        }
        this.b.c = n;
        this.b.d = n2;
        this.g();
        return true;
    }

    public final le a(int n) {
        this.e = n;
        if (this.b == null && this.a != null) {
            byte[] byArray = gu.a(this.a);
            this.b = lh.k().g().a(byArray, 0, byArray.length);
        }
        return this.b;
    }

    public final void a(byte[] byArray) {
        this.a = byArray;
        if (byArray == null) {
            if (this.d != 2) {
                this.d = 0;
            }
            return;
        }
        this.d = 3;
        this.c = null;
    }

    public iu a() {
        if (!this.b.h()) {
            if (!this.a.h()) {
                if (!this.c.h()) {
                    if (!this.d.h()) {
                        if (!this.e.h()) {
                            return null;
                        }
                        return this.e;
                    }
                    return this.d;
                }
                return this.c;
            }
            return this.a;
        }
        return this.b;
    }

    public void a(iu iu2) {
        if (this.e != iu2) {
            this.e.o();
        }
        if (this.a != iu2) {
            this.a.o();
        }
        if (this.c != iu2 && this.b != iu2) {
            this.c.o();
            this.b.o();
        }
        if (this.d != iu2) {
            this.d.o();
        }
    }

    public fk a(gu gu2) {
        switch (gu2.a) {
            case 1: {
                return fk.a(gu2.a, gu2.b);
            }
            case 3: {
                return fk.a(this.j.d());
            }
            case 2: {
                return fk.b(this.i.m());
            }
        }
        return null;
    }

    public void a(cq cq2, Object object) {
        if (!cq2.equals(this.c)) {
            if (cq2.equals(this.d)) {
                this.b.x();
                return;
            }
            this.b.s();
            return;
        }
        try {
            this.a.a(this.e);
            Thread.yield();
            this.b.s();
            return;
        }
        catch (IOException iOException) {
            this.b.a.a(lh.d(318), lh.d(567), true, null, this);
            return;
        }
    }

    public boolean b() {
        if (this.g != 0L && (this.i.i() || System.currentTimeMillis() > this.g)) {
            if (this.e != null) {
                if (this.i.i()) {
                    this.j.a(this.i.m());
                }
                this.a(this.e, 2);
                return true;
            }
            if (this.c != null) {
                this.a(this.c, this.d);
            }
            return true;
        }
        return false;
    }

    public boolean k() {
        return this.a.d > this.b.d;
    }

    public boolean h() {
        return this.a.c > this.b.c;
    }

    public boolean c(int n, int n2, int n3, int n4) {
        n3 = n + n3;
        return n2 + n4 >= this.b.b && n2 <= this.b.a() && n3 >= this.b.a && n <= this.b.c();
    }

    public boolean g() {
        iu iu2 = this.a();
        if (iu2 != null) {
            return iu2.p();
        }
        return false;
    }

    public void b(ht ht2) {
        iu iu2 = this.a();
        if (iu2 != null) {
            iu2.e(ht2);
        }
    }

    public void a(ht ht2) {
        iu iu2 = this.a();
        if (iu2 != null) {
            iu2.b(ht2);
            if (iu2 != this.e && this.e != null) {
                this.e.d(ht2);
            }
            iu2.d(ht2);
        }
    }

    public ij(gd gd2, bi bi2, ck ck2, lh lh2, jt jt2, lh lh3, jt jt3, hj hj2, cx cx2) {
        this.a = new be(gd2, ck2, lh2, jt2);
        this.b = new iz(gd2, ck2, lh2, jt2);
        this.c = new bu(gd2, bi2, ck2, lh2, hj2, jt2, lh3, jt3, cx2);
        lh3.b = this.c;
        this.d = new ff(gd2, ck2, lh2, jt2);
        this.e = new cl(gd2, ck2, lh2);
        this.e.c(bj.a());
    }

    public ij(iv iv2, String string, String string2, String string3, iv iv3, iv iv4) {
        this.a = iv2;
        this.a = string;
        this.b = string2;
        this.f = string3;
        this.d = iv3;
        this.c = iv4;
    }

    public ij(lh lh2, ck ck2, be be2, gd gd2) {
        this.i = lh2;
        this.j = ck2;
        this.a = be2;
        this.b = gd2;
    }

    public ij(w w2, String string, int n, int n2) {
        this.a = w2;
        this.d = n2;
        this.b = string;
        this.e = n;
        this.c = (string.length() + "       ".length()) * 1000 / 8;
        this.b = w2.a(string) + w2.a("       ");
    }

    public ij(int n, int n2, int n3, int n4) {
        this.a = new gh();
        this.b = new gh();
        this.c = 25;
        this.a = n;
        this.d = n2;
        this.b = n3;
        this.e = n4;
    }

    public void a(int n, int n2, int n3, int n4) {
        this.a.a = n;
        this.a.b = n2;
        this.a.c = n3;
        this.a.d = n4;
        this.g();
    }

    public void b(int n, int n2) {
        this.b.a = n;
        this.b.b = n2;
    }

    public void b(mo mo2) {
        this.b.a(mo2, 2);
    }

    public void a(mo mo2) {
        this.b.a(mo2, 1);
    }

    public void c(mo mo2) {
        this.b.a(mo2, 3);
    }

    private void a(ps ps2, boolean bl2) {
        this.a.a(ps2, bl2);
    }

    private static int a(int n, int n2, int n3) {
        return Math.max(n, Math.max(n2, n3));
    }

    private static int b(int n, int n2, int n3) {
        return Math.min(n, Math.min(n2, n3));
    }

    private int c(int n) {
        return n * this.c / 100;
    }

    public boolean a(short s) {
        return this.a.a(s);
    }

    public void a(StringBuffer stringBuffer) {
        stringBuffer.append(this.a.toString());
        stringBuffer.append('\u0004');
        stringBuffer.append(ed.c(this.a));
        stringBuffer.append('\u0004');
        stringBuffer.append(ed.c(this.b));
        stringBuffer.append('\u0004');
        stringBuffer.append(ed.c(this.f));
        stringBuffer.append('\u0004');
        if (this.d != null) {
            stringBuffer.append(this.d.toString());
        }
        stringBuffer.append('\u0004');
        if (this.c != null) {
            stringBuffer.append(this.c.toString());
        }
    }

    private static void b(gu gu2) {
        gp gp2 = gp.a("locationMemory");
        if (gu2.a != null) {
            gp2.a(fk.a(gu2.a));
        }
    }

    private static void c(gu gu2) {
        gr gr2 = gr.a("queryMemory");
        if (gu2.a != null) {
            gr2.c(gu2.a);
        }
    }

    public final void c() {
        if (this.d != 3) {
            this.d = 2;
        }
    }

    public final void b() {
        if (this.d == 1) {
            this.d = 0;
        }
    }

    public final void a() {
        if (this.d == 0) {
            this.d = 1;
        }
    }

    public boolean a() {
        return !ed.b(this.a);
    }

    public boolean e() {
        return this.a() != this.e;
    }

    public boolean f() {
        return this.a().G();
    }

    public void k() {
        this.a.e_();
    }

    public void j() {
        this.a.d_();
    }

    public ij() {
    }

    public boolean d() {
        int cfr_ignored_0 = (null).length;
        return false;
    }

    public boolean y_() {
        return false;
    }

    public boolean z_() {
        return false;
    }

    public boolean A_() {
        return false;
    }

    public int z() {
        return 4;
    }

    public void h() {
        this.b = null;
        this.a = null;
        this.f = null;
    }

    public final void d() {
        this.b = null;
        this.c = null;
    }

    public final void e() {
        this.d();
        this.a((byte[])null);
    }

    public void i() {
        ++this.e;
        this.e.a(100 * this.e / 10);
        this.d.d();
    }

    public void a(Exception exception) {
        this.f = "Error: \n";
        this.f = this.f + exception.getMessage();
        this.f = this.f + "\n";
        this.f = this.f + "Exception: \n";
        this.f = this.f + exception.getClass().toString();
        this.f = this.f + "\n";
        this.f = this.f + "Init Stage: " + this.e;
    }

    public void b(int n) {
        this.a(n, null);
    }

    public boolean b(gh gh2) {
        return this.c(gh2.e(), gh2.f(), gh2.d(), gh2.b());
    }

    public void a(gh gh2) {
        this.b(gh2.e(), gh2.f(), gh2.d(), gh2.b());
    }

    public void a(DataOutput dataOutput) {
        dataOutput.writeUTF(this.a.b());
        dataOutput.writeUTF(lh.k().a());
    }

    private void a(String string, int n) {
        this.b.a(string, n, 2, -1, null, "o", null);
    }

    private void a(ps ps2, int n) {
        this.b.a(ps2, true, n);
    }

    public void a(int n, int n2) {
        this.a.N();
        this.c.N();
        this.d.N();
        this.e.N();
        this.b.N();
    }

    public ij(GoogleNav googleNav, gd gd2) {
        this.a = googleNav;
        this.b = gd2;
        this.c = cq.a(lh.d(571), cq.c, 1);
        this.d = cq.a(lh.d(43), cq.b, 2);
    }

    private static void a(ar ar2) {
        gp.a("locationMemory").a(fk.a(ar2));
    }
}

