package com.sistemasolton.itranvias;

import android.app.PendingIntent;
import android.content.Intent;
import android.content.IntentFilter;
import android.nfc.NfcAdapter;
import android.nfc.Tag;
import android.os.Bundle;
import androidx.activity.ComponentActivity;
import androidx.activity.EdgeToEdge;
import androidx.activity.compose.ComponentActivityKt;
import androidx.compose.runtime.Composer;
import androidx.compose.runtime.ComposerKt;
import androidx.compose.runtime.CompositionLocalKt;
import androidx.compose.runtime.MutableState;
import androidx.compose.runtime.ProvidableCompositionLocal;
import androidx.compose.runtime.ProvidedValue;
import androidx.compose.runtime.SnapshotStateKt__SnapshotStateKt;
import androidx.compose.runtime.internal.ComposableLambdaKt;
import androidx.compose.ui.platform.CompositionLocalsKt;
import androidx.compose.ui.unit.Density;
import androidx.compose.ui.unit.DensityKt;
import androidx.sqlite.driver.bundled.BundledSQLite;
import com.google.android.gms.common.internal.BaseGmsClient;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlinx.coroutines.BuildersKt__Builders_commonKt;
import kotlinx.coroutines.CoroutineScopeKt;
import kotlinx.coroutines.Dispatchers;

/* JADX INFO: compiled from: MainActivity.kt */
/* JADX INFO: loaded from: classes2.dex */
@Metadata(d1 = {"\u0000V\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0011\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\b\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0002\b\u0007\u0018\u00002\u00020\u0001:\u0001\"B\u0007¢\u0006\u0004\b\u0002\u0010\u0003J\u0012\u0010\u0014\u001a\u00020\u00152\b\u0010\u0016\u001a\u0004\u0018\u00010\u0017H\u0014J\u0006\u0010\u0018\u001a\u00020\u0015J\u0006\u0010\u0019\u001a\u00020\u0015J\b\u0010\u001a\u001a\u00020\u0015H\u0014J\b\u0010\u001b\u001a\u00020\u0015H\u0014J\u0010\u0010\u001f\u001a\u00020\u00152\u0006\u0010 \u001a\u00020!H\u0014R\u001c\u0010\u0004\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010\u00060\u0005X\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0007\u0010\bR\u001c\u0010\t\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010\n0\u0005X\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u000b\u0010\bR\u0010\u0010\f\u001a\u0004\u0018\u00010\rX\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\u000e\u001a\u0004\u0018\u00010\u000fX\u0082\u000e¢\u0006\u0002\n\u0000R\u0018\u0010\u0010\u001a\n\u0012\u0004\u0012\u00020\u0012\u0018\u00010\u0011X\u0082\u000e¢\u0006\u0004\n\u0002\u0010\u0013R\u001a\u0010\u001c\u001a\b\u0012\u0004\u0012\u00020\u001d0\u0005X\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u001e\u0010\b¨\u0006#"}, d2 = {"Lcom/sistemasolton/itranvias/MainActivity;", "Landroidx/activity/ComponentActivity;", "<init>", "()V", "cardDataState", "Landroidx/compose/runtime/MutableState;", "Lcom/sistemasolton/itranvias/MainActivity$CardData;", "getCardDataState$composeApp_release", "()Landroidx/compose/runtime/MutableState;", "nfcTagState", "", "getNfcTagState$composeApp_release", "nfcAdapter", "Landroid/nfc/NfcAdapter;", BaseGmsClient.KEY_PENDING_INTENT, "Landroid/app/PendingIntent;", "intentFilters", "", "Landroid/content/IntentFilter;", "[Landroid/content/IntentFilter;", "onCreate", "", "savedInstanceState", "Landroid/os/Bundle;", "enableNfcDispatch", "disableNfcDispatch", "onResume", "onPause", "readingTrigger", "", "getReadingTrigger$composeApp_release", "onNewIntent", "intent", "Landroid/content/Intent;", "CardData", "composeApp_release"}, k = 1, mv = {2, 1, 0}, xi = 48)
public final class MainActivity extends ComponentActivity {
    public static final int $stable = 8;
    private IntentFilter[] intentFilters;
    private NfcAdapter nfcAdapter;
    private PendingIntent pendingIntent;
    private final MutableState<CardData> cardDataState = SnapshotStateKt__SnapshotStateKt.mutableStateOf$default(null, null, 2, null);
    private final MutableState<String> nfcTagState = SnapshotStateKt__SnapshotStateKt.mutableStateOf$default(null, null, 2, null);
    private final MutableState<Integer> readingTrigger = SnapshotStateKt__SnapshotStateKt.mutableStateOf$default(0, null, 2, null);

