package com.strmr.ps.ui.base;

import com.strmr.ps.data.model.ContentItem;
import com.strmr.ps.data.repository.ScreenConfigRepository;
import defpackage.ak1;
import defpackage.ck1;
import defpackage.cr4;
import defpackage.e6a;
import defpackage.gf1;
import defpackage.gr3;
import defpackage.ng6;
import defpackage.s38;
import defpackage.vx8;
import defpackage.wj0;
import java.util.ArrayList;
import java.util.Iterator;
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\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.base.BaseContentViewModel$changeRowSort$1", f = "BaseContentViewModel.kt", i = {0, 1, 1}, l = {544, 881}, m = "invokeSuspend", n = {"$this$launch", "$this$launch", "$this$withLock_u24default$iv"}, s = {"L$0", "L$0", "L$1"})
@vx8
final class d extends SuspendLambda implements gr3<ak1, Continuation<? super e6a>, Object> {
    public ng6 a;
    public BaseContentViewModel b;
    public String c;
    public String d;
    public String e;
    public int f;
    public /* synthetic */ Object i;
    public final /* synthetic */ BaseContentViewModel j;
    public final /* synthetic */ String k;
    public final /* synthetic */ String l;
    public final /* synthetic */ String m;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public d(BaseContentViewModel baseContentViewModel, String str, String str2, String str3, Continuation continuation) {
        super(2, continuation);
        this.j = baseContentViewModel;
        this.k = str;
        this.l = str2;
        this.m = str3;
    }

    @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
    public final Continuation create(Object obj, Continuation continuation) {
        d dVar = new d(this.j, this.k, this.l, this.m, continuation);
        dVar.i = obj;
        return dVar;
    }

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

    /* JADX WARN: Removed duplicated region for block: B:22:0x0072 A[Catch: all -> 0x0084, TRY_LEAVE, TryCatch #0 {all -> 0x0084, blocks: (B:19:0x0064, B:20:0x006c, B:22:0x0072, B:33:0x008f), top: B:38:0x0064 }] */
    /* JADX WARN: Removed duplicated region for block: B:31:0x008b A[DONT_GENERATE] */
    /* JADX WARN: Removed duplicated region for block: B:33:0x008f A[Catch: all -> 0x0084, TRY_ENTER, TRY_LEAVE, TryCatch #0 {all -> 0x0084, blocks: (B:19:0x0064, B:20:0x006c, B:22:0x0072, B:33:0x008f), top: B:38:0x0064 }] */
    /* JADX WARN: Removed duplicated region for block: B:40:0x0086 A[SYNTHETIC] */
    @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final Object invokeSuspend(Object obj) {
        ak1 ak1Var;
        ng6 ng6Var;
        Iterator it;
        int i;
        ck1 ck1Var = ck1.a;
        int i2 = this.f;
        String str = this.m;
        String str2 = this.l;
        String str3 = this.k;
        BaseContentViewModel baseContentViewModel = this.j;
        if (i2 == 0) {
            s38.b(obj);
            ak1 ak1Var2 = (ak1) this.i;
            ScreenConfigRepository screenConfigRepository = baseContentViewModel.a;
            this.i = ak1Var2;
            this.f = 1;
            if (screenConfigRepository.updateRowSort(str3, str2, str, this) != ck1Var) {
                ak1Var = ak1Var2;
            }
            return ck1Var;
        }
        if (i2 != 1) {
            if (i2 != 2) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            str3 = this.e;
            str = this.d;
            str2 = this.c;
            baseContentViewModel = this.b;
            ng6Var = this.a;
            ak1Var = (ak1) this.i;
            s38.b(obj);
            try {
                ArrayList arrayList = baseContentViewModel.i;
                it = arrayList.iterator();
                i = 0;
                while (true) {
                    if (it.hasNext()) {
                        i = -1;
                        break;
                    }
                    if (cr4.b(((gf1) it.next()).a, str3)) {
                        break;
                    }
                    i++;
                }
                e6a e6aVar = e6a.a;
                if (i >= 0) {
                    return e6aVar;
                }
                gf1 gf1VarA = gf1.a((gf1) arrayList.get(i), str2, str);
                List list = gf1VarA.k;
                gf1VarA.l = 0;
                gf1VarA.m = true;
                gf1VarA.n = false;
                list.clear();
                list.addAll(ContentItem.INSTANCE.createPlaceholders(6));
                arrayList.set(i, gf1VarA);
                baseContentViewModel.k();
                wj0.c(ak1Var, null, null, new c(baseContentViewModel, i, gf1VarA, null), 3);
                return e6aVar;
            } finally {
                ng6Var.c(null);
            }
        }
        ak1Var = (ak1) this.i;
        s38.b(obj);
        ng6 ng6Var2 = baseContentViewModel.j;
        this.i = ak1Var;
        this.a = ng6Var2;
        this.b = baseContentViewModel;
        this.c = str2;
        this.d = str;
        this.e = str3;
        this.f = 2;
        if (ng6Var2.a(this) != ck1Var) {
            ng6Var = ng6Var2;
            ArrayList arrayList2 = baseContentViewModel.i;
            it = arrayList2.iterator();
            i = 0;
            while (true) {
                if (it.hasNext()) {
                }
                i++;
            }
            e6a e6aVar2 = e6a.a;
            if (i >= 0) {
            }
        }
        return ck1Var;
    }
}
