package o;

import com.google.android.gms.common.api.Api;
import java.util.List;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.z30, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class C3062z30 implements InterfaceC2235qO, InterfaceC2777w30 {
    public final Z8 a;
    public final C0133Fd b;

    public C3062z30(Z8 z8, C0133Fd c0133Fd) {
        this.a = z8;
        this.b = c0133Fd;
    }

    @Override // o.InterfaceC2235qO
    public final InterfaceC2329rO a(InterfaceC2424sO interfaceC2424sO, List list, long j) {
        return AbstractC1692kh0.G(this, C0634Yl.j(j), C0634Yl.i(j), C0634Yl.h(j), C0634Yl.g(j), interfaceC2424sO.N(this.a.a()), interfaceC2424sO, list, new VW[list.size()], list.size());
    }

    @Override // o.InterfaceC2777w30
    public final int b(VW vw) {
        return vw.m;
    }

    @Override // o.InterfaceC2235qO
    public final int c(InterfaceC2608uI interfaceC2608uI, List list, int i) {
        int iN = interfaceC2608uI.N(this.a.a());
        if (list.isEmpty()) {
            return 0;
        }
        int iMin = Math.min((list.size() - 1) * iN, i);
        int size = list.size();
        int iMax = 0;
        float f = 0.0f;
        for (int i2 = 0; i2 < size; i2++) {
            InterfaceC1760lO interfaceC1760lO = (InterfaceC1760lO) list.get(i2);
            float fC = C80.C(C80.z(interfaceC1760lO));
            if (fC == 0.0f) {
                int iMin2 = Math.min(interfaceC1760lO.U(Api.BaseClientBuilder.API_PRIORITY_OTHER), i == Integer.MAX_VALUE ? Integer.MAX_VALUE : i - iMin);
                iMin += iMin2;
                iMax = Math.max(iMax, interfaceC1760lO.d(iMin2));
            } else if (fC > 0.0f) {
                f += fC;
            }
        }
        int iRound = f == 0.0f ? 0 : i == Integer.MAX_VALUE ? Integer.MAX_VALUE : Math.round(Math.max(i - iMin, 0) / f);
        int size2 = list.size();
        for (int i3 = 0; i3 < size2; i3++) {
            InterfaceC1760lO interfaceC1760lO2 = (InterfaceC1760lO) list.get(i3);
            float fC2 = C80.C(C80.z(interfaceC1760lO2));
            if (fC2 > 0.0f) {
                iMax = Math.max(iMax, interfaceC1760lO2.d(iRound != Integer.MAX_VALUE ? Math.round(iRound * fC2) : Integer.MAX_VALUE));
            }
        }
        return iMax;
    }

    @Override // o.InterfaceC2777w30
    public final long d(int i, int i2, int i3, boolean z) {
        return !z ? AbstractC0842bm.a(i, i2, 0, i3) : Co0.t(i, i2, 0, i3);
    }

    @Override // o.InterfaceC2777w30
    public final InterfaceC2329rO e(VW[] vwArr, InterfaceC2424sO interfaceC2424sO, int[] iArr, int i, int i2) {
        return interfaceC2424sO.H(i, i2, C0358Nv.l, new C2110p2(vwArr, this, i2, iArr));
    }

    public final boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (!(obj instanceof C3062z30)) {
            return false;
        }
        C3062z30 c3062z30 = (C3062z30) obj;
        return F3.c(this.a, c3062z30.a) && F3.c(this.b, c3062z30.b);
    }

    @Override // o.InterfaceC2777w30
    public final int f(VW vw) {
        return vw.l;
    }

    @Override // o.InterfaceC2235qO
    public final int g(InterfaceC2608uI interfaceC2608uI, List list, int i) {
        int iN = interfaceC2608uI.N(this.a.a());
        if (list.isEmpty()) {
            return 0;
        }
        int iMin = Math.min((list.size() - 1) * iN, i);
        int size = list.size();
        int iMax = 0;
        float f = 0.0f;
        for (int i2 = 0; i2 < size; i2++) {
            InterfaceC1760lO interfaceC1760lO = (InterfaceC1760lO) list.get(i2);
            float fC = C80.C(C80.z(interfaceC1760lO));
            if (fC == 0.0f) {
                int iMin2 = Math.min(interfaceC1760lO.U(Api.BaseClientBuilder.API_PRIORITY_OTHER), i == Integer.MAX_VALUE ? Integer.MAX_VALUE : i - iMin);
                iMin += iMin2;
                iMax = Math.max(iMax, interfaceC1760lO.V(iMin2));
            } else if (fC > 0.0f) {
                f += fC;
            }
        }
        int iRound = f == 0.0f ? 0 : i == Integer.MAX_VALUE ? Integer.MAX_VALUE : Math.round(Math.max(i - iMin, 0) / f);
        int size2 = list.size();
        for (int i3 = 0; i3 < size2; i3++) {
            InterfaceC1760lO interfaceC1760lO2 = (InterfaceC1760lO) list.get(i3);
            float fC2 = C80.C(C80.z(interfaceC1760lO2));
            if (fC2 > 0.0f) {
                iMax = Math.max(iMax, interfaceC1760lO2.V(iRound != Integer.MAX_VALUE ? Math.round(iRound * fC2) : Integer.MAX_VALUE));
            }
        }
        return iMax;
    }

    @Override // o.InterfaceC2777w30
    public final void h(int i, InterfaceC2424sO interfaceC2424sO, int[] iArr, int[] iArr2) {
        this.a.g(interfaceC2424sO, i, iArr, interfaceC2424sO.getLayoutDirection(), iArr2);
    }

    public final int hashCode() {
        return this.b.hashCode() + (this.a.hashCode() * 31);
    }

    @Override // o.InterfaceC2235qO
    public final int i(InterfaceC2608uI interfaceC2608uI, List list, int i) {
        int iN = interfaceC2608uI.N(this.a.a());
        if (list.isEmpty()) {
            return 0;
        }
        int size = list.size();
        int iMax = 0;
        int i2 = 0;
        float f = 0.0f;
        for (int i3 = 0; i3 < size; i3++) {
            InterfaceC1760lO interfaceC1760lO = (InterfaceC1760lO) list.get(i3);
            float fC = C80.C(C80.z(interfaceC1760lO));
            int iO = interfaceC1760lO.O(i);
            if (fC == 0.0f) {
                i2 += iO;
            } else if (fC > 0.0f) {
                f += fC;
                iMax = Math.max(iMax, Math.round(iO / fC));
            }
        }
        return ((list.size() - 1) * iN) + Math.round(iMax * f) + i2;
    }

    @Override // o.InterfaceC2235qO
    public final int j(InterfaceC2608uI interfaceC2608uI, List list, int i) {
        int iN = interfaceC2608uI.N(this.a.a());
        if (list.isEmpty()) {
            return 0;
        }
        int size = list.size();
        int iMax = 0;
        int i2 = 0;
        float f = 0.0f;
        for (int i3 = 0; i3 < size; i3++) {
            InterfaceC1760lO interfaceC1760lO = (InterfaceC1760lO) list.get(i3);
            float fC = C80.C(C80.z(interfaceC1760lO));
            int iU = interfaceC1760lO.U(i);
            if (fC == 0.0f) {
                i2 += iU;
            } else if (fC > 0.0f) {
                f += fC;
                iMax = Math.max(iMax, Math.round(iU / fC));
            }
        }
        return ((list.size() - 1) * iN) + Math.round(iMax * f) + i2;
    }

    public final String toString() {
        return "RowMeasurePolicy(horizontalArrangement=" + this.a + ", verticalAlignment=" + this.b + ')';
    }
}
