package defpackage;

import java.util.ArrayList;

/* renamed from: ᵮᵴˎ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C4233 implements InterfaceC3983 {

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public static final C3657 f15859 = new C3657(new C0617(new C2834(12), C0961.f4310), new C0617(new C2834(13), C0961.f4311));

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public final ArrayList f15860 = new ArrayList();

    @Override // defpackage.InterfaceC3983
    public final void clear() {
        this.f15860.clear();
    }

    @Override // defpackage.InterfaceC3983
    /* renamed from: ˇʼʤˎ */
    public final void mo8809(long j) {
        int i = 0;
        while (true) {
            ArrayList arrayList = this.f15860;
            if (i >= arrayList.size()) {
                return;
            }
            long j2 = ((C1808) arrayList.get(i)).f7282;
            if (j > j2 && j > ((C1808) arrayList.get(i)).f7283) {
                arrayList.remove(i);
                i--;
            } else if (j < j2) {
                return;
            }
            i++;
        }
    }

    @Override // defpackage.InterfaceC3983
    /* renamed from: ˏᵙ */
    public final AbstractC2692 mo8810(long j) {
        ArrayList arrayList = this.f15860;
        if (!arrayList.isEmpty()) {
            if (j >= ((C1808) arrayList.get(0)).f7282) {
                ArrayList arrayList2 = new ArrayList();
                for (int i = 0; i < arrayList.size(); i++) {
                    C1808 c1808 = (C1808) arrayList.get(i);
                    if (j >= c1808.f7282 && j < c1808.f7283) {
                        arrayList2.add(c1808);
                    }
                    if (j < c1808.f7282) {
                        break;
                    }
                }
                C4471 c4471M6697 = AbstractC2692.m6697(f15859, arrayList2);
                C4704 c4704M6701 = AbstractC2692.m6701();
                for (int i2 = 0; i2 < c4471M6697.f16685; i2++) {
                    c4704M6701.m3198(((C1808) c4471M6697.get(i2)).f7281);
                }
                return c4704M6701.m9892();
            }
        }
        C4421 c4421 = AbstractC2692.f10429;
        return C4471.f16684;
    }

    @Override // defpackage.InterfaceC3983
    /* renamed from: ᵥᵯˎ */
    public final long mo8811(long j) {
        int i = 0;
        long jMin = -9223372036854775807L;
        while (true) {
            ArrayList arrayList = this.f15860;
            if (i >= arrayList.size()) {
                break;
            }
            long j2 = ((C1808) arrayList.get(i)).f7282;
            long j3 = ((C1808) arrayList.get(i)).f7283;
            if (j < j2) {
                jMin = jMin == -9223372036854775807L ? j2 : Math.min(jMin, j2);
            } else {
                if (j < j3) {
                    jMin = jMin == -9223372036854775807L ? j3 : Math.min(jMin, j3);
                }
                i++;
            }
        }
        if (jMin != -9223372036854775807L) {
            return jMin;
        }
        return Long.MIN_VALUE;
    }

    @Override // defpackage.InterfaceC3983
    /* renamed from: ᵴᵳ */
    public final boolean mo8812(C1808 c1808, long j) {
        long j2 = c1808.f7282;
        ᵛᵾˏ.ᵯٴᵦ(j2 != -9223372036854775807L);
        ᵛᵾˏ.ᵯٴᵦ(c1808.f7280 != -9223372036854775807L);
        boolean z = j2 <= j && j < c1808.f7283;
        ArrayList arrayList = this.f15860;
        for (int size = arrayList.size() - 1; size >= 0; size--) {
            if (j2 >= ((C1808) arrayList.get(size)).f7282) {
                arrayList.add(size + 1, c1808);
                return z;
            }
        }
        arrayList.add(0, c1808);
        return z;
    }

    @Override // defpackage.InterfaceC3983
    /* renamed from: ᵻᵢﹳᵰ */
    public final long mo8813(long j) {
        ArrayList arrayList = this.f15860;
        if (arrayList.isEmpty()) {
            return -9223372036854775807L;
        }
        if (j < ((C1808) arrayList.get(0)).f7282) {
            return -9223372036854775807L;
        }
        long jMax = ((C1808) arrayList.get(0)).f7282;
        for (int i = 0; i < arrayList.size(); i++) {
            long j2 = ((C1808) arrayList.get(i)).f7282;
            long j3 = ((C1808) arrayList.get(i)).f7283;
            if (j3 > j) {
                if (j2 > j) {
                    break;
                }
                jMax = Math.max(jMax, j2);
            } else {
                jMax = Math.max(jMax, j3);
            }
        }
        return jMax;
    }
}
