package com.ss.android.ugc.aweme.search.activity;

import X.0Bt;
import X.1Bn;
import X.7XR;
import X.7Y2;
import X.CwZ;
import X.Cwu;
import X.LWw;
import X.M12;
import X.MLa;
import androidx.lifecycle.LiveData;
import com.bytedance.covode.number.Covode;
import com.bytedance.ies.sdk.widgets.NextLiveData;
import java.util.Map;

public final class SearchGlobalViewModel extends 0Bt {
    public final LiveData<7Y2> LIZ;
    public final 1Bn<Integer> LIZIZ;
    public final LiveData<Integer> LIZJ;
    public final LiveData<7XR> LIZLLL;
    public final LiveData<MLa> LJ;
    public final 1Bn<7Y2> LJFF;
    public final 1Bn<7XR> LJI;
    public final 1Bn<MLa> LJII;

    static {
        Covode.recordClassIndex(103999);
    }

    public final int LIZIZ() {
        MLa mLa = (MLa) this.LJII.getValue();
        if (mLa != null) {
            return mLa.LIZ;
        }
        return -1;
    }

    public SearchGlobalViewModel() {
        NextLiveData nextLiveData = new NextLiveData();
        this.LJFF = nextLiveData;
        this.LIZ = nextLiveData;
        NextLiveData nextLiveData2 = new NextLiveData();
        this.LIZIZ = nextLiveData2;
        this.LIZJ = nextLiveData2;
        NextLiveData nextLiveData3 = new NextLiveData();
        this.LJI = nextLiveData3;
        this.LIZLLL = nextLiveData3;
        NextLiveData nextLiveData4 = new NextLiveData();
        this.LJII = nextLiveData4;
        this.LJ = nextLiveData4;
    }

    public final boolean LIZ() {
        if (LIZIZ() == 1) {
            return true;
        }
        return false;
    }

    public final Integer LIZ(String str) {
        7Y2 r0;
        Map map;
        if (str == null || (r0 = (7Y2) this.LJFF.getValue()) == null || (map = r0.LIZIZ) == null) {
            return null;
        }
        return (Integer) map.get(str);
    }

    public final void LIZIZ(int i) {
        MLa mLa;
        MLa mLa2 = (MLa) this.LJII.getValue();
        if (mLa2 != null) {
            mLa = mLa2.LIZ(i);
        } else {
            mLa = new MLa(i);
        }
        this.LJII.setValue(mLa);
    }

    public final void LIZ(int i) {
        this.LIZIZ.postValue(Integer.valueOf(i));
    }

    public final void LIZ(String str, int i) {
        Map map;
        M12.LIZ(str);
        7Y2 r0 = (7Y2) this.LJFF.getValue();
        if (r0 == null || (map = r0.LIZIZ) == null) {
            this.LJFF.postValue(new 7Y2(str, LWw.LIZIZ(new Cwu[]{CwZ.LIZ(str, Integer.valueOf(i))})));
            return;
        }
        map.put(str, Integer.valueOf(i));
        this.LJFF.postValue(new 7Y2(str, map));
    }
}
