package com.mbridge.msdk.mbbid.common; import android.content.Context; import android.text.TextUtils; import com.mbridge.msdk.MBridgeConstans; import com.mbridge.msdk.c.g; import com.mbridge.msdk.c.h; import com.mbridge.msdk.c.i; import com.mbridge.msdk.foundation.download.core.DownloadCommon; import com.mbridge.msdk.foundation.same.DomainNameUtils; import com.mbridge.msdk.foundation.same.report.d.d; import com.mbridge.msdk.foundation.same.report.d.e; import com.mbridge.msdk.foundation.tools.SameMD5; import com.mbridge.msdk.foundation.tools.aa; import com.mbridge.msdk.foundation.tools.ab; import com.mbridge.msdk.foundation.tools.af; import com.mbridge.msdk.foundation.tools.ai; import com.mbridge.msdk.foundation.tools.ak; import com.mbridge.msdk.foundation.tools.am; import com.mbridge.msdk.foundation.tools.f; import com.mbridge.msdk.foundation.tools.v; import com.mbridge.msdk.foundation.tools.z; import com.mbridge.msdk.mbbid.out.BidConstants; import com.mbridge.msdk.out.MBConfiguration; import java.util.HashMap; import java.util.Map; import org.json.JSONArray; /* loaded from: classes4.dex */ public final class b extends a { public static Map a = new HashMap(); public static JSONArray b; public static String a(Context context, String str) { HashMap hashMap = new HashMap(); hashMap.put(BidConstants.BID_FILTER_KEY_UNIT_ID, str); return a(context, hashMap); } public static String a(Context context, Map map) { String str; a = map; try { if (com.mbridge.msdk.foundation.controller.c.m().c() == null) { com.mbridge.msdk.foundation.controller.c.m().b(context); } if (b == null) { b = h.a().a(com.mbridge.msdk.foundation.controller.c.m().k()).al(); } str = SameMD5.getMD5(ak.d()); try { if (b(context, str)) { return ""; } Map map2 = a; return a(context, (map2 == null || !map2.containsKey(BidConstants.BID_FILTER_KEY_UNIT_ID)) ? "" : a.get(BidConstants.BID_FILTER_KEY_UNIT_ID), str); } catch (Exception unused) { return a(context, "", str); } } catch (Exception unused2) { str = ""; } } private static String a(Context context, String str, String str2) { long j; StringBuffer stringBuffer = new StringBuffer(); if (context != null) { try { if (com.mbridge.msdk.foundation.controller.c.m().c() == null) { com.mbridge.msdk.foundation.controller.c.m().b(context); } } catch (Exception e) { if (MBridgeConstans.DEBUG) { af.b("BidCommon", e.getMessage()); } } } g b2 = h.a().b(com.mbridge.msdk.foundation.controller.c.m().k()); if (b2 == null) { h.a(); b2 = i.a(); } stringBuffer.append(f.c()); stringBuffer.append("|"); stringBuffer.append(""); stringBuffer.append("|"); stringBuffer.append(""); stringBuffer.append("|"); stringBuffer.append("|"); stringBuffer.append("|"); stringBuffer.append(ab.x()); stringBuffer.append("|"); stringBuffer.append(ab.m()); stringBuffer.append("|"); stringBuffer.append(ab.m(context)); stringBuffer.append("|"); stringBuffer.append(MBConfiguration.SDK_VERSION); stringBuffer.append("|"); stringBuffer.append(ab.j(context)); stringBuffer.append("x"); stringBuffer.append(ab.h(context)); stringBuffer.append("|"); stringBuffer.append(ab.g()); stringBuffer.append("|"); stringBuffer.append(""); stringBuffer.append("|"); stringBuffer.append(ak.b(20)); stringBuffer.append("|"); stringBuffer.append(System.currentTimeMillis()); stringBuffer.append("|"); stringBuffer.append(com.mbridge.msdk.foundation.same.a.d); stringBuffer.append("|"); stringBuffer.append(ab.o()); stringBuffer.append("|"); stringBuffer.append(ab.f()); stringBuffer.append("|"); stringBuffer.append(""); stringBuffer.append("|"); stringBuffer.append(""); stringBuffer.append("|"); stringBuffer.append(""); stringBuffer.append("|"); stringBuffer.append(ai.b()); stringBuffer.append("|"); stringBuffer.append(ai.a()); stringBuffer.append("|"); try { j = aa.a(); } catch (Exception unused) { j = 0; } if (j > 0) { stringBuffer.append(j); stringBuffer.append("|"); } else { stringBuffer.append(""); stringBuffer.append("|"); } stringBuffer.append("|"); stringBuffer.append("|"); stringBuffer.append(com.mbridge.msdk.foundation.a.a.a.a().a(DownloadCommon.DOWNLOAD_REPORT_FIND_FILE_RESULT_VALUE_B)); stringBuffer.append("|"); stringBuffer.append(com.mbridge.msdk.foundation.a.a.a.a().a("c")); stringBuffer.append("|"); stringBuffer.append(ab.i()); String d = b2 != null ? b2.d() : ""; stringBuffer.append("|"); stringBuffer.append(d); stringBuffer.append("|"); stringBuffer.append(ak.a()); stringBuffer.append("|"); String c = ak.c(); if (TextUtils.isEmpty(c)) { c = ""; } stringBuffer.append(c); stringBuffer.append("|"); stringBuffer.append(ak.c(str)); stringBuffer.append("|"); if (b2 != null && b2.av() == 1 && com.mbridge.msdk.foundation.controller.authoritycontroller.c.j().c(MBridgeConstans.AUTHORITY_DEVICE_ID)) { stringBuffer.append(""); } stringBuffer.append("|"); stringBuffer.append(ab.z()); stringBuffer.append("|"); stringBuffer.append(ab.v(context)); stringBuffer.append("|"); stringBuffer.append(ab.u() + ""); stringBuffer.append("|"); stringBuffer.append(ab.c(com.mbridge.msdk.foundation.controller.c.m().h()) + ""); stringBuffer.append("|"); stringBuffer.append(ab.v()); stringBuffer.append("|"); stringBuffer.append(com.mbridge.msdk.foundation.controller.authoritycontroller.b.a() ? "1" : "2"); stringBuffer.append("|"); if (com.mbridge.msdk.foundation.controller.authoritycontroller.c.j().c(MBridgeConstans.AUTHORITY_GENERAL_DATA)) { stringBuffer.append(""); } stringBuffer.append("|"); stringBuffer.append(""); stringBuffer.append("|"); stringBuffer.append(""); stringBuffer.append("|"); stringBuffer.append(""); stringBuffer.append("|"); stringBuffer.append("1"); stringBuffer.append("|"); stringBuffer.append(com.mbridge.msdk.foundation.controller.authoritycontroller.c.j().f()); stringBuffer.append("|"); if (ab.q() != 0) { stringBuffer.append(ab.q() + ""); } if (DomainNameUtils.getInstance().isExcludeCNDomain()) { stringBuffer.append("|"); stringBuffer.append(1); } else { stringBuffer.append("|"); stringBuffer.append(""); } stringBuffer.append("|"); stringBuffer.append(""); stringBuffer.append("|"); stringBuffer.append(str2); stringBuffer.append("|"); stringBuffer.append(ab.l(context)); stringBuffer.append("|"); stringBuffer.append(ab.k(context)); stringBuffer.append("|"); stringBuffer.append(f.d()); stringBuffer.append("|"); stringBuffer.append(f.a()); stringBuffer.append("|"); stringBuffer.append(com.mbridge.msdk.e.c.a); stringBuffer.append("|"); stringBuffer.append(""); stringBuffer.append("|"); stringBuffer.append(v.a().b()); return z.b(stringBuffer.toString()); } /* JADX WARN: Code restructure failed: missing block: B:18:0x00d5, code lost: r3 = java.lang.System.currentTimeMillis(); */ /* JADX WARN: Code restructure failed: missing block: B:20:0x00db, code lost: if (r13 <= 0) goto L65; */ /* JADX WARN: Code restructure failed: missing block: B:23:0x00ec, code lost: if ((r3 - r13) >= (r8.optInt("ttl") * 1000)) goto L59; */ /* JADX WARN: Code restructure failed: missing block: B:24:0x011d, code lost: a(r19, r10, r3); r0 = 1; r3 = 0; */ /* JADX WARN: Code restructure failed: missing block: B:25:0x0122, code lost: r4 = r3; r3 = r8; */ /* JADX WARN: Code restructure failed: missing block: B:55:0x00ee, code lost: r3 = r8.optDouble("rate"); r0 = new java.util.Random().nextInt(100); */ /* JADX WARN: Code restructure failed: missing block: B:57:0x0103, code lost: if (r3 == 0.0d) goto L54; */ /* JADX WARN: Code restructure failed: missing block: B:59:0x010b, code lost: if ((r3 * 100.0d) < r0) goto L54; */ /* JADX WARN: Code restructure failed: missing block: B:60:0x010d, code lost: r0 = 1; */ /* JADX WARN: Code restructure failed: missing block: B:61:0x010e, code lost: r3 = r0; */ /* JADX WARN: Code restructure failed: missing block: B:62:0x0112, code lost: r5 = r0; r0 = 2; */ /* JADX WARN: Code restructure failed: missing block: B:63:0x0110, code lost: r0 = 2; */ /* JADX WARN: Code restructure failed: missing block: B:65:0x0118, code lost: r0 = move-exception; */ /* JADX WARN: Code restructure failed: missing block: B:66:0x0119, code lost: r4 = r0; r0 = 2; */ /* JADX WARN: Code restructure failed: missing block: B:67:0x011b, code lost: r3 = r8; */ /* JADX WARN: Code restructure failed: missing block: B:73:0x012e, code lost: a(r19, r10, r3); */ /* JADX WARN: Code restructure failed: missing block: B:74:0x0131, code lost: r0 = 1; r3 = r8; */ /* JADX WARN: Code restructure failed: missing block: B:75:0x0125, code lost: r0 = move-exception; */ /* JADX WARN: Code restructure failed: missing block: B:76:0x0126, code lost: r4 = r0; r0 = 1; */ /* JADX WARN: Multi-variable type inference failed */ /* JADX WARN: Removed duplicated region for block: B:29:0x0151 A[Catch: all -> 0x017c, TryCatch #5 {all -> 0x017c, blocks: (B:27:0x0147, B:29:0x0151, B:31:0x0176, B:32:0x017e, B:34:0x0187, B:36:0x018f, B:37:0x019c, B:39:0x01a6, B:40:0x01b3, B:42:0x01bd, B:43:0x01ca), top: B:26:0x0147 }] */ /* JADX WARN: Removed duplicated region for block: B:47:0x01de */ /* JADX WARN: Removed duplicated region for block: B:50:0x01e0 A[ORIG_RETURN, RETURN] */ /* JADX WARN: Removed duplicated region for block: B:70:0x013f */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ private static boolean b(android.content.Context r19, java.lang.String r20) { /* Method dump skipped, instructions count: 487 To view this dump add '--comments-level debug' option */ throw new UnsupportedOperationException("Method not decompiled: com.mbridge.msdk.mbbid.common.b.b(android.content.Context, java.lang.String):boolean"); } private static void a(Context context, String str, long j) { am.a(context, str, Long.valueOf(j)); } private static boolean a(String str, String str2) { if (TextUtils.isEmpty(str) || TextUtils.isEmpty(str2)) { return false; } if (str.equals(str2)) { return true; } for (String str3 : str.split("-")) { if (!TextUtils.isEmpty(str3) && str3.length() > 2 && str3.startsWith("{") && str3.endsWith("}")) { String substring = str3.substring(1, str3.length() - 1); Map map = a; if (map != null && map.containsKey(substring)) { String valueOf = String.valueOf(a.get(substring)); if (!TextUtils.isEmpty(valueOf)) { str = str.replace(str3, valueOf + ""); } } else if (BidConstants.BID_FILTER_KEY_NETWORK.equals(str3)) { str = str.replace(str3, ab.m(com.mbridge.msdk.foundation.controller.c.m().c()) + ""); } } } return str.equals(str2); } private static void a(String str, int i) { e eVar = new e(); eVar.a("filter", Integer.valueOf(i)); eVar.a("lrid", str); d.a().b("2000124", eVar); } }