package b3;

import C4.j;
import T1.n;
import V4.C;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import coil.ImageLoader;
import coil.request.ImageRequest;
import coil.request.ImageResult;
import coil.size.Size;
import k2.C2378d;
import k2.C2379e;
import k2.C2380f;
import m3.AbstractC2467b;
import p0.AbstractC2686D;
import p0.C2714u;
import w4.C3137A;
import w4.m;

/* JADX INFO: loaded from: classes.dex */
public final class e extends j implements J4.e {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public int f13281a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public long f13282b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public boolean f13283c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public float f13284d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public int f13285e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public /* synthetic */ Object f13286f;

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    public final /* synthetic */ long f13287j;

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public final /* synthetic */ Context f13288k;
    public final /* synthetic */ String l;

    /* JADX INFO: renamed from: m, reason: collision with root package name */
    public final /* synthetic */ Size f13289m;

    /* JADX INFO: renamed from: n, reason: collision with root package name */
    public final /* synthetic */ ImageLoader f13290n;

    /* JADX INFO: renamed from: o, reason: collision with root package name */
    public final /* synthetic */ boolean f13291o;

    /* JADX INFO: renamed from: p, reason: collision with root package name */
    public final /* synthetic */ float f13292p;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public e(long j4, Context context, String str, Size size, ImageLoader imageLoader, boolean z6, float f6, A4.d dVar) {
        super(2, dVar);
        this.f13287j = j4;
        this.f13288k = context;
        this.l = str;
        this.f13289m = size;
        this.f13290n = imageLoader;
        this.f13291o = z6;
        this.f13292p = f6;
    }

    @Override // C4.a
    public final A4.d create(Object obj, A4.d dVar) {
        e eVar = new e(this.f13287j, this.f13288k, this.l, this.f13289m, this.f13290n, this.f13291o, this.f13292p, dVar);
        eVar.f13286f = obj;
        return eVar;
    }

    @Override // J4.e
    public final Object invoke(Object obj, Object obj2) {
        return ((e) create((C) obj, (A4.d) obj2)).invokeSuspend(C3137A.f25453a);
    }

