package defpackage;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.os.SystemClock;
import android.util.Log;
import com.bumptech.glide.load.engine.GlideException;
import j$.util.Objects;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

/* JADX INFO: renamed from: ᵱᐧᵖ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public final class C4436 implements InterfaceC2653 {

    /* JADX INFO: renamed from: ᵯᵷʽ, reason: contains not printable characters */
    public static final boolean f16873 = Log.isLoggable("GlideRequest", 2);

    /* JADX INFO: renamed from: ʽˈˋ, reason: contains not printable characters */
    public final Object f16874;

    /* JADX INFO: renamed from: ˉᵲ, reason: contains not printable characters */
    public Drawable f16875;

    /* JADX INFO: renamed from: ˊᵙᵾᵲ, reason: contains not printable characters */
    public Drawable f16876;

    /* JADX INFO: renamed from: ˊᵨᵧ, reason: contains not printable characters */
    public int f16877;

    /* JADX INFO: renamed from: ˊᵫᵗ, reason: contains not printable characters */
    public final int f16878;

    /* JADX INFO: renamed from: ˋˈ, reason: contains not printable characters */
    public final ExecutorC0789 f16879;

    /* JADX INFO: renamed from: ˌᴵ, reason: contains not printable characters */
    public int f16880;

    /* JADX INFO: renamed from: ˏːˆ, reason: contains not printable characters */
    public Drawable f16881;

    /* JADX INFO: renamed from: ːˏᵟᵯ, reason: contains not printable characters */
    public final InterfaceC4110 f16882;

    /* JADX INFO: renamed from: ᵔᵖᵹᵫ, reason: contains not printable characters */
    public final RuntimeException f16883;

    /* JADX INFO: renamed from: ᵜᵪʾ, reason: contains not printable characters */
    public boolean f16884;

    /* JADX INFO: renamed from: ᵝᵶ, reason: contains not printable characters */
    public final InterfaceC0557 f16885;

    /* JADX INFO: renamed from: ᵟᵹᵙ, reason: contains not printable characters */
    public ᵣˊˈᵪ f16886;

    /* JADX INFO: renamed from: ᵨᵣ, reason: contains not printable characters */
    public final Object f16887;

    /* JADX INFO: renamed from: ᵨᵼⁱ, reason: contains not printable characters */
    public int f16888;

    /* JADX INFO: renamed from: ᵪᵹᵥᵻ, reason: contains not printable characters */
    public InterfaceC1364 f16889;

    /* JADX INFO: renamed from: ᵮᵣᵗˈ, reason: contains not printable characters */
    public final List f16890;

    /* JADX INFO: renamed from: ᵱʡˏ, reason: contains not printable characters */
    public volatile C3580 f16891;

    /* JADX INFO: renamed from: ᵱᵽʡᵚ, reason: contains not printable characters */
    public final EnumC4810 f16892;

    /* JADX INFO: renamed from: ᵲᵶᵳˈ, reason: contains not printable characters */
    public final C1655 f16893;

    /* JADX INFO: renamed from: ᵵᵽ, reason: contains not printable characters */
    public final AbstractC2086 f16894;

    /* JADX INFO: renamed from: ᵶᵥᵝ, reason: contains not printable characters */
    public final InterfaceC4963 f16895;

    /* JADX INFO: renamed from: ᵷᵺʾᵖ, reason: contains not printable characters */
    public final C1883 f16896;

    /* JADX INFO: renamed from: ᵻʽᵯ, reason: contains not printable characters */
    public final int f16897;

    /* JADX INFO: renamed from: ᵻˈᵦʼ, reason: contains not printable characters */
    public final Class f16898;

    public C4436(Context context, C1883 c1883, Object obj, Object obj2, Class cls, AbstractC2086 abstractC2086, int i, int i2, EnumC4810 enumC4810, InterfaceC4963 interfaceC4963, ArrayList arrayList, InterfaceC4110 interfaceC4110, C3580 c3580, InterfaceC0557 interfaceC0557) {
        ExecutorC0789 executorC0789 = ᵷᵸˁ.ːˏᵟᵯ;
        if (f16873) {
            String.valueOf(hashCode());
        }
        this.f16893 = new C1655();
        this.f16874 = obj;
        this.f16896 = c1883;
        this.f16887 = obj2;
        this.f16898 = cls;
        this.f16894 = abstractC2086;
        this.f16878 = i;
        this.f16897 = i2;
        this.f16892 = enumC4810;
        this.f16895 = interfaceC4963;
        this.f16890 = arrayList;
        this.f16882 = interfaceC4110;
        this.f16891 = c3580;
        this.f16885 = interfaceC0557;
        this.f16879 = executorC0789;
        this.f16888 = 1;
        if (this.f16883 == null && ((Map) c1883.f7466.f4404).containsKey(ᵣˉ.class)) {
            this.f16883 = new RuntimeException("Glide request origin trace");
        }
    }

    @Override // defpackage.InterfaceC2653
    public final void clear() {
        synchronized (this.f16874) {
            try {
                if (this.f16884) {
                    throw new IllegalStateException("You can't start or clear loads in RequestListener or Target callbacks. If you're trying to start a fallback request when a load fails, use RequestBuilder#error(RequestBuilder). Otherwise consider posting your into() or clear() calls to the main thread using a Handler instead.");
                }
                this.f16893.m4545();
                if (this.f16888 == 6) {
                    return;
                }
                m9440();
                InterfaceC1364 interfaceC1364 = this.f16889;
                if (interfaceC1364 != null) {
                    this.f16889 = null;
                } else {
                    interfaceC1364 = null;
                }
                InterfaceC4110 interfaceC4110 = this.f16882;
                if (interfaceC4110 == null || interfaceC4110.mo1489(this)) {
                    this.f16895.mo3552(m9443());
                }
                this.f16888 = 6;
                if (interfaceC1364 != null) {
                    this.f16891.getClass();
                    C3580.m8087(interfaceC1364);
                }
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    @Override // defpackage.InterfaceC2653
    public final boolean isRunning() {
        boolean z;
        synchronized (this.f16874) {
            int i = this.f16888;
            z = i == 2 || i == 3;
        }
        return z;
    }

    public final String toString() {
        Object obj;
        Class cls;
        synchronized (this.f16874) {
            obj = this.f16887;
            cls = this.f16898;
        }
        return super.toString() + "[model=" + obj + ", transcodeClass=" + cls + "]";
    }

    @Override // defpackage.InterfaceC2653
    /* JADX INFO: renamed from: ʽˈˋ */
    public final boolean mo1479(InterfaceC2653 interfaceC2653) {
        int i;
        int i2;
        Object obj;
        Class cls;
        AbstractC2086 abstractC2086;
        EnumC4810 enumC4810;
        int size;
        int i3;
        int i4;
        Object obj2;
        Class cls2;
        AbstractC2086 abstractC20862;
        EnumC4810 enumC48102;
        int size2;
        if (!(interfaceC2653 instanceof C4436)) {
            return false;
        }
        synchronized (this.f16874) {
            try {
                i = this.f16878;
                i2 = this.f16897;
                obj = this.f16887;
                cls = this.f16898;
                abstractC2086 = this.f16894;
                enumC4810 = this.f16892;
                List list = this.f16890;
                size = list != null ? list.size() : 0;
            } finally {
            }
        }
        C4436 c4436 = (C4436) interfaceC2653;
        synchronized (c4436.f16874) {
            try {
                i3 = c4436.f16878;
                i4 = c4436.f16897;
                obj2 = c4436.f16887;
                cls2 = c4436.f16898;
                abstractC20862 = c4436.f16894;
                enumC48102 = c4436.f16892;
                List list2 = c4436.f16890;
                size2 = list2 != null ? list2.size() : 0;
            } finally {
            }
        }
        if (i == i3 && i2 == i4) {
            if ((obj == null ? obj2 == null : obj.equals(obj2)) && cls.equals(cls2)) {
                if ((abstractC2086 == null ? abstractC20862 == null : abstractC2086.m5561(abstractC20862)) && enumC4810 == enumC48102 && size == size2) {
                    return true;
                }
            }
        }
        return false;
    }

    /* JADX INFO: renamed from: ˊᵫᵗ, reason: contains not printable characters */
    public final void m9439(InterfaceC1364 interfaceC1364, Object obj, int i) {
        InterfaceC4110 interfaceC4110 = this.f16882;
        boolean z = interfaceC4110 == null || !interfaceC4110.getRoot().mo1484();
        this.f16888 = 4;
        this.f16889 = interfaceC1364;
        if (this.f16896.f7473 <= 3) {
            Objects.toString(this.f16887);
            int i2 = AbstractC0925.f4045;
            SystemClock.elapsedRealtimeNanos();
        }
        if (interfaceC4110 != null) {
            interfaceC4110.mo1487(this);
        }
        this.f16884 = true;
        try {
            List list = this.f16890;
            if (list != null) {
                Iterator it = list.iterator();
                while (it.hasNext()) {
                    ((InterfaceC0230) it.next()).m1404(obj);
                }
            }
            this.f16895.mo3548(obj, this.f16885.m2141(i, z));
            this.f16884 = false;
        } catch (Throwable th) {
            this.f16884 = false;
            throw th;
        }
    }

    /* JADX INFO: renamed from: ːˏᵟᵯ, reason: contains not printable characters */
    public final void m9440() {
        if (this.f16884) {
            ᵕᵩʽᵲ.ᵪᵹᵥᵻ("You can't start or clear loads in RequestListener or Target callbacks. If you're trying to start a fallback request when a load fails, use RequestBuilder#error(RequestBuilder). Otherwise consider posting your into() or clear() calls to the main thread using a Handler instead.");
            return;
        }
        this.f16893.m4545();
        this.f16895.mo3553(this);
        ᵣˊˈᵪ r0 = this.f16886;
        if (r0 != null) {
            synchronized (((C3580) r0.ᵨᵼⁱ)) {
                ((C3670) r0.ᵜᵪʾ).m8280((C4436) r0.ᵔᵖᵹᵫ);
            }
            this.f16886 = null;
        }
    }

    @Override // defpackage.InterfaceC2653
    /* JADX INFO: renamed from: ᵨᵣ */
    public final void mo1482() {
        synchronized (this.f16874) {
            try {
                if (isRunning()) {
                    clear();
                }
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Type inference failed for: r1v1 */
    /* JADX WARN: Type inference failed for: r1v15 */
    /* JADX WARN: Type inference failed for: r1v2 */
    /* JADX INFO: renamed from: ᵮᵣᵗˈ, reason: contains not printable characters */
    public final void m9441(int i, int i2) {
        ?? r1;
        int i3 = i;
        this.f16893.m4545();
        Object obj = this.f16874;
        synchronized (obj) {
            try {
                try {
                    boolean z = f16873;
                    if (z) {
                        int i4 = AbstractC0925.f4045;
                        SystemClock.elapsedRealtimeNanos();
                    }
                    if (this.f16888 != 3) {
                        return;
                    }
                    this.f16888 = 2;
                    this.f16894.getClass();
                    this.f16877 = i3 == Integer.MIN_VALUE ? i3 : Math.round(i3 * 1.0f);
                    this.f16880 = i2 == Integer.MIN_VALUE ? i2 : Math.round(1.0f * i2);
                    if (z) {
                        int i5 = AbstractC0925.f4045;
                        SystemClock.elapsedRealtimeNanos();
                    }
                    C3580 c3580 = this.f16891;
                    C1883 c1883 = this.f16896;
                    Object obj2 = this.f16887;
                    AbstractC2086 abstractC2086 = this.f16894;
                    this.f16886 = c3580.m8091(c1883, obj2, abstractC2086.f8285, this.f16877, this.f16880, abstractC2086.f8289, this.f16898, this.f16892, abstractC2086.f8288, abstractC2086.f8278, abstractC2086.f8293, abstractC2086.f8279, abstractC2086.f8286, abstractC2086.f8291, abstractC2086.f8283, this, this.f16879);
                    if (this.f16888 != 2) {
                        this.f16886 = null;
                    }
                    if (z) {
                        int i6 = AbstractC0925.f4045;
                        SystemClock.elapsedRealtimeNanos();
                    }
                } catch (Throwable th) {
                    th = th;
                    r1 = obj;
                    throw th;
                }
            } catch (Throwable th2) {
                th = th2;
                r1 = i3;
            }
        }
    }

    @Override // defpackage.InterfaceC2653
    /* JADX INFO: renamed from: ᵱᵽʡᵚ */
    public final void mo1483() {
        synchronized (this.f16874) {
            try {
                if (this.f16884) {
                    throw new IllegalStateException("You can't start or clear loads in RequestListener or Target callbacks. If you're trying to start a fallback request when a load fails, use RequestBuilder#error(RequestBuilder). Otherwise consider posting your into() or clear() calls to the main thread using a Handler instead.");
                }
                this.f16893.m4545();
                int i = AbstractC0925.f4045;
                SystemClock.elapsedRealtimeNanos();
                if (this.f16887 == null) {
                    if (ᵱˉˈ.ˌᵨʠᵫ(this.f16878, this.f16897)) {
                        this.f16877 = this.f16878;
                        this.f16880 = this.f16897;
                    }
                    if (this.f16881 == null) {
                        this.f16894.getClass();
                        this.f16881 = null;
                    }
                    m9444(new GlideException("Received null model"), this.f16881 == null ? 5 : 3);
                    return;
                }
                int i2 = this.f16888;
                if (i2 == 2) {
                    throw new IllegalArgumentException("Cannot restart a running request");
                }
                if (i2 == 4) {
                    m9442(this.f16889, 5);
                    return;
                }
                List<InterfaceC0230> list = this.f16890;
                if (list != null) {
                    for (InterfaceC0230 interfaceC0230 : list) {
                    }
                }
                this.f16888 = 3;
                if (ᵱˉˈ.ˌᵨʠᵫ(this.f16878, this.f16897)) {
                    m9441(this.f16878, this.f16897);
                } else {
                    this.f16895.mo3550(this);
                }
                int i3 = this.f16888;
                if (i3 == 2 || i3 == 3) {
                    InterfaceC4110 interfaceC4110 = this.f16882;
                    if (interfaceC4110 == null || interfaceC4110.mo1485(this)) {
                        this.f16895.mo3549(m9443());
                    }
                }
                if (f16873) {
                    SystemClock.elapsedRealtimeNanos();
                }
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    @Override // defpackage.InterfaceC2653
    /* JADX INFO: renamed from: ᵲᵶᵳˈ */
    public final boolean mo1484() {
        boolean z;
        synchronized (this.f16874) {
            z = this.f16888 == 4;
        }
        return z;
    }

    /* JADX INFO: renamed from: ᵵᵽ, reason: contains not printable characters */
    public final void m9442(InterfaceC1364 interfaceC1364, int i) {
        this.f16893.m4545();
        InterfaceC1364 interfaceC13642 = null;
        try {
            synchronized (this.f16874) {
                try {
                    this.f16886 = null;
                    if (interfaceC1364 == null) {
                        m9444(new GlideException("Expected to receive a Resource<R> with an object of " + this.f16898 + " inside, but instead got null."), 5);
                        return;
                    }
                    Object obj = interfaceC1364.get();
                    try {
                        if (obj == null || !this.f16898.isAssignableFrom(obj.getClass())) {
                            this.f16889 = null;
                            StringBuilder sb = new StringBuilder("Expected to receive an object of ");
                            sb.append(this.f16898);
                            sb.append(" but instead got ");
                            sb.append(obj != null ? obj.getClass() : "");
                            sb.append("{");
                            sb.append(obj);
                            sb.append("} inside Resource{");
                            sb.append(interfaceC1364);
                            sb.append("}.");
                            sb.append(obj != null ? "" : " To indicate failure return a null Resource object, rather than a Resource object containing null data.");
                            m9444(new GlideException(sb.toString()), 5);
                        } else {
                            InterfaceC4110 interfaceC4110 = this.f16882;
                            if (interfaceC4110 == null || interfaceC4110.mo1480(this)) {
                                m9439(interfaceC1364, obj, i);
                                return;
                            } else {
                                this.f16889 = null;
                                this.f16888 = 4;
                            }
                        }
                        this.f16891.getClass();
                        C3580.m8087(interfaceC1364);
                    } catch (Throwable th) {
                        interfaceC13642 = interfaceC1364;
                        th = th;
                        throw th;
                    }
                } catch (Throwable th2) {
                    th = th2;
                }
            }
        } catch (Throwable th3) {
            if (interfaceC13642 != null) {
                this.f16891.getClass();
                C3580.m8087(interfaceC13642);
            }
            throw th3;
        }
    }

    @Override // defpackage.InterfaceC2653
    /* JADX INFO: renamed from: ᵶᵥᵝ */
    public final boolean mo1486() {
        boolean z;
        synchronized (this.f16874) {
            z = this.f16888 == 4;
        }
        return z;
    }

    /* JADX INFO: renamed from: ᵷᵺʾᵖ, reason: contains not printable characters */
    public final Drawable m9443() {
        if (this.f16875 == null) {
            this.f16894.getClass();
            this.f16875 = null;
        }
        return this.f16875;
    }

    @Override // defpackage.InterfaceC2653
    /* JADX INFO: renamed from: ᵻʽᵯ */
    public final boolean mo1488() {
        boolean z;
        synchronized (this.f16874) {
            z = this.f16888 == 6;
        }
        return z;
    }

    /* JADX INFO: renamed from: ᵻˈᵦʼ, reason: contains not printable characters */
    public final void m9444(GlideException glideException, int i) {
        boolean zM1403;
        this.f16893.m4545();
        synchronized (this.f16874) {
            try {
                glideException.getClass();
                int i2 = this.f16896.f7473;
                if (i2 <= i) {
                    Objects.toString(this.f16887);
                    if (i2 <= 4) {
                        ArrayList arrayList = new ArrayList();
                        GlideException.m799(glideException, arrayList);
                        int size = arrayList.size();
                        int i3 = 0;
                        while (i3 < size) {
                            int i4 = i3 + 1;
                            i3 = i4;
                        }
                    }
                }
                Drawable drawableM9443 = null;
                this.f16886 = null;
                this.f16888 = 5;
                InterfaceC4110 interfaceC4110 = this.f16882;
                if (interfaceC4110 != null) {
                    interfaceC4110.mo1481(this);
                }
                boolean z = true;
                this.f16884 = true;
                try {
                    List<InterfaceC0230> list = this.f16890;
                    if (list != null) {
                        zM1403 = false;
                        for (InterfaceC0230 interfaceC0230 : list) {
                            InterfaceC4110 interfaceC41102 = this.f16882;
                            if (interfaceC41102 != null) {
                                interfaceC41102.getRoot().mo1484();
                            }
                            zM1403 |= interfaceC0230.m1403();
                        }
                    } else {
                        zM1403 = false;
                    }
                    if (!zM1403) {
                        InterfaceC4110 interfaceC41103 = this.f16882;
                        if (interfaceC41103 != null && !interfaceC41103.mo1485(this)) {
                            z = false;
                        }
                        if (z) {
                            if (this.f16887 == null) {
                                if (this.f16881 == null) {
                                    this.f16894.getClass();
                                    this.f16881 = null;
                                }
                                drawableM9443 = this.f16881;
                            }
                            if (drawableM9443 == null) {
                                if (this.f16876 == null) {
                                    this.f16876 = this.f16894.f8290;
                                }
                                drawableM9443 = this.f16876;
                            }
                            if (drawableM9443 == null) {
                                drawableM9443 = m9443();
                            }
                            this.f16895.mo3558(drawableM9443);
                        }
                    }
                } finally {
                    this.f16884 = false;
                }
            } catch (Throwable th) {
                throw th;
            }
        }
    }
}
