package I;

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 f951a;

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

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

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

    public d() {
        this.f951a = null;
        this.f952b = 0;
        long[] jArr = {0, LocationRequestCompat.PASSIVE_INTERVAL};
        this.f953c = jArr;
        long[] jArrCopyOf = Arrays.copyOf(jArr, jArr.length);
        this.f954d = jArrCopyOf;
        Arrays.sort(jArrCopyOf);
    }

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

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

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

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

    public d(String[] strArr, long j2, long[] jArr) {
        ArrayList arrayList = new ArrayList();
        for (String str : strArr) {
            arrayList.add(new c(str));
        }
        this.f951a = arrayList;
        this.f952b = arrayList.size();
        this.f953c = jArr;
        long[] jArrCopyOf = Arrays.copyOf(jArr, jArr.length);
        this.f954d = jArrCopyOf;
        Arrays.sort(jArrCopyOf);
    }

    public d(String str, long j2, long j3) {
        List listSingletonList = Collections.singletonList(new c(str));
        this.f951a = listSingletonList;
        int size = listSingletonList.size();
        this.f952b = size;
        long[] jArr = new long[size * 2];
        this.f953c = jArr;
        jArr[0] = j2;
        jArr[1] = j3;
        long[] jArrCopyOf = Arrays.copyOf(jArr, jArr.length);
        this.f954d = jArrCopyOf;
        Arrays.sort(jArrCopyOf);
    }
}
