package d;

import e.InterfaceC0451b;
import java.io.Serializable;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;

/* JADX INFO: renamed from: d.e, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public class C0425e extends AbstractC0421a implements Map, Cloneable, Serializable, InvocationHandler {

    /* JADX INFO: renamed from: Z, reason: collision with root package name */
    private final Map f3681Z;

    public C0425e() {
        this(16, false);
    }

    @Override // java.util.Map
    public void clear() {
        this.f3681Z.clear();
    }

    public Object clone() {
        return new C0425e(this.f3681Z instanceof LinkedHashMap ? new LinkedHashMap(this.f3681Z) : new HashMap(this.f3681Z));
    }

    @Override // java.util.Map
    public boolean containsKey(Object obj) {
        boolean zContainsKey = this.f3681Z.containsKey(obj);
        return (zContainsKey || !(obj instanceof Number)) ? zContainsKey : this.f3681Z.containsKey(obj.toString());
    }

    @Override // java.util.Map
    public boolean containsValue(Object obj) {
        return this.f3681Z.containsValue(obj);
    }

    @Override // java.util.Map
    public Set entrySet() {
        return this.f3681Z.entrySet();
    }

    @Override // java.util.Map
    public boolean equals(Object obj) {
        return this.f3681Z.equals(obj);
    }

    @Override // java.util.Map
    public Object get(Object obj) {
        Object obj2 = this.f3681Z.get(obj);
        return (obj2 == null && (obj instanceof Number)) ? this.f3681Z.get(obj.toString()) : obj2;
    }

    @Override // java.util.Map
    public int hashCode() {
        return this.f3681Z.hashCode();
    }

    @Override // java.lang.reflect.InvocationHandler
    public Object invoke(Object obj, Method method, Object[] objArr) {
        Class<?>[] parameterTypes = method.getParameterTypes();
        String strName = null;
        if (parameterTypes.length == 1) {
            if (method.getName().equals("equals")) {
                return Boolean.valueOf(equals(objArr[0]));
            }
            if (method.getReturnType() != Void.TYPE) {
                throw new C0424d("illegal setter");
            }
            InterfaceC0451b interfaceC0451b = (InterfaceC0451b) l.l.O(method, InterfaceC0451b.class);
            String strName2 = (interfaceC0451b == null || interfaceC0451b.name().length() == 0) ? null : interfaceC0451b.name();
            if (strName2 == null) {
                String name = method.getName();
                if (!name.startsWith("set")) {
                    throw new C0424d("illegal setter");
                }
                String strSubstring = name.substring(3);
                if (strSubstring.length() == 0) {
                    throw new C0424d("illegal setter");
                }
                strName2 = Character.toLowerCase(strSubstring.charAt(0)) + strSubstring.substring(1);
            }
            this.f3681Z.put(strName2, objArr[0]);
            return null;
        }
        if (parameterTypes.length != 0) {
            throw new UnsupportedOperationException(method.toGenericString());
        }
        if (method.getReturnType() == Void.TYPE) {
            throw new C0424d("illegal getter");
        }
        InterfaceC0451b interfaceC0451b2 = (InterfaceC0451b) l.l.O(method, InterfaceC0451b.class);
        if (interfaceC0451b2 != null && interfaceC0451b2.name().length() != 0) {
            strName = interfaceC0451b2.name();
        }
        if (strName == null) {
            String name2 = method.getName();
            if (name2.startsWith("get")) {
                String strSubstring2 = name2.substring(3);
                if (strSubstring2.length() == 0) {
                    throw new C0424d("illegal getter");
                }
                strName = Character.toLowerCase(strSubstring2.charAt(0)) + strSubstring2.substring(1);
            } else {
                if (!name2.startsWith("is")) {
                    if (name2.startsWith("hashCode")) {
                        return Integer.valueOf(hashCode());
                    }
                    if (name2.startsWith("toString")) {
                        return toString();
                    }
                    throw new C0424d("illegal getter");
                }
                String strSubstring3 = name2.substring(2);
                if (strSubstring3.length() == 0) {
                    throw new C0424d("illegal getter");
                }
                strName = Character.toLowerCase(strSubstring3.charAt(0)) + strSubstring3.substring(1);
            }
        }
        return l.l.h(this.f3681Z.get(strName), method.getGenericReturnType(), g.i.r());
    }

    @Override // java.util.Map
    public boolean isEmpty() {
        return this.f3681Z.isEmpty();
    }

    @Override // java.util.Map
    public Set keySet() {
        return this.f3681Z.keySet();
    }

    @Override // java.util.Map
    public void putAll(Map map) {
        this.f3681Z.putAll(map);
    }

    public Map r() {
        return this.f3681Z;
    }

    @Override // java.util.Map
    public Object remove(Object obj) {
        return this.f3681Z.remove(obj);
    }

    public String s(String str) {
        Object obj = get(str);
        if (obj == null) {
            return null;
        }
        return obj.toString();
    }

    @Override // java.util.Map
    public int size() {
        return this.f3681Z.size();
    }

    @Override // java.util.Map
    /* JADX INFO: renamed from: t, reason: merged with bridge method [inline-methods] */
    public Object put(String str, Object obj) {
        return this.f3681Z.put(str, obj);
    }

    public Object u(Class cls, g.i iVar, int i2) {
        return cls == Map.class ? this : (cls != Object.class || containsKey(AbstractC0421a.f3675r)) ? l.l.u(this, cls, iVar) : this;
    }

    @Override // java.util.Map
    public Collection values() {
        return this.f3681Z.values();
    }

    public C0425e(Map map) {
        if (map == null) {
            throw new IllegalArgumentException("map is null.");
        }
        this.f3681Z = map;
    }

    public C0425e(boolean z2) {
        this(16, z2);
    }

    public C0425e(int i2) {
        this(i2, false);
    }

    public C0425e(int i2, boolean z2) {
        if (z2) {
            this.f3681Z = new LinkedHashMap(i2);
        } else {
            this.f3681Z = new HashMap(i2);
        }
    }
}
