package o; import java.util.concurrent.CancellationException; import o.C13395fZS; /* renamed from: o.ggJ */ /* loaded from: classes.dex */ public final class C15069ggJ { private static final C15119ghh a = new C15119ghh("UNDEFINED"); public static final C15119ghh b = new C15119ghh("REUSABLE_CLAIMED"); public static final void a(InterfaceC14907gbi interfaceC14907gbi, Object obj, InterfaceC14894gbR interfaceC14894gbR) { AbstractC15050gfj c; if (!(interfaceC14907gbi instanceof ggM)) { interfaceC14907gbi.resumeWith(obj); return; } ggM ggm = (ggM) interfaceC14907gbi; Object e = geL.e(obj, null); AbstractC15004geU abstractC15004geU = ggm.h; ggm.getContext(); if (abstractC15004geU.c()) { ggm.a = e; ggm.d = 1; ggm.h.d(ggm.getContext(), ggm); return; } C15045gfe.b(); C15039gfT c15039gfT = C15039gfT.e; AbstractC15057gfq d = C15039gfT.d(); if (d.b >= 4294967296L) { ggm.a = e; ggm.d = 1; ggM ggm2 = ggm; ggE> gge = d.e; if (gge == null) { gge = new ggE<>(); d.e = gge; } gge.b(ggm2); return; } ggM ggm3 = ggm; d.c(true); try { InterfaceC15034gfD interfaceC15034gfD = (InterfaceC15034gfD) ggm.getContext().get(InterfaceC15034gfD.d); if (interfaceC15034gfD != null && !interfaceC15034gfD.d()) { CancellationException e2 = interfaceC15034gfD.e(); CancellationException cancellationException = e2; if (e instanceof C14999geJ) { ((C14999geJ) e).a.invoke(cancellationException); } C13395fZS.IeS ieS = C13395fZS.b; CancellationException cancellationException2 = e2; C14957gcv.e(cancellationException2, ""); ggm.resumeWith(C13395fZS.a(new C13395fZS.LWm(cancellationException2))); } else { InterfaceC14907gbi interfaceC14907gbi2 = ggm.e; Object obj2 = ggm.b; InterfaceC14912gbn context = interfaceC14907gbi2.getContext(); Object e3 = C15126gho.e(context, obj2); gfV e4 = e3 != C15126gho.e ? geQ.e(interfaceC14907gbi2, context, e3) : null; try { ggm.e.resumeWith(obj); C14866gag c14866gag = C14866gag.c; } finally { if (e4 != null) { if (e4.b.get() != null) { e4.b.set(null); } } C15126gho.c(context, e3); } } while (true) { ggE> gge2 = d.e; if (gge2 != null && (c = gge2.c()) != null) { c.run(); } } } finally { try { } finally { } } } public static final /* synthetic */ C15119ghh c() { return a; } }