package com.bytedance.sdk.openadsdk.maa.fm;

import android.content.Context;
import android.text.TextUtils;
import android.webkit.ConsoleMessage;
import android.webkit.WebResourceError;
import android.webkit.WebResourceRequest;
import android.webkit.WebResourceResponse;
import android.webkit.WebView;
import android.widget.FrameLayout;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.media3.exoplayer.upstream.CmcdConfiguration;
import com.bytedance.sdk.component.ef.wsy;
import com.bytedance.sdk.component.fm.fhx;
import com.bytedance.sdk.component.utils.wey;
import com.bytedance.sdk.openadsdk.BuildConfig;
import com.bytedance.sdk.openadsdk.core.gof;
import com.bytedance.sdk.openadsdk.core.hxv;
import com.bytedance.sdk.openadsdk.core.model.ai;
import com.bytedance.sdk.openadsdk.core.model.lse;
import com.bytedance.sdk.openadsdk.core.widget.ef;
import com.bytedance.sdk.openadsdk.core.widget.fm.ajl;
import com.bytedance.sdk.openadsdk.core.widget.vt;
import com.bytedance.sdk.openadsdk.maa.jnr;
import com.bytedance.sdk.openadsdk.maa.wsy;
import com.bytedance.sdk.openadsdk.maa.wu;
import com.bytedance.sdk.openadsdk.utils.bx;
import com.bytedance.sdk.openadsdk.yz.gqi;
import java.lang.ref.WeakReference;
import java.util.HashMap;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
import org.json.JSONException;
import org.json.JSONObject;

/* JADX INFO: loaded from: classes2.dex */
public class fm {

    @Nullable
    private vt ajl;
    private volatile boolean dsz;
    private boolean duv;

    /* JADX INFO: renamed from: ef, reason: collision with root package name */
    private final String f7474ef;
    private int fhx;
    protected wsy fm;
    private ef gof;
    private com.bytedance.sdk.openadsdk.core.lb.fm gqi;
    private StringBuilder hi;
    private long hlt;
    private AtomicBoolean irt;
    private final FrameLayout jnr;

    @Nullable
    private com.bytedance.sdk.openadsdk.dsz.wsy ku;

    /* JADX INFO: renamed from: lb, reason: collision with root package name */
    private final lse f7475lb;
    private int lse;
    private int maa;
    private InterfaceC0099fm nt;
    private volatile boolean onz;
    private AtomicBoolean qhl;
    private final Context ro;
    private boolean sds;
    private wu vt;
    private ro wey;
    private hxv wsy;
    private String wu;
    private final int yz;

    /* JADX INFO: renamed from: com.bytedance.sdk.openadsdk.maa.fm.fm$fm, reason: collision with other inner class name */
    public interface InterfaceC0099fm {
        void fm(int i10);
    }

    public interface ro {
        void fm();
    }

    public fm(Context context, lse lseVar, int i10, boolean z10, FrameLayout frameLayout) {
        this(context, lseVar, i10, z10, frameLayout, false);
    }

    public void fm(InterfaceC0099fm interfaceC0099fm) {
        this.nt = interfaceC0099fm;
    }

    public boolean jnr() {
        return this.dsz;
    }

    public hxv wsy() {
        return this.wsy;
    }

    public fm(Context context, lse lseVar, int i10, boolean z10, FrameLayout frameLayout, boolean z11) {
        this(context, lseVar, i10, z10, frameLayout, z11, 0);
    }

