package com.tencent.mm.plugin.webview.ui.tools.newjsapi; import android.net.Uri; import android.os.Bundle; import android.util.Base64; import com.tencent.mm.ipcinvoker.e; import com.tencent.mm.ipcinvoker.extension.XIPCInvoker; import com.tencent.mm.ipcinvoker.g; import com.tencent.mm.sdk.platformtools.Log; import com.tencent.mm.sdk.platformtools.MMApplicationContext; import com.tencent.mm.sdk.platformtools.WeChatProcess; import com.tencent.wxmm.v2helper; import com.tenpay.android.wechat.PayuSecureEncrypt; import ek4.y; import java.net.URLDecoder; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedHashMap; import kotlin.Metadata; import kp3.h1; import lh4.m; import org.json.JSONArray; import org.json.JSONObject; import qd3.h0; import qd3.z; import sz.h; import ve3.a0; import ve3.l1; import ve3.n1; import ve3.p; import yz3.j; public final class o2 extends np3.a { /* renamed from: d reason: collision with root package name */ public static final o2 f168647d = new o2(); /* renamed from: e reason: collision with root package name */ public static final int f168648e = v2helper.EMethodSetSpkEnhance; /* renamed from: f reason: collision with root package name */ public static final String f168649f = "publishTextState"; /* renamed from: g reason: collision with root package name */ public static final HashMap<String, String> f168650g; @Metadata(bv = {}, d1 = {"\u0000\u0010\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\b\u0002\u0018\u00002\u000e\u0012\u0004\u0012\u00020\u0002\u0012\u0004\u0012\u00020\u00020\u0001B\u0007¢\u0006\u0004\b\u0003\u0010\u0004¨\u0006\u0005"}, d2 = {"Lcom/tencent/mm/plugin/webview/ui/tools/newjsapi/o2$a;", "Lcom/tencent/mm/ipcinvoker/e;", "Landroid/os/Bundle;", "<init>", "()V", "plugin-webview_release"}, k = 1, mv = {1, 7, 1}) public static final class a implements e<Bundle, Bundle> { /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object, com.tencent.mm.ipcinvoker.g] */ @Override // com.tencent.mm.ipcinvoker.e public void invoke(Bundle bundle, g<Bundle> gVar) { Bundle bundle2 = bundle; m.g(bundle2, "data"); byte[] byteArray = bundle2.getByteArray("KEY_REQUEST_DATA"); z zVar = new z(); zVar.parseFrom(byteArray); ((h) j.c(h.class)).QQ(MMApplicationContext.getContext(), zVar, new JsApiPublishTextState$JsSetStatusTask$invoke$setStatusCallback$1(gVar)); } } public static final class b<T> implements g { /* renamed from: d reason: collision with root package name */ public final /* synthetic */ kp3.j f168651d; /* renamed from: e reason: collision with root package name */ public final /* synthetic */ h1 f168652e; public b(kp3.j jVar, h1 h1Var) { this.f168651d = jVar; this.f168652e = h1Var; } @Override // com.tencent.mm.ipcinvoker.g public void a(Object obj) { Bundle bundle = (Bundle) obj; int i15 = bundle.getInt("KEY_RESULT_CODE"); Bundle bundle2 = (Bundle) bundle.getParcelable("KEY_RESULT_DATA"); byte[] bArr = null; if (i15 == -1) { p pVar = new p(); if (bundle2 != null) { bArr = bundle2.getByteArray("select_status_info"); } if (bArr != null) { pVar.parseFrom(bArr); } String str = pVar.f325385d; if (str == null) { str = ""; } LinkedHashMap linkedHashMap = new LinkedHashMap(); linkedHashMap.put("icon_id", str); kp3.g gVar = this.f168651d.f247870d; String str2 = this.f168652e.f247857c; gVar.b(str2, this.f168652e.f247863i + ":ok", linkedHashMap); return; } kp3.g gVar2 = this.f168651d.f247870d; String str3 = this.f168652e.f247857c; gVar2.b(str3, this.f168652e.f247863i + ":fail_cancel", null); } } static { HashMap<String, String> hashMap = new HashMap<>(); hashMap.put("websearch", "9"); hashMap.put("h5", PayuSecureEncrypt.ENCRYPT_VERSION_DEFAULT); f168650g = hashMap; } /* JADX WARNING: Removed duplicated region for block: B:104:0x01f6 A[Catch:{ all -> 0x0211 }] */ /* JADX WARNING: Removed duplicated region for block: B:111:0x0204 A[Catch:{ all -> 0x0211 }] */ /* JADX WARNING: Removed duplicated region for block: B:117:0x0221 A[LOOP:0: B:64:0x013f->B:117:0x0221, LOOP_END] */ /* JADX WARNING: Removed duplicated region for block: B:130:0x0263 */ /* JADX WARNING: Removed duplicated region for block: B:132:0x0275 */ /* JADX WARNING: Removed duplicated region for block: B:137:0x0282 */ /* JADX WARNING: Removed duplicated region for block: B:153:0x02aa */ /* JADX WARNING: Removed duplicated region for block: B:154:0x02c6 */ /* JADX WARNING: Removed duplicated region for block: B:155:0x025c A[EDGE_INSN: B:155:0x025c->B:127:0x025c ?: BREAK , SYNTHETIC] */ /* JADX WARNING: Removed duplicated region for block: B:81:0x016e A[Catch:{ all -> 0x0166 }] */ /* JADX WARNING: Removed duplicated region for block: B:82:0x0174 A[Catch:{ all -> 0x0166 }] */ /* JADX WARNING: Removed duplicated region for block: B:98:0x01ea A[Catch:{ all -> 0x0211 }] */ @Override // kp3.b1 public boolean a(kp3.j jVar, h1 h1Var) { String str; String str2; String str3; String str4; String str5; String str6; String str7; String str8; String str9; String str10; boolean z15; boolean z16; String str11; String str12; String str13; boolean z17; boolean z18; boolean z19; boolean z25; boolean z26; Throwable th5; String str14; JSONArray jSONArray; String str15; boolean z27; boolean z28; Throwable th6; boolean z29; m.g(jVar, "env"); m.g(h1Var, "msg"); if (!h0.g()) { jVar.f247870d.b(h1Var.f247857c, h1Var.f247863i + ":fail_not_support", null); return true; } Object obj = ((HashMap) h1Var.f247819a).get("sourceId"); if (obj instanceof String) { str = (String) obj; } else { str = null; } Object obj2 = ((HashMap) h1Var.f247819a).get("sourceActivityId"); if (obj2 instanceof String) { str2 = (String) obj2; } else { str2 = null; } Object obj3 = ((HashMap) h1Var.f247819a).get("sourceVerifyInfo"); if (obj3 instanceof String) { str3 = (String) obj3; } else { str3 = null; } Object obj4 = ((HashMap) h1Var.f247819a).get("sourceName"); if (obj4 instanceof String) { str4 = (String) obj4; } else { str4 = null; } Object obj5 = ((HashMap) h1Var.f247819a).get("sourceIconURL"); if (obj5 instanceof String) { str5 = (String) obj5; } else { str5 = null; } Object obj6 = ((HashMap) h1Var.f247819a).get("iconId"); if (obj6 instanceof String) { str6 = (String) obj6; } else { str6 = null; } Object obj7 = ((HashMap) h1Var.f247819a).get("image"); if (obj7 instanceof String) { str7 = (String) obj7; } else { str7 = null; } Object obj8 = ((HashMap) h1Var.f247819a).get("desc"); if (obj8 instanceof String) { str8 = (String) obj8; } else { str8 = null; } Object obj9 = ((HashMap) h1Var.f247819a).get("jumpJSON"); if (obj9 instanceof String) { str9 = (String) obj9; } else { str9 = null; } Object obj10 = ((HashMap) h1Var.f247819a).get("hideToast"); if (obj10 instanceof String) { str10 = (String) obj10; } else { str10 = null; } if (str10 == null || Integer.parseInt(str10) != 1) { z15 = false; } else { z15 = true; } Log.i("MicroMsg.JsApiPublishTextState", "publishTextState params:" + h1Var.f247819a); String str16 = "buf"; ArrayList arrayList = new ArrayList(); if (str9 == null || y.n(str9)) { z16 = true; } else { z16 = false; } if (!z16) { try { JSONArray optJSONArray = new JSONObject(str9).optJSONArray("infos"); if (optJSONArray != null) { z17 = z15; try { int length = optJSONArray.length(); if (length >= 0) { str13 = str8; int i15 = 0; while (true) { try { JSONObject optJSONObject = optJSONArray.optJSONObject(i15); if (optJSONObject != null) { jSONArray = optJSONArray; String optString = optJSONObject.optString("type"); String optString2 = optJSONObject.optString(str16); str12 = str7; try { String str17 = f168650g.get(optString); if (optString2 != null) { try { if (!y.n(optString2)) { z29 = false; if (!z29) { str14 = str16; str11 = str3; } else { str11 = str3; if (m.b(str17, "9")) { try { m.f(optString2, str16); String decode = URLDecoder.decode(Uri.parse(p2.a(optString2)).getQueryParameter("keyword"), "UTF-8"); n1 n1Var = new n1(); n1Var.f325375d = decode; byte[] byteArray = n1Var.toByteArray(); str15 = Base64.encodeToString(byteArray, 0, byteArray.length, 0); } catch (Throwable th7) { th6 = th7; str14 = str16; try { Log.printErrStackTrace("MicroMsg.JsApiPublishTextState", th6, "parse keyBusiBuf err", new Object[0]); str15 = null; if (str17 != null) { } z27 = true; if (!z27) { } if (i15 == length) { } } catch (Throwable th8) { th5 = th8; z18 = false; Log.printErrStackTrace("MicroMsg.JsApiPublishTextState", th5, "parse jumpJSON", new Object[0]); if (arrayList.size() > 0) { } if (str != null) { } z19 = true; if (!z19) { } if (!z18) { } } } } else if (m.b(str17, PayuSecureEncrypt.ENCRYPT_VERSION_DEFAULT)) { m.f(optString2, str16); String decode2 = URLDecoder.decode(Uri.parse(p2.a(optString2)).getQueryParameter("url"), "UTF-8"); l1 l1Var = new l1(); l1Var.f325354d = decode2; byte[] byteArray2 = l1Var.toByteArray(); str15 = Base64.encodeToString(byteArray2, 0, byteArray2.length, 0); } else { str14 = str16; } str14 = str16; if (str17 != null) { if (!y.n(str17)) { z27 = false; if (!z27) { if (str15 != null) { if (!y.n(str15)) { z28 = false; if (!z28) { a0 a0Var = new a0(); a0Var.f325223d = str17; a0Var.f325226g = str15; arrayList.add(a0Var); } } } z28 = true; if (!z28) { } } } } z27 = true; if (!z27) { } } str15 = null; if (str17 != null) { } z27 = true; if (!z27) { } } } catch (Throwable th9) { th6 = th9; str11 = str3; str14 = str16; Log.printErrStackTrace("MicroMsg.JsApiPublishTextState", th6, "parse keyBusiBuf err", new Object[0]); str15 = null; if (str17 != null) { } z27 = true; if (!z27) { } if (i15 == length) { } } } z29 = true; if (!z29) { } str15 = null; if (str17 != null) { } z27 = true; if (!z27) { } } catch (Throwable th10) { th5 = th10; str11 = str3; z18 = false; Log.printErrStackTrace("MicroMsg.JsApiPublishTextState", th5, "parse jumpJSON", new Object[0]); if (arrayList.size() > 0) { } if (str != null) { } z19 = true; if (!z19) { } if (!z18) { } } } else { str14 = str16; str11 = str3; str12 = str7; jSONArray = optJSONArray; } if (i15 == length) { break; } i15++; optJSONArray = jSONArray; str7 = str12; str3 = str11; str16 = str14; } catch (Throwable th11) { th5 = th11; str11 = str3; str12 = str7; z18 = false; Log.printErrStackTrace("MicroMsg.JsApiPublishTextState", th5, "parse jumpJSON", new Object[0]); if (arrayList.size() > 0) { } if (str != null) { } z19 = true; if (!z19) { } if (!z18) { } } } } else { str11 = str3; str12 = str7; str13 = str8; } z18 = false; } catch (Throwable th12) { th5 = th12; str11 = str3; str12 = str7; str13 = str8; z18 = false; Log.printErrStackTrace("MicroMsg.JsApiPublishTextState", th5, "parse jumpJSON", new Object[0]); if (arrayList.size() > 0) { } if (str != null) { } z19 = true; if (!z19) { } if (!z18) { } } if (arrayList.size() > 0) { a0 a0Var2 = new a0(); a0Var2.f325223d = "3"; a0Var2.f325225f = "https://support.weixin.qq.com/security/readtemplate?t=w_security_center_website/upgrade&scene=1#wechat_redirect"; arrayList.add(a0Var2); } if (str != null || y.n(str)) { z19 = true; } else { z19 = z18; } if (!z19) { if (str4 == null || y.n(str4)) { z25 = true; } else { z25 = z18; } if (!z25) { if (str5 == null || y.n(str5)) { z26 = true; } else { z26 = z18; } if (!z26 && !arrayList.isEmpty()) { z18 = true; } } } if (!z18) { jVar.f247870d.b(h1Var.f247857c, h1Var.f247863i + ":fail_invalid_arguments", null); return true; } z.a aVar = new z.a(); aVar.a(str6); aVar.f(str4); aVar.e(str); aVar.c(str2); aVar.g(str11); aVar.d(str5); z zVar = aVar.f289149a; zVar.f325204e = str12; zVar.f325203d.J = str13; aVar.b(arrayList); z zVar2 = aVar.f289149a; zVar2.f325218v = z17; Bundle bundle = new Bundle(); bundle.putByteArray("KEY_REQUEST_DATA", zVar2.toByteArray()); XIPCInvoker.a(WeChatProcess.PROCESS_MAIN, bundle, a.class, new b(jVar, h1Var)); return true; } } catch (Throwable th13) { th5 = th13; str11 = str3; str12 = str7; str13 = str8; z17 = z15; z18 = false; Log.printErrStackTrace("MicroMsg.JsApiPublishTextState", th5, "parse jumpJSON", new Object[0]); if (arrayList.size() > 0) { } if (str != null) { } z19 = true; if (!z19) { } if (!z18) { } } } str11 = str3; str12 = str7; str13 = str8; z17 = z15; z18 = false; if (arrayList.size() > 0) { } if (str != null) { } z19 = true; if (!z19) { } if (!z18) { } } @Override // kp3.b1 public String b() { return f168649f; } @Override // kp3.b1 public int c() { return f168648e; } }