package androidx.recyclerview.widget;

import android.animation.ValueAnimator;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewParent;
import androidx.annotation.Nullable;
import java.util.ArrayList;
import java.util.WeakHashMap;
import xyz.netfly.ui.main.sport.LeagueSortActivity;

/* JADX INFO: loaded from: classes.dex */
public final class n0 extends m1 implements s1 {
    public Rect B;
    public long C;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public float f3793d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public float f3794e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public float f3795f;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public float f3796g;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public float f3797h;

    /* JADX INFO: renamed from: i, reason: collision with root package name */
    public float f3798i;

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    public float f3799j;

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public float f3800k;

    /* JADX INFO: renamed from: m, reason: collision with root package name */
    public final h0 f3802m;

    /* JADX INFO: renamed from: o, reason: collision with root package name */
    public int f3804o;

    /* JADX INFO: renamed from: q, reason: collision with root package name */
    public int f3806q;

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    public RecyclerView f3807r;

    /* JADX INFO: renamed from: t, reason: collision with root package name */
    public VelocityTracker f3809t;

    /* JADX INFO: renamed from: u, reason: collision with root package name */
    public ArrayList f3810u;

    /* JADX INFO: renamed from: v, reason: collision with root package name */
    public ArrayList f3811v;

    /* JADX INFO: renamed from: y, reason: collision with root package name */
    public androidx.core.view.t f3814y;

    /* JADX INFO: renamed from: z, reason: collision with root package name */
    public i0 f3815z;

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final ArrayList f3790a = new ArrayList();

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final float[] f3791b = new float[2];

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public j2 f3792c = null;

    /* JADX INFO: renamed from: l, reason: collision with root package name */
    public int f3801l = -1;

    /* JADX INFO: renamed from: n, reason: collision with root package name */
    public int f3803n = 0;

    /* JADX INFO: renamed from: p, reason: collision with root package name */
    public final ArrayList f3805p = new ArrayList();

    /* JADX INFO: renamed from: s, reason: collision with root package name */
    public final d0 f3808s = new d0(this);

    /* JADX INFO: renamed from: w, reason: collision with root package name */
    public View f3812w = null;

    /* JADX INFO: renamed from: x, reason: collision with root package name */
    public int f3813x = -1;
    public final e0 A = new e0(this);

    public n0(mf.c cVar) {
        this.f3802m = cVar;
    }

    public static boolean l(View view, float f10, float f11, float f12, float f13) {
        return f10 >= f12 && f10 <= f12 + ((float) view.getWidth()) && f11 >= f13 && f11 <= f13 + ((float) view.getHeight());
    }

    public void attachToRecyclerView(@Nullable RecyclerView recyclerView) {
        RecyclerView recyclerView2 = this.f3807r;
        if (recyclerView2 == recyclerView) {
            return;
        }
        e0 e0Var = this.A;
        if (recyclerView2 != null) {
            recyclerView2.removeItemDecoration(this);
            this.f3807r.removeOnItemTouchListener(e0Var);
            this.f3807r.removeOnChildAttachStateChangeListener(this);
            ArrayList arrayList = this.f3805p;
            int size = arrayList.size();
            while (true) {
                size--;
                if (size < 0) {
                    break;
                }
                k0 k0Var = (k0) arrayList.get(0);
                k0Var.f3754g.cancel();
                this.f3802m.getClass();
                h0.a(k0Var.f3752e);
            }
            arrayList.clear();
            this.f3812w = null;
            this.f3813x = -1;
            VelocityTracker velocityTracker = this.f3809t;
            if (velocityTracker != null) {
                velocityTracker.recycle();
                this.f3809t = null;
            }
            i0 i0Var = this.f3815z;
            if (i0Var != null) {
                i0Var.f3727a = false;
                this.f3815z = null;
            }
            if (this.f3814y != null) {
                this.f3814y = null;
            }
        }
        this.f3807r = recyclerView;
        if (recyclerView != null) {
            Resources resources = recyclerView.getResources();
            this.f3795f = resources.getDimension(e3.b.item_touch_helper_swipe_escape_velocity);
            this.f3796g = resources.getDimension(e3.b.item_touch_helper_swipe_escape_max_velocity);
            this.f3806q = ViewConfiguration.get(this.f3807r.getContext()).getScaledTouchSlop();
            this.f3807r.addItemDecoration(this);
            this.f3807r.addOnItemTouchListener(e0Var);
            this.f3807r.addOnChildAttachStateChangeListener(this);
            this.f3815z = new i0(this);
            this.f3814y = new androidx.core.view.t(this.f3807r.getContext(), this.f3815z, null);
        }
    }