    private void lb(boolean z10) {
        fhx fhxVarRo;
        JSONObject jSONObject = new JSONObject();
        try {
            jSONObject.put(CmcdConfiguration.KEY_CONTENT_ID, this.f7475lb.eo());
            jSONObject.put("log_extra", this.f7475lb.gt());
        } catch (Throwable unused) {
        }
        if (com.bytedance.sdk.openadsdk.core.vt.ro().fhx()) {
            com.bytedance.sdk.openadsdk.maa.wsy.fm(new wsy.fm() { // from class: com.bytedance.sdk.openadsdk.maa.fm.fm.1
            });
        }
        wu wuVarFm = wu.fm(gof.fm(), this.fm.getWebView(), new com.bytedance.sdk.openadsdk.maa.lb() { // from class: com.bytedance.sdk.openadsdk.maa.fm.fm.2
            @Override // com.bytedance.sdk.openadsdk.maa.lb
            public void fm(String str, JSONObject jSONObject2) {
                if (fm.this.wsy != null) {
                    fm.this.wsy.fm(str, jSONObject2);
                }
            }
        }, new com.bytedance.sdk.openadsdk.maa.fm() { // from class: com.bytedance.sdk.openadsdk.maa.fm.fm.3
            @Override // com.bytedance.sdk.openadsdk.maa.fm
            public com.bytedance.sdk.openadsdk.maa.yz fm() {
                String strWu = com.bytedance.sdk.openadsdk.common.lb.wu();
                strWu.getClass();
                switch (strWu) {
                    case "2g":
                        return com.bytedance.sdk.openadsdk.maa.yz.TYPE_2G;
                    case "3g":
                        return com.bytedance.sdk.openadsdk.maa.yz.TYPE_3G;
                    case "4g":
                        return com.bytedance.sdk.openadsdk.maa.yz.TYPE_4G;
                    case "5g":
                        return com.bytedance.sdk.openadsdk.maa.yz.TYPE_5G;
                    case "wifi":
                        return com.bytedance.sdk.openadsdk.maa.yz.TYPE_WIFI;
                    default:
                        return com.bytedance.sdk.openadsdk.maa.yz.TYPE_UNKNOWN;
                }
            }

            @Override // com.bytedance.sdk.openadsdk.maa.fm
            public void lb() {
                if (fm.this.wsy.onz() != null) {
                    fm.this.wsy.onz().fm(true);
                }
            }

            @Override // com.bytedance.sdk.openadsdk.maa.fm
            public void ro() {
                fm.this.wsy.yz(true);
                if (fm.this.ku != null) {
                    fm.this.ku.fm();
                }
            }

            @Override // com.bytedance.sdk.openadsdk.maa.fm
            public void fm(final JSONObject jSONObject2) {
                if (jSONObject2 == null) {
                    jSONObject2 = new JSONObject();
                }
                com.bytedance.sdk.openadsdk.yz.lb.fm(System.currentTimeMillis(), fm.this.f7475lb, fm.this.wu, "playable_track", new com.bytedance.sdk.openadsdk.irt.ro.fm() { // from class: com.bytedance.sdk.openadsdk.maa.fm.fm.3.1
                    @Override // com.bytedance.sdk.openadsdk.irt.ro.fm, com.bytedance.sdk.openadsdk.irt.ro.ro
                    public JSONObject fm() {
                        try {
                            JSONObject jSONObject3 = new JSONObject();
                            jSONObject3.put("is_new_playable", 1);
                            if (fm.this.f7475lb.yw()) {
                                jSONObject3.put("is_pre_render", 1);
                            }
                            return jSONObject3;
                        } catch (JSONException e10) {
                            wey.lb("PlayableManager", e10.getMessage());
                            return null;
                        }
                    }

                    @Override // com.bytedance.sdk.openadsdk.irt.ro.fm, com.bytedance.sdk.openadsdk.irt.ro.ro
                    public JSONObject lb() {
                        return jSONObject2;
                    }
                });
            }

            @Override // com.bytedance.sdk.openadsdk.maa.fm
            public void fm(int i10, String str) {
                fm.this.duv = false;
                if (i10 == 2 || i10 == 3 || i10 == 4) {
                    fm.this.fm(2, i10);
                } else if (i10 == 5) {
                    fm.this.fm(3, i10);
                } else {
                    fm.this.fm(1, 0);
                }
            }
        });
        this.vt = wuVarFm;
        wuVarFm.wsy(this.f7474ef).jnr(com.bytedance.sdk.openadsdk.common.lb.fm(gof.fm())).ro(com.bytedance.sdk.openadsdk.common.lb.wsy()).fm(com.bytedance.sdk.openadsdk.common.lb.fm()).yz(com.bytedance.sdk.openadsdk.common.lb.ajl()).lb(jSONObject).lb(ai.vt(this.f7475lb)).yz(true).fm(z10).lb(false).fm(ai.qhl(this.f7475lb)).ro(ai.qhl(this.f7475lb)).fm("sdkEdition", com.bytedance.sdk.openadsdk.common.lb.lb()).jnr(ai.ajl(this.f7475lb)).ajl(this.wu);
        this.vt.fm(jnr.ro(this.ro));
        Set<String> setKu = this.vt.ku();
        final WeakReference weakReference = new WeakReference(this.vt);
        for (String str : setKu) {
            if (!"subscribe_app_ad".equals(str) && !"adInfo".equals(str) && !"webview_time_track".equals(str) && !"download_app_ad".equals(str) && (fhxVarRo = this.wsy.ro()) != null) {
                fhxVarRo.fm(str, new com.bytedance.sdk.component.fm.yz<JSONObject, JSONObject>() { // from class: com.bytedance.sdk.openadsdk.maa.fm.fm.4
                    @Override // com.bytedance.sdk.component.fm.yz
                    public JSONObject fm(String str2, @NonNull JSONObject jSONObject2, @NonNull com.bytedance.sdk.component.fm.jnr jnrVar) {
                        try {
                            wu wuVar = (wu) weakReference.get();
                            if (wuVar == null) {
                                return null;
                            }
                            return wuVar.yz(fm(), jSONObject2);
                        } catch (Throwable unused2) {
                            return null;
                        }
                    }
                });
            }
        }
    }

