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

import B.AbstractC0084s;
import B.e1;
import G0.InterfaceC0245a0;
import I0.C0289e;
import I0.C0291f;
import I0.C0293g;
import I0.InterfaceC0295h;
import J4.c;
import J4.e;
import J4.f;
import androidx.compose.runtime.Composable;
import androidx.compose.runtime.ComposableTarget;
import androidx.compose.runtime.ComposablesKt;
import androidx.compose.runtime.Composer;
import androidx.compose.runtime.ComposerKt;
import androidx.compose.runtime.CompositionLocalMap;
import androidx.compose.runtime.Updater;
import com.revenuecat.purchases.paywalls.components.properties.Dimension;
import com.revenuecat.purchases.paywalls.components.properties.Size;
import com.revenuecat.purchases.ui.revenuecatui.components.ComponentViewKt;
import com.revenuecat.purchases.ui.revenuecatui.components.ktx.AlignmentKt;
import com.revenuecat.purchases.ui.revenuecatui.components.modifier.ScrollableKt;
import com.revenuecat.purchases.ui.revenuecatui.components.modifier.SizeKt;
import com.revenuecat.purchases.ui.revenuecatui.components.style.ComponentStyle;
import com.revenuecat.purchases.ui.revenuecatui.data.PaywallState;
import com.revenuecat.purchases.ui.revenuecatui.extensions.ModifierExtensionsKt;
import i0.AbstractC2237a;
import i0.C2252p;
import i0.InterfaceC2242f;
import i0.InterfaceC2255s;
import kotlin.jvm.internal.o;
import kotlin.jvm.internal.p;
import m0.h;
import v.AbstractC3058z;
import v.C3000R0;
import w4.C3137A;
import x.EnumC3207z0;

/* JADX INFO: loaded from: classes3.dex */
public final class StackComponentViewKt$MainStackComponent$stack$1 extends p implements f {
    final /* synthetic */ e $clickHandler;
    final /* synthetic */ float $contentAlpha;
    final /* synthetic */ InterfaceC2255s $modifier;
    final /* synthetic */ e1 $safeDrawingInsets;
    final /* synthetic */ StackComponentState $stackState;
    final /* synthetic */ PaywallState.Loaded.Components $state;

    /* JADX INFO: renamed from: com.revenuecat.purchases.ui.revenuecatui.components.stack.StackComponentViewKt$MainStackComponent$stack$1$1, reason: invalid class name */
    public static final class AnonymousClass1 extends p implements f {
        public static final AnonymousClass1 INSTANCE = new AnonymousClass1();

        public AnonymousClass1() {
            super(3);
        }

        @Override // J4.f
        public final InterfaceC2255s invoke(InterfaceC2255s applyIfNotNull, C3000R0 state, EnumC3207z0 orientation) {
            o.h(applyIfNotNull, "$this$applyIfNotNull");
            o.h(state, "state");
            o.h(orientation, "orientation");
            return ScrollableKt.scrollable(applyIfNotNull, state, orientation);
        }
    }

    /* JADX INFO: renamed from: com.revenuecat.purchases.ui.revenuecatui.components.stack.StackComponentViewKt$MainStackComponent$stack$1$3, reason: invalid class name */
    public static final class AnonymousClass3 extends p implements f {
        public static final AnonymousClass3 INSTANCE = new AnonymousClass3();

        public AnonymousClass3() {
            super(3);
        }

        @Override // J4.f
        public final InterfaceC2255s invoke(InterfaceC2255s applyIfNotNull, C3000R0 state, EnumC3207z0 orientation) {
            o.h(applyIfNotNull, "$this$applyIfNotNull");
            o.h(state, "state");
            o.h(orientation, "orientation");
            return ScrollableKt.scrollable(applyIfNotNull, state, orientation);
        }
    }

    /* JADX INFO: renamed from: com.revenuecat.purchases.ui.revenuecatui.components.stack.StackComponentViewKt$MainStackComponent$stack$1$5, reason: invalid class name */
    public static final class AnonymousClass5 extends p implements f {
        public static final AnonymousClass5 INSTANCE = new AnonymousClass5();

        public AnonymousClass5() {
            super(3);
        }

        @Override // J4.f
        public final InterfaceC2255s invoke(InterfaceC2255s applyIfNotNull, C3000R0 state, EnumC3207z0 orientation) {
            o.h(applyIfNotNull, "$this$applyIfNotNull");
            o.h(state, "state");
            o.h(orientation, "orientation");
            return ScrollableKt.scrollable(applyIfNotNull, state, orientation);
        }
    }

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public StackComponentViewKt$MainStackComponent$stack$1(StackComponentState stackComponentState, InterfaceC2255s interfaceC2255s, PaywallState.Loaded.Components components, e eVar, e1 e1Var, float f6) {
        super(3);
        this.$stackState = stackComponentState;
        this.$modifier = interfaceC2255s;
        this.$state = components;
        this.$clickHandler = eVar;
        this.$safeDrawingInsets = e1Var;
        this.$contentAlpha = f6;
    }

