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

import A0.a;
import A4.d;
import A4.k;
import B.AbstractC0057e;
import B.J0;
import C4.j;
import E3.v;
import G0.InterfaceC0245a0;
import G0.InterfaceC0247b0;
import G0.InterfaceC0249c0;
import G0.InterfaceC0274t;
import G0.Z;
import G0.p0;
import G0.q0;
import I0.C0289e;
import I0.C0293g;
import I0.InterfaceC0295h;
import J0.AbstractC0391w0;
import J4.c;
import J4.e;
import V4.C;
import a0.W0;
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.CompositionScopedCoroutineScopeCanceller;
import androidx.compose.runtime.EffectsKt;
import androidx.compose.runtime.MutableState;
import androidx.compose.runtime.RecomposeScopeImplKt;
import androidx.compose.runtime.ScopeUpdateScope;
import androidx.compose.runtime.SnapshotStateKt;
import androidx.compose.runtime.SnapshotStateKt__SnapshotStateKt;
import androidx.compose.runtime.State;
import androidx.compose.runtime.Updater;
import androidx.compose.runtime.internal.ComposableLambdaKt;
import androidx.media3.exoplayer.RendererCapabilities;
import com.revenuecat.purchases.paywalls.components.CountdownComponent;
import com.revenuecat.purchases.paywalls.components.properties.CornerRadiuses;
import com.revenuecat.purchases.paywalls.components.properties.Dimension;
import com.revenuecat.purchases.paywalls.components.properties.FlexDistribution;
import com.revenuecat.purchases.paywalls.components.properties.HorizontalAlignment;
import com.revenuecat.purchases.paywalls.components.properties.Padding;
import com.revenuecat.purchases.paywalls.components.properties.Shape;
import com.revenuecat.purchases.paywalls.components.properties.Size;
import com.revenuecat.purchases.paywalls.components.properties.SizeConstraint;
import com.revenuecat.purchases.ui.revenuecatui.components.PaywallAction;
import com.revenuecat.purchases.ui.revenuecatui.components.PreviewHelpersKt;
import com.revenuecat.purchases.ui.revenuecatui.components.TransitionViewKt;
import com.revenuecat.purchases.ui.revenuecatui.components.properties.BackgroundStyles;
import com.revenuecat.purchases.ui.revenuecatui.components.properties.BorderStyles;
import com.revenuecat.purchases.ui.revenuecatui.components.properties.ColorStyle;
import com.revenuecat.purchases.ui.revenuecatui.components.properties.ColorStyleKt;
import com.revenuecat.purchases.ui.revenuecatui.components.properties.ColorStyles;
import com.revenuecat.purchases.ui.revenuecatui.components.properties.ShadowStyles;
import com.revenuecat.purchases.ui.revenuecatui.components.stack.StackComponentStateKt;
import com.revenuecat.purchases.ui.revenuecatui.components.stack.StackComponentViewKt;
import com.revenuecat.purchases.ui.revenuecatui.components.style.ButtonComponentStyle;
import com.revenuecat.purchases.ui.revenuecatui.components.style.StackComponentStyle;
import com.revenuecat.purchases.ui.revenuecatui.data.PaywallState;
import h1.b;
import h1.f;
import h1.m;
import i0.AbstractC2237a;
import i0.C2252p;
import i0.InterfaceC2255s;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import kotlin.jvm.internal.o;
import kotlin.jvm.internal.p;
import m0.h;
import m3.AbstractC2467b;
import n2.AbstractC2612c;
import p0.C2714u;
import q.AbstractC2777h;
import v.AbstractC3058z;
import w4.C3137A;
import x4.AbstractC3251q;
import x4.AbstractC3253s;
import x4.y;
import x4.z;

