package okhttp3;

import J4.a;
import java.security.cert.Certificate;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.List;
import kotlin.jvm.internal.o;
import kotlin.jvm.internal.p;
import okhttp3.internal.tls.CertificateChainCleaner;
import x4.AbstractC3253s;

/* JADX INFO: loaded from: classes3.dex */
final class CertificatePinner$check$1 extends p implements a {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final /* synthetic */ CertificatePinner f21951a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final /* synthetic */ List f21952b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final /* synthetic */ String f21953c;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public CertificatePinner$check$1(CertificatePinner certificatePinner, List list, String str) {
        super(0);
        this.f21951a = certificatePinner;
        this.f21952b = list;
        this.f21953c = str;
    }

    @Override // J4.a
    public final Object invoke() {
        List listClean;
        CertificateChainCleaner certificateChainCleaner = this.f21951a.f21949b;
        List<Certificate> list = this.f21952b;
        if (certificateChainCleaner != null && (listClean = certificateChainCleaner.clean(list, this.f21953c)) != null) {
            list = listClean;
        }
        ArrayList arrayList = new ArrayList(AbstractC3253s.G(list, 10));
        for (Certificate certificate : list) {
            o.f(certificate, "null cannot be cast to non-null type java.security.cert.X509Certificate");
            arrayList.add((X509Certificate) certificate);
        }
        return arrayList;
    }
}
