package ῲ.ⁱ.ῲ.㿎.ᕣ;

import android.view.View;
import androidx.constraintlayout.solver.widgets.ConstraintAnchor;
import androidx.constraintlayout.solver.widgets.ConstraintWidget;
import androidx.constraintlayout.solver.widgets.analyzer.WidgetRun;
import androidx.constraintlayout.widget.ConstraintHelper;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.constraintlayout.widget.Placeholder;
import java.util.ArrayList;
import java.util.Iterator;
import ῲ.ⁱ.ῲ.㿎.AbstractC2105;
import ῲ.ⁱ.ῲ.㿎.C2082;
import ῲ.ⁱ.ῲ.㿎.C2083;
import ῲ.ⁱ.ῲ.㿎.C2100;
import ῲ.ⁱ.ῲ.㿎.C2103;
import ῲ.ⁱ.ῲ.㿎.C2108;

/* renamed from: ῲ.ⁱ.ῲ.㿎.ᕣ.ῲ  reason: contains not printable characters */
/* compiled from: BasicMeasure */
public class C2088 {

    /* renamed from: ʬ  reason: contains not printable characters */
    public C2082 f7223;

    /* renamed from: ῲ  reason: contains not printable characters */
    public C2090 f7224 = new C2090();

    /* renamed from: K  reason: contains not printable characters */
    public final ArrayList<ConstraintWidget> f7225 = new ArrayList<>();

    /* renamed from: ῲ.ⁱ.ῲ.㿎.ᕣ.ῲ$ῲ  reason: contains not printable characters */
    /* compiled from: BasicMeasure */
    public interface AbstractC2089 {
    }

    /* renamed from: ῲ.ⁱ.ῲ.㿎.ᕣ.ῲ$K  reason: contains not printable characters */
    /* compiled from: BasicMeasure */
    public static class C2090 {

        /* renamed from: ʬ  reason: contains not printable characters */
        public int f7226;

        /* renamed from: ඓ  reason: contains not printable characters */
        public int f7227;

        /* renamed from: ᨨ  reason: contains not printable characters */
        public boolean f7228;

        /* renamed from: ῲ  reason: contains not printable characters */
        public ConstraintWidget.DimensionBehaviour f7229;

        /* renamed from: ⁱ  reason: contains not printable characters */
        public int f7230;

        /* renamed from: K  reason: contains not printable characters */
        public ConstraintWidget.DimensionBehaviour f7231;

        /* renamed from: 㳳  reason: contains not printable characters */
        public boolean f7232;

        /* renamed from: 㴹  reason: contains not printable characters */
        public int f7233;

        /* renamed from: 㸾  reason: contains not printable characters */
        public int f7234;

        /* renamed from: 㿎  reason: contains not printable characters */
        public boolean f7235;
    }

    public C2088(C2082 r2) {
        this.f7223 = r2;
    }

