package com.google.android.gms.internal.ads;

import android.os.Bundle;
import android.text.TextUtils;
import java.util.Map;
import java.util.Objects;
import org.json.JSONException;
import org.json.JSONObject;
import xyz.stream.download.config.InnerConstant;

/* JADX INFO: loaded from: classes2.dex */
public final class m40 implements ys {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final /* synthetic */ int f13954a;

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

    public /* synthetic */ m40(Object obj, int i10) {
        this.f13954a = i10;
        this.f13955b = obj;
    }

    @Override // com.google.android.gms.internal.ads.ys
    public final void a(Object obj, Map map) {
        Bundle bundleZzl = null;
        bundleZzl = null;
        n00Var = null;
        n00 n00Var = null;
        switch (this.f13954a) {
            case 0:
                String str = (String) map.get("action");
                if (str == null) {
                    q7.j.d("Action missing from video GMSG.");
                    return;
                }
                if (str.equals("src")) {
                    String str2 = (String) map.get("src");
                    if (str2 == null) {
                        q7.j.d("src missing from video GMSG.");
                        return;
                    }
                    mv mvVar = (mv) this.f13955b;
                    mvVar.getClass();
                    Bundle bundle = new Bundle();
                    bundle.putString("mediaUrl", str2);
                    mvVar.f14360a.zzc(bundle);
                    return;
                }
                return;
            case 1:
                js jsVar = (js) this.f13955b;
                if (jsVar == null) {
                    return;
                }
                String str3 = (String) map.get("name");
                if (str3 == null) {
                    q7.j.c("Ad metadata with no name parameter.");
                    str3 = "";
                }
                if (map.containsKey("info")) {
                    try {
                        bundleZzl = p7.y.zzl(new JSONObject((String) map.get("info")));
                        break;
                    } catch (JSONException unused) {
                    }
                }
                if (bundleZzl == null) {
                    q7.j.b("Failed to convert ad metadata to Bundle.");
                    return;
                } else {
                    jsVar.d(bundleZzl, str3);
                    return;
                }
            case 2:
                String str4 = (String) map.get("name");
                if (str4 == null) {
                    q7.j.d("App event with no name parameter.");
                    return;
                } else {
                    ((ks) this.f13955b).zzb(str4, (String) map.get("info"));
                    return;
                }
            case 3:
                x50 x50Var = (x50) obj;
                boolean zEquals = "1".equals(map.get("transparentBackground"));
                boolean zEquals2 = "1".equals(map.get("blur"));
                float f10 = 0.0f;
                try {
                    if (map.get("blurRadius") != null) {
                        f10 = Float.parseFloat((String) map.get("blurRadius"));
                    }
                    break;
                } catch (NumberFormatException unused2) {
                }
                at atVar = (at) this.f13955b;
                synchronized (atVar) {
                    atVar.f9277a = zEquals;
                    atVar.f9280d.set(true);
                }
                synchronized (atVar) {
                    atVar.f9278b = zEquals2;
                    atVar.f9279c = f10;
                }
                x50Var.s0(zEquals);
                return;
            case 4:
                if (map == null || !map.containsKey(InnerConstant.Db.f36069id) || TextUtils.isEmpty((CharSequence) map.get(InnerConstant.Db.f36069id)) || !map.containsKey("event_type") || TextUtils.isEmpty((CharSequence) map.get("event_type"))) {
                    p7.l0.g("Ignoring onDeviceStorageEvent GMSG: missing required parameters.");
                    return;
                }
                try {
                    long j10 = Long.parseLong((String) map.get(InnerConstant.Db.f36069id));
                    int i10 = Integer.parseInt((String) map.get("event_type"));
                    m7.n.C.f30472k.getClass();
                    ((pr0) this.f13955b).a(i10, j10, System.currentTimeMillis());
                    return;
                } catch (NumberFormatException unused3) {
                    p7.l0.h();
                    return;
                }
            case 5:
                String str5 = (String) map.get("action");
                boolean zEquals3 = "grant".equals(str5);
                Object obj2 = this.f13955b;
                if (zEquals3) {
                    try {
                        int i11 = Integer.parseInt((String) map.get("amount"));
                        String str6 = (String) map.get("type");
                        if (!TextUtils.isEmpty(str6)) {
                            n00Var = new n00(str6, i11);
                        }
                    } catch (NumberFormatException unused4) {
                    }
                    ((kt) obj2).zzb(n00Var);
                    return;
                }
                if ("video_start".equals(str5)) {
                    ((kt) obj2).zza();
                    return;
                } else {
                    if ("video_complete".equals(str5)) {
                        ((kt) obj2).zzc();
                        return;
                    }
                    return;
                }
            case 6:
                if (map != null) {
                    String str7 = (String) map.get("height");
                    if (TextUtils.isEmpty(str7)) {
                        return;
                    }
                    try {
                        int i12 = Integer.parseInt(str7);
                        k60 k60Var = (k60) this.f13955b;
                        synchronized (k60Var) {
                            try {
                                if (k60Var.f13131n0 != i12) {
                                    k60Var.f13131n0 = i12;
                                    k60Var.requestLayout();
                                }
                            } finally {
                            }
                            break;
                        }
                        return;
                    } catch (Exception unused5) {
                        return;
                    }
                }
                return;
            default:
                ((on0) this.f13955b).f15114b.d(map);
                return;
        }
    }

    public m40(k60 k60Var) {
        this.f13954a = 6;
        Objects.requireNonNull(k60Var);
        this.f13955b = k60Var;
    }
}
