package com.revenuecat.purchases;

import com.revenuecat.purchases.SyncPendingPurchaseResult;
import com.revenuecat.purchases.common.Config;
import com.revenuecat.purchases.common.LogIntent;
import com.revenuecat.purchases.common.LogWrapperKt;
import com.revenuecat.purchases.common.UtilsKt;
import com.revenuecat.purchases.models.PurchaseState;
import com.revenuecat.purchases.models.StoreTransaction;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import kotlin.jvm.internal.o;
import kotlin.jvm.internal.p;
import w4.C3137A;
import x4.AbstractC3229F;
import x4.AbstractC3251q;
import x4.AbstractC3253s;
import x4.AbstractC3257w;

/* JADX INFO: loaded from: classes3.dex */
public final class PostPendingTransactionsHelper$syncPendingPurchaseQueue$3$1 extends p implements J4.c {
    final /* synthetic */ boolean $allowSharingPlayStoreAccount;
    final /* synthetic */ String $appUserID;
    final /* synthetic */ J4.c $callback;
    final /* synthetic */ PostPendingTransactionsHelper this$0;

    /* JADX INFO: renamed from: com.revenuecat.purchases.PostPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$2, reason: invalid class name */
    public static final class AnonymousClass2 extends p implements J4.a {
        final /* synthetic */ boolean $allowSharingPlayStoreAccount;
        final /* synthetic */ String $appUserID;
        final /* synthetic */ J4.c $callback;
        final /* synthetic */ Set<String> $pendingTransactionsTokens;
        final /* synthetic */ PostPendingTransactionsHelper this$0;

        /* JADX INFO: renamed from: com.revenuecat.purchases.PostPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$2$1, reason: invalid class name */
        public static final class AnonymousClass1 extends p implements J4.a {
            final /* synthetic */ J4.c $callback;

            /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
            public AnonymousClass1(J4.c cVar) {
                super(0);
                this.$callback = cVar;
            }

            @Override // J4.a
            public /* bridge */ /* synthetic */ Object invoke() {
                m406invoke();
                return C3137A.f25453a;
            }

            /* JADX INFO: renamed from: invoke, reason: collision with other method in class */
            public final void m406invoke() {
                J4.c cVar = this.$callback;
                if (cVar != null) {
                    cVar.invoke(SyncPendingPurchaseResult.NoPendingPurchasesToSync.INSTANCE);
                }
            }
        }

        /* JADX INFO: renamed from: com.revenuecat.purchases.PostPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$2$2, reason: invalid class name and collision with other inner class name */
        public static final class C00092 extends p implements J4.c {
            final /* synthetic */ J4.c $callback;

            /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
            public C00092(J4.c cVar) {
                super(1);
                this.$callback = cVar;
            }

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

            public final void invoke(PurchasesError it) {
                o.h(it, "it");
                J4.c cVar = this.$callback;
                if (cVar != null) {
                    cVar.invoke(new SyncPendingPurchaseResult.Error(it));
                }
            }
        }

        /* JADX INFO: renamed from: com.revenuecat.purchases.PostPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$2$3, reason: invalid class name */
        public static final class AnonymousClass3 extends p implements J4.c {
            final /* synthetic */ J4.c $callback;

            /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
            public AnonymousClass3(J4.c cVar) {
                super(1);
                this.$callback = cVar;
            }

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

            public final void invoke(CustomerInfo it) {
                o.h(it, "it");
                J4.c cVar = this.$callback;
                if (cVar != null) {
                    cVar.invoke(new SyncPendingPurchaseResult.Success(it));
                }
            }
        }

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public AnonymousClass2(PostPendingTransactionsHelper postPendingTransactionsHelper, String str, boolean z6, Set<String> set, J4.c cVar) {
            super(0);
            this.this$0 = postPendingTransactionsHelper;
            this.$appUserID = str;
            this.$allowSharingPlayStoreAccount = z6;
            this.$pendingTransactionsTokens = set;
            this.$callback = cVar;
        }

        @Override // J4.a
        public /* bridge */ /* synthetic */ Object invoke() {
            m405invoke();
            return C3137A.f25453a;
        }

        /* JADX INFO: renamed from: invoke, reason: collision with other method in class */
        public final void m405invoke() {
            this.this$0.postReceiptHelper.postRemainingCachedTransactionMetadata(this.$appUserID, this.$allowSharingPlayStoreAccount, this.$pendingTransactionsTokens, new AnonymousClass1(this.$callback), new C00092(this.$callback), new AnonymousClass3(this.$callback));
        }
    }

