package ῲ.ⁱ.ῲ.㿎.ᕣ;

import androidx.constraintlayout.solver.widgets.ConstraintWidget;
import com.facebook.internal.AnalyticsEvents;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Iterator;
import ඓ.K.K.K.C1293;
import ῲ.ⁱ.ῲ.C2080;
import ῲ.ⁱ.ῲ.㿎.C2082;
import K.K.K.ʬ.C2369;

/* renamed from: ῲ.ⁱ.ῲ.㿎.ᕣ.䁗  reason: contains not printable characters */
/* compiled from: WidgetGroup */
public class C2098 {

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

    /* renamed from: ʬ  reason: contains not printable characters */
    public int f7242 = 0;

    /* renamed from: ඓ  reason: contains not printable characters */
    public int f7243 = -1;

    /* renamed from: ῲ  reason: contains not printable characters */
    public int f7244 = -1;

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

    /* renamed from: 㸾  reason: contains not printable characters */
    public ArrayList<C2099> f7246 = null;

    /* renamed from: ῲ.ⁱ.ῲ.㿎.ᕣ.䁗$K  reason: contains not printable characters */
    /* compiled from: WidgetGroup */
    public class C2099 {
        public C2099(C2098 r1, ConstraintWidget constraintWidget, C2080 r3, int i) {
            new WeakReference(constraintWidget);
            r3.m5446(constraintWidget.f820);
            r3.m5446(constraintWidget.f885);
            r3.m5446(constraintWidget.f833);
            r3.m5446(constraintWidget.f841);
            r3.m5446(constraintWidget.f897);
        }
    }

    public C2098(int i) {
        int i2 = f7241;
        f7241 = i2 + 1;
        this.f7244 = i2;
        this.f7242 = i;
    }

    public String toString() {
        StringBuilder sb = new StringBuilder();
        int i = this.f7242;
        sb.append(i == 0 ? "Horizontal" : i == 1 ? "Vertical" : i == 2 ? "Both" : AnalyticsEvents.PARAMETER_DIALOG_OUTCOME_VALUE_UNKNOWN);
        sb.append(" [");
        sb.append(this.f7244);
        sb.append("] <");
        String sb2 = sb.toString();
        Iterator<ConstraintWidget> it2 = this.f7245.iterator();
        while (it2.hasNext()) {
            StringBuilder r0 = C1293.m3402(sb2, " ");
            r0.append(it2.next().f893);
            sb2 = r0.toString();
        }
        return C1293.m3412(sb2, " >");
    }

    /* renamed from: K  reason: contains not printable characters */
    public boolean m5550(ConstraintWidget constraintWidget) {
        if (this.f7245.contains(constraintWidget)) {
            return false;
        }
        this.f7245.add(constraintWidget);
        return true;
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m5548(int i, C2098 r5) {
        Iterator<ConstraintWidget> it2 = this.f7245.iterator();
        while (it2.hasNext()) {
            ConstraintWidget next = it2.next();
            r5.m5550(next);
            if (i == 0) {
                next.f887 = r5.f7244;
            } else {
                next.f818 = r5.f7244;
            }
        }
        this.f7243 = r5.f7244;
    }

    /* renamed from: K  reason: contains not printable characters */
    public int m5547(C2080 r6, int i) {
        int i2;
        int i3;
        if (this.f7245.size() == 0) {
            return 0;
        }
        ArrayList<ConstraintWidget> arrayList = this.f7245;
        C2082 r2 = (C2082) arrayList.get(0).f867;
        r6.m5451();
        r2.m497(r6, false);
        for (int i4 = 0; i4 < arrayList.size(); i4++) {
            arrayList.get(i4).m497(r6, false);
        }
        if (i == 0 && r2.f7202 > 0) {
            C2369.m6337(r2, r6, arrayList, 0);
        }
        if (i == 1 && r2.f7190 > 0) {
            C2369.m6337(r2, r6, arrayList, 1);
        }
        try {
            r6.m5445();
        } catch (Exception e) {
            e.printStackTrace();
        }
        this.f7246 = new ArrayList<>();
        for (int i5 = 0; i5 < arrayList.size(); i5++) {
            this.f7246.add(new C2099(this, arrayList.get(i5), r6, i));
        }
        if (i == 0) {
            i2 = r6.m5446(r2.f820);
            i3 = r6.m5446(r2.f833);
            r6.m5451();
        } else {
            i2 = r6.m5446(r2.f885);
            i3 = r6.m5446(r2.f841);
            r6.m5451();
        }
        return i3 - i2;
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m5549(ArrayList<C2098> arrayList) {
        int size = this.f7245.size();
        if (this.f7243 != -1 && size > 0) {
            for (int i = 0; i < arrayList.size(); i++) {
                C2098 r2 = arrayList.get(i);
                if (this.f7243 == r2.f7244) {
                    m5548(this.f7242, r2);
                }
            }
        }
        if (size == 0) {
            arrayList.remove(this);
        }
    }
}
