package com.ss.android.ugc.aweme.commercialize.feed.assem.popup.viewmodel;

import X.CqM;
import X.D0S;
import X.D0V;
import X.D45;
import X.DRK;
import X.Hle;
import X.HmW;
import X.HmY;
import X.K0c;
import X.KGj;
import X.KwT;
import X.TSt;
import com.bytedance.covode.number.Covode;
import com.google.gson.m;
import com.ss.android.ugc.aweme.feed.model.Aweme;
import com.ss.android.ugc.aweme.feed.model.AwemeRawAd;
import com.ss.android.ugc.aweme.feed.model.VideoItemParams;
import java.util.LinkedHashMap;
import kotlin.h.b.n;

public final class AdPopUpWebPageVM extends AbsAdPopUpWebPageVM {
    public static final DRK LJFF = new DRK((byte) 0);

    static {
        Covode.recordClassIndex(58756);
    }

    /* JADX WARNING: type inference failed for: r6v0, types: [com.ss.android.ugc.aweme.commercialize.feed.assem.popup.viewmodel.AdPopUpWebPageVM, com.bytedance.ext_power_list.AssemViewModelWithItem] */
    public final void LIZJ() {
        String str;
        Aweme aweme;
        AwemeRawAd awemeRawAd;
        LinkedHashMap linkedHashMap = new LinkedHashMap();
        VideoItemParams videoItemParams = (VideoItemParams) LIZ();
        if (videoItemParams == null || (aweme = videoItemParams.mAweme) == null || (awemeRawAd = aweme.getAwemeRawAd()) == null || (str = awemeRawAd.getWebUrl()) == null) {
            str = "";
        }
        linkedHashMap.put("url", str);
        linkedHashMap.put("timestamp", String.valueOf(System.currentTimeMillis()));
        HmY.LIZ(new HmW("ad_webview_close", System.currentTimeMillis(), new Hle().LIZ(linkedHashMap)));
    }

    /* JADX WARNING: type inference failed for: r4v0, types: [com.bytedance.assem.arch.viewModel.AssemViewModel, com.ss.android.ugc.aweme.commercialize.feed.assem.popup.viewmodel.AbsAdPopUpWebPageVM, com.ss.android.ugc.aweme.commercialize.feed.assem.popup.viewmodel.AdPopUpWebPageVM, com.bytedance.ext_power_list.AssemViewModelWithItem] */
    public final void LIZIZ() {
        String str;
        AwemeRawAd awemeRawAd;
        String str2;
        Aweme aweme;
        Aweme aweme2;
        AwemeRawAd awemeRawAd2;
        Aweme aweme3;
        CqM.LIZ(new D45(false));
        setState(D0S.LIZ);
        setState(D0V.LIZ);
        if (KwT.LIZLLL == 1) {
            str = "slide";
        } else {
            str = "slide_down";
        }
        VideoItemParams videoItemParams = (VideoItemParams) LIZ();
        AwemeRawAd awemeRawAd3 = null;
        if (videoItemParams == null || (aweme3 = videoItemParams.mAweme) == null) {
            awemeRawAd = null;
        } else {
            awemeRawAd = aweme3.getAwemeRawAd();
        }
        if (LIZ(awemeRawAd)) {
            VideoItemParams videoItemParams2 = (VideoItemParams) LIZ();
            if (videoItemParams2 == null || (aweme2 = videoItemParams2.mAweme) == null || (awemeRawAd2 = aweme2.getAwemeRawAd()) == null || awemeRawAd2.getWebviewPannelStyle() != 1) {
                str2 = "landing_page";
            } else {
                str2 = "close";
            }
            VideoItemParams videoItemParams3 = (VideoItemParams) LIZ();
            if (!(videoItemParams3 == null || (aweme = videoItemParams3.mAweme) == null)) {
                awemeRawAd3 = aweme.getAwemeRawAd();
            }
            KGj LIZ = K0c.LIZ("landing_ad", str2, awemeRawAd3);
            String str3 = this.LIZIZ;
            if (str3 != null) {
                str = str3;
            }
            LIZ.LIZIZ("refer", str);
            LIZ.LIZIZ();
        }
        LIZ(System.currentTimeMillis() - this.LIZJ);
        LIZJ();
    }

    public final boolean LIZ(AwemeRawAd awemeRawAd) {
        if (awemeRawAd != null && awemeRawAd.getWebviewType() == 1 && this.LIZLLL == 2) {
            return true;
        }
        return false;
    }

    /* JADX WARNING: type inference failed for: r4v0, types: [com.ss.android.ugc.aweme.commercialize.feed.assem.popup.viewmodel.AdPopUpWebPageVM, com.bytedance.ext_power_list.AssemViewModelWithItem] */
    public final String LIZ(Aweme aweme, String str, boolean z, String str2) {
        String str3;
        String str4;
        String str5;
        m mVar = new m();
        try {
            VideoItemParams videoItemParams = (VideoItemParams) LIZ();
            String str6 = null;
            if (videoItemParams != null) {
                str3 = videoItemParams.mEventType;
            } else {
                str3 = null;
            }
            mVar.LIZ("enter_from", str3);
            mVar.LIZ("from_source", "item_anchor");
            if (aweme != null) {
                str4 = aweme.getAid();
            } else {
                str4 = null;
            }
            mVar.LIZ("from_group_id", str4);
            if (aweme != null) {
                str6 = aweme.getAuthorUid();
            }
            mVar.LIZ("from_author_id", str6);
            mVar.LIZ("scene_id", str);
            if (z) {
                str5 = "item_play";
            } else {
                str5 = "anchor_list";
            }
            mVar.LIZ("position", str5);
            mVar.LIZ("anchor_type", str2);
        } catch (Exception e) {
            TSt.LIZ(e);
        }
        String jVar = mVar.toString();
        n.LIZIZ(jVar, "");
        return jVar;
    }
}
