package androidx.datastore.preferences.protobuf;

import defpackage.AbstractC2819;
import defpackage.AbstractC2990;
import defpackage.AbstractC3453;
import defpackage.C1260;
import defpackage.C1291;
import defpackage.C2347;
import defpackage.C3718;
import defpackage.InterfaceC4249;
import j$.util.concurrent.ConcurrentHashMap;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Map;

/* renamed from: androidx.datastore.preferences.protobuf.ˇʼʤˎ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public abstract class AbstractC0001 extends AbstractC0007 {
    private static final int MEMOIZED_SERIALIZED_SIZE_MASK = Integer.MAX_VALUE;
    private static final int MUTABLE_FLAG_MASK = Integer.MIN_VALUE;
    static final int UNINITIALIZED_HASH_CODE = 0;
    static final int UNINITIALIZED_SERIALIZED_SIZE = Integer.MAX_VALUE;
    private static Map<Object, AbstractC0001> defaultInstanceMap = new ConcurrentHashMap();
    private int memoizedSerializedSize;
    protected C0010 unknownFields;

    public AbstractC0001() {
        this.memoizedHashCode = UNINITIALIZED_HASH_CODE;
        this.memoizedSerializedSize = -1;
        this.unknownFields = C0010.f364;
    }

    /* renamed from: ˇʼʤˎ, reason: contains not printable characters */
    public static Object m99(Method method, AbstractC0001 abstractC0001, Object... objArr) {
        try {
            return method.invoke(abstractC0001, objArr);
        } catch (IllegalAccessException e) {
            ᵨᴵᵺ.ᵪʩ("Couldn't use Java reflection to implement protocol message reflection.", e);
            return null;
        } catch (InvocationTargetException e2) {
            Throwable cause = e2.getCause();
            if (cause instanceof RuntimeException) {
                throw ((RuntimeException) cause);
            }
            if (cause instanceof Error) {
                throw ((Error) cause);
            }
            ᵨᴵᵺ.ᵪʩ("Unexpected exception thrown by generated accessor method.", cause);
            return null;
        }
    }

    /* renamed from: ˏˋٴ, reason: contains not printable characters */
    public static final boolean m100(AbstractC0001 abstractC0001, boolean z) {
        byte bByteValue = ((Byte) abstractC0001.mo104(1)).byteValue();
        if (bByteValue == 1) {
            return true;
        }
        if (bByteValue == 0) {
            return false;
        }
        C1291 c1291 = C1291.f5320;
        c1291.getClass();
        boolean zMo124 = c1291.m4013(abstractC0001.getClass()).mo124(abstractC0001);
        if (z) {
            abstractC0001.mo104(2);
        }
        return zMo124;
    }

    /* renamed from: ᵶᵷᵕ, reason: contains not printable characters */
    public static void m101(Class cls, AbstractC0001 abstractC0001) {
        abstractC0001.m109();
        defaultInstanceMap.put(cls, abstractC0001);
    }

    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    public static AbstractC0001 m102(Class cls) throws ClassNotFoundException {
        AbstractC0001 abstractC0001 = defaultInstanceMap.get(cls);
        if (abstractC0001 == null) {
            try {
                Class.forName(cls.getName(), true, cls.getClassLoader());
                abstractC0001 = defaultInstanceMap.get(cls);
            } catch (ClassNotFoundException e) {
                C1260.m3810("Class initialization cannot fail.", e);
                return null;
            }
        }
        if (abstractC0001 != null) {
            return abstractC0001;
        }
        AbstractC0001 abstractC00012 = (AbstractC0001) ((AbstractC0001) AbstractC3453.m7846(cls)).mo104(6);
        if (abstractC00012 != null) {
            defaultInstanceMap.put(cls, abstractC00012);
            return abstractC00012;
        }
        ᵨᴵᵺ.ˌʾˀ();
        return null;
    }

    public final boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null || getClass() != obj.getClass()) {
            return false;
        }
        C1291 c1291 = C1291.f5320;
        c1291.getClass();
        return c1291.m4013(getClass()).mo129(this, (AbstractC0001) obj);
    }

    public final int hashCode() {
        if (m103()) {
            C1291 c1291 = C1291.f5320;
            c1291.getClass();
            return c1291.m4013(getClass()).mo121(this);
        }
        if (this.memoizedHashCode == 0) {
            C1291 c12912 = C1291.f5320;
            c12912.getClass();
            this.memoizedHashCode = c12912.m4013(getClass()).mo121(this);
        }
        return this.memoizedHashCode;
    }

    public final String toString() {
        String string = super.toString();
        char[] cArr = AbstractC0004.f345;
        StringBuilder sb = new StringBuilder();
        sb.append("# ");
        sb.append(string);
        AbstractC0004.m150(this, sb, UNINITIALIZED_HASH_CODE);
        return sb.toString();
    }

    /* renamed from: ˎˏʜʾ, reason: contains not printable characters */
    public final boolean m103() {
        return (this.memoizedSerializedSize & MUTABLE_FLAG_MASK) != 0;
    }

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public abstract Object mo104(int i);

    /* renamed from: ᵝᵵᵺ, reason: contains not printable characters */
    public final AbstractC0001 m105() {
        return (AbstractC0001) mo104(4);
    }

    @Override // androidx.datastore.preferences.protobuf.AbstractC0007
    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public final int mo106(InterfaceC4249 interfaceC4249) {
        int iMo123;
        int iMo1232;
        if (m103()) {
            if (interfaceC4249 == null) {
                C1291 c1291 = C1291.f5320;
                c1291.getClass();
                iMo1232 = c1291.m4013(getClass()).mo123(this);
            } else {
                iMo1232 = interfaceC4249.mo123(this);
            }
            if (iMo1232 >= 0) {
                return iMo1232;
            }
            ᵹˉᵞ.ᵳٴᵶ(AbstractC2990.m7313(iMo1232, "serialized size must be non-negative, was "));
            return UNINITIALIZED_HASH_CODE;
        }
        int i = this.memoizedSerializedSize;
        if ((i & Integer.MAX_VALUE) != Integer.MAX_VALUE) {
            return i & Integer.MAX_VALUE;
        }
        if (interfaceC4249 == null) {
            C1291 c12912 = C1291.f5320;
            c12912.getClass();
            iMo123 = c12912.m4013(getClass()).mo123(this);
        } else {
            iMo123 = interfaceC4249.mo123(this);
        }
        m108(iMo123);
        return iMo123;
    }

    @Override // androidx.datastore.preferences.protobuf.AbstractC0007
    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public final void mo107(C2347 c2347) {
        C1291 c1291 = C1291.f5320;
        c1291.getClass();
        InterfaceC4249 interfaceC4249M4013 = c1291.m4013(getClass());
        C3718 c3718 = c2347.f9185;
        if (c3718 == null) {
            c3718 = new C3718();
            AbstractC2819.m6913(c2347, "output");
            c3718.f13883 = c2347;
            c2347.f9185 = c3718;
        }
        interfaceC4249M4013.mo146(this, c3718);
    }

    /* renamed from: ᵸˑ, reason: contains not printable characters */
    public final void m108(int i) {
        if (i < 0) {
            ᵹˉᵞ.ᵳٴᵶ(AbstractC2990.m7313(i, "serialized size must be non-negative, was "));
        } else {
            this.memoizedSerializedSize = (i & Integer.MAX_VALUE) | (this.memoizedSerializedSize & MUTABLE_FLAG_MASK);
        }
    }

    /* renamed from: ᵹᵝᵶ, reason: contains not printable characters */
    public final void m109() {
        this.memoizedSerializedSize &= Integer.MAX_VALUE;
    }
}
