package p037.p058.p061.p062;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import p037.p041.p042.LayoutInflaterFactory2C1494;
import p037.p058.p061.C1735;
import p037.p058.p061.p062.C1747;
import p037.p058.p061.p062.p063.AbstractC1771;
import p037.p058.p061.p062.p063.C1757;
import p037.p058.p061.p062.p063.C1760;
import p037.p058.p061.p062.p063.C1762;

/* JADX INFO: renamed from: މ.ނ.ؠ.ޅ.ނ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public class C1749 extends C1755 {

    /* JADX INFO: renamed from: ྌ, reason: contains not printable characters */
    public int f5799;

    /* JADX INFO: renamed from: ဢ, reason: contains not printable characters */
    public int f5800;

    /* JADX INFO: renamed from: ൎ, reason: contains not printable characters */
    public C1757 f5794 = new C1757(this);

    /* JADX INFO: renamed from: ໞ, reason: contains not printable characters */
    public C1762 f5795 = new C1762(this);

    /* JADX INFO: renamed from: ໟ, reason: contains not printable characters */
    public C1757.InterfaceC1759 f5796 = null;

    /* JADX INFO: renamed from: ྈ, reason: contains not printable characters */
    public boolean f5797 = false;

    /* JADX INFO: renamed from: ྉ, reason: contains not printable characters */
    public C1735 f5798 = new C1735();

    /* JADX INFO: renamed from: ဨ, reason: contains not printable characters */
    public int f5801 = 0;

    /* JADX INFO: renamed from: ၚ, reason: contains not printable characters */
    public int f5802 = 0;

    /* JADX INFO: renamed from: ၛ, reason: contains not printable characters */
    public C1744[] f5803 = new C1744[4];

    /* JADX INFO: renamed from: ၜ, reason: contains not printable characters */
    public C1744[] f5804 = new C1744[4];

    /* JADX INFO: renamed from: ၝ, reason: contains not printable characters */
    public int f5805 = 7;

    /* JADX INFO: renamed from: ၡ, reason: contains not printable characters */
    public boolean f5806 = false;

    /* JADX INFO: renamed from: ၥ, reason: contains not printable characters */
    public boolean f5807 = false;

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public void m3481(C1747 c1747, int i) {
        if (i == 0) {
            int i2 = this.f5801 + 1;
            C1744[] c1744Arr = this.f5804;
            if (i2 >= c1744Arr.length) {
                this.f5804 = (C1744[]) Arrays.copyOf(c1744Arr, c1744Arr.length * 2);
            }
            this.f5804[this.f5801] = new C1744(c1747, 0, this.f5797);
            this.f5801++;
            return;
        }
        if (i == 1) {
            int i3 = this.f5802 + 1;
            C1744[] c1744Arr2 = this.f5803;
            if (i3 >= c1744Arr2.length) {
                this.f5803 = (C1744[]) Arrays.copyOf(c1744Arr2, c1744Arr2.length * 2);
            }
            this.f5803[this.f5802] = new C1744(c1747, 1, this.f5797);
            this.f5802++;
        }
    }

    @Override // p037.p058.p061.p062.C1747
    /* JADX INFO: renamed from: ֏ */
    public void mo3459(boolean z, boolean z2) {
        super.mo3459(z, z2);
        int size = this.f5817.size();
        for (int i = 0; i < size; i++) {
            this.f5817.get(i).mo3459(z, z2);
        }
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public boolean m3482(boolean z, int i) {
        boolean z2;
        C1747.EnumC1748 enumC1748;
        C1762 c1762 = this.f5795;
        boolean z3 = true;
        boolean z4 = z & true;
        C1747.EnumC1748 enumC1748M3454 = c1762.f5833.m3454(0);
        C1747.EnumC1748 enumC1748M34542 = c1762.f5833.m3454(1);
        int iM3475 = c1762.f5833.m3475();
        int iM3477 = c1762.f5833.m3477();
        if (z4 && (enumC1748M3454 == (enumC1748 = C1747.EnumC1748.WRAP_CONTENT) || enumC1748M34542 == enumC1748)) {
            Iterator<AbstractC1771> it = c1762.f5837.iterator();
            while (true) {
                if (!it.hasNext()) {
                    break;
                }
                AbstractC1771 next = it.next();
                if (next.f5874 == i && !next.mo3495()) {
                    z4 = false;
                    break;
                }
            }
            if (i == 0) {
                if (z4 && enumC1748M3454 == C1747.EnumC1748.WRAP_CONTENT) {
                    c1762.f5833.m3458(C1747.EnumC1748.FIXED);
                    C1749 c1749 = c1762.f5833;
                    c1749.m3476(c1762.m3498(c1749, 0));
                    C1749 c17492 = c1762.f5833;
                    c17492.f5737.f5873.mo3506(c17492.m3473());
                }
            } else if (z4 && enumC1748M34542 == C1747.EnumC1748.WRAP_CONTENT) {
                c1762.f5833.m3463(C1747.EnumC1748.FIXED);
                C1749 c17493 = c1762.f5833;
                c17493.m3470(c1762.m3498(c17493, 1));
                C1749 c17494 = c1762.f5833;
                c17494.f5738.f5873.mo3506(c17494.m3464());
            }
        }
        if (i == 0) {
            C1747.EnumC1748[] enumC1748Arr = c1762.f5833.f5767;
            if (enumC1748Arr[0] == C1747.EnumC1748.FIXED || enumC1748Arr[0] == C1747.EnumC1748.MATCH_PARENT) {
                int iM3473 = c1762.f5833.m3473() + iM3475;
                c1762.f5833.f5737.f5877.mo3506(iM3473);
                c1762.f5833.f5737.f5873.mo3506(iM3473 - iM3475);
                z2 = true;
            }
            z2 = false;
        } else {
            C1747.EnumC1748[] enumC1748Arr2 = c1762.f5833.f5767;
            if (enumC1748Arr2[1] == C1747.EnumC1748.FIXED || enumC1748Arr2[1] == C1747.EnumC1748.MATCH_PARENT) {
                int iM3464 = c1762.f5833.m3464() + iM3477;
                c1762.f5833.f5738.f5877.mo3506(iM3464);
                c1762.f5833.f5738.f5873.mo3506(iM3464 - iM3477);
                z2 = true;
            }
            z2 = false;
        }
        c1762.m3504();
        for (AbstractC1771 abstractC1771 : c1762.f5837) {
            if (abstractC1771.f5874 == i && (abstractC1771.f5870 != c1762.f5833 || abstractC1771.f5875)) {
                abstractC1771.mo3492();
            }
        }
        for (AbstractC1771 abstractC17712 : c1762.f5837) {
            if (abstractC17712.f5874 == i && (z2 || abstractC17712.f5870 != c1762.f5833)) {
                if (!abstractC17712.f5876.f5850 || !abstractC17712.f5877.f5850 || (!(abstractC17712 instanceof C1760) && !abstractC17712.f5873.f5850)) {
                    z3 = false;
                    break;
                }
            }
        }
        c1762.f5833.m3458(enumC1748M3454);
        c1762.f5833.m3463(enumC1748M34542);
        return z3;
    }

    /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
    public boolean m3483(C1735 c1735) {
        mo3446(c1735);
        int size = this.f5817.size();
        for (int i = 0; i < size; i++) {
            C1747 c1747 = this.f5817.get(i);
            if ((c1747 instanceof C1754) || (c1747 instanceof C1750)) {
                c1747.mo3446(c1735);
            }
        }
        for (int i2 = 0; i2 < size; i2++) {
            C1747 c17472 = this.f5817.get(i2);
            if (c17472 instanceof C1749) {
                C1747.EnumC1748[] enumC1748Arr = c17472.f5767;
                C1747.EnumC1748 enumC1748 = enumC1748Arr[0];
                C1747.EnumC1748 enumC17482 = enumC1748Arr[1];
                if (enumC1748 == C1747.EnumC1748.WRAP_CONTENT) {
                    c17472.m3458(C1747.EnumC1748.FIXED);
                }
                if (enumC17482 == C1747.EnumC1748.WRAP_CONTENT) {
                    c17472.m3463(C1747.EnumC1748.FIXED);
                }
                c17472.mo3446(c1735);
                if (enumC1748 == C1747.EnumC1748.WRAP_CONTENT) {
                    c17472.m3458(enumC1748);
                }
                if (enumC17482 == C1747.EnumC1748.WRAP_CONTENT) {
                    c17472.m3463(enumC17482);
                }
            } else {
                c17472.f5741 = -1;
                c17472.f5742 = -1;
                if (this.f5767[0] != C1747.EnumC1748.WRAP_CONTENT && c17472.f5767[0] == C1747.EnumC1748.MATCH_PARENT) {
                    int i3 = c17472.f5757.f5720;
                    int iM3473 = m3473() - c17472.f5759.f5720;
                    C1745 c1745 = c17472.f5757;
                    c1745.f5722 = c1735.m3420(c1745);
                    C1745 c17452 = c17472.f5759;
                    c17452.f5722 = c1735.m3420(c17452);
                    c1735.m3425(c17472.f5757.f5722, i3);
                    c1735.m3425(c17472.f5759.f5722, iM3473);
                    c17472.f5741 = 2;
                    c17472.f5773 = i3;
                    int i4 = iM3473 - i3;
                    c17472.f5769 = i4;
                    int i5 = c17472.f5776;
                    if (i4 < i5) {
                        c17472.f5769 = i5;
                    }
                }
                if (this.f5767[1] != C1747.EnumC1748.WRAP_CONTENT && c17472.f5767[1] == C1747.EnumC1748.MATCH_PARENT) {
                    int i6 = c17472.f5758.f5720;
                    int iM3464 = m3464() - c17472.f5760.f5720;
                    C1745 c17453 = c17472.f5758;
                    c17453.f5722 = c1735.m3420(c17453);
                    C1745 c17454 = c17472.f5760;
                    c17454.f5722 = c1735.m3420(c17454);
                    c1735.m3425(c17472.f5758.f5722, i6);
                    c1735.m3425(c17472.f5760.f5722, iM3464);
                    if (c17472.f5775 > 0 || c17472.f5781 == 8) {
                        C1745 c17455 = c17472.f5761;
                        c17455.f5722 = c1735.m3420(c17455);
                        c1735.m3425(c17472.f5761.f5722, c17472.f5775 + i6);
                    }
                    c17472.f5742 = 2;
                    c17472.f5774 = i6;
                    int i7 = iM3464 - i6;
                    c17472.f5770 = i7;
                    int i8 = c17472.f5777;
                    if (i7 < i8) {
                        c17472.f5770 = i8;
                    }
                }
                if (!(c17472 instanceof C1754) && !(c17472 instanceof C1750)) {
                    c17472.mo3446(c1735);
                }
            }
        }
        if (this.f5801 > 0) {
            LayoutInflaterFactory2C1494.C1505.m2954(this, c1735, 0);
        }
        if (this.f5802 > 0) {
            LayoutInflaterFactory2C1494.C1505.m2954(this, c1735, 1);
        }
        return true;
    }

    @Override // p037.p058.p061.p062.C1755, p037.p058.p061.p062.C1747
    /* JADX INFO: renamed from: މ */
    public void mo3480() {
        this.f5798.m3437();
        this.f5799 = 0;
        this.f5800 = 0;
        super.mo3480();
    }

    /* JADX WARN: Removed duplicated region for block: B:109:0x021d A[PHI: r0 r12
      0x021d: PHI (r0v26 boolean) = (r0v25 boolean), (r0v28 boolean), (r0v28 boolean), (r0v28 boolean) binds: [B:96:0x01e0, B:104:0x0205, B:105:0x0207, B:107:0x020d] A[DONT_GENERATE, DONT_INLINE]
      0x021d: PHI (r12v5 boolean) = (r12v4 boolean), (r12v7 boolean), (r12v7 boolean), (r12v7 boolean) binds: [B:96:0x01e0, B:104:0x0205, B:105:0x0207, B:107:0x020d] A[DONT_GENERATE, DONT_INLINE]] */
    /* JADX WARN: Removed duplicated region for block: B:14:0x0037  */
    /* JADX WARN: Type inference failed for: r11v11 */
    /* JADX WARN: Type inference failed for: r11v12, types: [boolean] */
    /* JADX WARN: Type inference failed for: r11v16 */
    @Override // p037.p058.p061.p062.C1755
    /* JADX INFO: renamed from: ފ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public void mo3484() {
        boolean z;
        boolean z2;
        ?? r11;
        boolean z3;
        this.f5773 = 0;
        this.f5774 = 0;
        int iMax = Math.max(0, m3473());
        int iMax2 = Math.max(0, m3464());
        this.f5806 = false;
        this.f5807 = false;
        if ((this.f5805 & 64) == 64) {
            z = true;
        } else if (!((this.f5805 & 128) == 128)) {
            z = false;
        }
        C1735 c1735 = this.f5798;
        c1735.f5655 = false;
        c1735.f5656 = false;
        if (this.f5805 != 0 && z) {
            c1735.f5656 = true;
        }
        C1747.EnumC1748[] enumC1748Arr = this.f5767;
        C1747.EnumC1748 enumC1748 = enumC1748Arr[1];
        C1747.EnumC1748 enumC17482 = enumC1748Arr[0];
        ArrayList<C1747> arrayList = this.f5817;
        boolean z4 = m3467() == C1747.EnumC1748.WRAP_CONTENT || m3471() == C1747.EnumC1748.WRAP_CONTENT;
        this.f5801 = 0;
        this.f5802 = 0;
        int size = this.f5817.size();
        for (int i = 0; i < size; i++) {
            C1747 c1747 = this.f5817.get(i);
            if (c1747 instanceof C1755) {
                ((C1755) c1747).mo3484();
            }
        }
        int i2 = 0;
        boolean z5 = true;
        boolean z6 = false;
        while (z5) {
            int i3 = i2 + 1;
            try {
                this.f5798.m3437();
                this.f5801 = 0;
                this.f5802 = 0;
                m3462(this.f5798);
                for (int i4 = 0; i4 < size; i4++) {
                    this.f5817.get(i4).m3462(this.f5798);
                }
                m3483(this.f5798);
            } catch (Exception e) {
                e = e;
            }
            try {
                C1735 c17352 = this.f5798;
                if (c17352.f5655 || c17352.f5656) {
                    int i5 = 0;
                    while (true) {
                        if (i5 >= c17352.f5659) {
                            z3 = true;
                            break;
                        } else {
                            if (!c17352.f5654[i5].f5644) {
                                z3 = false;
                                break;
                            }
                            i5++;
                        }
                    }
                    if (z3) {
                        c17352.m3422();
                    } else {
                        c17352.m3424(c17352.f5651);
                    }
                } else {
                    c17352.m3424(c17352.f5651);
                }
                z5 = true;
            } catch (Exception e2) {
                e = e2;
                z5 = true;
                e.printStackTrace();
                System.out.println("EXCEPTION : " + e);
            }
            if (z5) {
                C1735 c17353 = this.f5798;
                C1753.f5815[2] = false;
                mo3466(c17353);
                int size2 = this.f5817.size();
                for (int i6 = 0; i6 < size2; i6++) {
                    this.f5817.get(i6).mo3466(c17353);
                }
            } else {
                mo3466(this.f5798);
                for (int i7 = 0; i7 < size; i7++) {
                    this.f5817.get(i7).mo3466(this.f5798);
                }
            }
            if (z4 && i3 < 8 && C1753.f5815[2]) {
                int iMax3 = 0;
                int iMax4 = 0;
                for (int i8 = 0; i8 < size; i8++) {
                    C1747 c17472 = this.f5817.get(i8);
                    iMax3 = Math.max(iMax3, c17472.m3473() + c17472.f5773);
                    iMax4 = Math.max(iMax4, c17472.m3464() + c17472.f5774);
                }
                int iMax5 = Math.max(this.f5776, iMax3);
                int iMax6 = Math.max(this.f5777, iMax4);
                if (enumC17482 != C1747.EnumC1748.WRAP_CONTENT || m3473() >= iMax5) {
                    z2 = false;
                } else {
                    m3476(iMax5);
                    this.f5767[0] = C1747.EnumC1748.WRAP_CONTENT;
                    z2 = true;
                    z6 = true;
                }
                if (enumC1748 == C1747.EnumC1748.WRAP_CONTENT && m3464() < iMax6) {
                    m3470(iMax6);
                    this.f5767[1] = C1747.EnumC1748.WRAP_CONTENT;
                    z2 = true;
                    z6 = true;
                }
            } else {
                z2 = false;
            }
            int iMax7 = Math.max(this.f5776, m3473());
            if (iMax7 > m3473()) {
                m3476(iMax7);
                this.f5767[0] = C1747.EnumC1748.FIXED;
                z2 = true;
                z6 = true;
            }
            int iMax8 = Math.max(this.f5777, m3464());
            if (iMax8 > m3464()) {
                m3470(iMax8);
                r11 = 1;
                this.f5767[1] = C1747.EnumC1748.FIXED;
                z2 = true;
                z6 = true;
            } else {
                r11 = 1;
            }
            if (z6) {
                z5 = z2;
            } else {
                if (this.f5767[0] == C1747.EnumC1748.WRAP_CONTENT && iMax > 0 && m3473() > iMax) {
                    this.f5806 = r11;
                    this.f5767[0] = C1747.EnumC1748.FIXED;
                    m3476(iMax);
                    z2 = true;
                    z6 = true;
                }
                if (this.f5767[r11] == C1747.EnumC1748.WRAP_CONTENT && iMax2 > 0 && m3464() > iMax2) {
                    this.f5807 = r11;
                    this.f5767[r11] = C1747.EnumC1748.FIXED;
                    m3470(iMax2);
                    z5 = true;
                    z6 = true;
                }
            }
            i2 = i3;
        }
        this.f5817 = arrayList;
        if (z6) {
            C1747.EnumC1748[] enumC1748Arr2 = this.f5767;
            enumC1748Arr2[0] = enumC17482;
            enumC1748Arr2[1] = enumC1748;
        }
        mo3455(this.f5798.f5661);
    }

    /* JADX INFO: renamed from: ދ, reason: contains not printable characters */
    public void m3485() {
        this.f5795.f5834 = true;
    }
}