    @Override // androidx.recyclerview.widget.s1
    public final void b(View view) {
        n(view);
        j2 childViewHolder = this.f3807r.getChildViewHolder(view);
        if (childViewHolder == null) {
            return;
        }
        j2 j2Var = this.f3792c;
        if (j2Var != null && childViewHolder == j2Var) {
            select(null, 0);
            return;
        }
        i(childViewHolder, false);
        if (this.f3790a.remove(childViewHolder.itemView)) {
            this.f3802m.getClass();
            h0.a(childViewHolder);
        }
    }

    @Override // androidx.recyclerview.widget.s1
    public final void c(View view) {
    }

    public final int f(int i10) {
        if ((i10 & 12) == 0) {
            return 0;
        }
        int i11 = this.f3797h > 0.0f ? 8 : 4;
        VelocityTracker velocityTracker = this.f3809t;
        h0 h0Var = this.f3802m;
        if (velocityTracker != null && this.f3801l > -1) {
            float f10 = this.f3796g;
            h0Var.getClass();
            velocityTracker.computeCurrentVelocity(1000, f10);
            float xVelocity = this.f3809t.getXVelocity(this.f3801l);
            float yVelocity = this.f3809t.getYVelocity(this.f3801l);
            int i12 = xVelocity > 0.0f ? 8 : 4;
            float fAbs = Math.abs(xVelocity);
            if ((i12 & i10) != 0 && i11 == i12 && fAbs >= this.f3795f && fAbs > Math.abs(yVelocity)) {
                return i12;
            }
        }
        float width = this.f3807r.getWidth();
        h0Var.getClass();
        float f11 = width * 0.5f;
        if ((i10 & i11) == 0 || Math.abs(this.f3797h) <= f11) {
            return 0;
        }
        return i11;
    }

    public final void g(int i10, int i11, MotionEvent motionEvent) {
        View viewJ;
        if (this.f3792c == null && i10 == 2 && this.f3803n != 2) {
            h0 h0Var = this.f3802m;
            h0Var.getClass();
            if (this.f3807r.getScrollState() == 1) {
                return;
            }
            q1 layoutManager = this.f3807r.getLayoutManager();
            int i12 = this.f3801l;
            j2 childViewHolder = null;
            if (i12 != -1) {
                int iFindPointerIndex = motionEvent.findPointerIndex(i12);
                float x10 = motionEvent.getX(iFindPointerIndex) - this.f3793d;
                float y10 = motionEvent.getY(iFindPointerIndex) - this.f3794e;
                float fAbs = Math.abs(x10);
                float fAbs2 = Math.abs(y10);
                float f10 = this.f3806q;
                if ((fAbs >= f10 || fAbs2 >= f10) && ((fAbs <= fAbs2 || !layoutManager.canScrollHorizontally()) && ((fAbs2 <= fAbs || !layoutManager.canScrollVertically()) && (viewJ = j(motionEvent)) != null))) {
                    childViewHolder = this.f3807r.getChildViewHolder(viewJ);
                }
            }
            if (childViewHolder == null) {
                return;
            }
            RecyclerView recyclerView = this.f3807r;
            l0 l0Var = (l0) h0Var;
            int i13 = l0Var.f3769d;
            int i14 = l0Var.f3770e;
            int i15 = (i14 << 16) | (i13 << 8) | i13 | i14;
            WeakHashMap weakHashMap = androidx.core.view.s1.f1815a;
            int iB = (h0.b(i15, recyclerView.getLayoutDirection()) & 65280) >> 8;
            if (iB == 0) {
                return;
            }
            float x11 = motionEvent.getX(i11);
            float y11 = motionEvent.getY(i11);
            float f11 = x11 - this.f3793d;
            float f12 = y11 - this.f3794e;
            float fAbs3 = Math.abs(f11);
            float fAbs4 = Math.abs(f12);
            float f13 = this.f3806q;
            if (fAbs3 >= f13 || fAbs4 >= f13) {
                if (fAbs3 > fAbs4) {
                    if (f11 < 0.0f && (iB & 4) == 0) {
                        return;
                    }
                    if (f11 > 0.0f && (iB & 8) == 0) {
                        return;
                    }
                } else {
                    if (f12 < 0.0f && (iB & 1) == 0) {
                        return;
                    }
                    if (f12 > 0.0f && (iB & 2) == 0) {
                        return;
                    }
                }
                this.f3798i = 0.0f;
                this.f3797h = 0.0f;
                this.f3801l = motionEvent.getPointerId(0);
                select(childViewHolder, 1);
            }
        }
    }