    /* JADX INFO: renamed from: com.revenuecat.purchases.PostPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$3, reason: invalid class name */
    public static final class AnonymousClass3 extends p implements J4.c {
        final /* synthetic */ boolean $allowSharingPlayStoreAccount;
        final /* synthetic */ String $appUserID;
        final /* synthetic */ J4.c $callback;
        final /* synthetic */ Set<String> $pendingTransactionsTokens;
        final /* synthetic */ PostPendingTransactionsHelper this$0;

        /* JADX INFO: renamed from: com.revenuecat.purchases.PostPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$3$1, reason: invalid class name */
        public static final class AnonymousClass1 extends p implements J4.a {
            final /* synthetic */ J4.c $callback;
            final /* synthetic */ PurchasesError $error;

            /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
            public AnonymousClass1(J4.c cVar, PurchasesError purchasesError) {
                super(0);
                this.$callback = cVar;
                this.$error = purchasesError;
            }

            @Override // J4.a
            public /* bridge */ /* synthetic */ Object invoke() {
                m407invoke();
                return C3137A.f25453a;
            }

            /* JADX INFO: renamed from: invoke, reason: collision with other method in class */
            public final void m407invoke() {
                LogHandler currentLogHandler;
                String strJ;
                String str;
                LogIntent logIntent = LogIntent.DEBUG;
                PostPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$3$1$invoke$$inlined$log$1 postPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$3$1$invoke$$inlined$log$1 = new PostPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$3$1$invoke$$inlined$log$1(logIntent);
                switch (LogWrapperKt.WhenMappings.$EnumSwitchMapping$0[logIntent.ordinal()]) {
                    case 1:
                        LogLevel logLevel = LogLevel.DEBUG;
                        currentLogHandler = LogWrapperKt.getCurrentLogHandler();
                        if (Config.INSTANCE.getLogLevel().compareTo(logLevel) <= 0) {
                            strJ = com.google.android.recaptcha.internal.a.j(logLevel, new StringBuilder("[Purchases] - "));
                            str = (String) postPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$3$1$invoke$$inlined$log$1.invoke();
                            currentLogHandler.d(strJ, str);
                        }
                        break;
                    case 2:
                        LogWrapperKt.getCurrentLogHandler().e("[Purchases] - ERROR", (String) postPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$3$1$invoke$$inlined$log$1.invoke(), null);
                        break;
                    case 3:
                        LogLevel logLevel2 = LogLevel.WARN;
                        LogHandler currentLogHandler2 = LogWrapperKt.getCurrentLogHandler();
                        if (Config.INSTANCE.getLogLevel().compareTo(logLevel2) <= 0) {
                            currentLogHandler2.w(com.google.android.recaptcha.internal.a.j(logLevel2, new StringBuilder("[Purchases] - ")), (String) postPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$3$1$invoke$$inlined$log$1.invoke());
                        }
                        break;
                    case 4:
                        LogLevel logLevel3 = LogLevel.INFO;
                        LogHandler currentLogHandler3 = LogWrapperKt.getCurrentLogHandler();
                        if (Config.INSTANCE.getLogLevel().compareTo(logLevel3) <= 0) {
                            currentLogHandler3.i(com.google.android.recaptcha.internal.a.j(logLevel3, new StringBuilder("[Purchases] - ")), (String) postPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$3$1$invoke$$inlined$log$1.invoke());
                        }
                        break;
                    case 5:
                        LogLevel logLevel4 = LogLevel.DEBUG;
                        currentLogHandler = LogWrapperKt.getCurrentLogHandler();
                        if (Config.INSTANCE.getLogLevel().compareTo(logLevel4) <= 0) {
                            strJ = com.google.android.recaptcha.internal.a.j(logLevel4, new StringBuilder("[Purchases] - "));
                            str = (String) postPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$3$1$invoke$$inlined$log$1.invoke();
                            currentLogHandler.d(strJ, str);
                        }
                        break;
                    case 6:
                        LogWrapperKt.getCurrentLogHandler().e("[Purchases] - ERROR", (String) postPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$3$1$invoke$$inlined$log$1.invoke(), null);
                        break;
                    case 7:
                        LogLevel logLevel5 = LogLevel.INFO;
                        LogHandler currentLogHandler4 = LogWrapperKt.getCurrentLogHandler();
                        if (Config.INSTANCE.getLogLevel().compareTo(logLevel5) <= 0) {
                            currentLogHandler4.i(com.google.android.recaptcha.internal.a.j(logLevel5, new StringBuilder("[Purchases] - ")), (String) postPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$3$1$invoke$$inlined$log$1.invoke());
                        }
                        break;
                    case 8:
                        LogLevel logLevel6 = LogLevel.DEBUG;
                        currentLogHandler = LogWrapperKt.getCurrentLogHandler();
                        if (Config.INSTANCE.getLogLevel().compareTo(logLevel6) <= 0) {
                            strJ = com.google.android.recaptcha.internal.a.j(logLevel6, new StringBuilder("[Purchases] - "));
                            str = (String) postPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$3$1$invoke$$inlined$log$1.invoke();
                            currentLogHandler.d(strJ, str);
                        }
                        break;
                    case 9:
                        LogLevel logLevel7 = LogLevel.DEBUG;
                        currentLogHandler = LogWrapperKt.getCurrentLogHandler();
                        if (Config.INSTANCE.getLogLevel().compareTo(logLevel7) <= 0) {
                            strJ = com.google.android.recaptcha.internal.a.j(logLevel7, new StringBuilder("[Purchases] - "));
                            str = (String) postPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$3$1$invoke$$inlined$log$1.invoke();
                            currentLogHandler.d(strJ, str);
                        }
                        break;
                    case 10:
                        LogLevel logLevel8 = LogLevel.WARN;
                        LogHandler currentLogHandler5 = LogWrapperKt.getCurrentLogHandler();
                        if (Config.INSTANCE.getLogLevel().compareTo(logLevel8) <= 0) {
                            currentLogHandler5.w(com.google.android.recaptcha.internal.a.j(logLevel8, new StringBuilder("[Purchases] - ")), (String) postPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$3$1$invoke$$inlined$log$1.invoke());
                        }
                        break;
                    case 11:
                        LogLevel logLevel9 = LogLevel.WARN;
                        LogHandler currentLogHandler6 = LogWrapperKt.getCurrentLogHandler();
                        if (Config.INSTANCE.getLogLevel().compareTo(logLevel9) <= 0) {
                            currentLogHandler6.w(com.google.android.recaptcha.internal.a.j(logLevel9, new StringBuilder("[Purchases] - ")), (String) postPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$3$1$invoke$$inlined$log$1.invoke());
                        }
                        break;
                    case 12:
                        LogWrapperKt.getCurrentLogHandler().e("[Purchases] - ERROR", (String) postPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$3$1$invoke$$inlined$log$1.invoke(), null);
                        break;
                    case 13:
                        LogLevel logLevel10 = LogLevel.WARN;
                        LogHandler currentLogHandler7 = LogWrapperKt.getCurrentLogHandler();
                        if (Config.INSTANCE.getLogLevel().compareTo(logLevel10) <= 0) {
                            currentLogHandler7.w(com.google.android.recaptcha.internal.a.j(logLevel10, new StringBuilder("[Purchases] - ")), (String) postPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$3$1$invoke$$inlined$log$1.invoke());
                        }
                        break;
                    case 14:
                        LogWrapperKt.getCurrentLogHandler().e("[Purchases] - ERROR", (String) postPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$3$1$invoke$$inlined$log$1.invoke(), null);
                        break;
                }
                J4.c cVar = this.$callback;
                if (cVar != null) {
                    cVar.invoke(new SyncPendingPurchaseResult.Error(this.$error));
                }
            }
        }

