package com.ss.android.ugc.aweme.notification.service;

import X.2ct;
import X.7he;
import X.9HM;
import X.C0295Crj;
import X.C4053Ean;
import X.C4060Eau;
import X.C4062Eaw;
import X.C4065Eaz;
import X.C4072Eb6;
import X.C4073Eb7;
import X.C4086EbK;
import X.C4096EbU;
import X.C4104Ebc;
import X.C5116Erw;
import X.EZ1;
import X.Lea;
import X.Lel;
import X.Lnj;
import X.M12;
import X.SsI;
import android.os.Message;
import com.bytedance.covode.number.Covode;
import com.bytedance.frameworks.apm.trace.MethodCollector;
import com.ss.android.ugc.aweme.im.sdk.common.controller.providedservices.IMService;
import com.ss.android.ugc.aweme.notice.api.count.OldNoticeCountService;
import com.ss.android.ugc.aweme.notice.api.count.OldRedPointService;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

public final class OldNoticeCountServiceImpl implements OldNoticeCountService {
    public final C0295Crj LIZIZ = 7he.LIZ(C4096EbU.LIZ);

    static {
        Covode.recordClassIndex(95739);
    }

    private final OldRedPointService LJI() {
        return (OldRedPointService) this.LIZIZ.getValue();
    }

    public final void LIZ(boolean z, int i) {
        LJI().LIZ(z, i);
    }

    public final void LIZIZ() {
        LJI().LIZ();
    }

    public final void LIZ() {
        if (C4104Ebc.LIZ.LIZIZ()) {
            SsI.LIZ(C4065Eaz.LIZIZ);
            IMService.createIIMServicebyMonsterPlugin(false);
        }
    }

    public final int LIZLLL() {
        List<Integer> LIZIZ2 = C4053Ean.LIZLLL.LIZIZ();
        ArrayList arrayList = new ArrayList(9HM.LIZ(LIZIZ2, 10));
        for (Number intValue : LIZIZ2) {
            arrayList.add(Integer.valueOf(LIZIZ(intValue.intValue())));
        }
        return Lea.LJIL(arrayList);
    }

    public final int LJ() {
        List<Integer> LIZ = C4053Ean.LIZLLL.LIZ();
        ArrayList arrayList = new ArrayList(9HM.LIZ(LIZ, 10));
        for (Number intValue : LIZ) {
            arrayList.add(Integer.valueOf(LIZIZ(intValue.intValue())));
        }
        return Lea.LJIL(arrayList);
    }

    public static OldNoticeCountService LJFF() {
        MethodCollector.i(7973);
        OldNoticeCountService oldNoticeCountService = (OldNoticeCountService) Lnj.LIZ(OldNoticeCountService.class, false);
        if (oldNoticeCountService != null) {
            MethodCollector.o(7973);
            return oldNoticeCountService;
        }
        Object LIZIZ2 = Lnj.LIZIZ(OldNoticeCountService.class, false);
        if (LIZIZ2 != null) {
            OldNoticeCountService oldNoticeCountService2 = (OldNoticeCountService) LIZIZ2;
            MethodCollector.o(7973);
            return oldNoticeCountService2;
        }
        if (Lnj.K == null) {
            synchronized (OldNoticeCountService.class) {
                try {
                    if (Lnj.K == null) {
                        Lnj.K = new OldNoticeCountServiceImpl();
                    }
                } catch (Throwable th) {
                    MethodCollector.o(7973);
                    throw th;
                }
            }
        }
        OldNoticeCountServiceImpl oldNoticeCountServiceImpl = (OldNoticeCountServiceImpl) Lnj.K;
        MethodCollector.o(7973);
        return oldNoticeCountServiceImpl;
    }

    public final Map<Integer, Integer> LIZJ() {
        C4060Eau eau = C4060Eau.LIZ;
        LinkedHashMap linkedHashMap = new LinkedHashMap();
        List<Number> LJII = Lea.LJII(C4053Ean.LIZLLL.LIZIZ());
        2ct.LJ.LIZ(LJII);
        for (Number intValue : LJII) {
            int intValue2 = intValue.intValue();
            int LIZ = C5116Erw.LIZ(intValue2);
            if (LIZ != 0) {
                linkedHashMap.put(Integer.valueOf(intValue2), Integer.valueOf(LIZ));
            }
        }
        linkedHashMap.put(99, Integer.valueOf(eau.LIZ()));
        return linkedHashMap;
    }

    public final C4062Eaw LIZJ(int i) {
        return C4053Ean.LIZLLL.LIZIZ(i);
    }

    public final List<Integer> LIZLLL(int i) {
        return C4053Ean.LIZLLL.LIZ(i, (C4072Eb6) null);
    }

    public final int LIZ(int i) {
        return LJI().LIZ(i);
    }

    public final int LIZIZ(int i) {
        return LJI().LIZIZ(i);
    }

    public final int LIZ(String str) {
        M12.LIZ(str);
        return EZ1.LIZ().LIZ(str);
    }

    public final void LIZ(Message message) {
        M12.LIZ(message);
        LJI().LIZ(message);
    }

    public final void LIZ(boolean z) {
        LJI().LIZ(z);
    }

    public final void LIZ(int i, int i2) {
        LJI().LIZ(i, i2);
    }

    public final void LIZ(C4072Eb6 eb6, int... iArr) {
        M12.LIZ(iArr);
        for (int LIZ : iArr) {
            LJI().LIZ(LIZ, eb6);
        }
    }

    public final int LIZ(int i, C4073Eb7 eb7) {
        int[] iArr;
        List list;
        C4073Eb7 eb72;
        M12.LIZ(eb7);
        int i2 = C4086EbK.LIZ[eb7.ordinal()];
        if (i2 == 1) {
            List<Integer> LIZ = C4053Ean.LIZLLL.LIZ(i, (C4072Eb6) null);
            if (LIZ == null || LIZ.isEmpty()) {
                list = Lel.INSTANCE;
            } else {
                ArrayList arrayList = new ArrayList();
                for (T next : LIZ) {
                    C4062Eaw eaw = C4053Ean.LIZ.get(Integer.valueOf(((Number) next).intValue()));
                    if (eaw != null) {
                        eb72 = eaw.LIZIZ;
                    } else {
                        eb72 = null;
                    }
                    if (eb72 == C4073Eb7.ShowNum) {
                        arrayList.add(next);
                    }
                }
                list = arrayList;
            }
            iArr = Lea.LJFF(list);
        } else if (i2 != 2) {
            return 0;
        } else {
            iArr = Lea.LJFF(C4053Ean.LIZLLL.LIZ(i));
        }
        ArrayList arrayList2 = new ArrayList(iArr.length);
        for (int LIZIZ2 : iArr) {
            arrayList2.add(Integer.valueOf(LIZIZ(LIZIZ2)));
        }
        return Lea.LJIL(arrayList2);
    }

    public final void LIZ(List<String> list, String str) {
        M12.LIZ(list, str);
        EZ1.LIZ().LIZ(list, str);
    }
}
