257 lines
10 KiB
Java
257 lines
10 KiB
Java
package o;
|
|
|
|
import java.util.Iterator;
|
|
import java.util.LinkedHashMap;
|
|
import java.util.Map;
|
|
import java.util.Objects;
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
import java.util.concurrent.atomic.AtomicReference;
|
|
import o.C13303fWl;
|
|
|
|
/* renamed from: o.fWt, reason: case insensitive filesystem */
|
|
/* loaded from: classes6.dex */
|
|
public final class C13311fWt<TLeft, TRight, TLeftEnd, TRightEnd, R> extends fUX<TLeft, R> {
|
|
private InterfaceC13169fSq<? extends TRight> a;
|
|
private fSS<? super TLeft, ? extends InterfaceC13169fSq<TLeftEnd>> b;
|
|
private fSL<? super TLeft, ? super TRight, ? extends R> d;
|
|
private fSS<? super TRight, ? extends InterfaceC13169fSq<TRightEnd>> e;
|
|
|
|
public C13311fWt(InterfaceC13169fSq<TLeft> interfaceC13169fSq, InterfaceC13169fSq<? extends TRight> interfaceC13169fSq2, fSS<? super TLeft, ? extends InterfaceC13169fSq<TLeftEnd>> fss, fSS<? super TRight, ? extends InterfaceC13169fSq<TRightEnd>> fss2, fSL<? super TLeft, ? super TRight, ? extends R> fsl) {
|
|
super(interfaceC13169fSq);
|
|
this.a = interfaceC13169fSq2;
|
|
this.b = fss;
|
|
this.e = fss2;
|
|
this.d = fsl;
|
|
}
|
|
|
|
@Override // o.AbstractC13163fSk
|
|
public final void subscribeActual(InterfaceC13174fSv<? super R> interfaceC13174fSv) {
|
|
LWm lWm = new LWm(interfaceC13174fSv, this.b, this.e, this.d);
|
|
interfaceC13174fSv.onSubscribe(lWm);
|
|
C13303fWl.HBt hBt = new C13303fWl.HBt(lWm, true);
|
|
lWm.e.e(hBt);
|
|
C13303fWl.HBt hBt2 = new C13303fWl.HBt(lWm, false);
|
|
lWm.e.e(hBt2);
|
|
this.c.subscribe(hBt);
|
|
this.a.subscribe(hBt2);
|
|
}
|
|
|
|
/* renamed from: o.fWt$LWm */
|
|
/* loaded from: classes6.dex */
|
|
static final class LWm<TLeft, TRight, TLeftEnd, TRightEnd, R> extends AtomicInteger implements fSJ, C13303fWl.Sts {
|
|
private volatile boolean f;
|
|
private fSS<? super TLeft, ? extends InterfaceC13169fSq<TLeftEnd>> h;
|
|
private InterfaceC13174fSv<? super R> j;
|
|
private fSL<? super TLeft, ? super TRight, ? extends R> l;
|
|
private int m;
|
|
|
|
/* renamed from: o, reason: collision with root package name */
|
|
private fSS<? super TRight, ? extends InterfaceC13169fSq<TRightEnd>> f9121o;
|
|
private int q;
|
|
private static Integer b = 1;
|
|
private static Integer a = 2;
|
|
private static Integer c = 3;
|
|
private static Integer d = 4;
|
|
final fSC e = new fSC();
|
|
private C13416fZs<Object> k = new C13416fZs<>(AbstractC13163fSk.bufferSize());
|
|
private Map<Integer, TLeft> n = new LinkedHashMap();
|
|
private Map<Integer, TRight> r = new LinkedHashMap();
|
|
private AtomicReference<Throwable> g = new AtomicReference<>();
|
|
private AtomicInteger i = new AtomicInteger(2);
|
|
|
|
LWm(InterfaceC13174fSv<? super R> interfaceC13174fSv, fSS<? super TLeft, ? extends InterfaceC13169fSq<TLeftEnd>> fss, fSS<? super TRight, ? extends InterfaceC13169fSq<TRightEnd>> fss2, fSL<? super TLeft, ? super TRight, ? extends R> fsl) {
|
|
this.j = interfaceC13174fSv;
|
|
this.h = fss;
|
|
this.f9121o = fss2;
|
|
this.l = fsl;
|
|
}
|
|
|
|
@Override // o.fSJ
|
|
public final void dispose() {
|
|
if (this.f) {
|
|
return;
|
|
}
|
|
this.f = true;
|
|
this.e.dispose();
|
|
if (getAndIncrement() == 0) {
|
|
this.k.e();
|
|
}
|
|
}
|
|
|
|
private void a(InterfaceC13174fSv<?> interfaceC13174fSv) {
|
|
Throwable b2 = fYR.b(this.g);
|
|
this.n.clear();
|
|
this.r.clear();
|
|
interfaceC13174fSv.onError(b2);
|
|
}
|
|
|
|
private void b() {
|
|
if (getAndIncrement() != 0) {
|
|
return;
|
|
}
|
|
C13416fZs<Object> c13416fZs = this.k;
|
|
InterfaceC13174fSv<? super R> interfaceC13174fSv = this.j;
|
|
int i = 1;
|
|
while (!this.f) {
|
|
if (this.g.get() != null) {
|
|
c13416fZs.e();
|
|
this.e.dispose();
|
|
a(interfaceC13174fSv);
|
|
return;
|
|
}
|
|
boolean z = this.i.get() == 0;
|
|
Integer num = (Integer) c13416fZs.b();
|
|
boolean z2 = num == null;
|
|
if (z && z2) {
|
|
this.n.clear();
|
|
this.r.clear();
|
|
this.e.dispose();
|
|
interfaceC13174fSv.onComplete();
|
|
return;
|
|
}
|
|
if (!z2) {
|
|
Object b2 = c13416fZs.b();
|
|
if (num == b) {
|
|
int i2 = this.m;
|
|
this.m = i2 + 1;
|
|
this.n.put(Integer.valueOf(i2), b2);
|
|
try {
|
|
InterfaceC13169fSq interfaceC13169fSq = (InterfaceC13169fSq) Objects.requireNonNull(this.h.a(b2), "The leftEnd returned a null ObservableSource");
|
|
C13303fWl.LWm lWm = new C13303fWl.LWm(this, true, i2);
|
|
this.e.e(lWm);
|
|
interfaceC13169fSq.subscribe(lWm);
|
|
if (this.g.get() != null) {
|
|
c13416fZs.e();
|
|
this.e.dispose();
|
|
a(interfaceC13174fSv);
|
|
return;
|
|
}
|
|
Iterator<TRight> it = this.r.values().iterator();
|
|
while (it.hasNext()) {
|
|
try {
|
|
interfaceC13174fSv.onNext((Object) Objects.requireNonNull(this.l.e(b2, it.next()), "The resultSelector returned a null value"));
|
|
} catch (Throwable th) {
|
|
C13147fSI.c(th);
|
|
fYR.c(this.g, th);
|
|
c13416fZs.e();
|
|
this.e.dispose();
|
|
a(interfaceC13174fSv);
|
|
return;
|
|
}
|
|
}
|
|
} catch (Throwable th2) {
|
|
C13147fSI.c(th2);
|
|
fYR.c(this.g, th2);
|
|
c13416fZs.e();
|
|
this.e.dispose();
|
|
a(interfaceC13174fSv);
|
|
return;
|
|
}
|
|
} else if (num == a) {
|
|
int i3 = this.q;
|
|
this.q = i3 + 1;
|
|
this.r.put(Integer.valueOf(i3), b2);
|
|
try {
|
|
InterfaceC13169fSq interfaceC13169fSq2 = (InterfaceC13169fSq) Objects.requireNonNull(this.f9121o.a(b2), "The rightEnd returned a null ObservableSource");
|
|
C13303fWl.LWm lWm2 = new C13303fWl.LWm(this, false, i3);
|
|
this.e.e(lWm2);
|
|
interfaceC13169fSq2.subscribe(lWm2);
|
|
if (this.g.get() != null) {
|
|
c13416fZs.e();
|
|
this.e.dispose();
|
|
a(interfaceC13174fSv);
|
|
return;
|
|
}
|
|
Iterator<TLeft> it2 = this.n.values().iterator();
|
|
while (it2.hasNext()) {
|
|
try {
|
|
interfaceC13174fSv.onNext((Object) Objects.requireNonNull(this.l.e(it2.next(), b2), "The resultSelector returned a null value"));
|
|
} catch (Throwable th3) {
|
|
C13147fSI.c(th3);
|
|
fYR.c(this.g, th3);
|
|
c13416fZs.e();
|
|
this.e.dispose();
|
|
a(interfaceC13174fSv);
|
|
return;
|
|
}
|
|
}
|
|
} catch (Throwable th4) {
|
|
C13147fSI.c(th4);
|
|
fYR.c(this.g, th4);
|
|
c13416fZs.e();
|
|
this.e.dispose();
|
|
a(interfaceC13174fSv);
|
|
return;
|
|
}
|
|
} else if (num == c) {
|
|
C13303fWl.LWm lWm3 = (C13303fWl.LWm) b2;
|
|
this.n.remove(Integer.valueOf(lWm3.b));
|
|
if (this.e.b(lWm3)) {
|
|
lWm3.dispose();
|
|
}
|
|
} else {
|
|
C13303fWl.LWm lWm4 = (C13303fWl.LWm) b2;
|
|
this.r.remove(Integer.valueOf(lWm4.b));
|
|
if (this.e.b(lWm4)) {
|
|
lWm4.dispose();
|
|
}
|
|
}
|
|
} else {
|
|
i = addAndGet(-i);
|
|
if (i == 0) {
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
c13416fZs.e();
|
|
}
|
|
|
|
@Override // o.C13303fWl.Sts
|
|
public final void d(Throwable th) {
|
|
if (fYR.c(this.g, th)) {
|
|
this.i.decrementAndGet();
|
|
b();
|
|
} else {
|
|
C13418fZu.c(th);
|
|
}
|
|
}
|
|
|
|
@Override // o.C13303fWl.Sts
|
|
public final void a(C13303fWl.HBt hBt) {
|
|
this.e.b(hBt);
|
|
this.i.decrementAndGet();
|
|
b();
|
|
}
|
|
|
|
@Override // o.C13303fWl.Sts
|
|
public final void e(boolean z, Object obj) {
|
|
synchronized (this) {
|
|
this.k.e(z ? b : a, obj);
|
|
}
|
|
b();
|
|
}
|
|
|
|
@Override // o.C13303fWl.Sts
|
|
public final void d(boolean z, C13303fWl.LWm lWm) {
|
|
synchronized (this) {
|
|
this.k.e(z ? c : d, lWm);
|
|
}
|
|
b();
|
|
}
|
|
|
|
@Override // o.C13303fWl.Sts
|
|
public final void a(Throwable th) {
|
|
if (fYR.c(this.g, th)) {
|
|
b();
|
|
} else {
|
|
C13418fZu.c(th);
|
|
}
|
|
}
|
|
|
|
@Override // o.fSJ
|
|
public final boolean isDisposed() {
|
|
return this.f;
|
|
}
|
|
}
|
|
}
|