        /* JADX INFO: renamed from: com.revenuecat.purchases.PostPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$3$2, reason: invalid class name */
        public static final class AnonymousClass2 extends p implements J4.c {
            final /* synthetic */ J4.c $callback;
            final /* synthetic */ PurchasesError $error;

            /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
            public AnonymousClass2(J4.c cVar, PurchasesError purchasesError) {
                super(1);
                this.$callback = cVar;
                this.$error = purchasesError;
            }

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

            public final void invoke(PurchasesError it) {
                o.h(it, "it");
                J4.c cVar = this.$callback;
                if (cVar != null) {
                    cVar.invoke(new SyncPendingPurchaseResult.Error(this.$error));
                }
            }
        }

        /* JADX INFO: renamed from: com.revenuecat.purchases.PostPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$3$3, reason: invalid class name and collision with other inner class name */
        public static final class C00103 extends p implements J4.c {
            final /* synthetic */ J4.c $callback;

            /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
            public C00103(J4.c cVar) {
                super(1);
                this.$callback = cVar;
            }

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

            public final void invoke(CustomerInfo it) {
                o.h(it, "it");
                J4.c cVar = this.$callback;
                if (cVar != null) {
                    cVar.invoke(new SyncPendingPurchaseResult.Success(it));
                }
            }
        }

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public AnonymousClass3(PostPendingTransactionsHelper postPendingTransactionsHelper, String str, boolean z6, Set<String> set, J4.c cVar) {
            super(1);
            this.this$0 = postPendingTransactionsHelper;
            this.$appUserID = str;
            this.$allowSharingPlayStoreAccount = z6;
            this.$pendingTransactionsTokens = set;
            this.$callback = cVar;
        }

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

