package com.bytedance.android.livesdk.comp.impl.game;

import X.0YJ;
import X.0aP;
import X.0c0;
import X.0cm;
import X.1JZ;
import X.1KX;
import X.1Ka;
import X.1hK;
import X.2sR;
import X.C1578G8d;
import X.C1781GFy;
import X.C1832GHx;
import X.C2409Gbi;
import X.C3905Gzq;
import X.GFH;
import X.GM9;
import X.GP5;
import X.M12;
import android.content.Context;
import android.os.Bundle;
import com.bytedance.android.live.broadcast.education.GameLiveNewBroadcastEducationBannerWidget;
import com.bytedance.android.live.broadcast.education.GameLiveNewBroadcastEducationDialogWidget;
import com.bytedance.android.live.broadcast.highlight.PreviewHighLightVideoWidget;
import com.bytedance.android.live.broadcast.mirror.GameCastFragment;
import com.bytedance.android.live.broadcast.speeddetector.GameBroadcastPreviewAutoSpeedDetectorWidget;
import com.bytedance.android.live.broadcast.speeddetector.NetworkSpeedDetectionDialog;
import com.bytedance.android.live.publicscreen.api.IPublicScreenService;
import com.bytedance.android.livesdk.LiveDialogFragment;
import com.bytedance.android.livesdk.chatroom.ui.GameBroadcastFragment;
import com.bytedance.android.livesdk.comp.api.game.service.IGameService;
import com.bytedance.android.livesdk.game.model.GameLiveFragment;
import com.bytedance.android.livesdk.livesetting.game.HighLightFunctionSetting;
import com.bytedance.android.livesdk.livesetting.watchlive.GameLiveMaskLayerBelow18Setting;
import com.bytedance.android.livesdk.livesetting.watchlive.GameLiveMaskLayerSetting;
import com.bytedance.android.livesdk.preview.widget.GameAutoCoverMarkWidget;
import com.bytedance.android.livesdk.preview.widget.GameAutoCoverWidget;
import com.bytedance.covode.number.Covode;
import com.bytedance.ies.sdk.widgets.LiveRecyclableWidget;
import com.bytedance.ies.sdk.widgets.LiveWidget;
import java.util.LinkedHashMap;
import kotlin.h.b.n;

public class GameService implements IGameService {
    public 0YJ iHighLightVideoOperte;

    static {
        Covode.recordClassIndex(14999);
    }

    public GFH mirrorCast() {
        return 1Ka.LJIIIZ;
    }

    public LiveWidget createGameAutoCoverMarkWidget() {
        return new GameAutoCoverMarkWidget();
    }

    public LiveRecyclableWidget createGameLiveBroadcastPreviewAutoSpeedDetectorWidget() {
        return new GameBroadcastPreviewAutoSpeedDetectorWidget();
    }

    public LiveRecyclableWidget createGameLiveNewBroadcastEducationDialogWidget() {
        return new GameLiveNewBroadcastEducationDialogWidget();
    }

    public LiveWidget createPreviewHighLightVideoWidget() {
        return new PreviewHighLightVideoWidget();
    }

    public LiveWidget createPreviewNewGameBroadcastEducationWidget() {
        return new GameLiveNewBroadcastEducationBannerWidget();
    }

    public LiveDialogFragment createSpeedDetectionDialog() {
        return new NetworkSpeedDetectionDialog();
    }

    private final 0YJ getIStartVideoEdit() {
        1KX r0 = this.iHighLightVideoOperte;
        if (r0 == null) {
            r0 = new 1KX();
        }
        this.iHighLightVideoOperte = r0;
        return r0;
    }

    public void onInit() {
        0cm.LIZ(IPublicScreenService.class).addOnRegistryReadyListener(new C1578G8d());
    }

