package defpackage;

import android.util.Log;
import com.strmr.ps.data.model.ContentItem;
import com.strmr.ps.data.model.tmdb.TMDBImages;
import com.strmr.ps.data.remote.api.TMDBApiService;
import com.strmr.ps.ui.contextmenu.h;
import java.util.concurrent.CancellationException;
import kotlin.Metadata;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.jvm.internal.DebugMetadata;
import kotlin.coroutines.jvm.internal.SuspendLambda;

/* JADX INFO: loaded from: classes3.dex */
@Metadata(d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\u0010\u0002\u001a\u00020\u0001*\u00020\u0000H\n¢\u0006\u0004\b\u0002\u0010\u0003"}, d2 = {"Lak1;", "Le6a;", "<anonymous>", "(Lak1;)V"}, k = 3, mv = {2, 0, 0})
@DebugMetadata(c = "com.strmr.ps.ui.contextmenu.ContextMenuHelper$onChangeImageTypeSelected$1", f = "ContextMenuHelper.kt", i = {}, l = {222, 229, 236}, m = "invokeSuspend", n = {}, s = {})
final class hg1 extends SuspendLambda implements gr3<ak1, Continuation<? super e6a>, Object> {
    public int a;
    public final /* synthetic */ ContentItem b;
    public final /* synthetic */ TMDBApiService c;
    public final /* synthetic */ ir3 d;
    public final /* synthetic */ String e;
    public final /* synthetic */ h f;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public hg1(ContentItem contentItem, TMDBApiService tMDBApiService, ir3 ir3Var, String str, h hVar, Continuation continuation) {
        super(2, continuation);
        this.b = contentItem;
        this.c = tMDBApiService;
        this.d = ir3Var;
        this.e = str;
        this.f = hVar;
    }

    @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
    public final Continuation create(Object obj, Continuation continuation) {
        return new hg1(this.b, this.c, this.d, this.e, this.f, continuation);
    }

    @Override // defpackage.gr3
    public final Object invoke(Object obj, Object obj2) {
        return ((hg1) create((ak1) obj, (Continuation) obj2)).invokeSuspend(e6a.a);
    }

    /* JADX WARN: Code restructure failed: missing block: B:22:0x005c, code lost:
    
        if (defpackage.wj0.f(r12, r5, r11) == r1) goto L26;
     */
    /* JADX WARN: Code restructure failed: missing block: B:25:0x0077, code lost:
    
        if (defpackage.wj0.f(r12, r0, r11) != r1) goto L27;
     */
    @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final Object invokeSuspend(Object obj) throws Throwable {
        ck1 ck1Var = ck1.a;
        int i = this.a;
        try {
        } catch (CancellationException e) {
            throw e;
        } catch (Exception e2) {
            Log.e("ContextMenuHelper", "Failed to fetch TMDB images", e2);
            m12 m12Var = sc2.a;
            qm5 qm5Var = sm5.a;
            fg1 fg1Var = new fg1(this.f, null);
            this.a = 3;
        }
        if (i == 0) {
            s38.b(obj);
            m12 m12Var2 = sc2.a;
            m02 m02Var = m02.c;
            gg1 gg1Var = new gg1(this.b, this.c, null);
            this.a = 1;
            obj = wj0.f(m02Var, gg1Var, this);
            if (obj == ck1Var) {
            }
            return ck1Var;
        }
        if (i != 1) {
            if (i != 2 && i != 3) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            s38.b(obj);
            return e6a.a;
        }
        s38.b(obj);
        TMDBImages tMDBImages = (TMDBImages) obj;
        m12 m12Var3 = sc2.a;
        qm5 qm5Var2 = sm5.a;
        eg1 eg1Var = new eg1(this.d, this.b, this.e, tMDBImages, null);
        this.a = 2;
    }
}