    /* renamed from: K  reason: contains not printable characters */
    public long m5515(C2082 r23, int i, int i2, int i3, int i4, int i5) {
        AbstractC2089 r21;
        boolean z;
        boolean z2;
        int i6;
        boolean z3;
        boolean z4;
        int i7;
        AbstractC2089 r212;
        int i8;
        int i9;
        AbstractC2089 r11;
        boolean z5;
        C2094 r112;
        C2093 r12;
        int i10;
        int i11;
        boolean z6;
        int i12;
        boolean z7;
        boolean z8;
        AbstractC2089 r5 = r23.f7198;
        int size = r23.f7284.size();
        int r7 = r23.m478();
        int r8 = r23.m473();
        boolean r9 = C2108.m5585(i, 128);
        boolean z9 = r9 || C2108.m5585(i, 64);
        if (z9) {
            int i13 = 0;
            while (true) {
                if (i13 >= size) {
                    break;
                }
                ConstraintWidget constraintWidget = r23.f7284.get(i13);
                boolean z10 = (constraintWidget.m508() == ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT) && (constraintWidget.m512() == ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT) && constraintWidget.f842 > 0.0f;
                if ((!constraintWidget.m503() || !z10) && ((!constraintWidget.m514() || !z10) && !(constraintWidget instanceof C2100) && !constraintWidget.m503() && !constraintWidget.m514())) {
                    i13++;
                }
            }
            z9 = false;
        }
        boolean z11 = z9 & ((i2 == 1073741824 && i4 == 1073741824) || r9);
        if (z11) {
            int min = Math.min(r23.f884[0], i3);
            int min2 = Math.min(r23.f884[1], i5);
            if (i2 == 1073741824 && r23.m478() != min) {
                r23.m502(min);
                r23.m5480();
            }
            if (i4 == 1073741824 && r23.m473() != min2) {
                r23.m479(min2);
                r23.m5480();
            }
            if (i2 == 1073741824 && i4 == 1073741824) {
                C2085 r13 = r23.f7195;
                boolean z12 = r9 & true;
                if (r13.f7213 || r13.f7211) {
                    Iterator<ConstraintWidget> it2 = r13.f7215.f7284.iterator();
                    while (it2.hasNext()) {
                        ConstraintWidget next = it2.next();
                        next.m469();
                        next.f861 = false;
                        next.f896.m5538();
                        next.f835.m5531();
                    }
                    r13.f7215.m469();
                    C2082 r122 = r13.f7215;
                    r122.f861 = false;
                    r122.f896.m5538();
                    r13.f7215.f835.m5531();
                    r13.f7211 = false;
                }
                r13.m5506(r13.f7217);
                C2082 r123 = r13.f7215;
                r123.f822 = 0;
                r123.f892 = 0;
                ConstraintWidget.DimensionBehaviour r124 = r123.m480(0);
                ConstraintWidget.DimensionBehaviour r14 = r13.f7215.m480(1);
                if (r13.f7213) {
                    r13.m5502();
                }
                int r15 = r13.f7215.m506();
                int r10 = r13.f7215.m476();
                r13.f7215.f896.f928.m516(r15);
                r13.f7215.f835.f928.m516(r10);
                r13.m5500();
                ConstraintWidget.DimensionBehaviour dimensionBehaviour = ConstraintWidget.DimensionBehaviour.WRAP_CONTENT;
                if (r124 == dimensionBehaviour || r14 == dimensionBehaviour) {
                    if (z12) {
                        Iterator<WidgetRun> it3 = r13.f7212.iterator();
                        while (true) {
                            if (it3.hasNext()) {
                                if (!it3.next().m519()) {
                                    z12 = false;
                                    break;
                                }
                            } else {
                                break;
                            }
                        }
                    }
                    if (!z12 || r124 != ConstraintWidget.DimensionBehaviour.WRAP_CONTENT) {
                        z = z11;
                        r21 = r5;
                    } else {
                        z = z11;
                        r13.f7215.m493(ConstraintWidget.DimensionBehaviour.FIXED);
                        C2082 r2 = r13.f7215;
                        r21 = r5;
                        r2.m502(r13.m5501(r2, 0));
                        C2082 r22 = r13.f7215;
                        r22.f896.f920.m5539(r22.m478());
                    }
                    if (z12 && r14 == ConstraintWidget.DimensionBehaviour.WRAP_CONTENT) {
                        r13.f7215.m482(ConstraintWidget.DimensionBehaviour.FIXED);
                        C2082 r24 = r13.f7215;
                        r24.m479(r13.m5501(r24, 1));
                        C2082 r25 = r13.f7215;
                        r25.f835.f920.m5539(r25.m473());
                    }
                } else {
                    z = z11;
                    r21 = r5;
                }
                ConstraintWidget.DimensionBehaviour[] dimensionBehaviourArr = r13.f7215.f886;
                if (dimensionBehaviourArr[0] == ConstraintWidget.DimensionBehaviour.FIXED || dimensionBehaviourArr[0] == ConstraintWidget.DimensionBehaviour.MATCH_PARENT) {
                    int r26 = r13.f7215.m478() + r15;
                    r13.f7215.f896.f921.m516(r26);
                    r13.f7215.f896.f920.m5539(r26 - r15);
                    r13.m5500();
                    ConstraintWidget.DimensionBehaviour[] dimensionBehaviourArr2 = r13.f7215.f886;
                    if (dimensionBehaviourArr2[1] == ConstraintWidget.DimensionBehaviour.FIXED || dimensionBehaviourArr2[1] == ConstraintWidget.DimensionBehaviour.MATCH_PARENT) {
                        int r27 = r13.f7215.m473() + r10;
                        r13.f7215.f835.f921.m516(r27);
                        r13.f7215.f835.f920.m5539(r27 - r10);
                    }
                    r13.m5500();
                    z7 = true;
                } else {
                    z7 = false;
                }
                Iterator<WidgetRun> it4 = r13.f7212.iterator();
                while (it4.hasNext()) {
                    WidgetRun next2 = it4.next();
                    if (next2.f922 != r13.f7215 || next2.f923) {
                        next2.m520();
                    }
                }
                Iterator<WidgetRun> it5 = r13.f7212.iterator();
                while (true) {
                    if (!it5.hasNext()) {
                        z8 = true;
                        break;
                    }
                    WidgetRun next3 = it5.next();
                    if ((z7 || next3.f922 != r13.f7215) && (!next3.f928.f914 || ((!next3.f921.f914 && !(next3 instanceof C2097)) || (!next3.f920.f914 && !(next3 instanceof C2084) && !(next3 instanceof C2097))))) {
                        z8 = false;
                    }
                }
                z8 = false;
                r13.f7215.m493(r124);
                r13.f7215.m482(r14);
                z2 = z8;
                i10 = 1073741824;
                i6 = 2;
            } else {
                z = z11;
                r21 = r5;
                C2085 r28 = r23.f7195;
                if (r28.f7213) {
                    Iterator<ConstraintWidget> it6 = r28.f7215.f7284.iterator();
                    while (it6.hasNext()) {
                        ConstraintWidget next4 = it6.next();
                        next4.m469();
                        next4.f861 = false;
                        C2094 r125 = next4.f896;
                        r125.f920.f914 = false;
                        r125.f923 = false;
                        r125.m5538();
                        C2093 r102 = next4.f835;
                        r102.f920.f914 = false;
                        r102.f923 = false;
                        r102.m5531();
                    }
                    i11 = 0;
                    r28.f7215.m469();
                    C2082 r52 = r28.f7215;
                    r52.f861 = false;
                    C2094 r53 = r52.f896;
                    r53.f920.f914 = false;
                    r53.f923 = false;
                    r53.m5538();
                    C2093 r54 = r28.f7215.f835;
                    r54.f920.f914 = false;
                    r54.f923 = false;
                    r54.m5531();
                    r28.m5502();
                } else {
                    i11 = 0;
                }
                r28.m5506(r28.f7217);
                C2082 r55 = r28.f7215;
                r55.f822 = i11;
                r55.f892 = i11;
                r55.f896.f928.m516(i11);
                r28.f7215.f835.f928.m516(i11);
                i10 = 1073741824;
                if (i2 == 1073741824) {
                    i12 = 1;
                    z6 = r23.m5479(r9, i11) & true;
                    i6 = 1;
                } else {
                    i12 = 1;
                    i6 = 0;
                    z6 = true;
                }
                if (i4 == 1073741824) {
                    i6++;
                    z2 = r23.m5479(r9, i12) & z6;
                } else {
                    z2 = z6;
                }
            }
            if (z2) {
                r23.m5478(i2 == i10, i4 == i10);
            }
        } else {
            z = z11;
            r21 = r5;
            i6 = 0;
            z2 = false;
        }
        if (z2 && i6 == 2) {
            return 0;
        }
        int i14 = r23.f7192;
        if (size > 0) {
            int size2 = r23.f7284.size();
            boolean r4 = r23.m5482(64);
            AbstractC2089 r56 = r23.f7198;
            for (int i15 = 0; i15 < size2; i15++) {
                ConstraintWidget constraintWidget2 = r23.f7284.get(i15);
                if (!(constraintWidget2 instanceof C2083) && !(constraintWidget2 instanceof C2103) && !constraintWidget2.f863 && (!r4 || (r112 = constraintWidget2.f896) == null || (r12 = constraintWidget2.f835) == null || !r112.f920.f914 || !r12.f920.f914)) {
                    ConstraintWidget.DimensionBehaviour r126 = constraintWidget2.m480(0);
                    ConstraintWidget.DimensionBehaviour r132 = constraintWidget2.m480(1);
                    ConstraintWidget.DimensionBehaviour dimensionBehaviour2 = ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT;
                    boolean z13 = r126 == dimensionBehaviour2 && constraintWidget2.f874 != 1 && r132 == dimensionBehaviour2 && constraintWidget2.f827 != 1;
                    if (!z13 && r23.m5482(1) && !(constraintWidget2 instanceof C2100)) {
                        ConstraintWidget.DimensionBehaviour dimensionBehaviour3 = ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT;
                        if (r126 == dimensionBehaviour3 && constraintWidget2.f874 == 0 && r132 != dimensionBehaviour3 && !constraintWidget2.m503()) {
                            z13 = true;
                        }
                        ConstraintWidget.DimensionBehaviour dimensionBehaviour4 = ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT;
                        if (r132 == dimensionBehaviour4 && constraintWidget2.f827 == 0 && r126 != dimensionBehaviour4 && !constraintWidget2.m503()) {
                            z13 = true;
                        }
                    }
                    if (!z13) {
                        m5517(r56, constraintWidget2, false);
                    }
                }
            }
            ConstraintLayout.C0139 r57 = (ConstraintLayout.C0139) r56;
            int childCount = r57.f1002.getChildCount();
            for (int i16 = 0; i16 < childCount; i16++) {
                View childAt = r57.f1002.getChildAt(i16);
                if (childAt instanceof Placeholder) {
                    ((Placeholder) childAt).m570();
                }
            }
            int size3 = r57.f1002.mConstraintHelpers.size();
            if (size3 > 0) {
                for (int i17 = 0; i17 < size3; i17++) {
                    ((ConstraintHelper) r57.f1002.mConstraintHelpers.get(i17)).m552();
                }
            }
        }
        int size4 = this.f7225.size();
        if (size > 0) {
            m5516(r23, r7, r8);
        }
        if (size4 > 0) {
            boolean z14 = r23.m508() == ConstraintWidget.DimensionBehaviour.WRAP_CONTENT;
            boolean z15 = r23.m512() == ConstraintWidget.DimensionBehaviour.WRAP_CONTENT;
            int max = Math.max(r23.m478(), this.f7223.f880);
            int max2 = Math.max(r23.m473(), this.f7223.f832);
            int i18 = 0;
            boolean z16 = false;
            while (i18 < size4) {
                ConstraintWidget constraintWidget3 = this.f7225.get(i18);
                if (!(constraintWidget3 instanceof C2100)) {
                    i9 = i14;
                    r11 = r21;
                } else {
                    int r142 = constraintWidget3.m478();
                    int r152 = constraintWidget3.m473();
                    i9 = i14;
                    r11 = r21;
                    boolean r29 = z16 | m5517(r11, constraintWidget3, true);
                    int r92 = constraintWidget3.m478();
                    int r210 = constraintWidget3.m473();
                    if (r92 != r142) {
                        constraintWidget3.m502(r92);
                        if (z14 && constraintWidget3.m485() > max) {
                            max = Math.max(max, constraintWidget3.m488(ConstraintAnchor.Type.RIGHT).m456() + constraintWidget3.m485());
                        }
                        z5 = true;
                    } else {
                        z5 = r29;
                    }
                    if (r210 != r152) {
                        constraintWidget3.m479(r210);
                        if (z15 && constraintWidget3.m510() > max2) {
                            max2 = Math.max(max2, constraintWidget3.m488(ConstraintAnchor.Type.BOTTOM).m456() + constraintWidget3.m510());
                        }
                        z5 = true;
                    }
                    z16 = ((C2100) constraintWidget3).f7257 | z5;
                }
                i18++;
                r21 = r11;
                i14 = i9;
            }
            AbstractC2089 r113 = r21;
            int i19 = 0;
            int i20 = 2;
            while (true) {
                if (i19 >= i20) {
                    break;
                }
                int i21 = max2;
                boolean z17 = z16;
                int i22 = 0;
                while (i22 < size4) {
                    ConstraintWidget constraintWidget4 = this.f7225.get(i22);
                    if ((!(constraintWidget4 instanceof AbstractC2105) || (constraintWidget4 instanceof C2100)) && !(constraintWidget4 instanceof C2083) && constraintWidget4.f840 != 8 && ((!z || !constraintWidget4.f896.f920.f914 || !constraintWidget4.f835.f920.f914) && !(constraintWidget4 instanceof C2100))) {
                        int r6 = constraintWidget4.m478();
                        int r153 = constraintWidget4.m473();
                        i7 = size4;
                        int i23 = constraintWidget4.f865;
                        i8 = i19;
                        z17 |= m5517(r113, constraintWidget4, true);
                        int r211 = constraintWidget4.m478();
                        r212 = r113;
                        int r114 = constraintWidget4.m473();
                        if (r211 != r6) {
                            constraintWidget4.m502(r211);
                            if (z14 && constraintWidget4.m485() > max) {
                                max = Math.max(max, constraintWidget4.m488(ConstraintAnchor.Type.RIGHT).m456() + constraintWidget4.m485());
                            }
                            z17 = true;
                        }
                        if (r114 != r153) {
                            constraintWidget4.m479(r114);
                            if (z15 && constraintWidget4.m510() > i21) {
                                i21 = Math.max(i21, constraintWidget4.m488(ConstraintAnchor.Type.BOTTOM).m456() + constraintWidget4.m510());
                            }
                            z17 = true;
                        }
                        if (constraintWidget4.f852 && i23 != constraintWidget4.f865) {
                            z17 = true;
                        }
                    } else {
                        i8 = i19;
                        i7 = size4;
                        r212 = r113;
                    }
                    i22++;
                    size4 = i7;
                    i19 = i8;
                    r113 = r212;
                }
                if (!z17) {
                    z16 = z17;
                    max2 = i21;
                    break;
                }
                m5516(r23, r7, r8);
                i19++;
                size4 = size4;
                max2 = i21;
                r113 = r113;
                i20 = 2;
                z16 = false;
            }
            if (z16) {
                m5516(r23, r7, r8);
                if (r23.m478() < max) {
                    r23.m502(max);
                    z3 = true;
                } else {
                    z3 = false;
                }
                if (r23.m473() < max2) {
                    r23.m479(max2);
                    z4 = true;
                } else {
                    z4 = z3;
                }
                if (z4) {
                    m5516(r23, r7, r8);
                }
            }
            i14 = i14;
        }
        r23.m5469(i14);
        return 0;
    }

