package defpackage;

import android.net.Uri;
import android.os.SystemClock;
import androidx.media3.exoplayer.source.BehindLiveWindowException;
import java.util.Collections;
import java.util.List;
import java.util.Map;

/* renamed from: ᵙᵬᵔᵜ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C2614 implements InterfaceC5009 {

    /* renamed from: ˇʼʤˎ, reason: contains not printable characters */
    public InterfaceC5264 f10109;

    /* renamed from: ˎˏʜʾ, reason: contains not printable characters */
    public int f10110;

    /* renamed from: ˏˋٴ, reason: contains not printable characters */
    public C1374 f10111;

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public final C4823[] f10112;

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public final InterfaceC4619 f10113;

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public final int f10114;

    /* renamed from: ᵹᵝᵶ, reason: contains not printable characters */
    public BehindLiveWindowException f10115;

    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    public final InterfaceC2569 f10116;

    public C2614(InterfaceC4619 interfaceC4619, C1374 c1374, int i, InterfaceC5264 interfaceC5264, InterfaceC2569 interfaceC2569, ᵼᵫᵧˀ r30, boolean z) {
        C4401[] c4401Arr;
        this.f10113 = interfaceC4619;
        this.f10111 = c1374;
        this.f10114 = i;
        this.f10109 = interfaceC5264;
        this.f10116 = interfaceC2569;
        C5300 c5300 = c1374.f5651[i];
        this.f10112 = new C4823[interfaceC5264.length()];
        for (int i2 = 0; i2 < this.f10112.length; i2++) {
            int iMo5376 = interfaceC5264.mo5376(i2);
            C3446 c3446 = c5300.f19835[iMo5376];
            if (c3446.f12915 != null) {
                C4190 c4190 = c1374.f5649;
                c4190.getClass();
                c4401Arr = c4190.f15663;
            } else {
                c4401Arr = null;
            }
            C4401[] c4401Arr2 = c4401Arr;
            int i3 = c5300.f19830;
            int i4 = i3 == 2 ? 4 : 0;
            long j = c5300.f19828;
            long j2 = c1374.f5650;
            this.f10112[i2] = new C4823(new C2851(r30, !z ? 35 : 3, null, new C0904(iMo5376, i3, j, -9223372036854775807L, j2, j2, c3446, 0, c4401Arr2, i4, null, null), C4471.f16684, null), c5300.f19830, c3446);
        }
    }

    @Override // defpackage.InterfaceC5009
    /* renamed from: ˇʼʤˎ, reason: contains not printable characters */
    public final void mo6577(AbstractC4261 abstractC4261) {
    }

    @Override // defpackage.InterfaceC5009
    /* renamed from: ˎˏʜʾ, reason: contains not printable characters */
    public final int mo6578(long j, List list) {
        return (this.f10115 != null || this.f10109.length() < 2) ? list.size() : this.f10109.mo5377(j, list);
    }

    @Override // defpackage.InterfaceC5009
    /* renamed from: ˏˋٴ, reason: contains not printable characters */
    public final boolean mo6579(long j, AbstractC4261 abstractC4261, List list) {
        if (this.f10115 != null) {
            return false;
        }
        return this.f10109.mo5366(j, abstractC4261, list);
    }

    @Override // defpackage.InterfaceC5009
    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public final long mo6580(long j, C4110 c4110) {
        C5300 c5300 = this.f10111.f5651[this.f10114];
        int iM8119 = AbstractC3558.m8119(c5300.f19833, j, true);
        long[] jArr = c5300.f19833;
        long j2 = jArr[iM8119];
        return c4110.m8997(j, j2, (j2 >= j || iM8119 >= c5300.f19836 - 1) ? j2 : jArr[iM8119 + 1]);
    }

    @Override // defpackage.InterfaceC5009
    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public final void mo6581() {
        for (C4823 c4823 : this.f10112) {
            c4823.f17909.mo1576();
        }
    }

    @Override // defpackage.InterfaceC5009
    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public final void mo6582() throws BehindLiveWindowException {
        BehindLiveWindowException behindLiveWindowException = this.f10115;
        if (behindLiveWindowException != null) {
            throw behindLiveWindowException;
        }
        this.f10113.mo5627();
    }

    @Override // defpackage.InterfaceC5009
    /* renamed from: ᵹᵝᵶ, reason: contains not printable characters */
    public final boolean mo6583(AbstractC4261 abstractC4261, boolean z, C2124 c2124, C1899 c1899) {
        long jElapsedRealtime = SystemClock.elapsedRealtime();
        int length = this.f10109.length();
        int i = 0;
        for (int i2 = 0; i2 < length; i2++) {
            if (this.f10109.mo5363(jElapsedRealtime, i2)) {
                i++;
            }
        }
        C3103 c3103 = new C3103(1, 0, length, i);
        c1899.getClass();
        C3160 c3160M5317 = C1899.m5317(c3103, c2124);
        if (z && c3160M5317 != null && c3160M5317.f11993 == 2) {
            InterfaceC5264 interfaceC5264 = this.f10109;
            if (interfaceC5264.mo5364(c3160M5317.f11992, interfaceC5264.mo5379(abstractC4261.f15966))) {
                return true;
            }
        }
        return false;
    }

    @Override // defpackage.InterfaceC5009
    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    public final void mo6584(C5196 c5196, long j, List list, C4164 c4164) {
        List list2;
        int iMo1783;
        long jM10956;
        InterfaceC5264 interfaceC5264;
        if (this.f10115 != null) {
            return;
        }
        C5300[] c5300Arr = this.f10111.f5651;
        int i = this.f10114;
        C5300 c5300 = c5300Arr[i];
        int i2 = c5300.f19836;
        long[] jArr = c5300.f19833;
        if (i2 == 0) {
            c4164.f15572 = !r4.f5656;
            return;
        }
        if (list.isEmpty()) {
            iMo1783 = AbstractC3558.m8119(jArr, j, true);
            list2 = list;
        } else {
            list2 = list;
            iMo1783 = (int) (((AbstractC3168) list2.get(list.size() - 1)).mo1783() - this.f10110);
            if (iMo1783 < 0) {
                this.f10115 = new BehindLiveWindowException();
                return;
            }
        }
        if (iMo1783 >= c5300.f19836) {
            c4164.f15572 = !this.f10111.f5656;
            return;
        }
        long j2 = c5196.f19397;
        long j3 = j - j2;
        C1374 c1374 = this.f10111;
        if (c1374.f5656) {
            C5300 c53002 = c1374.f5651[i];
            int i3 = c53002.f19836 - 1;
            jM10956 = (c53002.m10956(i3) + c53002.f19833[i3]) - j2;
        } else {
            jM10956 = -9223372036854775807L;
        }
        int length = this.f10109.length();
        InterfaceC2379[] interfaceC2379Arr = new InterfaceC2379[length];
        int i4 = 0;
        while (true) {
            interfaceC5264 = this.f10109;
            if (i4 >= length) {
                break;
            }
            interfaceC5264.mo5376(i4);
            interfaceC2379Arr[i4] = new C5146(c5300, iMo1783);
            i4++;
        }
        interfaceC5264.mo2647(j2, j3, jM10956, list2, interfaceC2379Arr);
        long j4 = jArr[iMo1783];
        long jM109562 = c5300.m10956(iMo1783) + j4;
        long j5 = list.isEmpty() ? j : -9223372036854775807L;
        int i5 = this.f10110 + iMo1783;
        int iMo2646 = this.f10109.mo2646();
        C4823 c4823 = this.f10112[iMo2646];
        int iMo5376 = this.f10109.mo5376(iMo2646);
        List list3 = c5300.f19831;
        C3446[] c3446Arr = c5300.f19835;
        ᵛᵾˏ.ᵿʗᵝʽ(c3446Arr != null);
        ᵛᵾˏ.ᵿʗᵝʽ(list3 != null);
        ᵛᵾˏ.ᵿʗᵝʽ(iMo1783 < list3.size());
        String string = Integer.toString(c3446Arr[iMo5376].f12932);
        String string2 = ((Long) list3.get(iMo1783)).toString();
        Uri uri = ˆᴵ.ᵿʗᵝʽ(c5300.f19825, c5300.f19832.replace("{bitrate}", string).replace("{Bitrate}", string).replace("{start time}", string2).replace("{start_time}", string2));
        SystemClock.elapsedRealtime();
        C3446 c3446Mo5374 = this.f10109.mo5374();
        int iMo2645 = this.f10109.mo2645();
        Object objMo2648 = this.f10109.mo2648();
        Map map = Collections.EMPTY_MAP;
        ᵛᵾˏ.ᵨᵳʝ(uri, "The uri must be set.");
        c4164.f15571 = new C0355(this.f10116, new C4179(uri, 1, null, map, 0L, -1L, null, 0), c3446Mo5374, iMo2645, objMo2648, j4, jM109562, j5, -9223372036854775807L, i5, 1, j4, c4823);
    }
}
