package xp;

import rm.n0;
import rm.y;
import tp.h0;
import vm.e;

/* loaded from: classes3.dex */
public abstract class g extends e {

    /* renamed from: s, reason: collision with root package name */
    protected final wp.e f50969s;

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

        /* renamed from: p, reason: collision with root package name */
        int f50970p;

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

        a(vm.d dVar) {
            super(2, dVar);
        }

        @Override // dn.p
        /* renamed from: b, reason: merged with bridge method [inline-methods] */
        public final Object invoke(wp.f fVar, vm.d dVar) {
            return ((a) create(fVar, dVar)).invokeSuspend(n0.f34904a);
        }

        @Override // kotlin.coroutines.jvm.internal.a
        public final vm.d create(Object obj, vm.d dVar) {
            a aVar = new a(dVar);
            aVar.f50971q = obj;
            return aVar;
        }

        @Override // kotlin.coroutines.jvm.internal.a
        public final Object invokeSuspend(Object obj) {
            Object f10;
            f10 = wm.d.f();
            int i10 = this.f50970p;
            if (i10 == 0) {
                y.b(obj);
                wp.f fVar = (wp.f) this.f50971q;
                g gVar = g.this;
                this.f50970p = 1;
                if (gVar.q(fVar, this) == f10) {
                    return f10;
                }
            } else {
                if (i10 != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                y.b(obj);
            }
            return n0.f34904a;
        }
    }

    public g(wp.e eVar, vm.g gVar, int i10, vp.a aVar) {
        super(gVar, i10, aVar);
        this.f50969s = eVar;
    }

    static /* synthetic */ Object n(g gVar, wp.f fVar, vm.d dVar) {
        Object f10;
        Object f11;
        Object f12;
        if (gVar.f50960q == -3) {
            vm.g context = dVar.getContext();
            vm.g e10 = h0.e(context, gVar.f50959p);
            if (kotlin.jvm.internal.t.b(e10, context)) {
                Object q10 = gVar.q(fVar, dVar);
                f12 = wm.d.f();
                return q10 == f12 ? q10 : n0.f34904a;
            }
            e.Companion companion = vm.e.INSTANCE;
            if (kotlin.jvm.internal.t.b(e10.d(companion), context.d(companion))) {
                Object p10 = gVar.p(fVar, e10, dVar);
                f11 = wm.d.f();
                return p10 == f11 ? p10 : n0.f34904a;
            }
        }
        Object collect = super.collect(fVar, dVar);
        f10 = wm.d.f();
        return collect == f10 ? collect : n0.f34904a;
    }

    static /* synthetic */ Object o(g gVar, vp.s sVar, vm.d dVar) {
        Object f10;
        Object q10 = gVar.q(new t(sVar), dVar);
        f10 = wm.d.f();
        return q10 == f10 ? q10 : n0.f34904a;
    }

    private final Object p(wp.f fVar, vm.g gVar, vm.d dVar) {
        Object f10;
        Object c10 = f.c(gVar, f.a(fVar, dVar.getContext()), null, new a(null), dVar, 4, null);
        f10 = wm.d.f();
        return c10 == f10 ? c10 : n0.f34904a;
    }

    @Override // xp.e, wp.e
    public Object collect(wp.f fVar, vm.d dVar) {
        return n(this, fVar, dVar);
    }

    @Override // xp.e
    protected Object h(vp.s sVar, vm.d dVar) {
        return o(this, sVar, dVar);
    }

    protected abstract Object q(wp.f fVar, vm.d dVar);

    @Override // xp.e
    public String toString() {
        return this.f50969s + " -> " + super.toString();
    }
}
