package com.bytedance.creativex.recorder.sticker.panel;

import X.1Bn;
import X.2HN;
import X.5Am;
import X.5Ft;
import X.7he;
import X.Crj;
import X.LsC;
import X.M12;
import X.NC5;
import X.NDD;
import X.NDF;
import X.NDG;
import X.NDH;
import X.NDV;
import X.NE6;
import androidx.lifecycle.LiveData;
import com.bytedance.covode.number.Covode;
import com.bytedance.ui_component.LifecycleAwareViewModel;
import java.util.Collection;
import java.util.HashSet;

public final class RecordStickerPanelViewModel extends LifecycleAwareViewModel<StickerPanelState> implements NDV {
    public final 1Bn<Boolean> LIZ = new 1Bn<>();
    public final NE6 LIZIZ;
    public final NC5 LIZJ;
    public final Crj LIZLLL = 7he.LIZ(NDD.LIZ);

    static {
        Covode.recordClassIndex(25639);
    }

    private final HashSet<NDH> LIZJ() {
        return (HashSet) this.LIZLLL.getValue();
    }

    public final LiveData<Boolean> LIZIZ() {
        return this.LIZ;
    }

    public final /* synthetic */ 5Am dU_() {
        return new StickerPanelState((5Ft) null, 1, (2HN) null);
    }

    public final void cl_() {
        RecordStickerPanelViewModel.super.cl_();
        this.LIZIZ.LIZ().LIZ(this, new NDG(this));
    }

    public final void LIZ(NDH ndh) {
        M12.LIZ(ndh);
        LIZJ().add(ndh);
    }

    public final void LIZ(boolean z) {
        LsC<? super Boolean, Boolean> lsC = this.LIZJ.LIZ;
        if (lsC == null || !((Boolean) lsC.invoke(Boolean.valueOf(z))).booleanValue()) {
            if (z) {
                HashSet<NDH> LIZJ2 = LIZJ();
                if (!(LIZJ2 instanceof Collection) || !LIZJ2.isEmpty()) {
                    for (NDH LIZ2 : LIZJ2) {
                        if (LIZ2.LIZ()) {
                            return;
                        }
                    }
                }
            }
            LIZLLL(new NDF(this, z));
        }
    }

    public RecordStickerPanelViewModel(NE6 ne6, NC5 nc5) {
        M12.LIZ(ne6, nc5);
        this.LIZIZ = ne6;
        this.LIZJ = nc5;
    }
}
