package Y;

import I.g;
import I.h;
import Y.d;
import android.graphics.Bitmap;
import b0.AbstractC0399d;
import b0.D;
import b0.o;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

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

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

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

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

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

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

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    private List f1893f;

    public e(long j2, long[] jArr, String str, int i2, List list) {
        this.f1890c = j2;
        this.f1891d = jArr;
        long[] jArrCopyOf = Arrays.copyOf(jArr, jArr.length);
        this.f1892e = jArrCopyOf;
        this.f1888a = str;
        this.f1889b = i2;
        this.f1893f = list;
        Arrays.sort(jArrCopyOf);
    }

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

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

    @Override // I.g
    public List c(long j2) {
        o.d("VobSubSubtitle", "getCues timeUs: " + j2, 16);
        ArrayList arrayList = null;
        Bitmap bitmapA = null;
        for (int i2 = 0; i2 < this.f1893f.size(); i2++) {
            long[] jArr = this.f1891d;
            int i3 = i2 * 2;
            if (jArr[i3] <= j2) {
                int i4 = i3 + 1;
                if (j2 < jArr[i4]) {
                    o.d("VobSubSubtitle", "getCues " + i2 + " timeUs = " + this.f1891d[i3] + " " + this.f1891d[i4], 16);
                    if (arrayList == null) {
                        arrayList = new ArrayList();
                    }
                    bitmapA = ((d.a) this.f1893f.get(i2)).a();
                }
            }
            if (bitmapA != null) {
                h.a(bitmapA, j2, 0);
                return Collections.singletonList(new I.c(bitmapA));
            }
        }
        return Collections.emptyList();
    }

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