package androidx.constraintlayout.solver.widgets.analyzer;

import androidx.constraintlayout.solver.widgets.ConstraintAnchor;
import androidx.constraintlayout.solver.widgets.ConstraintWidget;
import ῲ.ⁱ.ῲ.㿎.ᕣ.AbstractC2096;
import ῲ.ⁱ.ῲ.㿎.ᕣ.C2086;
import ῲ.ⁱ.ῲ.㿎.ᕣ.C2093;
import ῲ.ⁱ.ῲ.㿎.ᕣ.C2094;
import ῲ.ⁱ.ῲ.㿎.ᕣ.C2095;

public abstract class WidgetRun implements AbstractC2096 {

    /* renamed from: ʬ  reason: contains not printable characters */
    public C2086 f919;

    /* renamed from: ඓ  reason: contains not printable characters */
    public C2095 f920 = new C2095(this);

    /* renamed from: ᨨ  reason: contains not printable characters */
    public DependencyNode f921 = new DependencyNode(this);

    /* renamed from: ῲ  reason: contains not printable characters */
    public ConstraintWidget f922;

    /* renamed from: ⁱ  reason: contains not printable characters */
    public boolean f923 = false;

    /* renamed from: K  reason: contains not printable characters */
    public int f924;

    /* renamed from: 㳳  reason: contains not printable characters */
    public RunType f925 = RunType.NONE;

    /* renamed from: 㴹  reason: contains not printable characters */
    public int f926 = 0;

    /* renamed from: 㸾  reason: contains not printable characters */
    public ConstraintWidget.DimensionBehaviour f927;

    /* renamed from: 㿎  reason: contains not printable characters */
    public DependencyNode f928 = new DependencyNode(this);

    public enum RunType {
        NONE,
        START,
        END,
        CENTER
    }

    public WidgetRun(ConstraintWidget constraintWidget) {
        this.f922 = constraintWidget;
    }

    /* renamed from: ʬ  reason: contains not printable characters */
    public abstract void m518();

    /* renamed from: ඓ  reason: contains not printable characters */
    public abstract boolean m519();

    /* renamed from: ῲ  reason: contains not printable characters */
    public abstract void m520();

    /* renamed from: K  reason: contains not printable characters */
    public final DependencyNode m522(ConstraintAnchor constraintAnchor) {
        ConstraintAnchor constraintAnchor2 = constraintAnchor.f812;
        if (constraintAnchor2 == null) {
            return null;
        }
        ConstraintWidget constraintWidget = constraintAnchor2.f813;
        int ordinal = constraintAnchor2.f807.ordinal();
        if (ordinal == 1) {
            return constraintWidget.f896.f928;
        }
        if (ordinal == 2) {
            return constraintWidget.f835.f928;
        }
        if (ordinal == 3) {
            return constraintWidget.f896.f921;
        }
        if (ordinal == 4) {
            return constraintWidget.f835.f921;
        }
        if (ordinal != 5) {
            return null;
        }
        return constraintWidget.f835.f7237;
    }

    /* renamed from: K  reason: contains not printable characters */
    public abstract void m524();

    @Override // ῲ.ⁱ.ῲ.㿎.ᕣ.AbstractC2096
    /* renamed from: K  reason: contains not printable characters */
    public void m528(AbstractC2096 r1) {
    }

    /* renamed from: 㸾  reason: contains not printable characters */
    public long m529() {
        C2095 r0 = this.f920;
        if (r0.f914) {
            return (long) r0.f911;
        }
        return 0;
    }