    private void wu() {
        ajl ajlVar = new ajl(gof.fm(), this.wsy, this.f7475lb.eo(), null, true) { // from class: com.bytedance.sdk.openadsdk.maa.fm.fm.5
            @Override // com.bytedance.sdk.openadsdk.core.widget.fm.ajl, android.webkit.WebViewClient
            public void onPageFinished(WebView webView, String str) {
                super.onPageFinished(webView, str);
                if (fm.this.vt != null) {
                    fm.this.vt.ef(str);
                }
                if (fm.this.duv) {
                    fm.this.fm(0, 0);
                    com.bytedance.sdk.openadsdk.yz.lb.fm(System.currentTimeMillis(), fm.this.f7475lb, fm.this.wu, "py_loading_success");
                }
            }

            @Override // com.bytedance.sdk.openadsdk.core.widget.fm.ajl, android.webkit.WebViewClient
            public void onReceivedError(WebView webView, int i10, String str, String str2) {
                super.onReceivedError(webView, i10, str, str2);
                fm.this.duv = false;
                if (fm.this.vt != null) {
                    fm.this.vt.ajl(com.bytedance.sdk.openadsdk.core.fhx.lb.fm.fm().fm(fm.this.f7475lb));
                    fm.this.vt.fm(i10, str, str2);
                }
            }

            @Override // com.bytedance.sdk.openadsdk.core.widget.fm.ajl, android.webkit.WebViewClient
            public void onReceivedHttpError(WebView webView, WebResourceRequest webResourceRequest, WebResourceResponse webResourceResponse) {
                super.onReceivedHttpError(webView, webResourceRequest, webResourceResponse);
                if (webResourceRequest.isForMainFrame()) {
                    fm.this.duv = false;
                    if (fm.this.vt != null) {
                        fm.this.vt.ajl(com.bytedance.sdk.openadsdk.core.fhx.lb.fm.fm().fm(fm.this.f7475lb));
                        fm.this.vt.fm(webResourceRequest.isForMainFrame(), webResourceRequest.getUrl().toString(), webResourceResponse.getStatusCode());
                    }
                }
            }

            @Override // com.bytedance.sdk.openadsdk.core.widget.fm.ajl, android.webkit.WebViewClient
            public WebResourceResponse shouldInterceptRequest(WebView webView, String str) {
                try {
                    if (fm.this.f7475lb.ex() != null && !TextUtils.isEmpty(fm.this.f7475lb.ex().f5929i)) {
                        if (fm.this.vt != null) {
                            fm.this.vt.vt(str);
                        }
                        String strDuv = ai.duv(fm.this.f7475lb);
                        WebResourceResponse webResourceResponseFm = com.bytedance.sdk.openadsdk.core.fhx.lb.fm.fm().fm(fm.this.f7475lb.ex().f5929i, strDuv, str);
                        if (webResourceResponseFm == null) {
                            return super.shouldInterceptRequest(webView, str);
                        }
                        if (fm.this.vt != null) {
                            fm.this.vt.ku(str);
                        }
                        return webResourceResponseFm;
                    }
                    return super.shouldInterceptRequest(webView, str);
                } catch (Throwable unused) {
                    return super.shouldInterceptRequest(webView, str);
                }
            }

            @Override // com.bytedance.sdk.openadsdk.core.widget.fm.ajl, android.webkit.WebViewClient
            @RequiresApi(api = 23)
            public void onReceivedError(WebView webView, WebResourceRequest webResourceRequest, WebResourceError webResourceError) {
                super.onReceivedError(webView, webResourceRequest, webResourceError);
                if (webResourceRequest.isForMainFrame()) {
                    fm.this.duv = false;
                    if (fm.this.vt == null || webResourceError == null) {
                        return;
                    }
                    fm.this.vt.ajl(com.bytedance.sdk.openadsdk.core.fhx.lb.fm.fm().fm(fm.this.f7475lb));
                    fm.this.vt.fm(webResourceError.getErrorCode(), String.valueOf(webResourceError.getDescription()), String.valueOf(webResourceRequest.getUrl()));
                }
            }
        };
        ajlVar.fm(this.f7475lb);
        this.fm.setWebViewClient(ajlVar);
        this.fm.setWebChromeClient(new com.bytedance.sdk.openadsdk.core.widget.fm.jnr(this.wsy) { // from class: com.bytedance.sdk.openadsdk.maa.fm.fm.6
            @Override // com.bytedance.sdk.openadsdk.core.widget.fm.jnr, android.webkit.WebChromeClient
            public boolean onConsoleMessage(ConsoleMessage consoleMessage) {
                return super.onConsoleMessage(consoleMessage);
            }

            @Override // com.bytedance.sdk.openadsdk.core.widget.fm.jnr, android.webkit.WebChromeClient
            public void onProgressChanged(WebView webView, int i10) {
                super.onProgressChanged(webView, i10);
                if (fm.this.ajl == null || fm.this.ajl.getVisibility() != 0) {
                    return;
                }
                fm.this.ajl.setProgress(i10);
            }
        });
        com.bytedance.sdk.openadsdk.core.widget.fm.yz.fm(this.ro).fm(false).ro(false).fm(this.fm.getWebView());
        com.bytedance.sdk.component.ef.wsy wsyVar = this.fm;
        wsyVar.setUserAgentString(com.bytedance.sdk.openadsdk.utils.wey.fm(wsyVar.getWebView(), BuildConfig.VERSION_CODE));
        this.fm.setMixedContentMode(0);
    }

