package com.revenuecat.purchases.ui.revenuecatui.activity;

import J4.c;
import android.app.Activity;
import androidx.compose.runtime.internal.StabilityInferred;
import androidx.fragment.app.G;
import androidx.fragment.app.L;
import com.revenuecat.purchases.InternalRevenueCatAPI;
import com.revenuecat.purchases.Offering;
import com.revenuecat.purchases.Package;
import com.revenuecat.purchases.PresentedOfferingContext;
import com.revenuecat.purchases.ui.revenuecatui.CustomVariableValue;
import com.revenuecat.purchases.ui.revenuecatui.OfferingSelection;
import com.revenuecat.purchases.ui.revenuecatui.PaywallListener;
import com.revenuecat.purchases.ui.revenuecatui.PaywallPurchaseLogic;
import com.revenuecat.purchases.ui.revenuecatui.activity.PaywallActivityLaunchIfNeededOptions;
import com.revenuecat.purchases.ui.revenuecatui.activity.PaywallActivityLaunchOptions;
import com.revenuecat.purchases.ui.revenuecatui.fonts.ParcelizableFontProvider;
import com.revenuecat.purchases.ui.revenuecatui.helpers.HelperFunctionsKt;
import com.revenuecat.purchases.ui.revenuecatui.helpers.Logger;
import g.AbstractC2050d;
import g.InterfaceC2049c;
import java.lang.ref.WeakReference;
import java.util.Map;
import kotlin.jvm.internal.h;
import kotlin.jvm.internal.o;
import kotlin.jvm.internal.p;
import w4.C3137A;
import w4.InterfaceC3141c;
import x4.AbstractC3251q;
import x4.z;

/* JADX INFO: loaded from: classes3.dex */
@StabilityInferred(parameters = 0)
public final class PaywallActivityLauncher {
    public static final int $stable = 8;
    private final AbstractC2050d activityResultLauncher;
    private Integer currentNonSerializableArgsKey;
    private final WeakReference<Activity> weakActivity;
    private final WeakReference<G> weakFragment;

    /* JADX INFO: renamed from: com.revenuecat.purchases.ui.revenuecatui.activity.PaywallActivityLauncher$launchIfNeeded$1, reason: invalid class name */
    public static final class AnonymousClass1 extends p implements c {
        final /* synthetic */ boolean $edgeToEdge;
        final /* synthetic */ ParcelizableFontProvider $fontProvider;
        final /* synthetic */ Offering $offering;
        final /* synthetic */ PaywallDisplayCallback $paywallDisplayCallback;
        final /* synthetic */ String $requiredEntitlementIdentifier;
        final /* synthetic */ boolean $shouldDisplayDismissButton;
        final /* synthetic */ PaywallActivityLauncher this$0;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public AnonymousClass1(PaywallDisplayCallback paywallDisplayCallback, PaywallActivityLauncher paywallActivityLauncher, String str, Offering offering, ParcelizableFontProvider parcelizableFontProvider, boolean z6, boolean z7) {
            super(1);
            this.$paywallDisplayCallback = paywallDisplayCallback;
            this.this$0 = paywallActivityLauncher;
            this.$requiredEntitlementIdentifier = str;
            this.$offering = offering;
            this.$fontProvider = parcelizableFontProvider;
            this.$shouldDisplayDismissButton = z6;
            this.$edgeToEdge = z7;
        }

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

        public final void invoke(boolean z6) {
            PaywallDisplayCallback paywallDisplayCallback = this.$paywallDisplayCallback;
            if (paywallDisplayCallback != null) {
                paywallDisplayCallback.onPaywallDisplayResult(z6);
            }
            if (z6) {
                PaywallActivityLauncher paywallActivityLauncher = this.this$0;
                String str = this.$requiredEntitlementIdentifier;
                Offering offering = this.$offering;
                OfferingSelection.IdAndPresentedOfferingContext idAndPresentedOfferingContext = null;
                if (offering != null) {
                    String identifier = offering.getIdentifier();
                    Package r02 = (Package) AbstractC3251q.g0(offering.getAvailablePackages());
                    idAndPresentedOfferingContext = new OfferingSelection.IdAndPresentedOfferingContext(identifier, r02 != null ? r02.getPresentedOfferingContext() : null);
                }
                paywallActivityLauncher.launchPaywallWithArgs(new PaywallActivityArgs(str, idAndPresentedOfferingContext, this.$fontProvider, this.$shouldDisplayDismissButton, this.$edgeToEdge, false, (Map) null, (Integer) null, 224, (h) null));
            }
        }
    }

