package o; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; import o.C17026tNn; import o.zvH; /* loaded from: classes.dex */ public final class lLR { public WqU c; public WqU e; public boolean a = true; public boolean b = true; public ArrayList i = new ArrayList<>(); private ArrayList h = new ArrayList<>(); public zvH.RVV d = null; private zvH.Sts g = new zvH.Sts(); private ArrayList f = new ArrayList<>(); public lLR(WqU wqU) { this.c = wqU; this.e = wqU; } public final int b(WqU wqU, int i) { int size = this.f.size(); long j = 0; for (int i2 = 0; i2 < size; i2++) { j = Math.max(j, this.f.get(i2).d(wqU, i)); } return (int) j; } private void a(C17026tNn c17026tNn, C17026tNn.LWm lWm, int i, C17026tNn.LWm lWm2, int i2) { this.g.e = lWm; this.g.h = lWm2; this.g.a = i; this.g.j = i2; this.d.a(c17026tNn, this.g); c17026tNn.i(this.g.g); c17026tNn.c(this.g.f); c17026tNn.d = this.g.b; int i3 = this.g.d; c17026tNn.k = i3; c17026tNn.d = i3 > 0; } public final boolean c(WqU wqU) { Iterator it = ((C16458oZD) wqU).az.iterator(); while (true) { if (!it.hasNext()) { return false; } C17026tNn next = it.next(); C17026tNn.LWm lWm = next.B[0]; C17026tNn.LWm lWm2 = next.B[1]; if (next.Z == 8) { next.ae = true; } else { if (next.M < 1.0f && lWm == C17026tNn.LWm.MATCH_CONSTRAINT) { next.H = 2; } if (next.K < 1.0f && lWm2 == C17026tNn.LWm.MATCH_CONSTRAINT) { next.I = 2; } if (next.s > BitmapDescriptorFactory.HUE_RED) { if (lWm == C17026tNn.LWm.MATCH_CONSTRAINT && (lWm2 == C17026tNn.LWm.WRAP_CONTENT || lWm2 == C17026tNn.LWm.FIXED)) { next.H = 3; } else if (lWm2 == C17026tNn.LWm.MATCH_CONSTRAINT && (lWm == C17026tNn.LWm.WRAP_CONTENT || lWm == C17026tNn.LWm.FIXED)) { next.I = 3; } else if (lWm == C17026tNn.LWm.MATCH_CONSTRAINT && lWm2 == C17026tNn.LWm.MATCH_CONSTRAINT) { if (next.H == 0) { next.H = 3; } if (next.I == 0) { next.I = 3; } } } if (lWm == C17026tNn.LWm.MATCH_CONSTRAINT && next.H == 1 && (next.D.f == null || next.X.f == null)) { lWm = C17026tNn.LWm.WRAP_CONTENT; } C17026tNn.LWm lWm3 = lWm; C17026tNn.LWm lWm4 = (lWm2 == C17026tNn.LWm.MATCH_CONSTRAINT && next.I == 1 && (next.V.f == null || next.n.f == null)) ? C17026tNn.LWm.WRAP_CONTENT : lWm2; next.h.d = lWm3; next.h.i = next.H; next.ak.d = lWm4; next.ak.i = next.I; if ((lWm3 != C17026tNn.LWm.MATCH_PARENT && lWm3 != C17026tNn.LWm.FIXED && lWm3 != C17026tNn.LWm.WRAP_CONTENT) || (lWm4 != C17026tNn.LWm.MATCH_PARENT && lWm4 != C17026tNn.LWm.FIXED && lWm4 != C17026tNn.LWm.WRAP_CONTENT)) { if (lWm3 == C17026tNn.LWm.MATCH_CONSTRAINT && (lWm4 == C17026tNn.LWm.WRAP_CONTENT || lWm4 == C17026tNn.LWm.FIXED)) { if (next.H == 3) { if (lWm4 == C17026tNn.LWm.WRAP_CONTENT) { a(next, C17026tNn.LWm.WRAP_CONTENT, 0, C17026tNn.LWm.WRAP_CONTENT, 0); } int i = next.Z == 8 ? 0 : next.p; int i2 = (int) ((i * next.s) + 0.5f); C17026tNn.LWm lWm5 = C17026tNn.LWm.FIXED; a(next, lWm5, i2, lWm5, i); next.h.e.d(next.Z == 8 ? 0 : next.ac); next.ak.e.d(next.Z != 8 ? next.p : 0); next.ae = true; } else if (next.H == 1) { a(next, C17026tNn.LWm.WRAP_CONTENT, 0, lWm4, 0); next.h.e.k = next.Z != 8 ? next.ac : 0; } else if (next.H == 2) { if (wqU.B[0] == C17026tNn.LWm.FIXED || wqU.B[0] == C17026tNn.LWm.MATCH_PARENT) { a(next, C17026tNn.LWm.FIXED, (int) ((next.M * (wqU.Z == 8 ? 0 : wqU.ac)) + 0.5f), lWm4, next.Z == 8 ? 0 : next.p); next.h.e.d(next.Z == 8 ? 0 : next.ac); next.ak.e.d(next.Z != 8 ? next.p : 0); next.ae = true; } } else if (next.C[0].f == null || next.C[1].f == null) { a(next, C17026tNn.LWm.WRAP_CONTENT, 0, lWm4, 0); next.h.e.d(next.Z == 8 ? 0 : next.ac); next.ak.e.d(next.Z != 8 ? next.p : 0); next.ae = true; } } if (lWm4 == C17026tNn.LWm.MATCH_CONSTRAINT && (lWm3 == C17026tNn.LWm.WRAP_CONTENT || lWm3 == C17026tNn.LWm.FIXED)) { if (next.I == 3) { if (lWm3 == C17026tNn.LWm.WRAP_CONTENT) { a(next, C17026tNn.LWm.WRAP_CONTENT, 0, C17026tNn.LWm.WRAP_CONTENT, 0); } int i3 = next.Z == 8 ? 0 : next.ac; float f = next.s; if (next.q == -1) { f = 1.0f / f; } C17026tNn.LWm lWm6 = C17026tNn.LWm.FIXED; a(next, lWm6, i3, lWm6, (int) ((i3 * f) + 0.5f)); next.h.e.d(next.Z == 8 ? 0 : next.ac); next.ak.e.d(next.Z != 8 ? next.p : 0); next.ae = true; } else if (next.I == 1) { a(next, lWm3, 0, C17026tNn.LWm.WRAP_CONTENT, 0); next.ak.e.k = next.Z != 8 ? next.p : 0; } else if (next.I == 2) { if (wqU.B[1] == C17026tNn.LWm.FIXED || wqU.B[1] == C17026tNn.LWm.MATCH_PARENT) { a(next, lWm3, next.Z == 8 ? 0 : next.ac, C17026tNn.LWm.FIXED, (int) ((next.K * (wqU.Z == 8 ? 0 : wqU.p)) + 0.5f)); next.h.e.d(next.Z == 8 ? 0 : next.ac); next.ak.e.d(next.Z != 8 ? next.p : 0); next.ae = true; } } else if (next.C[2].f == null || next.C[3].f == null) { a(next, C17026tNn.LWm.WRAP_CONTENT, 0, lWm4, 0); next.h.e.d(next.Z == 8 ? 0 : next.ac); next.ak.e.d(next.Z != 8 ? next.p : 0); next.ae = true; } } if (lWm3 == C17026tNn.LWm.MATCH_CONSTRAINT && lWm4 == C17026tNn.LWm.MATCH_CONSTRAINT) { if (next.H == 1 || next.I == 1) { a(next, C17026tNn.LWm.WRAP_CONTENT, 0, C17026tNn.LWm.WRAP_CONTENT, 0); next.h.e.k = next.Z == 8 ? 0 : next.ac; next.ak.e.k = next.Z != 8 ? next.p : 0; } else if (next.I == 2 && next.H == 2 && wqU.B[0] == C17026tNn.LWm.FIXED && wqU.B[1] == C17026tNn.LWm.FIXED) { float f2 = next.M; float f3 = next.K; int i4 = (int) ((f2 * (wqU.Z == 8 ? 0 : wqU.ac)) + 0.5f); int i5 = wqU.Z == 8 ? 0 : wqU.p; C17026tNn.LWm lWm7 = C17026tNn.LWm.FIXED; a(next, lWm7, i4, lWm7, (int) ((f3 * i5) + 0.5f)); next.h.e.d(next.Z == 8 ? 0 : next.ac); next.ak.e.d(next.Z != 8 ? next.p : 0); next.ae = true; } } } else { int i6 = next.Z == 8 ? 0 : next.ac; if (lWm3 == C17026tNn.LWm.MATCH_PARENT) { i6 = ((wqU.Z == 8 ? 0 : wqU.ac) - next.D.b) - next.X.b; lWm3 = C17026tNn.LWm.FIXED; } int i7 = i6; int i8 = next.Z == 8 ? 0 : next.p; if (lWm4 == C17026tNn.LWm.MATCH_PARENT) { int i9 = wqU.Z == 8 ? 0 : wqU.p; int i10 = next.V.b; int i11 = next.n.b; lWm4 = C17026tNn.LWm.FIXED; i8 = (i9 - i10) - i11; } a(next, lWm3, i7, lWm4, i8); next.h.e.d(next.Z == 8 ? 0 : next.ac); next.ak.e.d(next.Z != 8 ? next.p : 0); next.ae = true; } } } } public final void d() { Iterator it = ((C16458oZD) this.c).az.iterator(); while (it.hasNext()) { C17026tNn next = it.next(); if (!next.ae) { C17026tNn.LWm lWm = next.B[0]; C17026tNn.LWm lWm2 = next.B[1]; int i = next.H; int i2 = next.I; boolean z = lWm == C17026tNn.LWm.WRAP_CONTENT || (lWm == C17026tNn.LWm.MATCH_CONSTRAINT && i == 1); boolean z2 = lWm2 == C17026tNn.LWm.WRAP_CONTENT || (lWm2 == C17026tNn.LWm.MATCH_CONSTRAINT && i2 == 1); boolean z3 = next.h.e.j; boolean z4 = next.ak.e.j; if (z3 && z4) { a(next, C17026tNn.LWm.FIXED, next.h.e.l, C17026tNn.LWm.FIXED, next.ak.e.l); next.ae = true; } else if (z3 && z2) { a(next, C17026tNn.LWm.FIXED, next.h.e.l, C17026tNn.LWm.WRAP_CONTENT, next.ak.e.l); if (lWm2 == C17026tNn.LWm.MATCH_CONSTRAINT) { next.ak.e.k = next.Z != 8 ? next.p : 0; } else { next.ak.e.d(next.Z != 8 ? next.p : 0); next.ae = true; } } else if (z4 && z) { a(next, C17026tNn.LWm.WRAP_CONTENT, next.h.e.l, C17026tNn.LWm.FIXED, next.ak.e.l); if (lWm == C17026tNn.LWm.MATCH_CONSTRAINT) { next.h.e.k = next.Z != 8 ? next.ac : 0; } else { next.h.e.d(next.Z != 8 ? next.ac : 0); next.ae = true; } } if (next.ae && next.ak.a != null) { next.ak.a.d(next.k); } } } } public final void b() { a(this.i); this.f.clear(); ysb.a = 0; b(this.c.h, 0, this.f); b(this.c.ak, 1, this.f); this.a = false; } private void a(ArrayList arrayList) { arrayList.clear(); Vlp vlp = this.e.h; HashSet hashSet = null; vlp.h = null; vlp.f8108o.e(); vlp.c.e(); vlp.e.e(); vlp.j = false; this.e.ak.e(); arrayList.add(this.e.h); arrayList.add(this.e.ak); Iterator it = ((C16458oZD) this.e).az.iterator(); while (it.hasNext()) { C17026tNn next = it.next(); if (next instanceof WAE) { arrayList.add(new XjU(next)); } else { if (next.o()) { if (next.b == null) { next.b = new QAm(next, 0); } if (hashSet == null) { hashSet = new HashSet(); } hashSet.add(next.b); } else { arrayList.add(next.h); } if (next.k()) { if (next.ad == null) { next.ad = new QAm(next, 1); } if (hashSet == null) { hashSet = new HashSet(); } hashSet.add(next.ad); } else { arrayList.add(next.ak); } if (next instanceof NsV) { arrayList.add(new AXW(next)); } } } if (hashSet != null) { arrayList.addAll(hashSet); } Iterator it2 = arrayList.iterator(); while (it2.hasNext()) { it2.next().e(); } Iterator it3 = arrayList.iterator(); while (it3.hasNext()) { Bgk next2 = it3.next(); if (next2.l != this.e) { next2.a(); } } } private void e(KMk kMk, int i, int i2, KMk kMk2, ArrayList arrayList, ysb ysbVar) { Bgk bgk = kMk.g; if (bgk.h != null || bgk == this.c.h || bgk == this.c.ak) { return; } if (ysbVar == null) { ysbVar = new ysb(bgk, i2); arrayList.add(ysbVar); } bgk.h = ysbVar; ysbVar.c.add(bgk); ysbVar.b = bgk; for (rZk rzk : bgk.f8108o.d) { if (rzk instanceof KMk) { e((KMk) rzk, i, 0, kMk2, arrayList, ysbVar); } } for (rZk rzk2 : bgk.c.d) { if (rzk2 instanceof KMk) { e((KMk) rzk2, i, 1, kMk2, arrayList, ysbVar); } } if (i == 1 && (bgk instanceof UhD)) { for (rZk rzk3 : ((UhD) bgk).b.d) { if (rzk3 instanceof KMk) { e((KMk) rzk3, i, 2, kMk2, arrayList, ysbVar); } } } for (KMk kMk3 : bgk.f8108o.i) { if (kMk3 == kMk2) { ysbVar.d = true; } e(kMk3, i, 0, kMk2, arrayList, ysbVar); } for (KMk kMk4 : bgk.c.i) { if (kMk4 == kMk2) { ysbVar.d = true; } e(kMk4, i, 1, kMk2, arrayList, ysbVar); } if (i == 1 && (bgk instanceof UhD)) { Iterator it = ((UhD) bgk).b.i.iterator(); while (it.hasNext()) { e(it.next(), i, 2, kMk2, arrayList, ysbVar); } } } private void b(Bgk bgk, int i, ArrayList arrayList) { for (rZk rzk : bgk.f8108o.d) { if (rzk instanceof KMk) { e((KMk) rzk, i, 0, bgk.c, arrayList, null); } else if (rzk instanceof Bgk) { e(((Bgk) rzk).f8108o, i, 0, bgk.c, arrayList, null); } } for (rZk rzk2 : bgk.c.d) { if (rzk2 instanceof KMk) { e((KMk) rzk2, i, 1, bgk.f8108o, arrayList, null); } else if (rzk2 instanceof Bgk) { e(((Bgk) rzk2).c, i, 1, bgk.f8108o, arrayList, null); } } if (i == 1) { for (rZk rzk3 : ((UhD) bgk).b.d) { if (rzk3 instanceof KMk) { e((KMk) rzk3, i, 2, null, arrayList, null); } } } } }