    /* JADX INFO: compiled from: MainActivity.kt */
    @Metadata(d1 = {"\u0000(\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\u0006\n\u0002\b\u000f\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0002\b\u0087\b\u0018\u00002\u00020\u0001B'\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\n\b\u0002\u0010\u0004\u001a\u0004\u0018\u00010\u0005\u0012\n\b\u0002\u0010\u0006\u001a\u0004\u0018\u00010\u0003¢\u0006\u0004\b\u0007\u0010\bJ\t\u0010\u000f\u001a\u00020\u0003HÆ\u0003J\u0010\u0010\u0010\u001a\u0004\u0018\u00010\u0005HÆ\u0003¢\u0006\u0002\u0010\fJ\u000b\u0010\u0011\u001a\u0004\u0018\u00010\u0003HÆ\u0003J0\u0010\u0012\u001a\u00020\u00002\b\b\u0002\u0010\u0002\u001a\u00020\u00032\n\b\u0002\u0010\u0004\u001a\u0004\u0018\u00010\u00052\n\b\u0002\u0010\u0006\u001a\u0004\u0018\u00010\u0003HÆ\u0001¢\u0006\u0002\u0010\u0013J\u0013\u0010\u0014\u001a\u00020\u00152\b\u0010\u0016\u001a\u0004\u0018\u00010\u0001HÖ\u0003J\t\u0010\u0017\u001a\u00020\u0018HÖ\u0001J\t\u0010\u0019\u001a\u00020\u0003HÖ\u0001R\u0011\u0010\u0002\u001a\u00020\u0003¢\u0006\b\n\u0000\u001a\u0004\b\t\u0010\nR\u0015\u0010\u0004\u001a\u0004\u0018\u00010\u0005¢\u0006\n\n\u0002\u0010\r\u001a\u0004\b\u000b\u0010\fR\u0013\u0010\u0006\u001a\u0004\u0018\u00010\u0003¢\u0006\b\n\u0000\u001a\u0004\b\u000e\u0010\n¨\u0006\u001a"}, d2 = {"Lcom/sistemasolton/itranvias/MainActivity$CardData;", "", "id", "", "balance", "", "lastOperation", "<init>", "(Ljava/lang/String;Ljava/lang/Double;Ljava/lang/String;)V", "getId", "()Ljava/lang/String;", "getBalance", "()Ljava/lang/Double;", "Ljava/lang/Double;", "getLastOperation", "component1", "component2", "component3", "copy", "(Ljava/lang/String;Ljava/lang/Double;Ljava/lang/String;)Lcom/sistemasolton/itranvias/MainActivity$CardData;", "equals", "", "other", "hashCode", "", "toString", "composeApp_release"}, k = 1, mv = {2, 1, 0}, xi = 48)
    public static final /* data */ class CardData {
        public static final int $stable = 0;
        private final Double balance;
        private final String id;
        private final String lastOperation;

        public static /* synthetic */ CardData copy$default(CardData cardData, String str, Double d, String str2, int i, Object obj) {
            if ((i & 1) != 0) {
                str = cardData.id;
            }
            if ((i & 2) != 0) {
                d = cardData.balance;
            }
            if ((i & 4) != 0) {
                str2 = cardData.lastOperation;
            }
            return cardData.copy(str, d, str2);
        }

        /* JADX INFO: renamed from: component1, reason: from getter */
        public final String getId() {
            return this.id;
        }

        /* JADX INFO: renamed from: component2, reason: from getter */
        public final Double getBalance() {
            return this.balance;
        }

        /* JADX INFO: renamed from: component3, reason: from getter */
        public final String getLastOperation() {
            return this.lastOperation;
        }

        public final CardData copy(String id, Double balance, String lastOperation) {
            Intrinsics.checkNotNullParameter(id, "id");
            return new CardData(id, balance, lastOperation);
        }

        public boolean equals(Object other) {
            if (this == other) {
                return true;
            }
            if (!(other instanceof CardData)) {
                return false;
            }
            CardData cardData = (CardData) other;
            return Intrinsics.areEqual(this.id, cardData.id) && Intrinsics.areEqual((Object) this.balance, (Object) cardData.balance) && Intrinsics.areEqual(this.lastOperation, cardData.lastOperation);
        }

        public int hashCode() {
            int iHashCode = this.id.hashCode() * 31;
            Double d = this.balance;
            int iHashCode2 = (iHashCode + (d == null ? 0 : d.hashCode())) * 31;
            String str = this.lastOperation;
            return iHashCode2 + (str != null ? str.hashCode() : 0);
        }

        public String toString() {
            return "CardData(id=" + this.id + ", balance=" + this.balance + ", lastOperation=" + this.lastOperation + ")";
        }

        public CardData(String id, Double d, String str) {
            Intrinsics.checkNotNullParameter(id, "id");
            this.id = id;
            this.balance = d;
            this.lastOperation = str;
        }

        public /* synthetic */ CardData(String str, Double d, String str2, int i, DefaultConstructorMarker defaultConstructorMarker) {
            this(str, (i & 2) != 0 ? null : d, (i & 4) != 0 ? null : str2);
        }

        public final String getId() {
            return this.id;
        }

        public final Double getBalance() {
            return this.balance;
        }

        public final String getLastOperation() {
            return this.lastOperation;
        }
    }

