package com.google.android.material.bottomsheet;

import android.animation.ValueAnimator;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.util.SparseIntArray;
import android.util.TypedValue;
import android.view.View;
import android.view.ViewConfiguration;
import ar.tvplayer.tv.R;
import defpackage.AbstractC2172;
import defpackage.C2098;
import defpackage.C2140;
import defpackage.C3347;
import defpackage.C4335;
import defpackage.C4766;
import java.util.ArrayList;

/* JADX INFO: loaded from: classes3.dex */
public class BottomSheetBehavior<V extends View> extends ᵟˌᵫ {

    /* JADX INFO: renamed from: ˊᵫᵗ, reason: contains not printable characters */
    public final ColorStateList f1032;

    /* JADX INFO: renamed from: ˋˈ, reason: contains not printable characters */
    public final boolean f1033;

    /* JADX INFO: renamed from: ᵝᵶ, reason: contains not printable characters */
    public final int f1034;

    /* JADX INFO: renamed from: ᵨᵣ, reason: contains not printable characters */
    public int f1035;

    /* JADX INFO: renamed from: ᵪᵹᵥᵻ, reason: contains not printable characters */
    public int f1036;

    /* JADX INFO: renamed from: ᵮᵣᵗˈ, reason: contains not printable characters */
    public final ValueAnimator f1037;

    /* JADX INFO: renamed from: ᵱᵽʡᵚ, reason: contains not printable characters */
    public final C2140 f1038;

    /* JADX INFO: renamed from: ᵵᵽ, reason: contains not printable characters */
    public final C3347 f1039;

    /* JADX INFO: renamed from: ᵶᵥᵝ, reason: contains not printable characters */
    public boolean f1040;

    /* JADX INFO: renamed from: ᵷᵺʾᵖ, reason: contains not printable characters */
    public final boolean f1041;

    /* JADX INFO: renamed from: ᵻʽᵯ, reason: contains not printable characters */
    public final boolean f1042;

    /* JADX INFO: renamed from: ᵻˈᵦʼ, reason: contains not printable characters */
    public boolean f1043;

    public BottomSheetBehavior() {
        this.f1041 = true;
        new ᵟˑʽ(this);
        this.f1036 = 4;
        new ArrayList();
        new ArrayList();
        new SparseIntArray();
        new SparseIntArray();
        new SparseIntArray();
        new Rect();
    }