/* JADX INFO: loaded from: classes3.dex */
public final /* synthetic */ class ButtonComponentViewKt {
    private static final float ALPHA_DISABLED = 0.6f;
    private static final float BRIGHTNESS_CUTOFF = 0.6f;
    private static final float COEFFICIENT_LUMINANCE_BLUE = 0.114f;
    private static final float COEFFICIENT_LUMINANCE_GREEN = 0.587f;
    private static final float COEFFICIENT_LUMINANCE_RED = 0.299f;

    /* JADX INFO: renamed from: com.revenuecat.purchases.ui.revenuecatui.components.button.ButtonComponentViewKt$ButtonComponentView$1, reason: invalid class name */
    public static final class AnonymousClass1 extends p implements e {
        final /* synthetic */ int $$changed;
        final /* synthetic */ int $$default;
        final /* synthetic */ InterfaceC2255s $modifier;
        final /* synthetic */ e $onClick;
        final /* synthetic */ PaywallState.Loaded.Components $state;
        final /* synthetic */ ButtonComponentStyle $style;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public AnonymousClass1(ButtonComponentStyle buttonComponentStyle, PaywallState.Loaded.Components components, e eVar, InterfaceC2255s interfaceC2255s, int i6, int i7) {
            super(2);
            this.$style = buttonComponentStyle;
            this.$state = components;
            this.$onClick = eVar;
            this.$modifier = interfaceC2255s;
            this.$$changed = i6;
            this.$$default = i7;
        }

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

        public final void invoke(Composer composer, int i6) {
            ButtonComponentViewKt.ButtonComponentView(this.$style, this.$state, this.$onClick, this.$modifier, composer, RecomposeScopeImplKt.updateChangedFlags(this.$$changed | 1), this.$$default);
        }
    }

    /* JADX INFO: renamed from: com.revenuecat.purchases.ui.revenuecatui.components.button.ButtonComponentViewKt$ButtonComponentView$2, reason: invalid class name */
    public static final class AnonymousClass2 extends p implements e {
        final /* synthetic */ InterfaceC2255s $modifier;
        final /* synthetic */ e $onClick;
        final /* synthetic */ PaywallState.Loaded.Components $state;
        final /* synthetic */ ButtonComponentStyle $style;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public AnonymousClass2(ButtonComponentStyle buttonComponentStyle, PaywallState.Loaded.Components components, InterfaceC2255s interfaceC2255s, e eVar) {
            super(2);
            this.$style = buttonComponentStyle;
            this.$state = components;
            this.$modifier = interfaceC2255s;
            this.$onClick = eVar;
        }

        /* JADX INFO: Access modifiers changed from: private */
        public static final boolean invoke$lambda$2(MutableState<Boolean> mutableState) {
            return mutableState.getValue().booleanValue();
        }

        /* JADX INFO: Access modifiers changed from: private */
        public static final void invoke$lambda$3(MutableState<Boolean> mutableState, boolean z6) {
            mutableState.setValue(Boolean.valueOf(z6));
        }

        private static final float invoke$lambda$5(State<Float> state) {
            return state.getValue().floatValue();
        }

        private static final float invoke$lambda$7(State<Float> state) {
            return state.getValue().floatValue();
        }

        private static final float invoke$lambda$8(State<Float> state) {
            return state.getValue().floatValue();
        }

        private static final float invoke$lambda$9(State<Float> state) {
            return state.getValue().floatValue();
        }

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

        @ComposableTarget(applier = "androidx.compose.ui.UiComposable")
        @Composable
        public final void invoke(Composer composer, int i6) {
            boolean z6;
            Object buttonComponentViewKt$ButtonComponentView$2$2$1;
            InterfaceC2255s interfaceC2255s;
            if ((i6 & 3) == 2 && composer.getSkipping()) {
                composer.skipToGroupEnd();
                return;
            }
            if (ComposerKt.isTraceInProgress()) {
                ComposerKt.traceEventStart(-17542715, i6, -1, "com.revenuecat.purchases.ui.revenuecatui.components.button.ButtonComponentView.<anonymous> (ButtonComponentView.kt:85)");
            }
            ButtonComponentState buttonComponentStateRememberButtonComponentState = ButtonComponentStateKt.rememberButtonComponentState(this.$style, this.$state, composer, 0);
            Object objRememberedValue = composer.rememberedValue();
            Composer.Companion companion = Composer.Companion;
            if (objRememberedValue == companion.getEmpty()) {
                Object compositionScopedCoroutineScopeCanceller = new CompositionScopedCoroutineScopeCanceller(EffectsKt.createCompositionCoroutineScope(k.f106a, composer));
                composer.updateRememberedValue(compositionScopedCoroutineScopeCanceller);
                objRememberedValue = compositionScopedCoroutineScopeCanceller;
            }
            C coroutineScope = ((CompositionScopedCoroutineScopeCanceller) objRememberedValue).getCoroutineScope();
            PaywallState.Loaded.Components components = this.$state;
            composer.startReplaceGroup(-1790179292);
            Object objRememberedValue2 = composer.rememberedValue();
            if (objRememberedValue2 == companion.getEmpty()) {
                objRememberedValue2 = SnapshotStateKt__SnapshotStateKt.mutableStateOf$default(Boolean.FALSE, null, 2, null);
                composer.updateRememberedValue(objRememberedValue2);
            }
            MutableState mutableState = (MutableState) objRememberedValue2;
            Object objJ = a.j(composer, -1790177179);
            if (objJ == companion.getEmpty()) {
                objJ = SnapshotStateKt.derivedStateOf(new ButtonComponentViewKt$ButtonComponentView$2$contentAlpha$2$1(mutableState, components));
                composer.updateRememberedValue(objJ);
            }
            State state = (State) objJ;
            Object objJ2 = a.j(composer, -1790172092);
            if (objJ2 == companion.getEmpty()) {
                objJ2 = SnapshotStateKt.derivedStateOf(new ButtonComponentViewKt$ButtonComponentView$2$progressAlpha$2$1(mutableState));
                composer.updateRememberedValue(objJ2);
            }
            composer.endReplaceGroup();
            State stateB = AbstractC2777h.b(invoke$lambda$5(state), null, null, null, composer, 0, 30);
            State stateB2 = AbstractC2777h.b(invoke$lambda$7((State) objJ2), null, null, null, composer, 0, 30);
            m mVar = (m) composer.consume(AbstractC0391w0.f3105n);
            Object margin = this.$style.getStackComponentStyle().getMargin();
            composer.startReplaceGroup(-1790161765);
            boolean zChanged = composer.changed(margin);
            ButtonComponentStyle buttonComponentStyle = this.$style;
            Object objRememberedValue3 = composer.rememberedValue();
            if (zChanged || objRememberedValue3 == companion.getEmpty()) {
                objRememberedValue3 = new f(buttonComponentStyle.getStackComponentStyle().getMargin().c());
                composer.updateRememberedValue(objRememberedValue3);
            }
            final float f6 = ((f) objRememberedValue3).f16618a;
            composer.endReplaceGroup();
            Object margin2 = this.$style.getStackComponentStyle().getMargin();
            composer.startReplaceGroup(-1790156994);
            boolean zChanged2 = composer.changed(margin2);
            ButtonComponentStyle buttonComponentStyle2 = this.$style;
            Object objRememberedValue4 = composer.rememberedValue();
            if (zChanged2 || objRememberedValue4 == companion.getEmpty()) {
                objRememberedValue4 = new f(buttonComponentStyle2.getStackComponentStyle().getMargin().a());
                composer.updateRememberedValue(objRememberedValue4);
            }
            final float f7 = ((f) objRememberedValue4).f16618a;
            composer.endReplaceGroup();
            Object margin3 = this.$style.getStackComponentStyle().getMargin();
            composer.startReplaceGroup(-1790152131);
            boolean zChanged3 = composer.changed(margin3) | composer.changed(mVar);
            ButtonComponentStyle buttonComponentStyle3 = this.$style;
            Object objRememberedValue5 = composer.rememberedValue();
            if (zChanged3 || objRememberedValue5 == companion.getEmpty()) {
                objRememberedValue5 = new f(AbstractC0057e.m(buttonComponentStyle3.getStackComponentStyle().getMargin(), mVar));
                composer.updateRememberedValue(objRememberedValue5);
            }
            final float f8 = ((f) objRememberedValue5).f16618a;
            composer.endReplaceGroup();
            Object margin4 = this.$style.getStackComponentStyle().getMargin();
            composer.startReplaceGroup(-1790146373);
            boolean zChanged4 = composer.changed(margin4) | composer.changed(mVar);
            ButtonComponentStyle buttonComponentStyle4 = this.$style;
            Object objRememberedValue6 = composer.rememberedValue();
            if (zChanged4 || objRememberedValue6 == companion.getEmpty()) {
                objRememberedValue6 = new f(AbstractC0057e.l(buttonComponentStyle4.getStackComponentStyle().getMargin(), mVar));
                composer.updateRememberedValue(objRememberedValue6);
            }
            final float f9 = ((f) objRememberedValue6).f16618a;
            composer.endReplaceGroup();
            ButtonComponentStyle buttonComponentStyle5 = this.$style;
            PaywallState.Loaded.Components components2 = this.$state;
            InterfaceC2255s interfaceC2255s2 = this.$modifier;
            boolean z7 = !components.getActionInProgress();
            composer.startReplaceGroup(-1790105339);
            boolean zChangedInstance = composer.changedInstance(this.$onClick) | composer.changed(this.$state) | composer.changedInstance(coroutineScope) | composer.changed(buttonComponentStateRememberButtonComponentState);
            PaywallState.Loaded.Components components3 = this.$state;
            e eVar = this.$onClick;
            Object objRememberedValue7 = composer.rememberedValue();
            if (zChangedInstance || objRememberedValue7 == companion.getEmpty()) {
                z6 = z7;
                interfaceC2255s = interfaceC2255s2;
                buttonComponentViewKt$ButtonComponentView$2$2$1 = new ButtonComponentViewKt$ButtonComponentView$2$2$1(components3, coroutineScope, mutableState, eVar, buttonComponentStateRememberButtonComponentState);
                composer.updateRememberedValue(buttonComponentViewKt$ButtonComponentView$2$2$1);
            } else {
                buttonComponentViewKt$ButtonComponentView$2$2$1 = objRememberedValue7;
                z6 = z7;
                interfaceC2255s = interfaceC2255s2;
            }
            composer.endReplaceGroup();
            InterfaceC2255s interfaceC2255sN = AbstractC3058z.n(6, (J4.a) buttonComponentViewKt$ButtonComponentView$2$2$1, interfaceC2255s, z6);
            composer.startReplaceGroup(-1790092426);
            boolean zChanged5 = composer.changed(f8) | composer.changed(f9) | composer.changed(f6) | composer.changed(f7);
            Object objRememberedValue8 = composer.rememberedValue();
            if (zChanged5 || objRememberedValue8 == companion.getEmpty()) {
                objRememberedValue8 = new InterfaceC0245a0() { // from class: com.revenuecat.purchases.ui.revenuecatui.components.button.ButtonComponentViewKt$ButtonComponentView$2$3$1

                    /* JADX INFO: renamed from: com.revenuecat.purchases.ui.revenuecatui.components.button.ButtonComponentViewKt$ButtonComponentView$2$3$1$1, reason: invalid class name */
                    public static final class AnonymousClass1 extends p implements c {
                        final /* synthetic */ float $marginStartPx;
                        final /* synthetic */ float $marginTopPx;
                        final /* synthetic */ q0 $progress;
                        final /* synthetic */ q0 $stack;
                        final /* synthetic */ float $stackHeightMinusMargin;
                        final /* synthetic */ float $stackWidthMinusMargin;

                        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
                        public AnonymousClass1(q0 q0Var, q0 q0Var2, float f6, float f7, float f8, float f9) {
                            super(1);
                            this.$stack = q0Var;
                            this.$progress = q0Var2;
                            this.$marginStartPx = f6;
                            this.$stackWidthMinusMargin = f7;
                            this.$marginTopPx = f8;
                            this.$stackHeightMinusMargin = f9;
                        }

                        @Override // J4.c
                        public /* bridge */ /* synthetic */ Object invoke(Object obj) {
                            invoke((p0) obj);
                            return C3137A.f25453a;
                        }

                        public final void invoke(p0 layout) {
                            o.h(layout, "$this$layout");
                            p0.r(layout, this.$stack, 0, 0);
                            p0.r(layout, this.$progress, L4.a.d0((this.$stackWidthMinusMargin / 2.0f) - (r0.f1998a / 2.0f)) + ((int) this.$marginStartPx), L4.a.d0((this.$stackHeightMinusMargin / 2.0f) - (this.$progress.f1999b / 2.0f)) + ((int) this.$marginTopPx));
                        }
                    }

                    @Override // G0.InterfaceC0245a0
                    public /* bridge */ /* synthetic */ int maxIntrinsicHeight(InterfaceC0274t interfaceC0274t, List list, int i7) {
                        return super.maxIntrinsicHeight(interfaceC0274t, list, i7);
                    }

                    @Override // G0.InterfaceC0245a0
                    public /* bridge */ /* synthetic */ int maxIntrinsicWidth(InterfaceC0274t interfaceC0274t, List list, int i7) {
                        return super.maxIntrinsicWidth(interfaceC0274t, list, i7);
                    }

                    @Override // G0.InterfaceC0245a0
                    /* JADX INFO: renamed from: measure-3p2s80s */
                    public final InterfaceC0247b0 mo1measure3p2s80s(InterfaceC0249c0 Layout, List<? extends Z> measurables, long j4) {
                        o.h(Layout, "$this$Layout");
                        o.h(measurables, "measurables");
                        q0 q0VarQ = measurables.get(0).Q(j4);
                        float fY = Layout.Y(f8);
                        float fY2 = Layout.Y(f9);
                        float fY3 = Layout.Y(f6);
                        float fY4 = Layout.Y(f7);
                        int iProgressSize = ButtonComponentViewKt.progressSize(Layout, q0VarQ.f1998a, q0VarQ.f1999b, fY, fY2, fY3, fY4);
                        q0 q0VarQ2 = measurables.get(1).Q(b.a(iProgressSize, iProgressSize, iProgressSize, iProgressSize));
                        int i7 = q0VarQ.f1998a;
                        int i8 = q0VarQ.f1999b;
                        return Layout.e(i7, i8, z.f26066a, new AnonymousClass1(q0VarQ, q0VarQ2, fY, (i7 - fY) - fY2, fY3, (i8 - fY3) - fY4));
                    }

                    @Override // G0.InterfaceC0245a0
                    public /* bridge */ /* synthetic */ int minIntrinsicHeight(InterfaceC0274t interfaceC0274t, List list, int i7) {
                        return super.minIntrinsicHeight(interfaceC0274t, list, i7);
                    }

                    @Override // G0.InterfaceC0245a0
                    public /* bridge */ /* synthetic */ int minIntrinsicWidth(InterfaceC0274t interfaceC0274t, List list, int i7) {
                        return super.minIntrinsicWidth(interfaceC0274t, list, i7);
                    }
                };
                composer.updateRememberedValue(objRememberedValue8);
            }
            InterfaceC0245a0 interfaceC0245a0 = (InterfaceC0245a0) objRememberedValue8;
            composer.endReplaceGroup();
            int currentCompositeKeyHash = ComposablesKt.getCurrentCompositeKeyHash(composer, 0);
            CompositionLocalMap currentCompositionLocalMap = composer.getCurrentCompositionLocalMap();
            InterfaceC2255s interfaceC2255sC = AbstractC2237a.c(composer, interfaceC2255sN);
            InterfaceC0295h.f2384g.getClass();
            J4.a aVar = C0293g.f2375b;
            if (composer.getApplier() == null) {
                ComposablesKt.invalidApplier();
            }
            composer.startReusableNode();
            if (composer.getInserting()) {
                composer.createNode(aVar);
            } else {
                composer.useNode();
            }
            Composer composerM81constructorimpl = Updater.m81constructorimpl(composer);
            Updater.m89setimpl(composerM81constructorimpl, interfaceC0245a0, 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);
            StackComponentViewKt.StackComponentView(buttonComponentStyle5.getStackComponentStyle(), components2, new ButtonComponentViewKt$ButtonComponentView$2$1$1(null), null, invoke$lambda$8(stateB), composer, RendererCapabilities.DECODER_SUPPORT_MASK, 8);
            W0.b(h.a(C2252p.f18820a, invoke$lambda$9(stateB2)), ButtonComponentViewKt.progressColorFor(buttonComponentStyle5.getStackComponentStyle().getBackground(), composer, 0), 0.0f, 0L, 0, composer, 0, 28);
            composer.endNode();
            if (ComposerKt.isTraceInProgress()) {
                ComposerKt.traceEventEnd();
            }
        }
    }

    /* JADX INFO: renamed from: com.revenuecat.purchases.ui.revenuecatui.components.button.ButtonComponentViewKt$ButtonComponentView$3, reason: invalid class name */
    public static final class AnonymousClass3 extends p implements e {
        final /* synthetic */ int $$changed;
        final /* synthetic */ int $$default;
        final /* synthetic */ InterfaceC2255s $modifier;
        final /* synthetic */ e $onClick;
        final /* synthetic */ PaywallState.Loaded.Components $state;
        final /* synthetic */ ButtonComponentStyle $style;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public AnonymousClass3(ButtonComponentStyle buttonComponentStyle, PaywallState.Loaded.Components components, e eVar, InterfaceC2255s interfaceC2255s, int i6, int i7) {
            super(2);
            this.$style = buttonComponentStyle;
            this.$state = components;
            this.$onClick = eVar;
            this.$modifier = interfaceC2255s;
            this.$$changed = i6;
            this.$$default = i7;
        }

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

        public final void invoke(Composer composer, int i6) {
            ButtonComponentViewKt.ButtonComponentView(this.$style, this.$state, this.$onClick, this.$modifier, composer, RecomposeScopeImplKt.updateChangedFlags(this.$$changed | 1), this.$$default);
        }
    }

    /* JADX INFO: renamed from: com.revenuecat.purchases.ui.revenuecatui.components.button.ButtonComponentViewKt$ButtonComponentView_Preview_Default$1, reason: invalid class name and case insensitive filesystem */
    @C4.e(c = "com.revenuecat.purchases.ui.revenuecatui.components.button.ButtonComponentViewKt$ButtonComponentView_Preview_Default$1", f = "ButtonComponentView.kt", l = {}, m = "invokeSuspend")
    public static final class C14691 extends j implements e {
        int label;

        public C14691(d dVar) {
            super(2, dVar);
        }

        @Override // C4.a
        public final d create(Object obj, d dVar) {
            return new C14691(dVar);
        }

        @Override // J4.e
        public final Object invoke(PaywallAction paywallAction, d dVar) {
            return ((C14691) create(paywallAction, dVar)).invokeSuspend(C3137A.f25453a);
        }

        @Override // C4.a
        public final Object invokeSuspend(Object obj) {
            B4.a aVar = B4.a.f492a;
            if (this.label != 0) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            AbstractC2467b.l(obj);
            return C3137A.f25453a;
        }
    }

    /* JADX INFO: renamed from: com.revenuecat.purchases.ui.revenuecatui.components.button.ButtonComponentViewKt$ButtonComponentView_Preview_Default$2, reason: invalid class name and case insensitive filesystem */
    public static final class C14702 extends p implements e {
        final /* synthetic */ int $$changed;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public C14702(int i6) {
            super(2);
            this.$$changed = i6;
        }

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

        public final void invoke(Composer composer, int i6) {
            ButtonComponentViewKt.ButtonComponentView_Preview_Default(composer, RecomposeScopeImplKt.updateChangedFlags(this.$$changed | 1));
        }
    }

    /* JADX INFO: renamed from: com.revenuecat.purchases.ui.revenuecatui.components.button.ButtonComponentViewKt$ButtonComponentView_Preview_Narrow$1, reason: invalid class name and case insensitive filesystem */
    @C4.e(c = "com.revenuecat.purchases.ui.revenuecatui.components.button.ButtonComponentViewKt$ButtonComponentView_Preview_Narrow$1", f = "ButtonComponentView.kt", l = {}, m = "invokeSuspend")
    public static final class C14711 extends j implements e {
        int label;

        public C14711(d dVar) {
            super(2, dVar);
        }

        @Override // C4.a
        public final d create(Object obj, d dVar) {
            return new C14711(dVar);
        }

        @Override // J4.e
        public final Object invoke(PaywallAction paywallAction, d dVar) {
            return ((C14711) create(paywallAction, dVar)).invokeSuspend(C3137A.f25453a);
        }

        @Override // C4.a
        public final Object invokeSuspend(Object obj) {
            B4.a aVar = B4.a.f492a;
            if (this.label != 0) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            AbstractC2467b.l(obj);
            return C3137A.f25453a;
        }
    }

    /* JADX INFO: renamed from: com.revenuecat.purchases.ui.revenuecatui.components.button.ButtonComponentViewKt$ButtonComponentView_Preview_Narrow$2, reason: invalid class name and case insensitive filesystem */
    public static final class C14722 extends p implements e {
        final /* synthetic */ int $$changed;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public C14722(int i6) {
            super(2);
            this.$$changed = i6;
        }

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

        public final void invoke(Composer composer, int i6) {
            ButtonComponentViewKt.ButtonComponentView_Preview_Narrow(composer, RecomposeScopeImplKt.updateChangedFlags(this.$$changed | 1));
        }
    }

    @ComposableTarget(applier = "androidx.compose.ui.UiComposable")
    @Composable
    public static final void ButtonComponentView(ButtonComponentStyle style, PaywallState.Loaded.Components state, e onClick, InterfaceC2255s interfaceC2255s, Composer composer, int i6, int i7) {
        int i8;
        InterfaceC2255s interfaceC2255s2;
        o.h(style, "style");
        o.h(state, "state");
        o.h(onClick, "onClick");
        Composer composerStartRestartGroup = composer.startRestartGroup(-1096165859);
        if ((i7 & 1) != 0) {
            i8 = i6 | 6;
        } else if ((i6 & 6) == 0) {
            i8 = (composerStartRestartGroup.changed(style) ? 4 : 2) | i6;
        } else {
            i8 = i6;
        }
        if ((i7 & 2) != 0) {
            i8 |= 48;
        } else if ((i6 & 48) == 0) {
            i8 |= composerStartRestartGroup.changed(state) ? 32 : 16;
        }
        if ((i7 & 4) != 0) {
            i8 |= RendererCapabilities.DECODER_SUPPORT_MASK;
        } else if ((i6 & RendererCapabilities.DECODER_SUPPORT_MASK) == 0) {
            i8 |= composerStartRestartGroup.changedInstance(onClick) ? 256 : 128;
        }
        int i9 = i7 & 8;
        if (i9 != 0) {
            i8 |= 3072;
        } else if ((i6 & 3072) == 0) {
            i8 |= composerStartRestartGroup.changed(interfaceC2255s) ? 2048 : 1024;
        }
        if ((i8 & 1171) == 1170 && composerStartRestartGroup.getSkipping()) {
            composerStartRestartGroup.skipToGroupEnd();
            interfaceC2255s2 = interfaceC2255s;
        } else {
            if (i9 != 0) {
                interfaceC2255s = C2252p.f18820a;
            }
            interfaceC2255s2 = interfaceC2255s;
            if (ComposerKt.isTraceInProgress()) {
                ComposerKt.traceEventStart(-1096165859, i8, -1, "com.revenuecat.purchases.ui.revenuecatui.components.button.ButtonComponentView (ButtonComponentView.kt:74)");
            }
            if (!StackComponentStateKt.rememberUpdatedStackComponentState(style.getStackComponentStyle(), state, composerStartRestartGroup, i8 & 112).getVisible()) {
                if (ComposerKt.isTraceInProgress()) {
                    ComposerKt.traceEventEnd();
                }
                ScopeUpdateScope scopeUpdateScopeEndRestartGroup = composerStartRestartGroup.endRestartGroup();
                if (scopeUpdateScopeEndRestartGroup != null) {
                    scopeUpdateScopeEndRestartGroup.updateScope(new AnonymousClass1(style, state, onClick, interfaceC2255s2, i6, i7));
                    return;
                }
                return;
            }
            TransitionViewKt.TransitionView(style.getTransition(), ComposableLambdaKt.rememberComposableLambda(-17542715, true, new AnonymousClass2(style, state, interfaceC2255s2, onClick), composerStartRestartGroup, 54), composerStartRestartGroup, 48);
            if (ComposerKt.isTraceInProgress()) {
                ComposerKt.traceEventEnd();
            }
        }
        ScopeUpdateScope scopeUpdateScopeEndRestartGroup2 = composerStartRestartGroup.endRestartGroup();
        if (scopeUpdateScopeEndRestartGroup2 != null) {
            scopeUpdateScopeEndRestartGroup2.updateScope(new AnonymousClass3(style, state, onClick, interfaceC2255s2, i6, i7));
        }
    }

    /* JADX INFO: Access modifiers changed from: private */
    @ComposableTarget(applier = "androidx.compose.ui.UiComposable")
    @Composable
    public static final void ButtonComponentView_Preview_Default(Composer composer, int i6) {
        Composer composerStartRestartGroup = composer.startRestartGroup(-291258808);
        if (i6 == 0 && composerStartRestartGroup.getSkipping()) {
            composerStartRestartGroup.skipToGroupEnd();
        } else {
            if (ComposerKt.isTraceInProgress()) {
                ComposerKt.traceEventStart(-291258808, i6, -1, "com.revenuecat.purchases.ui.revenuecatui.components.button.ButtonComponentView_Preview_Default (ButtonComponentView.kt:240)");
            }
            ButtonComponentView(previewButtonComponentStyle(null, null, composerStartRestartGroup, 0, 3), PreviewHelpersKt.previewEmptyState(null, composerStartRestartGroup, 0, 1), new C14691(null), null, composerStartRestartGroup, RendererCapabilities.DECODER_SUPPORT_MASK, 8);
            if (ComposerKt.isTraceInProgress()) {
                ComposerKt.traceEventEnd();
            }
        }
        ScopeUpdateScope scopeUpdateScopeEndRestartGroup = composerStartRestartGroup.endRestartGroup();
        if (scopeUpdateScopeEndRestartGroup != null) {
            scopeUpdateScopeEndRestartGroup.updateScope(new C14702(i6));
        }
    }

    /* JADX INFO: Access modifiers changed from: private */
    @ComposableTarget(applier = "androidx.compose.ui.UiComposable")
    @Composable
    public static final void ButtonComponentView_Preview_Narrow(Composer composer, int i6) {
        Composer composerStartRestartGroup = composer.startRestartGroup(1236087174);
        if (i6 == 0 && composerStartRestartGroup.getSkipping()) {
            composerStartRestartGroup.skipToGroupEnd();
        } else {
            if (ComposerKt.isTraceInProgress()) {
                ComposerKt.traceEventStart(1236087174, i6, -1, "com.revenuecat.purchases.ui.revenuecatui.components.button.ButtonComponentView_Preview_Narrow (ButtonComponentView.kt:246)");
            }
            int i7 = C2714u.f22946n;
            ButtonComponentView(previewButtonComponentStyle(PreviewHelpersKt.m657previewStackComponentStyle7SJwSw$default(AbstractC2612c.q(PreviewHelpersKt.previewTextComponentStyle$default("Restore purchases", null, 0, null, null, null, null, new ColorStyles(ColorStyle.Solid.m732boximpl(ColorStyle.Solid.m733constructorimpl(C2714u.f22943j)), null, 2, null), false, null, null, null, null, null, null, null, 65406, null)), null, false, null, 0.0f, null, null, null, null, null, null, null, null, null, null, 32766, null), null, composerStartRestartGroup, 0, 2), PreviewHelpersKt.previewEmptyState(null, composerStartRestartGroup, 0, 1), new C14711(null), null, composerStartRestartGroup, RendererCapabilities.DECODER_SUPPORT_MASK, 8);
            if (ComposerKt.isTraceInProgress()) {
                ComposerKt.traceEventEnd();
            }
        }
        ScopeUpdateScope scopeUpdateScopeEndRestartGroup = composerStartRestartGroup.endRestartGroup();
        if (scopeUpdateScopeEndRestartGroup != null) {
            scopeUpdateScopeEndRestartGroup.updateScope(new C14722(i6));
        }
    }

    /* JADX INFO: renamed from: getBrightness-8_81llA, reason: not valid java name */
    private static final float m662getBrightness8_81llA(long j4) {
        return (C2714u.f(j4) * COEFFICIENT_LUMINANCE_BLUE) + (C2714u.h(j4) * COEFFICIENT_LUMINANCE_GREEN) + (C2714u.i(j4) * COEFFICIENT_LUMINANCE_RED);
    }

    @Composable
    private static final ButtonComponentStyle previewButtonComponentStyle(StackComponentStyle stackComponentStyle, ButtonComponentStyle.Action action, Composer composer, int i6, int i7) {
        StackComponentStyle stackComponentStyle2;
        composer.startReplaceGroup(-1733277159);
        if ((i7 & 1) != 0) {
            ColorStyles colorStyles = new ColorStyles(ColorStyle.Solid.m732boximpl(ColorStyle.Solid.m733constructorimpl(C2714u.f22943j)), null, 2, null);
            SizeConstraint.Fit fit = SizeConstraint.Fit.INSTANCE;
            float f6 = 16;
            stackComponentStyle2 = new StackComponentStyle(AbstractC2612c.q(PreviewHelpersKt.previewTextComponentStyle$default("Restore purchases", null, 0, null, null, null, null, colorStyles, false, new Size(fit, fit), new Padding(8.0d, 8.0d, 8.0d, 8.0d), new Padding(0.0d, 24.0d, 0.0d, 24.0d), null, null, null, null, 61822, null)), new Dimension.Vertical(HorizontalAlignment.CENTER, FlexDistribution.START), true, new Size(fit, fit), f6, BackgroundStyles.Color.m710boximpl(BackgroundStyles.Color.m711constructorimpl(new ColorStyles(ColorStyle.Solid.m732boximpl(ColorStyle.Solid.m733constructorimpl(C2714u.f22940g)), null, 2, null))), new J0(f6, f6, f6, f6), new J0(f6, f6, f6, f6), new Shape.Rectangle(new CornerRadiuses.Dp(20.0d)), new BorderStyles(2, new ColorStyles(ColorStyle.Solid.m732boximpl(ColorStyle.Solid.m733constructorimpl(C2714u.f22942i)), null, 2, null), null), new ShadowStyles(new ColorStyles(ColorStyle.Solid.m732boximpl(ColorStyle.Solid.m733constructorimpl(C2714u.f22935b)), null, 2, null), 10, 0, 3, null), null, null, null, null, null, null, null, CountdownComponent.CountFrom.DAYS, y.f26065a, false, false, false, 7421952, null);
        } else {
            stackComponentStyle2 = stackComponentStyle;
        }
        ButtonComponentStyle.Action action2 = (i7 & 2) != 0 ? ButtonComponentStyle.Action.RestorePurchases.INSTANCE : action;
        if (ComposerKt.isTraceInProgress()) {
            ComposerKt.traceEventStart(-1733277159, i6, -1, "com.revenuecat.purchases.ui.revenuecatui.components.button.previewButtonComponentStyle (ButtonComponentView.kt:299)");
        }
        ButtonComponentStyle buttonComponentStyle = new ButtonComponentStyle(stackComponentStyle2, action2, null, 4, null);
        if (ComposerKt.isTraceInProgress()) {
            ComposerKt.traceEventEnd();
        }
        composer.endReplaceGroup();
        return buttonComponentStyle;
    }

    /* JADX INFO: Access modifiers changed from: private */
    @Composable
    public static final long progressColorFor(BackgroundStyles backgroundStyles, Composer composer, int i6) {
        long jProgressColorFor;
        composer.startReplaceGroup(-1216934903);
        if (ComposerKt.isTraceInProgress()) {
            ComposerKt.traceEventStart(-1216934903, i6, -1, "com.revenuecat.purchases.ui.revenuecatui.components.button.progressColorFor (ButtonComponentView.kt:214)");
        }
        composer.startReplaceGroup(-1003117124);
        if (backgroundStyles == null) {
            long j4 = AbstractC3058z.v(composer) ? C2714u.f22939f : C2714u.f22935b;
            composer.endReplaceGroup();
            if (ComposerKt.isTraceInProgress()) {
                ComposerKt.traceEventEnd();
            }
            composer.endReplaceGroup();
            return j4;
        }
        composer.endReplaceGroup();
        if (backgroundStyles instanceof BackgroundStyles.Color) {
            jProgressColorFor = progressColorFor(ColorStyleKt.getForCurrentTheme(((BackgroundStyles.Color) backgroundStyles).m716unboximpl(), composer, 0));
        } else {
            if (!(backgroundStyles instanceof BackgroundStyles.Image) && !(backgroundStyles instanceof BackgroundStyles.Video)) {
                throw new v();
            }
            jProgressColorFor = C2714u.f22939f;
        }
        if (ComposerKt.isTraceInProgress()) {
            ComposerKt.traceEventEnd();
        }
        composer.endReplaceGroup();
        return jProgressColorFor;
    }

    /* JADX INFO: Access modifiers changed from: private */
    /* JADX WARN: Removed duplicated region for block: B:4:0x001a A[PHI: r4
      0x001a: PHI (r4v4 int) = (r4v1 int), (r4v2 int) binds: [B:3:0x0018, B:10:0x0030] A[DONT_GENERATE, DONT_INLINE]] */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public static final int progressSize(h1.c cVar, int i6, int i7, float f6, float f7, float f8, float f9) {
        float f10;
        float f11;
        float fN = cVar.N(Math.min((i6 - f6) - f7, (i7 - f8) - f9));
        int i8 = 16;
        if (f.b(fN, 32) < 0) {
            if (f.b(fN, 24) >= 0) {
                f10 = 16;
            } else {
                i8 = 8;
                if (f.b(fN, 16) >= 0) {
                    f11 = i8;
                } else {
                    f10 = 8;
                    if (f.b(fN, f10) < 0) {
                        f11 = 0;
                    }
                }
            }
            f11 = fN - f10;
        }
        return cVar.g0(L4.a.u(fN - f11, 0, 38));
    }

    private static final long progressColorFor(ColorStyle colorStyle) {
        if (colorStyle instanceof ColorStyle.Solid) {
            if (m662getBrightness8_81llA(((ColorStyle.Solid) colorStyle).m739unboximpl()) > 0.6f) {
                return C2714u.f22935b;
            }
            return C2714u.f22939f;
        }
        if (colorStyle instanceof ColorStyle.Gradient) {
            List colors$revenuecatui_defaultsBc8Release = ((ColorStyle.Gradient) colorStyle).m731unboximpl().getColors$revenuecatui_defaultsBc8Release();
            ArrayList arrayList = new ArrayList(AbstractC3253s.G(colors$revenuecatui_defaultsBc8Release, 10));
            Iterator it = colors$revenuecatui_defaultsBc8Release.iterator();
            while (it.hasNext()) {
                arrayList.add(Float.valueOf(m662getBrightness8_81llA(((C2714u) it.next()).f22947a)));
            }
            if (AbstractC3251q.X(arrayList) > 0.6000000238418579d) {
                return C2714u.f22935b;
            }
            return C2714u.f22939f;
        }
        throw new v();
    }
}