        public final void invoke(PurchasesError error) {
            o.h(error, "error");
            this.this$0.postReceiptHelper.postRemainingCachedTransactionMetadata(this.$appUserID, this.$allowSharingPlayStoreAccount, this.$pendingTransactionsTokens, new AnonymousClass1(this.$callback, error), new AnonymousClass2(this.$callback, error), new C00103(this.$callback));
        }
    }

    /* JADX INFO: renamed from: com.revenuecat.purchases.PostPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$4, reason: invalid class name */
    public static final class AnonymousClass4 extends p implements J4.c {
        final /* synthetic */ boolean $allowSharingPlayStoreAccount;
        final /* synthetic */ String $appUserID;
        final /* synthetic */ J4.c $callback;
        final /* synthetic */ Set<String> $pendingTransactionsTokens;
        final /* synthetic */ PostPendingTransactionsHelper this$0;

        /* JADX INFO: renamed from: com.revenuecat.purchases.PostPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$4$1, reason: invalid class name */
        public static final class AnonymousClass1 extends p implements J4.a {
            final /* synthetic */ J4.c $callback;
            final /* synthetic */ CustomerInfo $customerInfo;

            /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
            public AnonymousClass1(J4.c cVar, CustomerInfo customerInfo) {
                super(0);
                this.$callback = cVar;
                this.$customerInfo = customerInfo;
            }

            @Override // J4.a
            public /* bridge */ /* synthetic */ Object invoke() {
                m408invoke();
                return C3137A.f25453a;
            }

