package a0;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.RectF;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.util.SparseIntArray;
import android.view.View;
import android.view.ViewGroup;
import androidx.constraintlayout.motion.widget.MotionLayout;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Locale;
import java.util.concurrent.CopyOnWriteArrayList;

/* JADX INFO: loaded from: classes.dex */
public final class n extends c {

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

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public float f132e = 0.1f;

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

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

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

    /* JADX INFO: renamed from: i, reason: collision with root package name */
    public RectF f136i = new RectF();

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    public RectF f137j = new RectF();

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public HashMap f138k = new HashMap();

    /* JADX INFO: renamed from: l, reason: collision with root package name */
    public String f139l = null;

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

    /* JADX INFO: renamed from: n, reason: collision with root package name */
    public String f141n = null;

    /* JADX INFO: renamed from: o, reason: collision with root package name */
    public String f142o = null;

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

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

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    public View f145r = null;

    /* JADX INFO: renamed from: s, reason: collision with root package name */
    public boolean f146s = true;

    /* JADX INFO: renamed from: t, reason: collision with root package name */
    public boolean f147t = true;

    /* JADX INFO: renamed from: u, reason: collision with root package name */
    public boolean f148u = true;

    /* JADX INFO: renamed from: v, reason: collision with root package name */
    public float f149v = Float.NaN;

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

    public n() {
        this.f29d = new HashMap();
    }

    public static void j(RectF rectF, View view, boolean z10) {
        rectF.top = view.getTop();
        rectF.bottom = view.getBottom();
        rectF.left = view.getLeft();
        rectF.right = view.getRight();
        if (z10) {
            view.getMatrix().mapRect(rectF);
        }
    }

    @Override // a0.c
    public final void a(HashMap map) {
    }

    @Override // a0.c
    /* JADX INFO: renamed from: b, reason: merged with bridge method [inline-methods] */
    public final c clone() {
        n nVar = new n();
        super.c(this);
        nVar.f139l = this.f139l;
        nVar.f140m = this.f140m;
        nVar.f141n = this.f141n;
        nVar.f142o = this.f142o;
        nVar.f143p = this.f143p;
        nVar.f144q = this.f144q;
        nVar.f145r = this.f145r;
        nVar.f132e = this.f132e;
        nVar.f146s = this.f146s;
        nVar.f147t = this.f147t;
        nVar.f148u = this.f148u;
        nVar.f149v = this.f149v;
        nVar.f150w = this.f150w;
        nVar.f151x = this.f151x;
        nVar.f136i = this.f136i;
        nVar.f137j = this.f137j;
        nVar.f138k = this.f138k;
        return nVar;
    }

    @Override // a0.c
    public final void d(HashSet hashSet) {
    }