    /* JADX INFO: renamed from: com.revenuecat.purchases.ui.revenuecatui.activity.PaywallActivityLauncher$launchIfNeeded$2, reason: invalid class name */
    public static final class AnonymousClass2 extends p implements c {
        final /* synthetic */ boolean $edgeToEdge;
        final /* synthetic */ ParcelizableFontProvider $fontProvider;
        final /* synthetic */ String $offeringIdentifier;
        final /* synthetic */ PaywallDisplayCallback $paywallDisplayCallback;
        final /* synthetic */ String $requiredEntitlementIdentifier;
        final /* synthetic */ boolean $shouldDisplayDismissButton;
        final /* synthetic */ PaywallActivityLauncher this$0;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public AnonymousClass2(PaywallDisplayCallback paywallDisplayCallback, PaywallActivityLauncher paywallActivityLauncher, String str, String str2, ParcelizableFontProvider parcelizableFontProvider, boolean z6, boolean z7) {
            super(1);
            this.$paywallDisplayCallback = paywallDisplayCallback;
            this.this$0 = paywallActivityLauncher;
            this.$requiredEntitlementIdentifier = str;
            this.$offeringIdentifier = str2;
            this.$fontProvider = parcelizableFontProvider;
            this.$shouldDisplayDismissButton = z6;
            this.$edgeToEdge = z7;
        }

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

        public final void invoke(boolean z6) {
            PaywallDisplayCallback paywallDisplayCallback = this.$paywallDisplayCallback;
            if (paywallDisplayCallback != null) {
                paywallDisplayCallback.onPaywallDisplayResult(z6);
            }
            if (z6) {
                this.this$0.launchPaywallWithArgs(new PaywallActivityArgs(this.$requiredEntitlementIdentifier, new OfferingSelection.IdAndPresentedOfferingContext(this.$offeringIdentifier, null), this.$fontProvider, this.$shouldDisplayDismissButton, this.$edgeToEdge, false, (Map) null, (Integer) null, 224, (h) null));
            }
        }
    }

    /* JADX INFO: renamed from: com.revenuecat.purchases.ui.revenuecatui.activity.PaywallActivityLauncher$launchIfNeeded$3, reason: invalid class name */
    public static final class AnonymousClass3 extends p implements c {
        final /* synthetic */ boolean $edgeToEdge;
        final /* synthetic */ ParcelizableFontProvider $fontProvider;
        final /* synthetic */ Offering $offering;
        final /* synthetic */ boolean $shouldDisplayDismissButton;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public AnonymousClass3(Offering offering, ParcelizableFontProvider parcelizableFontProvider, boolean z6, boolean z7) {
            super(1);
            this.$offering = offering;
            this.$fontProvider = parcelizableFontProvider;
            this.$shouldDisplayDismissButton = z6;
            this.$edgeToEdge = z7;
        }

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

        public final void invoke(boolean z6) {
            OfferingSelection.IdAndPresentedOfferingContext idAndPresentedOfferingContext;
            if (z6) {
                PaywallActivityLauncher paywallActivityLauncher = PaywallActivityLauncher.this;
                Offering offering = this.$offering;
                if (offering != null) {
                    String identifier = offering.getIdentifier();
                    Package r22 = (Package) AbstractC3251q.g0(offering.getAvailablePackages());
                    idAndPresentedOfferingContext = new OfferingSelection.IdAndPresentedOfferingContext(identifier, r22 != null ? r22.getPresentedOfferingContext() : null);
                } else {
                    idAndPresentedOfferingContext = null;
                }
                paywallActivityLauncher.launchPaywallWithArgs(new PaywallActivityArgs((String) null, idAndPresentedOfferingContext, this.$fontProvider, this.$shouldDisplayDismissButton, this.$edgeToEdge, false, (Map) null, (Integer) null, 225, (h) null));
            }
        }
    }

    /* JADX INFO: renamed from: com.revenuecat.purchases.ui.revenuecatui.activity.PaywallActivityLauncher$launchIfNeededWithOptions$1, reason: invalid class name and case insensitive filesystem */
    public static final class C14521 extends p implements c {
        final /* synthetic */ PaywallActivityLaunchIfNeededOptions $options;
        final /* synthetic */ PaywallActivityLauncher this$0;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public C14521(PaywallActivityLaunchIfNeededOptions paywallActivityLaunchIfNeededOptions, PaywallActivityLauncher paywallActivityLauncher) {
            super(1);
            this.$options = paywallActivityLaunchIfNeededOptions;
            this.this$0 = paywallActivityLauncher;
        }

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