            /* JADX INFO: renamed from: invoke, reason: collision with other method in class */
            public final void m408invoke() {
                LogHandler currentLogHandler;
                String strJ;
                String str;
                LogIntent logIntent = LogIntent.DEBUG;
                PostPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$4$1$invoke$$inlined$log$1 postPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$4$1$invoke$$inlined$log$1 = new PostPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$4$1$invoke$$inlined$log$1(logIntent);
                switch (LogWrapperKt.WhenMappings.$EnumSwitchMapping$0[logIntent.ordinal()]) {
                    case 1:
                        LogLevel logLevel = LogLevel.DEBUG;
                        currentLogHandler = LogWrapperKt.getCurrentLogHandler();
                        if (Config.INSTANCE.getLogLevel().compareTo(logLevel) <= 0) {
                            strJ = com.google.android.recaptcha.internal.a.j(logLevel, new StringBuilder("[Purchases] - "));
                            str = (String) postPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$4$1$invoke$$inlined$log$1.invoke();
                            currentLogHandler.d(strJ, str);
                        }
                        break;
                    case 2:
                        LogWrapperKt.getCurrentLogHandler().e("[Purchases] - ERROR", (String) postPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$4$1$invoke$$inlined$log$1.invoke(), null);
                        break;
                    case 3:
                        LogLevel logLevel2 = LogLevel.WARN;
                        LogHandler currentLogHandler2 = LogWrapperKt.getCurrentLogHandler();
                        if (Config.INSTANCE.getLogLevel().compareTo(logLevel2) <= 0) {
                            currentLogHandler2.w(com.google.android.recaptcha.internal.a.j(logLevel2, new StringBuilder("[Purchases] - ")), (String) postPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$4$1$invoke$$inlined$log$1.invoke());
                        }
                        break;
                    case 4:
                        LogLevel logLevel3 = LogLevel.INFO;
                        LogHandler currentLogHandler3 = LogWrapperKt.getCurrentLogHandler();
                        if (Config.INSTANCE.getLogLevel().compareTo(logLevel3) <= 0) {
                            currentLogHandler3.i(com.google.android.recaptcha.internal.a.j(logLevel3, new StringBuilder("[Purchases] - ")), (String) postPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$4$1$invoke$$inlined$log$1.invoke());
                        }
                        break;
                    case 5:
                        LogLevel logLevel4 = LogLevel.DEBUG;
                        currentLogHandler = LogWrapperKt.getCurrentLogHandler();
                        if (Config.INSTANCE.getLogLevel().compareTo(logLevel4) <= 0) {
                            strJ = com.google.android.recaptcha.internal.a.j(logLevel4, new StringBuilder("[Purchases] - "));
                            str = (String) postPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$4$1$invoke$$inlined$log$1.invoke();
                            currentLogHandler.d(strJ, str);
                        }
                        break;
                    case 6:
                        LogWrapperKt.getCurrentLogHandler().e("[Purchases] - ERROR", (String) postPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$4$1$invoke$$inlined$log$1.invoke(), null);
                        break;
                    case 7:
                        LogLevel logLevel5 = LogLevel.INFO;
                        LogHandler currentLogHandler4 = LogWrapperKt.getCurrentLogHandler();
                        if (Config.INSTANCE.getLogLevel().compareTo(logLevel5) <= 0) {
                            currentLogHandler4.i(com.google.android.recaptcha.internal.a.j(logLevel5, new StringBuilder("[Purchases] - ")), (String) postPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$4$1$invoke$$inlined$log$1.invoke());
                        }
                        break;
                    case 8:
                        LogLevel logLevel6 = LogLevel.DEBUG;
                        currentLogHandler = LogWrapperKt.getCurrentLogHandler();
                        if (Config.INSTANCE.getLogLevel().compareTo(logLevel6) <= 0) {
                            strJ = com.google.android.recaptcha.internal.a.j(logLevel6, new StringBuilder("[Purchases] - "));
                            str = (String) postPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$4$1$invoke$$inlined$log$1.invoke();
                            currentLogHandler.d(strJ, str);
                        }
                        break;
                    case 9:
                        LogLevel logLevel7 = LogLevel.DEBUG;
                        currentLogHandler = LogWrapperKt.getCurrentLogHandler();
                        if (Config.INSTANCE.getLogLevel().compareTo(logLevel7) <= 0) {
                            strJ = com.google.android.recaptcha.internal.a.j(logLevel7, new StringBuilder("[Purchases] - "));
                            str = (String) postPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$4$1$invoke$$inlined$log$1.invoke();
                            currentLogHandler.d(strJ, str);
                        }
                        break;
                    case 10:
                        LogLevel logLevel8 = LogLevel.WARN;
                        LogHandler currentLogHandler5 = LogWrapperKt.getCurrentLogHandler();
                        if (Config.INSTANCE.getLogLevel().compareTo(logLevel8) <= 0) {
                            currentLogHandler5.w(com.google.android.recaptcha.internal.a.j(logLevel8, new StringBuilder("[Purchases] - ")), (String) postPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$4$1$invoke$$inlined$log$1.invoke());
                        }
                        break;
                    case 11:
                        LogLevel logLevel9 = LogLevel.WARN;
                        LogHandler currentLogHandler6 = LogWrapperKt.getCurrentLogHandler();
                        if (Config.INSTANCE.getLogLevel().compareTo(logLevel9) <= 0) {
                            currentLogHandler6.w(com.google.android.recaptcha.internal.a.j(logLevel9, new StringBuilder("[Purchases] - ")), (String) postPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$4$1$invoke$$inlined$log$1.invoke());
                        }
                        break;
                    case 12:
                        LogWrapperKt.getCurrentLogHandler().e("[Purchases] - ERROR", (String) postPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$4$1$invoke$$inlined$log$1.invoke(), null);
                        break;
                    case 13:
                        LogLevel logLevel10 = LogLevel.WARN;
                        LogHandler currentLogHandler7 = LogWrapperKt.getCurrentLogHandler();
                        if (Config.INSTANCE.getLogLevel().compareTo(logLevel10) <= 0) {
                            currentLogHandler7.w(com.google.android.recaptcha.internal.a.j(logLevel10, new StringBuilder("[Purchases] - ")), (String) postPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$4$1$invoke$$inlined$log$1.invoke());
                        }
                        break;
                    case 14:
                        LogWrapperKt.getCurrentLogHandler().e("[Purchases] - ERROR", (String) postPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$4$1$invoke$$inlined$log$1.invoke(), null);
                        break;
                }
                J4.c cVar = this.$callback;
                if (cVar != null) {
                    cVar.invoke(new SyncPendingPurchaseResult.Success(this.$customerInfo));
                }
            }
        }

