package androidx.datastore.preferences.protobuf;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/* JADX INFO: renamed from: androidx.datastore.preferences.protobuf.t, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public abstract class AbstractC1030t extends AbstractC1012a {
    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, AbstractC1030t> defaultInstanceMap = new ConcurrentHashMap();
    private int memoizedSerializedSize;
    protected h0 unknownFields;

    public AbstractC1030t() {
        this.memoizedHashCode = 0;
        this.memoizedSerializedSize = -1;
        this.unknownFields = h0.f11393f;
    }

    public static AbstractC1030t d(Class cls) {
        AbstractC1030t abstractC1030t = defaultInstanceMap.get(cls);
        if (abstractC1030t == null) {
            try {
                Class.forName(cls.getName(), true, cls.getClassLoader());
                abstractC1030t = defaultInstanceMap.get(cls);
            } catch (ClassNotFoundException e6) {
                throw new IllegalStateException("Class initialization cannot fail.", e6);
            }
        }
        if (abstractC1030t != null) {
            return abstractC1030t;
        }
        AbstractC1030t abstractC1030t2 = (AbstractC1030t) ((AbstractC1030t) q0.b(cls)).c(6);
        if (abstractC1030t2 == null) {
            throw new IllegalStateException();
        }
        defaultInstanceMap.put(cls, abstractC1030t2);
        return abstractC1030t2;
    }

    public static Object e(Method method, AbstractC1012a abstractC1012a, Object... objArr) {
        try {
            return method.invoke(abstractC1012a, objArr);
        } catch (IllegalAccessException e6) {
            throw new RuntimeException("Couldn't use Java reflection to implement protocol message reflection.", e6);
        } catch (InvocationTargetException e7) {
            Throwable cause = e7.getCause();
            if (cause instanceof RuntimeException) {
                throw ((RuntimeException) cause);
            }
            if (cause instanceof Error) {
                throw ((Error) cause);
            }
            throw new RuntimeException("Unexpected exception thrown by generated accessor method.", cause);
        }
    }

    public static final boolean f(AbstractC1030t abstractC1030t, boolean z6) {
        byte bByteValue = ((Byte) abstractC1030t.c(1)).byteValue();
        if (bByteValue == 1) {
            return true;
        }
        if (bByteValue == 0) {
            return false;
        }
        U u6 = U.f11340c;
        u6.getClass();
        boolean zC = u6.a(abstractC1030t.getClass()).c(abstractC1030t);
        if (z6) {
            abstractC1030t.c(2);
        }
        return zC;
    }

    public static void j(Class cls, AbstractC1030t abstractC1030t) {
        abstractC1030t.h();
        defaultInstanceMap.put(cls, abstractC1030t);
    }

    @Override // androidx.datastore.preferences.protobuf.AbstractC1012a
    public final int a(X x6) {
        int iG;
        int iG2;
        if (g()) {
            if (x6 == null) {
                U u6 = U.f11340c;
                u6.getClass();
                iG2 = u6.a(getClass()).g(this);
            } else {
                iG2 = x6.g(this);
            }
            if (iG2 >= 0) {
                return iG2;
            }
            throw new IllegalStateException(Z0.o.l("serialized size must be non-negative, was ", iG2));
        }
        int i6 = this.memoizedSerializedSize;
        if ((i6 & Integer.MAX_VALUE) != Integer.MAX_VALUE) {
            return i6 & Integer.MAX_VALUE;
        }
        if (x6 == null) {
            U u7 = U.f11340c;
            u7.getClass();
            iG = u7.a(getClass()).g(this);
        } else {
            iG = x6.g(this);
        }
        k(iG);
        return iG;
    }

    @Override // androidx.datastore.preferences.protobuf.AbstractC1012a
    public final void b(C1021j c1021j) {
        U u6 = U.f11340c;
        u6.getClass();
        X xA = u6.a(getClass());
        F f6 = c1021j.f11408c;
        if (f6 == null) {
            f6 = new F(c1021j);
        }
        xA.e(this, f6);
    }

    public abstract Object c(int i6);

    public final boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null || getClass() != obj.getClass()) {
            return false;
        }
        U u6 = U.f11340c;
        u6.getClass();
        return u6.a(getClass()).i(this, (AbstractC1030t) obj);
    }

    public final boolean g() {
        return (this.memoizedSerializedSize & Integer.MIN_VALUE) != 0;
    }

    public final void h() {
        this.memoizedSerializedSize &= Integer.MAX_VALUE;
    }

    public final int hashCode() {
        if (g()) {
            U u6 = U.f11340c;
            u6.getClass();
            return u6.a(getClass()).h(this);
        }
        if (this.memoizedHashCode == 0) {
            U u7 = U.f11340c;
            u7.getClass();
            this.memoizedHashCode = u7.a(getClass()).h(this);
        }
        return this.memoizedHashCode;
    }

    public final AbstractC1030t i() {
        return (AbstractC1030t) c(4);
    }

    public final void k(int i6) {
        if (i6 < 0) {
            throw new IllegalStateException(Z0.o.l("serialized size must be non-negative, was ", i6));
        }
        this.memoizedSerializedSize = (i6 & Integer.MAX_VALUE) | (this.memoizedSerializedSize & Integer.MIN_VALUE);
    }

    public final String toString() {
        String string = super.toString();
        char[] cArr = M.f11319a;
        StringBuilder sb = new StringBuilder();
        sb.append("# ");
        sb.append(string);
        M.c(this, sb, 0);
        return sb.toString();
    }
}
