package androidx.constraintlayout.motion.widget;

import android.content.Context;
import android.content.res.TypedArray;
import android.content.res.XmlResourceParser;
import android.graphics.RectF;
import android.util.Xml;
import android.view.View;
import android.view.ViewGroup;
import androidx.constraintlayout.widget.s;

/* JADX INFO: loaded from: classes.dex */
public final class c {
    public static final float[][] E = {new float[]{0.5f, 0.0f}, new float[]{0.0f, 0.5f}, new float[]{1.0f, 0.5f}, new float[]{0.5f, 1.0f}, new float[]{0.5f, 0.5f}, new float[]{0.0f, 0.5f}, new float[]{1.0f, 0.5f}};
    public static final float[][] F = {new float[]{0.0f, -1.0f}, new float[]{0.0f, 1.0f}, new float[]{-1.0f, 0.0f}, new float[]{1.0f, 0.0f}, new float[]{-1.0f, 0.0f}, new float[]{1.0f, 0.0f}};
    public final float A;
    public final float B;
    public final int C;
    public final int D;

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final int f1153a;

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

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

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

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

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public final int f1158f;

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

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

    /* JADX INFO: renamed from: i, reason: collision with root package name */
    public final int f1161i;

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    public final boolean f1162j;

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

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

    /* JADX INFO: renamed from: m, reason: collision with root package name */
    public boolean f1165m = false;

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

    /* JADX INFO: renamed from: o, reason: collision with root package name */
    public final int[] f1167o = new int[2];

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

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

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    public final MotionLayout f1170r;

    /* JADX INFO: renamed from: s, reason: collision with root package name */
    public final float f1171s;

    /* JADX INFO: renamed from: t, reason: collision with root package name */
    public final float f1172t;

    /* JADX INFO: renamed from: u, reason: collision with root package name */
    public final boolean f1173u;

    /* JADX INFO: renamed from: v, reason: collision with root package name */
    public final float f1174v;

    /* JADX INFO: renamed from: w, reason: collision with root package name */
    public final int f1175w;

    /* JADX INFO: renamed from: x, reason: collision with root package name */
    public final float f1176x;

    /* JADX INFO: renamed from: y, reason: collision with root package name */
    public final float f1177y;

    /* JADX INFO: renamed from: z, reason: collision with root package name */
    public final float f1178z;

