package o; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import java.util.ArrayList; import java.util.Collections; import java.util.List; import o.C16381npu; /* loaded from: classes2.dex */ public final class WiE { public final List a; public final float[] b; public final C16381npu c; public final float d; public final float e; public final float[] h; public final List i; public WiE(C16381npu c16381npu, List list, List list2) { this.c = c16381npu; this.a = Collections.unmodifiableList(list); this.i = Collections.unmodifiableList(list2); float f = list.get(list.size() - 1).c.get(0).c - c16381npu.c.get(0).c; this.e = f; List list3 = c16381npu.c; float f2 = list3.get(list3.size() - 1).c; List list4 = list2.get(list2.size() - 1).c; float f3 = f2 - list4.get(list4.size() - 1).c; this.d = f3; this.b = e(f, list, true); this.h = e(f3, list2, false); } public static C16381npu a(List list, float f, float[] fArr) { int size = list.size(); float f2 = fArr[0]; int i = 1; while (i < size) { float f3 = fArr[i]; if (f <= f3) { float b = C6217cMa.b(BitmapDescriptorFactory.HUE_RED, 1.0f, f2, f3, f); C16381npu c16381npu = list.get(i - 1); C16381npu c16381npu2 = list.get(i); if (c16381npu.b != c16381npu2.b) { throw new IllegalArgumentException("Keylines being linearly interpolated must have the same item size."); } List list2 = c16381npu.c; List list3 = c16381npu2.c; if (list2.size() != list3.size()) { throw new IllegalArgumentException("Keylines being linearly interpolated must have the same number of keylines."); } ArrayList arrayList = new ArrayList(); for (int i2 = 0; i2 < c16381npu.c.size(); i2++) { C16381npu.LWm lWm = list2.get(i2); C16381npu.LWm lWm2 = list3.get(i2); float f4 = lWm.c; float f5 = f4 + ((lWm2.c - f4) * b); float f6 = lWm.a; float f7 = f6 + ((lWm2.a - f6) * b); float f8 = lWm.e; float f9 = f8 + ((lWm2.e - f8) * b); float f10 = lWm.d; arrayList.add(new C16381npu.LWm(f5, f7, f9, f10 + ((lWm2.d - f10) * b))); } return new C16381npu(c16381npu.b, arrayList, c16381npu.d + Math.round((c16381npu2.d - r0) * b), c16381npu.a + Math.round(b * (c16381npu2.a - r1))); } i++; f2 = f3; } return list.get(0); } private static float[] e(float f, List list, boolean z) { float f2; int size = list.size(); float[] fArr = new float[size]; int i = 1; while (i < size) { int i2 = i - 1; C16381npu c16381npu = list.get(i2); C16381npu c16381npu2 = list.get(i); if (z) { f2 = c16381npu2.c.get(0).c - c16381npu.c.get(0).c; } else { List list2 = c16381npu.c; float f3 = list2.get(list2.size() - 1).c; List list3 = c16381npu2.c; f2 = f3 - list3.get(list3.size() - 1).c; } fArr[i] = i == size + (-1) ? 1.0f : fArr[i2] + (f2 / f); i++; } return fArr; } public static List d(C16381npu c16381npu) { int i; ArrayList arrayList = new ArrayList(); arrayList.add(c16381npu); int i2 = 0; while (true) { if (i2 >= c16381npu.c.size()) { i2 = -1; break; } if (c16381npu.c.get(i2).a >= BitmapDescriptorFactory.HUE_RED) { break; } i2++; } if (c16381npu.c.get(c16381npu.d).a - (c16381npu.c.get(c16381npu.d).d / 2.0f) > BitmapDescriptorFactory.HUE_RED && c16381npu.c.get(c16381npu.d) != c16381npu.c.get(0) && i2 != -1) { int i3 = c16381npu.d; float f = c16381npu.c.get(0).a; float f2 = c16381npu.c.get(0).d / 2.0f; for (int i4 = 0; i4 <= (i3 - 1) - i2; i4++) { C16381npu c16381npu2 = (C16381npu) arrayList.get(arrayList.size() - 1); int size = c16381npu.c.size() - 1; int i5 = (i2 + i4) - 1; if (i5 >= 0) { float f3 = c16381npu.c.get(i5).e; int i6 = c16381npu2.a; while (true) { if (i6 >= c16381npu2.c.size()) { i6 = c16381npu2.c.size() - 1; break; } if (f3 == c16381npu2.c.get(i6).e) { break; } i6++; } i = i6 - 1; } else { i = size; } arrayList.add(d(c16381npu2, i2, i, f - f2, (c16381npu.d - i4) - 1, (c16381npu.a - i4) - 1)); } } return arrayList; } public static List d(InterfaceC0312Dxl interfaceC0312Dxl, C16381npu c16381npu) { int i; ArrayList arrayList = new ArrayList(); arrayList.add(c16381npu); int size = c16381npu.c.size(); while (true) { size--; if (size < 0) { size = -1; break; } if (c16381npu.c.get(size).a <= interfaceC0312Dxl.a()) { break; } } if (c16381npu.c.get(c16381npu.a).a + (c16381npu.c.get(c16381npu.a).d / 2.0f) < interfaceC0312Dxl.a()) { if (c16381npu.c.get(c16381npu.a) != c16381npu.c.get(r3.size() - 1) && size != -1) { int i2 = c16381npu.a; float f = c16381npu.c.get(0).a; float f2 = c16381npu.c.get(0).d / 2.0f; for (int i3 = 0; i3 < size - i2; i3++) { C16381npu c16381npu2 = (C16381npu) arrayList.get(arrayList.size() - 1); int i4 = (size - i3) + 1; if (i4 < c16381npu.c.size()) { float f3 = c16381npu.c.get(i4).e; int i5 = c16381npu2.d - 1; while (true) { if (i5 < 0) { i5 = 0; break; } if (f3 == c16381npu2.c.get(i5).e) { break; } i5--; } i = i5 + 1; } else { i = 0; } arrayList.add(d(c16381npu2, size, i, f - f2, c16381npu.d + i3 + 1, c16381npu.a + i3 + 1)); } } } return arrayList; } private static C16381npu d(C16381npu c16381npu, int i, int i2, float f, int i3, int i4) { ArrayList arrayList = new ArrayList(c16381npu.c); arrayList.add(i2, (C16381npu.LWm) arrayList.remove(i)); C16381npu.RVV rvv = new C16381npu.RVV(c16381npu.b); int i5 = 0; while (i5 < arrayList.size()) { C16381npu.LWm lWm = (C16381npu.LWm) arrayList.get(i5); rvv.b((lWm.d / 2.0f) + f, lWm.e, lWm.d, i5 >= i3 && i5 <= i4); f += lWm.d; i5++; } return rvv.c(); } }