    public GM9 getLiveGameConfig() {
        2sR<Boolean> r0 = C1781GFy.LLLJIL;
        n.LIZIZ(r0, "");
        Object LIZ = r0.LIZ();
        n.LIZIZ(LIZ, "");
        boolean booleanValue = ((Boolean) LIZ).booleanValue();
        2sR<Boolean> r02 = C1781GFy.LLLL;
        n.LIZIZ(r02, "");
        Object LIZ2 = r02.LIZ();
        n.LIZIZ(LIZ2, "");
        boolean booleanValue2 = ((Boolean) LIZ2).booleanValue();
        2sR<Integer> r03 = C1781GFy.LLLJL;
        n.LIZIZ(r03, "");
        Object LIZ3 = r03.LIZ();
        n.LIZIZ(LIZ3, "");
        int intValue = ((Number) LIZ3).intValue();
        2sR<Integer> r04 = C1781GFy.LLLLII;
        n.LIZIZ(r04, "");
        Object LIZ4 = r04.LIZ();
        n.LIZIZ(LIZ4, "");
        return new GM9(booleanValue, booleanValue2, intValue, ((Number) LIZ4).intValue(), GameLiveMaskLayerSetting.INSTANCE.isEnable(), GameLiveMaskLayerBelow18Setting.INSTANCE.isEnable());
    }

    public LiveWidget createGameAutoCoverWidget(String str) {
        M12.LIZ(str);
        return new GameAutoCoverWidget(str);
    }

    public void updateMaskAgeRestrictedSaveSelected(boolean z) {
        2sR<Boolean> r1 = C1781GFy.LLLJIL;
        n.LIZIZ(r1, "");
        r1.LIZ(Boolean.valueOf(z));
    }

    public void updateMaskAgeRestrictedTypeSelected(int i) {
        2sR<Integer> r1 = C1781GFy.LLLJL;
        n.LIZIZ(r1, "");
        r1.LIZ(Integer.valueOf(i));
    }

    public void updateMaskContentDisturbingSaveSelected(boolean z) {
        2sR<Boolean> r1 = C1781GFy.LLLL;
        n.LIZIZ(r1, "");
        r1.LIZ(Boolean.valueOf(z));
    }

    public void updateMaskContentDisturbingTypeSelected(int i) {
        2sR<Integer> r1 = C1781GFy.LLLLII;
        n.LIZIZ(r1, "");
        r1.LIZ(Integer.valueOf(i));
    }

    public C3905Gzq createMirrorCastFragment(Bundle bundle) {
        GameCastFragment gameCastFragment = new GameCastFragment();
        Bundle bundle2 = new Bundle();
        bundle2.putBundle("extra", bundle);
        gameCastFragment.setArguments(bundle2);
        return gameCastFragment;
    }

    public void cacheSaveToDraftFragmentId(String str) {
        M12.LIZ(str);
        M12.LIZ(str);
        if (C2409Gbi.LJFF) {
            0aP.LIZ(4, "GameBroadcastMessageStationWidget", "cacheSaveToDraftFragmentId(). id=".concat(String.valueOf(str)));
        }
        1JZ.LIZLLL.add(str);
        LinkedHashMap linkedHashMap = new LinkedHashMap();
        if (str == null) {
            str = "";
        }
        linkedHashMap.put("fragment_id", str);
        linkedHashMap.put("timestamp", Long.valueOf(System.currentTimeMillis()));
        0c0.LIZ(C1832GHx.LIZ("ttlive_highlight_to_draft_monitor"), -1, linkedHashMap);
    }

    public C3905Gzq createGameBroadcastFragment(GP5 gp5, Bundle bundle) {
        GameBroadcastFragment gameBroadcastFragment = new GameBroadcastFragment();
        Bundle bundle2 = new Bundle();
        bundle2.putBundle("extra", bundle);
        gameBroadcastFragment.setArguments(bundle2);
        gameBroadcastFragment.LJ = gp5;
        return gameBroadcastFragment;
    }

    public void saveToDraft(1hK r2, GameLiveFragment gameLiveFragment) {
        0YJ iStartVideoEdit;
        M12.LIZ(gameLiveFragment);
        if (HighLightFunctionSetting.INSTANCE.isOpen() && (iStartVideoEdit = getIStartVideoEdit()) != null) {
            iStartVideoEdit.LIZ(r2, gameLiveFragment);
        }
    }

    public void downloadVideoAndJumpShortVideoEditPage(Context context, String str, String str2, String str3, String str4) {
        0YJ iStartVideoEdit;
        Context context2 = context;
        String str5 = str2;
        String str6 = str4;
        String str7 = str3;
        M12.LIZ(context2, str5, str7, str6);
        if (HighLightFunctionSetting.INSTANCE.isOpen() && (iStartVideoEdit = getIStartVideoEdit()) != null) {
            iStartVideoEdit.LIZ(context2, str, str5, str7, str6);
        }
    }
}
