package com.bytedance.hybrid.spark;

import X.2HN;
import X.2ZF;
import X.By2;
import X.C0685KDk;
import X.C1187KWs;
import X.C1208KXn;
import X.C1353KbI;
import X.C1575Kes;
import X.C1579Kew;
import X.C1582Kez;
import X.C1587Kf4;
import X.C1623Kfe;
import X.C1624Kff;
import X.C1627Kfi;
import X.C1628Kfj;
import X.C1629Kfk;
import X.C1630Kfl;
import X.C1637Kfs;
import X.C1641Kfw;
import X.C1642Kfx;
import X.C1643Kfy;
import X.C1663KgI;
import X.C1692Kgl;
import X.Hjs;
import X.HtZ;
import X.JvF;
import X.KLC;
import X.KLF;
import X.M12;
import android.net.Uri;
import android.os.Parcel;
import android.os.Parcelable;
import com.bytedance.covode.number.Covode;
import com.bytedance.frameworks.apm.trace.MethodCollector;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.Map;
import kotlin.h.b.n;
import kotlin.o.z;

public class SparkContext extends C1208KXn implements Parcelable {
    public static final Parcelable.Creator<SparkContext> CREATOR = new C1637Kfs();
    public static final Map<String, C1208KXn> LIZLLL = new LinkedHashMap();
    public static final C0685KDk LJ = new C0685KDk((byte) 0);
    public String LIZ;
    public Map<String, String> LIZIZ;
    public C1187KWs LIZJ;
    public int LJIILIIL;
    public C1628Kfj LJIILJJIL;
    public boolean LJIILL;

    public int describeContents() {
        return 0;
    }

    public final SparkContext LIZ(String str) {
        M12.LIZ((Object) str);
        this.LIZ = str;
        this.LJIILL = false;
        return this;
    }

    public final SparkContext LIZ(String str, String str2) {
        M12.LIZ((Object) str, (Object) str2);
        this.LIZIZ.put(str, str2);
        return this;
    }

    public final SparkContext LIZ(String str, int i) {
        M12.LIZ((Object) str);
        this.LIZIZ.put(str, String.valueOf(i));
        return this;
    }

    public final SparkContext LIZ(String str, double d) {
        M12.LIZ((Object) str);
        this.LIZIZ.put(str, String.valueOf(d));
        return this;
    }

    public final SparkContext LIZ(String str, boolean z) {
        M12.LIZ((Object) str);
        this.LIZIZ.put(str, z ? "1" : "0");
        return this;
    }

    public final SparkContext LIZ(Map<String, ? extends Object> map) {
        M12.LIZ((Object) map);
        this.LIZJ.putAll(map);
        return this;
    }

    public final SparkContext LIZ(String str, Object obj) {
        M12.LIZ((Object) str, obj);
        this.LIZJ.put(str, obj);
        return this;
    }

    public final void LIZ(HtZ htZ) {
        M12.LIZ((Object) htZ);
        LIZ(HtZ.class, htZ);
    }

