package com.ss.android.ugc.aweme.live.hostbusiness;

import X.2dc;
import X.C2286GZj;
import X.C3320GqP;
import X.C4282HEd;
import X.C5712Hnt;
import X.HDR;
import X.K0c;
import X.KGj;
import X.M12;
import android.content.Context;
import android.net.Uri;
import com.bytedance.android.livesdk.model.AdLiveEnterRoomConfig;
import com.bytedance.android.livesdkapi.business.IAdLiveHelperService;
import com.bytedance.android.livesdkapi.session.EnterRoomConfig;
import com.bytedance.covode.number.Covode;
import com.bytedance.ies.sdk.datachannel.DataChannelGlobal;
import com.ss.android.ugc.aweme.ad.FeedAdServiceImpl;
import com.ss.android.ugc.aweme.ad.feed.IFeedAdService;
import java.util.LinkedHashMap;
import java.util.Map;
import kotlin.h.b.n;

public final class AdLiveHelperService implements IAdLiveHelperService {
    static {
        Covode.recordClassIndex(91182);
    }

    public final void onInit() {
    }

    public final void LIZ(Uri uri, EnterRoomConfig enterRoomConfig) {
        M12.LIZ(uri, enterRoomConfig);
        try {
            String queryParameter = uri.getQueryParameter("adLiveJson");
            if (queryParameter != null) {
                n.LIZIZ(queryParameter, "");
                AdLiveEnterRoomConfig adLiveEnterRoomConfig = (AdLiveEnterRoomConfig) 2dc.LIZ(queryParameter, AdLiveEnterRoomConfig.class);
                String str = adLiveEnterRoomConfig.LIZLLL;
                if (str == null) {
                    return;
                }
                if (str.length() != 0) {
                    enterRoomConfig.LIZLLL.LJIILIIL = adLiveEnterRoomConfig;
                    enterRoomConfig.LIZLLL.LJIILJJIL = adLiveEnterRoomConfig.LIZ;
                    if (adLiveEnterRoomConfig.LIZ) {
                        C5712Hnt.LIZ.LIZJ();
                    }
                }
            }
        } catch (Exception unused) {
        }
    }

    public final void LIZ(Context context, String str, long j) {
        M12.LIZ(context, str);
        IFeedAdService LJFF = FeedAdServiceImpl.LJFF();
        if (LJFF != null) {
            LJFF.LIZ(context, str, j);
        }
    }

    public final void LIZ(Context context, String str, long j, C2286GZj gZj) {
        String str2 = str;
        Context context2 = context;
        M12.LIZ(context2, str2, gZj);
        IFeedAdService LJFF = FeedAdServiceImpl.LJFF();
        if (LJFF != null) {
            LJFF.LIZ(context2, str2, j, new HDR(gZj));
        }
    }

    public final void LIZ(String str, String str2, Map<String, ? extends Object> map, Map<String, ? extends Object> map2) {
        AdLiveEnterRoomConfig adLiveEnterRoomConfig;
        String str3;
        M12.LIZ(str, str2);
        C3320GqP gqP = (C3320GqP) DataChannelGlobal.LIZLLL.LIZIZ(C4282HEd.class);
        if (gqP != null && (adLiveEnterRoomConfig = gqP.LJJJJZ) != null && (str3 = adLiveEnterRoomConfig.LIZLLL) != null) {
            LinkedHashMap linkedHashMap = new LinkedHashMap();
            Map<String, Object> LIZIZ = adLiveEnterRoomConfig.LIZIZ();
            KGj LIZ = K0c.LIZ(str, str2, str3, adLiveEnterRoomConfig.LJFF, adLiveEnterRoomConfig.LJI);
            LIZ.LIZIZ(map);
            LIZ.LIZ(map2);
            LIZ.LIZIZ(linkedHashMap);
            LIZ.LIZ(LIZIZ);
            LIZ.LIZIZ();
        }
    }
}