    public boolean ajl() {
        hxv hxvVar = this.wsy;
        if (hxvVar != null) {
            return hxvVar.ajl();
        }
        return false;
    }

    public void fm(ro roVar) {
        this.wey = roVar;
    }

    public void ro() {
        wu wuVar;
        if (!this.irt.get() || (wuVar = this.vt) == null) {
            return;
        }
        wuVar.lb(true);
    }

    public void yz() {
        wu wuVar = this.vt;
        if (wuVar != null) {
            wuVar.gc();
        }
        com.bytedance.sdk.component.ef.wsy wsyVar = this.fm;
        if (wsyVar != null) {
            wsyVar.fhx();
        }
        hxv hxvVar = this.wsy;
        if (hxvVar != null) {
            hxvVar.duv();
        }
        this.hlt = System.currentTimeMillis();
        this.hi = new StringBuilder();
        try {
            for (StackTraceElement stackTraceElement : Thread.currentThread().getStackTrace()) {
                StringBuilder sb = this.hi;
                sb.append(stackTraceElement);
                sb.append("\n");
            }
        } catch (Throwable th) {
            wey.fm("PlayableManager", "onDestroy() error", th);
        }
        this.fm = null;
    }

    public fm(Context context, lse lseVar, int i10, boolean z10, FrameLayout frameLayout, boolean z11, int i11) {
        this.duv = true;
        this.irt = new AtomicBoolean(false);
        this.qhl = new AtomicBoolean(false);
        this.lse = 0;
        this.hlt = 0L;
        this.ro = context;
        this.f7475lb = lseVar;
        this.maa = i11;
        if (lseVar != null && lseVar.yz() != null && lseVar.yz().jnr() != null) {
            this.lse = lseVar.yz().jnr().size();
        }
        this.yz = i10;
        String strLb = bx.lb(lseVar.cpu().getDurationSlotType());
        this.wu = strLb;
        int iFm = bx.fm(strLb);
        this.sds = z11;
        if (z11) {
            this.wu = bx.ro(iFm);
        }
        this.f7474ef = ai.duv(lseVar);
        this.jnr = frameLayout;
        fm(frameLayout);
        fm(iFm);
        lb(z10);
        wu();
    }