    @Override // androidx.recyclerview.widget.m1
    public final void getItemOffsets(Rect rect, View view, RecyclerView recyclerView, f2 f2Var) {
        rect.setEmpty();
    }

    public final int h(int i10) {
        if ((i10 & 3) == 0) {
            return 0;
        }
        int i11 = this.f3798i > 0.0f ? 2 : 1;
        VelocityTracker velocityTracker = this.f3809t;
        h0 h0Var = this.f3802m;
        if (velocityTracker != null && this.f3801l > -1) {
            float f10 = this.f3796g;
            h0Var.getClass();
            velocityTracker.computeCurrentVelocity(1000, f10);
            float xVelocity = this.f3809t.getXVelocity(this.f3801l);
            float yVelocity = this.f3809t.getYVelocity(this.f3801l);
            int i12 = yVelocity > 0.0f ? 2 : 1;
            float fAbs = Math.abs(yVelocity);
            if ((i12 & i10) != 0 && i12 == i11 && fAbs >= this.f3795f && fAbs > Math.abs(xVelocity)) {
                return i12;
            }
        }
        float height = this.f3807r.getHeight();
        h0Var.getClass();
        float f11 = height * 0.5f;
        if ((i10 & i11) == 0 || Math.abs(this.f3798i) <= f11) {
            return 0;
        }
        return i11;
    }

    public final void i(j2 j2Var, boolean z10) {
        ArrayList arrayList = this.f3805p;
        for (int size = arrayList.size() - 1; size >= 0; size--) {
            k0 k0Var = (k0) arrayList.get(size);
            if (k0Var.f3752e == j2Var) {
                k0Var.f3758k |= z10;
                if (!k0Var.f3759l) {
                    k0Var.f3754g.cancel();
                }
                arrayList.remove(size);
                return;
            }
        }
    }

    public final View j(MotionEvent motionEvent) {
        float x10 = motionEvent.getX();
        float y10 = motionEvent.getY();
        j2 j2Var = this.f3792c;
        if (j2Var != null) {
            View view = j2Var.itemView;
            if (l(view, x10, y10, this.f3799j + this.f3797h, this.f3800k + this.f3798i)) {
                return view;
            }
        }
        ArrayList arrayList = this.f3805p;
        for (int size = arrayList.size() - 1; size >= 0; size--) {
            k0 k0Var = (k0) arrayList.get(size);
            View view2 = k0Var.f3752e.itemView;
            if (l(view2, x10, y10, k0Var.f3756i, k0Var.f3757j)) {
                return view2;
            }
        }
        return this.f3807r.findChildViewUnder(x10, y10);
    }

    public final void k(float[] fArr) {
        if ((this.f3804o & 12) != 0) {
            fArr[0] = (this.f3799j + this.f3797h) - this.f3792c.itemView.getLeft();
        } else {
            fArr[0] = this.f3792c.itemView.getTranslationX();
        }
        if ((this.f3804o & 3) != 0) {
            fArr[1] = (this.f3800k + this.f3798i) - this.f3792c.itemView.getTop();
        } else {
            fArr[1] = this.f3792c.itemView.getTranslationY();
        }
    }

