导航菜单

页面标题

页面副标题

Perplexity v2.48.1 - PurchasesOrchestrator.java 源代码

正在查看: Perplexity v2.48.1 应用的 PurchasesOrchestrator.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.revenuecat.purchases;

import Dn.h;
import Hc.C0027m;
import Qa.c;
import Qa.m;
import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import android.util.Pair;
import androidx.lifecycle.D;
import androidx.lifecycle.Y;
import bl.i;
import bl.l;
import com.revenuecat.purchases.common.AppConfig;
import com.revenuecat.purchases.common.Backend;
import com.revenuecat.purchases.common.BillingAbstract;
import com.revenuecat.purchases.common.Config;
import com.revenuecat.purchases.common.Constants;
import com.revenuecat.purchases.common.DateProvider;
import com.revenuecat.purchases.common.DefaultDateProvider;
import com.revenuecat.purchases.common.Delay;
import com.revenuecat.purchases.common.Dispatcher;
import com.revenuecat.purchases.common.DurationExtensionsKt;
import com.revenuecat.purchases.common.LogIntent;
import com.revenuecat.purchases.common.LogUtilsKt;
import com.revenuecat.purchases.common.LogWrapperKt;
import com.revenuecat.purchases.common.PlatformInfo;
import com.revenuecat.purchases.common.ReceiptInfo;
import com.revenuecat.purchases.common.ReplaceProductInfo;
import com.revenuecat.purchases.common.UtilsKt;
import com.revenuecat.purchases.common.caching.DeviceCache;
import com.revenuecat.purchases.common.diagnostics.DiagnosticsSynchronizer;
import com.revenuecat.purchases.common.diagnostics.DiagnosticsTracker;
import com.revenuecat.purchases.common.events.EventsManager;
import com.revenuecat.purchases.common.events.FeatureEvent;
import com.revenuecat.purchases.common.offerings.OfferingsManager;
import com.revenuecat.purchases.common.offlineentitlements.OfflineEntitlementsManager;
import com.revenuecat.purchases.common.subscriberattributes.SubscriberAttributeKey;
import com.revenuecat.purchases.customercenter.CustomerCenterConfigData;
import com.revenuecat.purchases.customercenter.CustomerCenterListener;
import com.revenuecat.purchases.deeplinks.WebPurchaseRedemptionHelper;
import com.revenuecat.purchases.identity.IdentityManager;
import com.revenuecat.purchases.interfaces.Callback;
import com.revenuecat.purchases.interfaces.GetAmazonLWAConsentStatusCallback;
import com.revenuecat.purchases.interfaces.GetCustomerCenterConfigCallback;
import com.revenuecat.purchases.interfaces.GetStoreProductsCallback;
import com.revenuecat.purchases.interfaces.GetStorefrontCallback;
import com.revenuecat.purchases.interfaces.LogInCallback;
import com.revenuecat.purchases.interfaces.ProductChangeCallback;
import com.revenuecat.purchases.interfaces.PurchaseCallback;
import com.revenuecat.purchases.interfaces.PurchaseErrorCallback;
import com.revenuecat.purchases.interfaces.ReceiveCustomerInfoCallback;
import com.revenuecat.purchases.interfaces.ReceiveOfferingsCallback;
import com.revenuecat.purchases.interfaces.RedeemWebPurchaseListener;
import com.revenuecat.purchases.interfaces.SyncAttributesAndOfferingsCallback;
import com.revenuecat.purchases.interfaces.SyncPurchasesCallback;
import com.revenuecat.purchases.interfaces.UpdatedCustomerInfoListener;
import com.revenuecat.purchases.models.BillingFeature;
import com.revenuecat.purchases.models.GoogleReplacementMode;
import com.revenuecat.purchases.models.InAppMessageType;
import com.revenuecat.purchases.models.PurchasingData;
import com.revenuecat.purchases.models.StoreProduct;
import com.revenuecat.purchases.models.StoreTransaction;
import com.revenuecat.purchases.paywalls.PaywallPresentedCache;
import com.revenuecat.purchases.paywalls.events.PaywallEvent;
import com.revenuecat.purchases.subscriberattributes.SubscriberAttributesManager;
import com.revenuecat.purchases.utils.AndroidVersionUtilsKt;
import com.revenuecat.purchases.utils.CustomActivityLifecycleHandler;
import com.revenuecat.purchases.utils.RateLimiter;
import fn.A;
import gm.j;
import hf.C0527d;
import i.e;
import ja.f;
import java.io.File;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
import kotlin.Lazy;
import kotlin.LazyKt;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.collections.EmptyList;
import kotlin.collections.MapsKt;
import kotlin.io.FilesKt;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Ref;
import kotlin.jvm.internal.SourceDebugExtension;
import kotlin.time.Duration;
import kotlin.time.DurationKt;
import kotlin.time.DurationUnit;
import ma.b;
import xb.i0;