    /* renamed from: K  reason: contains not printable characters */
    public final boolean m5517(AbstractC2089 r6, ConstraintWidget constraintWidget, boolean z) {
        this.f7224.f7231 = constraintWidget.m508();
        this.f7224.f7229 = constraintWidget.m512();
        this.f7224.f7226 = constraintWidget.m478();
        this.f7224.f7234 = constraintWidget.m473();
        C2090 k = this.f7224;
        k.f7228 = false;
        k.f7232 = z;
        boolean z2 = k.f7231 == ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT;
        boolean z3 = this.f7224.f7229 == ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT;
        boolean z4 = z2 && constraintWidget.f842 > 0.0f;
        boolean z5 = z3 && constraintWidget.f842 > 0.0f;
        if (z4 && constraintWidget.f847[0] == 4) {
            this.f7224.f7231 = ConstraintWidget.DimensionBehaviour.FIXED;
        }
        if (z5 && constraintWidget.f847[1] == 4) {
            this.f7224.f7229 = ConstraintWidget.DimensionBehaviour.FIXED;
        }
        ((ConstraintLayout.C0139) r6).m564(constraintWidget, this.f7224);
        constraintWidget.m502(this.f7224.f7227);
        constraintWidget.m479(this.f7224.f7233);
        C2090 k2 = this.f7224;
        constraintWidget.f852 = k2.f7235;
        constraintWidget.m513(k2.f7230);
        C2090 k3 = this.f7224;
        k3.f7232 = false;
        return k3.f7228;
    }

    /* renamed from: K  reason: contains not printable characters */
    public final void m5516(C2082 r4, int i, int i2) {
        int i3 = r4.f880;
        int i4 = r4.f832;
        r4.m477(0);
        r4.m507(0);
        r4.f873 = i;
        int i5 = r4.f873;
        int i6 = r4.f880;
        if (i5 < i6) {
            r4.f873 = i6;
        }
        r4.f819 = i2;
        int i7 = r4.f819;
        int i8 = r4.f832;
        if (i7 < i8) {
            r4.f819 = i8;
        }
        r4.m477(i3);
        r4.m507(i4);
        this.f7223.m5481();
    }
}
