package com.mbridge.msdk.video.bt.a; import android.app.Activity; import android.content.Context; import android.graphics.Color; import android.graphics.Rect; import android.os.Handler; import android.os.Looper; import android.text.TextUtils; import android.util.Base64; import android.view.View; import android.view.ViewGroup; import android.webkit.WebView; import android.widget.FrameLayout; import android.widget.LinearLayout; import android.widget.RelativeLayout; import com.ironsource.fc; import com.mbridge.msdk.MBridgeConstans; import com.mbridge.msdk.foundation.db.j; import com.mbridge.msdk.foundation.db.n; import com.mbridge.msdk.foundation.download.download.H5DownLoadManager; import com.mbridge.msdk.foundation.entity.CampaignEx; import com.mbridge.msdk.foundation.entity.m; import com.mbridge.msdk.foundation.tools.ab; import com.mbridge.msdk.foundation.tools.af; import com.mbridge.msdk.foundation.tools.aj; import com.mbridge.msdk.foundation.tools.ak; import com.mbridge.msdk.foundation.tools.at; import com.mbridge.msdk.foundation.tools.s; import com.mbridge.msdk.interstitial.view.MBInterstitialActivity; import com.mbridge.msdk.mbsignalcommon.windvane.WindVaneWebView; import com.mbridge.msdk.mbsignalcommon.windvane.g; import com.mbridge.msdk.playercommon.exoplayer2.text.ttml.TtmlNode; import com.mbridge.msdk.video.bt.a.b; import com.mbridge.msdk.video.bt.module.BTBaseView; import com.mbridge.msdk.video.bt.module.MBTempContainer; import com.mbridge.msdk.video.bt.module.MBridgeBTContainer; import com.mbridge.msdk.video.bt.module.MBridgeBTLayout; import com.mbridge.msdk.video.bt.module.MBridgeBTNativeEC; import com.mbridge.msdk.video.bt.module.MBridgeBTVideoView; import com.mbridge.msdk.video.bt.module.MBridgeBTWebView; import com.mbridge.msdk.video.signal.a.k; import com.tapjoy.TJAdUnitConstants; import csdk.gluads.Consts; import java.io.File; import java.util.ArrayList; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; import java.util.concurrent.ConcurrentHashMap; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; /* loaded from: classes4.dex */ public class a { private static ConcurrentHashMap> a = new ConcurrentHashMap<>(); private static LinkedHashMap b = new LinkedHashMap<>(); private static LinkedHashMap c = new LinkedHashMap<>(); private static LinkedHashMap d = new LinkedHashMap<>(); private static LinkedHashMap e = new LinkedHashMap<>(); private static LinkedHashMap f = new LinkedHashMap<>(); private static LinkedHashMap g = new LinkedHashMap<>(); private static volatile int h = 10000; private static int i = 0; private static int j = 1; private static String k = ""; private static int l; private static int m; private static int n; private static int o; private static int p; public final String a() { h++; return String.valueOf(h); } public final CampaignEx a(String str) { if (c.containsKey(str)) { return c.get(str); } return null; } private String h(String str) { return b.containsKey(str) ? b.get(str) : ""; } public final void a(String str, String str2) { b.put(str, str2); } public final com.mbridge.msdk.videocommon.d.c b(String str) { if (d.containsKey(str)) { return d.get(str); } return null; } public final String c(String str) { return e.containsKey(str) ? e.get(str) : ""; } public final void a(String str, Activity activity) { g.put(str, activity); } public final void d(String str) { g.remove(str); } public final void a(String str, int i2) { f.put(str, Integer.valueOf(i2)); } public final int e(String str) { if (f.containsKey(str)) { return f.get(str).intValue(); } return 2; } public final void f(String str) { if (e.containsKey(str)) { e.remove(str); } if (d.containsKey(str)) { d.remove(str); } if (c.containsKey(str)) { c.remove(str); } if (b.containsKey(str)) { b.remove(str); } } public final void g(String str) { if (f.containsKey(str)) { f.remove(str); } } public final synchronized LinkedHashMap b(String str, String str2) { if (a.containsKey(str + "_" + str2)) { return a.get(str + "_" + str2); } LinkedHashMap linkedHashMap = new LinkedHashMap<>(); a.put(str + "_" + str2, linkedHashMap); return linkedHashMap; } private void c(Object obj, String str) { try { JSONObject jSONObject = new JSONObject(); jSONObject.put("code", j); jSONObject.put("message", str); jSONObject.put("data", new JSONObject()); g.a().a(obj, Base64.encodeToString(jSONObject.toString().getBytes(), 2)); } catch (Exception e2) { af.a("OperateViews", e2.getMessage()); } } public final void a(WebView webView, String str) { try { JSONObject jSONObject = new JSONObject(); jSONObject.put("code", j); jSONObject.put("message", str); jSONObject.put("data", new JSONObject()); g.a().a(webView, Base64.encodeToString(jSONObject.toString().getBytes(), 2)); } catch (Exception e2) { af.a("OperateViews", e2.getMessage()); } } public final void a(Object obj, String str) { try { JSONObject jSONObject = new JSONObject(); jSONObject.put("code", i); JSONObject jSONObject2 = new JSONObject(); jSONObject2.put("id", str); jSONObject.put("data", jSONObject2); g.a().a(obj, Base64.encodeToString(jSONObject.toString().getBytes(), 2)); } catch (Exception e2) { c(obj, e2.getMessage()); af.a("OperateViews", e2.getMessage()); } } private void a(Object obj, String str, String str2) { try { JSONObject jSONObject = new JSONObject(); jSONObject.put("code", i); JSONObject jSONObject2 = new JSONObject(); jSONObject2.put("id", str2); jSONObject.put("data", jSONObject2); g.a().a(obj, str, Base64.encodeToString(jSONObject.toString().getBytes(), 2)); } catch (Exception e2) { c(obj, e2.getMessage()); af.a("OperateViews", e2.getMessage()); } } public final void a(WebView webView, String str, String str2) { try { JSONObject jSONObject = new JSONObject(); jSONObject.put("code", i); JSONObject jSONObject2 = new JSONObject(); jSONObject2.put("id", str2); jSONObject.put("data", jSONObject2); g.a().a(webView, str, Base64.encodeToString(jSONObject.toString().getBytes(), 2)); } catch (Exception e2) { a(webView, e2.getMessage()); af.a("OperateViews", e2.getMessage()); } } public final void a(final Object obj, JSONObject jSONObject) { final int i2; final int i3; final Rect rect; try { final String optString = jSONObject.optString("unitId"); if (TextUtils.isEmpty(optString)) { c(obj, "unitId is empty"); return; } JSONObject optJSONObject = jSONObject.optJSONObject("data"); int optInt = optJSONObject.optInt("delay", 0); optJSONObject.optString("fileURL"); optJSONObject.optString(fc.c.c); optJSONObject.optString(TJAdUnitConstants.String.HTML); JSONObject optJSONObject2 = optJSONObject.optJSONObject("rect"); Rect rect2 = new Rect(-999, -999, -999, -999); if (optJSONObject2 != null) { Rect rect3 = new Rect(optJSONObject2.optInt("left", -999), optJSONObject2.optInt("top", -999), optJSONObject2.optInt(TtmlNode.RIGHT, -999), optJSONObject2.optInt(Consts.SDK_BANNER_POSITION_BOTTOM, -999)); int optInt2 = optJSONObject2.optInt("width"); i3 = optJSONObject2.optInt("height"); rect = rect3; i2 = optInt2; } else { i2 = 0; i3 = 0; rect = rect2; } new Handler(Looper.getMainLooper()).postDelayed(new Runnable() { // from class: com.mbridge.msdk.video.bt.a.a.1 @Override // java.lang.Runnable public final void run() { String str; WindVaneWebView windVaneWebView = ((com.mbridge.msdk.mbsignalcommon.windvane.a) obj).b; if (windVaneWebView != null) { str = windVaneWebView.getRid(); } else { str = ""; windVaneWebView = null; } LinkedHashMap b2 = a.this.b(optString, str); String a2 = a.this.a(); a.b.put(a2, str); MBridgeBTLayout mBridgeBTLayout = new MBridgeBTLayout(com.mbridge.msdk.foundation.controller.c.m().c()); b2.put(a2, mBridgeBTLayout); mBridgeBTLayout.setInstanceId(a2); mBridgeBTLayout.setUnitId(optString); mBridgeBTLayout.setWebView(windVaneWebView); mBridgeBTLayout.setRect(rect); int i4 = i2; if (i4 > 0 || i3 > 0) { mBridgeBTLayout.setLayout(i4, i3); } a.this.a(obj, a2); af.a("OperateViews", "create view instanceId = " + a2); } }, optInt); } catch (Throwable th) { c(obj, th.getMessage()); af.a("OperateViews", "create view failed:" + th.getMessage()); } } public final void b(final Object obj, JSONObject jSONObject) { final int i2; final int i3; final Rect rect; try { final String optString = jSONObject.optString("unitId"); if (TextUtils.isEmpty(optString)) { c(obj, "unitId is empty"); return; } JSONObject optJSONObject = jSONObject.optJSONObject("data"); int optInt = optJSONObject.optInt("delay", 0); final String optString2 = optJSONObject.optString("fileURL"); final String optString3 = optJSONObject.optString(fc.c.c); final String optString4 = optJSONObject.optString(TJAdUnitConstants.String.HTML); JSONObject optJSONObject2 = optJSONObject.optJSONObject("rect"); Rect rect2 = new Rect(-999, -999, -999, -999); if (optJSONObject2 != null) { Rect rect3 = new Rect(optJSONObject2.optInt("left", -999), optJSONObject2.optInt("top", -999), optJSONObject2.optInt(TtmlNode.RIGHT, -999), optJSONObject2.optInt(Consts.SDK_BANNER_POSITION_BOTTOM, -999)); int optInt2 = optJSONObject2.optInt("width"); i3 = optJSONObject2.optInt("height"); rect = rect3; i2 = optInt2; } else { i2 = 0; i3 = 0; rect = rect2; } new Handler(Looper.getMainLooper()).postDelayed(new Runnable() { // from class: com.mbridge.msdk.video.bt.a.a.2 @Override // java.lang.Runnable public final void run() { String str; WindVaneWebView windVaneWebView = ((com.mbridge.msdk.mbsignalcommon.windvane.a) obj).b; if (windVaneWebView != null) { str = windVaneWebView.getRid(); } else { str = ""; windVaneWebView = null; } LinkedHashMap b2 = a.this.b(optString, str); String a2 = a.this.a(); a.b.put(a2, str); MBridgeBTWebView mBridgeBTWebView = new MBridgeBTWebView(com.mbridge.msdk.foundation.controller.c.m().c()); b2.put(a2, mBridgeBTWebView); mBridgeBTWebView.setInstanceId(a2); mBridgeBTWebView.setUnitId(optString); mBridgeBTWebView.setFileURL(optString2); mBridgeBTWebView.setFilePath(optString3); mBridgeBTWebView.setHtml(optString4); mBridgeBTWebView.setRect(rect); mBridgeBTWebView.setWebViewRid(str); mBridgeBTWebView.setCreateWebView(windVaneWebView); int i4 = i2; if (i4 > 0 || i3 > 0) { mBridgeBTWebView.setLayout(i4, i3); } mBridgeBTWebView.preload(); a.this.a(obj, a2); af.a("OperateViews", "createWebview instanceId = " + a2); } }, optInt); } catch (Throwable th) { c(obj, th.getMessage()); af.a("OperateViews", "createWebview failed:" + th.getMessage()); } } public final void c(Object obj, JSONObject jSONObject) { b unused; try { String optString = jSONObject.optString("unitId"); JSONObject optJSONObject = jSONObject.optJSONObject("data"); if (optJSONObject != null && !TextUtils.isEmpty(optString)) { String str = ""; CampaignEx parseCampaignWithBackData = CampaignEx.parseCampaignWithBackData(optJSONObject.optJSONObject(MBInterstitialActivity.INTENT_CAMAPIGN)); if (parseCampaignWithBackData != null && !TextUtils.isEmpty(optString)) { parseCampaignWithBackData.setCampaignUnitId(optString); str = parseCampaignWithBackData.getRequestId(); } int optInt = optJSONObject.optInt("show_time", 0); int optInt2 = optJSONObject.optInt("show_mute", 0); int optInt3 = optJSONObject.optInt("show_close", 0); int optInt4 = optJSONObject.optInt("orientation", 1); int optInt5 = optJSONObject.optInt("show_pgb", 0); MBridgeBTVideoView mBridgeBTVideoView = new MBridgeBTVideoView(com.mbridge.msdk.foundation.controller.c.m().c()); try { k kVar = (k) ((com.mbridge.msdk.mbsignalcommon.windvane.a) obj).b.getObject(); mBridgeBTVideoView.setAdEvents(kVar.l()); mBridgeBTVideoView.setAdSession(kVar.j()); mBridgeBTVideoView.setVideoEvents(kVar.k()); } catch (Exception e2) { af.b("OperateViews", e2.getMessage()); } mBridgeBTVideoView.setCampaign(parseCampaignWithBackData); mBridgeBTVideoView.setUnitId(optString); mBridgeBTVideoView.setShowMute(optInt2); mBridgeBTVideoView.setShowTime(optInt); mBridgeBTVideoView.setShowClose(optInt3); mBridgeBTVideoView.setOrientation(optInt4); mBridgeBTVideoView.setProgressBarState(optInt5); WindVaneWebView windVaneWebView = ((com.mbridge.msdk.mbsignalcommon.windvane.a) obj).b; if (windVaneWebView != null) { str = windVaneWebView.getRid(); mBridgeBTVideoView.setCreateWebView(windVaneWebView); } LinkedHashMap b2 = b(optString, str); String a2 = a(); b.put(a2, str); mBridgeBTVideoView.setInstanceId(a2); b2.put(a2, mBridgeBTVideoView); mBridgeBTVideoView.preLoadData(); if (parseCampaignWithBackData == null) { c(obj, "campaign is null"); af.a("OperateViews", "createPlayerView failed"); } else { a(obj, a2); af.a("OperateViews", "createPlayerView instanceId = " + a2); } unused = b.a.a; return; } c(obj, "unitId or data is empty"); } catch (Throwable th) { c(obj, th.getMessage()); af.a("OperateViews", "createPlayerView failed:" + th.getMessage()); } } public final void d(Object obj, JSONObject jSONObject) { WindVaneWebView windVaneWebView; try { String optString = jSONObject.optString("unitId"); JSONObject optJSONObject = jSONObject.optJSONObject("data"); if (optJSONObject != null && !TextUtils.isEmpty(optString)) { int optInt = optJSONObject.optInt(CampaignEx.JSON_NATIVE_VIDEO_MUTE); String str = ""; CampaignEx parseCampaignWithBackData = CampaignEx.parseCampaignWithBackData(optJSONObject.optJSONObject(MBInterstitialActivity.INTENT_CAMAPIGN)); if (parseCampaignWithBackData != null && !TextUtils.isEmpty(optString)) { parseCampaignWithBackData.setCampaignUnitId(optString); str = parseCampaignWithBackData.getRequestId(); } com.mbridge.msdk.videocommon.d.c a2 = com.mbridge.msdk.videocommon.d.c.a(optJSONObject.optJSONObject("unitSetting")); if (a2 != null) { a2.a(optString); } String optString2 = optJSONObject.optString("userId"); if (TextUtils.isEmpty(str) && (windVaneWebView = ((com.mbridge.msdk.mbsignalcommon.windvane.a) obj).b) != null) { str = windVaneWebView.getRid(); } LinkedHashMap b2 = b(optString, str); String a3 = a(); b.put(a3, str); MBTempContainer mBTempContainer = new MBTempContainer(com.mbridge.msdk.foundation.controller.c.m().c()); try { k kVar = (k) ((com.mbridge.msdk.mbsignalcommon.windvane.a) obj).b.getObject(); mBTempContainer.setAdEvents(kVar.l()); mBTempContainer.setAdSession(kVar.j()); mBTempContainer.setVideoEvents(kVar.k()); } catch (Exception e2) { af.b("OperateViews", e2.getMessage()); } mBTempContainer.setInstanceId(a3); mBTempContainer.setUnitId(optString); mBTempContainer.setCampaign(parseCampaignWithBackData); mBTempContainer.setRewardUnitSetting(a2); mBTempContainer.setBigOffer(true); if (!TextUtils.isEmpty(optString2)) { mBTempContainer.setUserId(optString2); } JSONObject optJSONObject2 = optJSONObject.optJSONObject("reward"); if (optJSONObject2 != null) { String optString3 = optJSONObject2.optString("id"); com.mbridge.msdk.videocommon.b.c cVar = new com.mbridge.msdk.videocommon.b.c(optJSONObject2.optString("name"), optJSONObject2.optInt("amount")); if (!TextUtils.isEmpty(optString3)) { mBTempContainer.setRewardId(optString3); } if (!TextUtils.isEmpty(cVar.a())) { mBTempContainer.setReward(cVar); } } String optString4 = optJSONObject.optString("extra"); if (!TextUtils.isEmpty(optString4)) { mBTempContainer.setDeveloperExtraData(optString4); } mBTempContainer.setMute(optInt); b2.put(a3, mBTempContainer); e.put(a3, optString); c.put(a3, parseCampaignWithBackData); d.put(a3, a2); a(obj, a3); af.a("OperateViews", "createSubPlayTemplateView instanceId = " + a3); return; } c(obj, "unitId or data is empty"); } catch (Throwable th) { c(obj, th.getMessage()); af.a("OperateViews", "createSubPlayTemplateView failed:" + th.getMessage()); } } public final void e(Object obj, JSONObject jSONObject) { WindVaneWebView windVaneWebView; try { String optString = jSONObject.optString("unitId"); String optString2 = jSONObject.optString("id"); if (jSONObject.optJSONObject("data") != null && !TextUtils.isEmpty(optString)) { String h2 = h(optString2); if (TextUtils.isEmpty(h2) && (windVaneWebView = ((com.mbridge.msdk.mbsignalcommon.windvane.a) obj).b) != null) { h2 = windVaneWebView.getRid(); } LinkedHashMap b2 = b(optString, h2); if (b2 != null && b2.containsKey(optString2)) { View view = b2.get(optString2); b2.remove(optString2); if (view != null && view.getParent() != null) { ViewGroup viewGroup = (ViewGroup) view.getParent(); if (viewGroup != null) { viewGroup.removeView(view); } if (view instanceof ViewGroup) { ViewGroup viewGroup2 = (ViewGroup) view; if (viewGroup2.getChildCount() > 0) { int childCount = viewGroup2.getChildCount(); for (int i2 = 0; i2 < childCount; i2++) { View childAt = viewGroup2.getChildAt(i2); if (childAt instanceof MBridgeBTWebView) { b2.remove(((MBridgeBTWebView) childAt).getInstanceId()); ((MBridgeBTWebView) childAt).onDestory(); } else if (childAt instanceof MBridgeBTVideoView) { b2.remove(((MBridgeBTVideoView) childAt).getInstanceId()); ((MBridgeBTVideoView) childAt).onDestory(); } else if (childAt instanceof MBTempContainer) { b2.remove(((MBTempContainer) childAt).getInstanceId()); ((MBTempContainer) childAt).onDestroy(); } } } } } if (view instanceof MBTempContainer) { ((MBTempContainer) view).onDestroy(); } if (view instanceof MBridgeBTWebView) { ((MBridgeBTWebView) view).onDestory(); } if (view instanceof MBridgeBTVideoView) { ((MBridgeBTVideoView) view).onDestory(); } a(obj, optString2); a(obj, "onComponentDestroy", optString2); af.a("OperateViews", "destroyComponent instanceId = " + optString2); return; } c(obj, "unitId or instanceId not exist"); af.a("OperateViews", "destroyComponent failed"); return; } c(obj, "unidId or data is empty"); } catch (Throwable th) { c(obj, th.getMessage()); af.a("OperateViews", "destroyComponent failed"); } } public final void f(Object obj, JSONObject jSONObject) { try { jSONObject.optString("unitId"); String optString = jSONObject.optString("id"); if (jSONObject.optJSONObject("data") == null) { c(obj, "data is empty"); } else { a(obj, optString); } } catch (Throwable th) { c(obj, th.getMessage()); } } public final void g(Object obj, JSONObject jSONObject) { WindVaneWebView windVaneWebView; try { String optString = jSONObject.optString("unitId"); String optString2 = jSONObject.optString("id"); String h2 = h(optString2); if (TextUtils.isEmpty(h2) && (windVaneWebView = ((com.mbridge.msdk.mbsignalcommon.windvane.a) obj).b) != null) { h2 = windVaneWebView.getRid(); } JSONObject optJSONObject = jSONObject.optJSONObject("data"); if (optJSONObject == null) { c(obj, "data is empty"); return; } JSONObject optJSONObject2 = optJSONObject.optJSONObject("rect"); if (optJSONObject2 == null) { c(obj, "rect not exist"); return; } LinkedHashMap b2 = b(optString, h2); Rect rect = new Rect(optJSONObject2.optInt("left", -999), optJSONObject2.optInt("top", -999), optJSONObject2.optInt(TtmlNode.RIGHT, -999), optJSONObject2.optInt(Consts.SDK_BANNER_POSITION_BOTTOM, -999)); int optInt = optJSONObject2.optInt("width"); int optInt2 = optJSONObject2.optInt("height"); if (b2.containsKey(optString2)) { View view = b2.get(optString2); if (view != null) { if (view.getParent() != null) { view.setLayoutParams(a(view.getLayoutParams(), rect, optInt, optInt2)); view.requestLayout(); } else { if (view instanceof MBridgeBTWebView) { ((MBridgeBTWebView) view).setRect(rect); ((MBridgeBTWebView) view).setLayout(optInt, optInt2); } if (view instanceof MBridgeBTVideoView) { ((MBridgeBTVideoView) view).setRect(rect); ((MBridgeBTVideoView) view).setLayout(optInt, optInt2); } } a(obj, optString2); a(obj, "onViewRectChanged", optString2); af.a("OperateViews", "setViewRect instanceId = " + optString2); return; } c(obj, "view is null"); af.a("OperateViews", "setViewRect failed: view is null"); return; } c(obj, "instanceId not exist"); af.a("OperateViews", "setViewRect failed: instanceId not exist"); } catch (Throwable th) { c(obj, th.getMessage()); af.a("OperateViews", "setViewRect failed: " + th.getMessage()); } } /* JADX WARN: Multi-variable type inference failed */ /* JADX WARN: Type inference failed for: r5v0, types: [android.view.ViewGroup$LayoutParams] */ /* JADX WARN: Type inference failed for: r5v1, types: [android.view.ViewGroup$LayoutParams] */ /* JADX WARN: Type inference failed for: r5v2, types: [android.widget.LinearLayout$LayoutParams] */ private ViewGroup.LayoutParams a(ViewGroup.LayoutParams layoutParams, Rect rect, int i2, int i3) { if (rect == null) { rect = new Rect(-999, -999, -999, -999); } Context c2 = com.mbridge.msdk.foundation.controller.c.m().c(); if (c2 == null) { return layoutParams; } if (layoutParams instanceof FrameLayout.LayoutParams) { FrameLayout.LayoutParams layoutParams2 = new FrameLayout.LayoutParams(-1, -1); int i4 = rect.left; if (i4 != -999) { layoutParams2.leftMargin = ak.a(c2, i4); } int i5 = rect.top; if (i5 != -999) { layoutParams2.topMargin = ak.a(c2, i5); } int i6 = rect.right; if (i6 != -999) { layoutParams2.rightMargin = ak.a(c2, i6); } int i7 = rect.bottom; if (i7 != -999) { layoutParams2.bottomMargin = ak.a(c2, i7); } if (i2 > 0) { layoutParams2.width = ak.a(c2, i2); } if (i3 > 0) { layoutParams2.height = ak.a(c2, i3); } return layoutParams2; } if (layoutParams instanceof RelativeLayout.LayoutParams) { RelativeLayout.LayoutParams layoutParams3 = new RelativeLayout.LayoutParams(-1, -1); int i8 = rect.left; if (i8 != -999) { layoutParams3.leftMargin = ak.a(c2, i8); } int i9 = rect.top; if (i9 != -999) { layoutParams3.topMargin = ak.a(c2, i9); } int i10 = rect.right; if (i10 != -999) { layoutParams3.rightMargin = ak.a(c2, i10); } int i11 = rect.bottom; if (i11 != -999) { layoutParams3.bottomMargin = ak.a(c2, i11); } if (i2 > 0) { layoutParams3.width = ak.a(c2, i2); } if (i3 > 0) { layoutParams3.height = ak.a(c2, i3); } return layoutParams3; } if (layoutParams instanceof LinearLayout.LayoutParams) { layoutParams = new LinearLayout.LayoutParams(-1, -1); int i12 = rect.left; if (i12 != -999) { ((LinearLayout.LayoutParams) layoutParams).leftMargin = ak.a(c2, i12); } int i13 = rect.top; if (i13 != -999) { ((LinearLayout.LayoutParams) layoutParams).topMargin = ak.a(c2, i13); } int i14 = rect.right; if (i14 != -999) { ((LinearLayout.LayoutParams) layoutParams).rightMargin = ak.a(c2, i14); } int i15 = rect.bottom; if (i15 != -999) { ((LinearLayout.LayoutParams) layoutParams).bottomMargin = ak.a(c2, i15); } if (i2 > 0) { ((LinearLayout.LayoutParams) layoutParams).width = ak.a(c2, i2); } if (i3 > 0) { ((LinearLayout.LayoutParams) layoutParams).height = ak.a(c2, i3); } } return layoutParams; } public final void h(Object obj, JSONObject jSONObject) { WindVaneWebView windVaneWebView; try { String optString = jSONObject.optString("unitId"); String optString2 = jSONObject.optString("id"); String h2 = h(optString2); if (TextUtils.isEmpty(h2) && (windVaneWebView = ((com.mbridge.msdk.mbsignalcommon.windvane.a) obj).b) != null) { h2 = windVaneWebView.getRid(); } if (jSONObject.optJSONObject("data") == null) { c(obj, "data is empty"); return; } LinkedHashMap b2 = b(optString, h2); if (b2.containsKey(optString2)) { View view = b2.get(optString2); if (view != null && view.getParent() != null) { ViewGroup viewGroup = (ViewGroup) view.getParent(); if (viewGroup != null) { viewGroup.removeView(view); a(obj, optString2); a(obj, "onRemoveFromView", optString2); af.a("OperateViews", "removeFromSuperView instanceId = " + optString2); return; } c(obj, "parent is null"); af.a("OperateViews", "removeFromSuperView failed: parent is null instanceId = " + optString2); return; } c(obj, "view is null"); af.a("OperateViews", "removeFromSuperView failed: view is null instanceId = " + optString2); return; } c(obj, "params not enough"); af.a("OperateViews", "removeFromSuperView failed: params not enough instanceId = " + optString2); } catch (Throwable th) { c(obj, th.getMessage()); af.a("OperateViews", "removeFromSuperView failed: " + th.getMessage()); } } /* JADX WARN: Code restructure failed: missing block: B:29:0x00da, code lost: com.mbridge.msdk.foundation.tools.at.a(r5); */ /* JADX WARN: Code restructure failed: missing block: B:31:0x00dd, code lost: r2 = (com.mbridge.msdk.video.bt.module.MBTempContainer) r5; r6 = (com.mbridge.msdk.video.signal.a.k) ((com.mbridge.msdk.mbsignalcommon.windvane.a) r13).b.getObject(); r2.setAdEvents(r6.l()); r2.setAdSession(r6.j()); r2.setVideoEvents(r6.k()); */ /* JADX WARN: Code restructure failed: missing block: B:36:0x0101, code lost: r2 = move-exception; */ /* JADX WARN: Code restructure failed: missing block: B:37:0x0102, code lost: com.mbridge.msdk.foundation.tools.af.b("OperateViews", r2.getMessage()); */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public final void i(java.lang.Object r13, org.json.JSONObject r14) { /* Method dump skipped, instructions count: 484 To view this dump add '--comments-level debug' option */ throw new UnsupportedOperationException("Method not decompiled: com.mbridge.msdk.video.bt.a.a.i(java.lang.Object, org.json.JSONObject):void"); } public final void j(Object obj, JSONObject jSONObject) { int optInt; int optInt2; Rect rect; WindVaneWebView windVaneWebView; try { String optString = jSONObject.optString("unitId"); String optString2 = jSONObject.optString("id"); String h2 = h(optString2); if (TextUtils.isEmpty(h2) && (windVaneWebView = ((com.mbridge.msdk.mbsignalcommon.windvane.a) obj).b) != null) { h2 = windVaneWebView.getRid(); } JSONObject optJSONObject = jSONObject.optJSONObject("data"); if (optJSONObject != null && !TextUtils.isEmpty(optString)) { String optString3 = optJSONObject.optString("id"); LinkedHashMap b2 = b(optString, h2); if (b2.containsKey(optString2) && b2.containsKey(optString3)) { ViewGroup viewGroup = (ViewGroup) b2.get(optString3); View view = b2.get(optString2); at.a(view); if (viewGroup != null && view != null) { JSONObject optJSONObject2 = optJSONObject.optJSONObject("rect"); if (view instanceof MBTempContainer) { Iterator it = b2.values().iterator(); while (true) { if (!it.hasNext()) { break; } View next = it.next(); if (next instanceof MBridgeBTContainer) { at.a(view); ((MBridgeBTContainer) next).appendSubView((MBridgeBTContainer) next, (MBTempContainer) view, optJSONObject2); break; } } } else { if (optJSONObject2 == null) { if (view instanceof BTBaseView) { rect = ((BTBaseView) view).getRect(); optInt = ((BTBaseView) view).getViewWidth(); optInt2 = ((BTBaseView) view).getViewHeight(); } else { optInt = 0; rect = null; optInt2 = 0; } } else { Rect rect2 = new Rect(optJSONObject2.optInt("left", -999), optJSONObject2.optInt("top", -999), optJSONObject2.optInt(TtmlNode.RIGHT, -999), optJSONObject2.optInt(Consts.SDK_BANNER_POSITION_BOTTOM, -999)); optInt = optJSONObject2.optInt("width"); optInt2 = optJSONObject2.optInt("height"); rect = rect2; } ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(-1, -1); if (viewGroup instanceof FrameLayout) { layoutParams = new FrameLayout.LayoutParams(-1, -1); } else if (viewGroup instanceof RelativeLayout) { layoutParams = new RelativeLayout.LayoutParams(-1, -1); } else if (viewGroup instanceof LinearLayout) { layoutParams = new LinearLayout.LayoutParams(-1, -1); } ViewGroup.LayoutParams a2 = a(layoutParams, rect, optInt, optInt2); at.a(view); viewGroup.addView(view, a2); } a(obj, optString2); a(obj, "onAppendViewTo", optString2); af.a("OperateViews", "appendViewTo parentId = " + optString3 + " childId = " + optString2); return; } c(obj, "view is not exist"); return; } c(obj, "instanceId is not exist"); af.a("OperateViews", "appendViewTo failed: instanceId is not exist"); return; } c(obj, "unitId or data is empty"); } catch (Throwable th) { c(obj, th.getMessage()); af.a("OperateViews", "appendViewTo failed: " + th.getMessage()); } } public final void k(Object obj, JSONObject jSONObject) { int optInt; Rect rect; WindVaneWebView windVaneWebView; try { String optString = jSONObject.optString("unitId"); String optString2 = jSONObject.optString("id"); String h2 = h(optString2); if (TextUtils.isEmpty(h2) && (windVaneWebView = ((com.mbridge.msdk.mbsignalcommon.windvane.a) obj).b) != null) { h2 = windVaneWebView.getRid(); } JSONObject optJSONObject = jSONObject.optJSONObject("data"); if (optJSONObject == null) { c(obj, "data is empty"); return; } String optString3 = optJSONObject.optString("id"); LinkedHashMap b2 = b(optString, h2); if (b2.containsKey(optString3) && b2.containsKey(optString2)) { ViewGroup viewGroup = (ViewGroup) b2.get(optString2); View view = b2.get(optString3); if (viewGroup != null && view != null) { JSONObject optJSONObject2 = optJSONObject.optJSONObject("rect"); int i2 = 0; if (view instanceof MBTempContainer) { af.b("OperateViews", "OperateViews setNotchString = " + String.format("%1$s-%2$s-%3$s-%4$s-%5$s", Integer.valueOf(l), Integer.valueOf(m), Integer.valueOf(n), Integer.valueOf(o), Integer.valueOf(p))); ((MBTempContainer) view).setNotchPadding(l, m, n, o, p); Iterator it = b2.values().iterator(); while (true) { if (!it.hasNext()) { break; } View next = it.next(); if (next instanceof MBridgeBTContainer) { at.a(view); ((MBridgeBTContainer) next).appendSubView((MBridgeBTContainer) next, (MBTempContainer) view, optJSONObject2); break; } } } else { if (optJSONObject2 == null) { if (view instanceof BTBaseView) { rect = ((BTBaseView) view).getRect(); i2 = ((BTBaseView) view).getViewWidth(); optInt = ((BTBaseView) view).getViewHeight(); } else { rect = null; optInt = 0; } } else { Rect rect2 = new Rect(optJSONObject2.optInt("left", -999), optJSONObject2.optInt("top", -999), optJSONObject2.optInt(TtmlNode.RIGHT, -999), optJSONObject2.optInt(Consts.SDK_BANNER_POSITION_BOTTOM, -999)); i2 = optJSONObject2.optInt("width"); optInt = optJSONObject2.optInt("height"); rect = rect2; } ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(-1, -1); if (viewGroup instanceof FrameLayout) { layoutParams = new FrameLayout.LayoutParams(-1, -1); } else if (viewGroup instanceof RelativeLayout) { layoutParams = new RelativeLayout.LayoutParams(-1, -1); } else if (viewGroup instanceof LinearLayout) { layoutParams = new LinearLayout.LayoutParams(-1, -1); } viewGroup.addView(view, a(layoutParams, rect, i2, optInt)); } a(obj, optString2); a(obj, "onAppendView", optString2); af.a("OperateViews", "appendSubView parentId = " + optString2 + " childId = " + optString3); return; } c(obj, "view is not exist"); return; } c(obj, "instanceId is not exist"); af.a("OperateViews", "appendSubView failed: instanceId is not exist"); } catch (Throwable th) { c(obj, th.getMessage()); af.a("OperateViews", "appendSubView failed: " + th.getMessage()); } } public final void l(Object obj, JSONObject jSONObject) { int optInt; int optInt2; Rect rect; WindVaneWebView windVaneWebView; try { String optString = jSONObject.optString("unitId"); String optString2 = jSONObject.optString("id"); String h2 = h(optString2); if (TextUtils.isEmpty(h2) && (windVaneWebView = ((com.mbridge.msdk.mbsignalcommon.windvane.a) obj).b) != null) { h2 = windVaneWebView.getRid(); } JSONObject optJSONObject = jSONObject.optJSONObject("data"); if (optJSONObject != null && !TextUtils.isEmpty(optString)) { String optString3 = optJSONObject.optString("id"); LinkedHashMap b2 = b(optString, h2); if (b2.containsKey(optString2) && b2.containsKey(optString3)) { ViewGroup viewGroup = (ViewGroup) b2.get(optString3); View view = b2.get(optString2); if (viewGroup != null && view != null) { JSONObject optJSONObject2 = optJSONObject.optJSONObject("rect"); if (view instanceof MBTempContainer) { Iterator it = b2.values().iterator(); while (true) { if (!it.hasNext()) { break; } View next = it.next(); if (next instanceof MBridgeBTContainer) { at.a(view); ((MBridgeBTContainer) next).appendSubView((MBridgeBTContainer) next, (MBTempContainer) view, optJSONObject2); break; } } } else { if (optJSONObject2 == null) { if (view instanceof BTBaseView) { rect = ((BTBaseView) view).getRect(); optInt = ((BTBaseView) view).getViewWidth(); optInt2 = ((BTBaseView) view).getViewHeight(); } else { optInt = 0; rect = null; optInt2 = 0; } } else { Rect rect2 = new Rect(optJSONObject2.optInt("left", -999), optJSONObject2.optInt("top", -999), optJSONObject2.optInt(TtmlNode.RIGHT, -999), optJSONObject2.optInt(Consts.SDK_BANNER_POSITION_BOTTOM, -999)); optInt = optJSONObject2.optInt("width"); optInt2 = optJSONObject2.optInt("height"); rect = rect2; } ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(-1, -1); if (viewGroup instanceof FrameLayout) { layoutParams = new FrameLayout.LayoutParams(-1, -1); } else if (viewGroup instanceof RelativeLayout) { layoutParams = new RelativeLayout.LayoutParams(-1, -1); } else if (viewGroup instanceof LinearLayout) { layoutParams = new LinearLayout.LayoutParams(-1, -1); } viewGroup.addView(view, a(layoutParams, rect, optInt, optInt2)); } a(obj, optString2); a(obj, "onAppendViewTo", optString2); af.a("OperateViews", "appendViewTo parentId = " + optString3 + " childId = " + optString2); return; } c(obj, "view is not exist"); return; } c(obj, "instanceId is not exist"); af.a("OperateViews", "appendViewTo failed: instanceId is not exist"); return; } c(obj, "unitId or data is empty"); } catch (Throwable th) { c(obj, th.getMessage()); af.a("OperateViews", "appendViewTo failed: " + th.getMessage()); } } public final void m(Object obj, JSONObject jSONObject) { WindVaneWebView windVaneWebView; try { String optString = jSONObject.optString("unitId"); String optString2 = jSONObject.optString("id"); String h2 = h(optString2); if (TextUtils.isEmpty(h2) && (windVaneWebView = ((com.mbridge.msdk.mbsignalcommon.windvane.a) obj).b) != null) { h2 = windVaneWebView.getRid(); } if (jSONObject.optJSONObject("data") == null) { c(obj, "data is empty"); return; } LinkedHashMap b2 = b(optString, h2); if (b2.containsKey(optString2)) { View view = b2.get(optString2); if (view != null && view.getParent() != null) { ViewGroup viewGroup = (ViewGroup) view.getParent(); if (viewGroup != null) { viewGroup.bringChildToFront(view); a(obj, optString2); a(obj, "onBringViewToFront", optString2); af.a("OperateViews", "bringViewToFront instanceId = " + optString2); return; } c(obj, "parent is null"); af.a("OperateViews", "bringViewToFront failed: parent is null"); return; } c(obj, "view is null"); af.a("OperateViews", "bringViewToFront failed: view is null"); return; } c(obj, "instanceId is not exist"); af.a("OperateViews", "bringViewToFront failed: instanceId is not exist"); } catch (Throwable th) { c(obj, th.getMessage()); af.a("OperateViews", "bringViewToFront failed: " + th.getMessage()); } } public final void n(Object obj, JSONObject jSONObject) { WindVaneWebView windVaneWebView; try { String optString = jSONObject.optString("unitId"); String optString2 = jSONObject.optString("id"); String h2 = h(optString2); if (TextUtils.isEmpty(h2) && (windVaneWebView = ((com.mbridge.msdk.mbsignalcommon.windvane.a) obj).b) != null) { h2 = windVaneWebView.getRid(); } if (jSONObject.optJSONObject("data") == null) { c(obj, "data is empty"); return; } LinkedHashMap b2 = b(optString, h2); if (b2.containsKey(optString2)) { View view = b2.get(optString2); if (view != null) { view.setVisibility(8); a(obj, optString2); a(obj, "onHideView", optString2); af.a("OperateViews", "hideView instanceId = " + optString2); return; } c(obj, "view not exist"); af.a("OperateViews", "hideView failed: view not exist"); return; } c(obj, "instanceId not exist"); af.a("OperateViews", "hideView failed: instanceId not exist"); } catch (Throwable th) { c(obj, th.getMessage()); af.a("OperateViews", "hideView failed: + " + th.getMessage()); } } public final void o(Object obj, JSONObject jSONObject) { WindVaneWebView windVaneWebView; try { String optString = jSONObject.optString("unitId"); String optString2 = jSONObject.optString("id"); String h2 = h(optString2); if (TextUtils.isEmpty(h2) && (windVaneWebView = ((com.mbridge.msdk.mbsignalcommon.windvane.a) obj).b) != null) { h2 = windVaneWebView.getRid(); } if (jSONObject.optJSONObject("data") == null) { c(obj, "data is empty"); return; } LinkedHashMap b2 = b(optString, h2); if (b2.containsKey(optString2)) { View view = b2.get(optString2); if (view != null) { view.setVisibility(0); a(obj, optString2); a(obj, "onShowView", optString2); af.a("OperateViews", "showView instanceId = " + optString2); return; } c(obj, "view not exist"); af.a("OperateViews", "showView failed: view not exist instanceId = " + optString2); return; } c(obj, "instanceId not exist"); af.a("OperateViews", "showView failed: instanceId not exist instanceId = " + optString2); } catch (Throwable th) { c(obj, th.getMessage()); af.a("OperateViews", "showView failed: " + th.getMessage()); } } public final void p(Object obj, JSONObject jSONObject) { WindVaneWebView windVaneWebView; try { String optString = jSONObject.optString("unitId"); String optString2 = jSONObject.optString("id"); String h2 = h(optString2); if (TextUtils.isEmpty(h2) && (windVaneWebView = ((com.mbridge.msdk.mbsignalcommon.windvane.a) obj).b) != null) { h2 = windVaneWebView.getRid(); } JSONObject optJSONObject = jSONObject.optJSONObject("data"); if (optJSONObject == null) { c(obj, "data is empty"); return; } String optString3 = optJSONObject.optString("color"); if (TextUtils.isEmpty(optString3)) { c(obj, "color is not exist"); return; } LinkedHashMap b2 = b(optString, h2); if (b2.containsKey(optString2)) { View view = b2.get(optString2); if (view != null) { a(obj, optString2); view.setBackgroundColor(Color.parseColor(optString3)); a(obj, "onViewBgColorChanged", optString2); af.a("OperateViews", "setViewBgColor instanceId = " + optString2); return; } c(obj, "view not exist"); af.a("OperateViews", "setViewBgColor failed: view not exist instanceId = " + optString2); return; } c(obj, "instanceId not exist"); af.a("OperateViews", "setViewBgColor failed: instanceId not exist instanceId = " + optString2); } catch (Throwable th) { c(obj, th.getMessage()); af.a("OperateViews", "setViewBgColor failed: " + th.getMessage()); } } public final void q(Object obj, JSONObject jSONObject) { WindVaneWebView windVaneWebView; try { String optString = jSONObject.optString("unitId"); String optString2 = jSONObject.optString("id"); String h2 = h(optString2); if (TextUtils.isEmpty(h2) && (windVaneWebView = ((com.mbridge.msdk.mbsignalcommon.windvane.a) obj).b) != null) { h2 = windVaneWebView.getRid(); } JSONObject optJSONObject = jSONObject.optJSONObject("data"); if (optJSONObject == null) { c(obj, "data is empty"); return; } double optDouble = optJSONObject.optDouble("alpha", 1.0d); LinkedHashMap b2 = b(optString, h2); if (b2.containsKey(optString2)) { View view = b2.get(optString2); if (view != null) { view.setAlpha((float) optDouble); a(obj, optString2); a(obj, "onViewAlphaChanged", optString2); af.a("OperateViews", "setViewAlpha instanceId = " + optString2); return; } c(obj, "view not exist"); af.a("OperateViews", "setViewAlpha failed: view not exist instanceId = " + optString2); return; } c(obj, "instanceId not exist"); af.a("OperateViews", "setViewAlpha failed: instanceId not exist instanceId = " + optString2); } catch (Throwable th) { c(obj, th.getMessage()); af.a("OperateViews", "setViewAlpha failed: " + th.getMessage()); } } public final void r(Object obj, JSONObject jSONObject) { WindVaneWebView windVaneWebView; try { String optString = jSONObject.optString("unitId"); String optString2 = jSONObject.optString("id"); String h2 = h(optString2); if (TextUtils.isEmpty(h2) && (windVaneWebView = ((com.mbridge.msdk.mbsignalcommon.windvane.a) obj).b) != null) { h2 = windVaneWebView.getRid(); } JSONObject optJSONObject = jSONObject.optJSONObject("data"); if (optJSONObject == null) { c(obj, "data is empty"); return; } double optDouble = optJSONObject.optDouble("vertical", 1.0d); double optDouble2 = optJSONObject.optDouble("horizon", 1.0d); LinkedHashMap b2 = b(optString, h2); if (b2.containsKey(optString2)) { View view = b2.get(optString2); if (view != null) { view.setScaleX((float) optDouble2); view.setScaleY((float) optDouble); a(obj, optString2); a(obj, "onViewScaleChanged", optString2); af.a("OperateViews", "setViewScale instanceId = " + optString2); return; } c(obj, "view not exist"); af.a("OperateViews", "setViewScale failed: view not exist instanceId = " + optString2); return; } c(obj, "instanceId not exist"); af.a("OperateViews", "setViewScale failed: instanceId not exist instanceId = " + optString2); } catch (Throwable th) { c(obj, th.getMessage()); af.a("OperateViews", "setViewScale failed: " + th.getMessage()); } } public final void a(Object obj, JSONObject jSONObject, boolean z) { int optInt; int optInt2; Rect rect; WindVaneWebView windVaneWebView; try { String optString = jSONObject.optString("unitId"); String optString2 = jSONObject.optString("id"); String h2 = h(optString2); if (TextUtils.isEmpty(h2) && (windVaneWebView = ((com.mbridge.msdk.mbsignalcommon.windvane.a) obj).b) != null) { h2 = windVaneWebView.getRid(); } JSONObject optJSONObject = jSONObject.optJSONObject("data"); if (optJSONObject == null) { c(obj, "data is empty"); return; } String optString3 = optJSONObject.optString("targetComponentId"); JSONObject optJSONObject2 = optJSONObject.optJSONObject("rect"); LinkedHashMap b2 = b(optString, h2); if (b2.containsKey(optString2) && b2.containsKey(optString3)) { View view = b2.get(optString2); View view2 = b2.get(optString3); if (view2 != null && view2.getParent() != null) { ViewGroup viewGroup = (ViewGroup) view2.getParent(); int indexOfChild = viewGroup.indexOfChild(view2); if (optJSONObject2 == null) { if (view instanceof BTBaseView) { rect = ((BTBaseView) view).getRect(); optInt = ((BTBaseView) view).getViewWidth(); optInt2 = ((BTBaseView) view).getViewHeight(); } else { optInt = 0; rect = null; optInt2 = 0; } } else { Rect rect2 = new Rect(optJSONObject2.optInt("left", -999), optJSONObject2.optInt("top", -999), optJSONObject2.optInt(TtmlNode.RIGHT, -999), optJSONObject2.optInt(Consts.SDK_BANNER_POSITION_BOTTOM, -999)); optInt = optJSONObject2.optInt("width"); optInt2 = optJSONObject2.optInt("height"); rect = rect2; } ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(-1, -1); if (viewGroup instanceof FrameLayout) { layoutParams = new FrameLayout.LayoutParams(-1, -1); } else if (viewGroup instanceof RelativeLayout) { layoutParams = new RelativeLayout.LayoutParams(-1, -1); } else if (viewGroup instanceof LinearLayout) { layoutParams = new LinearLayout.LayoutParams(-1, -1); } ViewGroup.LayoutParams a2 = a(layoutParams, rect, optInt, optInt2); if (z) { at.a(view); } viewGroup.addView(view, indexOfChild + 1, a2); a(obj, optString2); a(obj, "onInsertViewAbove", optString2); af.a("OperateViews", "insertViewAbove instanceId = " + optString2 + " brotherId = " + optString3); return; } c(obj, "view not exist"); af.a("OperateViews", "insertViewAbove failed: view not exist instanceId = " + optString2); return; } c(obj, "instanceId not exist"); af.a("OperateViews", "insertViewAbove failed: instanceId not exist instanceId = " + optString2); } catch (Throwable th) { c(obj, th.getMessage()); af.a("OperateViews", "insertViewAbove failed: " + th.getMessage()); } } public final void b(Object obj, JSONObject jSONObject, boolean z) { int optInt; int optInt2; Rect rect; WindVaneWebView windVaneWebView; try { String optString = jSONObject.optString("unitId"); String optString2 = jSONObject.optString("id"); String h2 = h(optString2); if (TextUtils.isEmpty(h2) && (windVaneWebView = ((com.mbridge.msdk.mbsignalcommon.windvane.a) obj).b) != null) { h2 = windVaneWebView.getRid(); } JSONObject optJSONObject = jSONObject.optJSONObject("data"); if (optJSONObject == null) { c(obj, "data is empty"); return; } String optString3 = optJSONObject.optString("targetComponentId"); JSONObject optJSONObject2 = optJSONObject.optJSONObject("rect"); LinkedHashMap b2 = b(optString, h2); if (b2.containsKey(optString2) && b2.containsKey(optString3)) { View view = b2.get(optString2); View view2 = b2.get(optString3); if (view2 != null && view2.getParent() != null) { ViewGroup viewGroup = (ViewGroup) view2.getParent(); int indexOfChild = viewGroup.indexOfChild(view2); if (optJSONObject2 == null) { if (view instanceof BTBaseView) { rect = ((BTBaseView) view).getRect(); optInt = ((BTBaseView) view).getViewWidth(); optInt2 = ((BTBaseView) view).getViewHeight(); } else { rect = null; optInt = 0; optInt2 = 0; } } else { Rect rect2 = new Rect(optJSONObject2.optInt("left", -999), optJSONObject2.optInt("top", -999), optJSONObject2.optInt(TtmlNode.RIGHT, -999), optJSONObject2.optInt(Consts.SDK_BANNER_POSITION_BOTTOM, -999)); optInt = optJSONObject2.optInt("width"); optInt2 = optJSONObject2.optInt("height"); rect = rect2; } ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(-1, -1); if (viewGroup instanceof FrameLayout) { layoutParams = new FrameLayout.LayoutParams(-1, -1); } else if (viewGroup instanceof RelativeLayout) { layoutParams = new RelativeLayout.LayoutParams(-1, -1); } else if (viewGroup instanceof LinearLayout) { layoutParams = new LinearLayout.LayoutParams(-1, -1); } ViewGroup.LayoutParams a2 = a(layoutParams, rect, optInt, optInt2); if (z) { at.a(view); } int i2 = indexOfChild - 1; viewGroup.addView(view, i2 > -1 ? i2 : 0, a2); a(obj, optString2); a(obj, "onInsertViewBelow", optString2); af.a("OperateViews", "insertViewBelow instanceId = " + optString2); return; } c(obj, "view not exist"); af.a("OperateViews", "insertViewBelow failed: view not exist instanceId = " + optString2); return; } c(obj, "instanceId not exist"); af.a("OperateViews", "insertViewBelow failed: instanceId not exist instanceId = " + optString2); } catch (Throwable th) { c(obj, th.getMessage()); af.a("OperateViews", "insertViewBelow failed: " + th.getMessage()); } } public final void s(Object obj, JSONObject jSONObject) { int optInt; int optInt2; Rect rect; WindVaneWebView windVaneWebView; try { String optString = jSONObject.optString("unitId"); String optString2 = jSONObject.optString("id"); String h2 = h(optString2); if (TextUtils.isEmpty(h2) && (windVaneWebView = ((com.mbridge.msdk.mbsignalcommon.windvane.a) obj).b) != null) { h2 = windVaneWebView.getRid(); } JSONObject optJSONObject = jSONObject.optJSONObject("data"); if (optJSONObject == null) { c(obj, "data is empty"); return; } String optString3 = optJSONObject.optString("targetComponentId"); JSONObject optJSONObject2 = optJSONObject.optJSONObject("rect"); LinkedHashMap b2 = b(optString, h2); if (b2.containsKey(optString2) && b2.containsKey(optString3)) { View view = b2.get(optString2); View view2 = b2.get(optString3); if (view2 != null && view2.getParent() != null) { ViewGroup viewGroup = (ViewGroup) view2.getParent(); int indexOfChild = viewGroup.indexOfChild(view2); if (optJSONObject2 == null) { if (view instanceof BTBaseView) { rect = ((BTBaseView) view).getRect(); optInt = ((BTBaseView) view).getViewWidth(); optInt2 = ((BTBaseView) view).getViewHeight(); } else { optInt = 0; rect = null; optInt2 = 0; } } else { Rect rect2 = new Rect(optJSONObject2.optInt("left", -999), optJSONObject2.optInt("top", -999), optJSONObject2.optInt(TtmlNode.RIGHT, -999), optJSONObject2.optInt(Consts.SDK_BANNER_POSITION_BOTTOM, -999)); optInt = optJSONObject2.optInt("width"); optInt2 = optJSONObject2.optInt("height"); rect = rect2; } ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(-1, -1); if (viewGroup instanceof FrameLayout) { layoutParams = new FrameLayout.LayoutParams(-1, -1); } else if (viewGroup instanceof RelativeLayout) { layoutParams = new RelativeLayout.LayoutParams(-1, -1); } else if (viewGroup instanceof LinearLayout) { layoutParams = new LinearLayout.LayoutParams(-1, -1); } viewGroup.addView(view, indexOfChild + 1, a(layoutParams, rect, optInt, optInt2)); a(obj, optString2); a(obj, "onInsertViewAbove", optString2); af.a("OperateViews", "insertViewAbove instanceId = " + optString2 + " brotherId = " + optString3); return; } c(obj, "view not exist"); af.a("OperateViews", "insertViewAbove failed: view not exist instanceId = " + optString2); return; } c(obj, "instanceId not exist"); af.a("OperateViews", "insertViewAbove failed: instanceId not exist instanceId = " + optString2); } catch (Throwable th) { c(obj, th.getMessage()); af.a("OperateViews", "insertViewAbove failed: " + th.getMessage()); } } /* JADX WARN: Multi-variable type inference failed */ /* JADX WARN: Type inference failed for: r2v10 */ /* JADX WARN: Type inference failed for: r3v12 */ public final void t(Object obj, JSONObject jSONObject) { String str; Object obj2; String str2; int optInt; Rect rect; Object obj3; int i2; WindVaneWebView windVaneWebView; Object obj4 = obj; try { String optString = jSONObject.optString("unitId"); String optString2 = jSONObject.optString("id"); String h2 = h(optString2); if (TextUtils.isEmpty(h2) && (windVaneWebView = ((com.mbridge.msdk.mbsignalcommon.windvane.a) obj4).b) != null) { h2 = windVaneWebView.getRid(); } JSONObject optJSONObject = jSONObject.optJSONObject("data"); if (optJSONObject == null) { c(obj4, "data is empty"); return; } JSONObject optJSONObject2 = optJSONObject.optJSONObject("content"); if (optJSONObject2 == null) { c(obj4, "content is empty"); return; } String optString3 = optJSONObject2.optString("fileURL"); String optString4 = optJSONObject2.optString(fc.c.c); String optString5 = optJSONObject2.optString(TJAdUnitConstants.String.HTML); if (TextUtils.isEmpty(optString3) && TextUtils.isEmpty(optString4) && TextUtils.isEmpty(optString5)) { c(obj4, "url is empty"); return; } JSONArray optJSONArray = optJSONObject2.optJSONArray("campaigns"); List arrayList = new ArrayList<>(); if (optJSONArray != null && optJSONArray.length() > 0) { int length = optJSONArray.length(); int i3 = 0; while (i3 < length) { JSONArray jSONArray = optJSONArray; CampaignEx parseCampaignWithBackData = CampaignEx.parseCampaignWithBackData(optJSONArray.getJSONObject(i3)); if (parseCampaignWithBackData != null) { parseCampaignWithBackData.setCampaignUnitId(optString); arrayList.add(parseCampaignWithBackData); } i3++; optJSONArray = jSONArray; } } String optString6 = optJSONObject2.optString("unitId"); com.mbridge.msdk.videocommon.d.c a2 = com.mbridge.msdk.videocommon.d.c.a(optJSONObject2.optJSONObject("unitSetting")); if (a2 != null) { a2.a(optString6); } JSONObject optJSONObject3 = jSONObject.optJSONObject("rect"); Rect rect2 = new Rect(-999, -999, -999, -999); if (optJSONObject3 != null) { try { str2 = "OperateViews"; try { Rect rect3 = new Rect(optJSONObject3.optInt("left", -999), optJSONObject3.optInt("top", -999), optJSONObject3.optInt(TtmlNode.RIGHT, -999), optJSONObject3.optInt(Consts.SDK_BANNER_POSITION_BOTTOM, -999)); int optInt2 = optJSONObject3.optInt("width"); optInt = optJSONObject3.optInt("height"); rect = rect3; i2 = optInt2; } catch (Throwable th) { th = th; obj3 = obj; str = str2; obj2 = obj3; c(obj2, th.getMessage()); af.a(str, "webviewLoad failed: " + th.getMessage()); } } catch (Throwable th2) { th = th2; str2 = "OperateViews"; obj3 = obj; str = str2; obj2 = obj3; c(obj2, th.getMessage()); af.a(str, "webviewLoad failed: " + th.getMessage()); } } else { str2 = "OperateViews"; optInt = 0; i2 = 0; rect = rect2; } int optInt3 = optJSONObject2.optInt("refreshCache", 0); LinkedHashMap b2 = b(optString, h2); try { if (b2.containsKey(optString2)) { View view = b2.get(optString2); if (view instanceof MBridgeBTWebView) { MBridgeBTWebView mBridgeBTWebView = (MBridgeBTWebView) view; mBridgeBTWebView.setHtml(optString5); mBridgeBTWebView.setFilePath(optString4); mBridgeBTWebView.setFileURL(optString3); mBridgeBTWebView.setRect(rect); mBridgeBTWebView.setLayout(i2, optInt); mBridgeBTWebView.setCampaigns(arrayList); mBridgeBTWebView.setRewardUnitSetting(a2); mBridgeBTWebView.webviewLoad(optInt3); Object obj5 = obj; try { a(obj5, optString2); String str3 = str2; af.a(str3, "webviewLoad instanceId = " + optString2); i2 = obj5; rect = str3; } catch (Throwable th3) { th = th3; obj3 = obj5; str = str2; obj2 = obj3; c(obj2, th.getMessage()); af.a(str, "webviewLoad failed: " + th.getMessage()); } } else { Object obj6 = obj; String str4 = str2; c(obj6, "view not exist"); af.a(str4, "webviewLoad failed: view not exist instanceId = " + optString2); i2 = obj6; rect = str4; } } else { Object obj7 = obj; String str5 = str2; c(obj7, "instanceId not exist"); af.a(str5, "webviewLoad failed: instanceId not exist instanceId = " + optString2); i2 = obj7; rect = str5; } } catch (Throwable th4) { th = th4; obj2 = i2; str = rect; c(obj2, th.getMessage()); af.a(str, "webviewLoad failed: " + th.getMessage()); } } catch (Throwable th5) { th = th5; str = "OperateViews"; obj2 = obj4; } } public final void u(Object obj, JSONObject jSONObject) { WindVaneWebView windVaneWebView; try { String optString = jSONObject.optString("unitId"); String optString2 = jSONObject.optString("id"); String h2 = h(optString2); if (TextUtils.isEmpty(h2) && (windVaneWebView = ((com.mbridge.msdk.mbsignalcommon.windvane.a) obj).b) != null) { h2 = windVaneWebView.getRid(); } if (jSONObject.optJSONObject("data") == null) { c(obj, "data is empty"); return; } LinkedHashMap b2 = b(optString, h2); if (b2.containsKey(optString2)) { View view = b2.get(optString2); if (view instanceof MBridgeBTWebView) { if (((MBridgeBTWebView) view).webviewReload()) { a(obj, optString2); af.a("OperateViews", "webviewReload instanceId = " + optString2); return; } c(obj, "reload failed"); af.a("OperateViews", "webviewReload failed reload failed instanceId = " + optString2); return; } c(obj, "view not exist"); af.a("OperateViews", "webviewReload failed view not exist instanceId = " + optString2); return; } c(obj, "instanceId not exist"); af.a("OperateViews", "webviewReload failed instanceId not exist instanceId = " + optString2); } catch (Throwable th) { c(obj, th.getMessage()); af.a("OperateViews", "webviewReload failed: " + th.getMessage()); } } public final void v(Object obj, JSONObject jSONObject) { WindVaneWebView windVaneWebView; try { String optString = jSONObject.optString("unitId"); String optString2 = jSONObject.optString("id"); String h2 = h(optString2); if (TextUtils.isEmpty(h2) && (windVaneWebView = ((com.mbridge.msdk.mbsignalcommon.windvane.a) obj).b) != null) { h2 = windVaneWebView.getRid(); } if (jSONObject.optJSONObject("data") == null) { c(obj, "data is empty"); return; } LinkedHashMap b2 = b(optString, h2); if (b2.containsKey(optString2)) { View view = b2.get(optString2); if (view instanceof MBridgeBTWebView) { if (((MBridgeBTWebView) view).webviewGoBack()) { a(obj, optString2); af.a("OperateViews", "webviewGoBack instanceId = " + optString2); return; } c(obj, "webviewGoBack failed"); af.a("OperateViews", "webviewGoBack failed instanceId = " + optString2); return; } c(obj, "view not exist"); af.a("OperateViews", "webviewGoBack failed view not exist instanceId = " + optString2); return; } c(obj, "instanceId not exist"); af.a("OperateViews", "webviewGoBack failed instanceId not exist instanceId = " + optString2); } catch (Throwable th) { c(obj, th.getMessage()); af.a("OperateViews", "webviewGoBack failed: " + th.getMessage()); } } public final void w(Object obj, JSONObject jSONObject) { WindVaneWebView windVaneWebView; try { String optString = jSONObject.optString("unitId"); String optString2 = jSONObject.optString("id"); String h2 = h(optString2); if (TextUtils.isEmpty(h2) && (windVaneWebView = ((com.mbridge.msdk.mbsignalcommon.windvane.a) obj).b) != null) { h2 = windVaneWebView.getRid(); } if (jSONObject.optJSONObject("data") == null) { c(obj, "data is empty"); return; } LinkedHashMap b2 = b(optString, h2); if (b2.containsKey(optString2)) { View view = b2.get(optString2); if (view instanceof MBridgeBTWebView) { if (((MBridgeBTWebView) view).webviewGoForward()) { a(obj, optString2); af.a("OperateViews", "webviewGoForward instanceId = " + optString2); return; } c(obj, "webviewGoForward failed"); af.a("OperateViews", "webviewGoForward failed instanceId = " + optString2); return; } c(obj, "view not exist"); af.a("OperateViews", "webviewGoForward failed view not exist instanceId = " + optString2); return; } c(obj, "instanceId not exist"); af.a("OperateViews", "webviewGoForward failed instanceId not exist instanceId = " + optString2); } catch (Throwable th) { c(obj, th.getMessage()); af.a("OperateViews", "webviewGoForward failed: " + th.getMessage()); } } public final void x(Object obj, JSONObject jSONObject) { MBridgeBTContainer mBridgeBTContainer; WindVaneWebView windVaneWebView; try { String optString = jSONObject.optString("unitId"); String optString2 = jSONObject.optString("id"); String h2 = h(optString2); if (TextUtils.isEmpty(h2) && (windVaneWebView = ((com.mbridge.msdk.mbsignalcommon.windvane.a) obj).b) != null) { h2 = windVaneWebView.getRid(); } if (jSONObject.optJSONObject("data") == null) { c(obj, "data is empty"); return; } LinkedHashMap b2 = b(optString, h2); if (b2.containsKey(optString2)) { View view = b2.get(optString2); if (view instanceof MBridgeBTVideoView) { MBridgeBTVideoView mBridgeBTVideoView = (MBridgeBTVideoView) view; LinkedHashMap b3 = b(optString, h2); if (b3.size() > 0) { for (View view2 : b3.values()) { if (view2 instanceof MBridgeBTContainer) { mBridgeBTContainer = (MBridgeBTContainer) view2; break; } } } mBridgeBTContainer = null; if (mBridgeBTContainer != null) { mBridgeBTVideoView.setAdEvents(mBridgeBTContainer.getAdEvents()); mBridgeBTVideoView.setAdSession(mBridgeBTContainer.getAdSession()); mBridgeBTVideoView.setVideoEvents(mBridgeBTContainer.getVideoEvents()); } mBridgeBTVideoView.play(); a(obj, optString2); af.a("OperateViews", "playerPlay success"); return; } c(obj, "instanceId is not player"); af.a("OperateViews", "playerPlay failed instanceId is not player instanceId = " + optString2); return; } c(obj, "instanceId not exit"); af.a("OperateViews", "playerPlay failed instanceId not exit instanceId = " + optString2); } catch (Throwable th) { c(obj, th.getMessage()); af.a("OperateViews", "playerPlay failed: " + th.getMessage()); } } public final void y(Object obj, JSONObject jSONObject) { WindVaneWebView windVaneWebView; try { String optString = jSONObject.optString("unitId"); String optString2 = jSONObject.optString("id"); String h2 = h(optString2); if (TextUtils.isEmpty(h2) && (windVaneWebView = ((com.mbridge.msdk.mbsignalcommon.windvane.a) obj).b) != null) { h2 = windVaneWebView.getRid(); } if (jSONObject.optJSONObject("data") == null) { c(obj, "data is empty"); return; } LinkedHashMap b2 = b(optString, h2); if (b2.containsKey(optString2)) { View view = b2.get(optString2); if (view instanceof MBridgeBTVideoView) { ((MBridgeBTVideoView) view).pause(); a(obj, optString2); af.a("OperateViews", "playerPause success"); return; } else { c(obj, "instanceId is not player"); af.a("OperateViews", "playerPause failed instanceId is not player instanceId = " + optString2); return; } } c(obj, "instanceId not exit"); af.a("OperateViews", "playerPause failed instanceId not exit instanceId = " + optString2); } catch (Throwable th) { c(obj, th.getMessage()); af.a("OperateViews", "playerPause failed: " + th.getMessage()); } } public final void z(Object obj, JSONObject jSONObject) { WindVaneWebView windVaneWebView; try { String optString = jSONObject.optString("unitId"); String optString2 = jSONObject.optString("id"); String h2 = h(optString2); if (TextUtils.isEmpty(h2) && (windVaneWebView = ((com.mbridge.msdk.mbsignalcommon.windvane.a) obj).b) != null) { h2 = windVaneWebView.getRid(); } if (jSONObject.optJSONObject("data") == null) { c(obj, "data is empty"); return; } LinkedHashMap b2 = b(optString, h2); if (b2.containsKey(optString2)) { View view = b2.get(optString2); if (view instanceof MBridgeBTVideoView) { ((MBridgeBTVideoView) view).resume(); a(obj, optString2); af.a("OperateViews", "playerResume success"); return; } else { c(obj, "instanceId is not player"); af.a("OperateViews", "playerResume failed instanceId is not player instanceId = " + optString2); return; } } c(obj, "instanceId not exit"); af.a("OperateViews", "playerResume failed instanceId not exit instanceId = " + optString2); } catch (Throwable th) { c(obj, th.getMessage()); af.a("OperateViews", "playerResume failed: " + th.getMessage()); } } public final void A(Object obj, JSONObject jSONObject) { WindVaneWebView windVaneWebView; try { String optString = jSONObject.optString("unitId"); String optString2 = jSONObject.optString("id"); String h2 = h(optString2); if (TextUtils.isEmpty(h2) && (windVaneWebView = ((com.mbridge.msdk.mbsignalcommon.windvane.a) obj).b) != null) { h2 = windVaneWebView.getRid(); } if (jSONObject.optJSONObject("data") == null) { c(obj, "data is empty"); return; } LinkedHashMap b2 = b(optString, h2); if (b2.containsKey(optString2)) { View view = b2.get(optString2); if (view instanceof MBridgeBTVideoView) { ((MBridgeBTVideoView) view).stop(); a(obj, optString2); af.a("OperateViews", "playerStop success"); return; } else { c(obj, "instanceId is not player"); af.a("OperateViews", "playerStop failed instanceId is not player instanceId = " + optString2); return; } } c(obj, "instanceId not exit"); af.a("OperateViews", "playerStop failed instanceId not exit instanceId = " + optString2); } catch (Throwable th) { c(obj, th.getMessage()); af.a("OperateViews", "playerStop failed: " + th.getMessage()); } } public final void B(Object obj, JSONObject jSONObject) { try { jSONObject.optString("unitId"); if (jSONObject.optJSONObject("data") == null) { c(obj, "data is empty"); } } catch (Throwable th) { c(obj, th.getMessage()); } } public final void C(Object obj, JSONObject jSONObject) { WindVaneWebView windVaneWebView; try { String optString = jSONObject.optString("unitId"); String optString2 = jSONObject.optString("id"); String h2 = h(optString2); if (TextUtils.isEmpty(h2) && (windVaneWebView = ((com.mbridge.msdk.mbsignalcommon.windvane.a) obj).b) != null) { h2 = windVaneWebView.getRid(); } if (jSONObject.optJSONObject("data") == null) { c(obj, "data is empty"); return; } LinkedHashMap b2 = b(optString, h2); if (b2.containsKey(optString2)) { View view = b2.get(optString2); if (view instanceof MBridgeBTVideoView) { if (((MBridgeBTVideoView) view).playMute()) { a(obj, optString2); af.a("OperateViews", "playerMute success"); return; } else { c(obj, "set mute failed"); af.a("OperateViews", "playerMute failed set mute failed"); return; } } c(obj, "instanceId is not player"); af.a("OperateViews", "playerMute failed: instanceId is not player"); return; } c(obj, "instanceId not exist"); af.a("OperateViews", "playerMute failed: instanceId is not exist"); } catch (Throwable th) { c(obj, th.getMessage()); af.a("OperateViews", "playerMute failed: " + th.getMessage()); } } public final void D(Object obj, JSONObject jSONObject) { WindVaneWebView windVaneWebView; try { String optString = jSONObject.optString("unitId"); String optString2 = jSONObject.optString("id"); String h2 = h(optString2); if (TextUtils.isEmpty(h2) && (windVaneWebView = ((com.mbridge.msdk.mbsignalcommon.windvane.a) obj).b) != null) { h2 = windVaneWebView.getRid(); } if (jSONObject.optJSONObject("data") == null) { c(obj, "data is empty"); return; } LinkedHashMap b2 = b(optString, h2); if (b2.containsKey(optString2)) { View view = b2.get(optString2); if (view instanceof MBridgeBTVideoView) { if (((MBridgeBTVideoView) view).playUnMute()) { a(obj, optString2); a(obj, "onUnmute", optString2); af.a("OperateViews", "playerUnmute successed"); return; } else { a(obj, "set unmute failed"); af.a("OperateViews", "playerUnmute failed: set unmute failed"); return; } } c(obj, "instanceId is not player"); af.a("OperateViews", "playerUnmute failed: instanceId is not player"); return; } c(obj, "instanceId not exit"); af.a("OperateViews", "playerUnmute failed: instanceId not exit"); } catch (Throwable th) { c(obj, th.getMessage()); af.a("OperateViews", "playerUnmute failed: " + th.getMessage()); } } public final void E(Object obj, JSONObject jSONObject) { WindVaneWebView windVaneWebView; try { String optString = jSONObject.optString("unitId"); String optString2 = jSONObject.optString("id"); String h2 = h(optString2); if (TextUtils.isEmpty(h2) && (windVaneWebView = ((com.mbridge.msdk.mbsignalcommon.windvane.a) obj).b) != null) { h2 = windVaneWebView.getRid(); } if (jSONObject.optJSONObject("data") == null) { c(obj, "data is empty"); return; } LinkedHashMap b2 = b(optString, h2); if (b2.containsKey(optString2)) { View view = b2.get(optString2); if (view instanceof MBridgeBTVideoView) { int mute = ((MBridgeBTVideoView) view).getMute(); JSONObject jSONObject2 = new JSONObject(); jSONObject2.put("code", i); JSONObject jSONObject3 = new JSONObject(); jSONObject3.put("id", optString2); jSONObject3.put(CampaignEx.JSON_NATIVE_VIDEO_MUTE, mute); jSONObject2.put("data", jSONObject3); g.a().a(obj, Base64.encodeToString(jSONObject2.toString().getBytes(), 2)); af.a("OperateViews", "playerGetMuteState successed mute = " + mute); return; } c(obj, "instanceId is not player"); af.a("OperateViews", "playerGetMuteState failed instanceId is not player"); return; } c(obj, "instanceId not exist"); af.a("OperateViews", "playerGetMuteState failed instanceId not exist"); } catch (Throwable th) { c(obj, th.getMessage()); af.a("OperateViews", "playerGetMuteState failed: " + th.getMessage()); } } public final void F(Object obj, JSONObject jSONObject) { try { jSONObject.optString("unitId"); if (jSONObject.optJSONObject("data") == null) { c(obj, "data is empty"); } } catch (Throwable th) { c(obj, th.getMessage()); } } public final void G(Object obj, JSONObject jSONObject) { try { jSONObject.optString("unitId"); jSONObject.optString("id"); if (jSONObject.optJSONObject("data") == null) { c(obj, "data is empty"); } else { c(obj, "android mediaPlayer not support setScaleType"); } } catch (Throwable th) { c(obj, th.getMessage()); } } public final void H(Object obj, JSONObject jSONObject) { WindVaneWebView windVaneWebView; try { String optString = jSONObject.optString("unitId"); String optString2 = jSONObject.optString("id"); String h2 = h(optString2); if (TextUtils.isEmpty(h2) && (windVaneWebView = ((com.mbridge.msdk.mbsignalcommon.windvane.a) obj).b) != null) { h2 = windVaneWebView.getRid(); } if (jSONObject.optJSONObject("data") == null) { c(obj, "data is empty"); return; } LinkedHashMap b2 = b(optString, h2); if (b2.containsKey(optString2)) { View view = b2.get(optString2); if (view instanceof MBTempContainer) { ((MBTempContainer) view).preload(); a(obj, optString2); return; } else { c(obj, "view not exist"); return; } } c(obj, "instanceId not exist"); } catch (Throwable th) { c(obj, th.getMessage()); af.a("OperateViews", "preloadSubPlayTemplateView failed: " + th.getMessage()); } } public final void I(Object obj, JSONObject jSONObject) { WindVaneWebView windVaneWebView; b unused; try { String optString = jSONObject.optString("unitId"); String optString2 = jSONObject.optString("id"); String h2 = h(optString2); if (TextUtils.isEmpty(h2) && (windVaneWebView = ((com.mbridge.msdk.mbsignalcommon.windvane.a) obj).b) != null) { h2 = windVaneWebView.getRid(); } if (jSONObject.optJSONObject("data") == null) { c(obj, "data is empty"); return; } LinkedHashMap b2 = b(optString, h2); if (b2.size() > 0) { MBridgeBTContainer mBridgeBTContainer = null; for (View view : b2.values()) { if (view instanceof MBridgeBTContainer) { mBridgeBTContainer = (MBridgeBTContainer) view; } else if (view instanceof MBridgeBTWebView) { ((MBridgeBTWebView) view).onDestory(); } else if (view instanceof MBridgeBTVideoView) { ((MBridgeBTVideoView) view).getInstanceId(); unused = b.a.a; ((MBridgeBTVideoView) view).onDestory(); } else if (view instanceof MBTempContainer) { ((MBTempContainer) view).onDestroy(); } } if (mBridgeBTContainer != null) { mBridgeBTContainer.onAdClose(); a.remove(b2); b2.clear(); a.remove(optString + "_" + h2); a(obj, optString2); return; } c(obj, "not found MBridgeBTContainer"); af.a("OperateViews", "closeAd successed"); return; } c(obj, "unitId or instanceId not exist"); af.a("OperateViews", "closeAd failed: unitId or instanceId not exist unitId = " + optString); } catch (Throwable th) { c(obj, th.getMessage()); af.a("OperateViews", "closeAd failed: " + th.getMessage()); } } public final void J(Object obj, JSONObject jSONObject) { try { WindVaneWebView windVaneWebView = ((com.mbridge.msdk.mbsignalcommon.windvane.a) obj).b; String rid = windVaneWebView != null ? windVaneWebView.getRid() : ""; String optString = jSONObject.optString("unitId"); String optString2 = jSONObject.optString("eventName"); JSONObject optJSONObject = jSONObject.optJSONObject("data"); LinkedHashMap b2 = b(optString, rid); if (b2 != null && b2.size() > 0) { for (View view : b2.values()) { if (view instanceof MBridgeBTWebView) { ((MBridgeBTWebView) view).broadcast(optString2, optJSONObject); } if (view instanceof MBridgeBTLayout) { ((MBridgeBTLayout) view).broadcast(optString2, optJSONObject); } } a(obj, ""); return; } c(obj, "unitId not exist"); } catch (Throwable th) { c(obj, th.getMessage()); af.a("OperateViews", "broadcast failed: " + th.getMessage()); } } public final void K(Object obj, JSONObject jSONObject) { com.mbridge.msdk.videocommon.b.c cVar; String str; try { WindVaneWebView windVaneWebView = ((com.mbridge.msdk.mbsignalcommon.windvane.a) obj).b; String rid = windVaneWebView != null ? windVaneWebView.getRid() : ""; String optString = jSONObject.optString("unitId"); String optString2 = jSONObject.optString("id"); JSONObject optJSONObject = jSONObject.optJSONObject("data"); String optString3 = optJSONObject.optString("userId"); boolean optBoolean = optJSONObject.optBoolean("expired"); JSONObject optJSONObject2 = optJSONObject.optJSONObject("reward"); String optString4 = optJSONObject.optString("extra"); if (optJSONObject2 != null) { cVar = new com.mbridge.msdk.videocommon.b.c(optJSONObject2.optString("name"), optJSONObject2.optInt("amount")); str = optJSONObject2.optString("id"); } else { cVar = null; str = ""; } LinkedHashMap b2 = b(optString, rid); if (b2.size() > 0 && e.containsKey(optString2)) { View view = b2.get(optString2); if (view instanceof MBTempContainer) { MBTempContainer mBTempContainer = (MBTempContainer) view; mBTempContainer.setReward(cVar); mBTempContainer.setUserId(optString3); mBTempContainer.setRewardId(str); mBTempContainer.setCampaignExpired(optBoolean); if (!TextUtils.isEmpty(optString4)) { mBTempContainer.setDeveloperExtraData(optString4); } a(obj, optString2); af.a("OperateViews", "setSubPlayTemplateInfo success instanceId = " + optString2); return; } c(obj, "instanceId not exist"); af.a("OperateViews", "setSubPlayTemplateInfo failed: instanceId not exist instanceId = " + optString2); return; } c(obj, "unitId not exist"); af.a("OperateViews", "setSubPlayTemplateInfo failed: unitId not exist instanceId = " + optString2); } catch (Throwable th) { c(obj, th.getMessage()); af.a("OperateViews", "setSubPlayTemplateInfo failed: " + th.getMessage()); } } public final void L(Object obj, JSONObject jSONObject) { try { WindVaneWebView windVaneWebView = ((com.mbridge.msdk.mbsignalcommon.windvane.a) obj).b; String rid = windVaneWebView != null ? windVaneWebView.getRid() : ""; String optString = jSONObject.optString("unitId"); String optString2 = jSONObject.optString("id"); JSONObject optJSONObject = jSONObject.optJSONObject("data"); String optString3 = optJSONObject.optString("eventName"); JSONObject optJSONObject2 = optJSONObject.optJSONObject("eventData"); if (optJSONObject2 == null) { optJSONObject2 = new JSONObject(); } LinkedHashMap b2 = b(optString, rid); if (b2.size() > 0) { View view = b2.get(optString2); if (view instanceof ViewGroup) { ViewGroup viewGroup = (ViewGroup) view; int childCount = viewGroup.getChildCount(); for (int i2 = 0; i2 < childCount; i2++) { View childAt = viewGroup.getChildAt(i2); if (childAt instanceof WindVaneWebView) { g.a().a((WebView) childAt, optString3, Base64.encodeToString(optJSONObject2.toString().getBytes(), 2)); a(obj, optString2); af.a("OperateViews", "webviewFireEvent instanceId = " + optString2); return; } } } c(obj, "instanceId not exist"); af.a("OperateViews", "webviewFireEvent failed: instanceId not exist instanceId = " + optString2); return; } c(obj, "unitId not exist"); af.a("OperateViews", "webviewFireEvent failed: unitId not exist"); } catch (Throwable th) { c(obj, th.getMessage()); af.a("OperateViews", "webviewFireEvent failed: " + th.getMessage()); } } public final void M(Object obj, JSONObject jSONObject) { try { JSONObject optJSONObject = jSONObject.optJSONObject("data"); if (optJSONObject == null) { c(obj, "data is empty"); return; } final CampaignEx parseCampaignWithBackData = CampaignEx.parseCampaignWithBackData(optJSONObject); if (parseCampaignWithBackData == null) { c(obj, "data camapign is empty"); } else { new Thread(new Runnable() { // from class: com.mbridge.msdk.video.bt.a.a.3 @Override // java.lang.Runnable public final void run() { try { j a2 = j.a(com.mbridge.msdk.foundation.db.g.a(com.mbridge.msdk.foundation.controller.c.m().c())); if (a2 != null) { if (!a2.b(parseCampaignWithBackData.getId())) { com.mbridge.msdk.foundation.entity.g gVar = new com.mbridge.msdk.foundation.entity.g(); gVar.a(parseCampaignWithBackData.getId()); gVar.b(parseCampaignWithBackData.getFca()); gVar.c(parseCampaignWithBackData.getFcb()); gVar.a(0); gVar.d(1); gVar.a(System.currentTimeMillis()); a2.a(gVar); } else { a2.a(parseCampaignWithBackData.getId()); } } a.a(a.this, parseCampaignWithBackData.getCampaignUnitId(), parseCampaignWithBackData); } catch (Throwable th) { af.b("OperateViews", th.getMessage(), th); } } }).start(); a(obj, ""); } } catch (Throwable th) { c(obj, th.getMessage()); } } public final void N(Object obj, JSONObject jSONObject) { String str; String str2; String str3; String str4; int i2; boolean z; String str5; File file; JSONObject jSONObject2 = new JSONObject(); String str6 = "message"; String str7 = "code"; int i3 = 1; if (jSONObject == null) { try { jSONObject2.put("code", 1); jSONObject2.put("message", "params is null"); g.a().a(obj, Base64.encodeToString(jSONObject2.toString().getBytes(), 2)); return; } catch (JSONException e2) { af.a("OperateViews", e2.getMessage()); return; } } try { jSONObject2.put("code", 0); jSONObject2.put("message", ""); JSONArray jSONArray = jSONObject.getJSONArray("resource"); if (jSONArray != null) { try { if (jSONArray.length() > 0) { JSONArray jSONArray2 = new JSONArray(); int length = jSONArray.length(); int i4 = 0; while (i4 < length) { JSONObject jSONObject3 = jSONArray.getJSONObject(i4); String optString = jSONObject3.optString("ref", ""); int i5 = jSONObject3.getInt("type"); JSONObject jSONObject4 = new JSONObject(); JSONArray jSONArray3 = jSONArray; if (i5 == i3 && !TextUtils.isEmpty(optString)) { JSONObject jSONObject5 = new JSONObject(); m a2 = n.a(com.mbridge.msdk.foundation.db.g.a(com.mbridge.msdk.foundation.controller.c.m().c())).a(optString); if (a2 != null) { i2 = length; af.a("OperateViews", "VideoBean not null"); jSONObject5.put("type", 1); str3 = str6; try { jSONObject5.put("videoDataLength", a2.d()); String e3 = a2.e(); str4 = str7; if (TextUtils.isEmpty(e3)) { try { af.a("OperateViews", "VideoPath null"); jSONObject5.put("path", ""); jSONObject5.put("path4Web", ""); } catch (Throwable th) { th = th; str = str3; str2 = str4; try { jSONObject2.put(str2, 1); jSONObject2.put(str, th.getLocalizedMessage()); g.a().a(obj, Base64.encodeToString(jSONObject2.toString().getBytes(), 2)); } catch (JSONException e4) { af.a("OperateViews", e4.getMessage()); return; } } } else { af.a("OperateViews", "VideoPath not null"); jSONObject5.put("path", e3); jSONObject5.put("path4Web", e3); } if (a2.b() == 5) { jSONObject5.put("downloaded", 1); z = false; } else { z = false; jSONObject5.put("downloaded", 0); } jSONObject4.put(optString, jSONObject5); jSONArray2.put(jSONObject4); } catch (Throwable th2) { th = th2; str4 = str7; str = str3; str2 = str4; jSONObject2.put(str2, 1); jSONObject2.put(str, th.getLocalizedMessage()); g.a().a(obj, Base64.encodeToString(jSONObject2.toString().getBytes(), 2)); } } else { str3 = str6; str4 = str7; i2 = length; z = false; af.a("OperateViews", "VideoBean null"); } i4++; jSONArray = jSONArray3; length = i2; str6 = str3; str7 = str4; i3 = 1; } else { str3 = str6; str4 = str7; i2 = length; z = false; if (i5 == 2 && !TextUtils.isEmpty(optString)) { JSONObject jSONObject6 = new JSONObject(); jSONObject6.put("type", 2); jSONObject6.put("path", H5DownLoadManager.getInstance().getH5ResAddress(optString) == null ? "" : H5DownLoadManager.getInstance().getH5ResAddress(optString)); jSONObject4.put(optString, jSONObject6); jSONArray2.put(jSONObject4); } else if (i5 == 3 && !TextUtils.isEmpty(optString)) { try { file = new File(optString); } catch (Throwable th3) { if (MBridgeConstans.DEBUG) { th3.printStackTrace(); } } if (file.exists() && file.isFile() && file.canRead()) { af.a("OperateViews", "getFileInfo Mraid file " + optString); str5 = "file:////" + optString; JSONObject jSONObject7 = new JSONObject(); jSONObject7.put("type", 3); jSONObject7.put("path", str5); jSONObject4.put(optString, jSONObject7); jSONArray2.put(jSONObject4); } str5 = ""; JSONObject jSONObject72 = new JSONObject(); jSONObject72.put("type", 3); jSONObject72.put("path", str5); jSONObject4.put(optString, jSONObject72); jSONArray2.put(jSONObject4); } else if (i5 == 4 && !TextUtils.isEmpty(optString)) { JSONObject jSONObject8 = new JSONObject(); jSONObject8.put("type", 4); jSONObject8.put("path", aj.a(optString) == null ? "" : aj.a(optString)); jSONObject4.put(optString, jSONObject8); jSONArray2.put(jSONObject4); } i4++; jSONArray = jSONArray3; length = i2; str6 = str3; str7 = str4; i3 = 1; } } str3 = str6; str4 = str7; jSONObject2.put("resource", jSONArray2); g.a().a(obj, Base64.encodeToString(jSONObject2.toString().getBytes(), 2)); return; } } catch (Throwable th4) { th = th4; str3 = str6; } } str2 = "code"; str = 1; } catch (Throwable th5) { th = th5; str = "message"; str2 = "code"; } try { try { jSONObject2.put(str2, 1); str = "message"; try { jSONObject2.put(str, "resource is null"); g.a().a(obj, Base64.encodeToString(jSONObject2.toString().getBytes(), 2)); } catch (JSONException e5) { e = e5; af.a("OperateViews", e.getMessage()); } } catch (Throwable th6) { th = th6; jSONObject2.put(str2, 1); jSONObject2.put(str, th.getLocalizedMessage()); g.a().a(obj, Base64.encodeToString(jSONObject2.toString().getBytes(), 2)); } } catch (JSONException e6) { e = e6; str = "message"; } catch (Throwable th7) { th = th7; str = "message"; jSONObject2.put(str2, 1); jSONObject2.put(str, th.getLocalizedMessage()); g.a().a(obj, Base64.encodeToString(jSONObject2.toString().getBytes(), 2)); } } public final void b(Object obj, String str) { af.a("OperateViews", "reportUrls:" + str); if (TextUtils.isEmpty(str)) { return; } try { JSONArray jSONArray = new JSONArray(str); for (int i2 = 0; i2 < jSONArray.length(); i2++) { JSONObject jSONObject = jSONArray.getJSONObject(i2); int optInt = jSONObject.optInt("type"); String a2 = ak.a(jSONObject.optString("url"), "&tun=", ab.q() + ""); int optInt2 = jSONObject.optInt("report"); if (optInt2 == 0) { com.mbridge.msdk.click.a.a(com.mbridge.msdk.foundation.controller.c.m().c(), (CampaignEx) null, "", a2, false, optInt != 0); } else { com.mbridge.msdk.click.a.a(com.mbridge.msdk.foundation.controller.c.m().c(), (CampaignEx) null, "", a2, false, optInt != 0, optInt2); } } } catch (Throwable th) { th = th; } try { a(obj, ""); } catch (Throwable th2) { th = th2; af.b("OperateViews", "reportUrls", th); } } public final void O(Object obj, JSONObject jSONObject) { af.a("OperateViews", "createNativeEC:" + jSONObject); try { String optString = jSONObject.optString("unitId"); JSONObject optJSONObject = jSONObject.optJSONObject("data"); if (optJSONObject != null && !TextUtils.isEmpty(optString)) { String str = ""; CampaignEx parseCampaignWithBackData = CampaignEx.parseCampaignWithBackData(optJSONObject.optJSONObject(MBInterstitialActivity.INTENT_CAMAPIGN)); if (parseCampaignWithBackData != null && !TextUtils.isEmpty(optString)) { parseCampaignWithBackData.setCampaignUnitId(optString); str = parseCampaignWithBackData.getRequestId(); } com.mbridge.msdk.videocommon.d.c a2 = com.mbridge.msdk.videocommon.d.c.a(optJSONObject.optJSONObject("unitSetting")); if (a2 != null) { a2.a(optString); } MBridgeBTNativeEC mBridgeBTNativeEC = new MBridgeBTNativeEC(com.mbridge.msdk.foundation.controller.c.m().c()); mBridgeBTNativeEC.setCampaign(parseCampaignWithBackData); k kVar = new k(null, parseCampaignWithBackData); kVar.a(optString); mBridgeBTNativeEC.setJSCommon(kVar); mBridgeBTNativeEC.setUnitId(optString); mBridgeBTNativeEC.setRewardUnitSetting(a2); WindVaneWebView windVaneWebView = ((com.mbridge.msdk.mbsignalcommon.windvane.a) obj).b; if (windVaneWebView != null) { str = windVaneWebView.getRid(); mBridgeBTNativeEC.setCreateWebView(windVaneWebView); } LinkedHashMap b2 = b(optString, str); String a3 = a(); b.put(a3, str); mBridgeBTNativeEC.setInstanceId(a3); b2.put(a3, mBridgeBTNativeEC); mBridgeBTNativeEC.preLoadData(); if (parseCampaignWithBackData == null) { c(obj, "campaign is null"); af.a("OperateViews", "createNativeEC failed"); return; } a(obj, a3); af.a("OperateViews", "createNativeEC instanceId = " + a3); return; } c(obj, "unitId or data is empty"); } catch (Throwable th) { c(obj, th.getMessage()); af.a("OperateViews", "createNativeEC failed:" + th.getMessage()); } } public final void a(int i2, int i3, int i4, int i5, int i6) { af.a("OperateViews", "OperateViews setNotchString = " + String.format("%1$s-%2$s-%3$s-%4$s-%5$s", Integer.valueOf(i2), Integer.valueOf(i3), Integer.valueOf(i4), Integer.valueOf(i5), Integer.valueOf(i6))); k = s.a(i2, i3, i4, i5, i6); l = i2; m = i3; n = i4; o = i5; p = i6; } public static /* synthetic */ void a(a aVar, String str, CampaignEx campaignEx) { if (com.mbridge.msdk.foundation.same.a.b.j == null || TextUtils.isEmpty(campaignEx.getId())) { return; } com.mbridge.msdk.foundation.same.a.b.a(str, campaignEx, "reward"); } }