package m7;

import android.content.Context;
import android.content.pm.PackageManager;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.RemoteException;
import android.text.TextUtils;
import android.view.ViewGroup;
import android.webkit.WebView;
import androidx.annotation.Nullable;
import com.google.ads.mediation.admob.AdMobAdapter;
import com.google.android.gms.common.internal.w;
import com.google.android.gms.internal.ads.cp;
import com.google.android.gms.internal.ads.i00;
import com.google.android.gms.internal.ads.nk;
import com.google.android.gms.internal.ads.qo;
import java.util.Map;
import java.util.TreeMap;
import l.b0;
import n7.a4;
import n7.e0;
import n7.e2;
import n7.f4;
import n7.g1;
import n7.h0;
import n7.i4;
import n7.k1;
import n7.m1;
import n7.m2;
import n7.p2;
import n7.q0;
import n7.s2;
import n7.u3;
import n7.v0;

/* JADX INFO: loaded from: classes2.dex */
public final class m extends q0 {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final q7.a f30457a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final f4 f30458b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final Context f30459c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final b0 f30460d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public AsyncTask f30461e;

    @Nullable
    private WebView zze;

    @Nullable
    private e0 zzf;

    public m(Context context, f4 f4Var, String str, q7.a aVar) {
        String strConcat;
        this.f30459c = context;
        this.f30457a = aVar;
        this.f30458b = f4Var;
        this.zze = new WebView(context);
        b0 b0Var = new b0();
        b0Var.f29639a = context.getApplicationContext();
        b0Var.f29640b = str;
        b0Var.f29641c = new TreeMap();
        String packageName = context.getPackageName();
        try {
            String str2 = j8.e.a(context).b(0, context.getPackageName()).versionName;
            StringBuilder sb = new StringBuilder(String.valueOf(packageName).length() + 1 + String.valueOf(str2).length());
            sb.append(packageName);
            sb.append("-");
            sb.append(str2);
            strConcat = sb.toString();
        } catch (PackageManager.NameNotFoundException unused) {
            strConcat = String.valueOf(packageName).concat("-missing");
        }
        b0Var.f29644f = strConcat;
        this.f30460d = b0Var;
        R2(0);
        this.zze.setVerticalScrollBarEnabled(false);
        this.zze.getSettings().setJavaScriptEnabled(true);
        this.zze.setWebViewClient(new j(this));
        this.zze.setOnTouchListener(new k(this));
    }

    @Override // n7.r0
    public final void H1() {
        throw new IllegalStateException("Unused method");
    }

    @Override // n7.r0
    public final void K1(boolean z10) {
    }

    @Override // n7.r0
    public final void N0(nk nkVar) {
        throw new IllegalStateException("Unused method");
    }

    public final void R2(int i10) {
        if (this.zze == null) {
            return;
        }
        this.zze.setLayoutParams(new ViewGroup.LayoutParams(-1, i10));
    }

    public final String S2() {
        String str = (String) this.f30460d.f29643e;
        if (true == TextUtils.isEmpty(str)) {
            str = "www.google.com";
        }
        String str2 = (String) cp.f10014d.j();
        return defpackage.e.p(new StringBuilder(String.valueOf(str).length() + 8 + String.valueOf(str2).length()), "https://", str, str2);
    }

    public final /* synthetic */ WebView T2() {
        return this.zze;
    }

    public final /* synthetic */ e0 U2() {
        return this.zzf;
    }

    @Override // n7.r0
    public final void Y1(String str) {
        throw new IllegalStateException("Unused method");
    }

    @Override // n7.r0
    public final void a0(k8.a aVar) {
    }

    @Override // n7.r0
    public final String c() {
        throw new IllegalStateException("getAdUnitId not implemented");
    }

    @Override // n7.r0
    public final void c2(f4 f4Var) {
        throw new IllegalStateException("AdSize must be set before initialization");
    }

    @Override // n7.r0
    public final g1 d() {
        throw new IllegalStateException("getIAppEventListener not implemented");
    }

    @Override // n7.r0
    public final void d0(long j10) {
    }

    @Override // n7.r0
    public final void e0(boolean z10) {
        throw new IllegalStateException("Unused method");
    }

    @Override // n7.r0
    public final boolean i() {
        return false;
    }

    @Override // n7.r0
    public final void j1(i4 i4Var) {
        throw new IllegalStateException("Unused method");
    }

    @Override // n7.r0
    public final void j2(e2 e2Var) {
    }

    @Override // n7.r0
    public final void k1(k1 k1Var) {
        throw new IllegalStateException("Unused method");
    }

