package ඓ.ῲ.K.ᕣ.㳳;

import com.bumptech.glide.Registry;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import ඓ.ῲ.K.ᕣ.C1121;
import ඓ.ῲ.K.ᕣ.㳳.AbstractC1033;
import ῲ.ᨨ.㳳.C1841;
import ῲ.ᨨ.㿎.AbstractC1871;

/* renamed from: ඓ.ῲ.K.ᕣ.㳳.㗽  reason: contains not printable characters */
/* compiled from: MultiModelLoaderFactory */
public class C1092 {

    /* renamed from: ඓ  reason: contains not printable characters */
    public static final C1093 f4553 = new C1093();

    /* renamed from: 㴹  reason: contains not printable characters */
    public static final AbstractC1033<Object, Object> f4554 = new C1095();

    /* renamed from: ʬ  reason: contains not printable characters */
    public final Set<C1094<?, ?>> f4555 = new HashSet();

    /* renamed from: ῲ  reason: contains not printable characters */
    public final C1093 f4556;

    /* renamed from: K  reason: contains not printable characters */
    public final List<C1094<?, ?>> f4557 = new ArrayList();

    /* renamed from: 㸾  reason: contains not printable characters */
    public final AbstractC1871<List<Throwable>> f4558;

    /* renamed from: ඓ.ῲ.K.ᕣ.㳳.㗽$ʬ  reason: contains not printable characters */
    /* compiled from: MultiModelLoaderFactory */
    public static class C1093 {
        /* renamed from: K  reason: contains not printable characters */
        public <Model, Data> C1072<Model, Data> m2956(List<AbstractC1033<Model, Data>> list, AbstractC1871<List<Throwable>> r3) {
            return new C1072<>(list, r3);
        }
    }

    /* renamed from: ඓ.ῲ.K.ᕣ.㳳.㗽$ῲ  reason: contains not printable characters */
    /* compiled from: MultiModelLoaderFactory */
    public static class C1094<Model, Data> {

        /* renamed from: ʬ  reason: contains not printable characters */
        public final AbstractC1091<? extends Model, ? extends Data> f4559;

        /* renamed from: ῲ  reason: contains not printable characters */
        public final Class<Data> f4560;

        /* renamed from: K  reason: contains not printable characters */
        public final Class<Model> f4561;

        public C1094(Class<Model> cls, Class<Data> cls2, AbstractC1091<? extends Model, ? extends Data> r3) {
            this.f4561 = cls;
            this.f4560 = cls2;
            this.f4559 = r3;
        }
    }

    /* renamed from: ඓ.ῲ.K.ᕣ.㳳.㗽$K  reason: contains not printable characters */
    /* compiled from: MultiModelLoaderFactory */
    public static class C1095 implements AbstractC1033<Object, Object> {
        @Override // ඓ.ῲ.K.ᕣ.㳳.AbstractC1033
        /* renamed from: K  reason: contains not printable characters */
        public AbstractC1033.C1034<Object> m2957(Object obj, int i, int i2, C1121 r4) {
            return null;
        }

        @Override // ඓ.ῲ.K.ᕣ.㳳.AbstractC1033
        /* renamed from: K  reason: contains not printable characters */
        public boolean m2958(Object obj) {
            return false;
        }
    }

    public C1092(AbstractC1871<List<Throwable>> r3) {
        C1093 r0 = f4553;
        this.f4558 = r3;
        this.f4556 = r0;
    }

    /* renamed from: ῲ  reason: contains not printable characters */
    public synchronized List<Class<?>> m2951(Class<?> cls) {
        ArrayList arrayList;
        arrayList = new ArrayList();
        for (C1094<?, ?> r2 : this.f4557) {
            if (!arrayList.contains(r2.f4560) && r2.f4561.isAssignableFrom(cls)) {
                arrayList.add(r2.f4560);
            }
        }
        return arrayList;
    }

    /* renamed from: K  reason: contains not printable characters */
    public synchronized <Model, Data> void m2955(Class<Model> cls, Class<Data> cls2, AbstractC1091<? extends Model, ? extends Data> r4) {
        C1094<?, ?> r0 = new C1094<>(cls, cls2, r4);
        List<C1094<?, ?>> list = this.f4557;
        list.add(list.size(), r0);
    }

    /* renamed from: K  reason: contains not printable characters */
    public synchronized <Model> List<AbstractC1033<Model, ?>> m2952(Class<Model> cls) {
        ArrayList arrayList;
        try {
            arrayList = new ArrayList();
            for (C1094<?, ?> r2 : this.f4557) {
                if (!this.f4555.contains(r2)) {
                    if (r2.f4561.isAssignableFrom(cls)) {
                        this.f4555.add(r2);
                        arrayList.add(m2954(r2));
                        this.f4555.remove(r2);
                    }
                }
            }
        } catch (Throwable th) {
            this.f4555.clear();
            throw th;
        }
        return arrayList;
    }

    /* renamed from: K  reason: contains not printable characters */
    public synchronized <Model, Data> AbstractC1033<Model, Data> m2953(Class<Model> cls, Class<Data> cls2) {
        try {
            ArrayList arrayList = new ArrayList();
            boolean z = false;
            for (C1094<?, ?> r5 : this.f4557) {
                if (this.f4555.contains(r5)) {
                    z = true;
                } else if (r5.f4561.isAssignableFrom(cls) && r5.f4560.isAssignableFrom(cls2)) {
                    this.f4555.add(r5);
                    arrayList.add(m2954(r5));
                    this.f4555.remove(r5);
                }
            }
            if (arrayList.size() > 1) {
                return this.f4556.m2956(arrayList, this.f4558);
            } else if (arrayList.size() == 1) {
                return (AbstractC1033) arrayList.get(0);
            } else if (z) {
                return (AbstractC1033<Model, Data>) f4554;
            } else {
                throw new Registry.NoModelLoaderAvailableException((Class<?>) cls, (Class<?>) cls2);
            }
        } catch (Throwable th) {
            this.f4555.clear();
            throw th;
        }
    }

    /* JADX DEBUG: Type inference failed for r2v2. Raw type applied. Possible types: ඓ.ῲ.K.ᕣ.㳳.Ԕ<? extends Model, ? extends Data>, java.lang.Object, ඓ.ῲ.K.ᕣ.㳳.Ԕ<Model, Data> */
    /* renamed from: K  reason: contains not printable characters */
    public final <Model, Data> AbstractC1033<Model, Data> m2954(C1094<?, ?> r2) {
        AbstractC1033 r22 = (AbstractC1033<? extends Model, ? extends Data>) r2.f4559.m2950(this);
        C1841.m4783(r22, "Argument must not be null");
        return r22;
    }
}
