package androidx.compose.foundation.layout;

import c3.s;
import com.google.android.gms.common.api.Api;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import h2.d0;
import h2.f0;
import h2.g0;
import h2.p0;
import j2.b0;
import kotlin.jvm.internal.v;
import l1.i;
import rm.n0;

/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes.dex */
public final class r extends i.c implements b0 {
    private e0.j C;
    private boolean D;
    private dn.p E;

    /* loaded from: classes.dex */
    static final class a extends v implements dn.l {

        /* renamed from: q, reason: collision with root package name */
        final /* synthetic */ int f1883q;

        /* renamed from: r, reason: collision with root package name */
        final /* synthetic */ p0 f1884r;

        /* renamed from: s, reason: collision with root package name */
        final /* synthetic */ int f1885s;

        /* renamed from: t, reason: collision with root package name */
        final /* synthetic */ g0 f1886t;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        a(int i10, p0 p0Var, int i11, g0 g0Var) {
            super(1);
            this.f1883q = i10;
            this.f1884r = p0Var;
            this.f1885s = i11;
            this.f1886t = g0Var;
        }

        public final void a(p0.a aVar) {
            p0.a.j(aVar, this.f1884r, ((c3.n) r.this.h2().invoke(c3.r.b(s.a(this.f1883q - this.f1884r.S0(), this.f1885s - this.f1884r.F0())), this.f1886t.getLayoutDirection())).n(), BitmapDescriptorFactory.HUE_RED, 2, null);
        }

        @Override // dn.l
        public /* bridge */ /* synthetic */ Object invoke(Object obj) {
            a((p0.a) obj);
            return n0.f34904a;
        }
    }

    public r(e0.j jVar, boolean z10, dn.p pVar) {
        this.C = jVar;
        this.D = z10;
        this.E = pVar;
    }

    @Override // j2.b0
    public f0 h(g0 g0Var, d0 d0Var, long j10) {
        int k10;
        int k11;
        e0.j jVar = this.C;
        e0.j jVar2 = e0.j.Vertical;
        int n10 = jVar != jVar2 ? 0 : c3.b.n(j10);
        e0.j jVar3 = this.C;
        e0.j jVar4 = e0.j.Horizontal;
        int m10 = jVar3 == jVar4 ? c3.b.m(j10) : 0;
        e0.j jVar5 = this.C;
        int i10 = Api.BaseClientBuilder.API_PRIORITY_OTHER;
        int l10 = (jVar5 == jVar2 || !this.D) ? c3.b.l(j10) : Integer.MAX_VALUE;
        if (this.C == jVar4 || !this.D) {
            i10 = c3.b.k(j10);
        }
        p0 Y = d0Var.Y(c3.c.a(n10, l10, m10, i10));
        k10 = jn.o.k(Y.S0(), c3.b.n(j10), c3.b.l(j10));
        k11 = jn.o.k(Y.F0(), c3.b.m(j10), c3.b.k(j10));
        return g0.j0(g0Var, k10, k11, null, new a(k10, Y, k11, g0Var), 4, null);
    }

    public final dn.p h2() {
        return this.E;
    }

    public final void i2(dn.p pVar) {
        this.E = pVar;
    }

    public final void j2(e0.j jVar) {
        this.C = jVar;
    }

    public final void k2(boolean z10) {
        this.D = z10;
    }
}
