package ඓ.ῲ.K.ᕣ.ᨨ;

import android.util.Log;
import com.bumptech.glide.Priority;
import com.bumptech.glide.load.DataSource;
import com.bumptech.glide.load.engine.DecodeJob;
import com.bumptech.glide.request.SingleRequest;
import java.io.File;
import java.util.Map;
import java.util.concurrent.Executor;
import ඓ.ῲ.K.C1220;
import ඓ.ῲ.K.ᓣ.C0847;
import ඓ.ῲ.K.ᓣ.ᕣ.C0830;
import ඓ.ῲ.K.ᕣ.AbstractC1029;
import ඓ.ῲ.K.ᕣ.AbstractC1030;
import ඓ.ῲ.K.ᕣ.C1121;
import ඓ.ῲ.K.ᕣ.ᨨ.C1005;
import ඓ.ῲ.K.ᕣ.ᨨ.ト.AbstractC0989;
import ඓ.ῲ.K.ᕣ.ᨨ.ト.AbstractC0993;
import ඓ.ῲ.K.ᕣ.ᨨ.ト.C0985;
import ඓ.ῲ.K.ᕣ.ᨨ.ト.C0991;
import ඓ.ῲ.K.ᕣ.ᨨ.ト.C1000;
import ඓ.ῲ.K.ᕣ.ᨨ.ト.C1001;
import ඓ.ῲ.K.ᕣ.ᨨ.ト.C1003;
import ඓ.ῲ.K.ᕣ.ᨨ.㮔.ExecutorServiceC1008;
import ඓ.ῲ.K.㗗.AbstractC1199;
import ඓ.K.K.K.C1293;
import ῲ.ᨨ.㳳.C1841;
import ῲ.ᨨ.㿎.AbstractC1871;

/* renamed from: ඓ.ῲ.K.ᕣ.ᨨ.㳳  reason: contains not printable characters */
/* compiled from: Engine */
public class C1013 implements AbstractC1004, AbstractC0989.AbstractC0990, C1005.AbstractC1006 {

    /* renamed from: ᨨ  reason: contains not printable characters */
    public static final boolean f4420 = Log.isLoggable("Engine", 2);

    /* renamed from: ʬ  reason: contains not printable characters */
    public final AbstractC0989 f4421;

    /* renamed from: ඓ  reason: contains not printable characters */
    public final C0942 f4422;

    /* renamed from: ῲ  reason: contains not printable characters */
    public final C0935 f4423 = new C0935();

    /* renamed from: ⁱ  reason: contains not printable characters */
    public final C1017 f4424;

    /* renamed from: K  reason: contains not printable characters */
    public final C0944 f4425 = new C0944();

    /* renamed from: 㴹  reason: contains not printable characters */
    public final C1014 f4426;

    /* renamed from: 㸾  reason: contains not printable characters */
    public final C1015 f4427;

    /* renamed from: 㿎  reason: contains not printable characters */
    public final C0957 f4428;

    /* renamed from: ඓ.ῲ.K.ᕣ.ᨨ.㳳$ʬ  reason: contains not printable characters */
    /* compiled from: Engine */
    public static class C1014 implements DecodeJob.AbstractC0335 {

        /* renamed from: ῲ  reason: contains not printable characters */
        public volatile AbstractC0993 f4429;

        /* renamed from: K  reason: contains not printable characters */
        public final AbstractC0993.AbstractC0995 f4430;

        public C1014(AbstractC0993.AbstractC0995 k) {
            this.f4430 = k;
        }

