package f.a;

import java.util.concurrent.TimeUnit;

/* JADX INFO: compiled from: Observable.java */
/* JADX INFO: loaded from: classes.dex */
public abstract class d<T> implements e<T> {
    public static int f() {
        return b.a();
    }

    public static d<Long> g(long j2, long j3, TimeUnit timeUnit, g gVar) {
        f.a.n.b.b.d(timeUnit, "unit is null");
        f.a.n.b.b.d(gVar, "scheduler is null");
        return f.a.p.a.j(new f.a.n.e.a.b(Math.max(0L, j2), Math.max(0L, j3), timeUnit, gVar));
    }

    public static d<Long> h(long j2, TimeUnit timeUnit) {
        return g(j2, j2, timeUnit, f.a.q.a.a());
    }

    public static <T> d<T> i(T t) {
        f.a.n.b.b.d(t, "The item is null");
        return f.a.p.a.j(new f.a.n.e.a.c(t));
    }

    public static d<Long> t(long j2, TimeUnit timeUnit) {
        return u(j2, timeUnit, f.a.q.a.a());
    }

    public static d<Long> u(long j2, TimeUnit timeUnit, g gVar) {
        f.a.n.b.b.d(timeUnit, "unit is null");
        f.a.n.b.b.d(gVar, "scheduler is null");
        return f.a.p.a.j(new f.a.n.e.a.h(Math.max(j2, 0L), timeUnit, gVar));
    }

    @Override // f.a.e
    public final void e(f<? super T> fVar) {
        f.a.n.b.b.d(fVar, "observer is null");
        try {
            f<? super T> fVarP = f.a.p.a.p(this, fVar);
            f.a.n.b.b.d(fVarP, "Plugin returned null Observer");
            q(fVarP);
        } catch (NullPointerException e2) {
            throw e2;
        } catch (Throwable th) {
            f.a.l.b.b(th);
            f.a.p.a.m(th);
            NullPointerException nullPointerException = new NullPointerException("Actually not, but can't throw other exceptions due to RS");
            nullPointerException.initCause(th);
            throw nullPointerException;
        }
    }

    public final d<T> j(g gVar) {
        return k(gVar, false, f());
    }

    public final d<T> k(g gVar, boolean z, int i2) {
        f.a.n.b.b.d(gVar, "scheduler is null");
        f.a.n.b.b.e(i2, "bufferSize");
        return f.a.p.a.j(new f.a.n.e.a.d(this, gVar, z, i2));
    }

    public final d<T> l(long j2, TimeUnit timeUnit) {
        return m(j2, timeUnit, f.a.q.a.a());
    }

    public final d<T> m(long j2, TimeUnit timeUnit, g gVar) {
        f.a.n.b.b.d(timeUnit, "unit is null");
        f.a.n.b.b.d(gVar, "scheduler is null");
        return f.a.p.a.j(new f.a.n.e.a.e(this, j2, timeUnit, gVar, false));
    }

    public final f.a.k.b n(f.a.m.c<? super T> cVar) {
        return p(cVar, f.a.n.b.a.f827d, f.a.n.b.a.b, f.a.n.b.a.a());
    }

    public final f.a.k.b o(f.a.m.c<? super T> cVar, f.a.m.c<? super Throwable> cVar2) {
        return p(cVar, cVar2, f.a.n.b.a.b, f.a.n.b.a.a());
    }

    public final f.a.k.b p(f.a.m.c<? super T> cVar, f.a.m.c<? super Throwable> cVar2, f.a.m.a aVar, f.a.m.c<? super f.a.k.b> cVar3) {
        f.a.n.b.b.d(cVar, "onNext is null");
        f.a.n.b.b.d(cVar2, "onError is null");
        f.a.n.b.b.d(aVar, "onComplete is null");
        f.a.n.b.b.d(cVar3, "onSubscribe is null");
        f.a.n.d.c cVar4 = new f.a.n.d.c(cVar, cVar2, aVar, cVar3);
        e(cVar4);
        return cVar4;
    }

    protected abstract void q(f<? super T> fVar);

    public final d<T> r(g gVar) {
        f.a.n.b.b.d(gVar, "scheduler is null");
        return f.a.p.a.j(new f.a.n.e.a.g(this, gVar));
    }

    public final d<T> s(long j2, TimeUnit timeUnit) {
        return l(j2, timeUnit);
    }
}
