package com.sistemasolton.itranvias.home.presentation.stopdetail;

import androidx.compose.foundation.layout.RowScope;
import androidx.compose.material.icons.Icons;
import androidx.compose.material.icons.filled.StarKt;
import androidx.compose.material.icons.outlined.StarBorderKt;
import androidx.compose.material3.IconButtonKt;
import androidx.compose.material3.IconKt;
import androidx.compose.runtime.Composer;
import androidx.compose.runtime.ComposerKt;
import androidx.compose.runtime.MutableState;
import androidx.compose.runtime.internal.ComposableLambdaKt;
import androidx.compose.ui.Modifier;
import androidx.compose.ui.semantics.SemanticsModifierKt;
import androidx.compose.ui.semantics.SemanticsPropertiesKt;
import androidx.compose.ui.semantics.SemanticsPropertyReceiver;
import androidx.profileinstaller.ProfileVerifier;
import com.sistemasolton.itranvias.home.data.remote.dto.detalleparadadto.DetalleParadaDto;
import com.sistemasolton.itranvias.home.data.remote.dto.infodto.InfoDto;
import com.sistemasolton.itranvias.home.data.remote.dto.infodto.ParadaDto;
import com.sistemasolton.itranvias.ui.theme.ColorKt;
import itranvias.composeapp.generated.resources.Res;
import itranvias.composeapp.generated.resources.String0_commonMainKt;
import java.util.Iterator;
import java.util.List;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.functions.Function3;
import kotlin.jvm.internal.Intrinsics;
import org.jetbrains.compose.resources.StringResourcesKt;

/* JADX INFO: compiled from: StopDetailScreen.kt */
/* JADX INFO: loaded from: classes2.dex */
@Metadata(k = 3, mv = {2, 1, 0}, xi = 48)
final class StopDetailScreenKt$StopDetailScreen$3$1$3 implements Function3<RowScope, Composer, Integer, Unit> {
    final /* synthetic */ DetalleParadaDto $detalle;
    final /* synthetic */ InfoDto $infoDto;
    final /* synthetic */ MutableState<Boolean> $showAliasDialog$delegate;
    final /* synthetic */ StopDetailState $state;
    final /* synthetic */ StopDetailViewModel $viewModel;

    StopDetailScreenKt$StopDetailScreen$3$1$3(InfoDto infoDto, StopDetailState stopDetailState, StopDetailViewModel stopDetailViewModel, DetalleParadaDto detalleParadaDto, MutableState<Boolean> mutableState) {
        this.$infoDto = infoDto;
        this.$state = stopDetailState;
        this.$viewModel = stopDetailViewModel;
        this.$detalle = detalleParadaDto;
        this.$showAliasDialog$delegate = mutableState;
    }

    @Override // kotlin.jvm.functions.Function3
    public /* bridge */ /* synthetic */ Unit invoke(RowScope rowScope, Composer composer, Integer num) {
        invoke(rowScope, composer, num.intValue());
        return Unit.INSTANCE;
    }