        public final void invoke(boolean z6) {
            PaywallDisplayCallback paywallDisplayCallback$revenuecatui_defaultsBc8Release = this.$options.getPaywallDisplayCallback$revenuecatui_defaultsBc8Release();
            if (paywallDisplayCallback$revenuecatui_defaultsBc8Release != null) {
                paywallDisplayCallback$revenuecatui_defaultsBc8Release.onPaywallDisplayResult(z6);
            }
            if (z6) {
                this.this$0.launchPaywallWithArgs(new PaywallActivityArgs(this.$options.getRequiredEntitlementIdentifier$revenuecatui_defaultsBc8Release(), this.$options.toOfferingSelection$revenuecatui_defaultsBc8Release(), this.$options.getFontProvider$revenuecatui_defaultsBc8Release(), this.$options.getShouldDisplayDismissButton$revenuecatui_defaultsBc8Release(), this.$options.getEdgeToEdge$revenuecatui_defaultsBc8Release(), false, (Map) this.$options.getCustomVariables$revenuecatui_defaultsBc8Release(), this.this$0.storeNonSerializableArgsIfNeeded(this.$options.getPurchaseLogic$revenuecatui_defaultsBc8Release(), this.$options.getListener$revenuecatui_defaultsBc8Release()), 32, (h) null));
            }
        }
    }

    /* JADX WARN: Multi-variable type inference failed */
    public PaywallActivityLauncher(InterfaceC2049c resultCaller, final PaywallResultHandler resultHandler) {
        o.h(resultCaller, "resultCaller");
        o.h(resultHandler, "resultHandler");
        this.weakActivity = new WeakReference<>(resultCaller instanceof Activity ? (Activity) resultCaller : null);
        this.weakFragment = new WeakReference<>(resultCaller instanceof G ? (G) resultCaller : null);
        this.activityResultLauncher = resultCaller.registerForActivityResult(new PaywallContract(), new PaywallResultHandler() { // from class: com.revenuecat.purchases.ui.revenuecatui.activity.PaywallActivityLauncher$wrappedHandler$1
            @Override // com.revenuecat.purchases.ui.revenuecatui.activity.PaywallResultHandler, g.InterfaceC2048b
            public void onActivityResult(PaywallResult result) {
                o.h(result, "result");
                Integer num = this.this$0.currentNonSerializableArgsKey;
                if (num != null) {
                    PaywallActivityLauncher paywallActivityLauncher = this.this$0;
                    PaywallActivityNonSerializableArgsStore.INSTANCE.remove(num.intValue());
                    paywallActivityLauncher.currentNonSerializableArgsKey = null;
                }
                resultHandler.onActivityResult(result);
            }
        });
    }

    /* JADX WARN: Removed duplicated region for block: B:8:0x001d  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    private final boolean isActivityFinishing() {
        L activity;
        Activity activity2 = this.weakActivity.get();
        G g6 = this.weakFragment.get();
        if (activity2 == null) {
            if ((g6 != null ? g6.getActivity() : null) != null) {
            }
        } else if ((activity2 == null || !activity2.isFinishing()) && (g6 == null || (activity = g6.getActivity()) == null || !activity.isFinishing())) {
            return false;
        }
        return true;
    }

    /* JADX WARN: Multi-variable type inference failed */
    public static /* synthetic */ void launch$default(PaywallActivityLauncher paywallActivityLauncher, Offering offering, ParcelizableFontProvider parcelizableFontProvider, boolean z6, boolean z7, Map map, int i6, Object obj) {
        if ((i6 & 1) != 0) {
            offering = null;
        }
        if ((i6 & 2) != 0) {
            parcelizableFontProvider = null;
        }
        if ((i6 & 4) != 0) {
            z6 = true;
        }
        if ((i6 & 8) != 0) {
            z7 = PaywallActivityArgsKt.getDefaultEdgeToEdge();
        }
        if ((i6 & 16) != 0) {
            map = z.f26066a;
        }
        paywallActivityLauncher.launch(offering, parcelizableFontProvider, z6, z7, map);
    }

