package o; import com.airbnb.deeplinkdispatch.UrlTreeKt; import java.util.ArrayList; import java.util.Iterator; /* loaded from: classes.dex */ public final class QAm extends Bgk { private ArrayList a; private int b; public QAm(C17026tNn c17026tNn, int i) { super(c17026tNn); C17026tNn c17026tNn2; Bgk bgk; int i2; Bgk bgk2; this.a = new ArrayList<>(); this.f = i; C17026tNn c17026tNn3 = this.l; C17026tNn e = c17026tNn3.e(this.f); while (true) { C17026tNn c17026tNn4 = e; c17026tNn2 = c17026tNn3; c17026tNn3 = c17026tNn4; if (c17026tNn3 == null) { break; } else { e = c17026tNn3.e(this.f); } } this.l = c17026tNn2; ArrayList arrayList = this.a; int i3 = this.f; if (i3 == 0) { bgk = c17026tNn2.h; } else { bgk = i3 == 1 ? c17026tNn2.ak : null; } arrayList.add(bgk); C17026tNn b = c17026tNn2.b(this.f); while (b != null) { ArrayList arrayList2 = this.a; int i4 = this.f; if (i4 == 0) { bgk2 = b.h; } else { bgk2 = i4 == 1 ? b.ak : null; } arrayList2.add(bgk2); b = b.b(this.f); } Iterator it = this.a.iterator(); while (it.hasNext()) { Bgk next = it.next(); if (this.f == 0) { next.l.b = this; } else if (this.f == 1) { next.l.ad = this; } } if (this.f == 0 && ((WqU) this.l.S).aq && this.a.size() > 1) { ArrayList arrayList3 = this.a; this.l = arrayList3.get(arrayList3.size() - 1).l; } if (this.f == 0) { i2 = this.l.x; } else { i2 = this.l.W; } this.b = i2; } public final String toString() { StringBuilder sb = new StringBuilder("ChainRun "); sb.append(this.f == 0 ? "horizontal : " : "vertical : "); Iterator it = this.a.iterator(); while (it.hasNext()) { Bgk next = it.next(); sb.append(UrlTreeKt.configurablePathSegmentPrefix); sb.append(next); sb.append("> "); } return sb.toString(); } /* JADX INFO: Access modifiers changed from: package-private */ @Override // o.Bgk public final boolean d() { int size = this.a.size(); for (int i = 0; i < size; i++) { if (!this.a.get(i).d()) { return false; } } return true; } @Override // o.Bgk public final long b() { int size = this.a.size(); long j = 0; for (int i = 0; i < size; i++) { j = j + r4.f8108o.c + this.a.get(i).b() + r4.c.c; } return j; } /* JADX INFO: Access modifiers changed from: package-private */ @Override // o.Bgk public final void e() { this.h = null; Iterator it = this.a.iterator(); while (it.hasNext()) { it.next().e(); } } /* JADX WARN: Code restructure failed: missing block: B:283:0x03bf, code lost: r2 = r2 - r9; */ /* JADX WARN: Code restructure failed: missing block: B:68:0x00c1, code lost: if (r3.e.j != false) goto L56; */ @Override // o.Bgk, o.rZk /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public final void g() { /* Method dump skipped, instructions count: 996 To view this dump add '--comments-level debug' option */ throw new UnsupportedOperationException("Method not decompiled: o.QAm.g():void"); } @Override // o.Bgk public final void c() { for (int i = 0; i < this.a.size(); i++) { this.a.get(i).c(); } } private C17026tNn j() { for (int i = 0; i < this.a.size(); i++) { Bgk bgk = this.a.get(i); if (bgk.l.Z != 8) { return bgk.l; } } return null; } private C17026tNn f() { for (int size = this.a.size() - 1; size >= 0; size--) { Bgk bgk = this.a.get(size); if (bgk.l.Z != 8) { return bgk.l; } } return null; } /* JADX INFO: Access modifiers changed from: package-private */ @Override // o.Bgk public final void a() { Iterator it = this.a.iterator(); while (it.hasNext()) { it.next().a(); } int size = this.a.size(); if (size <= 0) { return; } C17026tNn c17026tNn = this.a.get(0).l; C17026tNn c17026tNn2 = this.a.get(size - 1).l; if (this.f == 0) { C1230Yni c1230Yni = c17026tNn.D; C1230Yni c1230Yni2 = c17026tNn2.X; KMk b = b(c1230Yni, 0); int e = c1230Yni.e(); C17026tNn j = j(); if (j != null) { e = j.D.e(); } if (b != null) { KMk kMk = this.f8108o; kMk.i.add(b); kMk.c = e; b.d.add(kMk); } KMk b2 = b(c1230Yni2, 0); int e2 = c1230Yni2.e(); C17026tNn f = f(); if (f != null) { e2 = f.X.e(); } if (b2 != null) { KMk kMk2 = this.c; kMk2.i.add(b2); kMk2.c = -e2; b2.d.add(kMk2); } } else { C1230Yni c1230Yni3 = c17026tNn.V; C1230Yni c1230Yni4 = c17026tNn2.n; KMk b3 = b(c1230Yni3, 1); int e3 = c1230Yni3.e(); C17026tNn j2 = j(); if (j2 != null) { e3 = j2.V.e(); } if (b3 != null) { KMk kMk3 = this.f8108o; kMk3.i.add(b3); kMk3.c = e3; b3.d.add(kMk3); } KMk b4 = b(c1230Yni4, 1); int e4 = c1230Yni4.e(); C17026tNn f2 = f(); if (f2 != null) { e4 = f2.n.e(); } if (b4 != null) { KMk kMk4 = this.c; kMk4.i.add(b4); kMk4.c = -e4; b4.d.add(kMk4); } } this.f8108o.n = this; this.c.n = this; } }