package h3;

import androidx.compose.runtime.MutableIntState;
import androidx.compose.runtime.MutableState;
import androidx.compose.runtime.State;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import m3.AbstractC2467b;
import w4.C3137A;
import x4.AbstractC3251q;
import x4.AbstractC3252r;

/* JADX INFO: renamed from: h3.e1, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class C2104e1 extends C4.j implements J4.e {

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

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

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final /* synthetic */ Integer f17885c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final /* synthetic */ Integer f17886d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public final /* synthetic */ D.H f17887e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public final /* synthetic */ MutableState f17888f;

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

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public final /* synthetic */ MutableIntState f17890k;
    public final /* synthetic */ Map l;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public C2104e1(Integer num, Integer num2, D.H h5, MutableState mutableState, State state, MutableIntState mutableIntState, Map map, A4.d dVar) {
        super(2, dVar);
        this.f17885c = num;
        this.f17886d = num2;
        this.f17887e = h5;
        this.f17888f = mutableState;
        this.f17889j = state;
        this.f17890k = mutableIntState;
        this.l = map;
    }

    @Override // C4.a
    public final A4.d create(Object obj, A4.d dVar) {
        return new C2104e1(this.f17885c, this.f17886d, this.f17887e, this.f17888f, this.f17889j, this.f17890k, this.l, dVar);
    }

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

    /* JADX WARN: Code restructure failed: missing block: B:46:0x00d2, code lost:
    
        if (V4.E.l(50, r11) == r1) goto L47;
     */
    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Removed duplicated region for block: B:40:0x00ab  */
    /* JADX WARN: Removed duplicated region for block: B:44:0x00c7  */
    @Override // C4.a
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final Object invokeSuspend(Object obj) {
        X2.i iVar;
        int iIntValue;
        int iV;
        int i6;
        Integer num;
        B4.a aVar = B4.a.f492a;
        int i7 = this.f17884b;
        C3137A c3137a = C3137A.f25453a;
        State state = this.f17889j;
        MutableState mutableState = this.f17888f;
        if (i7 == 0) {
            AbstractC2467b.l(obj);
            J.f fVar = AbstractC2211w1.f18642a;
            if (!((Boolean) mutableState.getValue()).booleanValue() && !((List) state.getValue()).isEmpty() && (iVar = (X2.i) AbstractC3251q.g0((List) state.getValue())) != null) {
                MutableIntState mutableIntState = this.f17890k;
                if (iVar.f8598f == mutableIntState.getIntValue()) {
                    Integer num2 = this.f17885c;
                    if (num2 == null || (num = this.f17886d) == null || mutableIntState.getIntValue() != num2.intValue()) {
                        iIntValue = 0;
                        iV = L4.a.v(iIntValue, 0, AbstractC3252r.A((List) state.getValue()));
                        this.f17883a = iIntValue;
                        this.f17884b = 1;
                        if (D.H.k(this.f17887e, iV, this) != aVar) {
                            i6 = iIntValue;
                        }
                        return aVar;
                    }
                    Iterator it = ((List) state.getValue()).iterator();
                    int i8 = 0;
                    while (true) {
                        if (!it.hasNext()) {
                            i8 = -1;
                            break;
                        }
                        if (((X2.i) it.next()).f8597e == num.intValue()) {
                            break;
                        }
                        i8++;
                    }
                    Integer num3 = new Integer(i8);
                    if (num3.intValue() < 0) {
                        num3 = null;
                    }
                    if (num3 != null) {
                        iIntValue = num3.intValue();
                    }
                    iV = L4.a.v(iIntValue, 0, AbstractC3252r.A((List) state.getValue()));
                    this.f17883a = iIntValue;
                    this.f17884b = 1;
                    if (D.H.k(this.f17887e, iV, this) != aVar) {
                    }
                    return aVar;
                }
            }
            return c3137a;
        }
        if (i7 != 1) {
            if (i7 != 2) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            i6 = this.f17883a;
            AbstractC2467b.l(obj);
            J.f fVar2 = AbstractC2211w1.f18642a;
            X2.i iVar2 = (X2.i) AbstractC3251q.h0(i6, (List) state.getValue());
            if (iVar2 != null) {
                n0.x xVar = (n0.x) this.l.get(new Integer(iVar2.f8593a));
                if (xVar != null) {
                    n0.x.a(xVar);
                }
            }
            mutableState.setValue(Boolean.TRUE);
            return c3137a;
        }
        i6 = this.f17883a;
        AbstractC2467b.l(obj);
        this.f17883a = i6;
        this.f17884b = 2;
    }
}