        /* JADX INFO: renamed from: com.revenuecat.purchases.PostPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$4$2, reason: invalid class name */
        public static final class AnonymousClass2 extends p implements J4.c {
            final /* synthetic */ J4.c $callback;

            /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
            public AnonymousClass2(J4.c cVar) {
                super(1);
                this.$callback = cVar;
            }

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

            public final void invoke(PurchasesError it) {
                o.h(it, "it");
                J4.c cVar = this.$callback;
                if (cVar != null) {
                    cVar.invoke(new SyncPendingPurchaseResult.Error(it));
                }
            }
        }

        /* JADX INFO: renamed from: com.revenuecat.purchases.PostPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$4$3, reason: invalid class name */
        public static final class AnonymousClass3 extends p implements J4.c {
            final /* synthetic */ J4.c $callback;

            /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
            public AnonymousClass3(J4.c cVar) {
                super(1);
                this.$callback = cVar;
            }

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

            public final void invoke(CustomerInfo it) {
                o.h(it, "it");
                J4.c cVar = this.$callback;
                if (cVar != null) {
                    cVar.invoke(new SyncPendingPurchaseResult.Success(it));
                }
            }
        }

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public AnonymousClass4(PostPendingTransactionsHelper postPendingTransactionsHelper, String str, boolean z6, Set<String> set, J4.c cVar) {
            super(1);
            this.this$0 = postPendingTransactionsHelper;
            this.$appUserID = str;
            this.$allowSharingPlayStoreAccount = z6;
            this.$pendingTransactionsTokens = set;
            this.$callback = cVar;
        }

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

        public final void invoke(CustomerInfo customerInfo) {
            o.h(customerInfo, "customerInfo");
            this.this$0.postReceiptHelper.postRemainingCachedTransactionMetadata(this.$appUserID, this.$allowSharingPlayStoreAccount, this.$pendingTransactionsTokens, new AnonymousClass1(this.$callback, customerInfo), new AnonymousClass2(this.$callback), new AnonymousClass3(this.$callback));
        }
    }

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public PostPendingTransactionsHelper$syncPendingPurchaseQueue$3$1(PostPendingTransactionsHelper postPendingTransactionsHelper, boolean z6, String str, J4.c cVar) {
        super(1);
        this.this$0 = postPendingTransactionsHelper;
        this.$allowSharingPlayStoreAccount = z6;
        this.$appUserID = str;
        this.$callback = cVar;
    }

    @Override // J4.c
    public /* bridge */ /* synthetic */ Object invoke(Object obj) {
        invoke((Map<String, StoreTransaction>) obj);
        return C3137A.f25453a;
    }

