discord-jadx/app/src/main/java/s/a/z1/a.java
2021-07-27 02:35:07 +02:00

311 lines
9.8 KiB
Java

package s.a.z1;
import d0.k;
import java.util.Objects;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.jvm.functions.Function1;
import kotlinx.coroutines.CancellableContinuation;
import s.a.a.g;
import s.a.a.h;
import s.a.a.i;
import s.a.a.j;
import s.a.a.k;
import s.a.a.o;
import s.a.a.s;
import s.a.a.t;
import s.a.e;
import s.a.k;
import s.a.l;
import s.a.u;
/* compiled from: AbstractChannel.kt */
public abstract class a<E> extends c<E> implements d<E> {
/* compiled from: AbstractChannel.kt */
/* renamed from: s.a.z1.a$a reason: collision with other inner class name */
public static final class C0344a<E> implements e<E> {
public Object a = b.d;
public final a<E> b;
public C0344a(a<E> aVar) {
this.b = aVar;
}
/* JADX WARNING: Code restructure failed: missing block: B:39:0x007f, code lost:
if (r1 != null) goto L_0x0041;
*/
@Override // s.a.z1.e
public Object a(Continuation<? super Boolean> continuation) {
k kVar;
k kVar2;
boolean z2;
Object obj = this.a;
t tVar = b.d;
boolean z3 = false;
if (obj != tVar) {
if (obj instanceof f) {
Objects.requireNonNull((f) obj);
} else {
z3 = true;
}
return d0.w.h.a.b.boxBoolean(z3);
}
Object i = this.b.i();
this.a = i;
if (i != tVar) {
if (i instanceof f) {
Objects.requireNonNull((f) i);
} else {
z3 = true;
}
return d0.w.h.a.b.boxBoolean(z3);
}
Continuation intercepted = d0.w.g.b.intercepted(continuation);
o oVar = null;
if (!(intercepted instanceof g)) {
kVar2 = new k(intercepted, 2);
} else {
g gVar = (g) intercepted;
while (true) {
Object obj2 = gVar._reusableCancellableContinuation;
if (obj2 == null) {
gVar._reusableCancellableContinuation = h.b;
kVar = null;
break;
} else if (obj2 instanceof k) {
if (g.l.compareAndSet(gVar, obj2, h.b)) {
kVar = (k) obj2;
break;
}
} else {
throw new IllegalStateException(c.d.b.a.a.r("Inconsistent state ", obj2).toString());
}
}
if (kVar != null) {
Object obj3 = kVar._state;
if (!(obj3 instanceof u) || ((u) obj3).d == null) {
kVar._decision = 0;
kVar._state = s.a.c.i;
z2 = true;
} else {
kVar.r();
z2 = false;
}
kVar2 = z2 ? kVar : null;
}
kVar2 = new k(intercepted, 2);
}
b bVar = new b(this, kVar2);
while (true) {
if (this.b.f(bVar)) {
a<E> aVar = this.b;
Objects.requireNonNull(aVar);
kVar2.e(new c(bVar));
break;
}
Object i2 = this.b.i();
this.a = i2;
if (i2 instanceof f) {
Objects.requireNonNull((f) i2);
Boolean boxBoolean = d0.w.h.a.b.boxBoolean(false);
k.a aVar2 = d0.k.i;
kVar2.resumeWith(d0.k.m75constructorimpl(boxBoolean));
break;
} else if (i2 != b.d) {
Boolean boxBoolean2 = d0.w.h.a.b.boxBoolean(true);
Function1<E, Unit> function1 = this.b.b;
if (function1 != null) {
oVar = new o(function1, i2, kVar2.n);
}
kVar2.y(boxBoolean2, kVar2.k, oVar);
}
}
Object u = kVar2.u();
if (u == d0.w.g.c.getCOROUTINE_SUSPENDED()) {
d0.w.h.a.g.probeCoroutineSuspended(continuation);
}
return u;
}
@Override // s.a.z1.e
public E next() {
E e = (E) this.a;
if (!(e instanceof f)) {
t tVar = b.d;
if (e != tVar) {
this.a = tVar;
return e;
}
throw new IllegalStateException("'hasNext' should be called prior to 'next' invocation");
}
Throwable q = e.q();
String str = s.a;
throw q;
}
}
/* compiled from: AbstractChannel.kt */
public static class b<E> extends h<E> {
public final C0344a<E> l;
public final CancellableContinuation<Boolean> m;
/* JADX DEBUG: Multi-variable search result rejected for r2v0, resolved type: kotlinx.coroutines.CancellableContinuation<? super java.lang.Boolean> */
/* JADX WARN: Multi-variable type inference failed */
public b(C0344a<E> aVar, CancellableContinuation<? super Boolean> cancellableContinuation) {
this.l = aVar;
this.m = cancellableContinuation;
}
@Override // s.a.z1.j
public void c(E e) {
this.l.a = e;
this.m.k(l.a);
}
@Override // s.a.z1.j
public t d(E e, k.b bVar) {
CancellableContinuation<Boolean> cancellableContinuation = this.m;
Boolean bool = Boolean.TRUE;
Function1<E, Unit> function1 = this.l.b.b;
if (cancellableContinuation.h(bool, null, function1 != null ? new o(function1, e, cancellableContinuation.getContext()) : null) != null) {
return l.a;
}
return null;
}
@Override // s.a.z1.h
public void q(f<?> fVar) {
Object b = this.m.b(Boolean.FALSE, null);
if (b != null) {
this.l.a = fVar;
this.m.k(b);
}
}
@Override // s.a.a.k
public String toString() {
StringBuilder K = c.d.b.a.a.K("ReceiveHasNext@");
K.append(c.q.a.k.a.u(this));
return K.toString();
}
}
/* compiled from: AbstractChannel.kt */
public final class c extends e {
public final h<?> i;
public c(h<?> hVar) {
this.i = hVar;
}
@Override // s.a.j
public void a(Throwable th) {
if (this.i.n()) {
Objects.requireNonNull(a.this);
}
}
/* Return type fixed from 'java.lang.Object' to match base method */
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
@Override // kotlin.jvm.functions.Function1
public Unit invoke(Throwable th) {
if (this.i.n()) {
Objects.requireNonNull(a.this);
}
return Unit.a;
}
public String toString() {
StringBuilder K = c.d.b.a.a.K("RemoveReceiveOnCancel[");
K.append(this.i);
K.append(']');
return K.toString();
}
}
/* compiled from: LockFreeLinkedList.kt */
public static final class d extends k.a {
public final /* synthetic */ a d;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public d(s.a.a.k kVar, s.a.a.k kVar2, a aVar) {
super(kVar2);
this.d = aVar;
}
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
@Override // s.a.a.d
public Object c(s.a.a.k kVar) {
if (this.d.h()) {
return null;
}
return j.a;
}
}
public a(Function1<? super E, Unit> function1) {
super(function1);
}
public boolean f(h<? super E> hVar) {
int p;
s.a.a.k k;
if (!g()) {
s.a.a.k kVar = this.a;
d dVar = new d(hVar, hVar, this);
do {
s.a.a.k k2 = kVar.k();
if (!(!(k2 instanceof k))) {
break;
}
p = k2.p(hVar, kVar, dVar);
if (p == 1) {
return true;
}
} while (p != 2);
} else {
s.a.a.k kVar2 = this.a;
do {
k = kVar2.k();
if (!(!(k instanceof k))) {
}
} while (!k.e(hVar, kVar2));
return true;
}
return false;
}
public abstract boolean g();
public abstract boolean h();
public abstract Object i();
@Override // s.a.z1.i
public final e<E> iterator() {
return new C0344a(this);
}
public j<E> j() {
s.a.a.k kVar;
s.a.a.k o;
i iVar = this.a;
while (true) {
Object i = iVar.i();
Objects.requireNonNull(i, "null cannot be cast to non-null type kotlinx.coroutines.internal.Node /* = kotlinx.coroutines.internal.LockFreeLinkedListNode */");
kVar = (s.a.a.k) i;
if (kVar != iVar && (kVar instanceof j)) {
if (((((j) kVar) instanceof f) && !kVar.m()) || (o = kVar.o()) == null) {
break;
}
o.l();
}
}
kVar = null;
j<E> jVar = (j) kVar;
if (jVar != null) {
boolean z2 = jVar instanceof f;
}
return jVar;
}
}