package com.bytedance.sdk.openadsdk.core.dsz.ajl;

import android.content.Context;
import android.text.TextUtils;
import com.bytedance.sdk.component.utils.gof;
import com.bytedance.sdk.component.utils.wey;
import com.bytedance.sdk.openadsdk.core.gqi;
import com.bytedance.sdk.openadsdk.core.model.lse;
import com.bytedance.sdk.openadsdk.utils.bx;
import java.util.Map;
import org.json.JSONObject;
import tv.danmaku.ijk.media.player.IjkMediaPlayer;

/* JADX INFO: loaded from: classes2.dex */
public class ajl {
    private final String fm = "UGenV3OpenLinks";
    private final String ro = "landingStyle";

    /* JADX INFO: renamed from: lb, reason: collision with root package name */
    private final String f7021lb = IjkMediaPlayer.OnNativeInvokeListener.ARG_URL;
    private final String yz = "fallbackUrl";

    public void fm(Context context, boolean z10, lse lseVar, String str, Map<String, Object> map, com.bytedance.sdk.openadsdk.core.widget.jnr jnrVar) {
        int i10;
        if (map == null || map.isEmpty()) {
            return;
        }
        try {
            Object obj = map.get("landingStyle");
            Object obj2 = map.get(IjkMediaPlayer.OnNativeInvokeListener.ARG_URL);
            Object obj3 = map.get("fallbackUrl");
            if (obj != null) {
                try {
                    i10 = Integer.parseInt(String.valueOf(obj));
                } catch (Throwable unused) {
                    i10 = -1;
                }
            } else {
                i10 = -1;
            }
            if (fm(i10, obj2 != null ? String.valueOf(obj2) : null, obj3 != null ? String.valueOf(obj3) : null)) {
                gqi.fm(context, z10, fm(map), lseVar, str, bx.fm(str), null, jnrVar);
            }
        } catch (Throwable th) {
            wey.lb("UGenV3OpenLinks", th.getMessage());
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:17:0x001f  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    private boolean fm(int i10, String str, String str2) {
        if (i10 == 1) {
            if (!gof.fm(str)) {
                return false;
            }
        } else if (i10 != 2) {
            if (i10 == 3) {
            }
        } else if ((TextUtils.isEmpty(str) && TextUtils.isEmpty(str2)) || !gof.fm(str2)) {
            return false;
        }
        return true;
    }

    private JSONObject fm(Map<String, Object> map) {
        JSONObject jSONObject = new JSONObject();
        if (map != null) {
            try {
                for (Map.Entry<String, Object> entry : map.entrySet()) {
                    Object value = entry.getValue();
                    if (value != null) {
                        jSONObject.put(entry.getKey(), String.valueOf(value));
                    }
                }
            } catch (Exception unused) {
            }
        }
        return jSONObject;
    }
}
