package com.strmr.ps.ui.traktlist;

import androidx.media3.extractor.ts.PsExtractor;
import com.strmr.ps.data.model.ContentItem;
import defpackage.ak1;
import defpackage.bk1;
import defpackage.ck1;
import defpackage.e6a;
import defpackage.gr3;
import defpackage.s38;
import java.util.List;
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\u0010\n\u0002\u0018\u0002\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0002\b\u0002\u0010\u0003\u001a\b\u0012\u0004\u0012\u00020\u00020\u0001*\u00020\u0000H\n¢\u0006\u0004\b\u0003\u0010\u0004"}, d2 = {"Lak1;", "", "Lcom/strmr/ps/data/model/ContentItem;", "<anonymous>", "(Lak1;)Ljava/util/List;"}, k = 3, mv = {2, 0, 0})
@DebugMetadata(c = "com.strmr.ps.ui.traktlist.TraktListViewModel$load$1$loadedItems$1", f = "TraktListViewModel.kt", i = {1}, l = {185, 186, PsExtractor.AUDIO_STREAM}, m = "invokeSuspend", n = {"authHeader"}, s = {"L$0"})
final class n extends SuspendLambda implements gr3<ak1, Continuation<? super List<? extends ContentItem>>, Object> {
    public String a;
    public int b;
    public final /* synthetic */ TraktListViewModel c;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public n(TraktListViewModel traktListViewModel, Continuation continuation) {
        super(2, continuation);
        this.c = traktListViewModel;
    }

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

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

    /* JADX WARN: Code restructure failed: missing block: B:22:0x005e, code lost:
    
        if (r8 == r0) goto L23;
     */
    @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final Object invokeSuspend(Object obj) {
        String str;
        ck1 ck1Var = ck1.a;
        int i = this.b;
        TraktListViewModel traktListViewModel = this.c;
        if (i == 0) {
            s38.b(obj);
            this.b = 1;
            obj = TraktListViewModel.f(traktListViewModel, this);
            if (obj != ck1Var) {
            }
            return ck1Var;
        }
        if (i == 1) {
            s38.b(obj);
        } else {
            if (i != 2) {
                if (i != 3) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                s38.b(obj);
                return (List) obj;
            }
            str = this.a;
            s38.b(obj);
            List list = (List) obj;
            if (!list.isEmpty() && str != null) {
                this.a = null;
                this.b = 3;
                obj = bk1.c(new g(traktListViewModel, null, 1, null), this);
            }
        }
        str = (String) obj;
        this.a = str;
        this.b = 2;
        obj = bk1.c(new g(traktListViewModel, str, 1, null), this);
        if (obj != ck1Var) {
            List list2 = (List) obj;
            return !list2.isEmpty() ? list2 : list2;
        }
        return ck1Var;
    }
}
