package p138.p176.p177.p242.p258.p263;

import com.google.android.gms.internal.measurement.zzes;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import p138.p176.p177.p242.p258.p263.AbstractC4444;
import p138.p176.p177.p242.p258.p263.AbstractC4532;

/* JADX INFO: renamed from: ދ.ހ.֏.ހ.ރ.ނ.ˊ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public abstract class AbstractC4444<MessageType extends AbstractC4444<MessageType, BuilderType>, BuilderType extends AbstractC4532<MessageType, BuilderType>> implements InterfaceC4450 {
    public int zza = 0;

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static <T> void m7404(Iterable<T> iterable, List<? super T> list) {
        C4545.m7591(iterable);
        if (iterable instanceof InterfaceC4530) {
            List<?> listMo7482 = ((InterfaceC4530) iterable).mo7482();
            InterfaceC4530 interfaceC4530 = (InterfaceC4530) list;
            int size = list.size();
            for (Object obj : listMo7482) {
                if (obj == null) {
                    int size2 = interfaceC4530.size() - size;
                    StringBuilder sb = new StringBuilder(37);
                    sb.append("Element at index ");
                    sb.append(size2);
                    sb.append(" is null.");
                    String string = sb.toString();
                    for (int size3 = interfaceC4530.size() - 1; size3 >= size; size3--) {
                        interfaceC4530.remove(size3);
                    }
                    throw new NullPointerException(string);
                }
                if (obj instanceof AbstractC4435) {
                    interfaceC4530.mo7480((AbstractC4435) obj);
                } else {
                    interfaceC4530.add((String) obj);
                }
            }
            return;
        }
        if (iterable instanceof InterfaceC4654) {
            list.addAll((Collection) iterable);
            return;
        }
        if ((list instanceof ArrayList) && (iterable instanceof Collection)) {
            ((ArrayList) list).ensureCapacity(((Collection) iterable).size() + list.size());
        }
        int size4 = list.size();
        for (T t : iterable) {
            if (t == null) {
                int size5 = list.size() - size4;
                StringBuilder sb2 = new StringBuilder(37);
                sb2.append("Element at index ");
                sb2.append(size5);
                sb2.append(" is null.");
                String string2 = sb2.toString();
                for (int size6 = list.size() - 1; size6 >= size4; size6--) {
                    list.remove(size6);
                }
                throw new NullPointerException(string2);
            }
            list.add(t);
        }
    }

    @Override // p138.p176.p177.p242.p258.p263.InterfaceC4450
    /* JADX INFO: renamed from: ނ, reason: contains not printable characters */
    public final AbstractC4435 mo7405() {
        try {
            C4438 c4438M7391 = AbstractC4435.m7391(mo7364());
            mo7358(c4438M7391.f13790);
            return c4438M7391.m7399();
        } catch (IOException e) {
            String name = getClass().getName();
            StringBuilder sb = new StringBuilder("ByteString".length() + name.length() + 62);
            sb.append("Serializing ");
            sb.append(name);
            sb.append(" to a ");
            sb.append("ByteString");
            sb.append(" threw an IOException (should never happen).");
            throw new RuntimeException(sb.toString(), e);
        }
    }

    /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
    public final byte[] m7406() {
        try {
            byte[] bArr = new byte[mo7364()];
            zzes zzesVarM1356 = zzes.m1356(bArr);
            mo7358(zzesVarM1356);
            if (zzesVarM1356.mo1387() == 0) {
                return bArr;
            }
            throw new IllegalStateException("Did not write as much data as expected.");
        } catch (IOException e) {
            String name = getClass().getName();
            StringBuilder sb = new StringBuilder(10 + name.length() + 62);
            sb.append("Serializing ");
            sb.append(name);
            sb.append(" to a ");
            sb.append("byte array");
            sb.append(" threw an IOException (should never happen).");
            throw new RuntimeException(sb.toString(), e);
        }
    }
}