    /* JADX WARNING: Code restructure failed: missing block: B:23:0x0053, code lost:
        if (r4.f924 == 3) goto L_0x00c6;
     */
    /* renamed from: K  reason: contains not printable characters */
    public void m525(ConstraintAnchor constraintAnchor, ConstraintAnchor constraintAnchor2, int i) {
        float f;
        ConstraintWidget.DimensionBehaviour dimensionBehaviour;
        int i2;
        DependencyNode r0 = m522(constraintAnchor);
        DependencyNode r1 = m522(constraintAnchor2);
        if (r0.f914 && r1.f914) {
            int r11 = constraintAnchor.m456() + r0.f911;
            int r2 = r1.f911 - constraintAnchor2.m456();
            int i3 = r2 - r11;
            C2095 r3 = this.f920;
            if (!r3.f914 && this.f927 == (dimensionBehaviour = ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT)) {
                int i4 = this.f924;
                if (i4 == 0) {
                    r3.m5539(m521(i3, i));
                } else if (i4 == 1) {
                    this.f920.m5539(Math.min(m521(r3.f7240, i), i3));
                } else if (i4 == 2) {
                    ConstraintWidget constraintWidget = this.f922.f867;
                    if (constraintWidget != null) {
                        WidgetRun widgetRun = i == 0 ? constraintWidget.f896 : constraintWidget.f835;
                        if (widgetRun.f920.f914) {
                            ConstraintWidget constraintWidget2 = this.f922;
                            this.f920.m5539(m521((int) ((((float) widgetRun.f920.f911) * (i == 0 ? constraintWidget2.f901 : constraintWidget2.f846)) + 0.5f), i));
                        }
                    }
                } else if (i4 == 3) {
                    ConstraintWidget constraintWidget3 = this.f922;
                    C2094 r8 = constraintWidget3.f896;
                    if (r8.f927 == dimensionBehaviour && r8.f924 == 3) {
                        C2093 r4 = constraintWidget3.f835;
                        if (r4.f927 == dimensionBehaviour) {
                        }
                    }
                    ConstraintWidget constraintWidget4 = this.f922;
                    C2095 r32 = (i == 0 ? constraintWidget4.f835 : constraintWidget4.f896).f920;
                    if (r32.f914) {
                        float f2 = this.f922.f842;
                        if (i == 1) {
                            i2 = (int) ((((float) r32.f911) / f2) + 0.5f);
                        } else {
                            i2 = (int) ((f2 * ((float) r32.f911)) + 0.5f);
                        }
                        this.f920.m5539(i2);
                    }
                }
            }
            C2095 r33 = this.f920;
            if (r33.f914) {
                if (r33.f911 == i3) {
                    this.f928.m516(r11);
                    this.f921.m516(r2);
                    return;
                }
                ConstraintWidget constraintWidget5 = this.f922;
                if (i == 0) {
                    f = constraintWidget5.f878;
                } else {
                    f = constraintWidget5.f888;
                }
                if (r0 == r1) {
                    r11 = r0.f911;
                    r2 = r1.f911;
                    f = 0.5f;
                }
                this.f928.m516((int) ((((float) ((r2 - r11) - this.f920.f911)) * f) + ((float) r11) + 0.5f));
                this.f921.m516(this.f928.f911 + this.f920.f911);
            }
        }
    }

    /* renamed from: K  reason: contains not printable characters */
    public final int m521(int i, int i2) {
        int i3;
        if (i2 == 0) {
            ConstraintWidget constraintWidget = this.f922;
            int i4 = constraintWidget.f829;
            i3 = Math.max(constraintWidget.f877, i);
            if (i4 > 0) {
                i3 = Math.min(i4, i);
            }
            if (i3 == i) {
                return i;
            }
        } else {
            ConstraintWidget constraintWidget2 = this.f922;
            int i5 = constraintWidget2.f894;
            i3 = Math.max(constraintWidget2.f824, i);
            if (i5 > 0) {
                i3 = Math.min(i5, i);
            }
            if (i3 == i) {
                return i;
            }
        }
        return i3;
    }

    /* renamed from: K  reason: contains not printable characters */
    public final DependencyNode m523(ConstraintAnchor constraintAnchor, int i) {
        ConstraintAnchor constraintAnchor2 = constraintAnchor.f812;
        if (constraintAnchor2 == null) {
            return null;
        }
        ConstraintWidget constraintWidget = constraintAnchor2.f813;
        WidgetRun widgetRun = i == 0 ? constraintWidget.f896 : constraintWidget.f835;
        int ordinal = constraintAnchor.f812.f807.ordinal();
        if (ordinal == 1 || ordinal == 2) {
            return widgetRun.f928;
        }
        if (ordinal == 3 || ordinal == 4) {
            return widgetRun.f921;
        }
        return null;
    }

    /* renamed from: K  reason: contains not printable characters */
    public final void m526(DependencyNode dependencyNode, DependencyNode dependencyNode2, int i) {
        dependencyNode.f913.add(dependencyNode2);
        dependencyNode.f915 = i;
        dependencyNode2.f908.add(dependencyNode);
    }

    /* renamed from: K  reason: contains not printable characters */
    public final void m527(DependencyNode dependencyNode, DependencyNode dependencyNode2, int i, C2095 r6) {
        dependencyNode.f913.add(dependencyNode2);
        dependencyNode.f913.add(this.f920);
        dependencyNode.f917 = i;
        dependencyNode.f909 = r6;
        dependencyNode2.f908.add(dependencyNode);
        r6.f908.add(dependencyNode);
    }
}