    private final void LIZIZ(int i) {
        boolean z;
        KLF klf;
        C1628Kfj kfj;
        boolean z2;
        boolean z3;
        boolean z4;
        boolean z5;
        KLF klf2;
        Integer valueOf;
        Integer valueOf2;
        Integer valueOf3;
        String str;
        KLF klf3;
        KLF klf4;
        SparkContext sparkContext = this;
        if (sparkContext.LIZ.length() > 0) {
            int i2 = i;
            if (i2 == 1) {
                String str2 = sparkContext.LIZ;
                Map<String, String> map = sparkContext.LIZIZ;
                String str3 = sparkContext.LJFF;
                M12.LIZ((Object) str2, (Object) str3);
                Uri LIZ2 = By2.LIZ(str2);
                Map LIZ3 = 2ZF.LIZ(LIZ2, map);
                C1642Kfx kfx = new C1642Kfx((KLF) null, 1, (2HN) null);
                2ZF.LIZ(str3, LIZ3);
                M12.LIZ(LIZ2, LIZ3, kfx);
                C1629Kfk.LIZ(LIZ2, LIZ3, kfx);
                Object obj = LIZ3.get("show_close_all");
                if (obj != null) {
                    kfx.setShowCloseAll(n.LIZ(obj, "1"));
                }
                Object obj2 = LIZ3.get("should_full_screen");
                if (obj2 != null) {
                    kfx.setTransStatusBar(n.LIZ(obj2, "1"));
                }
                String str4 = (String) LIZ3.get("status_bar_color");
                if (str4 != null) {
                    kfx.setStatusBarBgColor(C1630Kfl.LIZJ("status_bar_color", str4, LIZ3, LIZ2));
                }
                Object obj3 = LIZ3.get("show_loading");
                if (obj3 != null) {
                    kfx.setHideLoading(n.LIZ(obj3, "0"));
                }
                String str5 = (String) LIZ3.get("__use_ttnet");
                if (str5 != null) {
                    kfx.set_useTtnet(C1630Kfl.LIZ("__use_ttnet", str5, LIZ3, LIZ2, false));
                }
                String str6 = (String) LIZ3.get("accessKey");
                if (str6 != null) {
                    C1630Kfl.LIZIZ("accessKey", str6, LIZ3, LIZ2);
                    kfx.setAccessKey(str6);
                }
                String str7 = (String) LIZ3.get("append_common_params");
                if (str7 != null) {
                    kfx.setAppendCommonParams(C1630Kfl.LIZ("append_common_params", str7, LIZ3, LIZ2));
                }
                String str8 = (String) LIZ3.get("auto_play_bgm");
                if (str8 != null) {
                    kfx.setAutoPlayBgm(C1630Kfl.LIZ("auto_play_bgm", str8, LIZ3, LIZ2, false));
                }
                String str9 = (String) LIZ3.get("bid");
                if (str9 != null) {
                    C1630Kfl.LIZIZ("bid", str9, LIZ3, LIZ2);
                    kfx.setBid(str9);
                }
                String str10 = (String) LIZ3.get("block_back_press");
                if (str10 != null) {
                    kfx.setBlockBackPress(C1630Kfl.LIZ("block_back_press", str10, LIZ3, LIZ2));
                }
                String str11 = (String) LIZ3.get("bundle");
                if (str11 != null) {
                    C1630Kfl.LIZIZ("bundle", str11, LIZ3, LIZ2);
                    kfx.setBundle(str11);
                }
                String str12 = (String) LIZ3.get("channel");
                if (str12 != null) {
                    C1630Kfl.LIZIZ("channel", str12, LIZ3, LIZ2);
                    kfx.setChannel(str12);
                }
                String str13 = (String) LIZ3.get("container_bg_color");
                if (str13 != null) {
                    kfx.setContainerBgColor(C1630Kfl.LJ("container_bg_color", str13, LIZ3, LIZ2));
                }
                String str14 = (String) LIZ3.get("disable_back_press");
                if (str14 != null) {
                    kfx.setDisableBackPress(C1630Kfl.LIZ("disable_back_press", str14, LIZ3, LIZ2));
                }
                String str15 = (String) LIZ3.get("disable_builtin");
                if (str15 != null) {
                    kfx.setDisableBuiltin(C1630Kfl.LIZ("disable_builtin", str15, LIZ3, LIZ2));
                }
                String str16 = (String) LIZ3.get("disable_cdn");
                if (str16 != null) {
                    kfx.setDisableCDN(C1630Kfl.LIZ("disable_cdn", str16, LIZ3, LIZ2));
                }
                String str17 = (String) LIZ3.get("disable_hardware_accelerate");
                if (str17 != null) {
                    kfx.setDisableHardwareAccelerate(C1630Kfl.LIZ("disable_hardware_accelerate", str17, LIZ3, LIZ2));
                }
                String str18 = (String) LIZ3.get("disable_offline");
                if (str18 != null) {
                    kfx.setDisableOffline(C1630Kfl.LIZ("disable_offline", str18, LIZ3, LIZ2));
                }
                String str19 = (String) LIZ3.get("disable_save_image");
                if (str19 != null) {
                    kfx.setDisableSaveImage(C1630Kfl.LIZ("disable_save_image", str19, LIZ3, LIZ2));
                }
                String str20 = (String) LIZ3.get("dynamic");
                if (str20 != null) {
                    kfx.setDynamic(C1630Kfl.LIZ("dynamic", str20, LIZ3, LIZ2, false));
                }
                String str21 = (String) LIZ3.get("enable_canvas");
                if (str21 != null) {
                    kfx.setEnableCanvas(C1630Kfl.LIZ("enable_canvas", str21, LIZ3, LIZ2));
                }
                String str22 = (String) LIZ3.get("enable_canvas_optimize");
                if (str22 != null) {
                    kfx.setEnableCanvasOptimization(Boolean.valueOf(C1630Kfl.LIZ("enable_canvas_optimize", str22, LIZ3, LIZ2)));
                }
                String str23 = (String) LIZ3.get("enable_dynamic_v8");
                if (str23 != null) {
                    kfx.setEnableDynamicV8(C1630Kfl.LIZ("enable_dynamic_v8", str23, LIZ3, LIZ2));
                }
                String str24 = (String) LIZ3.get("enable_js_runtime");
                if (str24 != null) {
                    kfx.setEnableJSRuntime(C1630Kfl.LIZ("enable_js_runtime", str24, LIZ3, LIZ2));
                }
                String str25 = (String) LIZ3.get("enable_memory_cache");
                if (str25 != null) {
                    kfx.setEnableMemoryCache(C1630Kfl.LIZ("enable_memory_cache", str25, LIZ3, LIZ2));
                }
                String str26 = (String) LIZ3.get("enable_pending_js_task");
                if (str26 != null) {
                    kfx.setEnablePendingJsTask(C1630Kfl.LIZ("enable_pending_js_task", str26, LIZ3, LIZ2));
                }
                String str27 = (String) LIZ3.get("fallback_url");
                if (str27 != null) {
                    C1630Kfl.LIZIZ("fallback_url", str27, LIZ3, LIZ2);
                    kfx.setFallbackUrl(str27);
                }
                String str28 = (String) LIZ3.get("force_h5");
                if (str28 != null) {
                    kfx.setForceH5(C1630Kfl.LIZ("force_h5", str28, LIZ3, LIZ2));
                }
                String str29 = (String) LIZ3.get("group");
                if (str29 != null) {
                    C1630Kfl.LIZIZ("group", str29, LIZ3, LIZ2);
                    kfx.setGroup(str29);
                }
                String str30 = (String) LIZ3.get("hide_loading");
                if (str30 != null) {
                    kfx.setHideLoading(C1630Kfl.LIZ("hide_loading", str30, LIZ3, LIZ2));
                }
                String str31 = (String) LIZ3.get("hide_nav_bar");
                if (str31 != null) {
                    kfx.setHideNavBar(C1630Kfl.LIZ("hide_nav_bar", str31, LIZ3, LIZ2));
                }
                String str32 = (String) LIZ3.get("hide_status_bar");
                if (str32 != null) {
                    kfx.setHideStatusBar(C1630Kfl.LIZ("hide_status_bar", str32, LIZ3, LIZ2));
                }
                String str33 = (String) LIZ3.get("hide_system_video_poster");
                if (str33 != null) {
                    kfx.setHideSystemVideoPoster(C1630Kfl.LIZ("hide_system_video_poster", str33, LIZ3, LIZ2));
                }
                String str34 = (String) LIZ3.get("ignore_cache_policy");
                if (str34 != null) {
                    kfx.setIgnoreCachePolicy(C1630Kfl.LIZ("ignore_cache_policy", str34, LIZ3, LIZ2, false));
                }
                String str35 = (String) LIZ3.get("initial_data");
                if (str35 != null) {
                    C1630Kfl.LIZIZ("initial_data", str35, LIZ3, LIZ2);
                    kfx.setInitialData(str35);
                }
                String str36 = (String) LIZ3.get("keyboard_adjust");
                if (str36 != null) {
                    kfx.setKeyboardAdjust(C1630Kfl.LIZ("keyboard_adjust", str36, LIZ3, LIZ2, false));
                }
                String str37 = (String) LIZ3.get("keyboard_compat");
                if (str37 != null) {
                    kfx.setKeyboardCompat(C1630Kfl.LIZ("keyboard_compat", str37, LIZ3, LIZ2));
                }
                String str38 = (String) LIZ3.get("landscape_screen_size_as_portrait");
                if (str38 != null) {
                    kfx.setLandscapeScreenSizeAsPortrait(C1630Kfl.LIZ("landscape_screen_size_as_portrait", str38, LIZ3, LIZ2));
                }
                String str39 = (String) LIZ3.get("loading_bg_color");
                if (str39 != null) {
                    kfx.setLoadingBgColor(C1630Kfl.LJ("loading_bg_color", str39, LIZ3, LIZ2));
                }
                String str40 = (String) LIZ3.get("lynxview_height");
                if (str40 != null) {
                    z = true;
                    kfx.setLynxviewHeight(Integer.valueOf(C1630Kfl.LIZ("lynxview_height", str40, LIZ3, LIZ2, true)));
                } else {
                    z = true;
                }
                String str41 = (String) LIZ3.get("lynxview_width");
                if (str41 != null) {
                    kfx.setLynxviewWidth(Integer.valueOf(C1630Kfl.LIZ("lynxview_width", str41, LIZ3, LIZ2, z)));
                }
                String str42 = (String) LIZ3.get("nav_bar_color");
                if (str42 != null) {
                    kfx.setNavBarColor(C1630Kfl.LJ("nav_bar_color", str42, LIZ3, LIZ2));
                }
                String str43 = (String) LIZ3.get("nav_btn_type");
                if (str43 != null) {
                    C1630Kfl.LIZIZ("nav_btn_type", str43, LIZ3, LIZ2);
                    kfx.setNavBtnType(str43);
                }
                String str44 = (String) LIZ3.get("need_sec_link");
                if (str44 != null) {
                    kfx.setNeedSecLink(C1630Kfl.LIZ("need_sec_link", str44, LIZ3, LIZ2));
                }
                String str45 = (String) LIZ3.get("only_local");
                if (str45 != null) {
                    kfx.setOnlyLocal(C1630Kfl.LIZ("only_local", str45, LIZ3, LIZ2));
                }
                String str46 = (String) LIZ3.get("preloadFonts");
                if (str46 != null) {
                    C1630Kfl.LIZIZ("preloadFonts", str46, LIZ3, LIZ2);
                    kfx.setPreloadFonts(str46);
                }
                String str47 = (String) LIZ3.get("preload_setting_keys");
                if (str47 != null) {
                    C1630Kfl.LIZIZ("preload_setting_keys", str47, LIZ3, LIZ2);
                    kfx.setPreloadSettingsKeys(str47);
                }
                String str48 = (String) LIZ3.get("preset_height");
                if (str48 != null) {
                    kfx.setPresetHeight(C1630Kfl.LIZ("preset_height", str48, LIZ3, LIZ2, true));
                }
                String str49 = (String) LIZ3.get("preset_safe_point");
                if (str49 != null) {
                    kfx.setPresetSafePoint(C1630Kfl.LIZ("preset_safe_point", str49, LIZ3, LIZ2));
                }
                String str50 = (String) LIZ3.get("preset_width");
                if (str50 != null) {
                    kfx.setPresetWidth(C1630Kfl.LIZ("preset_width", str50, LIZ3, LIZ2, true));
                }
                String str51 = (String) LIZ3.get("screen_orientation");
                if (str51 != null) {
                    C1630Kfl.LIZIZ("screen_orientation", str51, LIZ3, LIZ2);
                    kfx.setScreenOrientation(str51);
                }
                String str52 = (String) LIZ3.get("sec_link_scene");
                if (str52 != null) {
                    C1630Kfl.LIZIZ("sec_link_scene", str52, LIZ3, LIZ2);
                    kfx.setSecLinkScene(str52);
                }
                String str53 = (String) LIZ3.get("share_group");
                if (str53 != null) {
                    kfx.setShareGroup(C1630Kfl.LIZ("share_group", str53, LIZ3, LIZ2));
                }
                String str54 = (String) LIZ3.get("show_closeall");
                if (str54 != null) {
                    kfx.setShowCloseAll(C1630Kfl.LIZ("show_closeall", str54, LIZ3, LIZ2));
                }
                String str55 = (String) LIZ3.get("show_nav_bar_in_trans_status_bar");
                if (str55 != null) {
                    kfx.setShowNavBarInTransStatusBar(C1630Kfl.LIZ("show_nav_bar_in_trans_status_bar", str55, LIZ3, LIZ2));
                }
                String str56 = (String) LIZ3.get("status_bar_bg_color");
                if (str56 != null) {
                    kfx.setStatusBarBgColor(C1630Kfl.LJ("status_bar_bg_color", str56, LIZ3, LIZ2));
                }
                String str57 = (String) LIZ3.get("status_font_mode");
                if (str57 != null) {
                    C1630Kfl.LIZIZ("status_font_mode", str57, LIZ3, LIZ2);
                    kfx.setStatusFontMode(str57);
                }
                String str58 = (String) LIZ3.get("surl");
                if (str58 != null) {
                    C1630Kfl.LIZIZ("surl", str58, LIZ3, LIZ2);
                    kfx.setSurl(str58);
                }
                String str59 = (String) LIZ3.get("thread_strategy");
                if (str59 != null) {
                    kfx.setThreadStrategy(C1630Kfl.LIZ("thread_strategy", str59, LIZ3, LIZ2, false));
                }
                String str60 = (String) LIZ3.get("title");
                if (str60 != null) {
                    C1630Kfl.LIZIZ("title", str60, LIZ3, LIZ2);
                    kfx.setTitle(str60);
                }
                String str61 = (String) LIZ3.get("title_color");
                if (str61 != null) {
                    kfx.setTitleColor(C1630Kfl.LJ("title_color", str61, LIZ3, LIZ2));
                }
                String str62 = (String) LIZ3.get("trans_status_bar");
                if (str62 != null) {
                    kfx.setTransStatusBar(C1630Kfl.LIZ("trans_status_bar", str62, LIZ3, LIZ2));
                }
                String str63 = (String) LIZ3.get("ui_running_mode");
                if (str63 != null) {
                    kfx.setUiRunningMode(C1630Kfl.LIZ("ui_running_mode", str63, LIZ3, LIZ2));
                }
                String str64 = (String) LIZ3.get("url");
                if (str64 != null) {
                    C1630Kfl.LIZIZ("url", str64, LIZ3, LIZ2);
                    kfx.setUrl(str64);
                }
                String str65 = (String) LIZ3.get("use_forest");
                if (str65 != null) {
                    kfx.setUseForest(C1630Kfl.LIZ("use_forest", str65, LIZ3, LIZ2));
                }
                String str66 = (String) LIZ3.get("use_preload");
                if (str66 != null) {
                    kfx.setUsePreload(C1630Kfl.LIZ("use_preload", str66, LIZ3, LIZ2));
                }
                String str67 = (String) LIZ3.get("use_webview_title");
                if (str67 != null) {
                    kfx.setUseWebviewTitle(C1630Kfl.LIZ("use_webview_title", str67, LIZ3, LIZ2));
                }
                String str68 = (String) LIZ3.get("wait_gecko_update");
                if (str68 != null) {
                    kfx.setWaitGeckoUpdate(C1630Kfl.LIZ("wait_gecko_update", str68, LIZ3, LIZ2));
                }
                String host = LIZ2.getHost();
                if (host != null) {
                    if (z.LIZ((CharSequence) host, "webview", false)) {
                        klf = KLF.WEB;
                    } else if (z.LIZ((CharSequence) host, "lynxview", false)) {
                        klf = KLF.LYNX;
                    }
                    kfx.setEngineType(klf);
                    kfx.adjustValues();
                    sparkContext = this;
                    kfj = kfx;
                }
                klf = KLF.UNKNOWN;
                kfx.setEngineType(klf);
                kfx.adjustValues();
                sparkContext = this;
                kfj = kfx;
            } else if (i2 == 2) {
                String str69 = sparkContext.LIZ;
                Map<String, String> map2 = sparkContext.LIZIZ;
                String str70 = sparkContext.LJFF;
                M12.LIZ((Object) str69, (Object) str70);
                Uri LIZ4 = By2.LIZ(str69);
                Map LIZ5 = 2ZF.LIZ(LIZ4, map2);
                C1627Kfi kfi = new C1627Kfi((KLF) null, 1, (2HN) null);
                2ZF.LIZ(str70, LIZ5);
                M12.LIZ(kfi, LIZ5, LIZ4);
                C1629Kfk.LIZ(LIZ4, LIZ5, kfi);
                String str71 = (String) LIZ5.get("width_percent");
                if (str71 != null) {
                    kfi.setWidth((int) ((Float.parseFloat(str71) / 100.0f) * ((float) C1663KgI.LIZIZ())));
                }
                String str72 = (String) LIZ5.get("height_percent");
                if (str72 != null) {
                    kfi.setHeight((int) ((Float.parseFloat(str72) / 100.0f) * ((float) C1663KgI.LIZ())));
                }
                String str73 = (String) LIZ5.get("mask_color");
                if (str73 != null) {
                    kfi.setMaskBgColor(C1630Kfl.LIZJ("mask_color", str73, LIZ5, LIZ4));
                }
                Object obj4 = LIZ5.get("close_by_mask");
                if (obj4 != null) {
                    kfi.setDisableOutsideClickClose(!n.LIZ(obj4, "1"));
                }
                kfi.setEnablePullDownClose(n.LIZ(LIZ5.get("close_by_gesture"), "1"));
                String str74 = (String) LIZ5.get("popup_enter_type");
                if (str74 != null) {
                    kfi.setTransitionAnimation(str74);
                }
                if (LIZ5.get("drag_height") == null && (str = (String) LIZ5.get("drag_height_percent")) != null) {
                    kfi.setDragHeight((int) ((Float.parseFloat(str) / 100.0f) * ((float) C1663KgI.LIZ())));
                }
                if (kfi.getEnablePullDownClose()) {
                    String str75 = (String) LIZ5.get("drag_down_threshold");
                    if (str75 == null || (valueOf3 = Integer.valueOf(Integer.parseInt(str75))) == null) {
                        kfi.setDragDownThreshold(kfi.getDragHeight() - kfi.getHeight());
                    } else {
                        kfi.setDragDownThreshold(valueOf3.intValue());
                    }
                    String str76 = (String) LIZ5.get("drag_down_close_threshold");
                    if (str76 == null || (valueOf2 = Integer.valueOf(Integer.parseInt(str76))) == null) {
                        kfi.setDragDownCloseThreshold((int) (((float) kfi.getDragHeight()) - (((float) kfi.getHeight()) * 0.8f)));
                    } else {
                        kfi.setDragDownCloseThreshold(valueOf2.intValue());
                    }
                    String str77 = (String) LIZ5.get("peek_down_close_threshold");
                    if (str77 == null || (valueOf = Integer.valueOf(Integer.parseInt(str77))) == null) {
                        kfi.setPeekDownCloseThreshold((int) (((float) kfi.getHeight()) * 0.2f));
                    } else {
                        kfi.setPeekDownCloseThreshold(valueOf.intValue());
                    }
                }
                Object obj5 = LIZ5.get("show_loading");
                if (obj5 != null) {
                    kfi.setHideLoading(n.LIZ(obj5, "0"));
                }
                Object obj6 = LIZ5.get("disable_mask_click_close");
                if (obj6 != null) {
                    kfi.setDisableOutsideClickClose(n.LIZ(obj6, "1"));
                }
                String str78 = (String) LIZ5.get("__use_ttnet");
                if (str78 != null) {
                    kfi.set_useTtnet(C1630Kfl.LIZ("__use_ttnet", str78, LIZ5, LIZ4, false));
                }
                String str79 = (String) LIZ5.get("accessKey");
                if (str79 != null) {
                    C1630Kfl.LIZIZ("accessKey", str79, LIZ5, LIZ4);
                    kfi.setAccessKey(str79);
                }
                String str80 = (String) LIZ5.get("append_common_params");
                if (str80 != null) {
                    kfi.setAppendCommonParams(C1630Kfl.LIZ("append_common_params", str80, LIZ5, LIZ4));
                }
                String str81 = (String) LIZ5.get("auto_play_bgm");
                if (str81 != null) {
                    kfi.setAutoPlayBgm(C1630Kfl.LIZ("auto_play_bgm", str81, LIZ5, LIZ4, false));
                }
                String str82 = (String) LIZ5.get("bid");
                if (str82 != null) {
                    C1630Kfl.LIZIZ("bid", str82, LIZ5, LIZ4);
                    kfi.setBid(str82);
                }
                String str83 = (String) LIZ5.get("block_back_press");
                if (str83 != null) {
                    kfi.setBlockBackPress(C1630Kfl.LIZ("block_back_press", str83, LIZ5, LIZ4));
                }
                String str84 = (String) LIZ5.get("bundle");
                if (str84 != null) {
                    C1630Kfl.LIZIZ("bundle", str84, LIZ5, LIZ4);
                    kfi.setBundle(str84);
                }
                String str85 = (String) LIZ5.get("channel");
                if (str85 != null) {
                    C1630Kfl.LIZIZ("channel", str85, LIZ5, LIZ4);
                    kfi.setChannel(str85);
                }
                String str86 = (String) LIZ5.get("container_bg_color");
                if (str86 != null) {
                    kfi.setContainerBgColor(C1630Kfl.LJ("container_bg_color", str86, LIZ5, LIZ4));
                }
                String str87 = (String) LIZ5.get("disable_back_press");
                if (str87 != null) {
                    kfi.setDisableBackPress(C1630Kfl.LIZ("disable_back_press", str87, LIZ5, LIZ4));
                }
                String str88 = (String) LIZ5.get("disable_builtin");
                if (str88 != null) {
                    kfi.setDisableBuiltin(C1630Kfl.LIZ("disable_builtin", str88, LIZ5, LIZ4));
                }
                String str89 = (String) LIZ5.get("disable_cdn");
                if (str89 != null) {
                    kfi.setDisableCDN(C1630Kfl.LIZ("disable_cdn", str89, LIZ5, LIZ4));
                }
                String str90 = (String) LIZ5.get("disable_hardware_accelerate");
                if (str90 != null) {
                    kfi.setDisableHardwareAccelerate(C1630Kfl.LIZ("disable_hardware_accelerate", str90, LIZ5, LIZ4));
                }
                String str91 = (String) LIZ5.get("disable_offline");
                if (str91 != null) {
                    kfi.setDisableOffline(C1630Kfl.LIZ("disable_offline", str91, LIZ5, LIZ4));
                }
                String str92 = (String) LIZ5.get("disable_outside_click_close");
                if (str92 != null) {
                    kfi.setDisableOutsideClickClose(C1630Kfl.LIZ("disable_outside_click_close", str92, LIZ5, LIZ4));
                }
                String str93 = (String) LIZ5.get("disable_save_image");
                if (str93 != null) {
                    kfi.setDisableSaveImage(C1630Kfl.LIZ("disable_save_image", str93, LIZ5, LIZ4));
                }
                String str94 = (String) LIZ5.get("drag_back");
                if (str94 != null) {
                    kfi.setDragBack(C1630Kfl.LIZ("drag_back", str94, LIZ5, LIZ4));
                }
                String str95 = (String) LIZ5.get("drag_by_gesture");
                if (str95 != null) {
                    kfi.setDragByGesture(C1630Kfl.LIZ("drag_by_gesture", str95, LIZ5, LIZ4));
                }
                String str96 = (String) LIZ5.get("drag_down_close_threshold");
                if (str96 != null) {
                    z2 = true;
                    kfi.setDragDownCloseThreshold(C1630Kfl.LIZ("drag_down_close_threshold", str96, LIZ5, LIZ4, true));
                } else {
                    z2 = true;
                }
                String str97 = (String) LIZ5.get("drag_down_threshold");
                if (str97 != null) {
                    kfi.setDragDownThreshold(C1630Kfl.LIZ("drag_down_threshold", str97, LIZ5, LIZ4, z2));
                }
                String str98 = (String) LIZ5.get("drag_height");
                if (str98 != null) {
                    kfi.setDragHeight(C1630Kfl.LIZ("drag_height", str98, LIZ5, LIZ4, z2));
                }
                String str99 = (String) LIZ5.get("drag_up_threshold");
                if (str99 != null) {
                    kfi.setDragUpThreshold(C1630Kfl.LIZ("drag_up_threshold", str99, LIZ5, LIZ4, z2));
                }
                String str100 = (String) LIZ5.get("dynamic");
                if (str100 != null) {
                    kfi.setDynamic(C1630Kfl.LIZ("dynamic", str100, LIZ5, LIZ4, false));
                }
                String str101 = (String) LIZ5.get("enable_canvas");
                if (str101 != null) {
                    kfi.setEnableCanvas(C1630Kfl.LIZ("enable_canvas", str101, LIZ5, LIZ4));
                }
                String str102 = (String) LIZ5.get("enable_canvas_optimize");
                if (str102 != null) {
                    kfi.setEnableCanvasOptimization(Boolean.valueOf(C1630Kfl.LIZ("enable_canvas_optimize", str102, LIZ5, LIZ4)));
                }
                String str103 = (String) LIZ5.get("enable_dynamic_v8");
                if (str103 != null) {
                    kfi.setEnableDynamicV8(C1630Kfl.LIZ("enable_dynamic_v8", str103, LIZ5, LIZ4));
                }
                String str104 = (String) LIZ5.get("enable_js_runtime");
                if (str104 != null) {
                    kfi.setEnableJSRuntime(C1630Kfl.LIZ("enable_js_runtime", str104, LIZ5, LIZ4));
                }
                String str105 = (String) LIZ5.get("enable_memory_cache");
                if (str105 != null) {
                    kfi.setEnableMemoryCache(C1630Kfl.LIZ("enable_memory_cache", str105, LIZ5, LIZ4));
                }
                String str106 = (String) LIZ5.get("enable_pending_js_task");
                if (str106 != null) {
                    kfi.setEnablePendingJsTask(C1630Kfl.LIZ("enable_pending_js_task", str106, LIZ5, LIZ4));
                }
                String str107 = (String) LIZ5.get("enable_pull_down_close");
                if (str107 != null) {
                    kfi.setEnablePullDownClose(C1630Kfl.LIZ("enable_pull_down_close", str107, LIZ5, LIZ4));
                }
                String str108 = (String) LIZ5.get("fallback_url");
                if (str108 != null) {
                    C1630Kfl.LIZIZ("fallback_url", str108, LIZ5, LIZ4);
                    kfi.setFallbackUrl(str108);
                }
                String str109 = (String) LIZ5.get("force_h5");
                if (str109 != null) {
                    kfi.setForceH5(C1630Kfl.LIZ("force_h5", str109, LIZ5, LIZ4));
                }
                String str110 = (String) LIZ5.get("gravity");
                if (str110 != null) {
                    C1630Kfl.LIZIZ("gravity", str110, LIZ5, LIZ4);
                    kfi.setGravity(str110);
                }
                String str111 = (String) LIZ5.get("group");
                if (str111 != null) {
                    C1630Kfl.LIZIZ("group", str111, LIZ5, LIZ4);
                    kfi.setGroup(str111);
                }
                String str112 = (String) LIZ5.get("height");
                if (str112 != null) {
                    kfi.setHeight(C1630Kfl.LIZ("height", str112, LIZ5, LIZ4, true));
                }
                String str113 = (String) LIZ5.get("hide_loading");
                if (str113 != null) {
                    kfi.setHideLoading(C1630Kfl.LIZ("hide_loading", str113, LIZ5, LIZ4));
                }
                String str114 = (String) LIZ5.get("hide_system_video_poster");
                if (str114 != null) {
                    kfi.setHideSystemVideoPoster(C1630Kfl.LIZ("hide_system_video_poster", str114, LIZ5, LIZ4));
                }
                String str115 = (String) LIZ5.get("ignore_cache_policy");
                if (str115 != null) {
                    kfi.setIgnoreCachePolicy(C1630Kfl.LIZ("ignore_cache_policy", str115, LIZ5, LIZ4, false));
                }
                String str116 = (String) LIZ5.get("initial_data");
                if (str116 != null) {
                    C1630Kfl.LIZIZ("initial_data", str116, LIZ5, LIZ4);
                    kfi.setInitialData(str116);
                }
                String str117 = (String) LIZ5.get("keyboard_adjust");
                if (str117 != null) {
                    kfi.setKeyboardAdjust(C1630Kfl.LIZ("keyboard_adjust", str117, LIZ5, LIZ4, false));
                }
                String str118 = (String) LIZ5.get("keyboard_compat");
                if (str118 != null) {
                    kfi.setKeyboardCompat(C1630Kfl.LIZ("keyboard_compat", str118, LIZ5, LIZ4));
                }
                String str119 = (String) LIZ5.get("landscape_gravity");
                if (str119 != null) {
                    C1630Kfl.LIZIZ("landscape_gravity", str119, LIZ5, LIZ4);
                    kfi.setLandscapeGravity(str119);
                }
                String str120 = (String) LIZ5.get("landscape_height");
                if (str120 != null) {
                    kfi.setLandscapeHeight(C1630Kfl.LIZ("landscape_height", str120, LIZ5, LIZ4, true));
                }
                String str121 = (String) LIZ5.get("landscape_screen_size_as_portrait");
                if (str121 != null) {
                    kfi.setLandscapeScreenSizeAsPortrait(C1630Kfl.LIZ("landscape_screen_size_as_portrait", str121, LIZ5, LIZ4));
                }
                String str122 = (String) LIZ5.get("landscape_transition_animation");
                if (str122 != null) {
                    C1630Kfl.LIZIZ("landscape_transition_animation", str122, LIZ5, LIZ4);
                    kfi.setLandscapeTransitionAnimation(str122);
                }
                String str123 = (String) LIZ5.get("landscape_width");
                if (str123 != null) {
                    kfi.setLandscapeWidth(C1630Kfl.LIZ("landscape_width", str123, LIZ5, LIZ4, true));
                }
                String str124 = (String) LIZ5.get("loading_bg_color");
                if (str124 != null) {
                    kfi.setLoadingBgColor(C1630Kfl.LJ("loading_bg_color", str124, LIZ5, LIZ4));
                }
                String str125 = (String) LIZ5.get("lynxview_height");
                if (str125 != null) {
                    z3 = true;
                    kfi.setLynxviewHeight(Integer.valueOf(C1630Kfl.LIZ("lynxview_height", str125, LIZ5, LIZ4, true)));
                } else {
                    z3 = true;
                }
                String str126 = (String) LIZ5.get("lynxview_width");
                if (str126 != null) {
                    kfi.setLynxviewWidth(Integer.valueOf(C1630Kfl.LIZ("lynxview_width", str126, LIZ5, LIZ4, z3)));
                }
                String str127 = (String) LIZ5.get("mask_bg_color");
                if (str127 != null) {
                    kfi.setMaskBgColor(C1630Kfl.LJ("mask_bg_color", str127, LIZ5, LIZ4));
                }
                String str128 = (String) LIZ5.get("min_margin_top");
                if (str128 != null) {
                    kfi.setMinMarginTop(C1630Kfl.LIZ("min_margin_top", str128, LIZ5, LIZ4, true));
                }
                String str129 = (String) LIZ5.get("need_sec_link");
                if (str129 != null) {
                    kfi.setNeedSecLink(C1630Kfl.LIZ("need_sec_link", str129, LIZ5, LIZ4));
                }
                String str130 = (String) LIZ5.get("only_local");
                if (str130 != null) {
                    kfi.setOnlyLocal(C1630Kfl.LIZ("only_local", str130, LIZ5, LIZ4));
                }
                String str131 = (String) LIZ5.get("peek_down_close_threshold");
                if (str131 != null) {
                    kfi.setPeekDownCloseThreshold(C1630Kfl.LIZ("peek_down_close_threshold", str131, LIZ5, LIZ4, true));
                }
                String str132 = (String) LIZ5.get("preloadFonts");
                if (str132 != null) {
                    C1630Kfl.LIZIZ("preloadFonts", str132, LIZ5, LIZ4);
                    kfi.setPreloadFonts(str132);
                }
                String str133 = (String) LIZ5.get("preload_setting_keys");
                if (str133 != null) {
                    C1630Kfl.LIZIZ("preload_setting_keys", str133, LIZ5, LIZ4);
                    kfi.setPreloadSettingsKeys(str133);
                }
                String str134 = (String) LIZ5.get("preset_height");
                if (str134 != null) {
                    kfi.setPresetHeight(C1630Kfl.LIZ("preset_height", str134, LIZ5, LIZ4, true));
                }
                String str135 = (String) LIZ5.get("preset_safe_point");
                if (str135 != null) {
                    kfi.setPresetSafePoint(C1630Kfl.LIZ("preset_safe_point", str135, LIZ5, LIZ4));
                }
                String str136 = (String) LIZ5.get("preset_width");
                if (str136 != null) {
                    z4 = true;
                    kfi.setPresetWidth(C1630Kfl.LIZ("preset_width", str136, LIZ5, LIZ4, true));
                } else {
                    z4 = true;
                }
                String str137 = (String) LIZ5.get("radius");
                if (str137 != null) {
                    kfi.setRadius(C1630Kfl.LIZ("radius", str137, LIZ5, LIZ4, z4));
                }
                String str138 = (String) LIZ5.get("sec_link_scene");
                if (str138 != null) {
                    C1630Kfl.LIZIZ("sec_link_scene", str138, LIZ5, LIZ4);
                    kfi.setSecLinkScene(str138);
                }
                String str139 = (String) LIZ5.get("share_group");
                if (str139 != null) {
                    kfi.setShareGroup(C1630Kfl.LIZ("share_group", str139, LIZ5, LIZ4));
                }
                String str140 = (String) LIZ5.get("show_mask");
                if (str140 != null) {
                    kfi.setShowMask(C1630Kfl.LIZ("show_mask", str140, LIZ5, LIZ4));
                }
                String str141 = (String) LIZ5.get("silent_load_type");
                if (str141 != null) {
                    kfi.setSilentLoadType(C1630Kfl.LIZ("silent_load_type", str141, LIZ5, LIZ4));
                }
                String str142 = (String) LIZ5.get("surl");
                if (str142 != null) {
                    C1630Kfl.LIZIZ("surl", str142, LIZ5, LIZ4);
                    kfi.setSurl(str142);
                }
                String str143 = (String) LIZ5.get("thread_strategy");
                if (str143 != null) {
                    kfi.setThreadStrategy(C1630Kfl.LIZ("thread_strategy", str143, LIZ5, LIZ4, false));
                }
                String str144 = (String) LIZ5.get("transition_animation");
                if (str144 != null) {
                    C1630Kfl.LIZIZ("transition_animation", str144, LIZ5, LIZ4);
                    kfi.setTransitionAnimation(str144);
                }
                String str145 = (String) LIZ5.get("ui_running_mode");
                if (str145 != null) {
                    kfi.setUiRunningMode(C1630Kfl.LIZ("ui_running_mode", str145, LIZ5, LIZ4));
                }
                String str146 = (String) LIZ5.get("url");
                if (str146 != null) {
                    C1630Kfl.LIZIZ("url", str146, LIZ5, LIZ4);
                    kfi.setUrl(str146);
                }
                String str147 = (String) LIZ5.get("use_forest");
                if (str147 != null) {
                    kfi.setUseForest(C1630Kfl.LIZ("use_forest", str147, LIZ5, LIZ4));
                }
                String str148 = (String) LIZ5.get("use_preload");
                if (str148 != null) {
                    kfi.setUsePreload(C1630Kfl.LIZ("use_preload", str148, LIZ5, LIZ4));
                }
                String str149 = (String) LIZ5.get("variable_height");
                if (str149 != null) {
                    kfi.setVariableHeight(C1630Kfl.LIZ("variable_height", str149, LIZ5, LIZ4, true));
                }
                String str150 = (String) LIZ5.get("wait_gecko_update");
                if (str150 != null) {
                    kfi.setWaitGeckoUpdate(C1630Kfl.LIZ("wait_gecko_update", str150, LIZ5, LIZ4));
                }
                String str151 = (String) LIZ5.get("width");
                if (str151 != null) {
                    z5 = true;
                    kfi.setWidth(C1630Kfl.LIZ("width", str151, LIZ5, LIZ4, true));
                } else {
                    z5 = true;
                }
                String host2 = LIZ4.getHost();
                if (host2 != null) {
                    if (z.LIZ((CharSequence) host2, "webview", false) == z5) {
                        klf2 = KLF.WEB;
                    } else if (z.LIZ((CharSequence) host2, "lynxview", false) == z5) {
                        klf2 = KLF.LYNX;
                    }
                    kfi.setEngineType(klf2);
                    kfi.adjustValues();
                    sparkContext = this;
                    kfj = kfi;
                }
                klf2 = KLF.UNKNOWN;
                kfi.setEngineType(klf2);
                kfi.adjustValues();
                sparkContext = this;
                kfj = kfi;
            } else if (i2 != 3) {
                String str152 = sparkContext.LIZ;
                Map<String, String> map3 = sparkContext.LIZIZ;
                String str153 = sparkContext.LJFF;
                M12.LIZ((Object) str152, (Object) str153);
                Uri LIZ6 = By2.LIZ(str152);
                Map LIZ7 = 2ZF.LIZ(LIZ6, map3);
                C1628Kfj kfj2 = new C1628Kfj((KLF) null, 1, (2HN) null);
                2ZF.LIZ(str153, LIZ7);
                C1623Kfe.LIZ(kfj2, LIZ7, LIZ6);
                String host3 = LIZ6.getHost();
                if (host3 != null) {
                    if (z.LIZ((CharSequence) host3, "webview", false)) {
                        klf4 = KLF.WEB;
                    } else if (z.LIZ((CharSequence) host3, "lynxview", false)) {
                        klf4 = KLF.LYNX;
                    }
                    kfj2.setEngineType(klf4);
                    kfj2.adjustValues();
                    kfj = kfj2;
                }
                klf4 = KLF.UNKNOWN;
                kfj2.setEngineType(klf4);
                kfj2.adjustValues();
                kfj = kfj2;
            } else {
                String str154 = sparkContext.LIZ;
                Map<String, String> map4 = sparkContext.LIZIZ;
                String str155 = sparkContext.LJFF;
                M12.LIZ((Object) str154, (Object) str155);
                Uri LIZ8 = By2.LIZ(str154);
                Map LIZ9 = 2ZF.LIZ(LIZ8, map4);
                C1641Kfw kfw = new C1641Kfw((KLF) null, 1, (2HN) null);
                2ZF.LIZ(str155, LIZ9);
                C1624Kff.LIZ(kfw, LIZ9, LIZ8);
                String host4 = LIZ8.getHost();
                if (host4 != null) {
                    if (z.LIZ((CharSequence) host4, "webview", false)) {
                        klf3 = KLF.WEB;
                    } else if (z.LIZ((CharSequence) host4, "lynxview", false)) {
                        klf3 = KLF.LYNX;
                    }
                    kfw.setEngineType(klf3);
                    kfw.adjustValues();
                    kfj = kfw;
                }
                klf3 = KLF.UNKNOWN;
                kfw.setEngineType(klf3);
                kfw.adjustValues();
                kfj = kfw;
            }
            sparkContext.LJIILJJIL = kfj;
        }
        sparkContext.LJIILL = true;
    }