    /* JADX WARN: Multi-variable type inference failed */
    public final void m(j2 j2Var) {
        ArrayList arrayList;
        int i10;
        int bottom;
        int iAbs;
        int top;
        int iAbs2;
        int left;
        int iAbs3;
        int right;
        int iAbs4;
        char c6;
        int i11;
        int i12;
        int i13;
        if (!this.f3807r.isLayoutRequested() && this.f3803n == 2) {
            h0 h0Var = this.f3802m;
            h0Var.getClass();
            int i14 = (int) (this.f3799j + this.f3797h);
            int i15 = (int) (this.f3800k + this.f3798i);
            if (Math.abs(i15 - j2Var.itemView.getTop()) >= j2Var.itemView.getHeight() * 0.5f || Math.abs(i14 - j2Var.itemView.getLeft()) >= j2Var.itemView.getWidth() * 0.5f) {
                ArrayList arrayList2 = this.f3810u;
                if (arrayList2 == null) {
                    this.f3810u = new ArrayList();
                    this.f3811v = new ArrayList();
                } else {
                    arrayList2.clear();
                    this.f3811v.clear();
                }
                int iRound = Math.round(this.f3799j + this.f3797h);
                int iRound2 = Math.round(this.f3800k + this.f3798i);
                int width = j2Var.itemView.getWidth() + iRound;
                int height = j2Var.itemView.getHeight() + iRound2;
                int i16 = (iRound + width) / 2;
                int i17 = (iRound2 + height) / 2;
                q1 layoutManager = this.f3807r.getLayoutManager();
                int childCount = layoutManager.getChildCount();
                int i18 = 0;
                while (i18 < childCount) {
                    View childAt = layoutManager.getChildAt(i18);
                    if (childAt != j2Var.itemView && childAt.getBottom() >= iRound2 && childAt.getTop() <= height && childAt.getRight() >= iRound && childAt.getLeft() <= width) {
                        j2 childViewHolder = this.f3807r.getChildViewHolder(childAt);
                        c6 = 2;
                        int iAbs5 = Math.abs(i16 - ((childAt.getRight() + childAt.getLeft()) / 2));
                        int iAbs6 = Math.abs(i17 - ((childAt.getBottom() + childAt.getTop()) / 2));
                        int i19 = (iAbs6 * iAbs6) + (iAbs5 * iAbs5);
                        i11 = iRound;
                        int size = this.f3810u.size();
                        i12 = iRound2;
                        i13 = width;
                        int i20 = 0;
                        int i21 = 0;
                        while (i20 < size) {
                            int i22 = size;
                            if (i19 <= ((Integer) this.f3811v.get(i20)).intValue()) {
                                break;
                            }
                            i21++;
                            i20++;
                            size = i22;
                        }
                        this.f3810u.add(i21, childViewHolder);
                        this.f3811v.add(i21, Integer.valueOf(i19));
                    } else {
                        i11 = iRound;
                        i12 = iRound2;
                        i13 = width;
                        c6 = 2;
                    }
                    i18++;
                    iRound = i11;
                    iRound2 = i12;
                    width = i13;
                }
                ArrayList arrayList3 = this.f3810u;
                if (arrayList3.size() == 0) {
                    return;
                }
                int width2 = j2Var.itemView.getWidth() + i14;
                int height2 = j2Var.itemView.getHeight() + i15;
                int left2 = i14 - j2Var.itemView.getLeft();
                int top2 = i15 - j2Var.itemView.getTop();
                int size2 = arrayList3.size();
                j2 j2Var2 = null;
                int i23 = -1;
                int i24 = 0;
                while (i24 < size2) {
                    j2 j2Var3 = (j2) arrayList3.get(i24);
                    if (left2 <= 0 || (right = j2Var3.itemView.getRight() - width2) >= 0) {
                        arrayList = arrayList3;
                        i10 = width2;
                    } else {
                        arrayList = arrayList3;
                        i10 = width2;
                        if (j2Var3.itemView.getRight() > j2Var.itemView.getRight() && (iAbs4 = Math.abs(right)) > i23) {
                            i23 = iAbs4;
                            j2Var2 = j2Var3;
                        }
                    }
                    if (left2 < 0 && (left = j2Var3.itemView.getLeft() - i14) > 0 && j2Var3.itemView.getLeft() < j2Var.itemView.getLeft() && (iAbs3 = Math.abs(left)) > i23) {
                        i23 = iAbs3;
                        j2Var2 = j2Var3;
                    }
                    if (top2 < 0 && (top = j2Var3.itemView.getTop() - i15) > 0 && j2Var3.itemView.getTop() < j2Var.itemView.getTop() && (iAbs2 = Math.abs(top)) > i23) {
                        i23 = iAbs2;
                        j2Var2 = j2Var3;
                    }
                    if (top2 > 0 && (bottom = j2Var3.itemView.getBottom() - height2) < 0 && j2Var3.itemView.getBottom() > j2Var.itemView.getBottom() && (iAbs = Math.abs(bottom)) > i23) {
                        i23 = iAbs;
                        j2Var2 = j2Var3;
                    }
                    i24++;
                    arrayList3 = arrayList;
                    width2 = i10;
                }
                if (j2Var2 == null) {
                    this.f3810u.clear();
                    this.f3811v.clear();
                    return;
                }
                int absoluteAdapterPosition = j2Var2.getAbsoluteAdapterPosition();
                j2Var.getAbsoluteAdapterPosition();
                if (LeagueSortActivity.L(((mf.c) h0Var).f30675f, j2Var.getBindingAdapterPosition(), j2Var2.getBindingAdapterPosition())) {
                    RecyclerView recyclerView = this.f3807r;
                    q1 layoutManager2 = recyclerView.getLayoutManager();
                    if (layoutManager2 instanceof m0) {
                        ((m0) layoutManager2).prepareForDrop(j2Var.itemView, j2Var2.itemView, i14, i15);
                        return;
                    }
                    if (layoutManager2.canScrollHorizontally()) {
                        if (layoutManager2.getDecoratedLeft(j2Var2.itemView) <= recyclerView.getPaddingLeft()) {
                            recyclerView.scrollToPosition(absoluteAdapterPosition);
                        }
                        if (layoutManager2.getDecoratedRight(j2Var2.itemView) >= recyclerView.getWidth() - recyclerView.getPaddingRight()) {
                            recyclerView.scrollToPosition(absoluteAdapterPosition);
                        }
                    }
                    if (layoutManager2.canScrollVertically()) {
                        if (layoutManager2.getDecoratedTop(j2Var2.itemView) <= recyclerView.getPaddingTop()) {
                            recyclerView.scrollToPosition(absoluteAdapterPosition);
                        }
                        if (layoutManager2.getDecoratedBottom(j2Var2.itemView) >= recyclerView.getHeight() - recyclerView.getPaddingBottom()) {
                            recyclerView.scrollToPosition(absoluteAdapterPosition);
                        }
                    }
                }
            }
        }
    }