@Metadata(d1 = {"\u0000ü\u0003\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0010\u0006\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u000b\n\u0002\b\u0003\n\u0002\u0010 \n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\"\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010$\n\u0002\b2\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\b\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\r\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0012\n\u0002\u0018\u0002\n\u0002\b%\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u000f\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\b\b\b\u0000\u0018\u0000 ä\u00022\u00020\u00012\u00020\u0002:\u0002ä\u0002B÷\u0001\u0012\u0006\u0010\u0004\u001a\u00020\u0003\u0012\b\u0010\u0006\u001a\u0004\u0018\u00010\u0005\u0012\u0006\u0010\b\u001a\u00020\u0007\u0012\u0006\u0010\n\u001a\u00020\t\u0012\u0006\u0010\f\u001a\u00020\u000b\u0012\u0006\u0010\u000e\u001a\u00020\r\u0012\u0006\u0010\u0010\u001a\u00020\u000f\u0012\u0006\u0010\u0012\u001a\u00020\u0011\u0012\u0006\u0010\u0014\u001a\u00020\u0013\u0012\u0006\u0010\u0016\u001a\u00020\u0015\u0012\b\u0010\u0018\u001a\u0004\u0018\u00010\u0017\u0012\b\u0010\u001a\u001a\u0004\u0018\u00010\u0019\u0012\b\b\u0002\u0010\u001c\u001a\u00020\u001b\u0012\u0006\u0010\u001e\u001a\u00020\u001d\u0012\u0006\u0010 \u001a\u00020\u001f\u0012\u0006\u0010\"\u001a\u00020!\u0012\u0006\u0010$\u001a\u00020#\u0012\u0006\u0010&\u001a\u00020%\u0012\u0006\u0010(\u001a\u00020'\u0012\b\u0010*\u001a\u0004\u0018\u00010)\u0012\u0006\u0010,\u001a\u00020+\u0012\u0006\u0010.\u001a\u00020-\u0012\n\b\u0002\u00100\u001a\u0004\u0018\u00010/\u0012\u0006\u00102\u001a\u000201\u0012\u0006\u00104\u001a\u000203\u0012\b\b\u0002\u00106\u001a\u000205\u0012\u000e\b\u0002\u00109\u001a\b\u0012\u0004\u0012\u00020807¢\u0006\u0004\b:\u0010;J\u000f\u0010=\u001a\u00020<H\u0016¢\u0006\u0004\b=\u0010>J\u000f\u0010?\u001a\u00020<H\u0016¢\u0006\u0004\b?\u0010>J\u0017\u0010B\u001a\u00020<2\u0006\u0010A\u001a\u00020@H\u0016¢\u0006\u0004\bB\u0010CJ\u001d\u0010H\u001a\u00020<2\u0006\u0010E\u001a\u00020D2\u0006\u0010G\u001a\u00020F¢\u0006\u0004\bH\u0010IJ\u0015\u0010L\u001a\u00020<2\u0006\u0010K\u001a\u00020J¢\u0006\u0004\bL\u0010MJ\u0015\u0010O\u001a\u00020<2\u0006\u0010K\u001a\u00020N¢\u0006\u0004\bO\u0010PJ\u0019\u0010R\u001a\u00020<2\n\b\u0002\u0010G\u001a\u0004\u0018\u00010Q¢\u0006\u0004\bR\u0010SJ9\u0010Z\u001a\u00020<2\u0006\u0010T\u001a\u00020\u00052\u0006\u0010U\u001a\u00020\u00052\u0006\u0010V\u001a\u00020\u00052\b\u0010W\u001a\u0004\u0018\u00010\u00052\b\u0010Y\u001a\u0004\u0018\u00010X¢\u0006\u0004\bZ\u0010[J\u0015\u0010]\u001a\u00020<2\u0006\u0010K\u001a\u00020\\¢\u0006\u0004\b]\u0010^J\u001f\u0010b\u001a\u00020<2\u0006\u0010G\u001a\u00020_2\b\b\u0002\u0010a\u001a\u00020`¢\u0006\u0004\bb\u0010cJ/\u0010i\u001a\u00020<2\f\u0010e\u001a\b\u0012\u0004\u0012\u00020\u00050d2\n\b\u0002\u0010g\u001a\u0004\u0018\u00010f2\u0006\u0010K\u001a\u00020h¢\u0006\u0004\bi\u0010jJ\u001d\u0010n\u001a\u00020<2\u0006\u0010l\u001a\u00020k2\u0006\u0010K\u001a\u00020m¢\u0006\u0004\bn\u0010oJ\u0015\u0010q\u001a\u00020<2\u0006\u0010K\u001a\u00020p¢\u0006\u0004\bq\u0010rJ!\u0010u\u001a\u00020<2\u0006\u0010s\u001a\u00020\u00052\n\b\u0002\u0010K\u001a\u0004\u0018\u00010t¢\u0006\u0004\bu\u0010vJ\u0019\u0010w\u001a\u00020<2\n\b\u0002\u0010K\u001a\u0004\u0018\u00010p¢\u0006\u0004\bw\u0010rJ\r\u0010x\u001a\u00020<¢\u0006\u0004\bx\u0010>J%\u0010|\u001a\u00020<2\u0006\u0010z\u001a\u00020y2\u0006\u0010{\u001a\u00020`2\u0006\u0010K\u001a\u00020p¢\u0006\u0004\b|\u0010}J\r\u0010~\u001a\u00020<¢\u0006\u0004\b~\u0010>J'\u0010\u0081\u0001\u001a\u00020<2\u0006\u0010A\u001a\u00020@2\r\u0010\u0080\u0001\u001a\b\u0012\u0004\u0012\u00020\u007f0d¢\u0006\u0006\b\u0081\u0001\u0010\u0082\u0001J\u000f\u0010\u0083\u0001\u001a\u00020<¢\u0006\u0005\b\u0083\u0001\u0010>J7\u0010\u0086\u0001\u001a\u00020<2\r\u0010e\u001a\t\u0012\u0004\u0012\u00020\u00050\u0084\u00012\u000e\u0010\u0085\u0001\u001a\t\u0012\u0004\u0012\u00020f0\u0084\u00012\u0006\u0010K\u001a\u00020h¢\u0006\u0006\b\u0086\u0001\u0010\u0087\u0001J\u001c\u0010\u008a\u0001\u001a\u00020<2\b\u0010\u0089\u0001\u001a\u00030\u0088\u0001H\u0007¢\u0006\u0006\b\u008a\u0001\u0010\u008b\u0001J\u0019\u0010\u008d\u0001\u001a\u00020<2\u0007\u0010K\u001a\u00030\u008c\u0001¢\u0006\u0006\b\u008d\u0001\u0010\u008e\u0001J(\u0010\u0091\u0001\u001a\u00020<2\u0016\u0010\u0090\u0001\u001a\u0011\u0012\u0004\u0012\u00020\u0005\u0012\u0006\u0012\u0004\u0018\u00010\u00050\u008f\u0001¢\u0006\u0006\b\u0091\u0001\u0010\u0092\u0001J\u001b\u0010\u0094\u0001\u001a\u00020<2\t\u0010\u0093\u0001\u001a\u0004\u0018\u00010\u0005¢\u0006\u0006\b\u0094\u0001\u0010\u0095\u0001J\u001b\u0010\u0097\u0001\u001a\u00020<2\t\u0010\u0096\u0001\u001a\u0004\u0018\u00010\u0005¢\u0006\u0006\b\u0097\u0001\u0010\u0095\u0001J\u001b\u0010\u0099\u0001\u001a\u00020<2\t\u0010\u0098\u0001\u001a\u0004\u0018\u00010\u0005¢\u0006\u0006\b\u0099\u0001\u0010\u0095\u0001J\u001b\u0010\u009b\u0001\u001a\u00020<2\t\u0010\u009a\u0001\u001a\u0004\u0018\u00010\u0005¢\u0006\u0006\b\u009b\u0001\u0010\u0095\u0001J\u001b\u0010\u009d\u0001\u001a\u00020<2\t\u0010\u009c\u0001\u001a\u0004\u0018\u00010\u0005¢\u0006\u0006\b\u009d\u0001\u0010\u0095\u0001J\u001b\u0010\u009f\u0001\u001a\u00020<2\t\u0010\u009e\u0001\u001a\u0004\u0018\u00010\u0005¢\u0006\u0006\b\u009f\u0001\u0010\u0095\u0001J\u001b\u0010¡\u0001\u001a\u00020<2\t\u0010 \u0001\u001a\u0004\u0018\u00010\u0005¢\u0006\u0006\b¡\u0001\u0010\u0095\u0001J\u001b\u0010£\u0001\u001a\u00020<2\t\u0010¢\u0001\u001a\u0004\u0018\u00010\u0005¢\u0006\u0006\b£\u0001\u0010\u0095\u0001J\u001b\u0010¥\u0001\u001a\u00020<2\t\u0010¤\u0001\u001a\u0004\u0018\u00010\u0005¢\u0006\u0006\b¥\u0001\u0010\u0095\u0001J\u001b\u0010§\u0001\u001a\u00020<2\t\u0010¦\u0001\u001a\u0004\u0018\u00010\u0005¢\u0006\u0006\b§\u0001\u0010\u0095\u0001J\u000f\u0010¨\u0001\u001a\u00020<¢\u0006\u0005\b¨\u0001\u0010>J\u001b\u0010ª\u0001\u001a\u00020<2\t\u0010©\u0001\u001a\u0004\u0018\u00010\u0005¢\u0006\u0006\bª\u0001\u0010\u0095\u0001J\u001b\u0010¬\u0001\u001a\u00020<2\t\u0010«\u0001\u001a\u0004\u0018\u00010\u0005¢\u0006\u0006\b¬\u0001\u0010\u0095\u0001J\u001b\u0010®\u0001\u001a\u00020<2\t\u0010\u00ad\u0001\u001a\u0004\u0018\u00010\u0005¢\u0006\u0006\b®\u0001\u0010\u0095\u0001J\u001b\u0010°\u0001\u001a\u00020<2\t\u0010¯\u0001\u001a\u0004\u0018\u00010\u0005¢\u0006\u0006\b°\u0001\u0010\u0095\u0001J\u001b\u0010²\u0001\u001a\u00020<2\t\u0010±\u0001\u001a\u0004\u0018\u00010\u0005¢\u0006\u0006\b²\u0001\u0010\u0095\u0001J\u001b\u0010´\u0001\u001a\u00020<2\t\u0010³\u0001\u001a\u0004\u0018\u00010\u0005¢\u0006\u0006\b´\u0001\u0010\u0095\u0001J\u001b\u0010¶\u0001\u001a\u00020<2\t\u0010µ\u0001\u001a\u0004\u0018\u00010\u0005¢\u0006\u0006\b¶\u0001\u0010\u0095\u0001J\u001b\u0010¸\u0001\u001a\u00020<2\t\u0010·\u0001\u001a\u0004\u0018\u00010\u0005¢\u0006\u0006\b¸\u0001\u0010\u0095\u0001J\u001b\u0010º\u0001\u001a\u00020<2\t\u0010¹\u0001\u001a\u0004\u0018\u00010\u0005¢\u0006\u0006\bº\u0001\u0010\u0095\u0001J\u001b\u0010¼\u0001\u001a\u00020<2\t\u0010»\u0001\u001a\u0004\u0018\u00010\u0005¢\u0006\u0006\b¼\u0001\u0010\u0095\u0001J\u001b\u0010¾\u0001\u001a\u00020<2\t\u0010½\u0001\u001a\u0004\u0018\u00010\u0005¢\u0006\u0006\b¾\u0001\u0010\u0095\u0001J\u001b\u0010À\u0001\u001a\u00020<2\t\u0010¿\u0001\u001a\u0004\u0018\u00010\u0005¢\u0006\u0006\bÀ\u0001\u0010\u0095\u0001J\u0018\u0010Á\u0001\u001a\u00020<2\u0006\u0010s\u001a\u00020\u0005¢\u0006\u0006\bÁ\u0001\u0010\u0095\u0001JA\u0010Ç\u0001\u001a\u00020<2\u0006\u0010A\u001a\u00020@2\b\u0010Ã\u0001\u001a\u00030Â\u00012\n\u0010Å\u0001\u001a\u0005\u0018\u00010Ä\u00012\t\u0010Æ\u0001\u001a\u0004\u0018\u00010`2\u0006\u0010G\u001a\u00020m¢\u0006\u0006\bÇ\u0001\u0010È\u0001JU\u0010Í\u0001\u001a\u00020<2\u0006\u0010A\u001a\u00020@2\b\u0010Ã\u0001\u001a\u00030Â\u00012\n\u0010Å\u0001\u001a\u0005\u0018\u00010Ä\u00012\u0007\u0010É\u0001\u001a\u00020\u00052\b\u0010Ë\u0001\u001a\u00030Ê\u00012\t\u0010Æ\u0001\u001a\u0004\u0018\u00010`2\u0007\u0010Ì\u0001\u001a\u00020m¢\u0006\u0006\bÍ\u0001\u0010Î\u0001JL\u0010Ð\u0001\u001a\u00020<2\u0006\u0010A\u001a\u00020@2\b\u0010Ã\u0001\u001a\u00030Â\u00012\n\u0010Å\u0001\u001a\u0005\u0018\u00010Ä\u00012\u0007\u0010É\u0001\u001a\u00020\u00052\n\u0010Ë\u0001\u001a\u0005\u0018\u00010Ê\u00012\u0007\u0010G\u001a\u00030Ï\u0001¢\u0006\u0006\bÐ\u0001\u0010Ñ\u0001J\u0017\u0010|\u001a\u00020<2\u0006\u0010K\u001a\u00020pH\u0002¢\u0006\u0004\b|\u0010rJ!\u0010Ó\u0001\u001a\u00020<2\r\u0010Ò\u0001\u001a\b\u0012\u0004\u0012\u00020<07H\u0002¢\u0006\u0006\bÓ\u0001\u0010Ô\u0001J\u001b\u0010Ö\u0001\u001a\u00020`2\u0007\u0010Õ\u0001\u001a\u00020`H\u0002¢\u0006\u0006\bÖ\u0001\u0010×\u0001JW\u0010\u0086\u0001\u001a\u00020<2\r\u0010e\u001a\t\u0012\u0004\u0012\u00020\u00050\u0084\u00012\u000e\u0010\u0085\u0001\u001a\t\u0012\u0004\u0012\u00020f0\u0084\u00012\u000e\u0010Ù\u0001\u001a\t\u0012\u0005\u0012\u00030Ø\u00010d2\f\b\u0002\u0010Û\u0001\u001a\u0005\u0018\u00010Ú\u00012\u0006\u0010K\u001a\u00020hH\u0002¢\u0006\u0006\b\u0086\u0001\u0010Ü\u0001J(\u0010ß\u0001\u001a\u00020<2\u0007\u0010Ý\u0001\u001a\u00020\u00052\u000b\b\u0002\u0010Þ\u0001\u001a\u0004\u0018\u00010pH\u0002¢\u0006\u0006\bß\u0001\u0010à\u0001J!\u0010â\u0001\u001a\u00020<2\r\u0010á\u0001\u001a\b\u0012\u0004\u0012\u00020<07H\u0002¢\u0006\u0006\bâ\u0001\u0010Ô\u0001J\u001d\u0010ä\u0001\u001a\u0004\u0018\u00010m2\u0007\u0010ã\u0001\u001a\u00020\u0005H\u0002¢\u0006\u0006\bä\u0001\u0010å\u0001J\u0015\u0010æ\u0001\u001a\u0005\u0018\u00010Ï\u0001H\u0002¢\u0006\u0006\bæ\u0001\u0010ç\u0001J\u0013\u0010é\u0001\u001a\u00030è\u0001H\u0002¢\u0006\u0006\bé\u0001\u0010ê\u0001J\u0018\u0010ë\u0001\u001a\b\u0012\u0004\u0012\u00020m0dH\u0002¢\u0006\u0006\bë\u0001\u0010ì\u0001JS\u0010ô\u0001\u001aC\u0012\u001e\u0012\u001c\u0012\u0005\u0012\u00030ï\u0001\u0012\u0005\u0012\u00030ð\u0001\u0012\u0004\u0012\u00020<0î\u0001j\u0003`ñ\u0001\u0012\u001e\u0012\u001c\u0012\u0005\u0012\u00030ï\u0001\u0012\u0005\u0012\u00030ò\u0001\u0012\u0004\u0012\u00020<0î\u0001j\u0003`ó\u00010í\u0001H\u0002¢\u0006\u0006\bô\u0001\u0010õ\u0001J_\u0010÷\u0001\u001aC\u0012\u001e\u0012\u001c\u0012\u0005\u0012\u00030ï\u0001\u0012\u0005\u0012\u00030ð\u0001\u0012\u0004\u0012\u00020<0î\u0001j\u0003`ñ\u0001\u0012\u001e\u0012\u001c\u0012\u0005\u0012\u00030ï\u0001\u0012\u0005\u0012\u00030ò\u0001\u0012\u0004\u0012\u00020<0î\u0001j\u0003`ó\u00010í\u00012\n\u0010ö\u0001\u001a\u0005\u0018\u00010Ï\u0001H\u0002¢\u0006\u0006\b÷\u0001\u0010ø\u0001J!\u0010â\u0001\u001a\u00020<*\u00030ù\u00012\b\u0010ú\u0001\u001a\u00030ò\u0001H\u0002¢\u0006\u0006\bâ\u0001\u0010û\u0001Jb\u0010ü\u0001\u001a\u00020<2\b\u0010Ã\u0001\u001a\u00030Â\u00012\u0007\u0010É\u0001\u001a\u00020\u00052\n\u0010Ë\u0001\u001a\u0005\u0018\u00010Ê\u00012\u0006\u0010A\u001a\u00020@2\u0007\u0010Ý\u0001\u001a\u00020\u00052\n\u0010Å\u0001\u001a\u0005\u0018\u00010Ä\u00012\t\u0010Æ\u0001\u001a\u0004\u0018\u00010`2\u0007\u0010G\u001a\u00030ù\u0001H\u0002¢\u0006\u0006\bü\u0001\u0010ý\u0001J\u0011\u0010þ\u0001\u001a\u00020<H\u0002¢\u0006\u0005\bþ\u0001\u0010>J\u0011\u0010ÿ\u0001\u001a\u00020<H\u0002¢\u0006\u0005\bÿ\u0001\u0010>J/\u0010\u0081\u0002\u001a\u00020m2\u0007\u0010\u0080\u0002\u001a\u00020m2\b\u0010Ã\u0001\u001a\u00030Â\u00012\b\u0010Û\u0001\u001a\u00030Ú\u0001H\u0002¢\u0006\u0006\b\u0081\u0002\u0010\u0082\u0002J\"\u0010\u0084\u0002\u001a\u00020<2\u000e\u0010\u0083\u0002\u001a\t\u0012\u0004\u0012\u00020\u00050\u0084\u0001H\u0002¢\u0006\u0006\b\u0084\u0002\u0010\u0085\u0002JH\u0010\u0087\u0002\u001a\u00020<2\b\u0010Û\u0001\u001a\u00030Ú\u00012\u000e\u0010\u0083\u0002\u001a\t\u0012\u0004\u0012\u00020\u00050\u0084\u00012\u000e\u0010\u0086\u0002\u001a\t\u0012\u0004\u0012\u00020\u00050\u0084\u00012\n\u0010ú\u0001\u001a\u0005\u0018\u00010ò\u0001H\u0002¢\u0006\u0006\b\u0087\u0002\u0010\u0088\u0002J$\u0010\u008a\u0002\u001a\u00020<2\u0007\u0010ã\u0001\u001a\u00020\u00052\u0007\u0010\u0089\u0002\u001a\u00020fH\u0002¢\u0006\u0006\b\u008a\u0002\u0010\u008b\u0002J>\u0010\u008e\u0002\u001a\u00020<2\b\u0010Ã\u0001\u001a\u00030Â\u00012\n\u0010ú\u0001\u001a\u0005\u0018\u00010ò\u00012\b\u0010Û\u0001\u001a\u00030Ú\u00012\n\u0010\u008d\u0002\u001a\u0005\u0018\u00010\u008c\u0002H\u0002¢\u0006\u0006\b\u008e\u0002\u0010\u008f\u0002R\u0015\u0010\u0004\u001a\u00020\u00038\u0002X\u0082\u0004¢\u0006\u0007\n\u0005\b\u0004\u0010\u0090\u0002R\u0015\u0010\b\u001a\u00020\u00078\u0002X\u0082\u0004¢\u0006\u0007\n\u0005\b\b\u0010\u0091\u0002R\u0015\u0010\n\u001a\u00020\t8\u0002X\u0082\u0004¢\u0006\u0007\n\u0005\b\n\u0010\u0092\u0002R\u0015\u0010\f\u001a\u00020\u000b8\u0002X\u0082\u0004¢\u0006\u0007\n\u0005\b\f\u0010\u0093\u0002R\u0015\u0010\u000e\u001a\u00020\r8\u0002X\u0082\u0004¢\u0006\u0007\n\u0005\b\u000e\u0010\u0094\u0002R\u0015\u0010\u0010\u001a\u00020\u000f8\u0002X\u0082\u0004¢\u0006\u0007\n\u0005\b\u0010\u0010\u0095\u0002R'\u0010\u0012\u001a\u00020\u00118\u0006@\u0006X\u0086\u000e¢\u0006\u0017\n\u0005\b\u0012\u0010\u0096\u0002\u001a\u0006\b\u0097\u0002\u0010\u0098\u0002\"\u0006\b\u0099\u0002\u0010\u009a\u0002R\u0015\u0010\u0014\u001a\u00020\u00138\u0002X\u0082\u0004¢\u0006\u0007\n\u0005\b\u0014\u0010\u009b\u0002R\u0015\u0010\u0016\u001a\u00020\u00158\u0002X\u0082\u0004¢\u0006\u0007\n\u0005\b\u0016\u0010\u009c\u0002R\u0017\u0010\u0018\u001a\u0004\u0018\u00010\u00178\u0002X\u0082\u0004¢\u0006\u0007\n\u0005\b\u0018\u0010\u009d\u0002R\u0017\u0010\u001a\u001a\u0004\u0018\u00010\u00198\u0002X\u0082\u0004¢\u0006\u0007\n\u0005\b\u001a\u0010\u009e\u0002R\u0015\u0010\u001c\u001a\u00020\u001b8\u0002X\u0082\u0004¢\u0006\u0007\n\u0005\b\u001c\u0010\u009f\u0002R\u001a\u0010\u001e\u001a\u00020\u001d8\u0007¢\u0006\u000f\n\u0005\b\u001e\u0010 \u0002\u001a\u0006\b¡\u0002\u0010¢\u0002R\u0015\u0010 \u001a\u00020\u001f8\u0002X\u0082\u0004¢\u0006\u0007\n\u0005\b \u0010£\u0002R\u0015\u0010\"\u001a\u00020!8\u0002X\u0082\u0004¢\u0006\u0007\n\u0005\b\"\u0010¤\u0002R\u0015\u0010$\u001a\u00020#8\u0002X\u0082\u0004¢\u0006\u0007\n\u0005\b$\u0010¥\u0002R\u0015\u0010&\u001a\u00020%8\u0002X\u0082\u0004¢\u0006\u0007\n\u0005\b&\u0010¦\u0002R\u0015\u0010(\u001a\u00020'8\u0002X\u0082\u0004¢\u0006\u0007\n\u0005\b(\u0010§\u0002R\u0017\u0010*\u001a\u0004\u0018\u00010)8\u0002X\u0082\u0004¢\u0006\u0007\n\u0005\b*\u0010¨\u0002R\u0015\u0010,\u001a\u00020+8\u0002X\u0082\u0004¢\u0006\u0007\n\u0005\b,\u0010©\u0002R\u0015\u0010.\u001a\u00020-8\u0002X\u0082\u0004¢\u0006\u0007\n\u0005\b.\u0010ª\u0002R\u0017\u00100\u001a\u0004\u0018\u00010/8\u0002X\u0082\u0004¢\u0006\u0007\n\u0005\b0\u0010«\u0002R\u0015\u00102\u001a\u0002018\u0002X\u0082\u0004¢\u0006\u0007\n\u0005\b2\u0010¬\u0002R\u0015\u00104\u001a\u0002038\u0002X\u0082\u0004¢\u0006\u0007\n\u0005\b4\u0010\u00ad\u0002R\u0015\u00106\u001a\u0002058\u0002X\u0082\u0004¢\u0006\u0007\n\u0005\b6\u0010®\u0002R \u00109\u001a\b\u0012\u0004\u0012\u000208078\u0006¢\u0006\u000f\n\u0005\b9\u0010¯\u0002\u001a\u0006\b°\u0002\u0010±\u0002R8\u0010´\u0002\u001a\u0005\u0018\u00010²\u00022\n\u0010³\u0002\u001a\u0005\u0018\u00010²\u00028F@FX\u0086\u000e¢\u0006\u0018\n\u0006\b´\u0002\u0010µ\u0002\u001a\u0006\b¶\u0002\u0010·\u0002\"\u0006\b¸\u0002\u0010¹\u0002R!\u0010¿\u0002\u001a\u00030º\u00028BX\u0082\u0084\u0002¢\u0006\u0010\n\u0006\b»\u0002\u0010¼\u0002\u001a\u0006\b½\u0002\u0010¾\u0002R\u0018\u0010Á\u0002\u001a\u00030À\u00028\u0002X\u0082\u0004¢\u0006\b\n\u0006\bÁ\u0002\u0010Â\u0002R-\u0010Ã\u0002\u001a\u0004\u0018\u00010\u00052\t\u0010³\u0002\u001a\u0004\u0018\u00010\u00058\u0006@BX\u0086\u000e¢\u0006\u000f\n\u0006\bÃ\u0002\u0010Ä\u0002\u001a\u0005\bL\u0010Å\u0002R,\u0010Ì\u0002\u001a\u00030Æ\u00022\b\u0010Ç\u0002\u001a\u00030Æ\u00028@@@X\u0080\u000e¢\u0006\u0010\u001a\u0006\bÈ\u0002\u0010É\u0002\"\u0006\bÊ\u0002\u0010Ë\u0002R\u0014\u0010Ï\u0002\u001a\u0002038F¢\u0006\b\u001a\u0006\bÍ\u0002\u0010Î\u0002R*\u0010Ô\u0002\u001a\u00020`2\u0007\u0010Ç\u0002\u001a\u00020`8F@FX\u0086\u000e¢\u0006\u0010\u001a\u0006\bÐ\u0002\u0010Ñ\u0002\"\u0006\bÒ\u0002\u0010Ó\u0002R\u0014\u0010Ý\u0001\u001a\u00020\u00058F¢\u0006\b\u001a\u0006\bÕ\u0002\u0010Å\u0002R0\u0010Û\u0002\u001a\u0005\u0018\u00010Ö\u00022\n\u0010Ç\u0002\u001a\u0005\u0018\u00010Ö\u00028F@FX\u0086\u000e¢\u0006\u0010\u001a\u0006\b×\u0002\u0010Ø\u0002\"\u0006\bÙ\u0002\u0010Ú\u0002R\u0014\u0010Ü\u0002\u001a\u00020`8F¢\u0006\b\u001a\u0006\bÜ\u0002\u0010Ñ\u0002R\u0015\u0010à\u0002\u001a\u00030Ý\u00028F¢\u0006\b\u001a\u0006\bÞ\u0002\u0010ß\u0002R*\u0010ã\u0002\u001a\u00020`2\u0007\u0010Ç\u0002\u001a\u00020`8F@FX\u0086\u000e¢\u0006\u0010\u001a\u0006\bá\u0002\u0010Ñ\u0002\"\u0006\bâ\u0002\u0010Ó\u0002¨\u0006å\u0002"}, d2 = {"Lcom/revenuecat/purchases/PurchasesOrchestrator;", "Lcom/revenuecat/purchases/LifecycleDelegate;", "Lcom/revenuecat/purchases/utils/CustomActivityLifecycleHandler;", "Landroid/app/Application;", "application", "", "backingFieldAppUserID", "Lcom/revenuecat/purchases/common/Backend;", "backend", "Lcom/revenuecat/purchases/common/BillingAbstract;", "billing", "Lcom/revenuecat/purchases/common/caching/DeviceCache;", "deviceCache", "Lcom/revenuecat/purchases/identity/IdentityManager;", "identityManager", "Lcom/revenuecat/purchases/subscriberattributes/SubscriberAttributesManager;", "subscriberAttributesManager", "Lcom/revenuecat/purchases/common/AppConfig;", "appConfig", "Lcom/revenuecat/purchases/CustomerInfoHelper;", "customerInfoHelper", "Lcom/revenuecat/purchases/CustomerInfoUpdateHandler;", "customerInfoUpdateHandler", "Lcom/revenuecat/purchases/common/diagnostics/DiagnosticsSynchronizer;", "diagnosticsSynchronizer", "Lcom/revenuecat/purchases/common/diagnostics/DiagnosticsTracker;", "diagnosticsTrackerIfEnabled", "Lcom/revenuecat/purchases/common/DateProvider;", "dateProvider", "Lcom/revenuecat/purchases/common/offlineentitlements/OfflineEntitlementsManager;", "offlineEntitlementsManager", "Lcom/revenuecat/purchases/PostReceiptHelper;", "postReceiptHelper", "Lcom/revenuecat/purchases/PostTransactionWithProductDetailsHelper;", "postTransactionWithProductDetailsHelper", "Lcom/revenuecat/purchases/PostPendingTransactionsHelper;", "postPendingTransactionsHelper", "Lcom/revenuecat/purchases/SyncPurchasesHelper;", "syncPurchasesHelper", "Lcom/revenuecat/purchases/common/offerings/OfferingsManager;", "offeringsManager", "Lcom/revenuecat/purchases/common/events/EventsManager;", "eventsManager", "Lcom/revenuecat/purchases/paywalls/PaywallPresentedCache;", "paywallPresentedCache", "Lcom/revenuecat/purchases/PurchasesStateCache;", "purchasesStateCache", "Landroid/os/Handler;", "mainHandler", "Lcom/revenuecat/purchases/common/Dispatcher;", "dispatcher", "Lcom/revenuecat/purchases/PurchasesConfiguration;", "initialConfiguration", "Lcom/revenuecat/purchases/deeplinks/WebPurchaseRedemptionHelper;", "webPurchaseRedemptionHelper", "Lkotlin/Function0;", "Landroidx/lifecycle/D;", "processLifecycleOwnerProvider", "<init>", "(Landroid/app/Application;Ljava/lang/String;Lcom/revenuecat/purchases/common/Backend;Lcom/revenuecat/purchases/common/BillingAbstract;Lcom/revenuecat/purchases/common/caching/DeviceCache;Lcom/revenuecat/purchases/identity/IdentityManager;Lcom/revenuecat/purchases/subscriberattributes/SubscriberAttributesManager;Lcom/revenuecat/purchases/common/AppConfig;Lcom/revenuecat/purchases/CustomerInfoHelper;Lcom/revenuecat/purchases/CustomerInfoUpdateHandler;Lcom/revenuecat/purchases/common/diagnostics/DiagnosticsSynchronizer;Lcom/revenuecat/purchases/common/diagnostics/DiagnosticsTracker;Lcom/revenuecat/purchases/common/DateProvider;Lcom/revenuecat/purchases/common/offlineentitlements/OfflineEntitlementsManager;Lcom/revenuecat/purchases/PostReceiptHelper;Lcom/revenuecat/purchases/PostTransactionWithProductDetailsHelper;Lcom/revenuecat/purchases/PostPendingTransactionsHelper;Lcom/revenuecat/purchases/SyncPurchasesHelper;Lcom/revenuecat/purchases/common/offerings/OfferingsManager;Lcom/revenuecat/purchases/common/events/EventsManager;Lcom/revenuecat/purchases/paywalls/PaywallPresentedCache;Lcom/revenuecat/purchases/PurchasesStateCache;Landroid/os/Handler;Lcom/revenuecat/purchases/common/Dispatcher;Lcom/revenuecat/purchases/PurchasesConfiguration;Lcom/revenuecat/purchases/deeplinks/WebPurchaseRedemptionHelper;Lkotlin/jvm/functions/Function0;)V", "", "onAppBackgrounded", "()V", "onAppForegrounded", "Landroid/app/Activity;", "activity", "onActivityStarted", "(Landroid/app/Activity;)V", "Lcom/revenuecat/purchases/WebPurchaseRedemption;", "webPurchaseRedemption", "Lcom/revenuecat/purchases/interfaces/RedeemWebPurchaseListener;", "listener", "redeemWebPurchase", "(Lcom/revenuecat/purchases/WebPurchaseRedemption;Lcom/revenuecat/purchases/interfaces/RedeemWebPurchaseListener;)V", "Lcom/revenuecat/purchases/interfaces/GetStorefrontCallback;", "callback", "getStorefrontCountryCode", "(Lcom/revenuecat/purchases/interfaces/GetStorefrontCallback;)V", "Lcom/revenuecat/purchases/interfaces/SyncAttributesAndOfferingsCallback;", "syncAttributesAndOfferingsIfNeeded", "(Lcom/revenuecat/purchases/interfaces/SyncAttributesAndOfferingsCallback;)V", "Lcom/revenuecat/purchases/interfaces/SyncPurchasesCallback;", "syncPurchases", "(Lcom/revenuecat/purchases/interfaces/SyncPurchasesCallback;)V", "productID", "receiptID", "amazonUserID", "isoCurrencyCode", "", "price", "syncAmazonPurchase", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Double;)V", "Lcom/revenuecat/purchases/interfaces/GetAmazonLWAConsentStatusCallback;", "getAmazonLWAConsentStatus", "(Lcom/revenuecat/purchases/interfaces/GetAmazonLWAConsentStatusCallback;)V", "Lcom/revenuecat/purchases/interfaces/ReceiveOfferingsCallback;", "", "fetchCurrent", "getOfferings", "(Lcom/revenuecat/purchases/interfaces/ReceiveOfferingsCallback;Z)V", "", "productIds", "Lcom/revenuecat/purchases/ProductType;", "type", "Lcom/revenuecat/purchases/interfaces/GetStoreProductsCallback;", "getProducts", "(Ljava/util/List;Lcom/revenuecat/purchases/ProductType;Lcom/revenuecat/purchases/interfaces/GetStoreProductsCallback;)V", "Lcom/revenuecat/purchases/PurchaseParams;", "purchaseParams", "Lcom/revenuecat/purchases/interfaces/PurchaseCallback;", "purchase", "(Lcom/revenuecat/purchases/PurchaseParams;Lcom/revenuecat/purchases/interfaces/PurchaseCallback;)V", "Lcom/revenuecat/purchases/interfaces/ReceiveCustomerInfoCallback;", "restorePurchases", "(Lcom/revenuecat/purchases/interfaces/ReceiveCustomerInfoCallback;)V", "newAppUserID", "Lcom/revenuecat/purchases/interfaces/LogInCallback;", "logIn", "(Ljava/lang/String;Lcom/revenuecat/purchases/interfaces/LogInCallback;)V", "logOut", "close", "Lcom/revenuecat/purchases/CacheFetchPolicy;", "fetchPolicy", "trackDiagnostics", "getCustomerInfo", "(Lcom/revenuecat/purchases/CacheFetchPolicy;ZLcom/revenuecat/purchases/interfaces/ReceiveCustomerInfoCallback;)V", "removeUpdatedCustomerInfoListener", "Lcom/revenuecat/purchases/models/InAppMessageType;", "inAppMessageTypes", "showInAppMessagesIfNeeded", "(Landroid/app/Activity;Ljava/util/List;)V", "invalidateCustomerInfoCache", "", "types", "getProductsOfTypes", "(Ljava/util/Set;Ljava/util/Set;Lcom/revenuecat/purchases/interfaces/GetStoreProductsCallback;)V", "Lcom/revenuecat/purchases/common/events/FeatureEvent;", "event", "track", "(Lcom/revenuecat/purchases/common/events/FeatureEvent;)V", "Lcom/revenuecat/purchases/interfaces/GetCustomerCenterConfigCallback;", "getCustomerCenterConfig", "(Lcom/revenuecat/purchases/interfaces/GetCustomerCenterConfigCallback;)V", "", "attributes", "setAttributes", "(Ljava/util/Map;)V", "email", "setEmail", "(Ljava/lang/String;)V", "phoneNumber", "setPhoneNumber", "displayName", "setDisplayName", "fcmToken", "setPushToken", "mixpanelDistinctID", "setMixpanelDistinctID", "onesignalID", "setOnesignalID", "onesignalUserID", "setOnesignalUserID", "airshipChannelID", "setAirshipChannelID", "firebaseAppInstanceID", "setFirebaseAppInstanceID", "tenjinAnalyticsInstallationID", "setTenjinAnalyticsInstallationID", "collectDeviceIdentifiers", "adjustID", "setAdjustID", "appsflyerID", "setAppsflyerID", "fbAnonymousID", "setFBAnonymousID", "mparticleID", "setMparticleID", "cleverTapID", "setCleverTapID", "kochavaDeviceID", "setKochavaDeviceID", "mediaSource", "setMediaSource", "campaign", "setCampaign", "adGroup", "setAdGroup", "ad", "setAd", "keyword", "setKeyword", "creative", "setCreative", "switchUser", "Lcom/revenuecat/purchases/models/PurchasingData;", "purchasingData", "Lcom/revenuecat/purchases/PresentedOfferingContext;", "presentedOfferingContext", "isPersonalizedPrice", "startPurchase", "(Landroid/app/Activity;Lcom/revenuecat/purchases/models/PurchasingData;Lcom/revenuecat/purchases/PresentedOfferingContext;Ljava/lang/Boolean;Lcom/revenuecat/purchases/interfaces/PurchaseCallback;)V", "oldProductId", "Lcom/revenuecat/purchases/models/GoogleReplacementMode;", "googleReplacementMode", "purchaseCallback", "startProductChange", "(Landroid/app/Activity;Lcom/revenuecat/purchases/models/PurchasingData;Lcom/revenuecat/purchases/PresentedOfferingContext;Ljava/lang/String;Lcom/revenuecat/purchases/models/GoogleReplacementMode;Ljava/lang/Boolean;Lcom/revenuecat/purchases/interfaces/PurchaseCallback;)V", "Lcom/revenuecat/purchases/interfaces/ProductChangeCallback;", "startDeprecatedProductChange", "(Landroid/app/Activity;Lcom/revenuecat/purchases/models/PurchasingData;Lcom/revenuecat/purchases/PresentedOfferingContext;Ljava/lang/String;Lcom/revenuecat/purchases/models/GoogleReplacementMode;Lcom/revenuecat/purchases/interfaces/ProductChangeCallback;)V", "command", "enqueue", "(Lkotlin/jvm/functions/Function0;)V", "firstTimeInForeground", "shouldRefreshCustomerInfo", "(Z)Z", "Lcom/revenuecat/purchases/models/StoreProduct;", "collectedStoreProducts", "Ljava/util/Date;", "startTime", "(Ljava/util/Set;Ljava/util/Set;Ljava/util/List;Ljava/util/Date;Lcom/revenuecat/purchases/interfaces/GetStoreProductsCallback;)V", "appUserID", "completion", "updateAllCaches", "(Ljava/lang/String;Lcom/revenuecat/purchases/interfaces/ReceiveCustomerInfoCallback;)V", "action", "dispatch", "productId", "getPurchaseCallback", "(Ljava/lang/String;)Lcom/revenuecat/purchases/interfaces/PurchaseCallback;", "getAndClearProductChangeCallback", "()Lcom/revenuecat/purchases/interfaces/ProductChangeCallback;", "Lcom/revenuecat/purchases/common/BillingAbstract$PurchasesUpdatedListener;", "getPurchasesUpdatedListener", "()Lcom/revenuecat/purchases/common/BillingAbstract$PurchasesUpdatedListener;", "getAndClearAllPurchaseCallbacks", "()Ljava/util/List;", "Landroid/util/Pair;", "Lkotlin/Function2;", "Lcom/revenuecat/purchases/models/StoreTransaction;", "Lcom/revenuecat/purchases/CustomerInfo;", "Lcom/revenuecat/purchases/SuccessfulPurchaseCallback;", "Lcom/revenuecat/purchases/PurchasesError;", "Lcom/revenuecat/purchases/ErrorPurchaseCallback;", "getPurchaseCompletedCallbacks", "()Landroid/util/Pair;", "productChangeListener", "getProductChangeCompletedCallbacks", "(Lcom/revenuecat/purchases/interfaces/ProductChangeCallback;)Landroid/util/Pair;", "Lcom/revenuecat/purchases/interfaces/PurchaseErrorCallback;", "error", "(Lcom/revenuecat/purchases/interfaces/PurchaseErrorCallback;Lcom/revenuecat/purchases/PurchasesError;)V", "replaceOldPurchaseWithNewProduct", "(Lcom/revenuecat/purchases/models/PurchasingData;Ljava/lang/String;Lcom/revenuecat/purchases/models/GoogleReplacementMode;Landroid/app/Activity;Ljava/lang/String;Lcom/revenuecat/purchases/PresentedOfferingContext;Ljava/lang/Boolean;Lcom/revenuecat/purchases/interfaces/PurchaseErrorCallback;)V", "synchronizeSubscriberAttributesIfNeeded", "flushPaywallEvents", "originalCallback", "createCallbackWithDiagnosticsIfNeeded", "(Lcom/revenuecat/purchases/interfaces/PurchaseCallback;Lcom/revenuecat/purchases/models/PurchasingData;Ljava/util/Date;)Lcom/revenuecat/purchases/interfaces/PurchaseCallback;", "requestedProductIds", "trackGetProductsStarted", "(Ljava/util/Set;)V", "notFoundProductIds", "trackGetProductsResult", "(Ljava/util/Date;Ljava/util/Set;Ljava/util/Set;Lcom/revenuecat/purchases/PurchasesError;)V", "productType", "trackPurchaseStarted", "(Ljava/lang/String;Lcom/revenuecat/purchases/ProductType;)V", "Lcom/revenuecat/purchases/VerificationResult;", "verificationResult", "trackPurchaseResultIfNeeded", "(Lcom/revenuecat/purchases/models/PurchasingData;Lcom/revenuecat/purchases/PurchasesError;Ljava/util/Date;Lcom/revenuecat/purchases/VerificationResult;)V", "Landroid/app/Application;", "Lcom/revenuecat/purchases/common/Backend;", "Lcom/revenuecat/purchases/common/BillingAbstract;", "Lcom/revenuecat/purchases/common/caching/DeviceCache;", "Lcom/revenuecat/purchases/identity/IdentityManager;", "Lcom/revenuecat/purchases/subscriberattributes/SubscriberAttributesManager;", "Lcom/revenuecat/purchases/common/AppConfig;", "getAppConfig", "()Lcom/revenuecat/purchases/common/AppConfig;", "setAppConfig", "(Lcom/revenuecat/purchases/common/AppConfig;)V", "Lcom/revenuecat/purchases/CustomerInfoHelper;", "Lcom/revenuecat/purchases/CustomerInfoUpdateHandler;", "Lcom/revenuecat/purchases/common/diagnostics/DiagnosticsSynchronizer;", "Lcom/revenuecat/purchases/common/diagnostics/DiagnosticsTracker;", "Lcom/revenuecat/purchases/common/DateProvider;", "Lcom/revenuecat/purchases/common/offlineentitlements/OfflineEntitlementsManager;", "getOfflineEntitlementsManager", "()Lcom/revenuecat/purchases/common/offlineentitlements/OfflineEntitlementsManager;", "Lcom/revenuecat/purchases/PostReceiptHelper;", "Lcom/revenuecat/purchases/PostTransactionWithProductDetailsHelper;", "Lcom/revenuecat/purchases/PostPendingTransactionsHelper;", "Lcom/revenuecat/purchases/SyncPurchasesHelper;", "Lcom/revenuecat/purchases/common/offerings/OfferingsManager;", "Lcom/revenuecat/purchases/common/events/EventsManager;", "Lcom/revenuecat/purchases/paywalls/PaywallPresentedCache;", "Lcom/revenuecat/purchases/PurchasesStateCache;", "Landroid/os/Handler;", "Lcom/revenuecat/purchases/common/Dispatcher;", "Lcom/revenuecat/purchases/PurchasesConfiguration;", "Lcom/revenuecat/purchases/deeplinks/WebPurchaseRedemptionHelper;", "Lkotlin/jvm/functions/Function0;", "getProcessLifecycleOwnerProvider", "()Lkotlin/jvm/functions/Function0;", "Lcom/revenuecat/purchases/customercenter/CustomerCenterListener;", "<set-?>", "customerCenterListener", "Lcom/revenuecat/purchases/customercenter/CustomerCenterListener;", "getCustomerCenterListener", "()Lcom/revenuecat/purchases/customercenter/CustomerCenterListener;", "setCustomerCenterListener", "(Lcom/revenuecat/purchases/customercenter/CustomerCenterListener;)V", "Lcom/revenuecat/purchases/AppLifecycleHandler;", "lifecycleHandler$delegate", "Lkotlin/Lazy;", "getLifecycleHandler", "()Lcom/revenuecat/purchases/AppLifecycleHandler;", "lifecycleHandler", "Lcom/revenuecat/purchases/utils/RateLimiter;", "lastSyncAttributesAndOfferingsRateLimiter", "Lcom/revenuecat/purchases/utils/RateLimiter;", "storefrontCountryCode", "Ljava/lang/String;", "()Ljava/lang/String;", "Lcom/revenuecat/purchases/PurchasesState;", "value", "getState$purchases_defaultsRelease", "()Lcom/revenuecat/purchases/PurchasesState;", "setState$purchases_defaultsRelease", "(Lcom/revenuecat/purchases/PurchasesState;)V", "state", "getCurrentConfiguration", "()Lcom/revenuecat/purchases/PurchasesConfiguration;", "currentConfiguration", "getFinishTransactions", "()Z", "setFinishTransactions", "(Z)V", "finishTransactions", "getAppUserID", "Lcom/revenuecat/purchases/interfaces/UpdatedCustomerInfoListener;", "getUpdatedCustomerInfoListener", "()Lcom/revenuecat/purchases/interfaces/UpdatedCustomerInfoListener;", "setUpdatedCustomerInfoListener", "(Lcom/revenuecat/purchases/interfaces/UpdatedCustomerInfoListener;)V", "updatedCustomerInfoListener", "isAnonymous", "Lcom/revenuecat/purchases/Store;", "getStore", "()Lcom/revenuecat/purchases/Store;", "store", "getAllowSharingPlayStoreAccount", "setAllowSharingPlayStoreAccount", "allowSharingPlayStoreAccount", "Companion", "purchases_defaultsRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
@SourceDebugExtension
public final class PurchasesOrchestrator implements LifecycleDelegate, CustomActivityLifecycleHandler {
    private static f cachedImageLoader = null;
    public static final String frameworkVersion = "8.17.0";
    private static URL proxyURL;
    private AppConfig appConfig;
    private final Application application;
    private final Backend backend;
    private final BillingAbstract billing;
    private CustomerCenterListener customerCenterListener;
    private final CustomerInfoHelper customerInfoHelper;
    private final CustomerInfoUpdateHandler customerInfoUpdateHandler;
    private final DateProvider dateProvider;
    private final DeviceCache deviceCache;
    private final DiagnosticsSynchronizer diagnosticsSynchronizer;
    private final DiagnosticsTracker diagnosticsTrackerIfEnabled;
    private final Dispatcher dispatcher;
    private final EventsManager eventsManager;
    private final IdentityManager identityManager;
    private final PurchasesConfiguration initialConfiguration;
    private final RateLimiter lastSyncAttributesAndOfferingsRateLimiter;

    private final Lazy lifecycleHandler;
    private final Handler mainHandler;
    private final OfferingsManager offeringsManager;
    private final OfflineEntitlementsManager offlineEntitlementsManager;
    private final PaywallPresentedCache paywallPresentedCache;
    private final PostPendingTransactionsHelper postPendingTransactionsHelper;
    private final PostReceiptHelper postReceiptHelper;
    private final PostTransactionWithProductDetailsHelper postTransactionWithProductDetailsHelper;
    private final Function0<D> processLifecycleOwnerProvider;
    private final PurchasesStateCache purchasesStateCache;
    private String storefrontCountryCode;
    private final SubscriberAttributesManager subscriberAttributesManager;
    private final SyncPurchasesHelper syncPurchasesHelper;
    private final WebPurchaseRedemptionHelper webPurchaseRedemptionHelper;

    public static final Companion INSTANCE = new Companion(null);
    private static PlatformInfo platformInfo = new PlatformInfo("native", null);

    @Metadata(d1 = {"\u0000^\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\f\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\b\n\u0002\u0010\u000e\n\u0002\b\u0003\b\u0080\u0003\u0018\u00002\u00020\u0001B\t\b\u0002¢\u0006\u0004\b\u0002\u0010\u0003J\u0015\u0010\u0007\u001a\u00020\u00062\u0006\u0010\u0005\u001a\u00020\u0004¢\u0006\u0004\b\u0007\u0010\bJ3\u0010\u0010\u001a\u00020\u000f2\u0006\u0010\u0005\u001a\u00020\u00042\u000e\b\u0002\u0010\u000b\u001a\b\u0012\u0004\u0012\u00020\n0\t2\f\u0010\u000e\u001a\b\u0012\u0004\u0012\u00020\r0\f¢\u0006\u0004\b\u0010\u0010\u0011R\"\u0010\u0013\u001a\u00020\u00128\u0006@\u0006X\u0086\u000e¢\u0006\u0012\n\u0004\b\u0013\u0010\u0014\u001a\u0004\b\u0015\u0010\u0016\"\u0004\b\u0017\u0010\u0018R$\u0010\u001e\u001a\u00020\r2\u0006\u0010\u0019\u001a\u00020\r8F@FX\u0086\u000e¢\u0006\f\u001a\u0004\b\u001a\u0010\u001b\"\u0004\b\u001c\u0010\u001dR$\u0010$\u001a\u00020\u001f2\u0006\u0010\u0019\u001a\u00020\u001f8F@FX\u0086\u000e¢\u0006\f\u001a\u0004\b \u0010!\"\u0004\b\"\u0010#R$\u0010*\u001a\u00020%2\u0006\u0010\u0019\u001a\u00020%8F@FX\u0086\u000e¢\u0006\f\u001a\u0004\b&\u0010'\"\u0004\b(\u0010)R$\u0010,\u001a\u0004\u0018\u00010+8\u0006@\u0006X\u0086\u000e¢\u0006\u0012\n\u0004\b,\u0010-\u001a\u0004\b.\u0010/\"\u0004\b0\u00101R\u0018\u00102\u001a\u0004\u0018\u00010\u00068\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\b2\u00103R\u0014\u00105\u001a\u0002048\u0006X\u0086T¢\u0006\u0006\n\u0004\b5\u00106¨\u00067"}, d2 = {"Lcom/revenuecat/purchases/PurchasesOrchestrator$Companion;", "", "<init>", "()V", "Landroid/content/Context;", "context", "Lja/f;", "getImageLoader", "(Landroid/content/Context;)Lja/f;", "", "Lcom/revenuecat/purchases/models/BillingFeature;", "features", "Lcom/revenuecat/purchases/interfaces/Callback;", "", "callback", "", "canMakePayments", "(Landroid/content/Context;Ljava/util/List;Lcom/revenuecat/purchases/interfaces/Callback;)V", "Lcom/revenuecat/purchases/common/PlatformInfo;", "platformInfo", "Lcom/revenuecat/purchases/common/PlatformInfo;", "getPlatformInfo", "()Lcom/revenuecat/purchases/common/PlatformInfo;", "setPlatformInfo", "(Lcom/revenuecat/purchases/common/PlatformInfo;)V", "value", "getDebugLogsEnabled", "()Z", "setDebugLogsEnabled", "(Z)V", "debugLogsEnabled", "Lcom/revenuecat/purchases/LogLevel;", "getLogLevel", "()Lcom/revenuecat/purchases/LogLevel;", "setLogLevel", "(Lcom/revenuecat/purchases/LogLevel;)V", "logLevel", "Lcom/revenuecat/purchases/LogHandler;", "getLogHandler", "()Lcom/revenuecat/purchases/LogHandler;", "setLogHandler", "(Lcom/revenuecat/purchases/LogHandler;)V", "logHandler", "Ljava/net/URL;", "proxyURL", "Ljava/net/URL;", "getProxyURL", "()Ljava/net/URL;", "setProxyURL", "(Ljava/net/URL;)V", "cachedImageLoader", "Lja/f;", "", "frameworkVersion", "Ljava/lang/String;", "purchases_defaultsRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
    public static final class Companion {
        public Companion(DefaultConstructorMarker defaultConstructorMarker) {
            this();
        }

        public static void canMakePayments$default(Companion companion, Context context, List list, Callback callback, int i, Object obj) {
            if ((i & 2) != 0) {
                list = EmptyList.w;
            }
            companion.canMakePayments(context, list, callback);
        }

        public final void canMakePayments(Context context, List<? extends BillingFeature> features, Callback<Boolean> callback) {
            Intrinsics.h(context, "context");
            Intrinsics.h(features, "features");
            Intrinsics.h(callback, "callback");
            C0027m c0027m = new C0027m(context);
            c0027m.a = new m(false, 0);
            c0027m.b = new Te.a(25);
            c a = c0027m.a();
            a.h(new PurchasesOrchestrator$Companion$canMakePayments$2$1(new Handler(context.getMainLooper()), new AtomicBoolean(false), callback, a, features));
        }

        public final boolean getDebugLogsEnabled() {
            return LogUtilsKt.getDebugLogsEnabled(getLogLevel());
        }

        public final synchronized f getImageLoader(final Context context) {
            ja.m mVar;
            Intrinsics.h(context, "context");
            mVar = PurchasesOrchestrator.cachedImageLoader;
            if (mVar == null) {
                final String str = "revenuecatui_cache";
                Ha.a aVar = new Ha.a(context, 16);
                final long j = 26214400;
                aVar.y = LazyKt.a(new Function0<b>() {
                    {
                        super(0);
                    }

                    public final b invoke() {
                        ma.a aVar2 = new ma.a();
                        File cacheDir = context.getCacheDir();
                        Intrinsics.g(cacheDir, "context.cacheDir");
                        File C = FilesKt.C(cacheDir, str);
                        String str2 = A.x;
                        aVar2.a = C0527d.t(C);
                        long j2 = j;
                        if (j2 <= 0) {
                            throw new IllegalArgumentException("size must be > 0.");
                        }
                        aVar2.c = 0.0d;
                        aVar2.f = j2;
                        return aVar2.a();
                    }
                });
                mVar = aVar.x();
                PurchasesOrchestrator.cachedImageLoader = mVar;
            }
            return mVar;
        }

        public final synchronized LogHandler getLogHandler() {
            return LogWrapperKt.getCurrentLogHandler();
        }

        public final LogLevel getLogLevel() {
            return Config.INSTANCE.getLogLevel();
        }

        public final PlatformInfo getPlatformInfo() {
            return PurchasesOrchestrator.platformInfo;
        }

        public final URL getProxyURL() {
            return PurchasesOrchestrator.proxyURL;
        }

        public final void setDebugLogsEnabled(boolean z) {
            setLogLevel(LogUtilsKt.debugLogsEnabled(LogLevel.INSTANCE, z));
        }

        public final synchronized void setLogHandler(LogHandler logHandler) {
            Intrinsics.h(logHandler, "value");
            LogWrapperKt.setCurrentLogHandler(logHandler);
        }

        public final void setLogLevel(LogLevel logLevel) {
            Intrinsics.h(logLevel, "value");
            Config.INSTANCE.setLogLevel(logLevel);
        }

        public final void setPlatformInfo(PlatformInfo platformInfo) {
            Intrinsics.h(platformInfo, "<set-?>");
            PurchasesOrchestrator.platformInfo = platformInfo;
        }

        public final void setProxyURL(URL url) {
            PurchasesOrchestrator.proxyURL = url;
        }

        private Companion() {
        }
    }

    public PurchasesOrchestrator(Application application, String str, Backend backend, BillingAbstract billingAbstract, DeviceCache deviceCache, IdentityManager identityManager, SubscriberAttributesManager subscriberAttributesManager, AppConfig appConfig, CustomerInfoHelper customerInfoHelper, CustomerInfoUpdateHandler customerInfoUpdateHandler, DiagnosticsSynchronizer diagnosticsSynchronizer, DiagnosticsTracker diagnosticsTracker, DateProvider dateProvider, OfflineEntitlementsManager offlineEntitlementsManager, PostReceiptHelper postReceiptHelper, PostTransactionWithProductDetailsHelper postTransactionWithProductDetailsHelper, PostPendingTransactionsHelper postPendingTransactionsHelper, SyncPurchasesHelper syncPurchasesHelper, OfferingsManager offeringsManager, EventsManager eventsManager, PaywallPresentedCache paywallPresentedCache, PurchasesStateCache purchasesStateCache, Handler handler, Dispatcher dispatcher, PurchasesConfiguration purchasesConfiguration, WebPurchaseRedemptionHelper webPurchaseRedemptionHelper, Function0<? extends D> function0) {
        Intrinsics.h(application, "application");
        Intrinsics.h(backend, "backend");
        Intrinsics.h(billingAbstract, "billing");
        Intrinsics.h(deviceCache, "deviceCache");
        Intrinsics.h(identityManager, "identityManager");
        Intrinsics.h(subscriberAttributesManager, "subscriberAttributesManager");
        Intrinsics.h(appConfig, "appConfig");
        Intrinsics.h(customerInfoHelper, "customerInfoHelper");
        Intrinsics.h(customerInfoUpdateHandler, "customerInfoUpdateHandler");
        Intrinsics.h(dateProvider, "dateProvider");
        Intrinsics.h(offlineEntitlementsManager, "offlineEntitlementsManager");
        Intrinsics.h(postReceiptHelper, "postReceiptHelper");
        Intrinsics.h(postTransactionWithProductDetailsHelper, "postTransactionWithProductDetailsHelper");
        Intrinsics.h(postPendingTransactionsHelper, "postPendingTransactionsHelper");
        Intrinsics.h(syncPurchasesHelper, "syncPurchasesHelper");
        Intrinsics.h(offeringsManager, "offeringsManager");
        Intrinsics.h(paywallPresentedCache, "paywallPresentedCache");
        Intrinsics.h(purchasesStateCache, "purchasesStateCache");
        Intrinsics.h(dispatcher, "dispatcher");
        Intrinsics.h(purchasesConfiguration, "initialConfiguration");
        Intrinsics.h(webPurchaseRedemptionHelper, "webPurchaseRedemptionHelper");
        Intrinsics.h(function0, "processLifecycleOwnerProvider");
        this.application = application;
        this.backend = backend;
        this.billing = billingAbstract;
        this.deviceCache = deviceCache;
        this.identityManager = identityManager;
        this.subscriberAttributesManager = subscriberAttributesManager;
        this.appConfig = appConfig;
        this.customerInfoHelper = customerInfoHelper;
        this.customerInfoUpdateHandler = customerInfoUpdateHandler;
        this.diagnosticsSynchronizer = diagnosticsSynchronizer;
        this.diagnosticsTrackerIfEnabled = diagnosticsTracker;
        this.dateProvider = dateProvider;
        this.offlineEntitlementsManager = offlineEntitlementsManager;
        this.postReceiptHelper = postReceiptHelper;
        this.postTransactionWithProductDetailsHelper = postTransactionWithProductDetailsHelper;
        this.postPendingTransactionsHelper = postPendingTransactionsHelper;
        this.syncPurchasesHelper = syncPurchasesHelper;
        this.offeringsManager = offeringsManager;
        this.eventsManager = eventsManager;
        this.paywallPresentedCache = paywallPresentedCache;
        this.purchasesStateCache = purchasesStateCache;
        this.mainHandler = handler;
        this.dispatcher = dispatcher;
        this.initialConfiguration = purchasesConfiguration;
        this.webPurchaseRedemptionHelper = webPurchaseRedemptionHelper;
        this.processLifecycleOwnerProvider = function0;
        this.lifecycleHandler = LazyKt.a(new Function0<AppLifecycleHandler>() {
            {
                super(0);
            }

            public final AppLifecycleHandler m298invoke() {
                return new AppLifecycleHandler(PurchasesOrchestrator.this);
            }
        });
        Duration.Companion companion = Duration.x;
        this.lastSyncAttributesAndOfferingsRateLimiter = new RateLimiter(5, DurationKt.g(60, DurationUnit.X), (DefaultConstructorMarker) null);
        identityManager.configure(str);
        billingAbstract.setStateListener(new BillingAbstract.StateListener() {
            @Override
            public void onConnected() {
                PostPendingTransactionsHelper.syncPendingPurchaseQueue$default(PurchasesOrchestrator.this.postPendingTransactionsHelper, PurchasesOrchestrator.this.getAllowSharingPlayStoreAccount(), null, 2, null);
                BillingAbstract billingAbstract2 = PurchasesOrchestrator.this.billing;
                final PurchasesOrchestrator purchasesOrchestrator = PurchasesOrchestrator.this;
                billingAbstract2.getStorefront(new Function1<String, Unit>() {
                    {
                        super(1);
                    }

                    public Object invoke(Object obj) {
                        invoke((String) obj);
                        return Unit.a;
                    }

                    public final void invoke(String str2) {
                        Intrinsics.h(str2, "countryCode");
                        PurchasesOrchestrator.this.storefrontCountryCode = str2;
                        LogUtilsKt.debugLog(String.format("Billing connected with country code: %s", Arrays.copyOf(new Object[]{str2}, 1)));
                    }
                }, new Function1<PurchasesError, Unit>() {
                    public Object invoke(Object obj) {
                        invoke((PurchasesError) obj);
                        return Unit.a;
                    }

                    public final void invoke(PurchasesError purchasesError) {
                        Intrinsics.h(purchasesError, "error");
                        LogUtilsKt.errorLog(purchasesError);
                    }
                });
            }
        });
        billingAbstract.setPurchasesUpdatedListener(getPurchasesUpdatedListener());
        BillingAbstract.startConnectionOnMainThread$default(billingAbstract, 0L, 1, null);
        dispatch(new Function0<Unit>() {
            {
                super(0);
            }

            public Object invoke() {
                m290invoke();
                return Unit.a;
            }

            public final void m290invoke() {
                ((D) PurchasesOrchestrator.this.getProcessLifecycleOwnerProvider().invoke()).getLifecycle().a(PurchasesOrchestrator.this.getLifecycleHandler());
                PurchasesOrchestrator.this.application.registerActivityLifecycleCallbacks(PurchasesOrchestrator.this);
            }
        });
        if (this.appConfig.getDangerousSettings().getAutoSyncPurchases()) {
            return;
        }
        LogWrapperKt.log(LogIntent.WARNING, "Automatic syncing of purchases has been disabled. \nRevenueCat won’t observe the new purchases from the store, and it will not sync any purchase \nautomatically. Call syncPurchases whenever a new transaction is completed so the \nreceipt is sent to RevenueCat’s backend. Consumables disappear from the receipt \nafter the transaction is finished, so make sure purchases are synced before \nfinishing any consumable transaction, otherwise RevenueCat won’t register the \npurchase.");
    }

    private final PurchaseCallback createCallbackWithDiagnosticsIfNeeded(final PurchaseCallback originalCallback, final PurchasingData purchasingData, final Date startTime) {
        return this.diagnosticsTrackerIfEnabled == null ? originalCallback : new PurchaseCallback() {
            @Override
            public void onCompleted(StoreTransaction storeTransaction, CustomerInfo customerInfo) {
                Intrinsics.h(storeTransaction, "storeTransaction");
                Intrinsics.h(customerInfo, "customerInfo");
                PurchasesOrchestrator.this.trackPurchaseResultIfNeeded(purchasingData, null, startTime, customerInfo.getEntitlements().getVerification());
                originalCallback.onCompleted(storeTransaction, customerInfo);
            }

            @Override
            public void onError(PurchasesError error, boolean userCancelled) {
                Intrinsics.h(error, "error");
                PurchasesOrchestrator.this.trackPurchaseResultIfNeeded(purchasingData, error, startTime, null);
                originalCallback.onError(error, userCancelled);
            }
        };
    }

    public final void dispatch(Function0<Unit> action) {
        if (Intrinsics.c(Thread.currentThread(), Looper.getMainLooper().getThread())) {
            action.invoke();
            return;
        }
        Handler handler = this.mainHandler;
        if (handler == null) {
            handler = new Handler(Looper.getMainLooper());
        }
        handler.post(new a(action, 2));
    }

    public static final void dispatch$lambda$21(Function0 function0) {
        Intrinsics.h(function0, "$tmp0");
        function0.invoke();
    }

    private final void enqueue(Function0<Unit> command) {
        this.dispatcher.enqueue(new a(command, 3), Delay.NONE);
    }

    public static final void enqueue$lambda$14(Function0 function0) {
        Intrinsics.h(function0, "$command");
        function0.invoke();
    }

    public final void flushPaywallEvents() {
        EventsManager eventsManager;
        if (!AndroidVersionUtilsKt.isAndroidNOrNewer() || (eventsManager = this.eventsManager) == null) {
            return;
        }
        eventsManager.flushEvents();
    }

    public final List<PurchaseCallback> getAndClearAllPurchaseCallbacks() {
        List<PurchaseCallback> n1;
        synchronized (this) {
            Map<String, PurchaseCallback> purchaseCallbacksByProductId = getState$purchases_defaultsRelease().getPurchaseCallbacksByProductId();
            PurchasesState state$purchases_defaultsRelease = getState$purchases_defaultsRelease();
            Map map = Collections.EMPTY_MAP;
            Intrinsics.g(map, "emptyMap()");
            setState$purchases_defaultsRelease(PurchasesState.copy$default(state$purchases_defaultsRelease, null, map, null, false, false, 29, null));
            n1 = bl.f.n1(purchaseCallbacksByProductId.values());
        }
        return n1;
    }

    public final ProductChangeCallback getAndClearProductChangeCallback() {
        ProductChangeCallback deprecatedProductChangeCallback = getState$purchases_defaultsRelease().getDeprecatedProductChangeCallback();
        setState$purchases_defaultsRelease(PurchasesState.copy$default(getState$purchases_defaultsRelease(), null, null, null, false, false, 27, null));
        return deprecatedProductChangeCallback;
    }

    public final void getCustomerInfo(ReceiveCustomerInfoCallback callback) {
        getCustomerInfo(CacheFetchPolicy.INSTANCE.m243default(), false, callback);
    }

    public final AppLifecycleHandler getLifecycleHandler() {
        return (AppLifecycleHandler) this.lifecycleHandler.getValue();
    }

    public static void getOfferings$default(PurchasesOrchestrator purchasesOrchestrator, ReceiveOfferingsCallback receiveOfferingsCallback, boolean z, int i, Object obj) {
        if ((i & 2) != 0) {
            z = false;
        }
        purchasesOrchestrator.getOfferings(receiveOfferingsCallback, z);
    }

    public final Pair<Function2<StoreTransaction, CustomerInfo, Unit>, Function2<StoreTransaction, PurchasesError, Unit>> getProductChangeCompletedCallbacks(final ProductChangeCallback productChangeListener) {
        return new Pair<>(new Function2<StoreTransaction, CustomerInfo, Unit>() {
            {
                super(2);
            }

            public Object invoke(Object obj, Object obj2) {
                invoke((StoreTransaction) obj, (CustomerInfo) obj2);
                return Unit.a;
            }

            public final void invoke(final StoreTransaction storeTransaction, final CustomerInfo customerInfo) {
                Intrinsics.h(storeTransaction, "storeTransaction");
                Intrinsics.h(customerInfo, "info");
                final ProductChangeCallback productChangeCallback = ProductChangeCallback.this;
                if (productChangeCallback != null) {
                    this.dispatch(new Function0<Unit>() {
                        {
                            super(0);
                        }

                        public Object invoke() {
                            m294invoke();
                            return Unit.a;
                        }

                        public final void m294invoke() {
                            ProductChangeCallback.this.onCompleted(storeTransaction, customerInfo);
                        }
                    });
                }
            }
        }, new Function2<StoreTransaction, PurchasesError, Unit>() {
            {
                super(2);
            }

            public Object invoke(Object obj, Object obj2) {
                invoke((StoreTransaction) obj, (PurchasesError) obj2);
                return Unit.a;
            }

            public final void invoke(StoreTransaction storeTransaction, PurchasesError purchasesError) {
                Intrinsics.h(storeTransaction, "<anonymous parameter 0>");
                Intrinsics.h(purchasesError, "error");
                ProductChangeCallback productChangeCallback = ProductChangeCallback.this;
                if (productChangeCallback != null) {
                    this.dispatch(productChangeCallback, purchasesError);
                }
            }
        });
    }

    public static void getProducts$default(PurchasesOrchestrator purchasesOrchestrator, List list, ProductType productType, GetStoreProductsCallback getStoreProductsCallback, int i, Object obj) {
        if ((i & 2) != 0) {
            productType = null;
        }
        purchasesOrchestrator.getProducts(list, productType, getStoreProductsCallback);
    }

    public static void getProductsOfTypes$default(PurchasesOrchestrator purchasesOrchestrator, Set set, Set set2, List list, Date date, GetStoreProductsCallback getStoreProductsCallback, int i, Object obj) {
        if ((i & 8) != 0) {
            date = null;
        }
        purchasesOrchestrator.getProductsOfTypes(set, set2, list, date, getStoreProductsCallback);
    }

    public final PurchaseCallback getPurchaseCallback(String productId) {
        PurchaseCallback purchaseCallback = getState$purchases_defaultsRelease().getPurchaseCallbacksByProductId().get(productId);
        PurchasesState state$purchases_defaultsRelease = getState$purchases_defaultsRelease();
        Map<String, PurchaseCallback> purchaseCallbacksByProductId = getState$purchases_defaultsRelease().getPurchaseCallbacksByProductId();
        LinkedHashMap linkedHashMap = new LinkedHashMap();
        for (Map.Entry<String, PurchaseCallback> entry : purchaseCallbacksByProductId.entrySet()) {
            if (!Intrinsics.c(entry.getKey(), productId)) {
                linkedHashMap.put(entry.getKey(), entry.getValue());
            }
        }
        setState$purchases_defaultsRelease(PurchasesState.copy$default(state$purchases_defaultsRelease, null, linkedHashMap, null, false, false, 29, null));
        return purchaseCallback;
    }

    public final Pair<Function2<StoreTransaction, CustomerInfo, Unit>, Function2<StoreTransaction, PurchasesError, Unit>> getPurchaseCompletedCallbacks() {
        return new Pair<>(new Function2<StoreTransaction, CustomerInfo, Unit>() {
            {
                super(2);
            }

            public Object invoke(Object obj, Object obj2) {
                invoke((StoreTransaction) obj, (CustomerInfo) obj2);
                return Unit.a;
            }

            public final void invoke(final StoreTransaction storeTransaction, final CustomerInfo customerInfo) {
                final PurchaseCallback purchaseCallback;
                Intrinsics.h(storeTransaction, "storeTransaction");
                Intrinsics.h(customerInfo, "info");
                purchaseCallback = PurchasesOrchestrator.this.getPurchaseCallback(storeTransaction.getProductIds().get(0));
                if (purchaseCallback != null) {
                    PurchasesOrchestrator.this.dispatch(new Function0<Unit>() {
                        {
                            super(0);
                        }

                        public Object invoke() {
                            m297invoke();
                            return Unit.a;
                        }

                        public final void m297invoke() {
                            PurchaseCallback.this.onCompleted(storeTransaction, customerInfo);
                        }
                    });
                }
            }
        }, new Function2<StoreTransaction, PurchasesError, Unit>() {
            {
                super(2);
            }

            public Object invoke(Object obj, Object obj2) {
                invoke((StoreTransaction) obj, (PurchasesError) obj2);
                return Unit.a;
            }

            public final void invoke(StoreTransaction storeTransaction, PurchasesError purchasesError) {
                PurchaseCallback purchaseCallback;
                Intrinsics.h(storeTransaction, "purchase");
                Intrinsics.h(purchasesError, "error");
                purchaseCallback = PurchasesOrchestrator.this.getPurchaseCallback(storeTransaction.getProductIds().get(0));
                if (purchaseCallback != null) {
                    PurchasesOrchestrator.this.dispatch(purchaseCallback, purchasesError);
                }
            }
        });
    }

    private final BillingAbstract.PurchasesUpdatedListener getPurchasesUpdatedListener() {
        return new BillingAbstract.PurchasesUpdatedListener() {
            @Override
            public void onPurchasesFailedToUpdate(PurchasesError purchasesError) {
                ProductChangeCallback andClearProductChangeCallback;
                Unit unit;
                List andClearAllPurchaseCallbacks;
                Intrinsics.h(purchasesError, "purchasesError");
                PurchasesOrchestrator purchasesOrchestrator = PurchasesOrchestrator.this;
                synchronized (purchasesOrchestrator) {
                    try {
                        andClearProductChangeCallback = purchasesOrchestrator.getAndClearProductChangeCallback();
                        if (andClearProductChangeCallback != null) {
                            purchasesOrchestrator.dispatch(andClearProductChangeCallback, purchasesError);
                            unit = Unit.a;
                        } else {
                            unit = null;
                        }
                        if (unit == null) {
                            andClearAllPurchaseCallbacks = purchasesOrchestrator.getAndClearAllPurchaseCallbacks();
                            Iterator it = andClearAllPurchaseCallbacks.iterator();
                            while (it.hasNext()) {
                                purchasesOrchestrator.dispatch((PurchaseCallback) it.next(), purchasesError);
                            }
                        }
                        Unit unit2 = Unit.a;
                    } catch (Throwable th) {
                        throw th;
                    }
                }
            }

            @Override
            public void onPurchasesUpdated(List<StoreTransaction> purchases) {
                Pair purchaseCompletedCallbacks;
                PostTransactionWithProductDetailsHelper postTransactionWithProductDetailsHelper;
                ProductChangeCallback andClearProductChangeCallback;
                Intrinsics.h(purchases, "purchases");
                PurchasesOrchestrator purchasesOrchestrator = PurchasesOrchestrator.this;
                synchronized (purchasesOrchestrator) {
                    try {
                        if (purchasesOrchestrator.getState$purchases_defaultsRelease().getDeprecatedProductChangeCallback() != null) {
                            andClearProductChangeCallback = purchasesOrchestrator.getAndClearProductChangeCallback();
                            purchaseCompletedCallbacks = purchasesOrchestrator.getProductChangeCompletedCallbacks(andClearProductChangeCallback);
                        } else {
                            purchaseCompletedCallbacks = purchasesOrchestrator.getPurchaseCompletedCallbacks();
                        }
                        Unit unit = Unit.a;
                    } catch (Throwable th) {
                        throw th;
                    }
                }
                postTransactionWithProductDetailsHelper = PurchasesOrchestrator.this.postTransactionWithProductDetailsHelper;
                postTransactionWithProductDetailsHelper.postTransactions(purchases, PurchasesOrchestrator.this.getAllowSharingPlayStoreAccount(), PurchasesOrchestrator.this.getAppUserID(), PostReceiptInitiationSource.PURCHASE, (Function2) purchaseCompletedCallbacks.first, (Function2) purchaseCompletedCallbacks.second);
                PurchasesOrchestrator.this.flushPaywallEvents();
            }
        };
    }

    public static void logIn$default(PurchasesOrchestrator purchasesOrchestrator, String str, LogInCallback logInCallback, int i, Object obj) {
        if ((i & 2) != 0) {
            logInCallback = null;
        }
        purchasesOrchestrator.logIn(str, logInCallback);
    }

    public static void logOut$default(PurchasesOrchestrator purchasesOrchestrator, ReceiveCustomerInfoCallback receiveCustomerInfoCallback, int i, Object obj) {
        if ((i & 1) != 0) {
            receiveCustomerInfoCallback = null;
        }
        purchasesOrchestrator.logOut(receiveCustomerInfoCallback);
    }

    private final void replaceOldPurchaseWithNewProduct(final PurchasingData purchasingData, String oldProductId, final GoogleReplacementMode googleReplacementMode, final Activity activity, final String appUserID, final PresentedOfferingContext presentedOfferingContext, final Boolean isPersonalizedPrice, final PurchaseErrorCallback listener) {
        ProductType productType = purchasingData.getProductType();
        ProductType productType2 = ProductType.SUBS;
        if (productType != productType2) {
            PurchasesError purchasesError = new PurchasesError(PurchasesErrorCode.PurchaseNotAllowedError, "UpgradeInfo passed to purchase for non-sub product type. No upgrade will occur. Consider using non-upgrade purchase flows for this product.");
            LogUtilsKt.errorLog(purchasesError);
            ProductChangeCallback andClearProductChangeCallback = getAndClearProductChangeCallback();
            if (andClearProductChangeCallback != null) {
                dispatch(andClearProductChangeCallback, purchasesError);
            }
            Iterator<T> it = getAndClearAllPurchaseCallbacks().iterator();
            while (it.hasNext()) {
                dispatch((PurchaseCallback) it.next(), purchasesError);
            }
            return;
        }
        final Ref.ObjectRef objectRef = new Ref.ObjectRef();
        objectRef.w = oldProductId;
        if (j.Q(oldProductId, Constants.SUBS_ID_BASE_PLAN_ID_SEPARATOR, false)) {
            objectRef.w = j.s0(oldProductId, Constants.SUBS_ID_BASE_PLAN_ID_SEPARATOR);
            StringBuilder p = e.p("Using incorrect oldProductId: ", oldProductId, ". The productId should not contain the basePlanId. Using productId: ");
            p.append((String) objectRef.w);
            p.append('.');
            LogUtilsKt.warnLog(p.toString());
        }
        this.billing.findPurchaseInPurchaseHistory(appUserID, productType2, (String) objectRef.w, new Function1<StoreTransaction, Unit>() {
            {
                super(1);
            }

            public Object invoke(Object obj) {
                invoke((StoreTransaction) obj);
                return Unit.a;
            }

            public final void invoke(StoreTransaction storeTransaction) {
                Intrinsics.h(storeTransaction, "purchaseRecord");
                com.mapbox.common.location.e.D(new Object[]{objectRef.w}, 1, "Found existing purchase for SKU: %s", LogIntent.PURCHASE);
                this.billing.makePurchaseAsync(activity, appUserID, purchasingData, new ReplaceProductInfo(storeTransaction, googleReplacementMode), presentedOfferingContext, isPersonalizedPrice);
            }
        }, new Function1<PurchasesError, Unit>() {
            {
                super(1);
            }

            public Object invoke(Object obj) {
                invoke((PurchasesError) obj);
                return Unit.a;
            }

            public final void invoke(PurchasesError purchasesError2) {
                Intrinsics.h(purchasesError2, "error");
                LogWrapperKt.log(LogIntent.GOOGLE_ERROR, purchasesError2.toString());
                PurchasesOrchestrator.this.getAndClearProductChangeCallback();
                PurchasesOrchestrator.this.getAndClearAllPurchaseCallbacks();
                PurchasesOrchestrator.this.dispatch(listener, purchasesError2);
            }
        });
    }

    public final boolean shouldRefreshCustomerInfo(boolean firstTimeInForeground) {
        return !this.appConfig.getCustomEntitlementComputation() && (firstTimeInForeground || this.deviceCache.isCustomerInfoCacheStale(getAppUserID(), false));
    }

    public static void syncPurchases$default(PurchasesOrchestrator purchasesOrchestrator, SyncPurchasesCallback syncPurchasesCallback, int i, Object obj) {
        if ((i & 1) != 0) {
            syncPurchasesCallback = null;
        }
        purchasesOrchestrator.syncPurchases(syncPurchasesCallback);
    }

    public final void synchronizeSubscriberAttributesIfNeeded() {
        SubscriberAttributesManager.synchronizeSubscriberAttributesForAllUsers$default(this.subscriberAttributesManager, getAppUserID(), (Function0) null, 2, (Object) null);
    }

    public final void trackGetProductsResult(Date startTime, Set<String> requestedProductIds, Set<String> notFoundProductIds, PurchasesError error) {
        PurchasesErrorCode code;
        if (this.diagnosticsTrackerIfEnabled == null) {
            return;
        }
        long between = DurationExtensionsKt.between(Duration.x, startTime, this.dateProvider.getNow());
        DiagnosticsTracker diagnosticsTracker = this.diagnosticsTrackerIfEnabled;
        Integer num = null;
        String message = error != null ? error.getMessage() : null;
        if (error != null && (code = error.getCode()) != null) {
            num = Integer.valueOf(code.getCode());
        }
        diagnosticsTracker.m342trackGetProductsResult9VgGkz4(requestedProductIds, notFoundProductIds, message, num, between);
    }

    private final void trackGetProductsStarted(Set<String> requestedProductIds) {
        DiagnosticsTracker diagnosticsTracker = this.diagnosticsTrackerIfEnabled;
        if (diagnosticsTracker != null) {
            diagnosticsTracker.trackGetProductsStarted(requestedProductIds);
        }
    }

    public final void trackPurchaseResultIfNeeded(PurchasingData purchasingData, PurchasesError error, Date startTime, VerificationResult verificationResult) {
        PurchasesErrorCode code;
        if (this.diagnosticsTrackerIfEnabled == null) {
            return;
        }
        this.diagnosticsTrackerIfEnabled.m347trackPurchaseResultmyKFqkg(purchasingData.getProductId(), purchasingData.getProductType(), (error == null || (code = error.getCode()) == null) ? null : Integer.valueOf(code.getCode()), error != null ? error.getMessage() : null, DurationExtensionsKt.between(Duration.x, startTime, this.dateProvider.getNow()), verificationResult);
    }

    private final void trackPurchaseStarted(String productId, ProductType productType) {
        DiagnosticsTracker diagnosticsTracker = this.diagnosticsTrackerIfEnabled;
        if (diagnosticsTracker != null) {
            diagnosticsTracker.trackPurchaseStarted(productId, productType);
        }
    }

    public final void updateAllCaches(String appUserID, ReceiveCustomerInfoCallback completion) {
        boolean appInBackground = getState$purchases_defaultsRelease().getAppInBackground();
        CustomerInfoHelper.retrieveCustomerInfo$default(this.customerInfoHelper, appUserID, CacheFetchPolicy.FETCH_CURRENT, appInBackground, getAllowSharingPlayStoreAccount(), false, completion, 16, null);
        OfferingsManager.fetchAndCacheOfferings$default(this.offeringsManager, appUserID, appInBackground, null, null, 12, null);
    }

    public static void updateAllCaches$default(PurchasesOrchestrator purchasesOrchestrator, String str, ReceiveCustomerInfoCallback receiveCustomerInfoCallback, int i, Object obj) {
        if ((i & 2) != 0) {
            receiveCustomerInfoCallback = null;
        }
        purchasesOrchestrator.updateAllCaches(str, receiveCustomerInfoCallback);
    }

    public final void close() {
        synchronized (this) {
            PurchasesState state$purchases_defaultsRelease = getState$purchases_defaultsRelease();
            Map map = Collections.EMPTY_MAP;
            Intrinsics.g(map, "emptyMap()");
            setState$purchases_defaultsRelease(PurchasesState.copy$default(state$purchases_defaultsRelease, null, map, null, false, false, 29, null));
            Unit unit = Unit.a;
        }
        this.backend.close();
        this.billing.close();
        setUpdatedCustomerInfoListener(null);
        dispatch(new Function0<Unit>() {
            {
                super(0);
            }

            public Object invoke() {
                m292invoke();
                return Unit.a;
            }

            public final void m292invoke() {
                ((D) PurchasesOrchestrator.this.getProcessLifecycleOwnerProvider().invoke()).getLifecycle().c(PurchasesOrchestrator.this.getLifecycleHandler());
            }
        });
    }

    public final void collectDeviceIdentifiers() {
        com.mapbox.common.location.e.D(new Object[]{"collectDeviceIdentifiers"}, 1, "%s called", LogIntent.DEBUG);
        this.subscriberAttributesManager.collectDeviceIdentifiers(getAppUserID(), this.application);
    }

    public final synchronized boolean getAllowSharingPlayStoreAccount() {
        Boolean allowSharingPlayStoreAccount;
        try {
            allowSharingPlayStoreAccount = getState$purchases_defaultsRelease().getAllowSharingPlayStoreAccount();
        } catch (Throwable th) {
            throw th;
        }
        return allowSharingPlayStoreAccount != null ? allowSharingPlayStoreAccount.booleanValue() : this.identityManager.currentUserIsAnonymous();
    }

    public final void getAmazonLWAConsentStatus(final GetAmazonLWAConsentStatusCallback callback) {
        Intrinsics.h(callback, "callback");
        this.billing.getAmazonLWAConsentStatus(new Function1<AmazonLWAConsentStatus, Unit>() {
            {
                super(1);
            }

            public Object invoke(Object obj) {
                invoke((AmazonLWAConsentStatus) obj);
                return Unit.a;
            }

            public final void invoke(AmazonLWAConsentStatus amazonLWAConsentStatus) {
                Intrinsics.h(amazonLWAConsentStatus, "it");
                GetAmazonLWAConsentStatusCallback.this.onSuccess(amazonLWAConsentStatus);
            }
        }, new Function1<PurchasesError, Unit>() {
            {
                super(1);
            }

            public Object invoke(Object obj) {
                invoke((PurchasesError) obj);
                return Unit.a;
            }

            public final void invoke(PurchasesError purchasesError) {
                Intrinsics.h(purchasesError, "it");
                GetAmazonLWAConsentStatusCallback.this.onError(purchasesError);
            }
        });
    }

    public final AppConfig getAppConfig() {
        return this.appConfig;
    }

    public final synchronized String getAppUserID() {
        return this.identityManager.getCurrentAppUserID();
    }

    public final PurchasesConfiguration getCurrentConfiguration() {
        return this.initialConfiguration.getAppUserID() == null ? this.initialConfiguration : PurchasesConfiguration.copy$purchases_defaultsRelease$default(this.initialConfiguration, getAppUserID(), null, 2, null);
    }

    public final void getCustomerCenterConfig(final GetCustomerCenterConfigCallback callback) {
        Intrinsics.h(callback, "callback");
        this.backend.getCustomerCenterConfig(this.identityManager.getCurrentAppUserID(), new Function1<CustomerCenterConfigData, Unit>() {
            {
                super(1);
            }

            public Object invoke(Object obj) {
                invoke((CustomerCenterConfigData) obj);
                return Unit.a;
            }

            public final void invoke(CustomerCenterConfigData customerCenterConfigData) {
                Intrinsics.h(customerCenterConfigData, "config");
                GetCustomerCenterConfigCallback.this.onSuccess(customerCenterConfigData);
            }
        }, new Function1<PurchasesError, Unit>() {
            {
                super(1);
            }

            public Object invoke(Object obj) {
                invoke((PurchasesError) obj);
                return Unit.a;
            }

            public final void invoke(PurchasesError purchasesError) {
                Intrinsics.h(purchasesError, "error");
                GetCustomerCenterConfigCallback.this.onError(purchasesError);
            }
        });
    }

    public final synchronized CustomerCenterListener getCustomerCenterListener() {
        return this.customerCenterListener;
    }

    public final synchronized boolean getFinishTransactions() {
        return this.appConfig.getFinishTransactions();
    }

    public final void getOfferings(final ReceiveOfferingsCallback listener, boolean fetchCurrent) {
        Intrinsics.h(listener, "listener");
        this.offeringsManager.getOfferings(this.identityManager.getCurrentAppUserID(), getState$purchases_defaultsRelease().getAppInBackground(), new Function1<PurchasesError, Unit>() {
            {
                super(1);
            }

            public Object invoke(Object obj) {
                invoke((PurchasesError) obj);
                return Unit.a;
            }

            public final void invoke(PurchasesError purchasesError) {
                Intrinsics.h(purchasesError, "it");
                ReceiveOfferingsCallback.this.onError(purchasesError);
            }
        }, new Function1<Offerings, Unit>() {
            {
                super(1);
            }

            public Object invoke(Object obj) {
                invoke((Offerings) obj);
                return Unit.a;
            }

            public final void invoke(Offerings offerings) {
                Intrinsics.h(offerings, "it");
                ReceiveOfferingsCallback.this.onReceived(offerings);
            }
        }, fetchCurrent);
    }

    public final OfflineEntitlementsManager getOfflineEntitlementsManager() {
        return this.offlineEntitlementsManager;
    }

    public final Function0<D> getProcessLifecycleOwnerProvider() {
        return this.processLifecycleOwnerProvider;
    }

    public final void getProducts(List<String> productIds, ProductType type, final GetStoreProductsCallback callback) {
        Intrinsics.h(productIds, "productIds");
        Intrinsics.h(callback, "callback");
        getProductsOfTypes(bl.f.r1(productIds), type != null ? h.M(type) : kotlin.collections.c.V0(new ProductType[]{ProductType.SUBS, ProductType.INAPP}), new GetStoreProductsCallback() {
            @Override
            public void onError(PurchasesError error) {
                Intrinsics.h(error, "error");
                GetStoreProductsCallback.this.onError(error);
            }

            @Override
            public void onReceived(List<? extends StoreProduct> storeProducts) {
                Intrinsics.h(storeProducts, "storeProducts");
                GetStoreProductsCallback.this.onReceived(storeProducts);
            }
        });
    }

    public final void getProductsOfTypes(Set<String> productIds, Set<? extends ProductType> types, GetStoreProductsCallback callback) {
        Intrinsics.h(productIds, "productIds");
        Intrinsics.h(types, "types");
        Intrinsics.h(callback, "callback");
        ArrayList arrayList = new ArrayList();
        for (Object obj : types) {
            if (((ProductType) obj) != ProductType.UNKNOWN) {
                arrayList.add(obj);
            }
        }
        getProductsOfTypes$default(this, productIds, bl.f.r1(arrayList), EmptyList.w, null, callback, 8, null);
    }

    public final PurchasesState getState$purchases_defaultsRelease() {
        return this.purchasesStateCache.getPurchasesState();
    }

    public final Store getStore() {
        return this.appConfig.getStore();
    }

    public final String getStorefrontCountryCode() {
        return this.storefrontCountryCode;
    }

    public final synchronized UpdatedCustomerInfoListener getUpdatedCustomerInfoListener() {
        return this.customerInfoUpdateHandler.getUpdatedCustomerInfoListener();
    }

    public final void invalidateCustomerInfoCache() {
        LogWrapperKt.log(LogIntent.DEBUG, "Invalidating CustomerInfo cache.");
        this.deviceCache.clearCustomerInfoCache(getAppUserID());
    }

    public final boolean isAnonymous() {
        return this.identityManager.currentUserIsAnonymous();
    }

    public final void logIn(final String newAppUserID, final LogInCallback callback) {
        Intrinsics.h(newAppUserID, "newAppUserID");
        String currentAppUserID = this.identityManager.getCurrentAppUserID();
        Unit unit = null;
        if (Intrinsics.c(currentAppUserID, newAppUserID)) {
            currentAppUserID = null;
        }
        if (currentAppUserID != null) {
            this.identityManager.logIn(newAppUserID, new Function2<CustomerInfo, Boolean, Unit>() {
                {
                    super(2);
                }

                public Object invoke(Object obj, Object obj2) {
                    invoke((CustomerInfo) obj, ((Boolean) obj2).booleanValue());
                    return Unit.a;
                }

                public final void invoke(final CustomerInfo customerInfo, final boolean z) {
                    OfferingsManager offeringsManager;
                    Intrinsics.h(customerInfo, "customerInfo");
                    final PurchasesOrchestrator purchasesOrchestrator = PurchasesOrchestrator.this;
                    final LogInCallback logInCallback = callback;
                    purchasesOrchestrator.dispatch(new Function0<Unit>() {
                        {
                            super(0);
                        }

                        public Object invoke() {
                            m299invoke();
                            return Unit.a;
                        }

                        public final void m299invoke() {
                            CustomerInfoUpdateHandler customerInfoUpdateHandler;
                            LogInCallback logInCallback2 = LogInCallback.this;
                            if (logInCallback2 != null) {
                                logInCallback2.onReceived(customerInfo, z);
                            }
                            customerInfoUpdateHandler = purchasesOrchestrator.customerInfoUpdateHandler;
                            customerInfoUpdateHandler.notifyListeners(customerInfo);
                        }
                    });
                    offeringsManager = PurchasesOrchestrator.this.offeringsManager;
                    OfferingsManager.fetchAndCacheOfferings$default(offeringsManager, newAppUserID, PurchasesOrchestrator.this.getState$purchases_defaultsRelease().getAppInBackground(), null, null, 12, null);
                }
            }, new Function1<PurchasesError, Unit>() {
                {
                    super(1);
                }

                public Object invoke(Object obj) {
                    invoke((PurchasesError) obj);
                    return Unit.a;
                }

                public final void invoke(final PurchasesError purchasesError) {
                    Intrinsics.h(purchasesError, "error");
                    PurchasesOrchestrator purchasesOrchestrator = PurchasesOrchestrator.this;
                    final LogInCallback logInCallback = callback;
                    purchasesOrchestrator.dispatch(new Function0<Unit>() {
                        {
                            super(0);
                        }

                        public Object invoke() {
                            m300invoke();
                            return Unit.a;
                        }

                        public final void m300invoke() {
                            LogInCallback logInCallback2 = LogInCallback.this;
                            if (logInCallback2 != null) {
                                logInCallback2.onError(purchasesError);
                            }
                        }
                    });
                }
            });
            unit = Unit.a;
        }
        if (unit == null) {
            CustomerInfoHelper.retrieveCustomerInfo$default(this.customerInfoHelper, this.identityManager.getCurrentAppUserID(), CacheFetchPolicy.INSTANCE.m243default(), getState$purchases_defaultsRelease().getAppInBackground(), getAllowSharingPlayStoreAccount(), false, ListenerConversionsCommonKt.receiveCustomerInfoCallback(new Function1<CustomerInfo, Unit>() {
                {
                    super(1);
                }

                public Object invoke(Object obj) {
                    invoke((CustomerInfo) obj);
                    return Unit.a;
                }

                public final void invoke(final CustomerInfo customerInfo) {
                    Intrinsics.h(customerInfo, "customerInfo");
                    PurchasesOrchestrator purchasesOrchestrator = PurchasesOrchestrator.this;
                    final LogInCallback logInCallback = callback;
                    purchasesOrchestrator.dispatch(new Function0<Unit>() {
                        {
                            super(0);
                        }

                        public Object invoke() {
                            m301invoke();
                            return Unit.a;
                        }

                        public final void m301invoke() {
                            LogInCallback logInCallback2 = LogInCallback.this;
                            if (logInCallback2 != null) {
                                logInCallback2.onReceived(customerInfo, false);
                            }
                        }
                    });
                }
            }, new Function1<PurchasesError, Unit>() {
                {
                    super(1);
                }

                public Object invoke(Object obj) {
                    invoke((PurchasesError) obj);
                    return Unit.a;
                }

                public final void invoke(final PurchasesError purchasesError) {
                    Intrinsics.h(purchasesError, "error");
                    PurchasesOrchestrator purchasesOrchestrator = PurchasesOrchestrator.this;
                    final LogInCallback logInCallback = callback;
                    purchasesOrchestrator.dispatch(new Function0<Unit>() {
                        {
                            super(0);
                        }

                        public Object invoke() {
                            m302invoke();
                            return Unit.a;
                        }

                        public final void m302invoke() {
                            LogInCallback logInCallback2 = LogInCallback.this;
                            if (logInCallback2 != null) {
                                logInCallback2.onError(purchasesError);
                            }
                        }
                    });
                }
            }), 16, null);
        }
    }

    public final void logOut(final ReceiveCustomerInfoCallback callback) {
        this.identityManager.logOut(new Function1<PurchasesError, Unit>() {
            {
                super(1);
            }

            public Object invoke(Object obj) {
                invoke((PurchasesError) obj);
                return Unit.a;
            }

            public final void invoke(PurchasesError purchasesError) {
                IdentityManager identityManager;
                if (purchasesError != null) {
                    ReceiveCustomerInfoCallback receiveCustomerInfoCallback = ReceiveCustomerInfoCallback.this;
                    if (receiveCustomerInfoCallback != null) {
                        receiveCustomerInfoCallback.onError(purchasesError);
                        return;
                    }
                    return;
                }
                PurchasesOrchestrator purchasesOrchestrator = this;
                synchronized (purchasesOrchestrator) {
                    PurchasesState state$purchases_defaultsRelease = purchasesOrchestrator.getState$purchases_defaultsRelease();
                    Map map = Collections.EMPTY_MAP;
                    Intrinsics.g(map, "emptyMap()");
                    purchasesOrchestrator.setState$purchases_defaultsRelease(PurchasesState.copy$default(state$purchases_defaultsRelease, null, map, null, false, false, 29, null));
                    Unit unit = Unit.a;
                }
                PurchasesOrchestrator purchasesOrchestrator2 = this;
                identityManager = purchasesOrchestrator2.identityManager;
                purchasesOrchestrator2.updateAllCaches(identityManager.getCurrentAppUserID(), ReceiveCustomerInfoCallback.this);
            }
        });
    }

    public void onActivityStarted(Activity activity) {
        Intrinsics.h(activity, "activity");
        if (this.appConfig.getShowInAppMessagesAutomatically()) {
            showInAppMessagesIfNeeded(activity, kotlin.collections.c.S0(InAppMessageType.values()));
        }
    }

    @Override
    public void onAppBackgrounded() {
        synchronized (this) {
            setState$purchases_defaultsRelease(PurchasesState.copy$default(getState$purchases_defaultsRelease(), null, null, null, true, false, 23, null));
            Unit unit = Unit.a;
        }
        LogWrapperKt.log(LogIntent.DEBUG, "App backgrounded");
        this.appConfig.setAppBackgrounded(true);
        synchronizeSubscriberAttributesIfNeeded();
        flushPaywallEvents();
    }

    @Override
    public void onAppForegrounded() {
        final Ref.BooleanRef booleanRef = new Ref.BooleanRef();
        synchronized (this) {
            booleanRef.w = getState$purchases_defaultsRelease().getFirstTimeInForeground();
            setState$purchases_defaultsRelease(PurchasesState.copy$default(getState$purchases_defaultsRelease(), null, null, null, false, false, 7, null));
            Unit unit = Unit.a;
        }
        LogWrapperKt.log(LogIntent.DEBUG, "App foregrounded");
        this.appConfig.setAppBackgrounded(false);
        enqueue(new Function0<Unit>() {
            {
                super(0);
            }

            public Object invoke() {
                m303invoke();
                return Unit.a;
            }

            public final void m303invoke() {
                throw new UnsupportedOperationException("Method not decompiled: com.revenuecat.purchases.PurchasesOrchestrator$onAppForegrounded$2.m303invoke():void");
            }
        });
    }

    public final void purchase(PurchaseParams purchaseParams, PurchaseCallback callback) {
        Unit unit;
        Intrinsics.h(purchaseParams, "purchaseParams");
        Intrinsics.h(callback, "callback");
        String oldProductId = purchaseParams.getOldProductId();
        if (oldProductId != null) {
            startProductChange(purchaseParams.getActivity(), purchaseParams.getPurchasingData(), purchaseParams.getPresentedOfferingContext(), oldProductId, purchaseParams.getGoogleReplacementMode(), purchaseParams.getIsPersonalizedPrice(), callback);
            unit = Unit.a;
        } else {
            unit = null;
        }
        if (unit == null) {
            startPurchase(purchaseParams.getActivity(), purchaseParams.getPurchasingData(), purchaseParams.getPresentedOfferingContext(), purchaseParams.getIsPersonalizedPrice(), callback);
        }
    }

    public final void redeemWebPurchase(WebPurchaseRedemption webPurchaseRedemption, RedeemWebPurchaseListener listener) {
        Intrinsics.h(webPurchaseRedemption, "webPurchaseRedemption");
        Intrinsics.h(listener, "listener");
        this.webPurchaseRedemptionHelper.handleRedeemWebPurchase(webPurchaseRedemption, listener);
    }

    public final void removeUpdatedCustomerInfoListener() {
        setUpdatedCustomerInfoListener(null);
    }

    public final void restorePurchases(final ReceiveCustomerInfoCallback callback) {
        Intrinsics.h(callback, "callback");
        LogWrapperKt.log(LogIntent.DEBUG, "Restoring purchases");
        if (!getAllowSharingPlayStoreAccount()) {
            LogWrapperKt.log(LogIntent.WARNING, "allowSharingPlayStoreAccount is set to false and restorePurchases has been called. This will 'alias' any app user id's sharing the same receipt. Are you sure you want to do this? More info here: https://errors.rev.cat/allowsSharingPlayStoreAccount");
        }
        final Date now = this.dateProvider.getNow();
        DiagnosticsTracker diagnosticsTracker = this.diagnosticsTrackerIfEnabled;
        if (diagnosticsTracker != null) {
            diagnosticsTracker.trackRestorePurchasesStarted();
        }
        final String currentAppUserID = this.identityManager.getCurrentAppUserID();
        if (this.diagnosticsTrackerIfEnabled != null) {
            callback = new ReceiveCustomerInfoCallback() {
                @Override
                public void onError(PurchasesError error) {
                    DiagnosticsTracker diagnosticsTracker2;
                    DateProvider dateProvider;
                    Intrinsics.h(error, "error");
                    diagnosticsTracker2 = PurchasesOrchestrator.this.diagnosticsTrackerIfEnabled;
                    Integer valueOf = Integer.valueOf(error.getCode().getCode());
                    String message = error.getMessage();
                    Duration.Companion companion = Duration.x;
                    Date date = now;
                    dateProvider = PurchasesOrchestrator.this.dateProvider;
                    diagnosticsTracker2.m348trackRestorePurchasesResultSxA4cEA(valueOf, message, DurationExtensionsKt.between(companion, date, dateProvider.getNow()));
                    callback.onError(error);
                }

                @Override
                public void onReceived(CustomerInfo customerInfo) {
                    DiagnosticsTracker diagnosticsTracker2;
                    DateProvider dateProvider;
                    Intrinsics.h(customerInfo, "customerInfo");
                    diagnosticsTracker2 = PurchasesOrchestrator.this.diagnosticsTrackerIfEnabled;
                    Duration.Companion companion = Duration.x;
                    Date date = now;
                    dateProvider = PurchasesOrchestrator.this.dateProvider;
                    diagnosticsTracker2.m348trackRestorePurchasesResultSxA4cEA(null, null, DurationExtensionsKt.between(companion, date, dateProvider.getNow()));
                    callback.onReceived(customerInfo);
                }
            };
        }
        this.billing.queryAllPurchases(currentAppUserID, new Function1<List<? extends StoreTransaction>, Unit>() {
            {
                super(1);
            }

            public Object invoke(Object obj) {
                invoke((List<StoreTransaction>) obj);
                return Unit.a;
            }

            public final void invoke(List<StoreTransaction> list) {
                PostReceiptHelper postReceiptHelper;
                Intrinsics.h(list, "allPurchases");
                if (list.isEmpty()) {
                    PurchasesOrchestrator.this.getCustomerInfo(callback);
                    return;
                }
                final List<StoreTransaction> h1 = bl.f.h1(list, new Comparator() {
                    @Override
                    public final int compare(T t, T t2) {
                        return i0.C(Long.valueOf(((StoreTransaction) t).getPurchaseTime()), Long.valueOf(((StoreTransaction) t2).getPurchaseTime()));
                    }
                });
                final PurchasesOrchestrator purchasesOrchestrator = PurchasesOrchestrator.this;
                String str = currentAppUserID;
                final ReceiveCustomerInfoCallback receiveCustomerInfoCallback = callback;
                for (final StoreTransaction storeTransaction : h1) {
                    postReceiptHelper = purchasesOrchestrator.postReceiptHelper;
                    postReceiptHelper.postTransactionAndConsumeIfNeeded(storeTransaction, null, true, str, PostReceiptInitiationSource.RESTORE, new Function2<StoreTransaction, CustomerInfo, Unit>() {
                        {
                            super(2);
                        }

                        public Object invoke(Object obj, Object obj2) {
                            invoke((StoreTransaction) obj, (CustomerInfo) obj2);
                            return Unit.a;
                        }

                        public final void invoke(StoreTransaction storeTransaction2, final CustomerInfo customerInfo) {
                            Intrinsics.h(storeTransaction2, "<anonymous parameter 0>");
                            Intrinsics.h(customerInfo, "info");
                            com.mapbox.common.location.e.D(new Object[]{StoreTransaction.this}, 1, "Purchase %s restored", LogIntent.DEBUG);
                            if (Intrinsics.c(bl.f.O0(h1), StoreTransaction.this)) {
                                PurchasesOrchestrator purchasesOrchestrator2 = purchasesOrchestrator;
                                final ReceiveCustomerInfoCallback receiveCustomerInfoCallback2 = receiveCustomerInfoCallback;
                                purchasesOrchestrator2.dispatch(new Function0<Unit>() {
                                    {
                                        super(0);
                                    }

                                    public Object invoke() {
                                        m304invoke();
                                        return Unit.a;
                                    }

                                    public final void m304invoke() {
                                        ReceiveCustomerInfoCallback.this.onReceived(customerInfo);
                                    }
                                });
                            }
                        }
                    }, new Function2<StoreTransaction, PurchasesError, Unit>() {
                        {
                            super(2);
                        }

                        public Object invoke(Object obj, Object obj2) {
                            invoke((StoreTransaction) obj, (PurchasesError) obj2);
                            return Unit.a;
                        }

                        public final void invoke(StoreTransaction storeTransaction2, final PurchasesError purchasesError) {
                            Intrinsics.h(storeTransaction2, "<anonymous parameter 0>");
                            Intrinsics.h(purchasesError, "error");
                            com.mapbox.common.location.e.D(new Object[]{StoreTransaction.this, purchasesError}, 2, "Error restoring purchase: %s. Error: %s", LogIntent.RC_ERROR);
                            if (Intrinsics.c(bl.f.O0(h1), StoreTransaction.this)) {
                                PurchasesOrchestrator purchasesOrchestrator2 = purchasesOrchestrator;
                                final ReceiveCustomerInfoCallback receiveCustomerInfoCallback2 = receiveCustomerInfoCallback;
                                purchasesOrchestrator2.dispatch(new Function0<Unit>() {
                                    {
                                        super(0);
                                    }

                                    public Object invoke() {
                                        m305invoke();
                                        return Unit.a;
                                    }

                                    public final void m305invoke() {
                                        ReceiveCustomerInfoCallback.this.onError(purchasesError);
                                    }
                                });
                            }
                        }
                    });
                }
            }
        }, new Function1<PurchasesError, Unit>() {
            {
                super(1);
            }

            public Object invoke(Object obj) {
                invoke((PurchasesError) obj);
                return Unit.a;
            }

            public final void invoke(final PurchasesError purchasesError) {
                Intrinsics.h(purchasesError, "error");
                PurchasesOrchestrator purchasesOrchestrator = PurchasesOrchestrator.this;
                final ReceiveCustomerInfoCallback receiveCustomerInfoCallback = callback;
                purchasesOrchestrator.dispatch(new Function0<Unit>() {
                    {
                        super(0);
                    }

                    public Object invoke() {
                        m306invoke();
                        return Unit.a;
                    }

                    public final void m306invoke() {
                        ReceiveCustomerInfoCallback.this.onError(purchasesError);
                    }
                });
            }
        });
    }

    public final void setAd(String ad2) {
        com.mapbox.common.location.e.D(new Object[]{"setAd"}, 1, "%s called", LogIntent.DEBUG);
        this.subscriberAttributesManager.setAttribute(SubscriberAttributeKey.CampaignParameters.Ad.INSTANCE, ad2, getAppUserID());
    }

    public final void setAdGroup(String adGroup) {
        com.mapbox.common.location.e.D(new Object[]{"setAdGroup"}, 1, "%s called", LogIntent.DEBUG);
        this.subscriberAttributesManager.setAttribute(SubscriberAttributeKey.CampaignParameters.AdGroup.INSTANCE, adGroup, getAppUserID());
    }

    public final void setAdjustID(String adjustID) {
        com.mapbox.common.location.e.D(new Object[]{"setAdjustID"}, 1, "%s called", LogIntent.DEBUG);
        this.subscriberAttributesManager.setAttributionID(SubscriberAttributeKey.AttributionIds.Adjust.INSTANCE, adjustID, getAppUserID(), this.application);
    }

    public final void setAirshipChannelID(String airshipChannelID) {
        com.mapbox.common.location.e.D(new Object[]{"setAirshipChannelID"}, 1, "%s called", LogIntent.DEBUG);
        this.subscriberAttributesManager.setAttribute(SubscriberAttributeKey.IntegrationIds.Airship.INSTANCE, airshipChannelID, getAppUserID());
    }

    public final synchronized void setAllowSharingPlayStoreAccount(boolean z) {
        setState$purchases_defaultsRelease(PurchasesState.copy$default(getState$purchases_defaultsRelease(), Boolean.valueOf(z), null, null, false, false, 30, null));
    }

    public final void setAppConfig(AppConfig appConfig) {
        Intrinsics.h(appConfig, "<set-?>");
        this.appConfig = appConfig;
    }

    public final void setAppsflyerID(String appsflyerID) {
        com.mapbox.common.location.e.D(new Object[]{"setAppsflyerID"}, 1, "%s called", LogIntent.DEBUG);
        this.subscriberAttributesManager.setAttributionID(SubscriberAttributeKey.AttributionIds.AppsFlyer.INSTANCE, appsflyerID, getAppUserID(), this.application);
    }

    public final void setAttributes(Map<String, String> attributes) {
        Intrinsics.h(attributes, "attributes");
        com.mapbox.common.location.e.D(new Object[]{"setAttributes"}, 1, "%s called", LogIntent.DEBUG);
        this.subscriberAttributesManager.setAttributes(attributes, getAppUserID());
    }

    public final void setCampaign(String campaign) {
        com.mapbox.common.location.e.D(new Object[]{"setCampaign"}, 1, "%s called", LogIntent.DEBUG);
        this.subscriberAttributesManager.setAttribute(SubscriberAttributeKey.CampaignParameters.Campaign.INSTANCE, campaign, getAppUserID());
    }

    public final void setCleverTapID(String cleverTapID) {
        com.mapbox.common.location.e.D(new Object[]{"setCleverTapID"}, 1, "%s called", LogIntent.DEBUG);
        this.subscriberAttributesManager.setAttributionID(SubscriberAttributeKey.AttributionIds.CleverTap.INSTANCE, cleverTapID, getAppUserID(), this.application);
    }

    public final void setCreative(String creative) {
        com.mapbox.common.location.e.D(new Object[]{"setCreative"}, 1, "%s called", LogIntent.DEBUG);
        this.subscriberAttributesManager.setAttribute(SubscriberAttributeKey.CampaignParameters.Creative.INSTANCE, creative, getAppUserID());
    }

    public final synchronized void setCustomerCenterListener(CustomerCenterListener customerCenterListener) {
        this.customerCenterListener = customerCenterListener;
    }

    public final void setDisplayName(String displayName) {
        com.mapbox.common.location.e.D(new Object[]{"setDisplayName"}, 1, "%s called", LogIntent.DEBUG);
        this.subscriberAttributesManager.setAttribute(SubscriberAttributeKey.DisplayName.INSTANCE, displayName, getAppUserID());
    }

    public final void setEmail(String email) {
        com.mapbox.common.location.e.D(new Object[]{"setEmail"}, 1, "%s called", LogIntent.DEBUG);
        this.subscriberAttributesManager.setAttribute(SubscriberAttributeKey.Email.INSTANCE, email, getAppUserID());
    }

    public final void setFBAnonymousID(String fbAnonymousID) {
        com.mapbox.common.location.e.D(new Object[]{"setFBAnonymousID"}, 1, "%s called", LogIntent.DEBUG);
        this.subscriberAttributesManager.setAttributionID(SubscriberAttributeKey.AttributionIds.Facebook.INSTANCE, fbAnonymousID, getAppUserID(), this.application);
    }

    public final synchronized void setFinishTransactions(boolean z) {
        this.appConfig.setFinishTransactions(z);
    }

    public final void setFirebaseAppInstanceID(String firebaseAppInstanceID) {
        com.mapbox.common.location.e.D(new Object[]{"setFirebaseAppInstanceID"}, 1, "%s called", LogIntent.DEBUG);
        this.subscriberAttributesManager.setAttribute(SubscriberAttributeKey.IntegrationIds.FirebaseAppInstanceId.INSTANCE, firebaseAppInstanceID, getAppUserID());
    }

    public final void setKeyword(String keyword) {
        com.mapbox.common.location.e.D(new Object[]{"seKeyword"}, 1, "%s called", LogIntent.DEBUG);
        this.subscriberAttributesManager.setAttribute(SubscriberAttributeKey.CampaignParameters.Keyword.INSTANCE, keyword, getAppUserID());
    }

    public final void setKochavaDeviceID(String kochavaDeviceID) {
        com.mapbox.common.location.e.D(new Object[]{"setKochavaDeviceID"}, 1, "%s called", LogIntent.DEBUG);
        this.subscriberAttributesManager.setAttributionID(SubscriberAttributeKey.AttributionIds.Kochava.INSTANCE, kochavaDeviceID, getAppUserID(), this.application);
    }

    public final void setMediaSource(String mediaSource) {
        com.mapbox.common.location.e.D(new Object[]{"setMediaSource"}, 1, "%s called", LogIntent.DEBUG);
        this.subscriberAttributesManager.setAttribute(SubscriberAttributeKey.CampaignParameters.MediaSource.INSTANCE, mediaSource, getAppUserID());
    }

    public final void setMixpanelDistinctID(String mixpanelDistinctID) {
        com.mapbox.common.location.e.D(new Object[]{"setMixpanelDistinctID"}, 1, "%s called", LogIntent.DEBUG);
        this.subscriberAttributesManager.setAttribute(SubscriberAttributeKey.IntegrationIds.MixpanelDistinctId.INSTANCE, mixpanelDistinctID, getAppUserID());
    }

    public final void setMparticleID(String mparticleID) {
        com.mapbox.common.location.e.D(new Object[]{"setMparticleID"}, 1, "%s called", LogIntent.DEBUG);
        this.subscriberAttributesManager.setAttributionID(SubscriberAttributeKey.AttributionIds.Mparticle.INSTANCE, mparticleID, getAppUserID(), this.application);
    }

    public final void setOnesignalID(String onesignalID) {
        com.mapbox.common.location.e.D(new Object[]{"setOnesignalID"}, 1, "%s called", LogIntent.DEBUG);
        this.subscriberAttributesManager.setAttribute(SubscriberAttributeKey.IntegrationIds.OneSignal.INSTANCE, onesignalID, getAppUserID());
    }

    public final void setOnesignalUserID(String onesignalUserID) {
        com.mapbox.common.location.e.D(new Object[]{"setOnesignalUserID"}, 1, "%s called", LogIntent.DEBUG);
        this.subscriberAttributesManager.setAttribute(SubscriberAttributeKey.IntegrationIds.OneSignalUserId.INSTANCE, onesignalUserID, getAppUserID());
    }

    public final void setPhoneNumber(String phoneNumber) {
        com.mapbox.common.location.e.D(new Object[]{"setPhoneNumber"}, 1, "%s called", LogIntent.DEBUG);
        this.subscriberAttributesManager.setAttribute(SubscriberAttributeKey.PhoneNumber.INSTANCE, phoneNumber, getAppUserID());
    }

    public final void setPushToken(String fcmToken) {
        com.mapbox.common.location.e.D(new Object[]{"setPushToken"}, 1, "%s called", LogIntent.DEBUG);
        this.subscriberAttributesManager.setAttribute(SubscriberAttributeKey.FCMTokens.INSTANCE, fcmToken, getAppUserID());
    }

    public final void setState$purchases_defaultsRelease(PurchasesState purchasesState) {
        Intrinsics.h(purchasesState, "value");
        this.purchasesStateCache.setPurchasesState(purchasesState);
    }

    public final void setTenjinAnalyticsInstallationID(String tenjinAnalyticsInstallationID) {
        com.mapbox.common.location.e.D(new Object[]{"setTenjinAnalyticsInstallationID"}, 1, "%s called", LogIntent.DEBUG);
        this.subscriberAttributesManager.setAttribute(SubscriberAttributeKey.IntegrationIds.TenjinAnalyticsInstallationId.INSTANCE, tenjinAnalyticsInstallationID, getAppUserID());
    }

    public final synchronized void setUpdatedCustomerInfoListener(UpdatedCustomerInfoListener updatedCustomerInfoListener) {
        this.customerInfoUpdateHandler.setUpdatedCustomerInfoListener(updatedCustomerInfoListener);
    }

    public final void showInAppMessagesIfNeeded(Activity activity, List<? extends InAppMessageType> inAppMessageTypes) {
        Intrinsics.h(activity, "activity");
        Intrinsics.h(inAppMessageTypes, "inAppMessageTypes");
        this.billing.showInAppMessagesIfNeeded(activity, inAppMessageTypes, new Function0<Unit>() {
            {
                super(0);
            }

            public Object invoke() {
                m307invoke();
                return Unit.a;
            }

            public final void m307invoke() {
                PurchasesOrchestrator.syncPurchases$default(PurchasesOrchestrator.this, null, 1, null);
            }
        });
    }

    public final void startDeprecatedProductChange(Activity activity, PurchasingData purchasingData, PresentedOfferingContext presentedOfferingContext, String oldProductId, GoogleReplacementMode googleReplacementMode, ProductChangeCallback listener) {
        String str;
        ProductChangeCallback productChangeCallback;
        Unit unit;
        String offeringIdentifier;
        Intrinsics.h(activity, "activity");
        Intrinsics.h(purchasingData, "purchasingData");
        Intrinsics.h(oldProductId, "oldProductId");
        Intrinsics.h(listener, "listener");
        if (purchasingData.getProductType() != ProductType.SUBS) {
            getAndClearProductChangeCallback();
            PurchasesError purchasesError = new PurchasesError(PurchasesErrorCode.PurchaseNotAllowedError, "UpgradeInfo passed to purchase for non-sub product type. No upgrade will occur. Consider using non-upgrade purchase flows for this product.");
            LogUtilsKt.errorLog(purchasesError);
            Unit unit2 = Unit.a;
            dispatch(listener, purchasesError);
            return;
        }
        LogIntent logIntent = LogIntent.PURCHASE;
        StringBuilder sb = new StringBuilder(" ");
        sb.append(purchasingData);
        sb.append(' ');
        String str2 = null;
        O6.c.p(sb, (presentedOfferingContext == null || (offeringIdentifier = presentedOfferingContext.getOfferingIdentifier()) == null) ? null : " - offering: ".concat(offeringIdentifier), " oldProductId: ", oldProductId, " googleReplacementMode ");
        sb.append(googleReplacementMode);
        com.mapbox.common.location.e.D(new Object[]{sb.toString()}, 1, "Product change started: %s", logIntent);
        synchronized (this) {
            try {
                if (!this.appConfig.getFinishTransactions()) {
                    LogWrapperKt.log(LogIntent.WARNING, "finishTransactions is set to false and a purchase has been started. Are you sure you want to do this? More info here: https://errors.rev.cat/finishTransactions");
                }
                if (getState$purchases_defaultsRelease().getDeprecatedProductChangeCallback() == null) {
                    setState$purchases_defaultsRelease(PurchasesState.copy$default(getState$purchases_defaultsRelease(), null, null, listener, false, false, 27, null));
                    str = this.identityManager.getCurrentAppUserID();
                } else {
                    str = null;
                }
                Unit unit3 = Unit.a;
            } catch (Throwable th) {
                throw th;
            }
        }
        if (str != null) {
            productChangeCallback = listener;
            replaceOldPurchaseWithNewProduct(purchasingData, oldProductId, googleReplacementMode, activity, str, presentedOfferingContext, null, productChangeCallback);
            unit = Unit.a;
        } else {
            productChangeCallback = listener;
            unit = null;
        }
        if (unit == null) {
            getAndClearProductChangeCallback();
            PurchasesError purchasesError2 = new PurchasesError(PurchasesErrorCode.OperationAlreadyInProgressError, str2, 2, str2);
            LogUtilsKt.errorLog(purchasesError2);
            dispatch(productChangeCallback, purchasesError2);
        }
    }

    public final void startProductChange(Activity activity, PurchasingData purchasingData, PresentedOfferingContext presentedOfferingContext, String oldProductId, GoogleReplacementMode googleReplacementMode, Boolean isPersonalizedPrice, PurchaseCallback purchaseCallback) {
        String str;
        Unit unit;
        String offeringIdentifier;
        Intrinsics.h(activity, "activity");
        Intrinsics.h(purchasingData, "purchasingData");
        Intrinsics.h(oldProductId, "oldProductId");
        Intrinsics.h(googleReplacementMode, "googleReplacementMode");
        Intrinsics.h(purchaseCallback, "purchaseCallback");
        trackPurchaseStarted(purchasingData.getProductId(), purchasingData.getProductType());
        PurchaseCallback createCallbackWithDiagnosticsIfNeeded = createCallbackWithDiagnosticsIfNeeded(purchaseCallback, purchasingData, this.dateProvider.getNow());
        if (purchasingData.getProductType() != ProductType.SUBS) {
            PurchasesError purchasesError = new PurchasesError(PurchasesErrorCode.PurchaseNotAllowedError, "UpgradeInfo passed to purchase for non-sub product type. No upgrade will occur. Consider using non-upgrade purchase flows for this product.");
            LogUtilsKt.errorLog(purchasesError);
            dispatch(createCallbackWithDiagnosticsIfNeeded, purchasesError);
            return;
        }
        LogIntent logIntent = LogIntent.PURCHASE;
        StringBuilder sb = new StringBuilder(" ");
        sb.append(purchasingData);
        sb.append(' ');
        String str2 = null;
        O6.c.p(sb, (presentedOfferingContext == null || (offeringIdentifier = presentedOfferingContext.getOfferingIdentifier()) == null) ? null : " - offering: ".concat(offeringIdentifier), " oldProductId: ", oldProductId, " googleReplacementMode ");
        sb.append(googleReplacementMode);
        com.mapbox.common.location.e.D(new Object[]{sb.toString()}, 1, "Product change started: %s", logIntent);
        synchronized (this) {
            try {
                if (!this.appConfig.getFinishTransactions()) {
                    LogWrapperKt.log(LogIntent.WARNING, "finishTransactions is set to false and a purchase has been started. Are you sure you want to do this? More info here: https://errors.rev.cat/finishTransactions");
                }
                if (getState$purchases_defaultsRelease().getPurchaseCallbacksByProductId().containsKey(purchasingData.getProductId())) {
                    str = null;
                } else {
                    setState$purchases_defaultsRelease(PurchasesState.copy$default(getState$purchases_defaultsRelease(), null, MapsKt.k0(getState$purchases_defaultsRelease().getPurchaseCallbacksByProductId(), i.c0(new kotlin.Pair(googleReplacementMode == GoogleReplacementMode.DEFERRED ? oldProductId : purchasingData.getProductId(), createCallbackWithDiagnosticsIfNeeded))), null, false, false, 29, null));
                    str = this.identityManager.getCurrentAppUserID();
                }
                Unit unit2 = Unit.a;
            } catch (Throwable th) {
                throw th;
            }
        }
        if (str != null) {
            replaceOldPurchaseWithNewProduct(purchasingData, oldProductId, googleReplacementMode, activity, str, presentedOfferingContext, isPersonalizedPrice, createCallbackWithDiagnosticsIfNeeded);
            unit = Unit.a;
        } else {
            unit = null;
        }
        if (unit == null) {
            PurchasesError purchasesError2 = new PurchasesError(PurchasesErrorCode.OperationAlreadyInProgressError, str2, 2, str2);
            LogUtilsKt.errorLog(purchasesError2);
            Iterator<T> it = getAndClearAllPurchaseCallbacks().iterator();
            while (it.hasNext()) {
                dispatch((PurchaseCallback) it.next(), purchasesError2);
            }
        }
    }

    public final void startPurchase(Activity activity, PurchasingData purchasingData, PresentedOfferingContext presentedOfferingContext, Boolean isPersonalizedPrice, PurchaseCallback listener) {
        String str;
        Unit unit;
        String offeringIdentifier;
        Intrinsics.h(activity, "activity");
        Intrinsics.h(purchasingData, "purchasingData");
        Intrinsics.h(listener, "listener");
        LogIntent logIntent = LogIntent.PURCHASE;
        StringBuilder sb = new StringBuilder(" ");
        sb.append(purchasingData);
        sb.append(' ');
        String str2 = null;
        sb.append((presentedOfferingContext == null || (offeringIdentifier = presentedOfferingContext.getOfferingIdentifier()) == null) ? null : " - offering: ".concat(offeringIdentifier));
        LogWrapperKt.log(logIntent, String.format("Purchase started - product: %s", Arrays.copyOf(new Object[]{sb.toString()}, 1)));
        trackPurchaseStarted(purchasingData.getProductId(), purchasingData.getProductType());
        PurchaseCallback createCallbackWithDiagnosticsIfNeeded = createCallbackWithDiagnosticsIfNeeded(listener, purchasingData, this.dateProvider.getNow());
        synchronized (this) {
            try {
                if (!this.appConfig.getFinishTransactions()) {
                    LogWrapperKt.log(LogIntent.WARNING, "finishTransactions is set to false and a purchase has been started. Are you sure you want to do this? More info here: https://errors.rev.cat/finishTransactions");
                }
                if (getState$purchases_defaultsRelease().getPurchaseCallbacksByProductId().containsKey(purchasingData.getProductId())) {
                    str = null;
                } else {
                    setState$purchases_defaultsRelease(PurchasesState.copy$default(getState$purchases_defaultsRelease(), null, MapsKt.k0(getState$purchases_defaultsRelease().getPurchaseCallbacksByProductId(), i.c0(new kotlin.Pair(purchasingData.getProductId(), createCallbackWithDiagnosticsIfNeeded))), null, false, false, 29, null));
                    str = this.identityManager.getCurrentAppUserID();
                }
                Unit unit2 = Unit.a;
            } catch (Throwable th) {
                throw th;
            }
        }
        if (str != null) {
            this.billing.makePurchaseAsync(activity, str, purchasingData, null, presentedOfferingContext, isPersonalizedPrice);
            unit = Unit.a;
        } else {
            unit = null;
        }
        if (unit == null) {
            PurchasesError purchasesError = new PurchasesError(PurchasesErrorCode.OperationAlreadyInProgressError, str2, 2, str2);
            LogUtilsKt.errorLog(purchasesError);
            dispatch(createCallbackWithDiagnosticsIfNeeded, purchasesError);
        }
    }

    public final void switchUser(String newAppUserID) {
        Intrinsics.h(newAppUserID, "newAppUserID");
        if (Intrinsics.c(this.identityManager.getCurrentAppUserID(), newAppUserID)) {
            LogUtilsKt.warnLog(String.format("switchUser called with the same appUserID as the current user %s. This has no effect.", Arrays.copyOf(new Object[]{newAppUserID}, 1)));
        } else {
            this.identityManager.switchUser(newAppUserID);
            OfferingsManager.fetchAndCacheOfferings$default(this.offeringsManager, newAppUserID, getState$purchases_defaultsRelease().getAppInBackground(), null, null, 12, null);
        }
    }

    public final void syncAmazonPurchase(String productID, final String receiptID, final String amazonUserID, final String isoCurrencyCode, final Double price) {
        Intrinsics.h(productID, "productID");
        Intrinsics.h(receiptID, "receiptID");
        Intrinsics.h(amazonUserID, "amazonUserID");
        LogIntent logIntent = LogIntent.DEBUG;
        com.mapbox.common.location.e.D(new Object[]{receiptID, amazonUserID}, 2, "Syncing purchase with token %s, for store user ID %s", logIntent);
        Set<String> previouslySentHashedTokens = this.deviceCache.getPreviouslySentHashedTokens();
        if (!previouslySentHashedTokens.contains(UtilsKt.sha1(receiptID))) {
            previouslySentHashedTokens = null;
        }
        if (previouslySentHashedTokens != null) {
            com.mapbox.common.location.e.D(new Object[]{receiptID, amazonUserID}, 2, "Skipping syncing purchase %s for store user ID %s. It has already been posted", logIntent);
        } else {
            final String currentAppUserID = this.identityManager.getCurrentAppUserID();
            this.billing.normalizePurchaseData(productID, receiptID, amazonUserID, new Function1<String, Unit>() {
                {
                    super(1);
                }

                public Object invoke(Object obj) {
                    invoke((String) obj);
                    return Unit.a;
                }

                public final void invoke(String str) {
                    PostReceiptHelper postReceiptHelper;
                    Intrinsics.h(str, "normalizedProductID");
                    List J = A9.b.J(str);
                    Double d = price;
                    Double d2 = (d == null || d.doubleValue() == 0.0d) ? null : d;
                    String str2 = isoCurrencyCode;
                    ReceiptInfo receiptInfo = new ReceiptInfo(J, null, null, null, d2, (str2 == null || j.b0(str2)) ? null : str2, null, 78, null);
                    postReceiptHelper = this.postReceiptHelper;
                    String str3 = receiptID;
                    String str4 = amazonUserID;
                    boolean allowSharingPlayStoreAccount = this.getAllowSharingPlayStoreAccount();
                    String str5 = currentAppUserID;
                    PostReceiptInitiationSource postReceiptInitiationSource = PostReceiptInitiationSource.RESTORE;
                    final String str6 = receiptID;
                    final String str7 = amazonUserID;
                    Function1<CustomerInfo, Unit> function1 = new Function1<CustomerInfo, Unit>() {
                        {
                            super(1);
                        }

                        public Object invoke(Object obj) {
                            invoke((CustomerInfo) obj);
                            return Unit.a;
                        }

                        public final void invoke(CustomerInfo customerInfo) {
                            Intrinsics.h(customerInfo, "it");
                            LogWrapperKt.log(LogIntent.PURCHASE, String.format("Purchase %s synced %s", Arrays.copyOf(new Object[]{str6, str7}, 2)));
                        }
                    };
                    final String str8 = receiptID;
                    final String str9 = amazonUserID;
                    postReceiptHelper.postTokenWithoutConsuming(str3, str4, receiptInfo, allowSharingPlayStoreAccount, str5, null, postReceiptInitiationSource, function1, new Function1<PurchasesError, Unit>() {
                        {
                            super(1);
                        }

                        public Object invoke(Object obj) {
                            invoke((PurchasesError) obj);
                            return Unit.a;
                        }

                        public final void invoke(PurchasesError purchasesError) {
                            Intrinsics.h(purchasesError, "error");
                            LogWrapperKt.log(LogIntent.RC_ERROR, String.format("Error syncing purchase %s for store user ID %s. Error: %s", Arrays.copyOf(new Object[]{str8, str9, purchasesError}, 3)));
                        }
                    });
                }
            }, new Function1<PurchasesError, Unit>() {
                {
                    super(1);
                }

                public Object invoke(Object obj) {
                    invoke((PurchasesError) obj);
                    return Unit.a;
                }

                public final void invoke(PurchasesError purchasesError) {
                    Intrinsics.h(purchasesError, "error");
                    LogWrapperKt.log(LogIntent.RC_ERROR, String.format("Error syncing purchase %s for store user ID %s. Error: %s", Arrays.copyOf(new Object[]{receiptID, amazonUserID, purchasesError}, 3)));
                }
            });
        }
    }

    public final void syncAttributesAndOfferingsIfNeeded(final SyncAttributesAndOfferingsCallback callback) {
        Intrinsics.h(callback, "callback");
        final ?? r0 = new ReceiveOfferingsCallback() {
            @Override
            public void onError(PurchasesError error) {
                Intrinsics.h(error, "error");
                SyncAttributesAndOfferingsCallback.this.onError(error);
            }

            @Override
            public void onReceived(Offerings offerings) {
                Intrinsics.h(offerings, "offerings");
                SyncAttributesAndOfferingsCallback.this.onSuccess(offerings);
            }
        };
        if (this.lastSyncAttributesAndOfferingsRateLimiter.shouldProceed()) {
            this.subscriberAttributesManager.synchronizeSubscriberAttributesForAllUsers(getAppUserID(), new Function0<Unit>() {
                {
                    super(0);
                }

                public Object invoke() {
                    m308invoke();
                    return Unit.a;
                }

                public final void m308invoke() {
                    PurchasesOrchestrator.this.getOfferings(r0, true);
                }
            });
            return;
        }
        LogIntent logIntent = LogIntent.WARNING;
        Integer valueOf = Integer.valueOf(this.lastSyncAttributesAndOfferingsRateLimiter.getMaxCallsInPeriod());
        long j = this.lastSyncAttributesAndOfferingsRateLimiter.getPeriodSeconds-UwyO8pc();
        Duration.Companion companion = Duration.x;
        com.mapbox.common.location.e.D(new Object[]{valueOf, Long.valueOf(Duration.o(j, DurationUnit.X))}, 2, "Sync attributes and offerings rate limit reached: %d per %d seconds. Returning offerings from cache", logIntent);
        getOfferings$default(this, r0, false, 2, null);
    }

    public final void syncPurchases(final SyncPurchasesCallback listener) {
        this.syncPurchasesHelper.syncPurchases(getAllowSharingPlayStoreAccount(), getState$purchases_defaultsRelease().getAppInBackground(), new Function1<CustomerInfo, Unit>() {
            {
                super(1);
            }

            public Object invoke(Object obj) {
                invoke((CustomerInfo) obj);
                return Unit.a;
            }

            public final void invoke(CustomerInfo customerInfo) {
                Intrinsics.h(customerInfo, "it");
                SyncPurchasesCallback syncPurchasesCallback = SyncPurchasesCallback.this;
                if (syncPurchasesCallback != null) {
                    syncPurchasesCallback.onSuccess(customerInfo);
                }
            }
        }, new Function1<PurchasesError, Unit>() {
            {
                super(1);
            }

            public Object invoke(Object obj) {
                invoke((PurchasesError) obj);
                return Unit.a;
            }

            public final void invoke(PurchasesError purchasesError) {
                Intrinsics.h(purchasesError, "it");
                SyncPurchasesCallback syncPurchasesCallback = SyncPurchasesCallback.this;
                if (syncPurchasesCallback != null) {
                    syncPurchasesCallback.onError(purchasesError);
                }
            }
        });
    }

    @ExperimentalPreviewRevenueCatPurchasesAPI
    public final void track(FeatureEvent event) {
        EventsManager eventsManager;
        Intrinsics.h(event, "event");
        if (event instanceof PaywallEvent) {
            this.paywallPresentedCache.receiveEvent((PaywallEvent) event);
        }
        if (!AndroidVersionUtilsKt.isAndroidNOrNewer() || (eventsManager = this.eventsManager) == null) {
            return;
        }
        eventsManager.track(event);
    }

    public final void getCustomerInfo(CacheFetchPolicy fetchPolicy, boolean trackDiagnostics, ReceiveCustomerInfoCallback callback) {
        Intrinsics.h(fetchPolicy, "fetchPolicy");
        Intrinsics.h(callback, "callback");
        this.customerInfoHelper.retrieveCustomerInfo(this.identityManager.getCurrentAppUserID(), fetchPolicy, getState$purchases_defaultsRelease().getAppInBackground(), getAllowSharingPlayStoreAccount(), trackDiagnostics, callback);
    }

    public final void getStorefrontCountryCode(final GetStorefrontCallback callback) {
        Unit unit;
        Intrinsics.h(callback, "callback");
        String str = this.storefrontCountryCode;
        if (str != null) {
            callback.onReceived(str);
            unit = Unit.a;
        } else {
            unit = null;
        }
        if (unit == null) {
            this.billing.getStorefront(new Function1<String, Unit>() {
                {
                    super(1);
                }

                public Object invoke(Object obj) {
                    invoke((String) obj);
                    return Unit.a;
                }

                public final void invoke(String str2) {
                    Intrinsics.h(str2, "countryCode");
                    PurchasesOrchestrator.this.storefrontCountryCode = str2;
                    callback.onReceived(str2);
                }
            }, new Function1<PurchasesError, Unit>() {
                {
                    super(1);
                }

                public Object invoke(Object obj) {
                    invoke((PurchasesError) obj);
                    return Unit.a;
                }

                public final void invoke(PurchasesError purchasesError) {
                    Intrinsics.h(purchasesError, "error");
                    LogUtilsKt.errorLog(purchasesError);
                    GetStorefrontCallback.this.onError(purchasesError);
                }
            });
        }
    }

    public final void dispatch(final PurchaseErrorCallback purchaseErrorCallback, final PurchasesError purchasesError) {
        dispatch(new Function0<Unit>() {
            {
                super(0);
            }

            public Object invoke() {
                m293invoke();
                return Unit.a;
            }

            public final void m293invoke() {
                PurchaseErrorCallback purchaseErrorCallback2 = PurchaseErrorCallback.this;
                PurchasesError purchasesError2 = purchasesError;
                purchaseErrorCallback2.onError(purchasesError2, purchasesError2.getCode() == PurchasesErrorCode.PurchaseCancelledError);
            }
        });
    }

    public final void getProductsOfTypes(Set<String> productIds, Set<? extends ProductType> types, List<? extends StoreProduct> collectedStoreProducts, Date startTime, GetStoreProductsCallback callback) {
        final Set<String> set;
        final List<? extends StoreProduct> list;
        GetStoreProductsCallback getStoreProductsCallback;
        Unit unit;
        if (startTime == null) {
            trackGetProductsStarted(productIds);
            startTime = this.dateProvider.getNow();
        }
        final Date date = startTime;
        final Set q1 = bl.f.q1(types);
        ProductType productType = (ProductType) bl.f.G0(q1);
        if (productType != null) {
            q1.remove(productType);
        } else {
            productType = null;
        }
        if (productType != null) {
            set = productIds;
            list = collectedStoreProducts;
            final GetStoreProductsCallback getStoreProductsCallback2 = callback;
            this.billing.queryProductDetailsAsync(productType, set, new Function1<List<? extends StoreProduct>, Unit>() {
                {
                    super(1);
                }

                public Object invoke(Object obj) {
                    invoke((List<? extends StoreProduct>) obj);
                    return Unit.a;
                }

                public final void invoke(final List<? extends StoreProduct> list2) {
                    Intrinsics.h(list2, "storeProducts");
                    final PurchasesOrchestrator purchasesOrchestrator = PurchasesOrchestrator.this;
                    final Set<String> set2 = set;
                    final Set<ProductType> set3 = q1;
                    final List<StoreProduct> list3 = list;
                    final Date date2 = date;
                    final GetStoreProductsCallback getStoreProductsCallback3 = getStoreProductsCallback2;
                    purchasesOrchestrator.dispatch(new Function0<Unit>() {
                        {
                            super(0);
                        }

                        public Object invoke() {
                            m295invoke();
                            return Unit.a;
                        }

                        public final void m295invoke() {
                            PurchasesOrchestrator.this.getProductsOfTypes(set2, set3, bl.f.X0(list3, list2), date2, getStoreProductsCallback3);
                        }
                    });
                }
            }, new Function1<PurchasesError, Unit>() {
                {
                    super(1);
                }

                public Object invoke(Object obj) {
                    invoke((PurchasesError) obj);
                    return Unit.a;
                }

                public final void invoke(final PurchasesError purchasesError) {
                    Intrinsics.h(purchasesError, "it");
                    final PurchasesOrchestrator purchasesOrchestrator = PurchasesOrchestrator.this;
                    final Date date2 = date;
                    final Set<String> set2 = set;
                    final GetStoreProductsCallback getStoreProductsCallback3 = getStoreProductsCallback2;
                    purchasesOrchestrator.dispatch(new Function0<Unit>() {
                        {
                            super(0);
                        }

                        public Object invoke() {
                            m296invoke();
                            return Unit.a;
                        }

                        public final void m296invoke() {
                            PurchasesOrchestrator purchasesOrchestrator2 = PurchasesOrchestrator.this;
                            Date date3 = date2;
                            Set<String> set3 = set2;
                            purchasesOrchestrator2.trackGetProductsResult(date3, set3, set3, purchasesError);
                            getStoreProductsCallback3.onError(purchasesError);
                        }
                    });
                }
            });
            unit = Unit.a;
            getStoreProductsCallback = getStoreProductsCallback2;
        } else {
            set = productIds;
            list = collectedStoreProducts;
            getStoreProductsCallback = callback;
            unit = null;
        }
        if (unit == null) {
            ArrayList arrayList = new ArrayList(bl.b.a0(list, 10));
            Iterator<T> it = list.iterator();
            while (it.hasNext()) {
                arrayList.add(((StoreProduct) it.next()).getId());
            }
            trackGetProductsResult(date, set, l.h0(set, bl.f.r1(arrayList)), null);
            getStoreProductsCallback.onReceived(list);
        }
    }

    public PurchasesOrchestrator(Application application, String str, Backend backend, BillingAbstract billingAbstract, DeviceCache deviceCache, IdentityManager identityManager, SubscriberAttributesManager subscriberAttributesManager, AppConfig appConfig, CustomerInfoHelper customerInfoHelper, CustomerInfoUpdateHandler customerInfoUpdateHandler, DiagnosticsSynchronizer diagnosticsSynchronizer, DiagnosticsTracker diagnosticsTracker, DateProvider dateProvider, OfflineEntitlementsManager offlineEntitlementsManager, PostReceiptHelper postReceiptHelper, PostTransactionWithProductDetailsHelper postTransactionWithProductDetailsHelper, PostPendingTransactionsHelper postPendingTransactionsHelper, SyncPurchasesHelper syncPurchasesHelper, OfferingsManager offeringsManager, EventsManager eventsManager, PaywallPresentedCache paywallPresentedCache, PurchasesStateCache purchasesStateCache, Handler handler, Dispatcher dispatcher, PurchasesConfiguration purchasesConfiguration, WebPurchaseRedemptionHelper webPurchaseRedemptionHelper, Function0 function0, int i, DefaultConstructorMarker defaultConstructorMarker) {
        this(application, str, backend, billingAbstract, deviceCache, identityManager, subscriberAttributesManager, appConfig, customerInfoHelper, customerInfoUpdateHandler, diagnosticsSynchronizer, diagnosticsTracker, (i & 4096) != 0 ? new DefaultDateProvider() : dateProvider, offlineEntitlementsManager, postReceiptHelper, postTransactionWithProductDetailsHelper, postPendingTransactionsHelper, syncPurchasesHelper, offeringsManager, eventsManager, paywallPresentedCache, purchasesStateCache, (4194304 & i) != 0 ? new Handler(Looper.getMainLooper()) : handler, dispatcher, purchasesConfiguration, (33554432 & i) != 0 ? new WebPurchaseRedemptionHelper(backend, identityManager, offlineEntitlementsManager, customerInfoUpdateHandler, null, 16, null) : webPurchaseRedemptionHelper, (i & 67108864) != 0 ? new Function0<D>() {
            public final D m289invoke() {
                Y y = Y.s0;
                Intrinsics.g(y, "get()");
                return y;
            }
        } : function0);
    }
}