package com.ironsource.sdk.controller; import android.content.Context; import android.text.TextUtils; import com.ironsource.i9; import com.ironsource.ju; import com.ironsource.kf; import com.ironsource.mj; import com.ironsource.pf; import com.ironsource.wp; import com.ironsource.xu; import org.json.JSONException; import org.json.JSONObject; /* loaded from: classes4.dex */ public class a implements kf { private static final String d = "loadWithUrl"; private static final String e = "sendMessage"; public static final String f = "removeAdView"; public static final String g = "webviewAction"; public static final String h = "handleGetViewVisibility"; private static final String i = "functionName"; private static final String j = "functionParams"; private static final String k = "success"; private static final String l = "fail"; public static final String m = "errMsg"; private static final String n = "%s | unsupported AdViews API"; private xu a; private pf b = pf.a(); private Context c; public static class b { String a; JSONObject b; String c; String d; private b() { } } public a(Context context) { this.c = context; } private b a(String str) throws JSONException { JSONObject jSONObject = new JSONObject(str); b bVar = new b(); bVar.a = jSONObject.optString("functionName"); bVar.b = jSONObject.optJSONObject("functionParams"); bVar.c = jSONObject.optString("success"); bVar.d = jSONObject.optString("fail"); return bVar; } public void a(xu xuVar) { this.a = xuVar; } public void a(String str, mj mjVar) throws Exception { char c; b a = a(str); wp wpVar = new wp(); try { String str2 = a.a; switch (str2.hashCode()) { case -1384357108: if (str2.equals(f)) { c = 2; break; } c = 65535; break; case 691453791: if (str2.equals("sendMessage")) { c = 1; break; } c = 65535; break; case 842351363: if (str2.equals("loadWithUrl")) { c = 0; break; } c = 65535; break; case 1182065477: if (str2.equals("handleGetViewVisibility")) { c = 3; break; } c = 65535; break; case 1491535759: if (str2.equals(g)) { c = 4; break; } c = 65535; break; default: c = 65535; break; } if (c == 0) { this.b.a(this, a.b, this.c, a.c, a.d); return; } if (c == 1) { this.b.d(a.b, a.c, a.d); return; } if (c == 2) { this.b.c(a.b, a.c, a.d); } else if (c == 3) { this.b.a(a.b, a.c, a.d); } else { if (c != 4) { throw new IllegalArgumentException(String.format(n, a.a)); } this.b.b(a.b, a.c, a.d); } } catch (Exception e2) { i9.d().a(e2); wpVar.b("errMsg", e2.getMessage()); String c2 = this.b.c(a.b); if (!TextUtils.isEmpty(c2)) { wpVar.b("adViewId", c2); } mjVar.a(false, a.d, wpVar); } } @Override // com.ironsource.kf public void a(String str, String str2, String str3) { a(str, ju.a(str2, str3)); } @Override // com.ironsource.kf public void a(String str, JSONObject jSONObject) { if (this.a == null || TextUtils.isEmpty(str)) { return; } this.a.a(str, jSONObject); } }