    public final void invoke(Map<String, StoreTransaction> purchasesByHashedToken) {
        LogHandler currentLogHandler;
        String strJ;
        Object objInvoke;
        o.h(purchasesByHashedToken, "purchasesByHashedToken");
        for (Map.Entry<String, StoreTransaction> entry : purchasesByHashedToken.entrySet()) {
            String key = entry.getKey();
            StoreTransaction value = entry.getValue();
            LogIntent logIntent = LogIntent.DEBUG;
            PostPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$invoke$lambda$1$$inlined$log$1 postPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$invoke$lambda$1$$inlined$log$1 = new PostPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$invoke$lambda$1$$inlined$log$1(logIntent, value, key);
            switch (LogWrapperKt.WhenMappings.$EnumSwitchMapping$0[logIntent.ordinal()]) {
                case 1:
                    LogLevel logLevel = LogLevel.DEBUG;
                    currentLogHandler = LogWrapperKt.getCurrentLogHandler();
                    if (Config.INSTANCE.getLogLevel().compareTo(logLevel) <= 0) {
                        strJ = com.google.android.recaptcha.internal.a.j(logLevel, new StringBuilder("[Purchases] - "));
                        objInvoke = postPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$invoke$lambda$1$$inlined$log$1.invoke();
                    }
                    break;
                case 2:
                    LogWrapperKt.getCurrentLogHandler().e("[Purchases] - ERROR", (String) postPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$invoke$lambda$1$$inlined$log$1.invoke(), null);
                    continue;
                case 3:
                    LogLevel logLevel2 = LogLevel.WARN;
                    LogHandler currentLogHandler2 = LogWrapperKt.getCurrentLogHandler();
                    if (Config.INSTANCE.getLogLevel().compareTo(logLevel2) <= 0) {
                        currentLogHandler2.w(com.google.android.recaptcha.internal.a.j(logLevel2, new StringBuilder("[Purchases] - ")), (String) postPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$invoke$lambda$1$$inlined$log$1.invoke());
                    } else {
                        continue;
                    }
                    break;
                case 4:
                    LogLevel logLevel3 = LogLevel.INFO;
                    LogHandler currentLogHandler3 = LogWrapperKt.getCurrentLogHandler();
                    if (Config.INSTANCE.getLogLevel().compareTo(logLevel3) <= 0) {
                        currentLogHandler3.i(com.google.android.recaptcha.internal.a.j(logLevel3, new StringBuilder("[Purchases] - ")), (String) postPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$invoke$lambda$1$$inlined$log$1.invoke());
                    } else {
                        continue;
                    }
                    break;
                case 5:
                    LogLevel logLevel4 = LogLevel.DEBUG;
                    currentLogHandler = LogWrapperKt.getCurrentLogHandler();
                    if (Config.INSTANCE.getLogLevel().compareTo(logLevel4) <= 0) {
                        strJ = com.google.android.recaptcha.internal.a.j(logLevel4, new StringBuilder("[Purchases] - "));
                        objInvoke = postPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$invoke$lambda$1$$inlined$log$1.invoke();
                    }
                    break;
                case 6:
                    LogWrapperKt.getCurrentLogHandler().e("[Purchases] - ERROR", (String) postPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$invoke$lambda$1$$inlined$log$1.invoke(), null);
                    continue;
                case 7:
                    LogLevel logLevel5 = LogLevel.INFO;
                    LogHandler currentLogHandler4 = LogWrapperKt.getCurrentLogHandler();
                    if (Config.INSTANCE.getLogLevel().compareTo(logLevel5) <= 0) {
                        currentLogHandler4.i(com.google.android.recaptcha.internal.a.j(logLevel5, new StringBuilder("[Purchases] - ")), (String) postPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$invoke$lambda$1$$inlined$log$1.invoke());
                    } else {
                        continue;
                    }
                    break;
                case 8:
                    LogLevel logLevel6 = LogLevel.DEBUG;
                    currentLogHandler = LogWrapperKt.getCurrentLogHandler();
                    if (Config.INSTANCE.getLogLevel().compareTo(logLevel6) <= 0) {
                        strJ = com.google.android.recaptcha.internal.a.j(logLevel6, new StringBuilder("[Purchases] - "));
                        objInvoke = postPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$invoke$lambda$1$$inlined$log$1.invoke();
                    }
                    break;
                case 9:
                    LogLevel logLevel7 = LogLevel.DEBUG;
                    currentLogHandler = LogWrapperKt.getCurrentLogHandler();
                    if (Config.INSTANCE.getLogLevel().compareTo(logLevel7) <= 0) {
                        strJ = com.google.android.recaptcha.internal.a.j(logLevel7, new StringBuilder("[Purchases] - "));
                        objInvoke = postPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$invoke$lambda$1$$inlined$log$1.invoke();
                    }
                    break;
                case 10:
                    LogLevel logLevel8 = LogLevel.WARN;
                    LogHandler currentLogHandler5 = LogWrapperKt.getCurrentLogHandler();
                    if (Config.INSTANCE.getLogLevel().compareTo(logLevel8) <= 0) {
                        currentLogHandler5.w(com.google.android.recaptcha.internal.a.j(logLevel8, new StringBuilder("[Purchases] - ")), (String) postPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$invoke$lambda$1$$inlined$log$1.invoke());
                    } else {
                        continue;
                    }
                    break;
                case 11:
                    LogLevel logLevel9 = LogLevel.WARN;
                    LogHandler currentLogHandler6 = LogWrapperKt.getCurrentLogHandler();
                    if (Config.INSTANCE.getLogLevel().compareTo(logLevel9) <= 0) {
                        currentLogHandler6.w(com.google.android.recaptcha.internal.a.j(logLevel9, new StringBuilder("[Purchases] - ")), (String) postPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$invoke$lambda$1$$inlined$log$1.invoke());
                    } else {
                        continue;
                    }
                    break;
                case 12:
                    LogWrapperKt.getCurrentLogHandler().e("[Purchases] - ERROR", (String) postPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$invoke$lambda$1$$inlined$log$1.invoke(), null);
                    continue;
                case 13:
                    LogLevel logLevel10 = LogLevel.WARN;
                    LogHandler currentLogHandler7 = LogWrapperKt.getCurrentLogHandler();
                    if (Config.INSTANCE.getLogLevel().compareTo(logLevel10) <= 0) {
                        currentLogHandler7.w(com.google.android.recaptcha.internal.a.j(logLevel10, new StringBuilder("[Purchases] - ")), (String) postPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$invoke$lambda$1$$inlined$log$1.invoke());
                    } else {
                        continue;
                    }
                    break;
                case 14:
                    LogWrapperKt.getCurrentLogHandler().e("[Purchases] - ERROR", (String) postPendingTransactionsHelper$syncPendingPurchaseQueue$3$1$invoke$lambda$1$$inlined$log$1.invoke(), null);
                    continue;
            }
            currentLogHandler.d(strJ, (String) objInvoke);
        }
        this.this$0.deviceCache.cleanPreviouslySentTokens$purchases_defaultsBc8Release(purchasesByHashedToken.keySet());
        List<StoreTransaction> activePurchasesNotInCache$purchases_defaultsBc8Release = this.this$0.deviceCache.getActivePurchasesNotInCache$purchases_defaultsBc8Release(purchasesByHashedToken);
        List<StoreTransaction> purchasesWithAutoRenewingChange$purchases_defaultsBc8Release = this.this$0.deviceCache.getPurchasesWithAutoRenewingChange$purchases_defaultsBc8Release(purchasesByHashedToken);
        ArrayList arrayList = new ArrayList(AbstractC3253s.G(purchasesWithAutoRenewingChange$purchases_defaultsBc8Release, 10));
        Iterator<T> it = purchasesWithAutoRenewingChange$purchases_defaultsBc8Release.iterator();
        while (it.hasNext()) {
            arrayList.add(UtilsKt.sha1(((StoreTransaction) it.next()).getPurchaseToken()));
        }
        Set setH0 = AbstractC3251q.H0(arrayList);
        LinkedHashMap linkedHashMapI = AbstractC3229F.I(purchasesByHashedToken);
        AbstractC3257w.R(setH0, linkedHashMapI.keySet());
        this.this$0.deviceCache.saveAutoRenewingStatus$purchases_defaultsBc8Release(AbstractC3229F.y(linkedHashMapI));
        ArrayList arrayListS0 = AbstractC3251q.s0(purchasesWithAutoRenewingChange$purchases_defaultsBc8Release, activePurchasesNotInCache$purchases_defaultsBc8Release);
        HashSet hashSet = new HashSet();
        ArrayList arrayList2 = new ArrayList();
        for (Object obj : arrayListS0) {
            if (hashSet.add(((StoreTransaction) obj).getPurchaseToken())) {
                arrayList2.add(obj);
            }
        }
        Collection<StoreTransaction> collectionValues = purchasesByHashedToken.values();
        ArrayList arrayList3 = new ArrayList();
        for (Object obj2 : collectionValues) {
            if (((StoreTransaction) obj2).getPurchaseState() == PurchaseState.PENDING) {
                arrayList3.add(obj2);
            }
        }
        ArrayList arrayList4 = new ArrayList(AbstractC3253s.G(arrayList3, 10));
        Iterator it2 = arrayList3.iterator();
        while (it2.hasNext()) {
            arrayList4.add(((StoreTransaction) it2.next()).getPurchaseToken());
        }
        Set setH02 = AbstractC3251q.H0(arrayList4);
        PostPendingTransactionsHelper postPendingTransactionsHelper = this.this$0;
        boolean z6 = this.$allowSharingPlayStoreAccount;
        String str = this.$appUserID;
        postPendingTransactionsHelper.postTransactionsWithCompletion(arrayList2, z6, str, new AnonymousClass2(postPendingTransactionsHelper, str, z6, setH02, this.$callback), new AnonymousClass3(this.this$0, this.$appUserID, this.$allowSharingPlayStoreAccount, setH02, this.$callback), new AnonymousClass4(this.this$0, this.$appUserID, this.$allowSharingPlayStoreAccount, setH02, this.$callback));
    }
}