    @Override // n7.r0
    public final e0 l() {
        throw new IllegalStateException("getIAdListener not implemented");
    }

    @Override // n7.r0
    public final void o() {
        throw new IllegalStateException("Unused method");
    }

    @Override // n7.r0
    public final void o2(m1 m1Var) {
    }

    @Override // n7.r0
    public final void s1(a4 a4Var, h0 h0Var) {
    }

    @Override // n7.r0
    public final long x() {
        return 0L;
    }

    @Override // n7.r0
    public final boolean z(a4 a4Var) {
        w.f(this.zze, "This Search Ad has already been torn down");
        b0 b0Var = this.f30460d;
        b0Var.getClass();
        b0Var.f29642d = a4Var.f30902j.f31018a;
        Bundle bundle = a4Var.f30905m;
        Bundle bundle2 = bundle != null ? bundle.getBundle(AdMobAdapter.class.getName()) : null;
        if (bundle2 != null) {
            String str = (String) cp.f10013c.j();
            for (String str2 : bundle2.keySet()) {
                if (str.equals(str2)) {
                    b0Var.f29643e = bundle2.getString(str2);
                } else if (str2.startsWith("csa_")) {
                    ((Map) b0Var.f29641c).put(str2.substring(4), bundle2.getString(str2));
                }
            }
            Map map = (Map) b0Var.f29641c;
            map.put("SDKVersion", this.f30457a.f32212a);
            if (((Boolean) cp.f10011a.j()).booleanValue()) {
                Bundle bundleJ = com.bumptech.glide.g.J((Context) b0Var.f29639a, (String) cp.f10012b.j());
                for (String str3 : bundleJ.keySet()) {
                    map.put(str3, bundleJ.get(str3).toString());
                }
            }
        }
        this.f30461e = new l(this).execute(new Void[0]);
        return true;
    }

    @Override // n7.r0
    public final boolean zzB() {
        return false;
    }

    @Override // n7.q0, n7.r0
    public final void zzC(i00 i00Var) {
        throw new IllegalStateException("Unused method");
    }

    @Override // n7.r0
    @Nullable
    public final p2 zzF() {
        return null;
    }

    @Override // n7.q0, n7.r0
    public final void zzG(u3 u3Var) {
        throw new IllegalStateException("Unused method");
    }

    @Override // n7.q0, n7.r0
    public final void zzH(s2 s2Var) {
        throw new IllegalStateException("Unused method");
    }

    @Override // n7.r0
    public final k8.a zzb() {
        w.d("getAdFrame must be called on the main UI thread.");
        return new k8.b(this.zze);
    }

    @Override // n7.r0
    public final void zzc() {
        w.d("destroy must be called on the main UI thread.");
        this.f30461e.cancel(true);
        this.zze.destroy();
        this.zze = null;
    }

    @Override // n7.r0
    public final boolean zzd() {
        return false;
    }

    @Override // n7.q0, n7.r0
    public final void zzdR(e0 e0Var) {
        this.zzf = e0Var;
    }

    @Override // n7.r0
    public final void zzf() {
        w.d("pause must be called on the main UI thread.");
    }

    @Override // n7.r0
    public final void zzg() {
        w.d("resume must be called on the main UI thread.");
    }

    @Override // n7.q0, n7.r0
    public final void zzi(g1 g1Var) {
        throw new IllegalStateException("Unused method");
    }

    @Override // n7.q0, n7.r0
    public final void zzj(v0 v0Var) {
        throw new IllegalStateException("Unused method");
    }

    @Override // n7.r0
    public final Bundle zzk() {
        throw new IllegalStateException("Unused method");
    }

    @Override // n7.r0
    public final void zzl() {
        throw new IllegalStateException("Unused method");
    }

    @Override // n7.r0
    public final void zzm() {
        throw new IllegalStateException("Unused method");
    }

    @Override // n7.r0
    public final f4 zzn() {
        return this.f30458b;
    }

    @Override // n7.r0
    public final void zzq() {
        throw new IllegalStateException("Unused method");
    }

    @Override // n7.r0
    @Nullable
    public final String zzr() throws RemoteException {
        return null;
    }

    @Override // n7.r0
    @Nullable
    public final String zzs() throws RemoteException {
        return null;
    }

    @Override // n7.r0
    @Nullable
    public final m2 zzt() {
        return null;
    }

    @Override // n7.q0, n7.r0
    public final void zzx(qo qoVar) {
        throw new IllegalStateException("Unused method");
    }

    @Override // n7.q0, n7.r0
    public final void zzy(n7.b0 b0Var) {
        throw new IllegalStateException("Unused method");
    }
}