    @Override // J4.f
    public /* bridge */ /* synthetic */ Object invoke(Object obj, Object obj2, Object obj3) {
        invoke((InterfaceC2255s) obj, (Composer) obj2, ((Number) obj3).intValue());
        return C3137A.f25453a;
    }

    @ComposableTarget(applier = "androidx.compose.ui.UiComposable")
    @Composable
    public final void invoke(InterfaceC2255s rootModifier, Composer composer, int i6) {
        Composer composer2 = composer;
        o.h(rootModifier, "rootModifier");
        int i7 = (i6 & 6) == 0 ? i6 | (composer2.changed(rootModifier) ? 4 : 2) : i6;
        if ((i7 & 19) == 18 && composer2.getSkipping()) {
            composer2.skipToGroupEnd();
            return;
        }
        if (ComposerKt.isTraceInProgress()) {
            ComposerKt.traceEventStart(-586909421, i7, -1, "com.revenuecat.purchases.ui.revenuecatui.components.stack.MainStackComponent.<anonymous> (StackComponentView.kt:491)");
        }
        EnumC3207z0 scrollOrientation = this.$stackState.getScrollOrientation();
        composer2.startReplaceGroup(-958142529);
        C3000R0 c3000r0W = scrollOrientation == null ? null : AbstractC3058z.w(composer2);
        composer2.endReplaceGroup();
        if (this.$stackState.getChildren().isEmpty()) {
            composer2.startReplaceGroup(362640510);
            AbstractC0084s.a(SizeKt.size$default(this.$modifier, this.$stackState.getSize(), null, null, 6, null).then(rootModifier), composer2, 0);
            composer2.endReplaceGroup();
        } else {
            composer2.startReplaceGroup(362943752);
            Dimension dimension = this.$stackState.getDimension();
            if (dimension instanceof Dimension.Horizontal) {
                composer2.startReplaceGroup(-958123426);
                Size size = this.$stackState.getSize();
                Dimension.Horizontal horizontal = (Dimension.Horizontal) dimension;
                float fM766getSpacingD9Ej5fM = this.$stackState.m766getSpacingD9Ej5fM();
                InterfaceC2255s interfaceC2255sThen = ModifierExtensionsKt.applyIfNotNull(SizeKt.size$default(this.$modifier, this.$stackState.getSize(), null, AlignmentKt.toAlignment(horizontal.getAlignment()), 2, null), c3000r0W, this.$stackState.getScrollOrientation(), AnonymousClass1.INSTANCE).then(rootModifier);
                composer2.startReplaceGroup(-958106345);
                boolean zChanged = composer2.changed(this.$stackState) | composer2.changed(this.$state) | composer2.changedInstance(this.$clickHandler) | composer2.changed(this.$safeDrawingInsets) | composer2.changed(this.$contentAlpha);
                StackComponentState stackComponentState = this.$stackState;
                PaywallState.Loaded.Components components = this.$state;
                e eVar = this.$clickHandler;
                e1 e1Var = this.$safeDrawingInsets;
                float f6 = this.$contentAlpha;
                Object objRememberedValue = composer2.rememberedValue();
                if (zChanged || objRememberedValue == Composer.Companion.getEmpty()) {
                    objRememberedValue = new StackComponentViewKt$MainStackComponent$stack$1$2$1(stackComponentState, components, eVar, e1Var, f6);
                    composer2.updateRememberedValue(objRememberedValue);
                }
                composer2.endReplaceGroup();
                HorizontalStackKt.m765HorizontalStackTN_CM5M(size, horizontal, fM766getSpacingD9Ej5fM, interfaceC2255sThen, (c) objRememberedValue, composer2, 0, 0);
                composer2.endReplaceGroup();
            } else if (dimension instanceof Dimension.Vertical) {
                composer2.startReplaceGroup(-958079794);
                Size size2 = this.$stackState.getSize();
                Dimension.Vertical vertical = (Dimension.Vertical) dimension;
                float fM766getSpacingD9Ej5fM2 = this.$stackState.m766getSpacingD9Ej5fM();
                InterfaceC2255s interfaceC2255sThen2 = ModifierExtensionsKt.applyIfNotNull(SizeKt.size$default(this.$modifier, this.$stackState.getSize(), AlignmentKt.toAlignment(vertical.getAlignment()), null, 4, null), c3000r0W, this.$stackState.getScrollOrientation(), AnonymousClass3.INSTANCE).then(rootModifier);
                composer2.startReplaceGroup(-958062713);
                boolean zChanged2 = composer2.changed(this.$stackState) | composer2.changed(this.$state) | composer2.changedInstance(this.$clickHandler) | composer2.changed(this.$safeDrawingInsets) | composer2.changed(this.$contentAlpha);
                StackComponentState stackComponentState2 = this.$stackState;
                PaywallState.Loaded.Components components2 = this.$state;
                e eVar2 = this.$clickHandler;
                e1 e1Var2 = this.$safeDrawingInsets;
                float f7 = this.$contentAlpha;
                Object objRememberedValue2 = composer2.rememberedValue();
                if (zChanged2 || objRememberedValue2 == Composer.Companion.getEmpty()) {
                    objRememberedValue2 = new StackComponentViewKt$MainStackComponent$stack$1$4$1(stackComponentState2, components2, eVar2, e1Var2, f7);
                    composer2.updateRememberedValue(objRememberedValue2);
                }
                composer2.endReplaceGroup();
                VerticalStackKt.m771VerticalStackTN_CM5M(size2, vertical, fM766getSpacingD9Ej5fM2, interfaceC2255sThen2, (c) objRememberedValue2, composer2, 0, 0);
                composer2.endReplaceGroup();
            } else if (dimension instanceof Dimension.ZLayer) {
                composer2.startReplaceGroup(-958024193);
                Dimension.ZLayer zLayer = (Dimension.ZLayer) dimension;
                InterfaceC2255s interfaceC2255sThen3 = ModifierExtensionsKt.applyIfNotNull(SizeKt.size(this.$modifier, this.$stackState.getSize(), AlignmentKt.toHorizontalAlignmentOrNull(zLayer.getAlignment()), AlignmentKt.toVerticalAlignmentOrNull(zLayer.getAlignment())), c3000r0W, this.$stackState.getScrollOrientation(), AnonymousClass5.INSTANCE).then(rootModifier);
                InterfaceC2242f alignment = AlignmentKt.toAlignment(zLayer.getAlignment());
                StackComponentState stackComponentState3 = this.$stackState;
                PaywallState.Loaded.Components components3 = this.$state;
                e eVar3 = this.$clickHandler;
                e1 e1Var3 = this.$safeDrawingInsets;
                float f8 = this.$contentAlpha;
                InterfaceC0245a0 interfaceC0245a0D = AbstractC0084s.d(alignment, false);
                int currentCompositeKeyHash = ComposablesKt.getCurrentCompositeKeyHash(composer2, 0);
                CompositionLocalMap currentCompositionLocalMap = composer2.getCurrentCompositionLocalMap();
                InterfaceC2255s interfaceC2255sC = AbstractC2237a.c(composer2, interfaceC2255sThen3);
                InterfaceC0295h.f2384g.getClass();
                C0291f c0291f = C0293g.f2375b;
                if (composer2.getApplier() == null) {
                    ComposablesKt.invalidApplier();
                }
                composer2.startReusableNode();
                if (composer2.getInserting()) {
                    composer2.createNode(c0291f);
                } else {
                    composer2.useNode();
                }
                Composer composerM81constructorimpl = Updater.m81constructorimpl(composer2);
                Updater.m89setimpl(composerM81constructorimpl, interfaceC0245a0D, C0293g.f2379f);
                Updater.m89setimpl(composerM81constructorimpl, currentCompositionLocalMap, C0293g.f2378e);
                C0289e c0289e = C0293g.f2380g;
                if (composerM81constructorimpl.getInserting() || !o.c(composerM81constructorimpl.rememberedValue(), Integer.valueOf(currentCompositeKeyHash))) {
                    Z0.o.u(currentCompositeKeyHash, composerM81constructorimpl, currentCompositeKeyHash, c0289e);
                }
                Updater.m89setimpl(composerM81constructorimpl, interfaceC2255sC, C0293g.f2377d);
                composer2.startReplaceGroup(1797954681);
                for (ComponentStyle componentStyle : stackComponentState3.getChildren()) {
                    C2252p c2252p = C2252p.f18820a;
                    boolean z6 = stackComponentState3.getApplyTopWindowInsets() && !StackComponentViewKt.getShouldIgnoreTopWindowInsets(componentStyle);
                    composer2.startReplaceGroup(193843242);
                    boolean zChanged3 = composer2.changed(e1Var3);
                    Object objRememberedValue3 = composer2.rememberedValue();
                    if (zChanged3 || objRememberedValue3 == Composer.Companion.getEmpty()) {
                        objRememberedValue3 = new StackComponentViewKt$MainStackComponent$stack$1$6$1$1$1(e1Var3);
                        composer2.updateRememberedValue(objRememberedValue3);
                    }
                    composer2.endReplaceGroup();
                    InterfaceC2255s interfaceC2255sA = h.a(ModifierExtensionsKt.conditional(c2252p, z6, (c) objRememberedValue3), f8);
                    PaywallState.Loaded.Components components4 = components3;
                    ComponentViewKt.ComponentView(componentStyle, components4, eVar3, interfaceC2255sA, composer, 0, 0);
                    components3 = components4;
                    composer2 = composer;
                }
                composer2.endReplaceGroup();
                composer2.endNode();
                composer2.endReplaceGroup();
            } else {
                composer2.startReplaceGroup(367323680);
                composer2.endReplaceGroup();
            }
            composer2.endReplaceGroup();
        }
        if (ComposerKt.isTraceInProgress()) {
            ComposerKt.traceEventEnd();
        }
    }
}