    public final void invoke(RowScope TopAppBar, Composer composer, int i) {
        Object next;
        Intrinsics.checkNotNullParameter(TopAppBar, "$this$TopAppBar");
        if ((i & 17) == 16 && composer.getSkipping()) {
            composer.skipToGroupEnd();
            return;
        }
        if (ComposerKt.isTraceInProgress()) {
            ComposerKt.traceEventStart(107072461, i, -1, "com.sistemasolton.itranvias.home.presentation.stopdetail.StopDetailScreen.<anonymous>.<anonymous>.<anonymous> (StopDetailScreen.kt:154)");
        }
        List<ParadaDto> paradas = this.$infoDto.getITranvias().getActualizacion().getParadas();
        DetalleParadaDto detalleParadaDto = this.$detalle;
        Iterator<T> it = paradas.iterator();
        while (true) {
            if (!it.hasNext()) {
                next = null;
                break;
            } else {
                next = it.next();
                if (((ParadaDto) next).getId() == detalleParadaDto.getBuses().getParada()) {
                    break;
                }
            }
        }
        ParadaDto paradaDto = (ParadaDto) next;
        final String nombre = paradaDto != null ? paradaDto.getNombre() : null;
        composer.startReplaceGroup(-182578180);
        if (nombre == null) {
            nombre = StringResourcesKt.stringResource(String0_commonMainKt.getStop_detail_title(Res.string.INSTANCE), composer, 0);
        }
        composer.endReplaceGroup();
        composer.startReplaceGroup(-1746271574);
        boolean zChangedInstance = composer.changedInstance(this.$state) | composer.changedInstance(this.$viewModel);
        final StopDetailState stopDetailState = this.$state;
        final StopDetailViewModel stopDetailViewModel = this.$viewModel;
        final MutableState<Boolean> mutableState = this.$showAliasDialog$delegate;
        Object objRememberedValue = composer.rememberedValue();
        if (zChangedInstance || objRememberedValue == Composer.INSTANCE.getEmpty()) {
            objRememberedValue = new Function0() { // from class: com.sistemasolton.itranvias.home.presentation.stopdetail.StopDetailScreenKt$StopDetailScreen$3$1$3$$ExternalSyntheticLambda0
                @Override // kotlin.jvm.functions.Function0
                public final Object invoke() {
                    return StopDetailScreenKt$StopDetailScreen$3$1$3.invoke$lambda$2$lambda$1(stopDetailState, stopDetailViewModel, mutableState);
                }
            };
            composer.updateRememberedValue(objRememberedValue);
        }
        Function0 function0 = (Function0) objRememberedValue;
        composer.endReplaceGroup();
        Modifier.Companion companion = Modifier.INSTANCE;
        composer.startReplaceGroup(-1633490746);
        boolean zChangedInstance2 = composer.changedInstance(this.$state) | composer.changed(nombre);
        final StopDetailState stopDetailState2 = this.$state;
        Object objRememberedValue2 = composer.rememberedValue();
        if (zChangedInstance2 || objRememberedValue2 == Composer.INSTANCE.getEmpty()) {
            objRememberedValue2 = new Function1() { // from class: com.sistemasolton.itranvias.home.presentation.stopdetail.StopDetailScreenKt$StopDetailScreen$3$1$3$$ExternalSyntheticLambda1
                @Override // kotlin.jvm.functions.Function1
                public final Object invoke(Object obj) {
                    return StopDetailScreenKt$StopDetailScreen$3$1$3.invoke$lambda$4$lambda$3(stopDetailState2, nombre, (SemanticsPropertyReceiver) obj);
                }
            };
            composer.updateRememberedValue(objRememberedValue2);
        }
        composer.endReplaceGroup();
        Modifier modifierSemantics$default = SemanticsModifierKt.semantics$default(companion, false, (Function1) objRememberedValue2, 1, null);
        final StopDetailState stopDetailState3 = this.$state;
        IconButtonKt.IconButton(function0, modifierSemantics$default, false, null, null, ComposableLambdaKt.rememberComposableLambda(-665819184, true, new Function2<Composer, Integer, Unit>() { // from class: com.sistemasolton.itranvias.home.presentation.stopdetail.StopDetailScreenKt$StopDetailScreen$3$1$3.3
            @Override // kotlin.jvm.functions.Function2
            public /* bridge */ /* synthetic */ Unit invoke(Composer composer2, Integer num) {
                invoke(composer2, num.intValue());
                return Unit.INSTANCE;
            }

            public final void invoke(Composer composer2, int i2) {
                if ((i2 & 3) == 2 && composer2.getSkipping()) {
                    composer2.skipToGroupEnd();
                    return;
                }
                if (ComposerKt.isTraceInProgress()) {
                    ComposerKt.traceEventStart(-665819184, i2, -1, "com.sistemasolton.itranvias.home.presentation.stopdetail.StopDetailScreen.<anonymous>.<anonymous>.<anonymous>.<anonymous> (StopDetailScreen.kt:178)");
                }
                IconKt.m2260Iconww6aTOc(stopDetailState3.isFavorite() ? StarKt.getStar(Icons.Filled.INSTANCE) : StarBorderKt.getStarBorder(Icons.Outlined.INSTANCE), (String) null, (Modifier) null, ColorKt.getWhiteTranvias(), composer2, 3120, 4);
                if (ComposerKt.isTraceInProgress()) {
                    ComposerKt.traceEventEnd();
                }
            }
        }, composer, 54), composer, ProfileVerifier.CompilationStatus.RESULT_CODE_ERROR_CANT_WRITE_PROFILE_VERIFICATION_RESULT_CACHE_FILE, 28);
        if (ComposerKt.isTraceInProgress()) {
            ComposerKt.traceEventEnd();
        }
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final Unit invoke$lambda$2$lambda$1(StopDetailState stopDetailState, StopDetailViewModel stopDetailViewModel, MutableState mutableState) {
        if (!stopDetailState.isFavorite()) {
            StopDetailScreenKt.StopDetailScreen$lambda$5(mutableState, true);
        } else {
            StopDetailViewModel.toggleFavorite$default(stopDetailViewModel, null, 1, null);
        }
        return Unit.INSTANCE;
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final Unit invoke$lambda$4$lambda$3(StopDetailState stopDetailState, String str, SemanticsPropertyReceiver semantics) {
        String str2;
        Intrinsics.checkNotNullParameter(semantics, "$this$semantics");
        if (stopDetailState.isFavorite()) {
            str2 = "Eliminar parada " + str + " de favoritos";
        } else {
            str2 = "Agregar parada " + str + " a favoritos";
        }
        SemanticsPropertiesKt.setContentDescription(semantics, str2);
        SemanticsPropertiesKt.setStateDescription(semantics, stopDetailState.isFavorite() ? "Marcado como favorito" : "No marcado como favorito");
        return Unit.INSTANCE;
    }
}