package o; import java.util.Objects; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicReference; /* renamed from: o.fVv, reason: case insensitive filesystem */ /* loaded from: classes6.dex */ public final class C13278fVv extends fUX { private fSS> d; public C13278fVv(InterfaceC13169fSq interfaceC13169fSq, fSS> fss) { super(interfaceC13169fSq); this.d = fss; } @Override // o.AbstractC13163fSk public final void subscribeActual(InterfaceC13174fSv interfaceC13174fSv) { this.c.subscribe(new Sts(new C13406fZi(interfaceC13174fSv), this.d)); } /* JADX INFO: Access modifiers changed from: package-private */ /* renamed from: o.fVv$Sts */ /* loaded from: classes6.dex */ public static final class Sts implements InterfaceC13174fSv, fSJ { private boolean a; final InterfaceC13174fSv b; volatile long c; private AtomicReference d = new AtomicReference<>(); private fSS> e; private fSJ g; Sts(InterfaceC13174fSv interfaceC13174fSv, fSS> fss) { this.b = interfaceC13174fSv; this.e = fss; } @Override // o.InterfaceC13174fSv public final void onSubscribe(fSJ fsj) { if (EnumC13192fTf.d(this.g, fsj)) { this.g = fsj; this.b.onSubscribe(this); } } @Override // o.InterfaceC13174fSv public final void onNext(T t) { if (this.a) { return; } long j = this.c + 1; this.c = j; fSJ fsj = this.d.get(); if (fsj != null) { fsj.dispose(); } try { InterfaceC13169fSq interfaceC13169fSq = (InterfaceC13169fSq) Objects.requireNonNull(this.e.a(t), "The ObservableSource supplied is null"); LWm lWm = new LWm(this, j, t); AtomicReference atomicReference = this.d; while (!atomicReference.compareAndSet(fsj, lWm)) { if (atomicReference.get() != fsj) { return; } } interfaceC13169fSq.subscribe(lWm); } catch (Throwable th) { C13147fSI.c(th); dispose(); this.b.onError(th); } } @Override // o.InterfaceC13174fSv public final void onError(Throwable th) { EnumC13192fTf.e(this.d); this.b.onError(th); } @Override // o.InterfaceC13174fSv public final void onComplete() { if (this.a) { return; } this.a = true; fSJ fsj = this.d.get(); if (fsj != EnumC13192fTf.DISPOSED) { LWm lWm = (LWm) fsj; if (lWm != null) { lWm.b(); } EnumC13192fTf.e(this.d); this.b.onComplete(); } } @Override // o.fSJ public final void dispose() { this.g.dispose(); EnumC13192fTf.e(this.d); } @Override // o.fSJ public final boolean isDisposed() { return this.g.isDisposed(); } /* renamed from: o.fVv$Sts$LWm */ /* loaded from: classes6.dex */ static final class LWm extends AbstractC13403fZf { private T a; private long b; private Sts c; private boolean d; private AtomicBoolean e = new AtomicBoolean(); LWm(Sts sts, long j, T t) { this.c = sts; this.b = j; this.a = t; } @Override // o.InterfaceC13174fSv public final void onNext(U u) { if (this.d) { return; } this.d = true; dispose(); b(); } final void b() { if (this.e.compareAndSet(false, true)) { Sts sts = this.c; long j = this.b; T t = this.a; if (j == sts.c) { sts.b.onNext(t); } } } @Override // o.InterfaceC13174fSv public final void onError(Throwable th) { if (this.d) { C13418fZu.c(th); } else { this.d = true; this.c.onError(th); } } @Override // o.InterfaceC13174fSv public final void onComplete() { if (this.d) { return; } this.d = true; b(); } } } }