package defpackage;

import android.net.Uri;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;

/* renamed from: ᵽᵠʾʾ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C5361 implements InterfaceC5487 {

    /* renamed from: ˇʼʤˎ, reason: contains not printable characters */
    public final long f20084;

    /* renamed from: ˌᵜᵹᵩ, reason: contains not printable characters */
    public final C0612 f20085;

    /* renamed from: ˎˏʜʾ, reason: contains not printable characters */
    public final long f20086;

    /* renamed from: ˏˋٴ, reason: contains not printable characters */
    public final long f20087;

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public final long f20088;

    /* renamed from: ᵝᵵᵺ, reason: contains not printable characters */
    public final C1646 f20089;

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

    /* renamed from: ᵯٴᵦ, reason: contains not printable characters */
    public final List f20091;

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

    /* renamed from: ᵶᵷᵕ, reason: contains not printable characters */
    public final C2266 f20093;

    /* renamed from: ᵸˑ, reason: contains not printable characters */
    public final Uri f20094;

    /* renamed from: ᵹᵝᵶ, reason: contains not printable characters */
    public final long f20095;

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

    public C5361(long j, long j2, long j3, boolean z, long j4, long j5, long j6, long j7, C0612 c0612, C1646 c1646, C2266 c2266, Uri uri, ArrayList arrayList) {
        this.f20090 = j;
        this.f20092 = j2;
        this.f20088 = j3;
        this.f20096 = z;
        this.f20084 = j4;
        this.f20087 = j5;
        this.f20086 = j6;
        this.f20095 = j7;
        this.f20085 = c0612;
        this.f20089 = c1646;
        this.f20094 = uri;
        this.f20093 = c2266;
        this.f20091 = arrayList;
    }

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public final long m10982(int i) {
        long j;
        long j2;
        List list = this.f20091;
        if (i == list.size() - 1) {
            j = this.f20092;
            if (j == -9223372036854775807L) {
                return -9223372036854775807L;
            }
            j2 = ((C1689) list.get(i)).f6731;
        } else {
            j = ((C1689) list.get(i + 1)).f6731;
            j2 = ((C1689) list.get(i)).f6731;
        }
        return j - j2;
    }

    @Override // defpackage.InterfaceC5487
    /* renamed from: ᵥᵯˎ */
    public final Object mo2926(List list) {
        long j;
        LinkedList linkedList = new LinkedList(list);
        Collections.sort(linkedList);
        linkedList.add(new C2129());
        ArrayList arrayList = new ArrayList();
        long j2 = 0;
        int i = 0;
        while (true) {
            if (i >= this.f20091.size()) {
                break;
            }
            if (((C2129) linkedList.peek()).f8393 != i) {
                long jM10982 = m10982(i);
                if (jM10982 != -9223372036854775807L) {
                    j2 += jM10982;
                }
            } else {
                C1689 c1689M10983 = m10983(i);
                List list2 = c1689M10983.f6729;
                C2129 c2129 = (C2129) linkedList.poll();
                int i2 = c2129.f8393;
                ArrayList arrayList2 = new ArrayList();
                while (true) {
                    int i3 = c2129.f8392;
                    C1168 c1168 = (C1168) list2.get(i3);
                    List list3 = c1168.f4962;
                    ArrayList arrayList3 = new ArrayList();
                    do {
                        arrayList3.add((AbstractC0185) list3.get(c2129.f8394));
                        c2129 = (C2129) linkedList.poll();
                        if (c2129.f8393 != i2) {
                            break;
                        }
                    } while (c2129.f8392 == i3);
                    j = j2;
                    arrayList2.add(new C1168(c1168.f4963, c1168.f4964, arrayList3, c1168.f4965, c1168.f4960, c1168.f4961));
                    if (c2129.f8393 != i2) {
                        break;
                    }
                    j2 = j;
                }
                linkedList.addFirst(c2129);
                arrayList.add(new C1689(c1689M10983.f6730, c1689M10983.f6731 - j, arrayList2, c1689M10983.f6732));
                j2 = j;
            }
            i++;
        }
        long j3 = j2;
        long j4 = this.f20092;
        return new C5361(this.f20090, j4 != -9223372036854775807L ? j4 - j3 : -9223372036854775807L, this.f20088, this.f20096, this.f20084, this.f20087, this.f20086, this.f20095, this.f20085, this.f20089, this.f20093, this.f20094, arrayList);
    }

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public final C1689 m10983(int i) {
        return (C1689) this.f20091.get(i);
    }

    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    public final long m10984(int i) {
        return AbstractC3558.m8133(m10982(i));
    }
}
