package ඓ.ῲ.K.ᕣ.ᨨ;

import com.bumptech.glide.Registry;
import com.bumptech.glide.load.DataSource;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import ඓ.ῲ.K.ᕣ.AbstractC1029;
import ඓ.ῲ.K.ᕣ.AbstractC1030;
import ඓ.ῲ.K.ᕣ.ᨨ.AbstractC1021;
import ඓ.ῲ.K.ᕣ.㳳.AbstractC1033;
import ඓ.ῲ.K.ᕣ.㿎.AbstractC1146;
import ඓ.K.K.K.C1293;

/* renamed from: ඓ.ῲ.K.ᕣ.ᨨ.Ԛ  reason: contains not printable characters */
/* compiled from: ResourceCacheGenerator */
public class C0936 implements AbstractC1021, AbstractC1146.AbstractC1147<Object> {

    /* renamed from: ʬ  reason: contains not printable characters */
    public final C0956<?> f4237;

    /* renamed from: ඓ  reason: contains not printable characters */
    public int f4238 = -1;

    /* renamed from: ᕣ  reason: contains not printable characters */
    public C1023 f4239;

    /* renamed from: ᨨ  reason: contains not printable characters */
    public volatile AbstractC1033.C1034<?> f4240;

    /* renamed from: ῲ  reason: contains not printable characters */
    public final AbstractC1021.AbstractC1022 f4241;

    /* renamed from: ⁱ  reason: contains not printable characters */
    public List<AbstractC1033<File, ?>> f4242;

    /* renamed from: 㳳  reason: contains not printable characters */
    public File f4243;

    /* renamed from: 㴹  reason: contains not printable characters */
    public AbstractC1029 f4244;

    /* renamed from: 㸾  reason: contains not printable characters */
    public int f4245;

    /* renamed from: 㿎  reason: contains not printable characters */
    public int f4246;

    public C0936(C0956<?> r2, AbstractC1021.AbstractC1022 k) {
        this.f4237 = r2;
        this.f4241 = k;
    }

    @Override // ඓ.ῲ.K.ᕣ.ᨨ.AbstractC1021
    public void cancel() {
        AbstractC1033.C1034<?> k = this.f4240;
        if (k != null) {
            k.f4474.cancel();
        }
    }

    @Override // ඓ.ῲ.K.ᕣ.ᨨ.AbstractC1021
    /* renamed from: K  reason: contains not printable characters */
    public boolean m2656() {
        List<AbstractC1029> r1 = this.f4237.m2712();
        if (r1.isEmpty()) {
            return false;
        }
        C0956<?> r2 = this.f4237;
        Registry registry = r2.f4302.f4849;
        Class<?> cls = r2.f4317.getClass();
        Class<?> cls2 = r2.f4310;
        Class<Transcode> cls3 = r2.f4307;
        List<Class<?>> r7 = registry.f2189.m2415(cls, cls2, cls3);
        if (r7 == null) {
            r7 = new ArrayList<>();
            for (Class<?> cls4 : registry.f2185.m2858(cls)) {
                for (Class<?> cls5 : registry.f2180.m2403(cls4, cls2)) {
                    if (!registry.f2187.m2645(cls5, cls3).isEmpty() && !r7.contains(cls5)) {
                        r7.add(cls5);
                    }
                }
            }
            registry.f2189.m2416(cls, cls2, cls3, Collections.unmodifiableList(r7));
        }
        if (!r7.isEmpty()) {
            while (true) {
                List<AbstractC1033<File, ?>> list = this.f4242;
                if (list != null) {
                    if (this.f4246 < list.size()) {
                        this.f4240 = null;
                        boolean z = false;
                        while (!z) {
                            if (!(this.f4246 < this.f4242.size())) {
                                break;
                            }
                            List<AbstractC1033<File, ?>> list2 = this.f4242;
                            int i = this.f4246;
                            this.f4246 = i + 1;
                            File file = this.f4243;
                            C0956<?> r4 = this.f4237;
                            this.f4240 = list2.get(i).m2849(file, r4.f4305, r4.f4316, r4.f4308);
                            if (this.f4240 != null && this.f4237.m2709(this.f4240.f4474.m3066())) {
                                this.f4240.f4474.m3067(this.f4237.f4313, this);
                                z = true;
                            }
                        }
                        return z;
                    }
                }
                this.f4238++;
                if (this.f4238 >= r7.size()) {
                    this.f4245++;
                    if (this.f4245 >= r1.size()) {
                        return false;
                    }
                    this.f4238 = 0;
                }
                AbstractC1029 r22 = r1.get(this.f4245);
                Class<?> cls6 = r7.get(this.f4238);
                AbstractC1030<Z> r14 = this.f4237.m2711(cls6);
                C0956<?> r5 = this.f4237;
                this.f4239 = new C1023(r5.f4302.f4851, r22, r5.f4303, r5.f4305, r5.f4316, r14, cls6, r5.f4308);
                this.f4243 = this.f4237.m2710().m2799(this.f4239);
                File file2 = this.f4243;
                if (file2 != null) {
                    this.f4244 = r22;
                    this.f4242 = this.f4237.m2713(file2);
                    this.f4246 = 0;
                }
            }
        } else if (File.class.equals(this.f4237.f4307)) {
            return false;
        } else {
            StringBuilder r23 = C1293.m3416("Failed to find any load path from ");
            r23.append(this.f4237.f4317.getClass());
            r23.append(" to ");
            r23.append(this.f4237.f4307);
            throw new IllegalStateException(r23.toString());
        }
    }

    @Override // ඓ.ῲ.K.ᕣ.㿎.AbstractC1146.AbstractC1147
    /* renamed from: K  reason: contains not printable characters */
    public void m2655(Object obj) {
        this.f4241.m2836(this.f4244, obj, this.f4240.f4474, DataSource.RESOURCE_DISK_CACHE, this.f4239);
    }

    @Override // ඓ.ῲ.K.ᕣ.㿎.AbstractC1146.AbstractC1147
    /* renamed from: K  reason: contains not printable characters */
    public void m2654(Exception exc) {
        this.f4241.m2835(this.f4239, exc, this.f4240.f4474, DataSource.RESOURCE_DISK_CACHE);
    }
}
