package o;

import com.google.android.gms.common.api.Api;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* loaded from: classes.dex */
public final class V40 extends LP implements InterfaceC1851mK, P50 {
    public boolean A;
    public Z40 z;

    @Override // o.InterfaceC1851mK
    public final InterfaceC2329rO a(InterfaceC2424sO interfaceC2424sO, InterfaceC1760lO interfaceC1760lO, long j) {
        boolean z = this.A;
        OU ou = OU.l;
        OU ou2 = z ? ou : OU.m;
        int iH = Api.BaseClientBuilder.API_PRIORITY_OTHER;
        if (ou2 == ou) {
            if (C0634Yl.g(j) == Integer.MAX_VALUE) {
                AbstractC2417sH.c("Vertically scrollable component was measured with an infinity maximum height constraints, which is disallowed. One of the common reasons is nesting layouts like LazyColumn and Column(Modifier.verticalScroll()). If you want to add a header before the list of items please add a header as a separate item() before the main items() inside the LazyColumn scope. There could be other reasons for this to happen: your ComposeView was added into a LinearLayout with some weight, you applied Modifier.wrapContentSize(unbounded = true) or wrote a custom layout. Please try to remove the source of infinite constraints in the hierarchy above the scrolling container.");
            }
        } else if (C0634Yl.h(j) == Integer.MAX_VALUE) {
            AbstractC2417sH.c("Horizontally scrollable component was measured with an infinity maximum width constraints, which is disallowed. One of the common reasons is nesting layouts like LazyRow and Row(Modifier.horizontalScroll()). If you want to add a header before the list of items please add a header as a separate item() before the main items() inside the LazyRow scope. There could be other reasons for this to happen: your ComposeView was added into a LinearLayout with some weight, you applied Modifier.wrapContentSize(unbounded = true) or wrote a custom layout. Please try to remove the source of infinite constraints in the hierarchy above the scrolling container.");
        }
        int iG = this.A ? Integer.MAX_VALUE : C0634Yl.g(j);
        if (this.A) {
            iH = C0634Yl.h(j);
        }
        VW vwC = interfaceC1760lO.c(C0634Yl.a(j, 0, iH, 0, iG, 5));
        int i = vwC.l;
        int iH2 = C0634Yl.h(j);
        if (i > iH2) {
            i = iH2;
        }
        int i2 = vwC.m;
        int iG2 = C0634Yl.g(j);
        if (i2 > iG2) {
            i2 = iG2;
        }
        int i3 = vwC.m - i2;
        int i4 = vwC.l - i;
        if (!this.A) {
            i3 = i4;
        }
        Z40 z40 = this.z;
        JV jv = z40.d;
        JV jv2 = z40.a;
        jv.h(i3);
        AbstractC2220q90 abstractC2220q90O = BP.o();
        OC ocE = abstractC2220q90O != null ? abstractC2220q90O.e() : null;
        AbstractC2220q90 abstractC2220q90Q = BP.q(abstractC2220q90O);
        try {
            if (jv2.g() > i3) {
                jv2.h(i3);
            }
            BP.t(abstractC2220q90O, abstractC2220q90Q, ocE);
            this.z.b.h(this.A ? i2 : i);
            return interfaceC2424sO.H(i, i2, C0358Nv.l, new K00(i3, 1, this, vwC));
        } catch (Throwable th) {
            BP.t(abstractC2220q90O, abstractC2220q90Q, ocE);
            throw th;
        }
    }

    @Override // o.InterfaceC1851mK
    public final int b(YM ym, InterfaceC1760lO interfaceC1760lO, int i) {
        if (!this.A) {
            i = Api.BaseClientBuilder.API_PRIORITY_OTHER;
        }
        return interfaceC1760lO.d(i);
    }

    @Override // o.InterfaceC1851mK
    public final int d(YM ym, InterfaceC1760lO interfaceC1760lO, int i) {
        if (this.A) {
            i = Api.BaseClientBuilder.API_PRIORITY_OTHER;
        }
        return interfaceC1760lO.U(i);
    }

    @Override // o.P50
    public final void d0(N50 n50) {
        DJ[] djArr = Y50.a;
        Z50 z50 = W50.m;
        DJ[] djArr2 = Y50.a;
        DJ dj = djArr2[6];
        z50.a(n50, Boolean.TRUE);
        O40 o40 = new O40(new U40(this, 0), new U40(this, 1));
        if (this.A) {
            Z50 z502 = W50.u;
            DJ dj2 = djArr2[12];
            z502.a(n50, o40);
        } else {
            Z50 z503 = W50.t;
            DJ dj3 = djArr2[11];
            z503.a(n50, o40);
        }
    }

    @Override // o.InterfaceC1851mK
    public final int h(YM ym, InterfaceC1760lO interfaceC1760lO, int i) {
        if (!this.A) {
            i = Api.BaseClientBuilder.API_PRIORITY_OTHER;
        }
        return interfaceC1760lO.V(i);
    }

    @Override // o.InterfaceC1851mK
    public final int i(YM ym, InterfaceC1760lO interfaceC1760lO, int i) {
        if (this.A) {
            i = Api.BaseClientBuilder.API_PRIORITY_OTHER;
        }
        return interfaceC1760lO.O(i);
    }
}
