package com.bytedance.jedi.arch.ext.list;

import X.2cN;
import X.7he;
import X.7xU;
import X.C0295Crj;
import X.C0436Cwu;
import X.C2381Dov;
import X.C2382Dow;
import X.C2421DpZ;
import X.C2423Dpb;
import X.C2426Dpe;
import X.C2427Dpf;
import X.C2440Dps;
import X.C2444Dpw;
import X.C2445Dpx;
import X.C2446Dpy;
import X.C2447Dpz;
import X.C2448Dq0;
import X.C2449Dq1;
import X.C2450Dq2;
import X.C2451Dq3;
import X.C2452Dq4;
import X.C2463DqF;
import X.C2464DqG;
import X.C2465DqH;
import X.C2490Dqg;
import X.C2492Dqi;
import X.C2515Dr5;
import X.C2558Drm;
import X.DUS;
import X.DUT;
import X.DV0;
import X.DV1;
import X.LsC;
import X.LsD;
import X.M12;
import X.PgU;
import com.bytedance.covode.number.Covode;
import com.bytedance.jedi.arch.JediViewModel;
import com.bytedance.jedi.arch.ext.list.IListState;
import java.util.List;

public abstract class ListViewModel<T, P extends C2381Dov, S extends IListState<T, P>> extends JediViewModel<S> implements C2558Drm {
    public final LsC<S, PgU<C0436Cwu<List<T>, P>>> LIZ;
    public final LsD<List<? extends T>, List<? extends T>, List<T>> LIZIZ = C2452Dq4.LIZ;
    public final LsD<List<? extends T>, List<? extends T>, List<T>> LIZJ = C2451Dq3.LIZ;
    public final C0295Crj<C2492Dqi> LIZLLL = 7he.LIZ(new C2490Dqg(this));

    static {
        Covode.recordClassIndex(34663);
    }

    public abstract LsC<S, PgU<C0436Cwu<List<T>, P>>> LIZLLL();

    public LsC<S, PgU<C0436Cwu<List<T>, P>>> LJII() {
        return this.LIZ;
    }

    public LsD<List<? extends T>, List<? extends T>, List<T>> LJIIIIZZ() {
        return this.LIZIZ;
    }

    public LsD<List<? extends T>, List<? extends T>, List<T>> LJIIIZ() {
        return this.LIZJ;
    }

    public final void LJIIJ() {
        LsD LJIIIIZZ = LJIIIIZZ();
        LsC LIZLLL2 = LIZLLL();
        M12.LIZ(LJIIIIZZ, LIZLLL2);
        b_(new C2427Dpf(this, LIZLLL2, LJIIIIZZ));
    }

    public final void LJIIJJI() {
        LsC LJII = LJII();
        if (LJII != null) {
            LsD LJIIIZ = LJIIIZ();
            M12.LIZ(LJIIIZ, LJII);
            b_(new C2426Dpe(this, LJII, LJIIIZ));
        }
    }

    public final void LIZ(int i) {
        this.LIZLLL.getValue().LIZ(i);
    }

    public final void LIZ(LsD<? super Integer, ? super T, ? extends T> lsD) {
        M12.LIZ(lsD);
        LIZJ(new C2421DpZ(this, lsD));
    }

    public final C2382Dow LIZ(ListState<T, P> listState, List<? extends T> list) {
        boolean isEmpty = list.isEmpty();
        if (isEmpty == listState.isEmpty().LIZ) {
            return listState.isEmpty();
        }
        return new C2382Dow(isEmpty);
    }

    public final void LIZ(int i, Throwable th) {
        C0295Crj<C2492Dqi> crj = this.LIZLLL;
        if (crj.isInitialized()) {
            crj.getValue().LIZ(i, th);
        }
    }

    public final void LIZ(LsC<? super T, Boolean> lsC, LsC<? super T, ? extends T> lsC2) {
        M12.LIZ(lsC, lsC2);
        b_(new C2423Dpb(this, lsC, lsC2));
    }

    public static /* synthetic */ void LIZ(ListViewModel listViewModel, DV1 dv1, C2515Dr5 dr5, C2444Dpw dpw, C2444Dpw dpw2, int i) {
        C2444Dpw dpw3 = null;
        if ((i & 2) != 0) {
            dr5 = null;
        }
        if ((i & 4) != 0) {
            dpw = null;
        }
        if ((i & 8) == 0) {
            dpw3 = dpw2;
        }
        DV1 dv12 = dv1;
        M12.LIZ(dv12);
        ListViewModel listViewModel2 = listViewModel;
        if (listViewModel2 != null) {
            if (dpw != null) {
                DV0.LIZ(dv12, (JediViewModel) listViewModel2, C2464DqG.LIZ, (DUT) null, (LsD) new C2447Dpz(dpw), (LsC) new C2449Dq1(dpw), (LsD) new C2445Dpx(dpw), 2);
            }
            if (dpw3 != null) {
                DV0.LIZ(dv12, (JediViewModel) listViewModel2, C2465DqH.LIZ, (DUT) null, (LsD) new C2448Dq0(dpw3), (LsC) new C2450Dq2(dpw3), (LsD) new C2446Dpy(dpw3), 2);
            }
            if (dr5 != null) {
                2cN unused = dv12.selectSubscribe(listViewModel2, C2463DqF.LIZ, DUS.LIZ(), new C2440Dps(dr5, dv12, listViewModel2));
                return;
            }
            return;
        }
        throw new 7xU("null cannot be cast to non-null type com.bytedance.jedi.arch.ext.list.ListViewModel<T, P, com.bytedance.jedi.arch.ext.list.IListState<T, P>>");
    }
}