    public static /* synthetic */ void launchIfNeeded$default(PaywallActivityLauncher paywallActivityLauncher, String str, Offering offering, ParcelizableFontProvider parcelizableFontProvider, boolean z6, boolean z7, PaywallDisplayCallback paywallDisplayCallback, int i6, Object obj) {
        if ((i6 & 2) != 0) {
            offering = null;
        }
        if ((i6 & 4) != 0) {
            parcelizableFontProvider = null;
        }
        if ((i6 & 8) != 0) {
            z6 = true;
        }
        if ((i6 & 16) != 0) {
            z7 = PaywallActivityArgsKt.getDefaultEdgeToEdge();
        }
        if ((i6 & 32) != 0) {
            paywallDisplayCallback = null;
        }
        paywallActivityLauncher.launchIfNeeded(str, offering, parcelizableFontProvider, z6, z7, paywallDisplayCallback);
    }

    public static /* synthetic */ void launchIfNeededWithOfferingId$default(PaywallActivityLauncher paywallActivityLauncher, String str, String str2, PresentedOfferingContext presentedOfferingContext, ParcelizableFontProvider parcelizableFontProvider, boolean z6, boolean z7, PaywallDisplayCallback paywallDisplayCallback, int i6, Object obj) {
        if ((i6 & 8) != 0) {
            parcelizableFontProvider = null;
        }
        if ((i6 & 16) != 0) {
            z6 = true;
        }
        if ((i6 & 32) != 0) {
            z7 = PaywallActivityArgsKt.getDefaultEdgeToEdge();
        }
        if ((i6 & 64) != 0) {
            paywallDisplayCallback = null;
        }
        paywallActivityLauncher.launchIfNeededWithOfferingId(str, str2, presentedOfferingContext, parcelizableFontProvider, z6, z7, paywallDisplayCallback);
    }

    /* JADX INFO: Access modifiers changed from: private */
    public final void launchPaywallWithArgs(PaywallActivityArgs paywallActivityArgs) {
        if (isActivityFinishing()) {
            Logger.INSTANCE.e("Not displaying paywall because activity/fragment is finishing or has finished.");
        } else {
            this.activityResultLauncher.a(paywallActivityArgs);
        }
    }

    /* JADX WARN: Multi-variable type inference failed */
    public static /* synthetic */ void launchWithOfferingId$default(PaywallActivityLauncher paywallActivityLauncher, String str, PresentedOfferingContext presentedOfferingContext, ParcelizableFontProvider parcelizableFontProvider, boolean z6, boolean z7, Map map, int i6, Object obj) {
        if ((i6 & 4) != 0) {
            parcelizableFontProvider = null;
        }
        ParcelizableFontProvider parcelizableFontProvider2 = parcelizableFontProvider;
        if ((i6 & 8) != 0) {
            z6 = true;
        }
        boolean z8 = z6;
        if ((i6 & 16) != 0) {
            z7 = PaywallActivityArgsKt.getDefaultEdgeToEdge();
        }
        boolean z9 = z7;
        if ((i6 & 32) != 0) {
            map = z.f26066a;
        }
        paywallActivityLauncher.launchWithOfferingId(str, presentedOfferingContext, parcelizableFontProvider2, z8, z9, map);
    }

    /* JADX INFO: Access modifiers changed from: private */
    public final Integer storeNonSerializableArgsIfNeeded(PaywallPurchaseLogic paywallPurchaseLogic, PaywallListener paywallListener) {
        if (paywallPurchaseLogic == null && paywallListener == null) {
            return null;
        }
        int iStore = PaywallActivityNonSerializableArgsStore.INSTANCE.store(new PaywallActivityNonSerializableArgs(paywallPurchaseLogic, paywallListener));
        this.currentNonSerializableArgsKey = Integer.valueOf(iStore);
        return Integer.valueOf(iStore);
    }

    public final void launch() {
        launch$default(this, null, null, false, false, null, 31, null);
    }

    public final void launchIfNeeded(c shouldDisplayBlock) {
        o.h(shouldDisplayBlock, "shouldDisplayBlock");
        launchIfNeeded$default(this, null, null, false, false, shouldDisplayBlock, 15, null);
    }