    public final HtZ LIZ() {
        return (HtZ) LIZ(HtZ.class);
    }

    static {
        Covode.recordClassIndex(27673);
    }

    public SparkContext() {
        this.LJIILIIL = -1;
        this.LIZ = "";
        this.LIZIZ = new LinkedHashMap();
        this.LIZJ = new C1187KWs();
    }

    public final SparkContext LIZ(C1353KbI kbI) {
        M12.LIZ((Object) kbI);
        LIZ(C1353KbI.class, kbI);
        return this;
    }

    public final C1628Kfj LIZ(int i) {
        if (!this.LJIILL) {
            KLC klc = KLC.LIZIZ;
            String str = this.LJFF;
            String str2 = "";
            if (str == null) {
                str = str2;
            }
            klc.LIZ(str, "prepare_init_data_start", System.currentTimeMillis());
            if (i <= 0) {
                i = Hjs.LIZ.LIZ(this.LIZ);
            }
            LIZIZ(i);
            KLC klc2 = KLC.LIZIZ;
            String str3 = this.LJFF;
            if (str3 != null) {
                str2 = str3;
            }
            klc2.LIZ(str2, "prepare_init_data_end", System.currentTimeMillis());
        }
        return this.LJIILJJIL;
    }

    public final SparkContext LIZ(C1575Kes kes) {
        M12.LIZ((Object) kes);
        LIZ(C1575Kes.class, kes);
        return this;
    }

