137 lines
5.2 KiB
Java
137 lines
5.2 KiB
Java
package s.a;
|
|
|
|
import d0.l;
|
|
import d0.w.g.c;
|
|
import d0.w.h.a.d;
|
|
import d0.w.h.a.e;
|
|
import d0.z.d.e0;
|
|
import kotlin.coroutines.Continuation;
|
|
import kotlin.jvm.functions.Function2;
|
|
import kotlin.jvm.internal.Ref$ObjectRef;
|
|
import kotlinx.coroutines.CoroutineScope;
|
|
import kotlinx.coroutines.TimeoutCancellationException;
|
|
/* compiled from: Builders.common.kt */
|
|
public final /* synthetic */ class g {
|
|
|
|
/* compiled from: Timeout.kt */
|
|
@e(c = "kotlinx.coroutines.TimeoutKt", f = "Timeout.kt", l = {101}, m = "withTimeoutOrNull")
|
|
public static final class a extends d {
|
|
public long J$0;
|
|
public Object L$0;
|
|
public Object L$1;
|
|
public int label;
|
|
public /* synthetic */ Object result;
|
|
|
|
public a(Continuation continuation) {
|
|
super(continuation);
|
|
}
|
|
|
|
@Override // d0.w.h.a.a
|
|
public final Object invokeSuspend(Object obj) {
|
|
this.result = obj;
|
|
this.label |= Integer.MIN_VALUE;
|
|
return g.b(0, null, this);
|
|
}
|
|
}
|
|
|
|
public static final <U, T extends U> Object a(r1<U, ? super T> r1Var, Function2<? super CoroutineScope, ? super Continuation<? super T>, ? extends Object> function2) {
|
|
Object obj;
|
|
boolean z2 = false;
|
|
r1Var.f(false, true, new m0(r1Var, c.q.a.k.a.s(r1Var.l.getContext()).w(r1Var.m, r1Var, r1Var.j)));
|
|
r1Var.Y();
|
|
if (function2 != null) {
|
|
try {
|
|
obj = ((Function2) e0.beforeCheckcastToFunctionOfArity(function2, 2)).invoke(r1Var, r1Var);
|
|
} catch (Throwable th) {
|
|
obj = new u(th, false, 2);
|
|
}
|
|
if (obj == c.getCOROUTINE_SUSPENDED()) {
|
|
return c.getCOROUTINE_SUSPENDED();
|
|
}
|
|
Object L = r1Var.L(obj);
|
|
if (L == f1.b) {
|
|
return c.getCOROUTINE_SUSPENDED();
|
|
}
|
|
if (!(L instanceof u)) {
|
|
return f1.a(L);
|
|
}
|
|
Throwable th2 = ((u) L).b;
|
|
if (!(th2 instanceof TimeoutCancellationException) || ((TimeoutCancellationException) th2).coroutine != r1Var) {
|
|
z2 = true;
|
|
}
|
|
if (z2) {
|
|
throw th2;
|
|
} else if (!(obj instanceof u)) {
|
|
return obj;
|
|
} else {
|
|
throw ((u) obj).b;
|
|
}
|
|
} else {
|
|
throw new NullPointerException("null cannot be cast to non-null type (R, kotlin.coroutines.Continuation<T>) -> kotlin.Any?");
|
|
}
|
|
}
|
|
|
|
/* JADX WARNING: Removed duplicated region for block: B:15:0x003c */
|
|
/* JADX WARNING: Removed duplicated region for block: B:8:0x0024 */
|
|
public static final <T> Object b(long j, Function2<? super CoroutineScope, ? super Continuation<? super T>, ? extends Object> function2, Continuation<? super T> continuation) {
|
|
a aVar;
|
|
int i;
|
|
TimeoutCancellationException e;
|
|
Ref$ObjectRef ref$ObjectRef;
|
|
if (continuation instanceof a) {
|
|
aVar = (a) continuation;
|
|
int i2 = aVar.label;
|
|
if ((i2 & Integer.MIN_VALUE) != 0) {
|
|
aVar.label = i2 - Integer.MIN_VALUE;
|
|
Object obj = aVar.result;
|
|
Object coroutine_suspended = c.getCOROUTINE_SUSPENDED();
|
|
i = aVar.label;
|
|
if (i != 0) {
|
|
l.throwOnFailure(obj);
|
|
if (j <= 0) {
|
|
return null;
|
|
}
|
|
Ref$ObjectRef ref$ObjectRef2 = new Ref$ObjectRef();
|
|
ref$ObjectRef2.element = null;
|
|
try {
|
|
aVar.J$0 = j;
|
|
aVar.L$0 = function2;
|
|
aVar.L$1 = ref$ObjectRef2;
|
|
aVar.label = 1;
|
|
T t = (T) new r1(j, aVar);
|
|
ref$ObjectRef2.element = t;
|
|
Object a2 = a(t, function2);
|
|
if (a2 == c.getCOROUTINE_SUSPENDED()) {
|
|
d0.w.h.a.g.probeCoroutineSuspended(aVar);
|
|
}
|
|
return a2 == coroutine_suspended ? coroutine_suspended : a2;
|
|
} catch (TimeoutCancellationException e2) {
|
|
e = e2;
|
|
ref$ObjectRef = ref$ObjectRef2;
|
|
if (e.coroutine == ref$ObjectRef.element) {
|
|
return null;
|
|
}
|
|
throw e;
|
|
}
|
|
} else if (i == 1) {
|
|
ref$ObjectRef = (Ref$ObjectRef) aVar.L$1;
|
|
Function2 function22 = (Function2) aVar.L$0;
|
|
try {
|
|
l.throwOnFailure(obj);
|
|
return obj;
|
|
} catch (TimeoutCancellationException e3) {
|
|
e = e3;
|
|
}
|
|
} else {
|
|
throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
|
|
}
|
|
}
|
|
}
|
|
aVar = new a(continuation);
|
|
Object obj = aVar.result;
|
|
Object coroutine_suspended = c.getCOROUTINE_SUSPENDED();
|
|
i = aVar.label;
|
|
if (i != 0) {
|
|
}
|
|
}
|
|
}
|