    @InternalRevenueCatAPI
    @InterfaceC3141c
    public final void launchIfNeededWithOfferingId(String requiredEntitlementIdentifier, String offeringIdentifier, PresentedOfferingContext presentedOfferingContext) {
        o.h(requiredEntitlementIdentifier, "requiredEntitlementIdentifier");
        o.h(offeringIdentifier, "offeringIdentifier");
        o.h(presentedOfferingContext, "presentedOfferingContext");
        launchIfNeededWithOfferingId$default(this, requiredEntitlementIdentifier, offeringIdentifier, presentedOfferingContext, null, false, false, null, 120, null);
    }

    public final void launchIfNeededWithOptions(PaywallActivityLaunchIfNeededOptions options) {
        c shouldDisplayBlock$revenuecatui_defaultsBc8Release;
        o.h(options, "options");
        if (options.getRequiredEntitlementIdentifier$revenuecatui_defaultsBc8Release() != null) {
            shouldDisplayBlock$revenuecatui_defaultsBc8Release = HelperFunctionsKt.shouldDisplayBlockForEntitlementIdentifier(options.getRequiredEntitlementIdentifier$revenuecatui_defaultsBc8Release());
        } else {
            shouldDisplayBlock$revenuecatui_defaultsBc8Release = options.getShouldDisplayBlock$revenuecatui_defaultsBc8Release();
            o.e(shouldDisplayBlock$revenuecatui_defaultsBc8Release);
        }
        HelperFunctionsKt.shouldDisplayPaywall(shouldDisplayBlock$revenuecatui_defaultsBc8Release, new C14521(options, this));
    }

    @InternalRevenueCatAPI
    @InterfaceC3141c
    public final void launchWithOfferingId(String offeringIdentifier, PresentedOfferingContext presentedOfferingContext) {
        o.h(offeringIdentifier, "offeringIdentifier");
        o.h(presentedOfferingContext, "presentedOfferingContext");
        launchWithOfferingId$default(this, offeringIdentifier, presentedOfferingContext, null, false, false, null, 60, null);
    }

    public final void launchWithOptions(PaywallActivityLaunchOptions options) {
        o.h(options, "options");
        this.activityResultLauncher.a(new PaywallActivityArgs((String) null, options.toOfferingSelection$revenuecatui_defaultsBc8Release(), options.getFontProvider$revenuecatui_defaultsBc8Release(), options.getShouldDisplayDismissButton$revenuecatui_defaultsBc8Release(), options.getEdgeToEdge$revenuecatui_defaultsBc8Release(), false, (Map) options.getCustomVariables$revenuecatui_defaultsBc8Release(), storeNonSerializableArgsIfNeeded(options.getPurchaseLogic$revenuecatui_defaultsBc8Release(), options.getListener$revenuecatui_defaultsBc8Release()), 33, (h) null));
    }

    public final void launch(Offering offering) {
        launch$default(this, offering, null, false, false, null, 30, null);
    }

    public final void launchIfNeeded(Offering offering, c shouldDisplayBlock) {
        o.h(shouldDisplayBlock, "shouldDisplayBlock");
        launchIfNeeded$default(this, offering, null, false, false, shouldDisplayBlock, 14, null);
    }

    @InternalRevenueCatAPI
    @InterfaceC3141c
    public final void launchIfNeededWithOfferingId(String requiredEntitlementIdentifier, String offeringIdentifier, PresentedOfferingContext presentedOfferingContext, ParcelizableFontProvider parcelizableFontProvider) {
        o.h(requiredEntitlementIdentifier, "requiredEntitlementIdentifier");
        o.h(offeringIdentifier, "offeringIdentifier");
        o.h(presentedOfferingContext, "presentedOfferingContext");
        launchIfNeededWithOfferingId$default(this, requiredEntitlementIdentifier, offeringIdentifier, presentedOfferingContext, parcelizableFontProvider, false, false, null, 112, null);
    }

    @InternalRevenueCatAPI
    @InterfaceC3141c
    public final void launchWithOfferingId(String offeringIdentifier, PresentedOfferingContext presentedOfferingContext, ParcelizableFontProvider parcelizableFontProvider) {
        o.h(offeringIdentifier, "offeringIdentifier");
        o.h(presentedOfferingContext, "presentedOfferingContext");
        launchWithOfferingId$default(this, offeringIdentifier, presentedOfferingContext, parcelizableFontProvider, false, false, null, 56, null);
    }