        /* renamed from: K  reason: contains not printable characters */
        public AbstractC0993 m2827() {
            if (this.f4429 == null) {
                synchronized (this) {
                    if (this.f4429 == null) {
                        C1001 r0 = (C1001) this.f4430;
                        C1000 r1 = (C1000) r0.f4397;
                        File cacheDir = r1.f4396.getCacheDir();
                        C0985 r3 = null;
                        if (cacheDir == null) {
                            cacheDir = null;
                        } else {
                            String str = r1.f4395;
                            if (str != null) {
                                cacheDir = new File(cacheDir, str);
                            }
                        }
                        if (cacheDir != null) {
                            if (!cacheDir.mkdirs()) {
                                if (cacheDir.exists()) {
                                    if (!cacheDir.isDirectory()) {
                                    }
                                }
                            }
                            r3 = new C0985(cacheDir, r0.f4398);
                        }
                        this.f4429 = r3;
                    }
                    if (this.f4429 == null) {
                        this.f4429 = new C0991();
                    }
                }
            }
            return this.f4429;
        }
    }

    /* renamed from: ඓ.ῲ.K.ᕣ.ᨨ.㳳$ῲ  reason: contains not printable characters */
    /* compiled from: Engine */
    public static class C1015 {

        /* renamed from: ʬ  reason: contains not printable characters */
        public final ExecutorServiceC1008 f4431;

        /* renamed from: ඓ  reason: contains not printable characters */
        public final AbstractC1004 f4432;

        /* renamed from: ῲ  reason: contains not printable characters */
        public final ExecutorServiceC1008 f4433;

        /* renamed from: ⁱ  reason: contains not printable characters */
        public final AbstractC1871<C0945<?>> f4434 = C0830.m2423(150, new C1016());

        /* renamed from: K  reason: contains not printable characters */
        public final ExecutorServiceC1008 f4435;

        /* renamed from: 㴹  reason: contains not printable characters */
        public final C1005.AbstractC1006 f4436;

        /* renamed from: 㸾  reason: contains not printable characters */
        public final ExecutorServiceC1008 f4437;

        /* renamed from: ඓ.ῲ.K.ᕣ.ᨨ.㳳$ῲ$K  reason: contains not printable characters */
        /* compiled from: Engine */
        public class C1016 implements C0830.AbstractC0833<C0945<?>> {
            public C1016() {
            }

            /* Return type fixed from 'java.lang.Object' to match base method */
            @Override // ඓ.ῲ.K.ᓣ.ᕣ.C0830.AbstractC0833
            /* renamed from: K  reason: contains not printable characters */
            public C0945<?> m2828() {
                C1015 r0 = C1015.this;
                return new C0945(r0.f4435, r0.f4433, r0.f4431, r0.f4437, r0.f4432, r0.f4436, r0.f4434);
            }
        }

        public C1015(ExecutorServiceC1008 k, ExecutorServiceC1008 k2, ExecutorServiceC1008 k3, ExecutorServiceC1008 k4, AbstractC1004 r7, C1005.AbstractC1006 k5) {
            this.f4435 = k;
            this.f4433 = k2;
            this.f4431 = k3;
            this.f4437 = k4;
            this.f4432 = r7;
            this.f4436 = k5;
        }
    }

    /* renamed from: ඓ.ῲ.K.ᕣ.ᨨ.㳳$K  reason: contains not printable characters */
    /* compiled from: Engine */
    public static class C1017 {

        /* renamed from: ʬ  reason: contains not printable characters */
        public int f4439;

        /* renamed from: ῲ  reason: contains not printable characters */
        public final AbstractC1871<DecodeJob<?>> f4440 = C0830.m2423(150, new C1018());

        /* renamed from: K  reason: contains not printable characters */
        public final DecodeJob.AbstractC0335 f4441;

        /* renamed from: ඓ.ῲ.K.ᕣ.ᨨ.㳳$K$K  reason: contains not printable characters */
        /* compiled from: Engine */
        public class C1018 implements C0830.AbstractC0833<DecodeJob<?>> {
            public C1018() {
            }

