package coil.intercept;

import A4.d;
import B4.a;
import C4.e;
import C4.j;
import V4.C;
import V4.E;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import coil.EventListener;
import coil.intercept.EngineInterceptor;
import coil.request.ImageRequest;
import coil.request.Options;
import coil.size.Size;
import coil.transform.Transformation;
import java.util.List;
import m3.AbstractC2467b;
import w4.C3137A;

/* JADX INFO: loaded from: classes.dex */
@e(c = "coil.intercept.EngineInterceptor$transform$3", f = "EngineInterceptor.kt", l = {246}, m = "invokeSuspend")
public final class EngineInterceptor$transform$3 extends j implements J4.e {
    final /* synthetic */ EventListener $eventListener;
    final /* synthetic */ Options $options;
    final /* synthetic */ ImageRequest $request;
    final /* synthetic */ EngineInterceptor.ExecuteResult $result;
    final /* synthetic */ List<Transformation> $transformations;
    int I$0;
    int I$1;
    private /* synthetic */ Object L$0;
    Object L$1;
    Object L$2;
    int label;
    final /* synthetic */ EngineInterceptor this$0;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    /* JADX WARN: Multi-variable type inference failed */
    public EngineInterceptor$transform$3(EngineInterceptor engineInterceptor, EngineInterceptor.ExecuteResult executeResult, Options options, List<? extends Transformation> list, EventListener eventListener, ImageRequest imageRequest, d dVar) {
        super(2, dVar);
        this.this$0 = engineInterceptor;
        this.$result = executeResult;
        this.$options = options;
        this.$transformations = list;
        this.$eventListener = eventListener;
        this.$request = imageRequest;
    }

    @Override // C4.a
    public final d create(Object obj, d dVar) {
        EngineInterceptor$transform$3 engineInterceptor$transform$3 = new EngineInterceptor$transform$3(this.this$0, this.$result, this.$options, this.$transformations, this.$eventListener, this.$request, dVar);
        engineInterceptor$transform$3.L$0 = obj;
        return engineInterceptor$transform$3;
    }

    @Override // J4.e
    public final Object invoke(C c6, d dVar) {
        return ((EngineInterceptor$transform$3) create(c6, dVar)).invokeSuspend(C3137A.f25453a);
    }

    /* JADX WARN: Removed duplicated region for block: B:10:0x0054  */
    /* JADX WARN: Removed duplicated region for block: B:14:0x007c  */
    /* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:11:0x006e -> B:13:0x0071). Please report as a decompilation issue!!! */
    @Override // C4.a
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final Object invokeSuspend(Object obj) {
        Options options;
        C c6;
        Bitmap bitmap;
        int size;
        List<Transformation> list;
        int i6;
        a aVar = a.f492a;
        int i7 = this.label;
        if (i7 == 0) {
            AbstractC2467b.l(obj);
            C c7 = (C) this.L$0;
            Bitmap bitmapConvertDrawableToBitmap = this.this$0.convertDrawableToBitmap(this.$result.getDrawable(), this.$options, this.$transformations);
            this.$eventListener.transformStart(this.$request, bitmapConvertDrawableToBitmap);
            List<Transformation> list2 = this.$transformations;
            options = this.$options;
            c6 = c7;
            bitmap = bitmapConvertDrawableToBitmap;
            size = list2.size();
            list = list2;
            i6 = 0;
            if (i6 < size) {
            }
        } else {
            if (i7 != 1) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            size = this.I$1;
            i6 = this.I$0;
            options = (Options) this.L$2;
            list = (List) this.L$1;
            c6 = (C) this.L$0;
            AbstractC2467b.l(obj);
            bitmap = (Bitmap) obj;
            E.m(c6.getCoroutineContext());
            i6++;
            if (i6 < size) {
                Transformation transformation = list.get(i6);
                Size size2 = options.getSize();
                this.L$0 = c6;
                this.L$1 = list;
                this.L$2 = options;
                this.I$0 = i6;
                this.I$1 = size;
                this.label = 1;
                obj = transformation.transform(bitmap, size2, this);
                if (obj == aVar) {
                    return aVar;
                }
                bitmap = (Bitmap) obj;
                E.m(c6.getCoroutineContext());
                i6++;
                if (i6 < size) {
                    this.$eventListener.transformEnd(this.$request, bitmap);
                    return EngineInterceptor.ExecuteResult.copy$default(this.$result, new BitmapDrawable(this.$request.getContext().getResources(), bitmap), false, null, null, 14, null);
                }
            }
        }
    }
}