    public c(Context context, MotionLayout motionLayout, XmlResourceParser xmlResourceParser) {
        this.f1153a = 0;
        this.f1154b = 0;
        this.f1155c = 0;
        this.f1156d = -1;
        this.f1157e = -1;
        this.f1158f = -1;
        this.f1159g = 0.5f;
        this.f1160h = 0.5f;
        this.f1161i = -1;
        this.f1162j = false;
        this.f1163k = 0.0f;
        this.f1164l = 1.0f;
        this.f1171s = 4.0f;
        this.f1172t = 1.2f;
        this.f1173u = true;
        this.f1174v = 1.0f;
        this.f1175w = 0;
        this.f1176x = 10.0f;
        this.f1177y = 10.0f;
        this.f1178z = 1.0f;
        this.A = Float.NaN;
        this.B = Float.NaN;
        this.C = 0;
        this.D = 0;
        this.f1170r = motionLayout;
        TypedArray typedArrayObtainStyledAttributes = context.obtainStyledAttributes(Xml.asAttributeSet(xmlResourceParser), s.OnSwipe);
        int indexCount = typedArrayObtainStyledAttributes.getIndexCount();
        for (int i10 = 0; i10 < indexCount; i10++) {
            int index = typedArrayObtainStyledAttributes.getIndex(i10);
            if (index == s.OnSwipe_touchAnchorId) {
                this.f1156d = typedArrayObtainStyledAttributes.getResourceId(index, this.f1156d);
            } else if (index == s.OnSwipe_touchAnchorSide) {
                int i11 = typedArrayObtainStyledAttributes.getInt(index, this.f1153a);
                this.f1153a = i11;
                float[] fArr = E[i11];
                this.f1160h = fArr[0];
                this.f1159g = fArr[1];
            } else if (index == s.OnSwipe_dragDirection) {
                int i12 = typedArrayObtainStyledAttributes.getInt(index, this.f1154b);
                this.f1154b = i12;
                if (i12 < 6) {
                    float[] fArr2 = F[i12];
                    this.f1163k = fArr2[0];
                    this.f1164l = fArr2[1];
                } else {
                    this.f1164l = Float.NaN;
                    this.f1163k = Float.NaN;
                    this.f1162j = true;
                }
            } else if (index == s.OnSwipe_maxVelocity) {
                this.f1171s = typedArrayObtainStyledAttributes.getFloat(index, this.f1171s);
            } else if (index == s.OnSwipe_maxAcceleration) {
                this.f1172t = typedArrayObtainStyledAttributes.getFloat(index, this.f1172t);
            } else if (index == s.OnSwipe_moveWhenScrollAtTop) {
                this.f1173u = typedArrayObtainStyledAttributes.getBoolean(index, this.f1173u);
            } else if (index == s.OnSwipe_dragScale) {
                this.f1174v = typedArrayObtainStyledAttributes.getFloat(index, this.f1174v);
            } else if (index == s.OnSwipe_dragThreshold) {
                this.f1176x = typedArrayObtainStyledAttributes.getFloat(index, this.f1176x);
            } else if (index == s.OnSwipe_touchRegionId) {
                this.f1157e = typedArrayObtainStyledAttributes.getResourceId(index, this.f1157e);
            } else if (index == s.OnSwipe_onTouchUp) {
                this.f1155c = typedArrayObtainStyledAttributes.getInt(index, this.f1155c);
            } else if (index == s.OnSwipe_nestedScrollFlags) {
                this.f1175w = typedArrayObtainStyledAttributes.getInteger(index, 0);
            } else if (index == s.OnSwipe_limitBoundsTo) {
                this.f1158f = typedArrayObtainStyledAttributes.getResourceId(index, 0);
            } else if (index == s.OnSwipe_rotationCenterId) {
                this.f1161i = typedArrayObtainStyledAttributes.getResourceId(index, this.f1161i);
            } else if (index == s.OnSwipe_springDamping) {
                this.f1177y = typedArrayObtainStyledAttributes.getFloat(index, this.f1177y);
            } else if (index == s.OnSwipe_springMass) {
                this.f1178z = typedArrayObtainStyledAttributes.getFloat(index, this.f1178z);
            } else if (index == s.OnSwipe_springStiffness) {
                this.A = typedArrayObtainStyledAttributes.getFloat(index, this.A);
            } else if (index == s.OnSwipe_springStopThreshold) {
                this.B = typedArrayObtainStyledAttributes.getFloat(index, this.B);
            } else if (index == s.OnSwipe_springBoundary) {
                this.C = typedArrayObtainStyledAttributes.getInt(index, this.C);
            } else if (index == s.OnSwipe_autoCompleteMode) {
                this.D = typedArrayObtainStyledAttributes.getInt(index, this.D);
            }
        }
        typedArrayObtainStyledAttributes.recycle();
    }

    public final RectF a(MotionLayout motionLayout, RectF rectF) {
        View viewFindViewById;
        int i10 = this.f1158f;
        if (i10 == -1 || (viewFindViewById = motionLayout.findViewById(i10)) == null) {
            return null;
        }
        rectF.set(viewFindViewById.getLeft(), viewFindViewById.getTop(), viewFindViewById.getRight(), viewFindViewById.getBottom());
        return rectF;
    }

    public final RectF b(ViewGroup viewGroup, RectF rectF) {
        View viewFindViewById;
        int i10 = this.f1157e;
        if (i10 == -1 || (viewFindViewById = viewGroup.findViewById(i10)) == null) {
            return null;
        }
        rectF.set(viewFindViewById.getLeft(), viewFindViewById.getTop(), viewFindViewById.getRight(), viewFindViewById.getBottom());
        return rectF;
    }

    public final void c(boolean z10) {
        float[][] fArr = E;
        float[][] fArr2 = F;
        if (z10) {
            fArr2[4] = fArr2[3];
            fArr2[5] = fArr2[2];
            fArr[5] = fArr[2];
            fArr[6] = fArr[1];
        } else {
            fArr2[4] = fArr2[2];
            fArr2[5] = fArr2[3];
            fArr[5] = fArr[1];
            fArr[6] = fArr[2];
        }
        float[] fArr3 = fArr[this.f1153a];
        this.f1160h = fArr3[0];
        this.f1159g = fArr3[1];
        int i10 = this.f1154b;
        if (i10 >= 6) {
            return;
        }
        float[] fArr4 = fArr2[i10];
        this.f1163k = fArr4[0];
        this.f1164l = fArr4[1];
    }

    public final String toString() {
        if (Float.isNaN(this.f1163k)) {
            return "rotation";
        }
        return this.f1163k + " , " + this.f1164l;
    }
}