    public static /* synthetic */ void launchIfNeeded$default(PaywallActivityLauncher paywallActivityLauncher, String str, String str2, ParcelizableFontProvider parcelizableFontProvider, boolean z6, boolean z7, PaywallDisplayCallback paywallDisplayCallback, int i6, Object obj) {
        if ((i6 & 4) != 0) {
            parcelizableFontProvider = null;
        }
        if ((i6 & 8) != 0) {
            z6 = true;
        }
        if ((i6 & 16) != 0) {
            z7 = PaywallActivityArgsKt.getDefaultEdgeToEdge();
        }
        if ((i6 & 32) != 0) {
            paywallDisplayCallback = null;
        }
        paywallActivityLauncher.launchIfNeeded(str, str2, parcelizableFontProvider, z6, z7, paywallDisplayCallback);
    }

    public final void launch(Offering offering, ParcelizableFontProvider parcelizableFontProvider) {
        launch$default(this, offering, parcelizableFontProvider, false, false, null, 28, null);
    }

    public final void launchIfNeeded(Offering offering, ParcelizableFontProvider parcelizableFontProvider, c shouldDisplayBlock) {
        o.h(shouldDisplayBlock, "shouldDisplayBlock");
        launchIfNeeded$default(this, offering, parcelizableFontProvider, false, false, shouldDisplayBlock, 12, null);
    }

    @InternalRevenueCatAPI
    @InterfaceC3141c
    public final void launchIfNeededWithOfferingId(String requiredEntitlementIdentifier, String offeringIdentifier, PresentedOfferingContext presentedOfferingContext, ParcelizableFontProvider parcelizableFontProvider, boolean z6) {
        o.h(requiredEntitlementIdentifier, "requiredEntitlementIdentifier");
        o.h(offeringIdentifier, "offeringIdentifier");
        o.h(presentedOfferingContext, "presentedOfferingContext");
        launchIfNeededWithOfferingId$default(this, requiredEntitlementIdentifier, offeringIdentifier, presentedOfferingContext, parcelizableFontProvider, z6, false, null, 96, null);
    }

    @InternalRevenueCatAPI
    @InterfaceC3141c
    public final void launchWithOfferingId(String offeringIdentifier, PresentedOfferingContext presentedOfferingContext, ParcelizableFontProvider parcelizableFontProvider, boolean z6) {
        o.h(offeringIdentifier, "offeringIdentifier");
        o.h(presentedOfferingContext, "presentedOfferingContext");
        launchWithOfferingId$default(this, offeringIdentifier, presentedOfferingContext, parcelizableFontProvider, z6, false, null, 48, null);
    }

    public static /* synthetic */ void launch$default(PaywallActivityLauncher paywallActivityLauncher, String str, ParcelizableFontProvider parcelizableFontProvider, boolean z6, boolean z7, int i6, Object obj) {
        if ((i6 & 2) != 0) {
            parcelizableFontProvider = null;
        }
        if ((i6 & 4) != 0) {
            z6 = true;
        }
        if ((i6 & 8) != 0) {
            z7 = PaywallActivityArgsKt.getDefaultEdgeToEdge();
        }
        paywallActivityLauncher.launch(str, parcelizableFontProvider, z6, z7);
    }

    public final void launch(Offering offering, ParcelizableFontProvider parcelizableFontProvider, boolean z6) {
        launch$default(this, offering, parcelizableFontProvider, z6, false, null, 24, null);
    }

    public final void launchIfNeeded(Offering offering, ParcelizableFontProvider parcelizableFontProvider, boolean z6, c shouldDisplayBlock) {
        o.h(shouldDisplayBlock, "shouldDisplayBlock");
        launchIfNeeded$default(this, offering, parcelizableFontProvider, z6, false, shouldDisplayBlock, 8, null);
    }

    @InternalRevenueCatAPI
    @InterfaceC3141c
    public final void launchIfNeededWithOfferingId(String requiredEntitlementIdentifier, String offeringIdentifier, PresentedOfferingContext presentedOfferingContext, ParcelizableFontProvider parcelizableFontProvider, boolean z6, boolean z7) {
        o.h(requiredEntitlementIdentifier, "requiredEntitlementIdentifier");
        o.h(offeringIdentifier, "offeringIdentifier");
        o.h(presentedOfferingContext, "presentedOfferingContext");
        launchIfNeededWithOfferingId$default(this, requiredEntitlementIdentifier, offeringIdentifier, presentedOfferingContext, parcelizableFontProvider, z6, z7, null, 64, null);
    }

