package o; import java.util.ArrayDeque; /* renamed from: o.fXs, reason: case insensitive filesystem */ /* loaded from: classes6.dex */ public final class C13345fXs extends fUX { private int d; public C13345fXs(InterfaceC13169fSq interfaceC13169fSq, int i) { super(interfaceC13169fSq); this.d = i; } @Override // o.AbstractC13163fSk public final void subscribeActual(InterfaceC13174fSv interfaceC13174fSv) { this.c.subscribe(new LWm(interfaceC13174fSv, this.d)); } /* renamed from: o.fXs$LWm */ /* loaded from: classes6.dex */ static final class LWm extends ArrayDeque implements InterfaceC13174fSv, fSJ { private fSJ a; private int c; private volatile boolean d; private InterfaceC13174fSv e; LWm(InterfaceC13174fSv interfaceC13174fSv, int i) { this.e = interfaceC13174fSv; this.c = i; } @Override // o.InterfaceC13174fSv public final void onSubscribe(fSJ fsj) { if (EnumC13192fTf.d(this.a, fsj)) { this.a = fsj; this.e.onSubscribe(this); } } @Override // o.InterfaceC13174fSv public final void onNext(T t) { if (this.c == size()) { poll(); } offer(t); } @Override // o.InterfaceC13174fSv public final void onError(Throwable th) { this.e.onError(th); } @Override // o.InterfaceC13174fSv public final void onComplete() { InterfaceC13174fSv interfaceC13174fSv = this.e; while (!this.d) { T poll = poll(); if (poll == null) { interfaceC13174fSv.onComplete(); return; } interfaceC13174fSv.onNext(poll); } } @Override // o.fSJ public final void dispose() { if (this.d) { return; } this.d = true; this.a.dispose(); } @Override // o.fSJ public final boolean isDisposed() { return this.d; } } }