    public final MutableState<CardData> getCardDataState$composeApp_release() {
        return this.cardDataState;
    }

    public final MutableState<String> getNfcTagState$composeApp_release() {
        return this.nfcTagState;
    }

    @Override // androidx.activity.ComponentActivity, androidx.core.app.ComponentActivity, android.app.Activity
    protected void onCreate(Bundle savedInstanceState) {
        MainActivity mainActivity = this;
        EdgeToEdge.enable$default(mainActivity, null, null, 3, null);
        super.onCreate(savedInstanceState);
        MainActivity mainActivity2 = this;
        this.nfcAdapter = NfcAdapter.getDefaultAdapter(mainActivity2);
        Intent intentAddFlags = new Intent(mainActivity2, getClass()).addFlags(536870912);
        Intrinsics.checkNotNullExpressionValue(intentAddFlags, "addFlags(...)");
        this.pendingIntent = PendingIntent.getActivity(mainActivity2, 0, intentAddFlags, BundledSQLite.SQLITE_OPEN_EXRESCODE);
        this.intentFilters = new IntentFilter[]{new IntentFilter("android.nfc.action.TAG_DISCOVERED")};
        ComponentActivityKt.setContent$default(mainActivity, null, ComposableLambdaKt.composableLambdaInstance(1220621109, true, new Function2<Composer, Integer, Unit>() { // from class: com.sistemasolton.itranvias.MainActivity.onCreate.1
            @Override // kotlin.jvm.functions.Function2
            public /* bridge */ /* synthetic */ Unit invoke(Composer composer, Integer num) {
                invoke(composer, num.intValue());
                return Unit.INSTANCE;
            }

            public final void invoke(Composer composer, int i) {
                if ((i & 3) == 2 && composer.getSkipping()) {
                    composer.skipToGroupEnd();
                    return;
                }
                if (ComposerKt.isTraceInProgress()) {
                    ComposerKt.traceEventStart(1220621109, i, -1, "com.sistemasolton.itranvias.MainActivity.onCreate.<anonymous> (MainActivity.kt:49)");
                }
                ProvidableCompositionLocal<Density> localDensity = CompositionLocalsKt.getLocalDensity();
                ComposerKt.sourceInformationMarkerStart(composer, 2023513938, "CC(<get-current>):CompositionLocal.kt#9igjgp");
                Object objConsume = composer.consume(localDensity);
                ComposerKt.sourceInformationMarkerEnd(composer);
                ProvidedValue<Density> providedValueProvides = CompositionLocalsKt.getLocalDensity().provides(DensityKt.Density(((Density) objConsume).getDensity(), 1.0f));
                final MainActivity mainActivity3 = MainActivity.this;
                CompositionLocalKt.CompositionLocalProvider(providedValueProvides, ComposableLambdaKt.rememberComposableLambda(927237749, true, new Function2<Composer, Integer, Unit>() { // from class: com.sistemasolton.itranvias.MainActivity.onCreate.1.1
                    @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(927237749, i2, -1, "com.sistemasolton.itranvias.MainActivity.onCreate.<anonymous>.<anonymous> (MainActivity.kt:56)");
                        }
                        AppKt.App(mainActivity3.getNfcTagState$composeApp_release().getValue(), null, composer2, 0, 2);
                        if (ComposerKt.isTraceInProgress()) {
                            ComposerKt.traceEventEnd();
                        }
                    }
                }, composer, 54), composer, ProvidedValue.$stable | 48);
                if (ComposerKt.isTraceInProgress()) {
                    ComposerKt.traceEventEnd();
                }
            }
        }), 1, null);
    }

    public final void enableNfcDispatch() {
        NfcAdapter nfcAdapter = this.nfcAdapter;
        if (nfcAdapter != null) {
            nfcAdapter.enableForegroundDispatch(this, this.pendingIntent, this.intentFilters, null);
        }
    }

    public final void disableNfcDispatch() {
        NfcAdapter nfcAdapter = this.nfcAdapter;
        if (nfcAdapter != null) {
            nfcAdapter.disableForegroundDispatch(this);
        }
    }

    @Override // android.app.Activity
    protected void onResume() {
        super.onResume();
    }

    @Override // android.app.Activity
    protected void onPause() {
        super.onPause();
    }

    public final MutableState<Integer> getReadingTrigger$composeApp_release() {
        return this.readingTrigger;
    }

    @Override // androidx.activity.ComponentActivity, android.app.Activity
    protected void onNewIntent(Intent intent) {
        Tag tag;
        Intrinsics.checkNotNullParameter(intent, "intent");
        super.onNewIntent(intent);
        if (!Intrinsics.areEqual(intent.getAction(), "android.nfc.action.TAG_DISCOVERED") || (tag = (Tag) intent.getParcelableExtra("android.nfc.extra.TAG")) == null) {
            return;
        }
        BuildersKt__Builders_commonKt.launch$default(CoroutineScopeKt.CoroutineScope(Dispatchers.getIO()), null, null, new MainActivity$onNewIntent$1$1(tag, this, null), 3, null);
    }
}