    public final void n(View view) {
        if (view == this.f3812w) {
            this.f3812w = null;
        }
    }

    public final void o(int i10, int i11, MotionEvent motionEvent) {
        float x10 = motionEvent.getX(i11);
        float y10 = motionEvent.getY(i11);
        float f10 = x10 - this.f3793d;
        this.f3797h = f10;
        this.f3798i = y10 - this.f3794e;
        if ((i10 & 4) == 0) {
            this.f3797h = Math.max(0.0f, f10);
        }
        if ((i10 & 8) == 0) {
            this.f3797h = Math.min(0.0f, this.f3797h);
        }
        if ((i10 & 1) == 0) {
            this.f3798i = Math.max(0.0f, this.f3798i);
        }
        if ((i10 & 2) == 0) {
            this.f3798i = Math.min(0.0f, this.f3798i);
        }
    }

    @Override // androidx.recyclerview.widget.m1
    public final void onDraw(Canvas canvas, RecyclerView recyclerView, f2 f2Var) {
        float f10;
        float f11;
        this.f3813x = -1;
        if (this.f3792c != null) {
            float[] fArr = this.f3791b;
            k(fArr);
            f10 = fArr[0];
            f11 = fArr[1];
        } else {
            f10 = 0.0f;
            f11 = 0.0f;
        }
        j2 j2Var = this.f3792c;
        ArrayList arrayList = this.f3805p;
        this.f3802m.getClass();
        int size = arrayList.size();
        for (int i10 = 0; i10 < size; i10++) {
            k0 k0Var = (k0) arrayList.get(i10);
            float f12 = k0Var.f3748a;
            float f13 = k0Var.f3750c;
            j2 j2Var2 = k0Var.f3752e;
            if (f12 == f13) {
                k0Var.f3756i = j2Var2.itemView.getTranslationX();
            } else {
                k0Var.f3756i = com.google.android.gms.measurement.internal.u1.a(f13, f12, k0Var.f3760m, f12);
            }
            float f14 = k0Var.f3749b;
            float f15 = k0Var.f3751d;
            if (f14 == f15) {
                k0Var.f3757j = j2Var2.itemView.getTranslationY();
            } else {
                k0Var.f3757j = com.google.android.gms.measurement.internal.u1.a(f15, f14, k0Var.f3760m, f14);
            }
            int iSave = canvas.save();
            h0.e(recyclerView, j2Var2, k0Var.f3756i, k0Var.f3757j, false);
            canvas.restoreToCount(iSave);
        }
        if (j2Var != null) {
            int iSave2 = canvas.save();
            h0.e(recyclerView, j2Var, f10, f11, true);
            canvas.restoreToCount(iSave2);
        }
    }

