package androidx.recyclerview.widget;

import android.view.View;

/* JADX INFO: compiled from: ViewBoundsCheck.java */
/* JADX INFO: loaded from: classes.dex */
class l {
    final b a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    a f1169b = new a();

    /* JADX INFO: compiled from: ViewBoundsCheck.java */
    static class a {
        int a = 0;

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        int f1170b;

        /* JADX INFO: renamed from: c, reason: collision with root package name */
        int f1171c;

        /* JADX INFO: renamed from: d, reason: collision with root package name */
        int f1172d;

        /* JADX INFO: renamed from: e, reason: collision with root package name */
        int f1173e;

        a() {
        }

        void a(int i2) {
            this.a = i2 | this.a;
        }

        boolean b() {
            int i2 = this.a;
            if ((i2 & 7) != 0 && (i2 & (c(this.f1172d, this.f1170b) << 0)) == 0) {
                return false;
            }
            int i3 = this.a;
            if ((i3 & 112) != 0 && (i3 & (c(this.f1172d, this.f1171c) << 4)) == 0) {
                return false;
            }
            int i4 = this.a;
            if ((i4 & 1792) != 0 && (i4 & (c(this.f1173e, this.f1170b) << 8)) == 0) {
                return false;
            }
            int i5 = this.a;
            return (i5 & 28672) == 0 || (i5 & (c(this.f1173e, this.f1171c) << 12)) != 0;
        }

        int c(int i2, int i3) {
            if (i2 > i3) {
                return 1;
            }
            return i2 == i3 ? 2 : 4;
        }

        void d() {
            this.a = 0;
        }

        void e(int i2, int i3, int i4, int i5) {
            this.f1170b = i2;
            this.f1171c = i3;
            this.f1172d = i4;
            this.f1173e = i5;
        }
    }

    /* JADX INFO: compiled from: ViewBoundsCheck.java */
    interface b {
        View a(int i2);

        int b();

        int c(View view);

        int d();

        int e(View view);
    }

    l(b bVar) {
        this.a = bVar;
    }

    View a(int i2, int i3, int i4, int i5) {
        int iD = this.a.d();
        int iB = this.a.b();
        int i6 = i3 > i2 ? 1 : -1;
        View view = null;
        while (i2 != i3) {
            View viewA = this.a.a(i2);
            this.f1169b.e(iD, iB, this.a.c(viewA), this.a.e(viewA));
            if (i4 != 0) {
                this.f1169b.d();
                this.f1169b.a(i4);
                if (this.f1169b.b()) {
                    return viewA;
                }
            }
            if (i5 != 0) {
                this.f1169b.d();
                this.f1169b.a(i5);
                if (this.f1169b.b()) {
                    view = viewA;
                }
            }
            i2 += i6;
        }
        return view;
    }

    boolean b(View view, int i2) {
        this.f1169b.e(this.a.d(), this.a.b(), this.a.c(view), this.a.e(view));
        if (i2 == 0) {
            return false;
        }
        this.f1169b.d();
        this.f1169b.a(i2);
        return this.f1169b.b();
    }
}
