package defpackage;

import com.bumptech.glide.load.data.a;
import defpackage.fx1;
import defpackage.vc7;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/* JADX INFO: loaded from: classes.dex */
public class cd5<Data, ResourceType, Transcode> {
    public final vc7.a a;
    public final List b;
    public final String c;

    public cd5(Class cls, Class cls2, Class cls3, List list, vc7.a aVar) {
        this.a = aVar;
        if (list.isEmpty()) {
            throw new IllegalArgumentException("Must not be empty.");
        }
        this.b = list;
        this.c = "Failed LoadPath{" + cls.getSimpleName() + "->" + cls2.getSimpleName() + "->" + cls3.getSimpleName() + "}";
    }

    public final b28 a(a aVar, my6 my6Var, int i, int i2, fx1.c cVar, List list) throws jv3 {
        vc7.a aVar2;
        List list2;
        List list3 = this.b;
        int size = list3.size();
        b28 b28VarA = null;
        for (int i3 = 0; i3 < size; i3++) {
            gx1 gx1Var = (gx1) list3.get(i3);
            try {
                aVar2 = gx1Var.d;
                Object objAcquire = aVar2.acquire();
                gf7.c(objAcquire, "Argument must not be null");
                list2 = (List) objAcquire;
            } catch (jv3 e) {
                e = e;
            }
            try {
                b28 b28VarA2 = gx1Var.a(aVar, i, i2, my6Var, list2);
                aVar2.a(list2);
                try {
                    b28VarA = gx1Var.c.a(cVar.a(b28VarA2), my6Var);
                } catch (jv3 e2) {
                    e = e2;
                    list.add(e);
                }
                if (b28VarA != null) {
                    break;
                }
            } catch (Throwable th) {
                aVar2.a(list2);
                throw th;
            }
        }
        if (b28VarA != null) {
            return b28VarA;
        }
        throw new jv3(this.c, new ArrayList(list));
    }

    public final String toString() {
        return "LoadPath{decodePaths=" + Arrays.toString(this.b.toArray()) + '}';
    }
}