    public void ro(boolean z10) {
        wu wuVar = this.vt;
        if (wuVar != null) {
            wuVar.jnr(z10);
        }
    }

    private void fm(FrameLayout frameLayout) {
        com.bytedance.sdk.component.ef.wsy wsyVar = new com.bytedance.sdk.component.ef.wsy(this.ro, true, wsy.lb.PLAYABLE);
        this.fm = wsyVar;
        wsyVar.jnr();
        this.fm.setLayerType(2, null);
        this.fm.setVisibility(4);
        this.fm.setBackgroundColor(-16777216);
        this.fm.setEnabled(true);
        this.fm.setTag(this.wu);
        this.fm.setMaterialMeta(this.f7475lb.ooo());
        this.fm.setLandingPage(true);
        frameLayout.addView(this.fm, new FrameLayout.LayoutParams(-1, -1));
        ef efVar = new ef(this.ro);
        this.gof = efVar;
        efVar.fm(this.f7475lb, this.wu, this.gqi, this.sds);
        frameLayout.addView(this.gof, new FrameLayout.LayoutParams(-1, -1));
        if (this.f7475lb.npg()) {
            vt vtVar = new vt(this.ro);
            this.ajl = vtVar;
            vtVar.ro();
            frameLayout.addView(this.ajl, new FrameLayout.LayoutParams(-1, -1));
        }
    }

    private void fm(int i10) {
        HashMap map = new HashMap();
        map.put("click_scence", 3);
        this.wsy = new hxv(this.ro);
        String strUuz = this.f7475lb.uuz();
        JSONObject jSONObject = new JSONObject();
        try {
            jSONObject.put("isMultiAd", this.f7475lb.qf());
            jSONObject.put("currentIndex", this.maa);
            jSONObject.put("totalAdCount", this.lse);
        } catch (JSONException unused) {
        }
        this.wsy.ro(this.fm).fm(this.f7475lb).fm(com.bytedance.sdk.openadsdk.core.vt.ro.lb.fm(this.f7475lb, true, jSONObject)).lb(this.f7475lb.eo()).yz(this.f7475lb.gt()).ro(i10).jnr(strUuz).fm(this.fm).ro(this.wu).fm(map).fm(new gqi(3, this.wu, this.f7475lb));
    }

    public void lb() {
        wu wuVar;
        if (!this.irt.get() || (wuVar = this.vt) == null) {
            return;
        }
        wuVar.lb(false);
    }

