package m3;

import android.view.View;
import com.google.android.gms.internal.measurement.X1;
import com.google.android.material.bottomsheet.BottomSheetBehavior;
import java.lang.ref.WeakReference;

/* JADX INFO: renamed from: m3.a, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class C1162a extends X1 {

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public final /* synthetic */ BottomSheetBehavior f14592e;

    public C1162a(BottomSheetBehavior bottomSheetBehavior) {
        this.f14592e = bottomSheetBehavior;
    }

    @Override // com.google.android.gms.internal.measurement.X1
    public final void B(int i) {
        if (i == 1) {
            BottomSheetBehavior bottomSheetBehavior = this.f14592e;
            if (bottomSheetBehavior.f10116E) {
                bottomSheetBehavior.z(1);
            }
        }
    }

    @Override // com.google.android.gms.internal.measurement.X1
    public final void C(View view, int i, int i5) {
        this.f14592e.u(i5);
    }

    /* JADX WARN: Removed duplicated region for block: B:22:0x004d  */
    @Override // com.google.android.gms.internal.measurement.X1
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void D(View view, float f3, float f7) {
        int iW;
        int i = 6;
        BottomSheetBehavior bottomSheetBehavior = this.f14592e;
        if (f7 < 0.0f) {
            if (bottomSheetBehavior.f10135b) {
                iW = bottomSheetBehavior.f10156x;
            } else {
                int top = view.getTop();
                int i5 = bottomSheetBehavior.f10157y;
                if (top > i5) {
                    iW = i5;
                } else {
                    iW = bottomSheetBehavior.w();
                }
            }
            i = 3;
        } else if (bottomSheetBehavior.f10115C && bottomSheetBehavior.B(view, f7)) {
            if (Math.abs(f3) >= Math.abs(f7) || f7 <= 500.0f) {
                if (view.getTop() > (bottomSheetBehavior.w() + bottomSheetBehavior.f10123M) / 2) {
                    iW = bottomSheetBehavior.f10123M;
                    i = 5;
                } else {
                    if (bottomSheetBehavior.f10135b) {
                        iW = bottomSheetBehavior.f10156x;
                    } else if (Math.abs(view.getTop() - bottomSheetBehavior.w()) < Math.abs(view.getTop() - bottomSheetBehavior.f10157y)) {
                        iW = bottomSheetBehavior.w();
                    } else {
                        iW = bottomSheetBehavior.f10157y;
                    }
                    i = 3;
                }
            }
        } else if (f7 == 0.0f || Math.abs(f3) > Math.abs(f7)) {
            int top2 = view.getTop();
            if (!bottomSheetBehavior.f10135b) {
                int i8 = bottomSheetBehavior.f10157y;
                if (top2 < i8) {
                    if (top2 < Math.abs(top2 - bottomSheetBehavior.f10113A)) {
                        iW = bottomSheetBehavior.w();
                        i = 3;
                    } else {
                        iW = bottomSheetBehavior.f10157y;
                    }
                } else if (Math.abs(top2 - i8) < Math.abs(top2 - bottomSheetBehavior.f10113A)) {
                    iW = bottomSheetBehavior.f10157y;
                } else {
                    iW = bottomSheetBehavior.f10113A;
                    i = 4;
                }
            } else if (Math.abs(top2 - bottomSheetBehavior.f10156x) < Math.abs(top2 - bottomSheetBehavior.f10113A)) {
                iW = bottomSheetBehavior.f10156x;
                i = 3;
            } else {
                iW = bottomSheetBehavior.f10113A;
                i = 4;
            }
        } else {
            if (bottomSheetBehavior.f10135b) {
                iW = bottomSheetBehavior.f10113A;
            } else {
                int top3 = view.getTop();
                if (Math.abs(top3 - bottomSheetBehavior.f10157y) < Math.abs(top3 - bottomSheetBehavior.f10113A)) {
                    iW = bottomSheetBehavior.f10157y;
                } else {
                    iW = bottomSheetBehavior.f10113A;
                }
            }
            i = 4;
        }
        bottomSheetBehavior.C(i, iW, view, true);
    }

    @Override // com.google.android.gms.internal.measurement.X1
    public final boolean N(View view, int i) {
        BottomSheetBehavior bottomSheetBehavior = this.f14592e;
        int i5 = bottomSheetBehavior.f10117F;
        if (i5 == 1 || bottomSheetBehavior.f10130T) {
            return false;
        }
        if (i5 == 3 && bottomSheetBehavior.f10128R == i) {
            WeakReference weakReference = bottomSheetBehavior.f10125O;
            View view2 = weakReference != null ? (View) weakReference.get() : null;
            if (view2 != null && view2.canScrollVertically(-1)) {
                return false;
            }
        }
        WeakReference weakReference2 = bottomSheetBehavior.f10124N;
        return weakReference2 != null && weakReference2.get() == view;
    }

    @Override // com.google.android.gms.internal.measurement.X1
    public final int g(View view, int i) {
        return view.getLeft();
    }

    @Override // com.google.android.gms.internal.measurement.X1
    public final int h(View view, int i) {
        BottomSheetBehavior bottomSheetBehavior = this.f14592e;
        int iW = bottomSheetBehavior.w();
        int i5 = bottomSheetBehavior.f10115C ? bottomSheetBehavior.f10123M : bottomSheetBehavior.f10113A;
        return i < iW ? iW : i > i5 ? i5 : i;
    }

    @Override // com.google.android.gms.internal.measurement.X1
    public final int r() {
        BottomSheetBehavior bottomSheetBehavior = this.f14592e;
        return bottomSheetBehavior.f10115C ? bottomSheetBehavior.f10123M : bottomSheetBehavior.f10113A;
    }
}