    /* JADX INFO: this call moved to the top of the method (can break code semantics) */
    public SparkContext(Parcel parcel) {
        this();
        boolean z;
        M12.LIZ((Object) parcel);
        this.LJIILIIL = parcel.readInt();
        String readString = parcel.readString();
        String str = "";
        this.LIZ = readString == null ? str : readString;
        parcel.readMap(this.LIZIZ, Map.class.getClassLoader());
        parcel.readMap(this.LIZJ, Map.class.getClassLoader());
        parcel.readMap(this.LJIIIZ, Map.class.getClassLoader());
        Serializable readSerializable = parcel.readSerializable();
        this.LJIILJJIL = (C1628Kfj) (!(readSerializable instanceof C1628Kfj) ? null : readSerializable);
        String readString2 = parcel.readString();
        readString2 = readString2 == null ? JvF.LIZJ.LIZ() : readString2;
        M12.LIZ((Object) readString2);
        this.LJFF = readString2;
        String readString3 = parcel.readString();
        LIZIZ(readString3 == null ? "hybridkit_default_bid" : readString3);
        boolean z2 = true;
        if (parcel.readInt() != 0) {
            z = true;
        } else {
            z = false;
        }
        this.LJIILL = z;
        String readString4 = parcel.readString();
        LIZJ(readString4 != null ? readString4 : str);
        this.LJIIL = parcel.readInt() == 0 ? false : z2;
    }