    public void fm(boolean z10, com.bytedance.sdk.openadsdk.dsz.wsy wsyVar) {
        this.ku = wsyVar;
        this.vt.ro(z10);
        com.bytedance.sdk.openadsdk.core.fhx.lb.fm.fm().ro(this.f7475lb);
        this.fm.a_(this.f7474ef);
        wu wuVar = this.vt;
        if (wuVar != null) {
            wuVar.ajl(com.bytedance.sdk.openadsdk.core.fhx.lb.fm.fm().fm(this.f7475lb));
            this.vt.wu(this.f7474ef);
        }
    }

    public void fm() {
        vt vtVar;
        final boolean z10 = true;
        if (this.irt.getAndSet(true)) {
            return;
        }
        FrameLayout frameLayout = this.jnr;
        if (frameLayout != null) {
            frameLayout.setVisibility(0);
        }
        if (!this.onz && (vtVar = this.ajl) != null) {
            vtVar.ro(this.f7475lb, this.yz);
            wu wuVar = this.vt;
            if (wuVar != null) {
                wuVar.ol();
            }
        } else {
            this.vt.lb(true);
            hxv hxvVar = this.wsy;
            if (hxvVar != null && hxvVar.onz() != null) {
                this.wsy.onz().jnr();
            }
            InterfaceC0099fm interfaceC0099fm = this.nt;
            if (interfaceC0099fm != null) {
                interfaceC0099fm.fm(this.fhx);
            }
            z10 = false;
        }
        if (this.vt != null) {
            com.bytedance.sdk.openadsdk.yz.lb.fm(System.currentTimeMillis(), this.f7475lb, this.wu, "playable_track", new com.bytedance.sdk.openadsdk.irt.ro.fm() { // from class: com.bytedance.sdk.openadsdk.maa.fm.fm.7
                @Override // com.bytedance.sdk.openadsdk.irt.ro.fm, com.bytedance.sdk.openadsdk.irt.ro.ro
                public JSONObject fm() {
                    try {
                        JSONObject jSONObject = new JSONObject();
                        jSONObject.put("webview_state", fm.this.vt.bx());
                        jSONObject.put("has_loading", z10);
                        jSONObject.put("is_new_playable", 1);
                        return jSONObject;
                    } catch (Throwable unused) {
                        return null;
                    }
                }

                @Override // com.bytedance.sdk.openadsdk.irt.ro.fm, com.bytedance.sdk.openadsdk.irt.ro.ro
                public JSONObject lb() {
                    JSONObject jSONObject = new JSONObject();
                    try {
                        jSONObject.put("playable_event", "start_show_plb");
                    } catch (Throwable unused) {
                    }
                    return jSONObject;
                }
            });
            this.vt.ajl(com.bytedance.sdk.openadsdk.core.fhx.lb.fm.fm().fm(this.f7475lb));
        }
        com.bytedance.sdk.component.ef.wsy wsyVar = this.fm;
        if (wsyVar != null) {
            wsyVar.setVisibility(0);
        } else {
            com.bytedance.sdk.openadsdk.irt.yz.fm("plb_npe_crash", false, new com.bytedance.sdk.openadsdk.irt.ro() { // from class: com.bytedance.sdk.openadsdk.maa.fm.fm.8
                @Override // com.bytedance.sdk.openadsdk.irt.ro
                public com.bytedance.sdk.openadsdk.irt.fm.lb fm() throws Exception {
                    JSONObject jSONObject = new JSONObject();
                    jSONObject.put("crash_ts", System.currentTimeMillis());
                    if (fm.this.hi != null) {
                        jSONObject.put("destroy_stack_trace", fm.this.hi.toString());
                    }
                    jSONObject.put("destroy_ts", fm.this.hlt);
                    return com.bytedance.sdk.openadsdk.irt.fm.yz.ro().fm("plb_npe_crash").ro(jSONObject.toString());
                }
            });
        }
    }

