package com.ss.android.ugc.aweme.account.login.v2.base;

import X.0CB;
import X.0CH;
import X.0CN;
import X.C1362Peh;
import X.C1466PgN;
import X.C1475PgW;
import X.C1519PhE;
import X.C1580PiD;
import X.C1590PiN;
import X.C1633Pj4;
import X.C1636Pj7;
import X.C1638Pj9;
import X.C1647PjI;
import X.C1728Pkb;
import X.D1M;
import X.M12;
import X.Q39;
import com.bytedance.covode.number.Covode;
import kotlin.h.b.n;

public final class MaybeBindLifeCycleTransformer<T> implements C1638Pj9<T, T>, C1638Pj9 {
    public static final C1647PjI LIZ = new C1647PjI((byte) 0);
    public final C1728Pkb<Integer> LIZIZ;

    static {
        Covode.recordClassIndex(51465);
    }

    public final void onStateChanged(0CH r2, 0CB r3) {
        if (r3 == 0CB.ON_DESTROY) {
            disposeRequest();
        }
    }

    public MaybeBindLifeCycleTransformer() {
        C1728Pkb<Integer> pkb = new C1728Pkb<>();
        n.LIZIZ(pkb, Q39.LIZJ);
        this.LIZIZ = pkb;
    }

    @0CN(LIZ = 0CB.ON_DESTROY)
    public final void disposeRequest() {
        this.LIZIZ.onNext(1);
    }

    public final C1362Peh<T> LIZ(C1475PgW<T> pgW) {
        M12.LIZ(pgW);
        C1728Pkb<Integer> pkb = this.LIZIZ;
        C1633Pj4 pj4 = C1633Pj4.LIZ;
        D1M.LIZ(pj4, "predicate is null");
        C1590PiN LIZ2 = C1519PhE.LIZ(new C1466PgN(pkb, pj4)).LIZ(C1636Pj7.MISSING);
        D1M.LIZ(LIZ2, "other is null");
        C1475PgW LIZ3 = C1519PhE.LIZ(new C1580PiD(pgW, LIZ2));
        n.LIZIZ(LIZ3, Q39.LIZJ);
        return LIZ3;
    }
}
