package o;

import android.view.View;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.gms.common.api.Api;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.uV, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class C2621uV extends AbstractC1349h10 {
    public RecyclerView a;
    public final C2030o90 b = new C2030o90(this);
    public PU c;
    public PU d;

    public static int b(View view, AbstractC1624jv abstractC1624jv) {
        return ((abstractC1624jv.c(view) / 2) + abstractC1624jv.e(view)) - ((abstractC1624jv.l() / 2) + abstractC1624jv.k());
    }

    public static View c(AbstractC1157f10 abstractC1157f10, AbstractC1624jv abstractC1624jv) {
        int iV = abstractC1157f10.v();
        View view = null;
        if (iV == 0) {
            return null;
        }
        int iL = (abstractC1624jv.l() / 2) + abstractC1624jv.k();
        int i = Api.BaseClientBuilder.API_PRIORITY_OTHER;
        for (int i2 = 0; i2 < iV; i2++) {
            View viewU = abstractC1157f10.u(i2);
            int iAbs = Math.abs(((abstractC1624jv.c(viewU) / 2) + abstractC1624jv.e(viewU)) - iL);
            if (iAbs < i) {
                view = viewU;
                i = iAbs;
            }
        }
        return view;
    }

    public final int[] a(AbstractC1157f10 abstractC1157f10, View view) {
        int[] iArr = new int[2];
        if (abstractC1157f10.d()) {
            iArr[0] = b(view, d(abstractC1157f10));
        } else {
            iArr[0] = 0;
        }
        if (abstractC1157f10.e()) {
            iArr[1] = b(view, e(abstractC1157f10));
            return iArr;
        }
        iArr[1] = 0;
        return iArr;
    }

    public final AbstractC1624jv d(AbstractC1157f10 abstractC1157f10) {
        PU pu = this.d;
        if (pu == null || ((AbstractC1157f10) pu.b) != abstractC1157f10) {
            this.d = new PU(abstractC1157f10, 0);
        }
        return this.d;
    }

    public final AbstractC1624jv e(AbstractC1157f10 abstractC1157f10) {
        PU pu = this.c;
        if (pu == null || ((AbstractC1157f10) pu.b) != abstractC1157f10) {
            this.c = new PU(abstractC1157f10, 1);
        }
        return this.c;
    }

    public final void f() {
        AbstractC1157f10 layoutManager;
        RecyclerView recyclerView = this.a;
        if (recyclerView == null || (layoutManager = recyclerView.getLayoutManager()) == null) {
            return;
        }
        View viewC = layoutManager.e() ? c(layoutManager, e(layoutManager)) : layoutManager.d() ? c(layoutManager, d(layoutManager)) : null;
        if (viewC == null) {
            return;
        }
        int[] iArrA = a(layoutManager, viewC);
        int i = iArrA[0];
        if (i == 0 && iArrA[1] == 0) {
            return;
        }
        this.a.Z(i, false, iArrA[1]);
    }
}