    @InternalRevenueCatAPI
    @InterfaceC3141c
    public final void launchWithOfferingId(String offeringIdentifier, PresentedOfferingContext presentedOfferingContext, ParcelizableFontProvider parcelizableFontProvider, boolean z6, boolean z7) {
        o.h(offeringIdentifier, "offeringIdentifier");
        o.h(presentedOfferingContext, "presentedOfferingContext");
        launchWithOfferingId$default(this, offeringIdentifier, presentedOfferingContext, parcelizableFontProvider, z6, z7, null, 32, null);
    }

    public static /* synthetic */ void launchIfNeeded$default(PaywallActivityLauncher paywallActivityLauncher, Offering offering, ParcelizableFontProvider parcelizableFontProvider, boolean z6, boolean z7, c cVar, int i6, Object obj) {
        if ((i6 & 1) != 0) {
            offering = null;
        }
        if ((i6 & 2) != 0) {
            parcelizableFontProvider = null;
        }
        if ((i6 & 4) != 0) {
            z6 = true;
        }
        if ((i6 & 8) != 0) {
            z7 = PaywallActivityArgsKt.getDefaultEdgeToEdge();
        }
        paywallActivityLauncher.launchIfNeeded(offering, parcelizableFontProvider, z6, z7, cVar);
    }

    public final void launch(Offering offering, ParcelizableFontProvider parcelizableFontProvider, boolean z6, boolean z7) {
        launch$default(this, offering, parcelizableFontProvider, z6, z7, null, 16, null);
    }

    public final void launchIfNeeded(String requiredEntitlementIdentifier) {
        o.h(requiredEntitlementIdentifier, "requiredEntitlementIdentifier");
        launchIfNeeded$default(this, requiredEntitlementIdentifier, (Offering) null, (ParcelizableFontProvider) null, false, false, (PaywallDisplayCallback) null, 62, (Object) null);
    }

    @InternalRevenueCatAPI
    @InterfaceC3141c
    public final void launchIfNeededWithOfferingId(String requiredEntitlementIdentifier, String offeringIdentifier, PresentedOfferingContext presentedOfferingContext, ParcelizableFontProvider parcelizableFontProvider, boolean z6, boolean z7, PaywallDisplayCallback paywallDisplayCallback) {
        o.h(requiredEntitlementIdentifier, "requiredEntitlementIdentifier");
        o.h(offeringIdentifier, "offeringIdentifier");
        o.h(presentedOfferingContext, "presentedOfferingContext");
        launchIfNeededWithOptions(new PaywallActivityLaunchIfNeededOptions.Builder().setRequiredEntitlementIdentifier(requiredEntitlementIdentifier).setOfferingIdentifier(offeringIdentifier, presentedOfferingContext).setFontProvider(parcelizableFontProvider).setShouldDisplayDismissButton(z6).setEdgeToEdge(z7).setPaywallDisplayCallback(paywallDisplayCallback).build());
    }

    @InternalRevenueCatAPI
    @InterfaceC3141c
    public final void launchWithOfferingId(String offeringIdentifier, PresentedOfferingContext presentedOfferingContext, ParcelizableFontProvider parcelizableFontProvider, boolean z6, boolean z7, Map<String, ? extends CustomVariableValue> customVariables) {
        o.h(offeringIdentifier, "offeringIdentifier");
        o.h(presentedOfferingContext, "presentedOfferingContext");
        o.h(customVariables, "customVariables");
        launchWithOptions(new PaywallActivityLaunchOptions.Builder().setOfferingIdentifier(offeringIdentifier, presentedOfferingContext).setFontProvider(parcelizableFontProvider).setShouldDisplayDismissButton(z6).setEdgeToEdge(z7).setCustomVariables(customVariables).build());
    }

    public final void launch(Offering offering, ParcelizableFontProvider parcelizableFontProvider, boolean z6, boolean z7, Map<String, ? extends CustomVariableValue> customVariables) {
        OfferingSelection.IdAndPresentedOfferingContext idAndPresentedOfferingContext;
        o.h(customVariables, "customVariables");
        AbstractC2050d abstractC2050d = this.activityResultLauncher;
        if (offering != null) {
            String identifier = offering.getIdentifier();
            Package r13 = (Package) AbstractC3251q.g0(offering.getAvailablePackages());
            idAndPresentedOfferingContext = new OfferingSelection.IdAndPresentedOfferingContext(identifier, r13 != null ? r13.getPresentedOfferingContext() : null);
        } else {
            idAndPresentedOfferingContext = null;
        }
        abstractC2050d.a(new PaywallActivityArgs((String) null, idAndPresentedOfferingContext, parcelizableFontProvider, z6, z7, false, (Map) customVariables, (Integer) null, 161, (h) null));
    }