    @Override // a0.c
    public final void e(Context context, AttributeSet attributeSet) {
        TypedArray typedArrayObtainStyledAttributes = context.obtainStyledAttributes(attributeSet, androidx.constraintlayout.widget.s.KeyTrigger);
        SparseIntArray sparseIntArray = m.f131a;
        int indexCount = typedArrayObtainStyledAttributes.getIndexCount();
        for (int i10 = 0; i10 < indexCount; i10++) {
            int index = typedArrayObtainStyledAttributes.getIndex(i10);
            SparseIntArray sparseIntArray2 = m.f131a;
            switch (sparseIntArray2.get(index)) {
                case 1:
                    this.f141n = typedArrayObtainStyledAttributes.getString(index);
                    break;
                case 2:
                    this.f142o = typedArrayObtainStyledAttributes.getString(index);
                    break;
                case 3:
                default:
                    Integer.toHexString(index);
                    sparseIntArray2.get(index);
                    break;
                case 4:
                    this.f139l = typedArrayObtainStyledAttributes.getString(index);
                    break;
                case 5:
                    this.f132e = typedArrayObtainStyledAttributes.getFloat(index, this.f132e);
                    break;
                case 6:
                    this.f143p = typedArrayObtainStyledAttributes.getResourceId(index, this.f143p);
                    break;
                case 7:
                    if (MotionLayout.f1093g1) {
                        int resourceId = typedArrayObtainStyledAttributes.getResourceId(index, this.f27b);
                        this.f27b = resourceId;
                        if (resourceId == -1) {
                            this.f28c = typedArrayObtainStyledAttributes.getString(index);
                        }
                    } else if (typedArrayObtainStyledAttributes.peekValue(index).type == 3) {
                        this.f28c = typedArrayObtainStyledAttributes.getString(index);
                    } else {
                        this.f27b = typedArrayObtainStyledAttributes.getResourceId(index, this.f27b);
                    }
                    break;
                case 8:
                    int integer = typedArrayObtainStyledAttributes.getInteger(index, this.f26a);
                    this.f26a = integer;
                    this.f149v = (integer + 0.5f) / 100.0f;
                    break;
                case 9:
                    this.f144q = typedArrayObtainStyledAttributes.getResourceId(index, this.f144q);
                    break;
                case 10:
                    this.f151x = typedArrayObtainStyledAttributes.getBoolean(index, this.f151x);
                    break;
                case 11:
                    this.f140m = typedArrayObtainStyledAttributes.getResourceId(index, this.f140m);
                    break;
                case 12:
                    this.f135h = typedArrayObtainStyledAttributes.getResourceId(index, this.f135h);
                    break;
                case 13:
                    this.f133f = typedArrayObtainStyledAttributes.getResourceId(index, this.f133f);
                    break;
                case 14:
                    this.f134g = typedArrayObtainStyledAttributes.getResourceId(index, this.f134g);
                    break;
            }
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:38:0x008b  */
    /* JADX WARN: Removed duplicated region for block: B:43:0x009f  */
    /* JADX WARN: Removed duplicated region for block: B:49:0x00b4  */
    /* JADX WARN: Removed duplicated region for block: B:56:0x00cd  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void h(float f10, View view) {
        boolean z10;
        boolean z11;
        boolean z12;
        boolean z13;
        boolean z14;
        boolean z15;
        if (this.f144q != -1) {
            if (this.f145r == null) {
                this.f145r = ((ViewGroup) view.getParent()).findViewById(this.f144q);
            }
            j(this.f136i, this.f145r, this.f151x);
            j(this.f137j, view, this.f151x);
            if (this.f136i.intersect(this.f137j)) {
                if (this.f146s) {
                    this.f146s = false;
                    z10 = true;
                } else {
                    z10 = false;
                }
                if (this.f148u) {
                    this.f148u = false;
                    z15 = true;
                } else {
                    z15 = false;
                }
                this.f147t = true;
                z14 = z15;
                z12 = false;
            } else {
                if (this.f146s) {
                    z10 = false;
                } else {
                    this.f146s = true;
                    z10 = true;
                }
                if (this.f147t) {
                    this.f147t = false;
                    z12 = true;
                } else {
                    z12 = false;
                }
                this.f148u = true;
                z14 = false;
            }
        } else {
            if (this.f146s) {
                float f11 = this.f149v;
                if ((this.f150w - f11) * (f10 - f11) < 0.0f) {
                    this.f146s = false;
                    z10 = true;
                }
                if (!this.f147t) {
                    float f12 = this.f149v;
                    float f13 = f10 - f12;
                    if ((this.f150w - f12) * f13 < 0.0f && f13 < 0.0f) {
                        this.f147t = false;
                        z11 = true;
                    }
                    if (this.f148u) {
                        float f14 = this.f149v;
                        float f15 = f10 - f14;
                        if ((this.f150w - f14) * f15 >= 0.0f || f15 <= 0.0f) {
                            z13 = false;
                        } else {
                            this.f148u = false;
                            z13 = true;
                        }
                        boolean z16 = z11;
                        z14 = z13;
                        z12 = z16;
                    } else {
                        if (Math.abs(f10 - this.f149v) > this.f132e) {
                            this.f148u = true;
                        }
                        z12 = z11;
                        z14 = false;
                    }
                } else if (Math.abs(f10 - this.f149v) > this.f132e) {
                    this.f147t = true;
                }
                z11 = false;
                if (this.f148u) {
                }
            } else if (Math.abs(f10 - this.f149v) > this.f132e) {
                this.f146s = true;
            }
            z10 = false;
            if (!this.f147t) {
            }
            z11 = false;
            if (this.f148u) {
            }
        }
        this.f150w = f10;
        if (z12 || z10 || z14) {
            MotionLayout motionLayout = (MotionLayout) view.getParent();
            x xVar = motionLayout.f1112n0;
            CopyOnWriteArrayList copyOnWriteArrayList = motionLayout.F0;
            if (copyOnWriteArrayList != null) {
                Iterator it = copyOnWriteArrayList.iterator();
                while (it.hasNext()) {
                    ((x) it.next()).getClass();
                }
            }
        }
        View viewFindViewById = this.f140m == -1 ? view : ((MotionLayout) view.getParent()).findViewById(this.f140m);
        if (z12) {
            String str = this.f141n;
            if (str != null) {
                i(viewFindViewById, str);
            }
            if (this.f133f != -1) {
                ((MotionLayout) view.getParent()).x(this.f133f, viewFindViewById);
            }
        }
        if (z14) {
            String str2 = this.f142o;
            if (str2 != null) {
                i(viewFindViewById, str2);
            }
            if (this.f134g != -1) {
                ((MotionLayout) view.getParent()).x(this.f134g, viewFindViewById);
            }
        }
        if (z10) {
            String str3 = this.f139l;
            if (str3 != null) {
                i(viewFindViewById, str3);
            }
            if (this.f135h != -1) {
                ((MotionLayout) view.getParent()).x(this.f135h, viewFindViewById);
            }
        }
    }

    public final void i(View view, String str) {
        Method method;
        if (str == null) {
            return;
        }
        if (!str.startsWith(".")) {
            if (this.f138k.containsKey(str)) {
                method = (Method) this.f138k.get(str);
                if (method == null) {
                    return;
                }
            } else {
                method = null;
            }
            if (method == null) {
                try {
                    method = view.getClass().getMethod(str, new Class[0]);
                    this.f138k.put(str, method);
                } catch (NoSuchMethodException unused) {
                    this.f138k.put(str, null);
                    view.getClass();
                    o6.b.q(view);
                    return;
                }
            }
            try {
                method.invoke(view, new Object[0]);
                return;
            } catch (Exception unused2) {
                view.getClass();
                o6.b.q(view);
                return;
            }
        }
        boolean z10 = str.length() == 1;
        if (!z10) {
            str = str.substring(1).toLowerCase(Locale.ROOT);
        }
        for (String str2 : this.f29d.keySet()) {
            String lowerCase = str2.toLowerCase(Locale.ROOT);
            if (z10 || lowerCase.matches(str)) {
                androidx.constraintlayout.widget.a aVar = (androidx.constraintlayout.widget.a) this.f29d.get(str2);
                if (aVar != null) {
                    Class<?> cls = view.getClass();
                    boolean z11 = aVar.f1300a;
                    String strI = aVar.f1301b;
                    if (!z11) {
                        strI = defpackage.e.i("set", strI);
                    }
                    try {
                        switch (aVar.f1302c.ordinal()) {
                            case 0:
                            case 7:
                                cls.getMethod(strI, Integer.TYPE).invoke(view, Integer.valueOf(aVar.f1303d));
                                continue;
                            case 1:
                                cls.getMethod(strI, Float.TYPE).invoke(view, Float.valueOf(aVar.f1304e));
                                continue;
                            case 2:
                                cls.getMethod(strI, Integer.TYPE).invoke(view, Integer.valueOf(aVar.f1307h));
                                continue;
                            case 3:
                                Method method2 = cls.getMethod(strI, Drawable.class);
                                ColorDrawable colorDrawable = new ColorDrawable();
                                colorDrawable.setColor(aVar.f1307h);
                                method2.invoke(view, colorDrawable);
                                continue;
                            case 4:
                                cls.getMethod(strI, CharSequence.class).invoke(view, aVar.f1305f);
                                continue;
                            case 5:
                                cls.getMethod(strI, Boolean.TYPE).invoke(view, Boolean.valueOf(aVar.f1306g));
                                continue;
                            case 6:
                                cls.getMethod(strI, Float.TYPE).invoke(view, Float.valueOf(aVar.f1304e));
                                continue;
                            default:
                                continue;
                        }
                    } catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException unused3) {
                    }
                }
            }
        }
    }
}