    public void fm(final int i10, final int i11) {
        InterfaceC0099fm interfaceC0099fm;
        wu wuVar;
        ro roVar;
        if (this.onz) {
            return;
        }
        this.onz = true;
        this.fhx = i10;
        if (i10 == 2) {
            this.dsz = true;
            this.vt.fm(3);
        } else if (i10 == 1) {
            this.dsz = true;
            this.vt.fm(2);
        } else if (i10 == 3) {
            this.dsz = true;
            this.vt.fm(4);
        } else if (i10 == 0) {
            this.vt.fm(1);
        }
        if (this.dsz && (roVar = this.wey) != null) {
            roVar.fm();
        }
        if (this.irt.get() && (wuVar = this.vt) != null) {
            wuVar.lb(true);
        }
        hxv hxvVar = this.wsy;
        if (hxvVar != null && hxvVar.onz() != null) {
            this.wsy.onz().jnr();
        }
        if (!this.dsz && (interfaceC0099fm = this.nt) != null) {
            interfaceC0099fm.fm(i10);
        }
        vt vtVar = this.ajl;
        if (vtVar != null) {
            vtVar.post(new Runnable() { // from class: com.bytedance.sdk.openadsdk.maa.fm.fm.9
                @Override // java.lang.Runnable
                public void run() {
                    if (fm.this.dsz) {
                        fm.this.gof.setVisibility(0);
                        if (fm.this.nt != null) {
                            fm.this.nt.fm(i10);
                        }
                        fm.this.fm(true);
                    }
                    fm.this.vt.wsy(fm.this.dsz);
                    fm.this.ajl.lb();
                    if (fm.this.irt.get()) {
                        com.bytedance.sdk.openadsdk.yz.lb.fm(System.currentTimeMillis(), fm.this.f7475lb, fm.this.wu, "playable_track", new com.bytedance.sdk.openadsdk.irt.ro.fm() { // from class: com.bytedance.sdk.openadsdk.maa.fm.fm.9.1
                            @Override // com.bytedance.sdk.openadsdk.irt.ro.fm, com.bytedance.sdk.openadsdk.irt.ro.ro
                            public JSONObject fm() {
                                try {
                                    JSONObject jSONObject = new JSONObject();
                                    jSONObject.put("remove_loading_page_type", i10);
                                    jSONObject.put("remove_loading_page_reason", i11);
                                    jSONObject.put("playable_url", fm.this.f7474ef);
                                    jSONObject.put("duration", fm.this.ajl.getDisplayDuration());
                                    jSONObject.put("is_new_playable", 1);
                                    return jSONObject;
                                } catch (Throwable unused) {
                                    return null;
                                }
                            }

                            @Override // com.bytedance.sdk.openadsdk.irt.ro.fm, com.bytedance.sdk.openadsdk.irt.ro.ro
                            public JSONObject lb() {
                                JSONObject jSONObject = new JSONObject();
                                try {
                                    jSONObject.put("playable_event", "remove_loading_page");
                                } catch (Throwable unused) {
                                }
                                return jSONObject;
                            }
                        });
                    }
                }
            });
        }
    }

    public void fm(boolean z10) {
        wu wuVar = this.vt;
        if (wuVar != null) {
            wuVar.fm(z10);
        }
    }

    public void fm(com.bytedance.sdk.openadsdk.core.lb.fm fmVar) {
        this.gqi = fmVar;
        vt vtVar = this.ajl;
        if (vtVar != null && vtVar.getDownloadButton() != null) {
            com.bytedance.sdk.openadsdk.core.ajl.wu downloadButton = this.ajl.getDownloadButton();
            downloadButton.setOnClickListener(fmVar);
            downloadButton.setOnTouchListener(fmVar);
        }
        ef efVar = this.gof;
        if (efVar != null) {
            efVar.setClickListener(fmVar);
        }
    }

    public void fm(com.bytedance.sdk.openadsdk.core.fhx.yz.ro roVar) {
        hxv hxvVar = this.wsy;
        if (hxvVar != null) {
            hxvVar.fm(roVar);
        }
    }
}
