package o; import o.InterfaceC14912gbn; import o.ggD; /* loaded from: classes6.dex */ public final class ggA extends AbstractC14916gbr implements InterfaceC15095ggw { private int a; private InterfaceC14907gbi b; private InterfaceC14912gbn c; private InterfaceC15095ggw d; public final InterfaceC14912gbn e; @Override // o.AbstractC14913gbo, o.InterfaceC14922gbx public final StackTraceElement getStackTraceElement() { return null; } /* JADX WARN: Multi-variable type inference failed */ public ggA(InterfaceC15095ggw interfaceC15095ggw, InterfaceC14912gbn interfaceC14912gbn) { super(C15097ggy.a, C14908gbj.e); this.d = interfaceC15095ggw; this.e = interfaceC14912gbn; this.a = ((Number) interfaceC14912gbn.fold(0, RVV.e)).intValue(); } @Override // o.AbstractC14913gbo, o.InterfaceC14922gbx public final InterfaceC14922gbx getCallerFrame() { InterfaceC14907gbi interfaceC14907gbi = this.b; if (interfaceC14907gbi instanceof InterfaceC14922gbx) { return (InterfaceC14922gbx) interfaceC14907gbi; } return null; } /* loaded from: classes6.dex */ static final class RVV extends AbstractC14961gcz implements InterfaceC14937gcb { public static final RVV e = new RVV(); @Override // o.InterfaceC14937gcb public final /* synthetic */ Integer invoke(Integer num, InterfaceC14912gbn.Sts sts) { return Integer.valueOf(num.intValue() + 1); } RVV() { super(2); } } @Override // o.AbstractC14916gbr, o.InterfaceC14907gbi public final InterfaceC14912gbn getContext() { InterfaceC14912gbn interfaceC14912gbn = this.c; return interfaceC14912gbn == null ? C14908gbj.e : interfaceC14912gbn; } @Override // o.AbstractC14913gbo public final Object invokeSuspend(Object obj) { Throwable d = C13395fZS.d(obj); if (d != null) { this.c = new C15096ggx(d, getContext()); } InterfaceC14907gbi interfaceC14907gbi = this.b; if (interfaceC14907gbi != null) { interfaceC14907gbi.resumeWith(obj); } return EnumC14910gbl.COROUTINE_SUSPENDED; } @Override // o.AbstractC14916gbr, o.AbstractC14913gbo public final void releaseIntercepted() { super.releaseIntercepted(); } @Override // o.InterfaceC15095ggw public final Object a(T t, InterfaceC14907gbi interfaceC14907gbi) { try { InterfaceC14912gbn context = interfaceC14907gbi.getContext(); InterfaceC15034gfD interfaceC15034gfD = (InterfaceC15034gfD) context.get(InterfaceC15034gfD.d); if (interfaceC15034gfD != null && !interfaceC15034gfD.d()) { throw interfaceC15034gfD.e(); } InterfaceC14912gbn interfaceC14912gbn = this.c; if (interfaceC14912gbn != context) { if (interfaceC14912gbn instanceof C15096ggx) { StringBuilder sb = new StringBuilder("\n Flow exception transparency is violated:\n Previous 'emit' call has thrown exception "); sb.append(((C15096ggx) interfaceC14912gbn).a); sb.append(", but then emission attempt of value '"); sb.append(t); sb.append("' has been detected.\n Emissions from 'catch' blocks are prohibited in order to avoid unspecified behaviour, 'Flow.catch' operator can be used instead.\n For a more detailed explanation, please refer to Flow documentation.\n "); throw new IllegalStateException(gdZ.c(sb.toString()).toString()); } if (((Number) context.fold(0, new ggD.Sts(this))).intValue() == this.a) { this.c = context; } else { StringBuilder sb2 = new StringBuilder("Flow invariant is violated:\n\t\tFlow was collected in "); sb2.append(this.e); sb2.append(",\n\t\tbut emission happened in "); sb2.append(context); sb2.append(".\n\t\tPlease refer to 'flow' documentation or use 'flowOn' instead"); throw new IllegalStateException(sb2.toString().toString()); } } this.b = interfaceC14907gbi; Object invoke = ggC.b().invoke(this.d, t, this); if (!C14957gcv.b(invoke, EnumC14910gbl.COROUTINE_SUSPENDED)) { this.b = null; } if (invoke == EnumC14910gbl.COROUTINE_SUSPENDED) { C14957gcv.e(interfaceC14907gbi, ""); } return invoke == EnumC14910gbl.COROUTINE_SUSPENDED ? invoke : C14866gag.c; } catch (Throwable th) { this.c = new C15096ggx(th, interfaceC14907gbi.getContext()); throw th; } } }