2021-11-08 18:25:28 +00:00
|
|
|
package j0.l.a;
|
2021-06-27 20:44:35 +00:00
|
|
|
|
2022-01-27 00:50:41 +00:00
|
|
|
import b.i.a.f.e.o.f;
|
2021-11-08 18:25:28 +00:00
|
|
|
import j0.l.e.d;
|
2021-12-17 22:03:14 +00:00
|
|
|
import j0.l.e.k;
|
|
|
|
import j0.l.e.o.n;
|
|
|
|
import j0.l.e.o.y;
|
2021-11-08 18:25:28 +00:00
|
|
|
import j0.o.l;
|
2021-06-27 20:44:35 +00:00
|
|
|
import java.util.Queue;
|
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
|
import java.util.concurrent.atomic.AtomicReference;
|
|
|
|
import rx.Observable;
|
|
|
|
import rx.Producer;
|
|
|
|
import rx.Subscriber;
|
|
|
|
import rx.exceptions.MissingBackpressureException;
|
|
|
|
import rx.observers.SerializedSubscriber;
|
|
|
|
import rx.subscriptions.SerialSubscription;
|
2022-03-02 20:59:20 +00:00
|
|
|
/* compiled from: OnSubscribeConcatMap.java */
|
|
|
|
/* loaded from: classes3.dex */
|
2021-06-27 20:44:35 +00:00
|
|
|
public final class h<T, R> implements Observable.a<R> {
|
2021-12-17 22:03:14 +00:00
|
|
|
public final Observable<? extends T> j;
|
|
|
|
public final j0.k.b<? super T, ? extends Observable<? extends R>> k;
|
2021-06-27 20:44:35 +00:00
|
|
|
|
2022-03-02 20:59:20 +00:00
|
|
|
/* compiled from: OnSubscribeConcatMap.java */
|
|
|
|
/* loaded from: classes3.dex */
|
2021-06-27 20:44:35 +00:00
|
|
|
public static final class a<T, R> implements Producer {
|
2021-12-17 22:03:14 +00:00
|
|
|
public final R j;
|
|
|
|
public final c<T, R> k;
|
|
|
|
public boolean l;
|
2021-06-27 20:44:35 +00:00
|
|
|
|
2021-11-08 18:25:28 +00:00
|
|
|
public a(R r, c<T, R> cVar) {
|
2021-12-17 22:03:14 +00:00
|
|
|
this.j = r;
|
|
|
|
this.k = cVar;
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override // rx.Producer
|
|
|
|
public void j(long j) {
|
2021-12-17 22:03:14 +00:00
|
|
|
if (!this.l && j > 0) {
|
|
|
|
this.l = true;
|
|
|
|
c<T, R> cVar = this.k;
|
|
|
|
cVar.j.onNext(this.j);
|
2022-03-02 20:59:20 +00:00
|
|
|
cVar.m.b(1L);
|
2022-03-30 16:43:10 +00:00
|
|
|
cVar.f3755s = false;
|
2021-06-27 20:44:35 +00:00
|
|
|
cVar.a();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-02 20:59:20 +00:00
|
|
|
/* compiled from: OnSubscribeConcatMap.java */
|
|
|
|
/* loaded from: classes3.dex */
|
2021-06-27 20:44:35 +00:00
|
|
|
public static final class b<T, R> extends Subscriber<R> {
|
2021-12-17 22:03:14 +00:00
|
|
|
public final c<T, R> j;
|
|
|
|
public long k;
|
2021-06-27 20:44:35 +00:00
|
|
|
|
|
|
|
public b(c<T, R> cVar) {
|
2021-12-17 22:03:14 +00:00
|
|
|
this.j = cVar;
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
|
2021-11-08 18:25:28 +00:00
|
|
|
@Override // j0.g
|
2021-06-27 20:44:35 +00:00
|
|
|
public void onCompleted() {
|
2021-12-17 22:03:14 +00:00
|
|
|
c<T, R> cVar = this.j;
|
|
|
|
long j = this.k;
|
2021-06-27 20:44:35 +00:00
|
|
|
if (j != 0) {
|
2021-12-17 22:03:14 +00:00
|
|
|
cVar.m.b(j);
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
2022-03-30 16:43:10 +00:00
|
|
|
cVar.f3755s = false;
|
2021-06-27 20:44:35 +00:00
|
|
|
cVar.a();
|
|
|
|
}
|
|
|
|
|
2021-11-08 18:25:28 +00:00
|
|
|
@Override // j0.g
|
2021-06-27 20:44:35 +00:00
|
|
|
public void onError(Throwable th) {
|
2021-12-17 22:03:14 +00:00
|
|
|
c<T, R> cVar = this.j;
|
|
|
|
long j = this.k;
|
|
|
|
if (!d.f(cVar.p, th)) {
|
2021-06-27 20:44:35 +00:00
|
|
|
l.b(th);
|
2021-12-17 22:03:14 +00:00
|
|
|
} else if (cVar.l == 0) {
|
|
|
|
Throwable h = d.h(cVar.p);
|
2021-06-27 20:44:35 +00:00
|
|
|
if (!d.g(h)) {
|
2021-12-17 22:03:14 +00:00
|
|
|
cVar.j.onError(h);
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
cVar.unsubscribe();
|
|
|
|
} else {
|
|
|
|
if (j != 0) {
|
2021-12-17 22:03:14 +00:00
|
|
|
cVar.m.b(j);
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
2022-03-30 16:43:10 +00:00
|
|
|
cVar.f3755s = false;
|
2021-06-27 20:44:35 +00:00
|
|
|
cVar.a();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-08 18:25:28 +00:00
|
|
|
@Override // j0.g
|
|
|
|
public void onNext(R r) {
|
2021-12-17 22:03:14 +00:00
|
|
|
this.k++;
|
|
|
|
this.j.j.onNext(r);
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override // rx.Subscriber
|
|
|
|
public void setProducer(Producer producer) {
|
2021-12-17 22:03:14 +00:00
|
|
|
this.j.m.c(producer);
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-02 20:59:20 +00:00
|
|
|
/* compiled from: OnSubscribeConcatMap.java */
|
|
|
|
/* loaded from: classes3.dex */
|
2021-06-27 20:44:35 +00:00
|
|
|
public static final class c<T, R> extends Subscriber<T> {
|
2021-12-17 22:03:14 +00:00
|
|
|
public final Subscriber<? super R> j;
|
|
|
|
public final j0.k.b<? super T, ? extends Observable<? extends R>> k;
|
|
|
|
public final int l;
|
|
|
|
public final Queue<Object> n;
|
|
|
|
public final SerialSubscription q;
|
2021-11-08 18:25:28 +00:00
|
|
|
public volatile boolean r;
|
2021-06-27 20:44:35 +00:00
|
|
|
|
2021-12-17 22:03:14 +00:00
|
|
|
/* renamed from: s reason: collision with root package name */
|
2022-03-30 16:43:10 +00:00
|
|
|
public volatile boolean f3755s;
|
2022-03-02 20:59:20 +00:00
|
|
|
public final j0.l.b.a m = new j0.l.b.a();
|
|
|
|
public final AtomicInteger o = new AtomicInteger();
|
|
|
|
public final AtomicReference<Throwable> p = new AtomicReference<>();
|
2021-12-17 22:03:14 +00:00
|
|
|
|
2021-11-08 18:25:28 +00:00
|
|
|
public c(Subscriber<? super R> subscriber, j0.k.b<? super T, ? extends Observable<? extends R>> bVar, int i, int i2) {
|
2021-12-17 22:03:14 +00:00
|
|
|
this.j = subscriber;
|
|
|
|
this.k = bVar;
|
|
|
|
this.l = i2;
|
|
|
|
this.n = y.b() ? new n<>(i) : new j0.l.e.n.c<>(i);
|
|
|
|
this.q = new SerialSubscription();
|
2022-03-02 20:59:20 +00:00
|
|
|
request(i);
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void a() {
|
2021-12-17 22:03:14 +00:00
|
|
|
if (this.o.getAndIncrement() == 0) {
|
|
|
|
int i = this.l;
|
|
|
|
while (!this.j.isUnsubscribed()) {
|
2022-03-30 16:43:10 +00:00
|
|
|
if (!this.f3755s) {
|
2021-12-17 22:03:14 +00:00
|
|
|
if (i != 1 || this.p.get() == null) {
|
|
|
|
boolean z2 = this.r;
|
|
|
|
Object poll = this.n.poll();
|
2021-06-27 20:44:35 +00:00
|
|
|
boolean z3 = poll == null;
|
|
|
|
if (z2 && z3) {
|
2021-12-17 22:03:14 +00:00
|
|
|
Throwable h = d.h(this.p);
|
2021-06-27 20:44:35 +00:00
|
|
|
if (h == null) {
|
2021-12-17 22:03:14 +00:00
|
|
|
this.j.onCompleted();
|
2021-06-27 20:44:35 +00:00
|
|
|
return;
|
|
|
|
} else if (!d.g(h)) {
|
2021-12-17 22:03:14 +00:00
|
|
|
this.j.onError(h);
|
2021-06-27 20:44:35 +00:00
|
|
|
return;
|
|
|
|
} else {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
} else if (!z3) {
|
|
|
|
try {
|
2021-12-17 22:03:14 +00:00
|
|
|
Observable<Object> observable = (Observable) this.k.call((Object) e.b(poll));
|
2021-06-27 20:44:35 +00:00
|
|
|
if (observable == null) {
|
|
|
|
b(new NullPointerException("The source returned by the mapper was null"));
|
|
|
|
return;
|
2021-12-17 22:03:14 +00:00
|
|
|
} else if (observable != c.k) {
|
|
|
|
if (observable instanceof k) {
|
2022-03-30 16:43:10 +00:00
|
|
|
this.f3755s = true;
|
2021-12-17 22:03:14 +00:00
|
|
|
this.m.c(new a(((k) observable).l, this));
|
2021-06-27 20:44:35 +00:00
|
|
|
} else {
|
|
|
|
b bVar = new b(this);
|
2021-12-17 22:03:14 +00:00
|
|
|
this.q.a(bVar);
|
2021-06-27 20:44:35 +00:00
|
|
|
if (!bVar.isUnsubscribed()) {
|
2022-03-30 16:43:10 +00:00
|
|
|
this.f3755s = true;
|
2021-10-26 23:51:06 +00:00
|
|
|
observable.i0(bVar);
|
2021-06-27 20:44:35 +00:00
|
|
|
} else {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2022-03-02 20:59:20 +00:00
|
|
|
request(1L);
|
2021-06-27 20:44:35 +00:00
|
|
|
} else {
|
2022-03-02 20:59:20 +00:00
|
|
|
request(1L);
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
} catch (Throwable th) {
|
2022-01-27 00:50:41 +00:00
|
|
|
f.o1(th);
|
2021-06-27 20:44:35 +00:00
|
|
|
b(th);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
2021-12-17 22:03:14 +00:00
|
|
|
Throwable h2 = d.h(this.p);
|
2021-06-27 20:44:35 +00:00
|
|
|
if (!d.g(h2)) {
|
2021-12-17 22:03:14 +00:00
|
|
|
this.j.onError(h2);
|
2021-06-27 20:44:35 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2021-12-17 22:03:14 +00:00
|
|
|
if (this.o.decrementAndGet() == 0) {
|
2021-06-27 20:44:35 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void b(Throwable th) {
|
|
|
|
unsubscribe();
|
2021-12-17 22:03:14 +00:00
|
|
|
if (d.f(this.p, th)) {
|
|
|
|
Throwable h = d.h(this.p);
|
2021-06-27 20:44:35 +00:00
|
|
|
if (!d.g(h)) {
|
2021-12-17 22:03:14 +00:00
|
|
|
this.j.onError(h);
|
2021-06-27 20:44:35 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
l.b(th);
|
|
|
|
}
|
|
|
|
|
2021-11-08 18:25:28 +00:00
|
|
|
@Override // j0.g
|
2021-06-27 20:44:35 +00:00
|
|
|
public void onCompleted() {
|
2021-12-17 22:03:14 +00:00
|
|
|
this.r = true;
|
2021-06-27 20:44:35 +00:00
|
|
|
a();
|
|
|
|
}
|
|
|
|
|
2021-11-08 18:25:28 +00:00
|
|
|
@Override // j0.g
|
2021-06-27 20:44:35 +00:00
|
|
|
public void onError(Throwable th) {
|
2021-12-17 22:03:14 +00:00
|
|
|
if (d.f(this.p, th)) {
|
|
|
|
this.r = true;
|
|
|
|
if (this.l == 0) {
|
|
|
|
Throwable h = d.h(this.p);
|
2021-06-27 20:44:35 +00:00
|
|
|
if (!d.g(h)) {
|
2021-12-17 22:03:14 +00:00
|
|
|
this.j.onError(h);
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
2021-12-17 22:03:14 +00:00
|
|
|
this.q.j.unsubscribe();
|
2021-06-27 20:44:35 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
a();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
l.b(th);
|
|
|
|
}
|
|
|
|
|
2021-11-08 18:25:28 +00:00
|
|
|
@Override // j0.g
|
2021-06-27 20:44:35 +00:00
|
|
|
public void onNext(T t) {
|
2021-12-17 22:03:14 +00:00
|
|
|
Queue<Object> queue = this.n;
|
2021-06-27 20:44:35 +00:00
|
|
|
if (t == null) {
|
2022-03-30 16:43:10 +00:00
|
|
|
t = (T) e.f3753b;
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
if (!queue.offer(t)) {
|
|
|
|
unsubscribe();
|
|
|
|
onError(new MissingBackpressureException());
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
a();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-08 18:25:28 +00:00
|
|
|
public h(Observable<? extends T> observable, j0.k.b<? super T, ? extends Observable<? extends R>> bVar, int i, int i2) {
|
2021-12-17 22:03:14 +00:00
|
|
|
this.j = observable;
|
|
|
|
this.k = bVar;
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override // rx.functions.Action1
|
|
|
|
public void call(Object obj) {
|
|
|
|
Subscriber subscriber = (Subscriber) obj;
|
2021-12-17 22:03:14 +00:00
|
|
|
c cVar = new c(new SerializedSubscriber(subscriber), this.k, 2, 0);
|
2021-06-27 20:44:35 +00:00
|
|
|
subscriber.add(cVar);
|
2021-12-17 22:03:14 +00:00
|
|
|
subscriber.add(cVar.q);
|
2021-06-27 20:44:35 +00:00
|
|
|
subscriber.setProducer(new g(this, cVar));
|
|
|
|
if (!subscriber.isUnsubscribed()) {
|
2021-12-17 22:03:14 +00:00
|
|
|
this.j.i0(cVar);
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|