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

import java.util.AbstractMap;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.RandomAccess;
import java.util.Set;

/* JADX INFO: loaded from: classes2.dex */
public class dr1 extends AbstractMap {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public transient br1 f10488a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public transient nr1 f10489b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final transient Map f10490c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final /* synthetic */ zzgsv f10491d;

    public dr1(zzgsv zzgsvVar, Map map) {
        Objects.requireNonNull(zzgsvVar);
        this.f10491d = zzgsvVar;
        this.f10490c = map;
    }

    @Override // java.util.AbstractMap, java.util.Map
    /* JADX INFO: renamed from: a, reason: merged with bridge method [inline-methods] */
    public final Set entrySet() {
        br1 br1Var = this.f10488a;
        if (br1Var != null) {
            return br1Var;
        }
        br1 br1Var2 = new br1(this);
        this.f10488a = br1Var2;
        return br1Var2;
    }

    @Override // java.util.AbstractMap, java.util.Map
    /* JADX INFO: renamed from: b, reason: merged with bridge method [inline-methods] */
    public final Collection values() {
        nr1 nr1Var = this.f10489b;
        if (nr1Var != null) {
            return nr1Var;
        }
        nr1 nr1Var2 = new nr1(this);
        this.f10489b = nr1Var2;
        return nr1Var2;
    }

    @Override // java.util.AbstractMap, java.util.Map
    public final void clear() {
        zzgsv zzgsvVar = this.f10491d;
        if (this.f10490c == zzgsvVar.f19755d) {
            zzgsvVar.zzf();
            return;
        }
        cr1 cr1Var = new cr1(this);
        while (cr1Var.hasNext()) {
            cr1Var.next();
            cr1Var.remove();
        }
    }

    @Override // java.util.AbstractMap, java.util.Map
    public final boolean containsKey(Object obj) {
        Map map = this.f10490c;
        map.getClass();
        try {
            return map.containsKey(obj);
        } catch (ClassCastException | NullPointerException unused) {
            return false;
        }
    }

    public final AbstractMap.SimpleImmutableEntry d(Map.Entry entry) {
        Object key = entry.getKey();
        Collection collection = (Collection) entry.getValue();
        zzgse zzgseVar = (zzgse) this.f10491d;
        zzgseVar.getClass();
        List list = (List) collection;
        return new AbstractMap.SimpleImmutableEntry(key, list instanceof RandomAccess ? new hr1(zzgseVar, key, list, null) : new mr1(zzgseVar, key, list, null));
    }

    @Override // java.util.AbstractMap, java.util.Map
    public final boolean equals(Object obj) {
        return this == obj || this.f10490c.equals(obj);
    }

    @Override // java.util.AbstractMap, java.util.Map
    public final Object get(Object obj) {
        Object obj2;
        Map map = this.f10490c;
        map.getClass();
        try {
            obj2 = map.get(obj);
        } catch (ClassCastException | NullPointerException unused) {
            obj2 = null;
        }
        Collection collection = (Collection) obj2;
        if (collection == null) {
            return null;
        }
        zzgse zzgseVar = (zzgse) this.f10491d;
        zzgseVar.getClass();
        List list = (List) collection;
        return list instanceof RandomAccess ? new hr1(zzgseVar, obj, list, null) : new mr1(zzgseVar, obj, list, null);
    }

    @Override // java.util.AbstractMap, java.util.Map
    public final int hashCode() {
        return this.f10490c.hashCode();
    }

    @Override // java.util.AbstractMap, java.util.Map
    public Set keySet() {
        zzgsv zzgsvVar = this.f10491d;
        Set set = zzgsvVar.f15162a;
        if (set != null) {
            return set;
        }
        Set setA = zzgsvVar.a();
        zzgsvVar.f15162a = setA;
        return setA;
    }

    @Override // java.util.AbstractMap, java.util.Map
    public final /* synthetic */ Object remove(Object obj) {
        Collection collection = (Collection) this.f10490c.remove(obj);
        if (collection == null) {
            return null;
        }
        zzgsv zzgsvVar = this.f10491d;
        List list = (List) ((zzgvv) zzgsvVar).f19784f.zza();
        list.addAll(collection);
        zzgsvVar.f19756e -= collection.size();
        collection.clear();
        return list;
    }

    @Override // java.util.AbstractMap, java.util.Map
    public final int size() {
        return this.f10490c.size();
    }

    @Override // java.util.AbstractMap
    public final String toString() {
        return this.f10490c.toString();
    }
}