    /* JADX WARN: Removed duplicated region for block: B:83:0x019e  */
    /* JADX WARN: Removed duplicated region for block: B:87:? A[RETURN, SYNTHETIC] */
    @Override // C4.a
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final Object invokeSuspend(Object obj) {
        Object objD;
        int i6;
        boolean z6;
        float f6;
        long jY;
        BitmapDrawable bitmapDrawable;
        Bitmap bitmap;
        Integer num;
        int iIntValue;
        B4.a aVar = B4.a.f492a;
        int i7 = this.f13285e;
        long j4 = this.f13287j;
        try {
            if (i7 == 0) {
                AbstractC2467b.l(obj);
                int iRgb = Color.rgb(L4.a.v((int) (C2714u.i(j4) * 255.0f), 0, 255), L4.a.v((int) (C2714u.h(j4) * 255.0f), 0, 255), L4.a.v((int) (C2714u.f(j4) * 255.0f), 0, 255)) | (-16777216);
                ImageRequest imageRequestBuild = new ImageRequest.Builder(this.f13288k).data(this.l).size(this.f13289m).allowHardware(false).build();
                ImageLoader imageLoader = this.f13290n;
                boolean z7 = this.f13291o;
                float f7 = this.f13292p;
                this.f13281a = iRgb;
                this.f13282b = j4;
                this.f13283c = z7;
                this.f13284d = f7;
                this.f13285e = 1;
                Object objExecute = imageLoader.execute(imageRequestBuild, this);
                if (objExecute == aVar) {
                    return aVar;
                }
                i6 = iRgb;
                obj = objExecute;
                z6 = z7;
                f6 = f7;
                jY = j4;
            } else {
                if (i7 != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                f6 = this.f13284d;
                z6 = this.f13283c;
                jY = this.f13282b;
                i6 = this.f13281a;
                AbstractC2467b.l(obj);
            }
            Drawable drawable = ((ImageResult) obj).getDrawable();
            bitmapDrawable = drawable instanceof BitmapDrawable ? (BitmapDrawable) drawable : null;
        } catch (Throwable th) {
            objD = AbstractC2467b.d(th);
        }
        if (bitmapDrawable != null && (bitmap = bitmapDrawable.getBitmap()) != null) {
            C2379e c2379eA = new n(bitmap).a();
            C2378d c2378d = c2379eA.f19770d;
            if (z6) {
                C2378d c2378dA = c2379eA.a(C2380f.f19772e);
                if (c2378dA != null) {
                    iIntValue = c2378dA.f19760d;
                } else if (c2378d != null) {
                    iIntValue = c2378d.f19760d;
                } else {
                    C2378d c2378dA2 = c2379eA.a(C2380f.f19773f);
                    Integer num2 = c2378dA2 != null ? new Integer(c2378dA2.f19760d) : null;
                    if (num2 == null) {
                        C2378d c2378dA3 = c2379eA.a(C2380f.f19775h);
                        num2 = c2378dA3 != null ? new Integer(c2378dA3.f19760d) : null;
                        if (num2 != null) {
                            iIntValue = num2.intValue();
                        } else {
                            C2378d c2378dA4 = c2379eA.a(C2380f.f19776i);
                            num = c2378dA4 != null ? new Integer(c2378dA4.f19760d) : null;
                            if (num != null) {
                                iIntValue = num.intValue();
                            } else {
                                if (c2378d != null) {
                                    i6 = c2378d.f19760d;
                                }
                                iIntValue = i6;
                            }
                        }
                    } else {
                        iIntValue = num2.intValue();
                    }
                }
                int i8 = f.f13294b;
                jY = AbstractC2686D.y(AbstractC2686D.f(Color.red(iIntValue) / 255.0f, Color.green(iIntValue) / 255.0f, Color.blue(iIntValue) / 255.0f, 0.0f, 24), L4.a.u(f6, 0.0f, 1.0f), C2714u.f22935b);
            } else {
                if (c2378d != null) {
                    iIntValue = c2378d.f19760d;
                } else {
                    C2378d c2378dA5 = c2379eA.a(C2380f.f19772e);
                    if (c2378dA5 != null) {
                        iIntValue = c2378dA5.f19760d;
                    } else {
                        C2378d c2378dA6 = c2379eA.a(C2380f.f19773f);
                        Integer num3 = c2378dA6 != null ? new Integer(c2378dA6.f19760d) : null;
                        if (num3 == null) {
                            C2378d c2378dA7 = c2379eA.a(C2380f.f19775h);
                            num3 = c2378dA7 != null ? new Integer(c2378dA7.f19760d) : null;
                            if (num3 != null) {
                                iIntValue = num3.intValue();
                            } else {
                                C2378d c2378dA8 = c2379eA.a(C2380f.f19776i);
                                num = c2378dA8 != null ? new Integer(c2378dA8.f19760d) : null;
                                if (num != null) {
                                    iIntValue = num.intValue();
                                } else {
                                    if (c2378d != null) {
                                        i6 = c2378d.f19760d;
                                    }
                                    iIntValue = i6;
                                }
                            }
                        } else {
                            iIntValue = num3.intValue();
                        }
                    }
                }
                int i82 = f.f13294b;
                jY = AbstractC2686D.y(AbstractC2686D.f(Color.red(iIntValue) / 255.0f, Color.green(iIntValue) / 255.0f, Color.blue(iIntValue) / 255.0f, 0.0f, 24), L4.a.u(f6, 0.0f, 1.0f), C2714u.f22935b);
            }
            return !(objD instanceof m) ? new C2714u(j4) : objD;
        }
        objD = new C2714u(jY);
        if (!(objD instanceof m)) {
        }
    }
}
