package o;

import java.util.AbstractMap;
import java.util.Collection;
import java.util.Map;
import java.util.Set;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.yW, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class C3002yW extends AbstractMap implements Map, AJ {
    public BP l = new BP(1);
    public C0737ah0 m;
    public Object n;

    /* renamed from: o, reason: collision with root package name */
    public int f806o;
    public int p;
    public C3097zW q;

    public C3002yW(C3097zW c3097zW) {
        this.m = c3097zW.l;
        this.p = c3097zW.m;
        this.q = c3097zW;
    }

    public final C3097zW a() {
        C0737ah0 c0737ah0 = this.m;
        C3097zW c3097zW = this.q;
        if (c0737ah0 != c3097zW.l) {
            this.l = new BP(1);
            c3097zW = new C3097zW(this.m, this.p);
        }
        this.q = c3097zW;
        return c3097zW;
    }

    public final boolean b(Object obj) {
        return this.m.d(obj != null ? obj.hashCode() : 0, 0, obj);
    }

    public final Object c(Object obj) {
        return this.m.g(obj != null ? obj.hashCode() : 0, 0, obj);
    }

    @Override // java.util.AbstractMap, java.util.Map
    public final void clear() {
        this.m = C0737ah0.e;
        e(0);
    }

    @Override // java.util.AbstractMap, java.util.Map
    public final /* bridge */ boolean containsKey(Object obj) {
        if (obj instanceof AbstractC3005yZ) {
            return b((AbstractC3005yZ) obj);
        }
        return false;
    }

    @Override // java.util.AbstractMap, java.util.Map
    public final /* bridge */ boolean containsValue(Object obj) {
        if (obj instanceof InterfaceC3118zi0) {
            return super.containsValue((InterfaceC3118zi0) obj);
        }
        return false;
    }

    public final Object d(Object obj) {
        this.n = null;
        C0737ah0 c0737ah0N = this.m.n(obj != null ? obj.hashCode() : 0, obj, 0, this);
        if (c0737ah0N == null) {
            c0737ah0N = C0737ah0.e;
        }
        this.m = c0737ah0N;
        return this.n;
    }

    public final void e(int i) {
        this.p = i;
        this.f806o++;
    }

    @Override // java.util.AbstractMap, java.util.Map
    public final Set entrySet() {
        return new EW(0, this);
    }

    @Override // java.util.AbstractMap, java.util.Map
    public final /* bridge */ Object get(Object obj) {
        if (obj instanceof AbstractC3005yZ) {
            return (InterfaceC3118zi0) c((AbstractC3005yZ) obj);
        }
        return null;
    }

    @Override // java.util.Map
    public final /* bridge */ Object getOrDefault(Object obj, Object obj2) {
        return !(obj instanceof AbstractC3005yZ) ? obj2 : (InterfaceC3118zi0) super.getOrDefault((AbstractC3005yZ) obj, (InterfaceC3118zi0) obj2);
    }

    @Override // java.util.AbstractMap, java.util.Map
    public final Set keySet() {
        return new EW(1, this);
    }

    @Override // java.util.AbstractMap, java.util.Map
    public final Object put(Object obj, Object obj2) {
        this.n = null;
        this.m = this.m.l(obj != null ? obj.hashCode() : 0, obj, obj2, 0, this);
        return this.n;
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Type inference failed for: r0v14, types: [o.BW] */
    @Override // java.util.AbstractMap, java.util.Map
    public final void putAll(Map map) {
        C3097zW c3097zWA = null;
        C3097zW c3097zW = map instanceof BW ? (BW) map : null;
        if (c3097zW == null) {
            C3002yW c3002yW = map instanceof C3002yW ? (C3002yW) map : null;
            if (c3002yW != null) {
                c3097zWA = c3002yW.a();
            }
        } else {
            c3097zWA = c3097zW;
        }
        if (c3097zWA == null) {
            super.putAll(map);
            return;
        }
        C2186pr c2186pr = new C2186pr();
        c2186pr.a = 0;
        int i = this.p;
        this.m = this.m.m(c3097zWA.l, 0, c2186pr, this);
        int i2 = (c3097zWA.m + i) - c2186pr.a;
        if (i != i2) {
            e(i2);
        }
    }

    @Override // java.util.Map
    public final boolean remove(Object obj, Object obj2) {
        int i = this.p;
        C0737ah0 c0737ah0O = this.m.o(obj != null ? obj.hashCode() : 0, obj, obj2, 0, this);
        if (c0737ah0O == null) {
            c0737ah0O = C0737ah0.e;
        }
        this.m = c0737ah0O;
        return i != this.p;
    }

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

    @Override // java.util.AbstractMap, java.util.Map
    public final Collection values() {
        return new C2993yN(1, this);
    }

    @Override // java.util.AbstractMap, java.util.Map
    public final /* bridge */ Object remove(Object obj) {
        if (obj instanceof AbstractC3005yZ) {
            return (InterfaceC3118zi0) d((AbstractC3005yZ) obj);
        }
        return null;
    }
}
