package com.google.android.material.appbar;

import android.content.Context;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.View;
import android.view.ViewConfiguration;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import j3.AbstractC1068a;

/* JADX INFO: loaded from: classes.dex */
public class AppBarLayout$BaseBehavior<T> extends AbstractC1068a {

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public boolean f10095b;

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

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

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

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

    public AppBarLayout$BaseBehavior() {
    }

    /* JADX WARN: Removed duplicated region for block: B:21:0x0046  */
    /* JADX WARN: Removed duplicated region for block: B:25:0x004e  */
    @Override // z.AbstractC1769a
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final boolean f(CoordinatorLayout coordinatorLayout, View view, MotionEvent motionEvent) {
        int iFindPointerIndex;
        if (this.f10098e < 0) {
            this.f10098e = ViewConfiguration.get(coordinatorLayout.getContext()).getScaledTouchSlop();
        }
        if (motionEvent.getActionMasked() == 2 && this.f10095b) {
            int i = this.f10096c;
            if (i != -1 && (iFindPointerIndex = motionEvent.findPointerIndex(i)) != -1) {
                int y8 = (int) motionEvent.getY(iFindPointerIndex);
                if (Math.abs(y8 - this.f10097d) > this.f10098e) {
                    this.f10097d = y8;
                    return true;
                }
                if (motionEvent.getActionMasked() != 0) {
                }
            }
        } else {
            if (motionEvent.getActionMasked() != 0) {
                this.f10096c = -1;
                motionEvent.getX();
                motionEvent.getY();
                throw new ClassCastException();
            }
            VelocityTracker velocityTracker = this.f10099f;
            if (velocityTracker != null) {
                velocityTracker.addMovement(motionEvent);
            }
        }
        return false;
    }

    @Override // j3.AbstractC1068a, z.AbstractC1769a
    public final boolean g(CoordinatorLayout coordinatorLayout, View view, int i) {
        throw new ClassCastException();
    }

    @Override // z.AbstractC1769a
    public final boolean h(CoordinatorLayout coordinatorLayout, View view) {
        throw new ClassCastException();
    }

    @Override // z.AbstractC1769a
    public final /* synthetic */ void j(CoordinatorLayout coordinatorLayout, View view, View view2, int i, int i5, int[] iArr, int i8) {
        throw new ClassCastException();
    }

    @Override // z.AbstractC1769a
    public final void k(CoordinatorLayout coordinatorLayout, View view, int i, int i5, int i8, int[] iArr) {
        throw new ClassCastException();
    }

    @Override // z.AbstractC1769a
    public final void m(View view, Parcelable parcelable) {
        throw new ClassCastException();
    }

    @Override // z.AbstractC1769a
    public final Parcelable n(View view) {
        throw new ClassCastException();
    }

    @Override // z.AbstractC1769a
    public final boolean o(View view, int i, int i5) {
        throw new ClassCastException();
    }

    @Override // z.AbstractC1769a
    public final void p(View view, View view2, int i) {
        throw new ClassCastException();
    }

    /* JADX WARN: Removed duplicated region for block: B:28:0x005c  */
    /* JADX WARN: Removed duplicated region for block: B:31:0x0063 A[RETURN] */
    /* JADX WARN: Removed duplicated region for block: B:32:0x0064 A[RETURN] */
    @Override // z.AbstractC1769a
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final boolean q(View view, MotionEvent motionEvent) {
        VelocityTracker velocityTracker;
        int actionMasked = motionEvent.getActionMasked();
        if (actionMasked != 1) {
            if (actionMasked == 2) {
                int iFindPointerIndex = motionEvent.findPointerIndex(this.f10096c);
                if (iFindPointerIndex != -1) {
                    this.f10097d = (int) motionEvent.getY(iFindPointerIndex);
                    view.getClass();
                    throw new ClassCastException();
                }
            }
            if (actionMasked != 3) {
                if (actionMasked == 6) {
                    int i = motionEvent.getActionIndex() == 0 ? 1 : 0;
                    this.f10096c = motionEvent.getPointerId(i);
                    this.f10097d = (int) (motionEvent.getY(i) + 0.5f);
                }
            }
            velocityTracker = this.f10099f;
            if (velocityTracker != null) {
                velocityTracker.addMovement(motionEvent);
            }
            return !this.f10095b;
        }
        VelocityTracker velocityTracker2 = this.f10099f;
        if (velocityTracker2 != null) {
            velocityTracker2.addMovement(motionEvent);
            this.f10099f.computeCurrentVelocity(1000);
            this.f10099f.getYVelocity(this.f10096c);
            view.getClass();
            throw new ClassCastException();
        }
        this.f10095b = false;
        this.f10096c = -1;
        VelocityTracker velocityTracker3 = this.f10099f;
        if (velocityTracker3 != null) {
            velocityTracker3.recycle();
            this.f10099f = null;
        }
        velocityTracker = this.f10099f;
        if (velocityTracker != null) {
        }
        if (!this.f10095b) {
        }
    }

    public AppBarLayout$BaseBehavior(Context context, AttributeSet attributeSet) {
    }
}