    public final void launchIfNeeded(String requiredEntitlementIdentifier, Offering offering) {
        o.h(requiredEntitlementIdentifier, "requiredEntitlementIdentifier");
        launchIfNeeded$default(this, requiredEntitlementIdentifier, offering, (ParcelizableFontProvider) null, false, false, (PaywallDisplayCallback) null, 60, (Object) null);
    }

    public final void launchIfNeeded(String requiredEntitlementIdentifier, Offering offering, ParcelizableFontProvider parcelizableFontProvider) {
        o.h(requiredEntitlementIdentifier, "requiredEntitlementIdentifier");
        launchIfNeeded$default(this, requiredEntitlementIdentifier, offering, parcelizableFontProvider, false, false, (PaywallDisplayCallback) null, 56, (Object) null);
    }

    public final void launchIfNeeded(String requiredEntitlementIdentifier, Offering offering, ParcelizableFontProvider parcelizableFontProvider, boolean z6) {
        o.h(requiredEntitlementIdentifier, "requiredEntitlementIdentifier");
        launchIfNeeded$default(this, requiredEntitlementIdentifier, offering, parcelizableFontProvider, z6, false, (PaywallDisplayCallback) null, 48, (Object) null);
    }

    public final void launchIfNeeded(String requiredEntitlementIdentifier, Offering offering, ParcelizableFontProvider parcelizableFontProvider, boolean z6, boolean z7) {
        o.h(requiredEntitlementIdentifier, "requiredEntitlementIdentifier");
        launchIfNeeded$default(this, requiredEntitlementIdentifier, offering, parcelizableFontProvider, z6, z7, (PaywallDisplayCallback) null, 32, (Object) null);
    }

    public final void launchIfNeeded(String requiredEntitlementIdentifier, Offering offering, ParcelizableFontProvider parcelizableFontProvider, boolean z6, boolean z7, PaywallDisplayCallback paywallDisplayCallback) {
        o.h(requiredEntitlementIdentifier, "requiredEntitlementIdentifier");
        HelperFunctionsKt.shouldDisplayPaywall(HelperFunctionsKt.shouldDisplayBlockForEntitlementIdentifier(requiredEntitlementIdentifier), new AnonymousClass1(paywallDisplayCallback, this, requiredEntitlementIdentifier, offering, parcelizableFontProvider, z6, z7));
    }

    @InterfaceC3141c
    public final /* synthetic */ void launchIfNeeded(String requiredEntitlementIdentifier, String offeringIdentifier, ParcelizableFontProvider parcelizableFontProvider, boolean z6, boolean z7, PaywallDisplayCallback paywallDisplayCallback) {
        o.h(requiredEntitlementIdentifier, "requiredEntitlementIdentifier");
        o.h(offeringIdentifier, "offeringIdentifier");
        HelperFunctionsKt.shouldDisplayPaywall(HelperFunctionsKt.shouldDisplayBlockForEntitlementIdentifier(requiredEntitlementIdentifier), new AnonymousClass2(paywallDisplayCallback, this, requiredEntitlementIdentifier, offeringIdentifier, parcelizableFontProvider, z6, z7));
    }

    @InterfaceC3141c
    public final void launch(String offeringIdentifier, ParcelizableFontProvider parcelizableFontProvider, boolean z6, boolean z7) {
        o.h(offeringIdentifier, "offeringIdentifier");
        this.activityResultLauncher.a(new PaywallActivityArgs((String) null, new OfferingSelection.IdAndPresentedOfferingContext(offeringIdentifier, null), parcelizableFontProvider, z6, z7, false, (Map) null, (Integer) null, 225, (h) null));
    }

    public final void launchIfNeeded(Offering offering, ParcelizableFontProvider parcelizableFontProvider, boolean z6, boolean z7, c shouldDisplayBlock) {
        o.h(shouldDisplayBlock, "shouldDisplayBlock");
        HelperFunctionsKt.shouldDisplayPaywall(shouldDisplayBlock, new AnonymousClass3(offering, parcelizableFontProvider, z6, z7));
    }
}