            /* Return type fixed from 'java.lang.Object' to match base method */
            @Override // ඓ.ῲ.K.ᓣ.ᕣ.C0830.AbstractC0833
            /* renamed from: K  reason: contains not printable characters */
            public DecodeJob<?> m2829() {
                C1017 k = C1017.this;
                return new DecodeJob(k.f4441, k.f4440);
            }
        }

        public C1017(DecodeJob.AbstractC0335 r3) {
            this.f4441 = r3;
        }
    }

    /* renamed from: ඓ.ῲ.K.ᕣ.ᨨ.㳳$㸾  reason: contains not printable characters */
    /* compiled from: Engine */
    public class C1019 {

        /* renamed from: ῲ  reason: contains not printable characters */
        public final AbstractC1199 f4444;

        /* renamed from: K  reason: contains not printable characters */
        public final C0945<?> f4445;

        public C1019(AbstractC1199 r2, C0945<?> r3) {
            this.f4444 = r2;
            this.f4445 = r3;
        }

        /* renamed from: K  reason: contains not printable characters */
        public void m2830() {
            synchronized (C1013.this) {
                this.f4445.m2672(this.f4444);
            }
        }
    }

    public C1013(AbstractC0989 r8, AbstractC0993.AbstractC0995 k, ExecutorServiceC1008 k2, ExecutorServiceC1008 k3, ExecutorServiceC1008 k4, ExecutorServiceC1008 k5, boolean z) {
        this.f4421 = r8;
        this.f4426 = new C1014(k);
        C0957 k6 = new C0957(z);
        this.f4428 = k6;
        k6.m2717(this);
        this.f4427 = new C1015(k2, k3, k4, k5, this, this);
        this.f4424 = new C1017(this.f4426);
        this.f4422 = new C0942();
        ((C1003) r8).f4399 = this;
    }

    /* renamed from: K  reason: contains not printable characters */
    public synchronized void m2824(C0945<?> r2, AbstractC1029 r3, C1005<?> r4) {
        if (r4 != null) {
            if (r4.f4402) {
                this.f4428.m2719(r3, r4);
            }
        }
        this.f4425.m2669(r3, r2);
    }

    /* renamed from: K  reason: contains not printable characters */
    public <R> C1019 m2821(C1220 r25, Object obj, AbstractC1029 r27, int i, int i2, Class<?> cls, Class<R> cls2, Priority priority, AbstractC0951 r33, Map<Class<?>, AbstractC1030<?>> map, boolean z, boolean z2, C1121 r37, boolean z3, boolean z4, boolean z5, boolean z6, AbstractC1199 r42, Executor executor) {
        long r0 = f4420 ? C0847.m2463() : 0;
        C1028 r02 = this.f4423.m2653(obj, r27, i, i2, map, cls, cls2, r37);
        synchronized (this) {
            C1005<?> r1 = m2820(r02, z3, r0);
            if (r1 == null) {
                return m2822(r25, obj, r27, i, i2, cls, cls2, priority, r33, map, z, z2, r37, z3, z4, z5, z6, r42, executor, r02, r0);
            }
            ((SingleRequest) r42).m1346(r1, DataSource.MEMORY_CACHE);
            return null;
        }
    }

