MyRecorder v1.01.90.0219版本的 MD5 值为:c361f51174a0bf833abfa72929caf8d3

以下内容为反编译后的 b.java 源代码,内容仅作参考


package com.bytedance.sdk.openadsdk.core;

import android.os.Build;
import android.text.TextUtils;
import android.util.Pair;
import com.applovin.sdk.AppLovinErrorCodes;
import com.bytedance.sdk.openadsdk.AdSlot;
import com.bytedance.sdk.openadsdk.FilterWord;
import com.bytedance.sdk.openadsdk.TTAdConstant;
import com.bytedance.sdk.openadsdk.core.h.a.b;
import com.bytedance.sdk.openadsdk.core.model.q;
import com.bytedance.sdk.openadsdk.utils.ac;
import com.bytedance.sdk.openadsdk.utils.ad;
import com.facebook.gamingservices.cloudgaming.internal.SDKAnalyticsEvents;
import com.facebook.gamingservices.cloudgaming.internal.SDKConstants;
import com.facebook.internal.NativeProtocol;
import com.facebook.share.internal.ShareConstants;
import com.fyber.inneractive.sdk.activities.InneractiveRichMediaVideoPlayerActivityCore;
import com.google.firebase.remoteconfig.FirebaseRemoteConfig;
import com.smaato.sdk.core.mvvm.model.imagead.ImageAdResponseParser;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import net.pubnative.lite.sdk.analytics.Reporting;
import net.pubnative.lite.sdk.models.APIAsset;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class b {
    private static int a(com.bykv.vk.openvk.component.video.api.c.b bVar, boolean z7) {
        if (bVar == null) {
            return TTAdConstant.VIDEO_INFO_CODE;
        }
        if (TextUtils.isEmpty(bVar.k())) {
            return TTAdConstant.VIDEO_URL_CODE;
        }
        if (z7 || !TextUtils.isEmpty(bVar.j())) {
            return 200;
        }
        return TTAdConstant.VIDEO_COVER_URL_CODE;
    }

    private static int a(com.bytedance.sdk.openadsdk.core.model.c cVar) {
        return cVar == null ? TTAdConstant.DOWNLOAD_APP_INFO_CODE : TextUtils.isEmpty(cVar.a()) ? 408 : 200;
    }

    private static int a(com.bytedance.sdk.openadsdk.core.model.j jVar) {
        if (jVar == null) {
            return 200;
        }
        if (TextUtils.isEmpty(jVar.a())) {
            return 403;
        }
        if (TextUtils.isEmpty(jVar.b())) {
            return 404;
        }
        return (jVar.c() == 1 || jVar.c() == 2) ? 200 : 405;
    }

    private static int a(com.bytedance.sdk.openadsdk.core.model.q qVar) {
        int i10;
        if (qVar == null) {
            return 401;
        }
        if (TextUtils.isEmpty(qVar.Y()) || qVar.Y().length() <= 1) {
            return 402;
        }
        if (qVar.bf() == 0) {
            i10 = a(qVar.ab());
            if (i10 != 200) {
                return i10;
            }
        } else {
            i10 = 200;
        }
        if (qVar.aw()) {
            int aU = qVar.aU();
            if (aU < 0) {
                aU = qVar.D() != null ? qVar.D().getDurationSlotType() : qVar.aT();
            }
            String c10 = ac.c(aU);
            if (qVar.be()) {
                c10 = "fullscreen_interstitial_ad";
            }
            if (TextUtils.isEmpty(qVar.ax())) {
                com.bytedance.sdk.openadsdk.b.c.b(qVar, c10, "load_html_fail", (JSONObject) null);
                return 401;
            }
            com.bytedance.sdk.openadsdk.b.c.b(qVar, c10, "load_html_success", (JSONObject) null);
        }
        int M = qVar.M();
        if (M != 2 && M != 3) {
            if (M == 4) {
                i10 = a(qVar.aa());
                if (i10 != 200) {
                    return i10;
                }
            }
            if (!qVar.au()) {
                int ad2 = qVar.ad();
                if (ad2 != 2 && ad2 != 3 && ad2 != 4) {
                    if (ad2 != 5 && ad2 != 15) {
                        if (ad2 != 16) {
                        }
                    }
                    i10 = a(qVar.K(), qVar.au());
                    if (i10 != 200) {
                        return i10;
                    }
                }
                i10 = a(qVar.Q());
                if (i10 != 200) {
                }
            }
            return i10;
        }
        if (b(qVar) && TextUtils.isEmpty(qVar.P())) {
            return TTAdConstant.LANDING_PAGE_TYPE_CODE;
        }
        if (!qVar.au()) {
        }
        return i10;
    }

    private static int a(List<com.bytedance.sdk.openadsdk.core.model.n> list) {
        if (list == null) {
            return 409;
        }
        if (list.size() <= 0) {
            return 410;
        }
        for (com.bytedance.sdk.openadsdk.core.model.n nVar : list) {
            if (nVar == null) {
                return TTAdConstant.IMAGE_CODE;
            }
            if (TextUtils.isEmpty(nVar.a())) {
                return 412;
            }
        }
        return 200;
    }

    private static Pair<com.bytedance.sdk.openadsdk.core.h.a, b.a> a(String str, int i10, int i11) {
        int i12;
        if (TextUtils.isEmpty(str)) {
            return null;
        }
        int i13 = 0;
        if (i11 == 1 || i11 == 5) {
            i12 = 0;
        } else {
            i13 = ad.c(o.a());
            i12 = ad.d(o.a());
            if (i10 == 2) {
                i13 = i12;
                i12 = i13;
            }
        }
        com.bytedance.sdk.openadsdk.core.h.a.a.e eVar = new com.bytedance.sdk.openadsdk.core.h.a.a.e(o.a(), i13, i12);
        return new Pair<>(eVar.a(str, new ArrayList()), eVar.f15416f);
    }

    public static Pair<com.bytedance.sdk.openadsdk.core.model.a, ArrayList<Integer>> a(JSONObject jSONObject, AdSlot adSlot, com.bytedance.sdk.openadsdk.core.model.s sVar, com.bytedance.sdk.openadsdk.core.model.b bVar) {
        if (jSONObject == null) {
            return null;
        }
        try {
            com.bytedance.sdk.openadsdk.core.model.a aVar = new com.bytedance.sdk.openadsdk.core.model.a();
            aVar.a(jSONObject.optString(SDKAnalyticsEvents.PARAMETER_REQUEST_ID));
            aVar.a(jSONObject.optInt("ret"));
            aVar.b(jSONObject.optString("message"));
            String optString = jSONObject.optString("gdid_encrypted");
            if (jSONObject.has("choose_ui_data")) {
                aVar.a(jSONObject.optJSONObject("choose_ui_data"));
                aVar.a(true);
            }
            String optString2 = jSONObject.optString("auction_price");
            if (aVar.b() != 0) {
                return null;
            }
            JSONArray optJSONArray = jSONObject.optJSONArray("creatives");
            ArrayList arrayList = new ArrayList();
            int i10 = 0;
            if (optJSONArray != null) {
                int length = optJSONArray.length();
                while (i10 < optJSONArray.length()) {
                    com.bytedance.sdk.openadsdk.core.model.q a10 = a(optJSONArray.optJSONObject(i10), adSlot, sVar);
                    int a11 = a(a10);
                    if (a11 != 200) {
                        arrayList.add(Integer.valueOf(a11));
                    } else {
                        a10.i(optString2);
                        if (!TextUtils.isEmpty(optString)) {
                            a10.z(optString);
                        }
                        aVar.a(a10);
                    }
                    i10++;
                }
                i10 = length;
            }
            a(i10, aVar, arrayList, bVar);
            return new Pair<>(aVar, arrayList);
        } catch (Throwable th2) {
            com.bytedance.sdk.component.utils.l.e("AdInfoFactory", th2.getMessage());
            return null;
        }
    }

    private static com.bykv.vk.openvk.component.video.api.c.b a(JSONObject jSONObject, com.bytedance.sdk.openadsdk.core.model.q qVar, boolean z7) {
        if (jSONObject == null) {
            return null;
        }
        com.bykv.vk.openvk.component.video.api.c.b bVar = new com.bykv.vk.openvk.component.video.api.c.b();
        bVar.b(jSONObject.optInt("cover_height"));
        bVar.c(jSONObject.optInt("cover_width"));
        bVar.a(jSONObject.optString("resolution"));
        bVar.a(jSONObject.optLong("size"));
        double optDouble = jSONObject.optDouble("video_duration", FirebaseRemoteConfig.DEFAULT_VALUE_FOR_DOUBLE);
        bVar.a(optDouble);
        int i10 = 1;
        int optInt = jSONObject.optInt("replay_time", 1);
        if (optDouble <= 15.0d && qVar.u() != 1 && com.bytedance.sdk.openadsdk.core.model.q.e(qVar)) {
            i10 = optInt;
        }
        bVar.j(i10);
        bVar.b(jSONObject.optString("cover_url"));
        bVar.c(jSONObject.optString(InneractiveRichMediaVideoPlayerActivityCore.VIDEO_URL));
        bVar.d(jSONObject.optString("endcard"));
        bVar.e(jSONObject.optString("playable_download_url"));
        bVar.f(jSONObject.optString("file_hash"));
        bVar.h(jSONObject.optInt("if_playable_loading_show", 0));
        bVar.i(jSONObject.optInt("remove_loading_page_type", 0));
        bVar.a(jSONObject.optInt("fallback_endcard_judge", 0));
        bVar.e(jSONObject.optInt("video_preload_size", 307200));
        bVar.f(jSONObject.optInt("reward_video_cached_type", 0));
        bVar.g(jSONObject.optInt("execute_cached_type", 0));
        bVar.d(z7 ? jSONObject.optInt("endcard_render", 0) : jSONObject.optInt("endcard_render", -1));
        return bVar;
    }

    public static com.bytedance.sdk.openadsdk.core.model.q a(JSONObject jSONObject) {
        if (jSONObject == null) {
            return null;
        }
        return a(jSONObject, (AdSlot) null, (com.bytedance.sdk.openadsdk.core.model.s) null);
    }

    private static com.bytedance.sdk.openadsdk.core.model.q a(JSONObject jSONObject, AdSlot adSlot, com.bytedance.sdk.openadsdk.core.model.s sVar) {
        com.bykv.vk.openvk.component.video.api.c.b bVar;
        com.bykv.vk.openvk.component.video.api.c.b bVar2;
        com.bytedance.sdk.openadsdk.core.h.a aVar;
        b.a aVar2;
        JSONObject optJSONObject;
        if (jSONObject == null) {
            return null;
        }
        com.bytedance.sdk.openadsdk.core.model.q b10 = com.bytedance.sdk.openadsdk.core.model.q.b();
        b10.r(jSONObject.optInt("interaction_type"));
        b10.m(jSONObject.optString("target_url"));
        b10.r(jSONObject.optString("ad_id"));
        b10.s(jSONObject.optString("app_log_url"));
        b10.k(jSONObject.optString("source"));
        b10.l(jSONObject.optString(NativeProtocol.BRIDGE_ARG_APP_NAME_STRING));
        int i10 = 0;
        b10.v(jSONObject.optInt("dislike_control", 0));
        b10.m(jSONObject.optInt("play_bar_show_time", AppLovinErrorCodes.UNABLE_TO_PRECACHE_RESOURCES));
        b10.u(jSONObject.optString("gecko_id"));
        if (jSONObject.has("set_click_type")) {
            JSONObject optJSONObject2 = jSONObject.optJSONObject("set_click_type");
            b10.b(optJSONObject2.optDouble("cta", 2.0d));
            b10.a(optJSONObject2.optDouble("other", 1.0d));
        }
        b10.d(jSONObject.optJSONObject(ShareConstants.MEDIA_EXTENSION));
        JSONObject optJSONObject3 = jSONObject.optJSONObject(APIAsset.ICON);
        b10.d(jSONObject.optBoolean("screenshot", false));
        b10.k(jSONObject.optInt("play_bar_style", 0));
        b10.v(jSONObject.optString("market_url", ""));
        b10.i(jSONObject.optInt("video_adaptation", 0));
        b10.f(jSONObject.optInt("feed_video_opentype", 0));
        b10.b(jSONObject.optJSONObject("session_params"));
        b10.i(jSONObject.optString("auction_price", ""));
        b10.A(jSONObject.optInt("mrc_report", 0));
        if (jSONObject.optBoolean("isMrcReportFinish", false)) {
            b10.aB();
        }
        JSONObject optJSONObject4 = jSONObject.optJSONObject(Reporting.EventType.RENDER);
        if (optJSONObject4 != null) {
            b10.g(optJSONObject4.optInt("render_sequence", 0));
            b10.h(optJSONObject4.optInt("backup_render_control", 1));
            b10.B(optJSONObject4.optInt("reserve_time", 100));
            b10.C(optJSONObject4.optInt("render_thread", 0));
        }
        b10.d(jSONObject.optInt("render_control", sVar != null ? sVar.f15763f : 1));
        if (optJSONObject3 != null) {
            com.bytedance.sdk.openadsdk.core.model.n nVar = new com.bytedance.sdk.openadsdk.core.model.n();
            nVar.a(optJSONObject3.optString("url"));
            nVar.b(optJSONObject3.optInt("height"));
            nVar.a(optJSONObject3.optInt("width"));
            b10.a(nVar);
        }
        JSONObject optJSONObject5 = jSONObject.optJSONObject("reward_data");
        if (optJSONObject5 != null) {
            b10.c(optJSONObject5.optInt("reward_amount", 0));
            b10.g(optJSONObject5.optString("reward_name", ""));
        }
        JSONObject optJSONObject6 = jSONObject.optJSONObject("cover_image");
        if (optJSONObject6 != null) {
            com.bytedance.sdk.openadsdk.core.model.n nVar2 = new com.bytedance.sdk.openadsdk.core.model.n();
            nVar2.a(optJSONObject6.optString("url"));
            nVar2.b(optJSONObject6.optInt("height"));
            nVar2.a(optJSONObject6.optInt("width"));
            b10.b(nVar2);
        }
        JSONArray optJSONArray = jSONObject.optJSONArray("image");
        if (optJSONArray != null) {
            for (int i11 = 0; i11 < optJSONArray.length(); i11++) {
                com.bytedance.sdk.openadsdk.core.model.n nVar3 = new com.bytedance.sdk.openadsdk.core.model.n();
                JSONObject optJSONObject7 = optJSONArray.optJSONObject(i11);
                nVar3.a(optJSONObject7.optString("url"));
                nVar3.b(optJSONObject7.optInt("height"));
                nVar3.a(optJSONObject7.optInt("width"));
                nVar3.a(optJSONObject7.optBoolean("image_preview"));
                nVar3.b(optJSONObject7.optString("image_key"));
                b10.c(nVar3);
            }
        }
        JSONArray optJSONArray2 = jSONObject.optJSONArray("show_url");
        if (optJSONArray2 != null) {
            for (int i12 = 0; i12 < optJSONArray2.length(); i12++) {
                b10.S().add(optJSONArray2.optString(i12));
            }
        }
        JSONArray optJSONArray3 = jSONObject.optJSONArray("click_url");
        if (optJSONArray3 != null) {
            for (int i13 = 0; i13 < optJSONArray3.length(); i13++) {
                b10.T().add(optJSONArray3.optString(i13));
            }
        }
        JSONArray optJSONArray4 = jSONObject.optJSONArray("play_start");
        if (optJSONArray4 != null) {
            for (int i14 = 0; i14 < optJSONArray4.length(); i14++) {
                b10.U().add(optJSONArray4.optString(i14));
            }
        }
        JSONObject optJSONObject8 = jSONObject.optJSONObject("click_area");
        if (optJSONObject8 != null) {
            com.bytedance.sdk.openadsdk.core.model.h hVar = new com.bytedance.sdk.openadsdk.core.model.h();
            hVar.f15610a = optJSONObject8.optBoolean("click_upper_content_area", true);
            hVar.f15611b = optJSONObject8.optBoolean("click_upper_non_content_area", true);
            hVar.f15612c = optJSONObject8.optBoolean("click_lower_content_area", true);
            hVar.f15613d = optJSONObject8.optBoolean("click_lower_non_content_area", true);
            hVar.f15614e = optJSONObject8.optBoolean("click_button_area", true);
            hVar.f15615f = optJSONObject8.optBoolean("click_video_area", true);
            b10.a(hVar);
        }
        JSONObject optJSONObject9 = jSONObject.optJSONObject("adslot");
        if (optJSONObject9 != null) {
            b10.a(d(optJSONObject9));
        } else {
            b10.a(adSlot);
        }
        if (adSlot != null) {
            Map<String, Object> requestExtraMap = adSlot.getRequestExtraMap();
            if (requestExtraMap != null && requestExtraMap.containsKey("admob_watermark")) {
                b10.A(String.valueOf(requestExtraMap.get("admob_watermark")));
            }
        } else {
            b10.A(jSONObject.optString("identificationOverlayContent"));
        }
        b10.l(jSONObject.optInt("intercept_flag", 0));
        b10.n(jSONObject.optString("phone_num"));
        b10.o(jSONObject.optString("title"));
        b10.p(jSONObject.optString("description"));
        b10.q(jSONObject.optString("button_text"));
        b10.j(jSONObject.optInt("ad_logo", 1));
        b10.t(jSONObject.optString(ImageAdResponseParser.ResponseFields.EXT_KEY));
        b10.p(jSONObject.optInt("cover_click_area", 0));
        b10.s(jSONObject.optInt("image_mode"));
        b10.u(jSONObject.optInt("orientation", 1));
        b10.a((float) jSONObject.optDouble("aspect_ratio", 100.0d));
        b10.p(jSONObject.optInt("cover_click_area", 0));
        JSONObject optJSONObject10 = jSONObject.optJSONObject("app");
        JSONObject optJSONObject11 = jSONObject.optJSONObject("deep_link");
        b10.a(f(optJSONObject10));
        b10.a(g(jSONObject.optJSONObject("interaction_method_params")));
        b10.a(i(optJSONObject11));
        b10.a(new com.bytedance.sdk.openadsdk.core.model.t(jSONObject));
        JSONArray optJSONArray5 = jSONObject.optJSONArray("filter_words");
        if (optJSONArray5 != null) {
            for (int i15 = 0; i15 < optJSONArray5.length(); i15++) {
                FilterWord e10 = e(optJSONArray5.optJSONObject(i15));
                if (e10 != null && e10.isValid()) {
                    b10.a(e10);
                }
            }
        }
        b10.t(jSONObject.optInt("count_down"));
        b10.b(jSONObject.optLong("expiration_time"));
        b10.G(jSONObject.optInt("video_encode_type", 0));
        b10.F(0);
        JSONObject optJSONObject12 = jSONObject.optJSONObject("video");
        if (optJSONObject12 != null) {
            bVar = a(optJSONObject12, b10, true);
            b10.b(bVar);
        } else {
            bVar = null;
        }
        JSONObject optJSONObject13 = jSONObject.optJSONObject("h265_video");
        if (optJSONObject13 != null) {
            bVar2 = a(optJSONObject13, b10, false);
            b10.c(bVar2);
        } else {
            bVar2 = null;
        }
        if (Build.VERSION.SDK_INT < 26 || b10.aM() == 0) {
            b10.a(bVar);
            b10.G(0);
        } else {
            if (bVar2 != null && bVar != null) {
                if (TextUtils.isEmpty(bVar2.l())) {
                    bVar2.d(bVar.l());
                }
                if (TextUtils.isEmpty(bVar2.m())) {
                    bVar2.e(bVar.m());
                }
                if (bVar2.d() == -1) {
                    bVar2.d(bVar.d());
                }
            }
            if (bVar2 != null) {
                b10.a(bVar2);
            } else {
                b10.a(bVar);
            }
        }
        JSONObject optJSONObject14 = jSONObject.optJSONObject("download_conf");
        if (optJSONObject14 != null) {
            b10.a(h(optJSONObject14));
        }
        b10.a(j(jSONObject.optJSONObject("media_ext")));
        JSONObject optJSONObject15 = jSONObject.optJSONObject("tpl_info");
        if (optJSONObject15 != null) {
            q.a aVar3 = new q.a();
            aVar3.b(optJSONObject15.optString("id"));
            aVar3.c(optJSONObject15.optString("md5"));
            aVar3.d(optJSONObject15.optString("url"));
            aVar3.e(optJSONObject15.optString("data"));
            aVar3.f(optJSONObject15.optString("diff_data"));
            String optString = optJSONObject15.optString("dynamic_creative");
            aVar3.g(optString);
            aVar3.a(optJSONObject15.optString("version"));
            aVar3.h(optJSONObject15.optString("media_view"));
            try {
                ArrayList arrayList = new ArrayList();
                JSONArray optJSONArray6 = new JSONObject(optString).optJSONArray("tag_ids");
                if (optJSONArray6 != null) {
                    for (int i16 = 0; i16 < optJSONArray6.length(); i16++) {
                        arrayList.add(Integer.valueOf(optJSONArray6.optInt(i16)));
                    }
                }
                aVar3.a(arrayList);
            } catch (JSONException e11) {
                com.bytedance.sdk.component.utils.l.e("AdInfoFactory", e11.getMessage());
            }
            b10.a(aVar3);
        }
        b10.j(jSONObject.optString("creative_extra"));
        b10.e(jSONObject.optInt("if_block_lp", 0));
        b10.n(jSONObject.optInt("cache_sort", 1));
        b10.o(jSONObject.optInt("if_sp_cache", 0));
        JSONObject optJSONObject16 = jSONObject.optJSONObject("splash_control");
        if (optJSONObject16 != null) {
            b10.a(c(optJSONObject16));
        }
        b10.w(jSONObject.optInt("is_package_open", 1));
        b10.h(jSONObject.optString("ad_info", null));
        int i17 = 2;
        b10.q(jSONObject.optInt("ua_policy", 2));
        b10.x(jSONObject.optInt("playable_duration_time", 20));
        b10.y(jSONObject.optInt("playable_endcard_close_time", -1));
        b10.z(jSONObject.optInt("endcard_close_time", -1));
        b10.a(jSONObject.optInt("interaction_method"));
        b10.w(jSONObject.optString("dsp_html"));
        JSONObject optJSONObject17 = jSONObject.optJSONObject("loading_page");
        if (optJSONObject17 != null) {
            b10.D(optJSONObject17.optInt("loading_landingpage_type", 0));
            JSONArray optJSONArray7 = optJSONObject17.optJSONArray("landingpage_text");
            if (optJSONArray7 != null) {
                ArrayList arrayList2 = new ArrayList();
                for (int i18 = 0; i18 < optJSONArray7.length(); i18++) {
                    String optString2 = optJSONArray7.optString(i18);
                    if (!TextUtils.isEmpty(optString2)) {
                        arrayList2.add(optString2);
                    }
                }
                b10.a((String[]) arrayList2.toArray(new String[arrayList2.size()]));
            }
        }
        int optInt = jSONObject.optInt("dsp_material_type", 0);
        optInt = (optInt < 0 || optInt > 3) ? 0 : 0;
        if (optInt == 0) {
            if (jSONObject.optBoolean("is_vast", false)) {
                optInt = 1;
            }
        }
        i17 = optInt;
        b10.I(i17);
        if (i17 == 1 || i17 == 3) {
            int aU = b10.aU();
            if (aU < 0) {
                aU = b10.D() != null ? b10.D().getDurationSlotType() : b10.aT();
            }
            String c10 = ac.c(aU);
            if (jSONObject.has("vast_json")) {
                aVar = com.bytedance.sdk.openadsdk.core.h.a.a(jSONObject.optJSONObject("vast_json"));
            } else {
                String optString3 = jSONObject.optString("dsp_vast");
                if (TextUtils.isEmpty(optString3)) {
                    a(b10, c10);
                    return null;
                }
                long currentTimeMillis = System.currentTimeMillis();
                Pair<com.bytedance.sdk.openadsdk.core.h.a, b.a> a10 = a(optString3, b10.ak(), aU);
                if (a10 != null) {
                    aVar2 = (b.a) a10.second;
                    aVar = (com.bytedance.sdk.openadsdk.core.h.a) a10.first;
                } else {
                    aVar = null;
                    aVar2 = null;
                }
                a(b10, c10, aVar, currentTimeMillis, aVar2);
            }
            if (aVar != null) {
                aVar.f(c10);
            }
            if (aVar == null) {
                return null;
            }
            a(aVar, b10);
        }
        b10.x(jSONObject.optString("deep_link_appname", ""));
        b10.H(jSONObject.optInt("landing_page_download_clicktype", 1));
        JSONObject optJSONObject18 = jSONObject.optJSONObject("dsp_style");
        if (optJSONObject18 != null) {
            b10.a(new com.bytedance.sdk.openadsdk.core.model.l(optJSONObject18));
        }
        JSONObject optJSONObject19 = jSONObject.optJSONObject("dsp_adchoices");
        if (optJSONObject19 != null) {
            b10.e(optJSONObject19.optString("adchoices_icon", ""));
            b10.f(optJSONObject19.optString("adchoices_url", ""));
        }
        String optString4 = jSONObject.optString("gdid_encrypted");
        if (!TextUtils.isEmpty(optString4)) {
            b10.z(optString4);
        }
        int optInt2 = jSONObject.optInt("jump_probability", 0);
        if (optInt2 >= 0 && optInt2 <= 100) {
            i10 = optInt2;
        }
        b10.J(i10);
        b10.bu();
        JSONObject optJSONObject20 = jSONObject.optJSONObject("ugen");
        if (optJSONObject20 != null && (optJSONObject = optJSONObject20.optJSONObject("endcard")) != null) {
            b10.a(b(optJSONObject));
        }
        return b10;
    }

    private static void a(int i10, final com.bytedance.sdk.openadsdk.core.model.a aVar, final ArrayList<Integer> arrayList, final com.bytedance.sdk.openadsdk.core.model.b bVar) {
        if (aVar == null || i10 < 2) {
            return;
        }
        final int size = i10 - (aVar.c() != null ? aVar.c().size() : 0);
        final boolean z7 = aVar.g() && aVar.h() == null;
        if (size > 0 || z7) {
            com.bytedance.sdk.openadsdk.j.b.a();
            com.bytedance.sdk.openadsdk.j.b.a("choose_ad_parsing_error", false, new com.bytedance.sdk.openadsdk.j.a() {
                @Override
                public com.bytedance.sdk.openadsdk.j.a.b getLogStats() throws Exception {
                    JSONObject jSONObject = new JSONObject();
                    jSONObject.put("req_id", com.bytedance.sdk.openadsdk.core.model.a.this.a());
                    jSONObject.put("material_error", size);
                    jSONObject.put("choose_ui_error", z7 ? 1 : 0);
                    ArrayList arrayList2 = arrayList;
                    if (arrayList2 != null && !arrayList2.isEmpty()) {
                        jSONObject.put("mate_unavailable_code_list", new JSONArray((Collection) arrayList).toString());
                    }
                    com.bytedance.sdk.openadsdk.core.model.b bVar2 = bVar;
                    if (bVar2 != null) {
                        jSONObject.put("server_res_str", bVar2.a());
                    }
                    return com.bytedance.sdk.openadsdk.j.a.c.b().a("choose_ad_parsing_error").b(jSONObject.toString());
                }
            });
        }
    }

    private static void a(com.bytedance.sdk.openadsdk.core.h.a aVar, com.bytedance.sdk.openadsdk.core.model.q qVar) {
        aVar.a(qVar);
        if (!a(qVar.M())) {
            qVar.r(2);
        }
        qVar.d(1);
        qVar.a(aVar);
        if (!TextUtils.isEmpty(aVar.d())) {
            qVar.o(aVar.d());
        }
        if (!TextUtils.isEmpty(aVar.e())) {
            qVar.p(aVar.e());
        }
        qVar.m(aVar.f());
        qVar.a((com.bytedance.sdk.openadsdk.core.model.c) null);
        com.bykv.vk.openvk.component.video.api.c.b K = qVar.K();
        if (K == null) {
            K = new com.bykv.vk.openvk.component.video.api.c.b();
        }
        K.c(aVar.g());
        K.a(aVar.h());
        K.f((String) null);
        K.b((String) null);
        K.d((String) null);
        qVar.a(K);
        if (aVar.b() != null && !TextUtils.isEmpty(aVar.b().e())) {
            com.bytedance.sdk.openadsdk.core.model.n nVar = new com.bytedance.sdk.openadsdk.core.model.n();
            nVar.a(aVar.b().e());
            nVar.a(aVar.b().b());
            nVar.b(aVar.b().c());
            qVar.a(nVar);
        } else if (qVar.N() == null) {
            com.bytedance.sdk.openadsdk.core.model.n nVar2 = new com.bytedance.sdk.openadsdk.core.model.n();
            nVar2.a("https://sf16-fe-tos-sg.i18n-pglstatp.com/obj/ad-pattern-sg/static/images/2023620white.jpeg");
            nVar2.a(98);
            nVar2.b(98);
            qVar.a(nVar2);
        }
    }

    private static void a(com.bytedance.sdk.openadsdk.core.model.q qVar, String str) {
        try {
            JSONObject jSONObject = new JSONObject();
            jSONObject.put("reason_code", -1);
            jSONObject.put("error_code", -1);
            com.bytedance.sdk.openadsdk.b.c.b(qVar, str, "load_vast_fail", jSONObject);
        } catch (Exception unused) {
        }
    }

    private static void a(final com.bytedance.sdk.openadsdk.core.model.q qVar, final String str, final com.bytedance.sdk.openadsdk.core.h.a aVar, final long j10, final b.a aVar2) {
        com.bytedance.sdk.openadsdk.b.c.a(new com.bytedance.sdk.component.g.h("vast_parser") {
            @Override
            public void run() {
                try {
                    JSONObject jSONObject = new JSONObject();
                    com.bytedance.sdk.openadsdk.core.h.a aVar3 = aVar;
                    String str2 = "load_vast_fail";
                    if (aVar3 != null) {
                        if (!TextUtils.isEmpty(aVar3.i()) && !TextUtils.isEmpty(aVar.f()) && aVar.h() > FirebaseRemoteConfig.DEFAULT_VALUE_FOR_DOUBLE) {
                            jSONObject.put("duration", System.currentTimeMillis() - j10);
                            b.a aVar4 = aVar2;
                            if (aVar4 != null) {
                                jSONObject.put("wrapper_count", aVar4.f15418b);
                                jSONObject.put("impression_links_null", aVar2.f15419c);
                            }
                            str2 = "load_vast_success";
                        }
                        jSONObject.put("reason_code", -3);
                        jSONObject.put("error_code", -3);
                    } else {
                        jSONObject.put("reason_code", -2);
                        b.a aVar5 = aVar2;
                        if (aVar5 != null) {
                            jSONObject.put("error_code", aVar5.f15417a);
                        }
                    }
                    com.bytedance.sdk.openadsdk.b.c.b(qVar, str, str2, jSONObject);
                    com.bytedance.sdk.openadsdk.core.h.a aVar6 = aVar;
                    if (aVar6 == null || aVar6.b() == null || !TextUtils.isEmpty(aVar.b().f())) {
                        return;
                    }
                    JSONObject jSONObject2 = new JSONObject();
                    try {
                        jSONObject2.put("error_code", 1000);
                        jSONObject2.put("description", "1000:Image url is null");
                    } catch (Throwable unused) {
                    }
                    com.bytedance.sdk.openadsdk.b.c.b(qVar, str, "load_vast_icon_fail", jSONObject2);
                    aVar.a((com.bytedance.sdk.openadsdk.core.h.b) null);
                } catch (Exception unused2) {
                }
            }
        });
    }

    private static boolean a(int i10) {
        return i10 == 2 || i10 == 3 || i10 == 8;
    }

    private static com.bytedance.sdk.openadsdk.core.g.e.a b(JSONObject jSONObject) {
        com.bytedance.sdk.openadsdk.core.g.e.a aVar = new com.bytedance.sdk.openadsdk.core.g.e.a();
        aVar.a(jSONObject.optString("id"));
        aVar.b(jSONObject.optString("md5"));
        aVar.c(jSONObject.optString("url"));
        return aVar;
    }

    private static boolean b(com.bytedance.sdk.openadsdk.core.model.q qVar) {
        return (qVar.au() || qVar.aw()) ? false : true;
    }

    private static com.bytedance.sdk.openadsdk.core.model.d c(JSONObject jSONObject) {
        if (jSONObject == null) {
            return null;
        }
        int optInt = jSONObject.optInt("splash_clickarea", 2);
        int optInt2 = jSONObject.optInt("splash_layout_id", 1);
        long optLong = jSONObject.optLong("load_wait_time", 0L);
        long j10 = optLong >= 0 ? optLong : 0L;
        com.bytedance.sdk.openadsdk.core.model.d dVar = new com.bytedance.sdk.openadsdk.core.model.d();
        dVar.a(optInt);
        dVar.b(optInt2);
        dVar.a(j10);
        return dVar;
    }

    private static AdSlot d(JSONObject jSONObject) {
        if (jSONObject == null) {
            return null;
        }
        String optString = jSONObject.optString("mCodeId", "");
        int optInt = jSONObject.optInt("mImgAcceptedWidth", 0);
        int optInt2 = jSONObject.optInt("mImgAcceptedHeight", 0);
        int optInt3 = jSONObject.optInt("mAdCount", 6);
        boolean optBoolean = jSONObject.optBoolean("mSupportDeepLink", true);
        String optString2 = jSONObject.optString("mRewardName", "");
        int optInt4 = jSONObject.optInt("mRewardAmount", 0);
        String optString3 = jSONObject.optString("mMediaExtra", "");
        String optString4 = jSONObject.optString("mUserID", "");
        jSONObject.optInt("mOrientation", 2);
        int optInt5 = jSONObject.optInt("mNativeAdType", 0);
        boolean optBoolean2 = jSONObject.optBoolean("mIsAutoPlay", false);
        boolean optBoolean3 = jSONObject.optBoolean("mIsExpressAd", false);
        String optString5 = jSONObject.optString("mBidAdm", "");
        return new AdSlot.Builder().setCodeId(optString).setImageAcceptedSize(optInt, optInt2).setExpressViewAcceptedSize((float) jSONObject.optDouble("mExpressViewAcceptedWidth", FirebaseRemoteConfig.DEFAULT_VALUE_FOR_DOUBLE), (float) jSONObject.optDouble("mExpressViewAcceptedHeight", FirebaseRemoteConfig.DEFAULT_VALUE_FOR_DOUBLE)).setAdCount(optInt3).setSupportDeepLink(optBoolean).setRewardName(optString2).setRewardAmount(optInt4).setMediaExtra(optString3).setUserID(optString4).setNativeAdType(optInt5).setIsAutoPlay(optBoolean2).isExpressAd(optBoolean3).withBid(optString5).setDurationSlotType(jSONObject.optInt("mDurationSlotType", 0)).build();
    }

    private static FilterWord e(JSONObject jSONObject) {
        if (jSONObject == null) {
            return null;
        }
        try {
            FilterWord filterWord = new FilterWord();
            filterWord.setId(jSONObject.optString("id"));
            filterWord.setName(jSONObject.optString("name"));
            filterWord.setIsSelected(jSONObject.optBoolean("is_selected"));
            JSONArray optJSONArray = jSONObject.optJSONArray(SDKConstants.PARAM_GAME_REQUESTS_OPTIONS);
            if (optJSONArray != null && optJSONArray.length() > 0) {
                for (int i10 = 0; i10 < optJSONArray.length(); i10++) {
                    FilterWord e10 = e(optJSONArray.optJSONObject(i10));
                    if (e10 != null && e10.isValid()) {
                        filterWord.addOption(e10);
                    }
                }
            }
            return filterWord;
        } catch (Throwable unused) {
            return null;
        }
    }

    private static com.bytedance.sdk.openadsdk.core.model.c f(JSONObject jSONObject) {
        if (jSONObject == null) {
            return null;
        }
        com.bytedance.sdk.openadsdk.core.model.c cVar = new com.bytedance.sdk.openadsdk.core.model.c();
        cVar.b(jSONObject.optString(NativeProtocol.BRIDGE_ARG_APP_NAME_STRING));
        cVar.c(jSONObject.optString("package_name"));
        cVar.a(jSONObject.optString("download_url"));
        cVar.a(jSONObject.optDouble("score", -1.0d));
        cVar.a(jSONObject.optInt("comment_num", -1));
        cVar.b(jSONObject.optInt("app_size", 0));
        cVar.d(jSONObject.optString("app_category"));
        return cVar;
    }

    private static com.bytedance.sdk.openadsdk.core.model.p g(JSONObject jSONObject) {
        com.bytedance.sdk.openadsdk.core.model.p pVar = new com.bytedance.sdk.openadsdk.core.model.p();
        if (jSONObject == null) {
            pVar.a(10L);
            pVar.b(20L);
            pVar.a("");
            return pVar;
        }
        pVar.a(jSONObject.optLong("onlylp_loading_maxtime", 10L));
        pVar.b(jSONObject.optLong("straight_lp_showtime", 20L));
        pVar.a(jSONObject.optString("loading_text", ""));
        return pVar;
    }

    private static com.bytedance.sdk.openadsdk.core.model.k h(JSONObject jSONObject) {
        if (jSONObject == null) {
            return null;
        }
        com.bytedance.sdk.openadsdk.core.model.k kVar = new com.bytedance.sdk.openadsdk.core.model.k();
        kVar.a(jSONObject.optInt("if_send_click", 0));
        return kVar;
    }

    private static com.bytedance.sdk.openadsdk.core.model.j i(JSONObject jSONObject) {
        if (jSONObject == null) {
            return null;
        }
        com.bytedance.sdk.openadsdk.core.model.j jVar = new com.bytedance.sdk.openadsdk.core.model.j();
        jVar.a(jSONObject.optString("deeplink_url"));
        jVar.b(jSONObject.optString("fallback_url"));
        jVar.a(jSONObject.optInt("fallback_type"));
        return jVar;
    }

    private static Map<String, Object> j(JSONObject jSONObject) {
        if (jSONObject == null) {
            return null;
        }
        HashMap hashMap = new HashMap();
        Iterator<String> keys = jSONObject.keys();
        while (keys.hasNext()) {
            String next = keys.next();
            if (!TextUtils.isEmpty(next)) {
                hashMap.put(next, jSONObject.opt(next));
            }
        }
        return hashMap;
    }
}