package defpackage;

import defpackage.nq1;
import defpackage.oq1;
import defpackage.z76;
import java.io.File;
import java.util.List;

/* JADX INFO: loaded from: classes.dex */
class aq1 implements oq1, nq1.a<Object> {
    public final List a;
    public final cx1 b;
    public final oq1.a c;
    public int d = -1;
    public v25 e;
    public List f;
    public int i;
    public volatile z76.a j;
    public File k;

    public aq1(List list, cx1 cx1Var, oq1.a aVar) {
        this.a = list;
        this.b = cx1Var;
        this.c = aVar;
    }

    @Override // defpackage.oq1
    public final boolean b() {
        while (true) {
            List list = this.f;
            boolean z = false;
            if (list != null && this.i < list.size()) {
                this.j = null;
                while (!z && this.i < this.f.size()) {
                    List list2 = this.f;
                    int i = this.i;
                    this.i = i + 1;
                    z76 z76Var = (z76) list2.get(i);
                    File file = this.k;
                    cx1 cx1Var = this.b;
                    this.j = z76Var.b(file, cx1Var.e, cx1Var.f, cx1Var.i);
                    if (this.j != null && this.b.c(this.j.c.a()) != null) {
                        this.j.c.d(this.b.o, this);
                        z = true;
                    }
                }
                return z;
            }
            int i2 = this.d + 1;
            this.d = i2;
            if (i2 >= this.a.size()) {
                return false;
            }
            v25 v25Var = (v25) this.a.get(this.d);
            cx1 cx1Var2 = this.b;
            File fileA = cx1Var2.h.a().a(new bq1(v25Var, cx1Var2.n));
            this.k = fileA;
            if (fileA != null) {
                this.e = v25Var;
                this.f = this.b.c.a().a.b(fileA);
                this.i = 0;
            }
        }
    }

    @Override // nq1.a
    public final void c(Exception exc) {
        this.c.a(this.e, exc, this.j.c, zq1.c);
    }

    @Override // defpackage.oq1
    public final void cancel() {
        z76.a aVar = this.j;
        if (aVar != null) {
            aVar.c.cancel();
        }
    }

    @Override // nq1.a
    public final void f(Object obj) {
        this.c.c(this.e, obj, this.j.c, zq1.c, this.e);
    }
}
