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

import android.os.Bundle;
import java.util.ArrayDeque;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import xyz.stream.download.config.InnerConstant;

/* JADX INFO: loaded from: classes2.dex */
public final class m51 implements m61 {

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

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

    public /* synthetic */ m51(int i10, HashMap map) {
        this.f13960a = i10;
        this.f13961b = map;
    }

    @Override // com.google.android.gms.internal.ads.m61
    public final void zza(Object obj) {
        int i10 = this.f13960a;
        Map map = this.f13961b;
        switch (i10) {
            case 0:
                zd0 zd0Var = (zd0) obj;
                if (!map.isEmpty()) {
                    Bundle bundle = zd0Var.f19235a;
                    JSONArray jSONArray = new JSONArray();
                    for (Map.Entry entry : map.entrySet()) {
                        ArrayDeque arrayDeque = (ArrayDeque) entry.getValue();
                        if (!arrayDeque.isEmpty()) {
                            or0 or0Var = (or0) entry.getKey();
                            JSONObject jSONObject = new JSONObject();
                            try {
                                jSONObject.put(InnerConstant.Db.f36069id, or0Var.f15160a);
                                jSONObject.put("event_type", or0Var.f15161b);
                                JSONArray jSONArray2 = new JSONArray();
                                Iterator it = arrayDeque.iterator();
                                while (it.hasNext()) {
                                    jSONArray2.put((Long) it.next());
                                    break;
                                }
                                jSONObject.put("timestamps", jSONArray2);
                                jSONArray.put(jSONObject);
                            } catch (JSONException unused) {
                                p7.l0.h();
                            }
                        }
                    }
                    if (jSONArray.length() > 0) {
                        bundle.putString("on_device_storage_records", jSONArray.toString());
                    }
                    break;
                }
                break;
            default:
                try {
                    ((JSONObject) obj).put("video_decoders", n7.x.f31085g.f31086a.c(map));
                } catch (JSONException e10) {
                    p7.l0.g("Could not encode video decoder properties: ".concat(String.valueOf(e10.getMessage())));
                }
                break;
        }
    }
}
