package defpackage;

import java.util.Iterator;
import java.util.concurrent.ConcurrentLinkedQueue;

/* renamed from: ˆᵸˑ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C0898 extends AbstractC1131 {

    /* renamed from: ˇʼʤˎ, reason: contains not printable characters */
    public final /* synthetic */ int f4073 = 1;

    /* renamed from: ˏˋٴ, reason: contains not printable characters */
    public final /* synthetic */ Object f4074;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public C0898(String str, InterfaceC4622 interfaceC4622) {
        super(str);
        this.f4074 = interfaceC4622;
    }

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public C0898(C5557 c5557, String str) {
        super(str);
        this.f4074 = c5557;
    }

    @Override // defpackage.AbstractC1131
    /* renamed from: ᵥᵯˎ */
    public final long mo2328() {
        switch (this.f4073) {
            case 0:
                C5557 c5557 = (C5557) this.f4074;
                long jNanoTime = System.nanoTime();
                long j = (jNanoTime - c5557.f20843) + 1;
                Iterator it = ((ConcurrentLinkedQueue) c5557.f20845).iterator();
                C0700 c0700 = null;
                long j2 = Long.MAX_VALUE;
                int i = 0;
                C0700 c07002 = null;
                C0700 c07003 = null;
                int i2 = 0;
                while (it.hasNext()) {
                    C0700 c07004 = (C0700) it.next();
                    synchronized (c07004) {
                        if (c5557.m11193(c07004, jNanoTime) > 0) {
                            i2++;
                        } else {
                            long j3 = c07004.f3405;
                            if (j3 < j) {
                                j = j3;
                                c07002 = c07004;
                            }
                            i++;
                            if (j3 < j2) {
                                j2 = j3;
                                c07003 = c07004;
                            }
                        }
                    }
                }
                if (c07002 != null) {
                    c0700 = c07002;
                } else if (i > 5) {
                    j = j2;
                    c0700 = c07003;
                } else {
                    j = -1;
                }
                if (c0700 == null) {
                    if (c07003 != null) {
                        return (j2 + c5557.f20843) - jNanoTime;
                    }
                    if (i2 > 0) {
                        return c5557.f20843;
                    }
                    return -1L;
                }
                synchronized (c0700) {
                    if (c0700.f3399.isEmpty() && c0700.f3405 == j) {
                        c0700.f3410 = true;
                        ((ConcurrentLinkedQueue) c5557.f20845).remove(c0700);
                        AbstractC4061.m8927(c0700.f3398);
                        if (!((ConcurrentLinkedQueue) c5557.f20845).isEmpty()) {
                            return 0L;
                        }
                        ((C0897) c5557.f20844).m3018();
                        return 0L;
                    }
                    return 0L;
                }
            default:
                ((InterfaceC4622) this.f4074).mo1401();
                return -1L;
        }
    }
}
