package R;

import I.g;
import androidx.core.location.LocationRequestCompat;
import b0.AbstractC0399d;
import b0.D;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

/* JADX INFO: loaded from: classes.dex */
public class d implements g {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    private final List f1628a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    private final int f1629b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    private final long[] f1630c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    private final long[] f1631d;

    public d() {
        this.f1628a = null;
        this.f1629b = 0;
        long[] jArr = {0, LocationRequestCompat.PASSIVE_INTERVAL};
        this.f1630c = jArr;
        long[] jArrCopyOf = Arrays.copyOf(jArr, jArr.length);
        this.f1631d = jArrCopyOf;
        Arrays.sort(jArrCopyOf);
    }

    @Override // I.g
    public int a(long j2) {
        AbstractC0399d.a(j2 >= 0);
        int iB = D.b(this.f1631d, j2, false, false);
        if (iB < this.f1631d.length) {
            return iB;
        }
        return -1;
    }

    @Override // I.g
    public long b(int i2) {
        AbstractC0399d.a(i2 >= 0);
        AbstractC0399d.a(i2 < this.f1631d.length);
        return this.f1631d[i2];
    }

    @Override // I.g
    public List c(long j2) {
        ArrayList arrayList = null;
        if (this.f1629b > 0) {
            for (int i2 = 0; i2 < this.f1629b; i2++) {
                long[] jArr = this.f1630c;
                int i3 = i2 * 2;
                if (jArr[i3] <= j2 && j2 < jArr[i3 + 1]) {
                    if (arrayList == null) {
                        arrayList = new ArrayList();
                    }
                    arrayList.add((I.c) this.f1628a.get(i2));
                }
            }
        }
        return arrayList != null ? arrayList : Collections.emptyList();
    }

    @Override // I.g
    public int d() {
        return this.f1631d.length;
    }

    public d(String[] strArr, long j2, long[] jArr, c[] cVarArr) {
        ArrayList arrayList = new ArrayList();
        for (int i2 = 0; i2 < strArr.length; i2++) {
            if (cVarArr != null) {
                c cVar = cVarArr[i2];
                if (cVar != null) {
                    arrayList.add(new I.c(strArr[i2], null, cVar.a(), Integer.MIN_VALUE, Integer.MIN_VALUE, Float.MIN_VALUE, Integer.MIN_VALUE, Float.MIN_VALUE, Float.MIN_VALUE, 0));
                } else {
                    arrayList.add(new I.c(strArr[i2]));
                }
            } else {
                arrayList.add(new I.c(strArr[i2]));
            }
        }
        this.f1628a = arrayList;
        this.f1629b = arrayList.size();
        this.f1630c = jArr;
        long[] jArrCopyOf = Arrays.copyOf(jArr, jArr.length);
        this.f1631d = jArrCopyOf;
        Arrays.sort(jArrCopyOf);
    }
}
