package wp;

import java.util.NoSuchElementException;
import kotlin.jvm.internal.o0;
import rm.n0;

/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes3.dex */
public abstract /* synthetic */ class q {

    /* loaded from: classes3.dex */
    public static final class a implements f {

        /* renamed from: p, reason: collision with root package name */
        final /* synthetic */ o0 f49654p;

        public a(o0 o0Var) {
            this.f49654p = o0Var;
        }

        @Override // wp.f
        public Object emit(Object obj, vm.d dVar) {
            this.f49654p.f26199p = obj;
            throw new xp.a(this);
        }
    }

    /* loaded from: classes3.dex */
    public static final class b implements f {

        /* renamed from: p, reason: collision with root package name */
        final /* synthetic */ dn.p f49655p;

        /* renamed from: q, reason: collision with root package name */
        final /* synthetic */ o0 f49656q;

        /* loaded from: classes3.dex */
        public static final class a extends kotlin.coroutines.jvm.internal.d {

            /* renamed from: p, reason: collision with root package name */
            Object f49657p;

            /* renamed from: q, reason: collision with root package name */
            /* synthetic */ Object f49658q;

            /* renamed from: r, reason: collision with root package name */
            int f49659r;

            /* renamed from: t, reason: collision with root package name */
            Object f49661t;

            public a(vm.d dVar) {
                super(dVar);
            }

            @Override // kotlin.coroutines.jvm.internal.a
            public final Object invokeSuspend(Object obj) {
                this.f49658q = obj;
                this.f49659r |= Integer.MIN_VALUE;
                return b.this.emit(null, this);
            }
        }

        public b(dn.p pVar, o0 o0Var) {
            this.f49655p = pVar;
            this.f49656q = o0Var;
        }

        /* JADX WARN: Removed duplicated region for block: B:12:0x0059  */
        /* JADX WARN: Removed duplicated region for block: B:14:0x0060  */
        /* JADX WARN: Removed duplicated region for block: B:17:0x0063  */
        /* JADX WARN: Removed duplicated region for block: B:21:0x0037  */
        /* JADX WARN: Removed duplicated region for block: B:8:0x0023  */
        @Override // wp.f
        /*
            Code decompiled incorrectly, please refer to instructions dump.
        */
        public Object emit(Object obj, vm.d dVar) {
            a aVar;
            Object obj2;
            Object f10;
            int i10;
            boolean z10;
            if (dVar instanceof a) {
                aVar = (a) dVar;
                int i11 = aVar.f49659r;
                if ((i11 & Integer.MIN_VALUE) != 0) {
                    aVar.f49659r = i11 - Integer.MIN_VALUE;
                    obj2 = aVar.f49658q;
                    f10 = wm.d.f();
                    i10 = aVar.f49659r;
                    z10 = true;
                    if (i10 != 0) {
                        rm.y.b(obj2);
                        dn.p pVar = this.f49655p;
                        aVar.f49657p = this;
                        aVar.f49661t = obj;
                        aVar.f49659r = 1;
                        kotlin.jvm.internal.r.c(6);
                        obj2 = pVar.invoke(obj, aVar);
                        kotlin.jvm.internal.r.c(7);
                        if (obj2 == f10) {
                            return f10;
                        }
                    } else {
                        if (i10 != 1) {
                            throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                        }
                        obj = aVar.f49661t;
                        this = (b) aVar.f49657p;
                        rm.y.b(obj2);
                    }
                    if (((Boolean) obj2).booleanValue()) {
                        this.f49656q.f26199p = obj;
                        z10 = false;
                    }
                    if (z10) {
                        throw new xp.a(this);
                    }
                    return n0.f34904a;
                }
            }
            aVar = new a(dVar);
            obj2 = aVar.f49658q;
            f10 = wm.d.f();
            i10 = aVar.f49659r;
            z10 = true;
            if (i10 != 0) {
            }
            if (((Boolean) obj2).booleanValue()) {
            }
            if (z10) {
            }
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes3.dex */
    public static final class c extends kotlin.coroutines.jvm.internal.d {

        /* renamed from: p, reason: collision with root package name */
        Object f49662p;

        /* renamed from: q, reason: collision with root package name */
        Object f49663q;

        /* renamed from: r, reason: collision with root package name */
        /* synthetic */ Object f49664r;

        /* renamed from: s, reason: collision with root package name */
        int f49665s;

        c(vm.d dVar) {
            super(dVar);
        }

        @Override // kotlin.coroutines.jvm.internal.a
        public final Object invokeSuspend(Object obj) {
            this.f49664r = obj;
            this.f49665s |= Integer.MIN_VALUE;
            return g.p(null, this);
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes3.dex */
    public static final class d extends kotlin.coroutines.jvm.internal.d {

        /* renamed from: p, reason: collision with root package name */
        Object f49666p;

        /* renamed from: q, reason: collision with root package name */
        Object f49667q;

        /* renamed from: r, reason: collision with root package name */
        Object f49668r;

        /* renamed from: s, reason: collision with root package name */
        /* synthetic */ Object f49669s;

        /* renamed from: t, reason: collision with root package name */
        int f49670t;

        d(vm.d dVar) {
            super(dVar);
        }

        @Override // kotlin.coroutines.jvm.internal.a
        public final Object invokeSuspend(Object obj) {
            this.f49669s = obj;
            this.f49670t |= Integer.MIN_VALUE;
            return g.o(null, null, this);
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:14:0x0070 A[RETURN] */
    /* JADX WARN: Removed duplicated region for block: B:16:0x0071  */
    /* JADX WARN: Removed duplicated region for block: B:23:0x003f  */
    /* JADX WARN: Removed duplicated region for block: B:8:0x0023  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public static final Object a(e eVar, dn.p pVar, vm.d dVar) {
        d dVar2;
        Object f10;
        int i10;
        dn.p pVar2;
        o0 o0Var;
        xp.a e10;
        f fVar;
        Object obj;
        if (dVar instanceof d) {
            dVar2 = (d) dVar;
            int i11 = dVar2.f49670t;
            if ((i11 & Integer.MIN_VALUE) != 0) {
                dVar2.f49670t = i11 - Integer.MIN_VALUE;
                Object obj2 = dVar2.f49669s;
                f10 = wm.d.f();
                i10 = dVar2.f49670t;
                if (i10 != 0) {
                    rm.y.b(obj2);
                    o0 o0Var2 = new o0();
                    o0Var2.f26199p = xp.p.f50997a;
                    f bVar = new b(pVar, o0Var2);
                    try {
                        dVar2.f49666p = pVar;
                        dVar2.f49667q = o0Var2;
                        dVar2.f49668r = bVar;
                        dVar2.f49670t = 1;
                        if (eVar.collect(bVar, dVar2) == f10) {
                            return f10;
                        }
                        pVar2 = pVar;
                        o0Var = o0Var2;
                    } catch (xp.a e11) {
                        pVar2 = pVar;
                        o0Var = o0Var2;
                        e10 = e11;
                        fVar = bVar;
                        xp.l.a(e10, fVar);
                        obj = o0Var.f26199p;
                        if (obj == xp.p.f50997a) {
                        }
                    }
                } else {
                    if (i10 != 1) {
                        throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                    }
                    fVar = (b) dVar2.f49668r;
                    o0Var = (o0) dVar2.f49667q;
                    pVar2 = (dn.p) dVar2.f49666p;
                    try {
                        rm.y.b(obj2);
                    } catch (xp.a e12) {
                        e10 = e12;
                        xp.l.a(e10, fVar);
                        obj = o0Var.f26199p;
                        if (obj == xp.p.f50997a) {
                        }
                    }
                }
                obj = o0Var.f26199p;
                if (obj == xp.p.f50997a) {
                    return obj;
                }
                throw new NoSuchElementException("Expected at least one element matching the predicate " + pVar2);
            }
        }
        dVar2 = new d(dVar);
        Object obj22 = dVar2.f49669s;
        f10 = wm.d.f();
        i10 = dVar2.f49670t;
        if (i10 != 0) {
        }
        obj = o0Var.f26199p;
        if (obj == xp.p.f50997a) {
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:14:0x0068 A[RETURN] */
    /* JADX WARN: Removed duplicated region for block: B:16:0x0069  */
    /* JADX WARN: Removed duplicated region for block: B:23:0x003b  */
    /* JADX WARN: Removed duplicated region for block: B:8:0x0023  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public static final Object b(e eVar, vm.d dVar) {
        c cVar;
        Object f10;
        int i10;
        o0 o0Var;
        xp.a e10;
        f fVar;
        Object obj;
        if (dVar instanceof c) {
            cVar = (c) dVar;
            int i11 = cVar.f49665s;
            if ((i11 & Integer.MIN_VALUE) != 0) {
                cVar.f49665s = i11 - Integer.MIN_VALUE;
                Object obj2 = cVar.f49664r;
                f10 = wm.d.f();
                i10 = cVar.f49665s;
                if (i10 != 0) {
                    rm.y.b(obj2);
                    o0 o0Var2 = new o0();
                    o0Var2.f26199p = xp.p.f50997a;
                    f aVar = new a(o0Var2);
                    try {
                        cVar.f49662p = o0Var2;
                        cVar.f49663q = aVar;
                        cVar.f49665s = 1;
                        if (eVar.collect(aVar, cVar) == f10) {
                            return f10;
                        }
                        o0Var = o0Var2;
                    } catch (xp.a e11) {
                        o0Var = o0Var2;
                        e10 = e11;
                        fVar = aVar;
                        xp.l.a(e10, fVar);
                        obj = o0Var.f26199p;
                        if (obj == xp.p.f50997a) {
                        }
                    }
                } else {
                    if (i10 != 1) {
                        throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                    }
                    fVar = (a) cVar.f49663q;
                    o0Var = (o0) cVar.f49662p;
                    try {
                        rm.y.b(obj2);
                    } catch (xp.a e12) {
                        e10 = e12;
                        xp.l.a(e10, fVar);
                        obj = o0Var.f26199p;
                        if (obj == xp.p.f50997a) {
                        }
                    }
                }
                obj = o0Var.f26199p;
                if (obj == xp.p.f50997a) {
                    return obj;
                }
                throw new NoSuchElementException("Expected at least one element");
            }
        }
        cVar = new c(dVar);
        Object obj22 = cVar.f49664r;
        f10 = wm.d.f();
        i10 = cVar.f49665s;
        if (i10 != 0) {
        }
        obj = o0Var.f26199p;
        if (obj == xp.p.f50997a) {
        }
    }
}
