/*
 * Decompiled with CFR 0.152.
 */
package com.l7tech.server.transport.http;

import com.l7tech.server.transport.http.TimeoutInputStream;
import java.io.InputStream;
import java.util.logging.Level;

class m {
    private final Object a = new Object();
    private boolean b;
    private boolean c;
    private boolean d;
    private long e;
    private long f;
    private final long g;
    private final InputStream h;
    private final long i;
    private final long j;
    private final int k;
    private static final String[] l;

    /*
     * WARNING - Removed try catching itself - possible behaviour change.
     */
    m(InputStream inputStream, long l2, long l3, int n2) {
        this.h = inputStream;
        this.g = System.currentTimeMillis();
        this.i = l2;
        this.j = l3;
        this.k = n2;
        Object object = this.a;
        synchronized (object) {
            this.b = true;
            this.c = false;
            this.d = false;
            this.e = 0L;
            this.f = 0L;
        }
    }

    /*
     * WARNING - Removed try catching itself - possible behaviour change.
     */
    void a(int n2) {
        if (n2 > 0) {
            Object object = this.a;
            synchronized (object) {
                this.e += (long)n2;
            }
        }
        if (n2 < 0) {
            Object object = this.a;
            synchronized (object) {
                this.c = true;
            }
        }
        TimeoutInputStream.a.log(Level.FINEST, l[0], new Object[]{n2, this.e});
    }

    /*
     * WARNING - Removed try catching itself - possible behaviour change.
     */
    void a(long l2) {
        if (l2 > 0L) {
            Object object = this.a;
            synchronized (object) {
                this.e += l2;
            }
        }
        if (l2 < 0L) {
            Object object = this.a;
            synchronized (object) {
                this.c = true;
            }
        }
        TimeoutInputStream.a.log(Level.FINEST, l[1], new Object[]{l2, this.e});
    }

    /*
     * WARNING - Removed try catching itself - possible behaviour change.
     */
    void a() {
        long l2 = System.currentTimeMillis();
        Object object = this.a;
        synchronized (object) {
            if (!this.b) {
                throw new IllegalStateException(l[2]);
            }
            this.b = false;
            this.f = l2;
        }
    }

    /*
     * WARNING - Removed try catching itself - possible behaviour change.
     */
    void b() {
        Object object = this.a;
        synchronized (object) {
            this.b = true;
        }
    }

    /*
     * WARNING - Removed try catching itself - possible behaviour change.
     */
    void c() {
        Object object = this.a;
        synchronized (object) {
            this.c = true;
        }
    }

    /*
     * WARNING - Removed try catching itself - possible behaviour change.
     */
    void d() {
        Object object = this.a;
        synchronized (object) {
            this.c = true;
        }
    }

    /*
     * WARNING - Removed try catching itself - possible behaviour change.
     */
    boolean e() {
        Object object = this.a;
        synchronized (object) {
            return this.c;
        }
    }

    /*
     * WARNING - Removed try catching itself - possible behaviour change.
     */
    void f() {
        Object object = this.a;
        synchronized (object) {
            this.d = true;
        }
    }

    /*
     * WARNING - Removed try catching itself - possible behaviour change.
     */
    boolean g() {
        Object object = this.a;
        synchronized (object) {
            return this.d;
        }
    }

    /*
     * WARNING - Removed try catching itself - possible behaviour change.
     */
    boolean b(long l2) {
        boolean bl2;
        Object object = this.a;
        synchronized (object) {
            boolean bl3;
            block7: {
                block6: {
                    if (!this.b) {
                        try {
                            if (l2 - this.f <= this.i) break block6;
                            bl3 = true;
                            break block7;
                        }
                        catch (IllegalStateException illegalStateException) {
                            throw m.a(illegalStateException);
                        }
                    }
                }
                bl3 = false;
            }
            bl2 = bl3;
        }
        return bl2;
    }

    /*
     * WARNING - Removed try catching itself - possible behaviour change.
     */
    void a(long l2, boolean[] blArray) {
        block9: {
            blArray[0] = false;
            blArray[1] = false;
            if (this.k > 0) {
                boolean bl2;
                long l3;
                Object object = this.a;
                synchronized (object) {
                    l3 = this.e;
                    bl2 = this.b;
                }
                long l4 = l2 - this.g;
                try {
                    if (l4 <= this.j || l4 <= 1000L) break block9;
                }
                catch (IllegalStateException illegalStateException) {
                    throw m.a(illegalStateException);
                }
                int n2 = (int)(l3 / (l4 / 1000L));
                try {
                    if (n2 < this.k) {
                        blArray[0] = true;
                        blArray[1] = bl2;
                    }
                }
                catch (IllegalStateException illegalStateException) {
                    throw m.a(illegalStateException);
                }
            }
        }
    }

    private static IllegalStateException a(IllegalStateException illegalStateException) {
        return illegalStateException;
    }

    /*
     * Enabled aggressive block sorting
     */
    static {
        String[] stringArray = new String[3];
        int n2 = 0;
        String string = "\u0004b{i:2\u0003&+ge(>\u000f,l5{y'F rae:tF\u0010ntdi!W?+wy=?\u0015bxz /;\u0014l2\u0004b{i:2\u0003&+ge(>\u000f,l5{y'F rae:tF\u0010ntdi!W?+wy=?\u0015bxz /;\u0014l&\u0010npn=(\u0007,hp &(F/~yt w\u0012*ypa-3\b%+er&8\n'f4";
        int n3 = "\u0004b{i:2\u0003&+ge(>\u000f,l5{y'F rae:tF\u0010ntdi!W?+wy=?\u0015bxz /;\u0014l2\u0004b{i:2\u0003&+ge(>\u000f,l5{y'F rae:tF\u0010ntdi!W?+wy=?\u0015bxz /;\u0014l&\u0010npn=(\u0007,hp &(F/~yt w\u0012*ypa-3\b%+er&8\n'f4".length();
        int n4 = 50;
        int n5 = -1;
        while (true) {
            int n6 = ++n5;
            stringArray[n2++] = m.a(104, m.a(string.substring(n6, n6 + n4)));
            if ((n5 += n4) >= n3) {
                l = stringArray;
                return;
            }
            n4 = string.charAt(n5);
        }
    }

    private static char[] a(String string) {
        char[] cArray = string.toCharArray();
        if (cArray.length < 2) {
            cArray = cArray;
            cArray[0] = (char)(cArray[0] ^ 0xE);
        }
        return cArray;
    }

    /*
     * Handled impossible loop by duplicating code
     * Enabled aggressive block sorting
     */
    private static String a(int n2, char[] cArray) {
        char[] cArray2;
        block11: {
            int n3;
            int n4;
            int n5;
            block10: {
                n5 = n2;
                cArray2 = cArray;
                n4 = cArray.length;
                n3 = 0;
                if (!true) break block10;
                n4 = n4;
                if (n4 <= n3) break block11;
            }
            do {
                n5 = n5;
                cArray2 = cArray2;
                int n6 = n3;
                cArray2[n6] = (char)(cArray2[n6] ^ (n5 ^ (switch (n3 % 7) {
                    case 0 -> 42;
                    case 1 -> 99;
                    case 2 -> 125;
                    case 3 -> 104;
                    case 4 -> 33;
                    case 5 -> 50;
                    default -> 14;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }
}