    @Override // androidx.recyclerview.widget.m1
    public final void onDrawOver(Canvas canvas, RecyclerView recyclerView, f2 f2Var) {
        boolean z10 = false;
        if (this.f3792c != null) {
            float[] fArr = this.f3791b;
            k(fArr);
            float f10 = fArr[0];
            float f11 = fArr[1];
        }
        j2 j2Var = this.f3792c;
        ArrayList arrayList = this.f3805p;
        this.f3802m.getClass();
        int size = arrayList.size();
        for (int i10 = 0; i10 < size; i10++) {
            k0 k0Var = (k0) arrayList.get(i10);
            int iSave = canvas.save();
            View view = k0Var.f3752e.itemView;
            canvas.restoreToCount(iSave);
        }
        if (j2Var != null) {
            canvas.restoreToCount(canvas.save());
        }
        for (int i11 = size - 1; i11 >= 0; i11--) {
            k0 k0Var2 = (k0) arrayList.get(i11);
            boolean z11 = k0Var2.f3759l;
            if (z11 && !k0Var2.f3755h) {
                arrayList.remove(i11);
            } else if (!z11) {
                z10 = true;
            }
        }
        if (z10) {
            recyclerView.invalidate();
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:21:0x0051  */
    /* JADX WARN: Removed duplicated region for block: B:85:0x01dc  */
    /* JADX WARN: Removed duplicated region for block: B:91:0x01e8  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public void select(@Nullable j2 j2Var, int i10) {
        h0 h0Var;
        int i11;
        boolean z10;
        h0 h0Var2;
        boolean z11;
        ViewParent parent;
        j2 j2Var2;
        int iH;
        int i12;
        float fSignum;
        float fSignum2;
        if (j2Var == this.f3792c && i10 == this.f3803n) {
            return;
        }
        this.C = Long.MIN_VALUE;
        int i13 = this.f3803n;
        i(j2Var, true);
        this.f3803n = i10;
        if (i10 == 2) {
            if (j2Var == null) {
                throw new IllegalArgumentException("Must pass a ViewHolder when dragging");
            }
            this.f3812w = j2Var.itemView;
        }
        int i14 = (1 << ((i10 * 8) + 8)) - 1;
        j2 j2Var3 = this.f3792c;
        h0 h0Var3 = this.f3802m;
        if (j2Var3 != null) {
            if (j2Var3.itemView.getParent() != null) {
                if (i13 == 2) {
                    i12 = 0;
                } else if (this.f3803n == 2) {
                    iH = 0;
                    i12 = iH;
                } else {
                    RecyclerView recyclerView = this.f3807r;
                    l0 l0Var = (l0) h0Var3;
                    int i15 = l0Var.f3769d;
                    int i16 = l0Var.f3770e;
                    int i17 = (i16 << 16) | (i15 << 8) | i15 | i16;
                    WeakHashMap weakHashMap = androidx.core.view.s1.f1815a;
                    int iB = (h0.b(i17, recyclerView.getLayoutDirection()) & 65280) >> 8;
                    if (iB != 0) {
                        int i18 = (i17 & 65280) >> 8;
                        if (Math.abs(this.f3797h) > Math.abs(this.f3798i)) {
                            iH = f(iB);
                            if (iH <= 0) {
                                iH = h(iB);
                                if (iH <= 0) {
                                }
                            } else if ((i18 & iH) == 0) {
                                iH = h0.c(iH, this.f3807r.getLayoutDirection());
                            }
                            i12 = iH;
                        } else {
                            iH = h(iB);
                            if (iH <= 0) {
                                iH = f(iB);
                                if (iH > 0) {
                                    if ((i18 & iH) == 0) {
                                        iH = h0.c(iH, this.f3807r.getLayoutDirection());
                                    }
                                }
                            }
                            i12 = iH;
                        }
                    }
                }
                VelocityTracker velocityTracker = this.f3809t;
                if (velocityTracker != null) {
                    velocityTracker.recycle();
                    this.f3809t = null;
                }
                if (i12 == 1 || i12 == 2) {
                    fSignum = Math.signum(this.f3798i) * this.f3807r.getHeight();
                    fSignum2 = 0.0f;
                } else if (i12 == 4 || i12 == 8 || i12 == 16 || i12 == 32) {
                    fSignum = 0.0f;
                    fSignum2 = Math.signum(this.f3797h) * this.f3807r.getWidth();
                } else {
                    fSignum2 = 0.0f;
                    fSignum = 0.0f;
                }
                int i19 = i13 == 2 ? 8 : i12 > 0 ? 2 : 4;
                float[] fArr = this.f3791b;
                k(fArr);
                int i20 = i19;
                float f10 = fSignum2;
                h0Var = h0Var3;
                i11 = 8;
                f0 f0Var = new f0(this, j2Var3, i20, i13, fArr[0], fArr[1], f10, fSignum, i12, j2Var3);
                RecyclerView recyclerView2 = this.f3807r;
                h0Var.getClass();
                l1 itemAnimator = recyclerView2.getItemAnimator();
                long j10 = itemAnimator == null ? i20 == 8 ? 200L : 250L : i20 == 8 ? itemAnimator.f3775e : itemAnimator.f3774d;
                ValueAnimator valueAnimator = f0Var.f3754g;
                valueAnimator.setDuration(j10);
                this.f3805p.add(f0Var);
                j2Var3.setIsRecyclable(false);
                valueAnimator.start();
                j2Var2 = null;
                z10 = true;
            } else {
                h0Var = h0Var3;
                i11 = 8;
                n(j2Var3.itemView);
                h0Var.getClass();
                h0.a(j2Var3);
                j2Var2 = null;
                z10 = false;
            }
            this.f3792c = j2Var2;
        } else {
            h0Var = h0Var3;
            i11 = 8;
            z10 = false;
        }
        if (j2Var != null) {
            RecyclerView recyclerView3 = this.f3807r;
            h0Var.getClass();
            h0Var2 = h0Var;
            l0 l0Var2 = (l0) h0Var2;
            int i21 = l0Var2.f3769d;
            int i22 = l0Var2.f3770e;
            int i23 = (i21 << i11) | i21 | i22 | (i22 << 16);
            WeakHashMap weakHashMap2 = androidx.core.view.s1.f1815a;
            this.f3804o = (h0.b(i23, recyclerView3.getLayoutDirection()) & i14) >> (this.f3803n * i11);
            this.f3799j = j2Var.itemView.getLeft();
            this.f3800k = j2Var.itemView.getTop();
            this.f3792c = j2Var;
            if (i10 == 2) {
                z11 = false;
                j2Var.itemView.performHapticFeedback(0);
            }
            parent = this.f3807r.getParent();
            if (parent != null) {
                parent.requestDisallowInterceptTouchEvent(this.f3792c != null ? true : z11);
            }
            if (!z10) {
                this.f3807r.getLayoutManager().requestSimpleAnimationsInNextLayout();
            }
            h0Var2.onSelectedChanged(this.f3792c, this.f3803n);
            this.f3807r.invalidate();
        }
        h0Var2 = h0Var;
        z11 = false;
        parent = this.f3807r.getParent();
        if (parent != null) {
        }
        if (!z10) {
        }
        h0Var2.onSelectedChanged(this.f3792c, this.f3803n);
        this.f3807r.invalidate();
    }
}
