package com.ss.android.ugc.aweme.ecommerce;

import X.6iy;
import X.C0665KCq;
import X.C0878KKv;
import X.C1715Kh8;
import X.C1719KhC;
import X.C1729KhM;
import X.C1739KhW;
import X.C1740KhX;
import X.C1741KhY;
import X.C2012Klv;
import X.C4672Lnj;
import X.HzT;
import X.KT7;
import X.LC9;
import X.M12;
import com.bytedance.covode.number.Covode;
import com.bytedance.frameworks.apm.trace.MethodCollector;
import com.bytedance.router.interceptor.IInterceptor;
import com.ss.android.ugc.aweme.ecommerce.router.EcomHybridInterceptor;
import com.ss.android.ugc.aweme.ecommerce.router.ISparkRouterInterceptor;
import com.ss.android.ugc.aweme.ecommerce.service.IEComHybridBridgeService;
import com.ss.android.ugc.aweme.ecommerce.service.IEComHybridLynxBehaviorService;
import com.ss.android.ugc.aweme.ecommerce.service.IEComHybridSparkInterceptorService;
import com.ss.android.ugc.aweme.framework.services.ServiceManager;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import kotlin.h.b.n;

public final class ECommerceHybridServiceImpl implements IECommerceHybridService {
    public static final C1739KhW LIZ = new C1739KhW((byte) 0);
    public static final List<LC9> LIZIZ = new ArrayList();

    public final List<IInterceptor> LIZJ() {
        return 6iy.LIZ(new EcomHybridInterceptor());
    }

    static {
        Covode.recordClassIndex(67858);
    }

    public final void LIZ() {
        if (!C1740KhX.LIZ) {
            C1715Kh8.LJIIJJI.LIZ((C1729KhM) new C1741KhY());
            C1715Kh8.LJIIJJI.LIZ((C1719KhC) new C2012Klv());
            C1740KhX.LIZ = true;
        }
    }

    public final List<LC9> LIZIZ() {
        if (LIZIZ.isEmpty()) {
            Set<IEComHybridLynxBehaviorService> services = ServiceManager.get().getServices(IEComHybridLynxBehaviorService.class);
            n.LIZIZ(services, "");
            for (IEComHybridLynxBehaviorService LIZ2 : services) {
                LIZIZ.addAll(LIZ2.LIZ());
            }
        }
        return LIZIZ;
    }

    public static IECommerceHybridService LIZLLL() {
        MethodCollector.i(582);
        IECommerceHybridService iECommerceHybridService = (IECommerceHybridService) C4672Lnj.LIZ(IECommerceHybridService.class, false);
        if (iECommerceHybridService != null) {
            MethodCollector.o(582);
            return iECommerceHybridService;
        }
        Object LIZIZ2 = C4672Lnj.LIZIZ(IECommerceHybridService.class, false);
        if (LIZIZ2 != null) {
            IECommerceHybridService iECommerceHybridService2 = (IECommerceHybridService) LIZIZ2;
            MethodCollector.o(582);
            return iECommerceHybridService2;
        }
        if (C4672Lnj.LLJJI == null) {
            synchronized (IECommerceHybridService.class) {
                try {
                    if (C4672Lnj.LLJJI == null) {
                        C4672Lnj.LLJJI = new ECommerceHybridServiceImpl();
                    }
                } catch (Throwable th) {
                    MethodCollector.o(582);
                    throw th;
                }
            }
        }
        ECommerceHybridServiceImpl eCommerceHybridServiceImpl = (ECommerceHybridServiceImpl) C4672Lnj.LLJJI;
        MethodCollector.o(582);
        return eCommerceHybridServiceImpl;
    }

    public final List<C0665KCq> LIZ(KT7 kt7) {
        M12.LIZ((Object) kt7);
        ArrayList arrayList = new ArrayList();
        Set<IEComHybridBridgeService> services = ServiceManager.get().getServices(IEComHybridBridgeService.class);
        n.LIZIZ(services, "");
        for (IEComHybridBridgeService LIZ2 : services) {
            arrayList.addAll(LIZ2.LIZ(kt7));
        }
        return arrayList;
    }

    public final List<ISparkRouterInterceptor> LIZ(String str) {
        ArrayList arrayList = new ArrayList();
        Set<IEComHybridSparkInterceptorService> services = ServiceManager.get().getServices(IEComHybridSparkInterceptorService.class);
        n.LIZIZ(services, "");
        for (IEComHybridSparkInterceptorService LIZ2 : services) {
            arrayList.addAll(LIZ2.LIZ(str));
        }
        return arrayList;
    }

    public final Map<String, HzT> LIZ(C0878KKv kKv) {
        LinkedHashMap linkedHashMap = new LinkedHashMap();
        Set<IEComHybridBridgeService> services = ServiceManager.get().getServices(IEComHybridBridgeService.class);
        n.LIZIZ(services, "");
        for (IEComHybridBridgeService LIZ2 : services) {
            linkedHashMap.putAll(LIZ2.LIZ(kKv));
        }
        return linkedHashMap;
    }
}
