package com.ss.android.ugc.aweme.compliance.common.serviceimpl;

import X.7he;
import X.C473246a;
import X.C473346b;
import X.C473446c;
import X.C473546d;
import X.Crj;
import X.Lnj;
import com.bytedance.covode.number.Covode;
import com.bytedance.frameworks.apm.trace.MethodCollector;
import com.bytedance.router.SmartRouter;
import com.ss.android.ugc.aweme.compliance.api.services.hydrogen.IHydrogenService;
import com.ss.android.ugc.aweme.compliance.common.hydrogen.HydrogenInterceptor;
import java.util.HashMap;

public final class HydrogenServiceImpl implements IHydrogenService {
    public boolean LIZ;
    public final Crj LIZIZ = 7he.LIZ(C473446c.LIZ);

    static {
        Covode.recordClassIndex(61373);
    }

    public static IHydrogenService LIZIZ() {
        MethodCollector.i(526);
        IHydrogenService iHydrogenService = (IHydrogenService) Lnj.LIZ(IHydrogenService.class, false);
        if (iHydrogenService != null) {
            MethodCollector.o(526);
            return iHydrogenService;
        }
        Object LIZIZ2 = Lnj.LIZIZ(IHydrogenService.class, false);
        if (LIZIZ2 != null) {
            IHydrogenService iHydrogenService2 = (IHydrogenService) LIZIZ2;
            MethodCollector.o(526);
            return iHydrogenService2;
        }
        if (Lnj.LLIILII == null) {
            synchronized (IHydrogenService.class) {
                try {
                    if (Lnj.LLIILII == null) {
                        Lnj.LLIILII = new HydrogenServiceImpl();
                    }
                } catch (Throwable th) {
                    MethodCollector.o(526);
                    throw th;
                }
            }
        }
        HydrogenServiceImpl hydrogenServiceImpl = (HydrogenServiceImpl) Lnj.LLIILII;
        MethodCollector.o(526);
        return hydrogenServiceImpl;
    }

    public final void LIZ() {
        if (!this.LIZ) {
            this.LIZIZ.getValue();
            HashMap<String, String> hashMap = C473546d.LIZ;
            HashMap hashMap2 = new HashMap();
            for (C473346b next : C473246a.LIZ().LIZIZ) {
                hashMap2.put(next.LIZ, next.LIZIZ);
            }
            hashMap.putAll(hashMap2);
            HydrogenInterceptor hydrogenInterceptor = new HydrogenInterceptor();
            hydrogenInterceptor.setRewriteMap(C473546d.LIZ);
            SmartRouter.addInterceptor(hydrogenInterceptor);
            this.LIZ = true;
        }
    }
}
