package o; import kotlinx.coroutines.channels.ClosedReceiveChannelException; import o.C13395fZS; import o.C15112gha; import o.ggU; /* loaded from: classes6.dex */ public abstract class gfZ extends AbstractC15079ggg implements InterfaceC15078ggf { protected abstract boolean e(); /* loaded from: classes6.dex */ public static final class LWm extends ggU.HBt { private gfZ a; /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ public LWm(ggU ggu, gfZ gfz) { super(ggu); this.a = gfz; } @Override // o.ggF public final /* synthetic */ Object e(ggU ggu) { if (this.a.e()) { return null; } return ggT.a(); } } public gfZ(InterfaceC14894gbR interfaceC14894gbR) { super(null); } protected Object c() { AbstractC15087ggo f; do { f = f(); if (f == null) { return C15074ggb.d; } } while (f.e() == null); C15045gfe.b(); return f.a(); } /* JADX INFO: Access modifiers changed from: protected */ public boolean a(AbstractC15082ggj abstractC15082ggj) { int e; ggR i = i(); AbstractC15082ggj abstractC15082ggj2 = abstractC15082ggj; LWm lWm = new LWm(abstractC15082ggj2, this); do { ggU b = i.b(); if (b == null) { b = ggU.a((ggU) i._prev); } if (!(!(b instanceof AbstractC15087ggo))) { break; } e = b.e(abstractC15082ggj2, i, lWm); if (e == 1) { return true; } } while (e != 2); return false; } @Override // o.InterfaceC15081ggi public final InterfaceC15080ggh b() { return new RVV(this); } /* JADX INFO: Access modifiers changed from: protected */ @Override // o.AbstractC15079ggg public final InterfaceC15083ggk d() { return super.d(); } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes6.dex */ public final class HBt extends AbstractC15021gep { private final AbstractC15082ggj c; private gfZ d; public HBt(gfZ gfz, AbstractC15082ggj abstractC15082ggj) { this.d = gfz; this.c = abstractC15082ggj; } @Override // o.InterfaceC14894gbR public final /* synthetic */ C14866gag invoke(Throwable th) { this.c.bw_(); return C14866gag.c; } @Override // o.AbstractC15025get public final void e(Throwable th) { this.c.bw_(); } public final String toString() { StringBuilder sb = new StringBuilder("RemoveReceiveOnCancel["); sb.append(this.c); sb.append(']'); return sb.toString(); } } /* loaded from: classes6.dex */ static final class RVV implements InterfaceC15080ggh { Object a = C15074ggb.d; public final gfZ d; public RVV(gfZ gfz) { this.d = gfz; } @Override // o.InterfaceC15080ggh public final Object d(InterfaceC14907gbi interfaceC14907gbi) { boolean z = false; if (this.a == C15074ggb.d) { Object c = this.d.c(); this.a = c; if (c != C15074ggb.d) { Object obj = this.a; if (obj instanceof C15085ggm) { Throwable th = ((C15085ggm) obj).d; } else { z = true; } return Boolean.valueOf(z); } geA e = geB.e(C14911gbm.a(interfaceC14907gbi)); geA gea = e; Sts sts = new Sts(this, gea); while (true) { Sts sts2 = sts; if (this.d.a(sts2)) { gfZ.d(this.d, gea, sts2); break; } Object c2 = this.d.c(); this.a = c2; if (c2 instanceof C15085ggm) { Throwable th2 = ((C15085ggm) c2).d; C13395fZS.IeS ieS = C13395fZS.b; gea.resumeWith(C13395fZS.a(Boolean.FALSE)); break; } if (c2 != C15074ggb.d) { Boolean bool = Boolean.TRUE; InterfaceC14894gbR interfaceC14894gbR = this.d.d; gea.b(bool, interfaceC14894gbR != null ? new C15112gha.RVV(interfaceC14894gbR, c2, gea.getContext()) : null); } } Object e2 = e.e(); if (e2 == EnumC14910gbl.COROUTINE_SUSPENDED) { C14957gcv.e(interfaceC14907gbi, ""); } return e2; } Object obj2 = this.a; if (obj2 instanceof C15085ggm) { Throwable th3 = ((C15085ggm) obj2).d; } else { z = true; } return Boolean.valueOf(z); } /* JADX WARN: Multi-variable type inference failed */ @Override // o.InterfaceC15080ggh public final E e() { E e = (E) this.a; if (e instanceof C15085ggm) { Throwable th = ((C15085ggm) e).d; throw C15120ghi.d(new ClosedReceiveChannelException("Channel was closed")); } if (e != C15074ggb.d) { this.a = C15074ggb.d; return e; } throw new IllegalStateException("'hasNext' should be called prior to 'next' invocation"); } } /* loaded from: classes6.dex */ static class Sts extends AbstractC15082ggj { private RVV a; private InterfaceC15027gev d; /* JADX WARN: Multi-variable type inference failed */ public Sts(RVV rvv, InterfaceC15027gev interfaceC15027gev) { this.a = rvv; this.d = interfaceC15027gev; } @Override // o.InterfaceC15083ggk public final C15119ghh b(E e) { InterfaceC15027gev interfaceC15027gev = this.d; Boolean bool = Boolean.TRUE; InterfaceC14894gbR interfaceC14894gbR = this.a.d.d; if (interfaceC15027gev.c(bool, interfaceC14894gbR != null ? new C15112gha.RVV(interfaceC14894gbR, e, this.d.getContext()) : null) == null) { return null; } C15045gfe.b(); return geC.b; } @Override // o.AbstractC15082ggj public final void a(C15085ggm c15085ggm) { Throwable th = c15085ggm.d; if (this.d.c(Boolean.FALSE) != null) { this.a.a = c15085ggm; this.d.c(); } } @Override // o.ggU public final String toString() { StringBuilder sb = new StringBuilder("ReceiveHasNext@"); sb.append(C15041gfa.b(this)); return sb.toString(); } @Override // o.InterfaceC15083ggk public final void c(E e) { this.a.a = e; InterfaceC15027gev interfaceC15027gev = this.d; C15119ghh c15119ghh = geC.b; interfaceC15027gev.c(); } } public static final /* synthetic */ void d(gfZ gfz, InterfaceC15027gev interfaceC15027gev, AbstractC15082ggj abstractC15082ggj) { interfaceC15027gev.e(new HBt(gfz, abstractC15082ggj)); } }