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

/*
 * Duplicate member names - consider using --renamedupmembers true
 */
public class mg
implements jf,
df,
ob,
Runnable {
    public static final byte[] a;
    private final int a;
    private final ob c;
    public final ke b;
    private static String b;
    private String a;
    private Hashtable b;
    private byte[] b;
    private Vector c;
    private int c;
    private long f;
    public long b;
    public jm[][] c;
    public boolean e;

    public void b(int n) {
    }

    public void a(int n) {
    }

    public mg(int n) {
        this.b = System.currentTimeMillis();
        this.a = n;
    }

    public void a(DataInput dataInput) {
        int n;
        byte[] byArray;
        block3: {
            byArray = new byte[4];
            dataInput.readFully(byArray);
            for (n = 0; n < byArray.length; ++n) {
                if (byArray[n] == a[n]) {
                    continue;
                }
                break block3;
            }
            int n2 = dataInput.readUnsignedShort();
            jm[][] jmArray = new jm[n2][];
            for (n = 0; n < n2; ++n) {
                dataInput.readUTF();
                dataInput.readUTF();
                this.e = dataInput.readBoolean();
                jmArray[n] = jm.a(this.b, dataInput);
            }
            this.a(System.currentTimeMillis(), jmArray);
            return;
        }
        throw new IOException("Bad traffic header @ " + n + " = " + byArray[n]);
    }

    public boolean a(DataInput dataInput) {
        int n = 0;
        try {
            String string;
            int n2 = (int)(System.currentTimeMillis() - this.b);
            this.a(dataInput.readUnsignedShort());
            int n3 = 0;
            int n4 = 0;
            int n5 = 0;
            if (this.a == 26) {
                n3 = dataInput.readUnsignedByte();
                if (n3 != 0) {
                    throw new IOException("Server returned: " + n3);
                }
                n3 = dataInput.readUnsignedShort();
            }
            for (n = 0; n < n3; ++n) {
                ke ke2 = ke.a(dataInput);
                byte[] byArray = new byte[dataInput.readUnsignedShort()];
                dataInput.readFully(byArray);
                if (this.a(n, ke2, byArray)) break;
                n4 += byArray.length;
                n5 |= 1 << ke2.d;
            }
            String string2 = null;
            int n6 = (int)(System.currentTimeMillis() - this.b);
            if (!ds.m()) {
                if (this.z_()) {
                    string = "t";
                } else {
                    string = "t-pc";
                    string2 = "pc";
                }
            } else {
                string = "t-sv";
                string2 = "sv";
            }
            me.a((short)22, string, "" + n6);
            Vector<String> vector = new Vector<String>();
            if ((n5 & 4) != 0) {
                vector.addElement("m");
            }
            if ((n5 & 8) != 0) {
                vector.addElement("s");
            }
            if ((n5 & 0x40) != 0) {
                vector.addElement("h");
            }
            if ((n5 & 0x10) != 0 || (n5 & 0x80) != 0) {
                vector.addElement("t");
            }
            gu.a(ed.a(vector, ","), this.c, n2, n6, n3, n4, string2);
            return true;
        }
        finally {
            this.b(n);
        }
    }

    public w a(int n, boolean bl2, boolean bl3, int n2, boolean bl4) {
        int n3 = n != 3 ? (n != 2 ? 1 : 2) : 3;
        w w2 = this.c.a(n, bl2, bl3, n2, bl4);
        String string = lh.o() + "_" + n + "_" + bl2 + "_" + bl3 + "_" + b;
        return new gu(w2, string, n3, 1, this.b, b);
    }

    public final void a(ke[] keArray, DataOutput dataOutput) {
        if (this.a == 26) {
            dataOutput.writeShort(keArray.length);
            dataOutput.writeShort(1);
            dataOutput.writeShort(128);
            dataOutput.writeLong(175);
        }
        for (int i = 0; i < keArray.length; ++i) {
            keArray[i].a(dataOutput);
        }
        this.c = (int)(System.currentTimeMillis() - this.b);
    }

    private synchronized void a() {
        for (int i = 0; i < this.c.size(); ++i) {
            ((aq)this.c.elementAt(i)).a(this.b, this.a);
        }
        this.c = 1;
    }

    public synchronized void a(aq aq2) {
        if (this.c != 1) {
            this.c.addElement(aq2);
            return;
        }
        aq2.a(this.b, this.a);
    }

    public synchronized void a(String string, am am2) {
        if ("MasfAuthCaptcha".equals(string)) {
            if (am2.a()) {
                this.b = am2.b();
            }
            this.a();
        }
    }

    public synchronized void d(String string) {
        if ("MasfAuthCaptcha".equals(string)) {
            this.a();
        }
    }

    public boolean c() {
        return this.c != null && this.c.length == 0;
    }

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

    public long b() {
        if (this.c()) {
            return System.currentTimeMillis();
        }
        return this.f;
    }

    public mg(String string) {
        this.c = new Vector();
        this.a = string;
        this.c = 0;
        oi.a("www.google.com/accounts/Captcha?ctoken=" + string, null, null, "MasfAuthCaptcha", this);
    }

    public mg(ob ob2) {
        this.b = new Hashtable();
        this.c = ob2;
    }

    public mg(ke ke2) {
        this.e = true;
        this.b = ke2;
    }

    public mg(bq bq2) {
    }

    public static void a(String string) {
        b = string;
    }

    public final int z() {
        return this.a;
    }

    public final boolean A_() {
        return false;
    }

    public boolean a(int n, ke ke2, byte[] byArray) {
        return false;
    }

    public void a(long l, jm[][] jmArray) {
        this.f = l;
        this.c = jmArray;
    }

    public static w a(w w2, String string, int n, int n2) {
        return new gu(w2, null, n, n2, null, string);
    }

    public void run() {
    }

    static {
        b = "";
        a = new byte[]{84, 82, 65, 70};
    }
}