    public BottomSheetBehavior(Context context, AttributeSet attributeSet) {
        int i;
        this.f1041 = true;
        new ᵟˑʽ(this);
        this.f1036 = 4;
        new ArrayList();
        new ArrayList();
        new SparseIntArray();
        new SparseIntArray();
        new SparseIntArray();
        new Rect();
        context.getResources().getDimensionPixelSize(R.dimen.h);
        TypedArray typedArrayObtainStyledAttributes = context.obtainStyledAttributes(attributeSet, AbstractC2172.f8637);
        if (typedArrayObtainStyledAttributes.hasValue(3)) {
            this.f1032 = ᵺᵘ.ˉᵲ(context, typedArrayObtainStyledAttributes, 3);
        }
        if (typedArrayObtainStyledAttributes.hasValue(24)) {
            this.f1038 = C2140.m5654(context, attributeSet, R.attr.h, R.style.h).m7053();
        }
        C2140 c2140 = this.f1038;
        if (c2140 != null) {
            C3347 c3347 = new C3347(c2140);
            this.f1039 = c3347;
            c3347.f12842.f16502 = new C2098(context);
            c3347.m7683();
            ColorStateList colorStateList = this.f1032;
            if (colorStateList != null) {
                C3347 c33472 = this.f1039;
                C4335 c4335 = c33472.f12842;
                if (c4335.f16505 != colorStateList) {
                    c4335.f16505 = colorStateList;
                    c33472.onStateChange(c33472.getState());
                }
            } else {
                TypedValue typedValue = new TypedValue();
                context.getTheme().resolveAttribute(android.R.attr.colorBackground, typedValue, true);
                this.f1039.setTint(typedValue.data);
            }
        }
        ValueAnimator valueAnimatorOfFloat = ValueAnimator.ofFloat(0.0f, 1.0f);
        this.f1037 = valueAnimatorOfFloat;
        valueAnimatorOfFloat.setDuration(500L);
        this.f1037.addUpdateListener(new C4766(0, this));
        typedArrayObtainStyledAttributes.getDimension(2, -1.0f);
        if (typedArrayObtainStyledAttributes.hasValue(0)) {
            typedArrayObtainStyledAttributes.getDimensionPixelSize(0, -1);
        }
        if (typedArrayObtainStyledAttributes.hasValue(1)) {
            typedArrayObtainStyledAttributes.getDimensionPixelSize(1, -1);
        }
        TypedValue typedValuePeekValue = typedArrayObtainStyledAttributes.peekValue(12);
        if (typedValuePeekValue == null || (i = typedValuePeekValue.data) != -1) {
            m815(typedArrayObtainStyledAttributes.getDimensionPixelSize(12, -1));
        } else {
            m815(i);
        }
        boolean z = typedArrayObtainStyledAttributes.getBoolean(10, false);
        if (this.f1033 != z) {
            this.f1033 = z;
            if (!z && this.f1036 == 5 && this.f1036 != 4) {
                this.f1036 = 4;
            }
        }
        typedArrayObtainStyledAttributes.getBoolean(16, false);
        boolean z2 = typedArrayObtainStyledAttributes.getBoolean(8, true);
        if (this.f1041 != z2) {
            this.f1041 = z2;
            int i2 = (z2 && this.f1036 == 6) ? 3 : this.f1036;
            if (this.f1036 != i2) {
                this.f1036 = i2;
            }
            m814(this.f1036);
        }
        typedArrayObtainStyledAttributes.getBoolean(15, false);
        typedArrayObtainStyledAttributes.getBoolean(5, true);
        typedArrayObtainStyledAttributes.getBoolean(6, true);
        typedArrayObtainStyledAttributes.getInt(13, 0);
        float f = typedArrayObtainStyledAttributes.getFloat(9, 0.5f);
        if (f <= 0.0f || f >= 1.0f) {
            ᵕᵩʽᵲ.ᵮᵣᵗˈ("ratio must be a float value between 0 and 1");
            throw null;
        }
        TypedValue typedValuePeekValue2 = typedArrayObtainStyledAttributes.peekValue(7);
        if (typedValuePeekValue2 == null || typedValuePeekValue2.type != 16) {
            int dimensionPixelOffset = typedArrayObtainStyledAttributes.getDimensionPixelOffset(7, 0);
            if (dimensionPixelOffset < 0) {
                ᵕᵩʽᵲ.ᵮᵣᵗˈ("offset must be greater than or equal to 0");
                throw null;
            }
            this.f1034 = dimensionPixelOffset;
            m814(this.f1036);
        } else {
            int i3 = typedValuePeekValue2.data;
            if (i3 < 0) {
                ᵕᵩʽᵲ.ᵮᵣᵗˈ("offset must be greater than or equal to 0");
                throw null;
            }
            this.f1034 = i3;
            m814(this.f1036);
        }
        typedArrayObtainStyledAttributes.getInt(14, 500);
        typedArrayObtainStyledAttributes.getBoolean(11, false);
        typedArrayObtainStyledAttributes.getBoolean(4, true);
        typedArrayObtainStyledAttributes.getBoolean(20, false);
        typedArrayObtainStyledAttributes.getBoolean(21, false);
        typedArrayObtainStyledAttributes.getBoolean(22, false);
        typedArrayObtainStyledAttributes.getBoolean(23, true);
        typedArrayObtainStyledAttributes.getBoolean(17, false);
        typedArrayObtainStyledAttributes.getBoolean(18, false);
        typedArrayObtainStyledAttributes.getBoolean(19, false);
        this.f1042 = typedArrayObtainStyledAttributes.getBoolean(26, true);
        typedArrayObtainStyledAttributes.recycle();
        ViewConfiguration.get(context).getScaledMaximumFlingVelocity();
    }

    /* JADX INFO: renamed from: ˋʿᐧ, reason: contains not printable characters */
    public final void m814(int i) {
        C3347 c3347;
        if (i == 2) {
            return;
        }
        boolean z = this.f1036 == 3 && this.f1042;
        if (this.f1040 == z || (c3347 = this.f1039) == null) {
            return;
        }
        this.f1040 = z;
        ValueAnimator valueAnimator = this.f1037;
        if (valueAnimator != null) {
            if (valueAnimator.isRunning()) {
                valueAnimator.reverse();
                return;
            } else {
                valueAnimator.setFloatValues(c3347.f12842.f16516, z ? 0.0f : 1.0f);
                valueAnimator.start();
                return;
            }
        }
        if (valueAnimator != null && valueAnimator.isRunning()) {
            valueAnimator.cancel();
        }
        float f = this.f1040 ? 0.0f : 1.0f;
        C4335 c4335 = c3347.f12842;
        if (c4335.f16516 != f) {
            c4335.f16516 = f;
            c3347.f12849 = true;
            c3347.f12828 = true;
            c3347.invalidateSelf();
        }
    }

    /* JADX INFO: renamed from: ᵡᵶᵬʤ, reason: contains not printable characters */
    public final void m815(int i) {
        boolean z = this.f1043;
        if (i == -1) {
            if (z) {
                return;
            }
            this.f1043 = true;
        } else if (z || this.f1035 != i) {
            this.f1043 = false;
            this.f1035 = Math.max(0, i);
        }
    }
}
