package com.revenuecat.purchases.ui.revenuecatui.components.image;

import E3.v;
import J4.a;
import com.revenuecat.purchases.paywalls.components.properties.Size;
import com.revenuecat.purchases.paywalls.components.properties.SizeConstraint;
import com.revenuecat.purchases.ui.revenuecatui.components.modifier.AspectRatio;
import kotlin.jvm.internal.p;
import n2.AbstractC2612c;

/* JADX INFO: loaded from: classes3.dex */
public final class ImageComponentState$aspectRatio$2 extends p implements a {
    final /* synthetic */ ImageComponentState this$0;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public ImageComponentState$aspectRatio$2(ImageComponentState imageComponentState) {
        super(0);
        this.this$0 = imageComponentState;
    }

    @Override // J4.a
    public final AspectRatio invoke() {
        Size size = this.this$0.getSize();
        ImageComponentState imageComponentState = this.this$0;
        SizeConstraint height = size.getHeight();
        if (height instanceof SizeConstraint.Fit) {
            SizeConstraint width = size.getWidth();
            if (!(width instanceof SizeConstraint.Fit) && !(width instanceof SizeConstraint.Fill)) {
                if (width instanceof SizeConstraint.Fixed) {
                    return null;
                }
                throw new v();
            }
            return new AspectRatio(imageComponentState.getImageAspectRatio(), true);
        }
        if (height instanceof SizeConstraint.Fill) {
            SizeConstraint width2 = size.getWidth();
            if (width2 instanceof SizeConstraint.Fit) {
                return new AspectRatio(imageComponentState.getImageAspectRatio(), false);
            }
            if ((width2 instanceof SizeConstraint.Fill) || (width2 instanceof SizeConstraint.Fixed)) {
                return null;
            }
            throw new v();
        }
        if (!(height instanceof SizeConstraint.Fixed)) {
            throw new v();
        }
        SizeConstraint width3 = size.getWidth();
        if ((width3 instanceof SizeConstraint.Fit) || (width3 instanceof SizeConstraint.Fill)) {
            return null;
        }
        if (width3 instanceof SizeConstraint.Fixed) {
            return new AspectRatio(((float) AbstractC2612c.u(((SizeConstraint.Fixed) width3).m621getValuepVg5ArA())) / ((float) AbstractC2612c.u(((SizeConstraint.Fixed) height).m621getValuepVg5ArA())), true);
        }
        throw new v();
    }
}
