package defpackage;

import java.io.IOException;
import java.util.ArrayDeque;
import java.util.TimeZone;
import okhttp3.internal.http2.StreamResetException;

/* JADX INFO: renamed from: ʾʽᵥ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public final class C0217 implements InterfaceC2210 {

    /* JADX INFO: renamed from: ʿٴˇ, reason: contains not printable characters */
    public final C2158 f1699;

    /* JADX INFO: renamed from: ˈᵲᵢ, reason: contains not printable characters */
    public boolean f1700;

    /* JADX INFO: renamed from: ˉᵵᵜ, reason: contains not printable characters */
    public IOException f1701;

    /* JADX INFO: renamed from: ˌᴵ, reason: contains not printable characters */
    public final int f1702;

    /* JADX INFO: renamed from: ˌᵨʠᵫ, reason: contains not printable characters */
    public final C3439 f1703;

    /* JADX INFO: renamed from: ˑˊᵲ, reason: contains not printable characters */
    public final C2158 f1704;

    /* JADX INFO: renamed from: ᵔᵖᵹᵫ, reason: contains not printable characters */
    public final C2744 f1705;

    /* JADX INFO: renamed from: ᵜᵪʾ, reason: contains not printable characters */
    public final C4901 f1706;

    /* JADX INFO: renamed from: ᵠˏˏ, reason: contains not printable characters */
    public int f1707;

    /* JADX INFO: renamed from: ᵨᵼⁱ, reason: contains not printable characters */
    public long f1708;

    /* JADX INFO: renamed from: ᵯᵷʽ, reason: contains not printable characters */
    public long f1709;

    /* JADX INFO: renamed from: ᵶˇᵱ, reason: contains not printable characters */
    public final ArrayDeque f1710;

    /* JADX INFO: renamed from: ᵸˆˁ, reason: contains not printable characters */
    public final C5198 f1711;

    public C0217(int i, C4901 c4901, boolean z, boolean z2, C0661 c0661) {
        this.f1702 = i;
        this.f1706 = c4901;
        this.f1705 = new C2744(i);
        this.f1709 = c4901.f18660.m6660();
        ArrayDeque arrayDeque = new ArrayDeque();
        this.f1710 = arrayDeque;
        this.f1703 = new C3439(this, c4901.f18653.m6660(), z2);
        this.f1711 = new C5198(this, z);
        this.f1704 = new C2158(this);
        this.f1699 = new C2158(this);
        if (c0661 == null) {
            if (m1383()) {
                return;
            }
            ᵕᵩʽᵲ.ᵪᵹᵥᵻ("remotely-initiated streams should have headers");
            throw null;
        }
        if (m1383()) {
            ᵕᵩʽᵲ.ᵪᵹᵥᵻ("locally-initiated streams shouldn't have headers yet");
            throw null;
        }
        arrayDeque.add(c0661);
    }

    /* JADX WARN: Removed duplicated region for block: B:16:0x001c  */
    /* JADX INFO: renamed from: ʽˈˋ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void m1382() {
        boolean z;
        boolean zM1392;
        TimeZone timeZone = AbstractC1190.f5068;
        synchronized (this) {
            try {
                C3439 c3439 = this.f1703;
                if (c3439.f13269 || !c3439.f13271) {
                    z = false;
                } else {
                    C5198 c5198 = this.f1711;
                    if (c5198.f19582 || c5198.f19583) {
                        z = true;
                    }
                }
                zM1392 = m1392();
            } catch (Throwable th) {
                throw th;
            }
        }
        if (z) {
            m1391(9, null);
        } else {
            if (zM1392) {
                return;
            }
            this.f1706.m10188(this.f1702);
        }
    }

    /* JADX INFO: renamed from: ˊᵫᵗ, reason: contains not printable characters */
    public final boolean m1383() {
        boolean z = (this.f1702 & 1) == 1;
        this.f1706.getClass();
        return true == z;
    }

    /* JADX INFO: renamed from: ːˏᵟᵯ, reason: contains not printable characters */
    public final void m1384() throws StreamResetException {
        C5198 c5198 = this.f1711;
        if (c5198.f19583) {
            C1685.m4568("stream closed");
            return;
        }
        if (c5198.f19582) {
            C1685.m4568("stream finished");
        } else if (m1389() != 0) {
            IOException iOException = this.f1701;
            if (iOException == null) {
                throw new StreamResetException(m1389());
            }
        }
    }

    /* JADX INFO: renamed from: ᵨᵣ, reason: contains not printable characters */
    public final boolean m1385(int i, IOException iOException) {
        TimeZone timeZone = AbstractC1190.f5068;
        synchronized (this) {
            if (m1389() != 0) {
                return false;
            }
            this.f1707 = i;
            this.f1701 = iOException;
            notifyAll();
            if (this.f1703.f13269) {
                if (this.f1711.f19582) {
                    return false;
                }
            }
            this.f1706.m10188(this.f1702);
            return true;
        }
    }

    /* JADX INFO: renamed from: ᵮᵣᵗˈ, reason: contains not printable characters */
    public final void m1386(int i) {
        synchronized (this) {
            if (m1389() == 0) {
                this.f1707 = i;
                notifyAll();
            }
        }
    }

    /* JADX INFO: renamed from: ᵱᵽʡᵚ, reason: contains not printable characters */
    public final void m1387(C0661 c0661, boolean z) {
        boolean zM1392;
        TimeZone timeZone = AbstractC1190.f5068;
        synchronized (this) {
            try {
                if (this.f1700 && c0661.m2425(":status") == null && c0661.m2425(":method") == null) {
                    this.f1703.getClass();
                } else {
                    this.f1700 = true;
                    this.f1710.add(c0661);
                }
                if (z) {
                    this.f1703.f13269 = true;
                }
                zM1392 = m1392();
                notifyAll();
            } catch (Throwable th) {
                throw th;
            }
        }
        if (zM1392) {
            return;
        }
        this.f1706.m10188(this.f1702);
    }

    @Override // defpackage.InterfaceC2210
    /* JADX INFO: renamed from: ᵲᵶᵳˈ, reason: contains not printable characters */
    public final InterfaceC3906 mo1388() {
        return this.f1703;
    }

    /* JADX INFO: renamed from: ᵵᵽ, reason: contains not printable characters */
    public final int m1389() {
        int i;
        synchronized (this) {
            i = this.f1707;
        }
        return i;
    }

    @Override // defpackage.InterfaceC2210
    /* JADX INFO: renamed from: ᵶᵥᵝ, reason: contains not printable characters */
    public final InterfaceC1636 mo1390() {
        return this.f1711;
    }

    /* JADX INFO: renamed from: ᵷᵺʾᵖ, reason: contains not printable characters */
    public final void m1391(int i, IOException iOException) {
        if (m1385(i, iOException)) {
            this.f1706.f18664.m5767(this.f1702, i);
        }
    }

    /* JADX INFO: renamed from: ᵻʽᵯ, reason: contains not printable characters */
    public final boolean m1392() {
        synchronized (this) {
            try {
                if (m1389() != 0) {
                    return false;
                }
                C3439 c3439 = this.f1703;
                if (c3439.f13269 || c3439.f13271) {
                    C5198 c5198 = this.f1711;
                    if (c5198.f19582 || c5198.f19583) {
                        if (this.f1700) {
                            return false;
                        }
                    }
                }
                return true;
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    /* JADX INFO: renamed from: ᵻˈᵦʼ, reason: contains not printable characters */
    public final void m1393(int i) {
        if (m1385(i, null)) {
            this.f1706.m10190(this.f1702, i);
        }
    }
}