    public final SparkContext LIZ(C1579Kew kew) {
        M12.LIZ((Object) kew);
        LIZ(C1579Kew.class, kew);
        return this;
    }

    public final SparkContext LIZ(C1582Kez kez) {
        M12.LIZ((Object) kez);
        LIZ(C1582Kez.class, kez);
        return this;
    }

    public final SparkContext LIZ(C1587Kf4 kf4) {
        M12.LIZ((Object) kf4);
        LIZ(C1587Kf4.class, kf4);
        return this;
    }

    public final synchronized SparkContext LIZ(C1692Kgl kgl) {
        MethodCollector.i(2130);
        M12.LIZ((Object) kgl);
        C1643Kfy kfy = (C1643Kfy) LIZ(C1643Kfy.class);
        if (kfy == null) {
            kfy = new C1643Kfy(new ArrayList());
        }
        kfy.LIZ.add(kgl);
        LIZ(C1643Kfy.class, kfy);
        MethodCollector.o(2130);
        return this;
    }

    public void writeToParcel(Parcel parcel, int i) {
        M12.LIZ((Object) parcel);
        parcel.writeInt(this.LJIILIIL);
        parcel.writeString(this.LIZ);
        parcel.writeMap(this.LIZIZ);
        parcel.writeMap(this.LIZJ);
        parcel.writeMap(this.LJIIIZ);
        parcel.writeSerializable(this.LJIILJJIL);
        parcel.writeString(this.LJFF);
        parcel.writeString(this.LJI);
        parcel.writeInt(this.LJIILL ? 1 : 0);
        parcel.writeString(this.LJII);
        parcel.writeInt(this.LJIIL ? 1 : 0);
    }
}