    /* JADX DEBUG: Multi-variable search result rejected for r24v0, resolved type: java.lang.Class<R> */
    /* JADX WARN: Multi-variable type inference failed */
    /* renamed from: K  reason: contains not printable characters */
    public final <R> C1019 m2822(C1220 r18, Object obj, AbstractC1029 r20, int i, int i2, Class<?> cls, Class<R> cls2, Priority priority, AbstractC0951 r26, Map<Class<?>, AbstractC1030<?>> map, boolean z, boolean z2, C1121 r30, boolean z3, boolean z4, boolean z5, boolean z6, AbstractC1199 r35, Executor executor, C1028 r37, long j) {
        C0944 r9 = this.f4425;
        C0945<?> r92 = (z6 ? r9.f4264 : r9.f4265).get(r37);
        if (r92 != null) {
            r92.m2685(r35, executor);
            if (f4420) {
                m2819("Added to existing load", j, r37);
            }
            return new C1019(r35, r92);
        }
        C0945<?> r93 = this.f4427.f4434.m4835();
        C1841.m4783(r93, "Argument must not be null");
        r93.m2678(r37, z3, z4, z5, z6);
        C1017 k = this.f4424;
        DecodeJob<?> r10 = k.f4440.m4835();
        C1841.m4783(r10, "Argument must not be null");
        int i3 = k.f4439;
        k.f4439 = i3 + 1;
        C0956<R> r94 = r10.f2207;
        DecodeJob.AbstractC0335 r12 = r10.f2199;
        r94.f4302 = r18;
        r94.f4317 = obj;
        r94.f4303 = r20;
        r94.f4305 = i;
        r94.f4316 = i2;
        r94.f4304 = r26;
        r94.f4310 = cls;
        r94.f4318 = r12;
        r94.f4307 = cls2;
        r94.f4313 = priority;
        r94.f4308 = r30;
        r94.f4315 = map;
        r94.f4306 = z;
        r94.f4314 = z2;
        r10.f2206 = r18;
        r10.f2216 = r20;
        r10.f2204 = priority;
        r10.f2212 = r37;
        r10.f2223 = i;
        r10.f2195 = i2;
        r10.f2213 = r26;
        r10.f2219 = z6;
        r10.f2197 = r30;
        r10.f2203 = r93;
        r10.f2214 = i3;
        r10.f2222 = DecodeJob.RunReason.INITIALIZE;
        r10.f2202 = obj;
        this.f4425.m2671(r37, r93);
        r93.m2685(r35, executor);
        r93.m2681(r10);
        if (f4420) {
            m2819("Started new load", j, r37);
        }
        return new C1019(r35, r93);
    }

    /* renamed from: K  reason: contains not printable characters */
    public static void m2819(String str, long j, AbstractC1029 r4) {
        StringBuilder r1 = C1293.m3402(str, " in ");
        r1.append(C0847.m2462(j));
        r1.append("ms, key: ");
        r1.append(r4);
        Log.v("Engine", r1.toString());
    }

    /* renamed from: K  reason: contains not printable characters */
    public final C1005<?> m2820(C1028 r8, boolean z, long j) {
        C1005<?> r9;
        if (!z) {
            return null;
        }
        C1005<?> r92 = this.f4428.m2715(r8);
        if (r92 != null) {
            r92.m2812();
        }
        if (r92 != null) {
            if (f4420) {
                m2819("Loaded resource from active resources", j, r8);
            }
            return r92;
        }
        AbstractC1027 r2 = ((C1003) this.f4421).m2804((AbstractC1029) r8);
        if (r2 == null) {
            r9 = null;
        } else if (r2 instanceof C1005) {
            r9 = (C1005) r2;
        } else {
            r9 = new C1005<>(r2, true, true, r8, this);
        }
        if (r9 != null) {
            r9.m2812();
            this.f4428.m2719(r8, r9);
        }
        if (r9 == null) {
            return null;
        }
        if (f4420) {
            m2819("Loaded resource from cache", j, r8);
        }
        return r9;
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m2825(AbstractC1027<?> r2) {
        if (r2 instanceof C1005) {
            ((C1005) r2).m2809();
            return;
        }
        throw new IllegalArgumentException("Cannot release anything but an EngineResource");
    }

    /* renamed from: K  reason: contains not printable characters */
    public synchronized void m2823(C0945<?> r2, AbstractC1029 r3) {
        this.f4425.m2669(r3, r2);
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m2826(AbstractC1029 r2, C1005<?> r3) {
        this.f4428.m2718(r2);
        if (r3.f4402) {
            ((C1003) this.f4421).m2805(r2, (AbstractC1027) r3);
        } else {
            this.f4422.m2668(r3, false);
        }
    }
}
