package com.strmr.ps.data.subscription;

import android.content.Context;
import android.content.SharedPreferences;
import android.util.Log;
import androidx.media3.container.NalUnitUtil;
import androidx.media3.exoplayer.upstream.CmcdData;
import androidx.media3.extractor.text.ttml.TtmlNode;
import com.google.android.gms.measurement.api.AppMeasurementSdk;
import com.strmr.ps.data.supabase.DeviceManager;
import dagger.hilt.android.qualifiers.ApplicationContext;
import defpackage.ae7;
import defpackage.aea;
import defpackage.at3;
import defpackage.be0;
import defpackage.bi8;
import defpackage.ck1;
import defpackage.cr4;
import defpackage.da1;
import defpackage.dy4;
import defpackage.e52;
import defpackage.ey4;
import defpackage.fa1;
import defpackage.fi7;
import defpackage.fl2;
import defpackage.i49;
import defpackage.ie7;
import defpackage.ig6;
import defpackage.iw7;
import defpackage.jn4;
import defpackage.k63;
import defpackage.ke7;
import defpackage.kn4;
import defpackage.kp6;
import defpackage.l38;
import defpackage.n25;
import defpackage.n41;
import defpackage.o29;
import defpackage.q6a;
import defpackage.qf8;
import defpackage.qk0;
import defpackage.rf8;
import defpackage.s38;
import defpackage.si8;
import defpackage.ta7;
import defpackage.u79;
import defpackage.ux1;
import defpackage.va7;
import defpackage.vd9;
import defpackage.vw2;
import defpackage.vx8;
import defpackage.we7;
import defpackage.wy4;
import defpackage.xa7;
import defpackage.xd7;
import defpackage.y41;
import defpackage.yj7;
import defpackage.yy4;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.time.temporal.TemporalUnit;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Objects;
import javax.inject.Inject;
import javax.inject.Singleton;
import kotlin.Metadata;
import kotlin.coroutines.jvm.internal.Boxing;
import kotlin.coroutines.jvm.internal.ContinuationImpl;
import kotlin.reflect.KTypeProjection;

/* JADX INFO: loaded from: classes3.dex */
@Singleton
@Metadata(d1 = {"\u0000\u001c\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0007\b\u0007\u0018\u00002\u00020\u0001:\u0003\n\u000b\fB#\b\u0007\u0012\b\b\u0001\u0010\u0003\u001a\u00020\u0002\u0012\u0006\u0010\u0005\u001a\u00020\u0004\u0012\u0006\u0010\u0007\u001a\u00020\u0006¢\u0006\u0004\b\b\u0010\t¨\u0006\r"}, d2 = {"Lcom/strmr/ps/data/subscription/ProSubscriptionManager;", "", "Landroid/content/Context;", "context", "Lxd7;", "postgrest", "Lcom/strmr/ps/data/supabase/DeviceManager;", "deviceManager", "<init>", "(Landroid/content/Context;Lxd7;Lcom/strmr/ps/data/supabase/DeviceManager;)V", CmcdData.OBJECT_TYPE_AUDIO_ONLY, "b", "c", "app_sideloadRelease"}, k = 1, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
@vx8
public final class ProSubscriptionManager {
    public final xd7 a;
    public final DeviceManager b;
    public final SharedPreferences c;
    public final ig6 d;
    public final o29 e;

    @Metadata(d1 = {"\u0000 \n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0010\u000e\n\u0002\b\u0006\n\u0002\u0010\b\n\u0002\b\b\n\u0002\u0010\t\n\u0002\b\u0004\b\u0086\u0003\u0018\u00002\u00020\u0001R\u0014\u0010\u0003\u001a\u00020\u00028\u0002X\u0082T¢\u0006\u0006\n\u0004\b\u0003\u0010\u0004R\u0014\u0010\u0005\u001a\u00020\u00028\u0002X\u0082T¢\u0006\u0006\n\u0004\b\u0005\u0010\u0004R\u0014\u0010\u0006\u001a\u00020\u00028\u0006X\u0086T¢\u0006\u0006\n\u0004\b\u0006\u0010\u0004R\u0014\u0010\u0007\u001a\u00020\u00028\u0006X\u0086T¢\u0006\u0006\n\u0004\b\u0007\u0010\u0004R\u0014\u0010\b\u001a\u00020\u00028\u0006X\u0086T¢\u0006\u0006\n\u0004\b\b\u0010\u0004R\u0014\u0010\n\u001a\u00020\t8\u0006X\u0086T¢\u0006\u0006\n\u0004\b\n\u0010\u000bR\u0014\u0010\f\u001a\u00020\u00028\u0002X\u0082T¢\u0006\u0006\n\u0004\b\f\u0010\u0004R\u0014\u0010\r\u001a\u00020\u00028\u0002X\u0082T¢\u0006\u0006\n\u0004\b\r\u0010\u0004R\u0014\u0010\u000e\u001a\u00020\u00028\u0002X\u0082T¢\u0006\u0006\n\u0004\b\u000e\u0010\u0004R\u0014\u0010\u000f\u001a\u00020\u00028\u0002X\u0082T¢\u0006\u0006\n\u0004\b\u000f\u0010\u0004R\u0014\u0010\u0010\u001a\u00020\u00028\u0002X\u0082T¢\u0006\u0006\n\u0004\b\u0010\u0010\u0004R\u0014\u0010\u0011\u001a\u00020\u00028\u0002X\u0082T¢\u0006\u0006\n\u0004\b\u0011\u0010\u0004R\u0014\u0010\u0013\u001a\u00020\u00128\u0002X\u0082T¢\u0006\u0006\n\u0004\b\u0013\u0010\u0014R\u0014\u0010\u0015\u001a\u00020\u00128\u0002X\u0082T¢\u0006\u0006\n\u0004\b\u0015\u0010\u0014¨\u0006\u0016"}, d2 = {"Lcom/strmr/ps/data/subscription/ProSubscriptionManager$a;", "", "", "TAG", "Ljava/lang/String;", "TABLE_SUBSCRIPTIONS", "PRODUCT_ID_MONTHLY", "PRODUCT_ID_YEARLY", "PRODUCT_ID_TRIAL", "", "TRIAL_DAYS", "I", "PREFS_NAME", "PREF_SUBSCRIPTION_STATUS", "PREF_TRIAL_EXPIRES_AT", "PREF_SUBSCRIPTION_EXPIRES_AT", "PREF_LAST_CHECK", "PREF_LAST_VERIFIED_AT", "", "CACHE_TTL_MS", "J", "GRACE_PERIOD_MS", "app_sideloadRelease"}, k = 1, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
    public static final class a {
    }

    @Metadata(d1 = {"\u0000\u001e\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\b6\u0018\u00002\u00020\u0001:\u0004\u0002\u0003\u0004\u0005\u0082\u0001\u0004\u0006\u0007\b\t¨\u0006\n"}, d2 = {"Lcom/strmr/ps/data/subscription/ProSubscriptionManager$b;", "", "c", "d", "b", CmcdData.OBJECT_TYPE_AUDIO_ONLY, "Lcom/strmr/ps/data/subscription/ProSubscriptionManager$b$a;", "Lcom/strmr/ps/data/subscription/ProSubscriptionManager$b$b;", "Lcom/strmr/ps/data/subscription/ProSubscriptionManager$b$c;", "Lcom/strmr/ps/data/subscription/ProSubscriptionManager$b$d;", "app_sideloadRelease"}, k = 1, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
    public static abstract class b {

        @Metadata(d1 = {"\u0000\n\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\b\u0086\b\u0018\u00002\u00020\u0001¨\u0006\u0002"}, d2 = {"Lcom/strmr/ps/data/subscription/ProSubscriptionManager$b$a;", "Lcom/strmr/ps/data/subscription/ProSubscriptionManager$b;", "app_sideloadRelease"}, k = 1, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
        public static final /* data */ class a extends b {
            public final String a;
            public final Long b;

            public a(String str, Long l) {
                cr4.g(str, "productId");
                this.a = str;
                this.b = l;
            }

            public final boolean equals(Object obj) {
                if (this == obj) {
                    return true;
                }
                if (!(obj instanceof a)) {
                    return false;
                }
                a aVar = (a) obj;
                return cr4.b(this.a, aVar.a) && cr4.b(this.b, aVar.b);
            }

            public final int hashCode() {
                int iHashCode = this.a.hashCode() * 31;
                Long l = this.b;
                return iHashCode + (l == null ? 0 : l.hashCode());
            }

            public final String toString() {
                return "Active(productId=" + this.a + ", expiresAt=" + this.b + ")";
            }
        }

        /* JADX INFO: renamed from: com.strmr.ps.data.subscription.ProSubscriptionManager$b$b, reason: collision with other inner class name */
        @Metadata(d1 = {"\u0000\n\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\b\u0086\b\u0018\u00002\u00020\u0001¨\u0006\u0002"}, d2 = {"Lcom/strmr/ps/data/subscription/ProSubscriptionManager$b$b;", "Lcom/strmr/ps/data/subscription/ProSubscriptionManager$b;", "app_sideloadRelease"}, k = 1, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
        public static final /* data */ class C0103b extends b {
            public final int a;

            public C0103b(int i) {
                this.a = i;
            }

            public final boolean equals(Object obj) {
                if (this == obj) {
                    return true;
                }
                return (obj instanceof C0103b) && this.a == ((C0103b) obj).a;
            }

            public final int hashCode() {
                return Integer.hashCode(this.a);
            }

            public final String toString() {
                return n41.i(this.a, "InTrial(daysRemaining=", ")");
            }
        }

        @Metadata(d1 = {"\u0000\n\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\bÆ\u0002\u0018\u00002\u00020\u0001¨\u0006\u0002"}, d2 = {"Lcom/strmr/ps/data/subscription/ProSubscriptionManager$b$c;", "Lcom/strmr/ps/data/subscription/ProSubscriptionManager$b;", "app_sideloadRelease"}, k = 1, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
        public static final class c extends b {
            public static final c a = new c();
        }

        @Metadata(d1 = {"\u0000\n\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\bÆ\u0002\u0018\u00002\u00020\u0001¨\u0006\u0002"}, d2 = {"Lcom/strmr/ps/data/subscription/ProSubscriptionManager$b$d;", "Lcom/strmr/ps/data/subscription/ProSubscriptionManager$b;", "app_sideloadRelease"}, k = 1, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
        public static final class d extends b {
            public static final d a = new d();
        }
    }

    @Inject
    public ProSubscriptionManager(@ApplicationContext @kp6 Context context, @kp6 xd7 xd7Var, @kp6 DeviceManager deviceManager) {
        cr4.g(context, "context");
        cr4.g(xd7Var, "postgrest");
        cr4.g(deviceManager, "deviceManager");
        this.a = xd7Var;
        this.b = deviceManager;
        this.c = context.getSharedPreferences("pro_subscription_prefs", 0);
        ig6 ig6VarA = i49.a(b.c.a);
        this.d = ig6VarA;
        this.e = k63.b(ig6VarA);
    }

    /* JADX WARN: Removed duplicated region for block: B:15:0x0042  */
    /* JADX WARN: Removed duplicated region for block: B:16:0x0049  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void a(c cVar) {
        SharedPreferences.Editor editorRemove;
        SharedPreferences.Editor editorEdit = this.c.edit();
        if (cVar != null) {
            String str = cVar.h;
            boolean zIsAfter = false;
            if (str != null) {
                try {
                    zIsAfter = Instant.now().isAfter(Instant.parse(str));
                } catch (Exception unused) {
                }
            }
            if (zIsAfter) {
                editorEdit.remove("subscription_status");
                editorEdit.remove("trial_expires_at");
                editorEdit.remove("subscription_expires_at");
            } else {
                editorEdit.putString("subscription_status", cVar.f);
                if (str != null) {
                    try {
                        long epochMilli = Instant.parse(str).toEpochMilli();
                        editorEdit.putLong("trial_expires_at", epochMilli);
                        editorRemove = editorEdit.putLong("subscription_expires_at", epochMilli);
                    } catch (Exception unused2) {
                        editorEdit.remove("trial_expires_at");
                        editorRemove = editorEdit.remove("subscription_expires_at");
                    }
                    if (editorRemove == null) {
                        editorEdit.remove("trial_expires_at");
                        editorEdit.remove("subscription_expires_at");
                    }
                }
            }
        }
        editorEdit.putLong("last_check", System.currentTimeMillis());
        editorEdit.apply();
    }

    /* JADX WARN: Removed duplicated region for block: B:32:0x00ea  */
    /* JADX WARN: Removed duplicated region for block: B:7:0x0013  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final Object b(ContinuationImpl continuationImpl) {
        com.strmr.ps.data.subscription.a aVar;
        ProSubscriptionManager proSubscriptionManager;
        if (continuationImpl instanceof com.strmr.ps.data.subscription.a) {
            aVar = (com.strmr.ps.data.subscription.a) continuationImpl;
            int i = aVar.d;
            if ((i & Integer.MIN_VALUE) != 0) {
                aVar.d = i - Integer.MIN_VALUE;
            } else {
                aVar = new com.strmr.ps.data.subscription.a(this, continuationImpl);
            }
        }
        Object objA = aVar.b;
        ck1 ck1Var = ck1.a;
        int i2 = aVar.d;
        b.d dVar = b.d.a;
        if (i2 == 0) {
            s38.b(objA);
            String strF = this.b.f();
            if (strF == null) {
                this.d.setValue(dVar);
                return null;
            }
            try {
                ke7 ke7VarL = this.a.l("user_subscriptions");
                ie7 ie7Var = ke7VarL.a;
                yj7 yj7Var = ie7Var.d.b;
                rf8 rf8Var = new rf8(yj7Var);
                LinkedHashMap linkedHashMap = rf8Var.b;
                new ae7(yj7Var, linkedHashMap).b("user_id", strF);
                linkedHashMap.put("select", y41.am("*"));
                qf8 qf8Var = new qf8(aea.a(linkedHashMap), ke7VarL.c, rf8Var.c.m());
                l38 l38Var = l38.a;
                String str = ke7VarL.b;
                aVar.a = this;
                aVar.d = 1;
                objA = l38Var.a(ie7Var, str, qf8Var, aVar);
                if (objA == ck1Var) {
                    return ck1Var;
                }
                proSubscriptionManager = this;
            } catch (Exception e) {
                e = e;
                proSubscriptionManager = this;
                Log.e("ProSubscriptionManager", "Failed to fetch subscription", e);
                if (!proSubscriptionManager.c()) {
                }
                return null;
            }
        } else {
            if (i2 != 1) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            proSubscriptionManager = aVar.a;
            try {
                s38.b(objA);
            } catch (Exception e2) {
                e = e2;
                Log.e("ProSubscriptionManager", "Failed to fetch subscription", e);
                if (!proSubscriptionManager.c()) {
                    proSubscriptionManager.d.setValue(dVar);
                }
                return null;
            }
        }
        we7 we7Var = (we7) objA;
        c cVar = (c) y41.ab((List) we7Var.c.getE().b(iw7.b(List.class, KTypeProjection.INSTANCE.invariant(iw7.a(c.class))), we7Var.a));
        proSubscriptionManager.getClass();
        proSubscriptionManager.e(cVar);
        proSubscriptionManager.a(cVar);
        proSubscriptionManager.c.edit().putLong("last_verified_at", System.currentTimeMillis()).apply();
        System.currentTimeMillis();
        return cVar;
    }

    public final boolean c() {
        long j = this.c.getLong("last_verified_at", 0L);
        if (j == 0) {
            return false;
        }
        long jCurrentTimeMillis = System.currentTimeMillis() - j;
        boolean z = jCurrentTimeMillis < 259200000;
        if (!z) {
            long j2 = jCurrentTimeMillis / ((long) 3600000);
        }
        return z;
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Removed duplicated region for block: B:7:0x0017  */
    /* JADX WARN: Type inference failed for: r17v0 */
    /* JADX WARN: Type inference failed for: r17v1 */
    /* JADX WARN: Type inference failed for: r17v7 */
    /* JADX WARN: Type inference failed for: r2v3, types: [java.lang.String] */
    /* JADX WARN: Type inference failed for: r7v0, types: [java.lang.String] */
    /* JADX WARN: Type inference failed for: r7v1 */
    /* JADX WARN: Type inference failed for: r7v10 */
    /* JADX WARN: Type inference failed for: r7v11 */
    /* JADX WARN: Type inference failed for: r7v9 */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final Object d(ContinuationImpl continuationImpl) {
        com.strmr.ps.data.subscription.b bVar;
        ?? r17;
        boolean z;
        String strF;
        ProSubscriptionManager proSubscriptionManager;
        Object obj;
        boolean zHasNext;
        jn4 jn4Var;
        l38 l38Var;
        String str;
        Instant instant;
        ProSubscriptionManager proSubscriptionManager2;
        c cVar;
        if (continuationImpl instanceof com.strmr.ps.data.subscription.b) {
            bVar = (com.strmr.ps.data.subscription.b) continuationImpl;
            int i = bVar.i;
            if ((i & Integer.MIN_VALUE) != 0) {
                bVar.i = i - Integer.MIN_VALUE;
            } else {
                bVar = new com.strmr.ps.data.subscription.b(this, continuationImpl);
            }
        }
        Object objB = bVar.e;
        ck1 ck1Var = ck1.a;
        int i2 = bVar.i;
        ?? r7 = "ProSubscriptionManager";
        try {
        } catch (Exception e) {
            e = e;
            r17 = r7;
        }
        if (i2 == 0) {
            s38.b(objB);
            strF = this.b.f();
            if (strF == null) {
                Log.e("ProSubscriptionManager", "No user logged in, cannot start trial");
                return Boxing.boxBoolean(false);
            }
            bVar.a = this;
            bVar.b = strF;
            bVar.i = 1;
            objB = b(bVar);
            if (objB != ck1Var) {
                proSubscriptionManager = this;
            }
            return ck1Var;
        }
        if (i2 != 1) {
            if (i2 != 2) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            cVar = bVar.d;
            instant = bVar.c;
            proSubscriptionManager2 = bVar.a;
            s38.b(objB);
            obj = "ProSubscriptionManager";
            r7 = r7;
            Objects.toString(instant);
            proSubscriptionManager2.d.setValue(new b.C0103b(14));
            proSubscriptionManager2.a(cVar);
            z = true;
            return Boxing.boxBoolean(z);
        }
        strF = bVar.b;
        proSubscriptionManager = bVar.a;
        s38.b(objB);
        c cVar2 = (c) objB;
        if (cVar2 != null) {
            Log.w("ProSubscriptionManager", "User already has a subscription: " + cVar2.c);
            return Boxing.boxBoolean(false);
        }
        Instant instantPlus = Instant.now().plus(14L, (TemporalUnit) ChronoUnit.DAYS);
        c cVar3 = new c(strF, instantPlus.toString());
        ke7 ke7VarL = proSubscriptionManager.a.l("user_subscriptions");
        List listAm = y41.am(cVar3);
        ie7 ie7Var = ke7VarL.a;
        kn4 kn4Var = new kn4(ie7Var.d.b);
        LinkedHashMap linkedHashMap = kn4Var.b;
        vd9 vd9Var = ie7Var.e;
        dy4.a aVar = dy4.d;
        obj = "ProSubscriptionManager";
        try {
            String strA = vd9Var.a(iw7.b(List.class, KTypeProjection.INSTANCE.invariant(iw7.a(c.class))), listAm);
            aVar.getClass();
            ey4 ey4VarF = yy4.f((wy4) aVar.c(wy4.INSTANCE.serializer(), strA));
            ArrayList arrayList = new ArrayList(y41.p(ey4VarF, 10));
            Iterator it = ey4VarF.a.iterator();
            while (true) {
                zHasNext = it.hasNext();
                if (!zHasNext) {
                    break;
                }
                arrayList.add(yy4.g((wy4) it.next()).a.keySet());
            }
            List listT = y41.t(y41.ac(arrayList));
            if (!listT.isEmpty()) {
                linkedHashMap.put("columns", y41.am(y41.ai(listT, ",", null, null, null, 62)));
            }
            jn4Var = new jn4(false, kn4Var.d, ey4VarF, aea.a(linkedHashMap), ke7VarL.c, kn4Var.c.m());
            l38Var = l38.a;
            str = ke7VarL.b;
            bVar.a = proSubscriptionManager;
            bVar.b = strF;
            bVar.c = instantPlus;
            bVar.d = cVar3;
            bVar.i = 2;
        } catch (Exception e2) {
            e = e2;
            r17 = obj;
            Log.e(r17, "Failed to start trial", e);
            z = false;
        }
        if (l38Var.a(ie7Var, str, jn4Var, bVar) != ck1Var) {
            instant = instantPlus;
            proSubscriptionManager2 = proSubscriptionManager;
            cVar = cVar3;
            r7 = zHasNext;
            obj = obj;
            Objects.toString(instant);
            proSubscriptionManager2.d.setValue(new b.C0103b(14));
            proSubscriptionManager2.a(cVar);
            z = true;
            return Boxing.boxBoolean(z);
        }
        return ck1Var;
    }

    /* JADX WARN: Removed duplicated region for block: B:11:0x001e  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void e(c cVar) {
        boolean zIsAfter;
        Object c0103b = b.d.a;
        if (cVar != null) {
            String str = cVar.h;
            String str2 = cVar.f;
            int i = 0;
            if (str == null) {
                zIsAfter = false;
                if (!zIsAfter) {
                    if (cVar.g || cr4.b(str2, "trial")) {
                        if (str != null) {
                            try {
                                Instant instant = Instant.parse(str);
                                Instant instantNow = Instant.now();
                                if (!instantNow.isAfter(instant)) {
                                    int iBetween = (int) ChronoUnit.DAYS.between(instantNow, instant);
                                    if (iBetween >= 0) {
                                        i = iBetween;
                                    }
                                }
                            } catch (Exception unused) {
                            }
                        }
                        c0103b = new b.C0103b(i);
                    } else if (cr4.b(str2, AppMeasurementSdk.ConditionalUserProperty.ACTIVE) || cr4.b(str2, "trial")) {
                        Long lValueOf = null;
                        if (str != null) {
                            try {
                                lValueOf = Long.valueOf(Instant.parse(str).toEpochMilli());
                            } catch (Exception unused2) {
                            }
                        }
                        c0103b = new b.a(cVar.c, lValueOf);
                    }
                }
            } else {
                try {
                    zIsAfter = Instant.now().isAfter(Instant.parse(str));
                } catch (Exception unused3) {
                    zIsAfter = false;
                }
                if (!zIsAfter) {
                }
            }
        }
        ig6 ig6Var = this.d;
        ig6Var.setValue(c0103b);
        Objects.toString(ig6Var.getValue());
    }

    @si8
    @Metadata(d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0004\b\u0087\b\u0018\u0000 \u00022\u00020\u0001:\u0002\u0003\u0004¨\u0006\u0005"}, d2 = {"Lcom/strmr/ps/data/subscription/ProSubscriptionManager$c;", "", "Companion", CmcdData.OBJECT_TYPE_AUDIO_ONLY, "b", "app_sideloadRelease"}, k = 1, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
    public static final /* data */ class c {

        /* JADX INFO: renamed from: Companion, reason: from kotlin metadata */
        @kp6
        public static final Companion INSTANCE = new Companion();
        public final String a;
        public final String b;
        public final String c;
        public final String d;
        public final String e;
        public final String f;
        public final boolean g;
        public final String h;
        public final String i;

        @e52
        @Metadata(d1 = {"\u0000\u0012\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\bÇ\u0002\u0018\u00002\b\u0012\u0004\u0012\u00020\u00020\u0001R\u0017\u0010\u0004\u001a\u00020\u00038\u0006¢\u0006\f\n\u0004\b\u0004\u0010\u0005\u001a\u0004\b\u0006\u0010\u0007¨\u0006\b"}, d2 = {"com/strmr/ps/data/subscription/ProSubscriptionManager.UserSubscription.$serializer", "Lat3;", "Lcom/strmr/ps/data/subscription/ProSubscriptionManager$c;", "Lbi8;", "descriptor", "Lbi8;", "getDescriptor", "()Lbi8;", "app_sideloadRelease"}, k = 1, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
        public /* synthetic */ class a implements at3<c> {
            public static final a a;

            @kp6
            private static final bi8 descriptor;

            static {
                a aVar = new a();
                a = aVar;
                va7 va7Var = new va7("com.strmr.ps.data.subscription.ProSubscriptionManager.UserSubscription", aVar, 9);
                va7Var.j(TtmlNode.ATTR_ID, true);
                va7Var.j("user_id", false);
                va7Var.j("product_id", false);
                va7Var.j("purchase_token", true);
                va7Var.j("order_id", true);
                va7Var.j("status", true);
                va7Var.j("is_trial", true);
                va7Var.j("expires_at", true);
                va7Var.j("created_at", true);
                descriptor = va7Var;
            }

            @Override // defpackage.at3
            public final n25[] childSerializers() {
                u79 u79Var = u79.a;
                return new n25[]{qk0.a(u79Var), u79Var, u79Var, qk0.a(u79Var), qk0.a(u79Var), u79Var, be0.a, qk0.a(u79Var), qk0.a(u79Var)};
            }

            @Override // defpackage.o52
            public final Object deserialize(ux1 ux1Var) {
                bi8 bi8Var = descriptor;
                da1 da1VarC = ux1Var.c(bi8Var);
                String str = null;
                String strK = null;
                String strK2 = null;
                String str2 = null;
                String str3 = null;
                String strK3 = null;
                String str4 = null;
                String str5 = null;
                int i = 0;
                boolean zAc = false;
                boolean z = true;
                while (z) {
                    int iW = da1VarC.w(bi8Var);
                    switch (iW) {
                        case -1:
                            z = false;
                            break;
                        case 0:
                            str = (String) da1VarC.o(bi8Var, 0, u79.a, str);
                            i |= 1;
                            break;
                        case 1:
                            strK = da1VarC.k(bi8Var, 1);
                            i |= 2;
                            break;
                        case 2:
                            strK2 = da1VarC.k(bi8Var, 2);
                            i |= 4;
                            break;
                        case 3:
                            str2 = (String) da1VarC.o(bi8Var, 3, u79.a, str2);
                            i |= 8;
                            break;
                        case 4:
                            str3 = (String) da1VarC.o(bi8Var, 4, u79.a, str3);
                            i |= 16;
                            break;
                        case 5:
                            strK3 = da1VarC.k(bi8Var, 5);
                            i |= 32;
                            break;
                        case 6:
                            zAc = da1VarC.ac(bi8Var, 6);
                            i |= 64;
                            break;
                        case 7:
                            str4 = (String) da1VarC.o(bi8Var, 7, u79.a, str4);
                            i |= 128;
                            break;
                        case 8:
                            str5 = (String) da1VarC.o(bi8Var, 8, u79.a, str5);
                            i |= 256;
                            break;
                        default:
                            throw new q6a(iW);
                    }
                }
                da1VarC.b(bi8Var);
                return new c(i, str, strK, strK2, str2, str3, strK3, zAc, str4, str5);
            }

            @Override // defpackage.yi8, defpackage.o52
            public final bi8 getDescriptor() {
                return descriptor;
            }

            @Override // defpackage.yi8
            public final void serialize(fl2 fl2Var, Object obj) {
                c cVar = (c) obj;
                cr4.g(cVar, AppMeasurementSdk.ConditionalUserProperty.VALUE);
                String str = cVar.a;
                bi8 bi8Var = descriptor;
                fa1 fa1VarC = fl2Var.c(bi8Var);
                if (fa1VarC.e(bi8Var, 0) || str != null) {
                    fa1VarC.ae(bi8Var, 0, u79.a, str);
                }
                String str2 = cVar.b;
                String str3 = cVar.i;
                String str4 = cVar.h;
                boolean z = cVar.g;
                String str5 = cVar.f;
                String str6 = cVar.e;
                String str7 = cVar.d;
                fa1VarC.n(bi8Var, 1, str2);
                fa1VarC.n(bi8Var, 2, cVar.c);
                if (fa1VarC.e(bi8Var, 3) || str7 != null) {
                    fa1VarC.ae(bi8Var, 3, u79.a, str7);
                }
                if (fa1VarC.e(bi8Var, 4) || str6 != null) {
                    fa1VarC.ae(bi8Var, 4, u79.a, str6);
                }
                if (fa1VarC.e(bi8Var, 5) || !cr4.b(str5, AppMeasurementSdk.ConditionalUserProperty.ACTIVE)) {
                    fa1VarC.n(bi8Var, 5, str5);
                }
                if (fa1VarC.e(bi8Var, 6) || z) {
                    fa1VarC.j(bi8Var, 6, z);
                }
                if (fa1VarC.e(bi8Var, 7) || str4 != null) {
                    fa1VarC.ae(bi8Var, 7, u79.a, str4);
                }
                if (fa1VarC.e(bi8Var, 8) || str3 != null) {
                    fa1VarC.ae(bi8Var, 8, u79.a, str3);
                }
                fa1VarC.b(bi8Var);
            }

            @Override // defpackage.at3
            public final n25[] typeParametersSerializers() {
                return xa7.a;
            }
        }

        /* JADX INFO: renamed from: com.strmr.ps.data.subscription.ProSubscriptionManager$c$b, reason: from kotlin metadata */
        @Metadata(d1 = {"\u0000\u0014\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\b\u0086\u0003\u0018\u00002\u00020\u0001J\u0013\u0010\u0004\u001a\b\u0012\u0004\u0012\u00020\u00030\u0002¢\u0006\u0004\b\u0004\u0010\u0005¨\u0006\u0006"}, d2 = {"Lcom/strmr/ps/data/subscription/ProSubscriptionManager$c$b;", "", "Ln25;", "Lcom/strmr/ps/data/subscription/ProSubscriptionManager$c;", "serializer", "()Ln25;", "app_sideloadRelease"}, k = 1, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
        public static final class Companion {
            @kp6
            public final n25<c> serializer() {
                return a.a;
            }
        }

        public c(String str, String str2) {
            cr4.g(str, "userId");
            this.a = null;
            this.b = str;
            this.c = "strmr_pro_trial";
            this.d = null;
            this.e = null;
            this.f = "trial";
            this.g = true;
            this.h = str2;
            this.i = null;
        }

        public final boolean equals(Object obj) {
            if (this == obj) {
                return true;
            }
            if (!(obj instanceof c)) {
                return false;
            }
            c cVar = (c) obj;
            return cr4.b(this.a, cVar.a) && cr4.b(this.b, cVar.b) && cr4.b(this.c, cVar.c) && cr4.b(this.d, cVar.d) && cr4.b(this.e, cVar.e) && cr4.b(this.f, cVar.f) && this.g == cVar.g && cr4.b(this.h, cVar.h) && cr4.b(this.i, cVar.i);
        }

        public final int hashCode() {
            String str = this.a;
            int iB = vw2.b(vw2.b((str == null ? 0 : str.hashCode()) * 31, 31, this.b), 31, this.c);
            String str2 = this.d;
            int iHashCode = (iB + (str2 == null ? 0 : str2.hashCode())) * 31;
            String str3 = this.e;
            int iC = fi7.c(vw2.b((iHashCode + (str3 == null ? 0 : str3.hashCode())) * 31, 31, this.f), 31, this.g);
            String str4 = this.h;
            int iHashCode2 = (iC + (str4 == null ? 0 : str4.hashCode())) * 31;
            String str5 = this.i;
            return iHashCode2 + (str5 != null ? str5.hashCode() : 0);
        }

        public final String toString() {
            StringBuilder sbM = fi7.m("UserSubscription(id=", this.a, ", userId=", this.b, ", productId=");
            vw2.aa(sbM, this.c, ", purchaseToken=", this.d, ", orderId=");
            vw2.aa(sbM, this.e, ", status=", this.f, ", isTrial=");
            sbM.append(this.g);
            sbM.append(", expiresAt=");
            sbM.append(this.h);
            sbM.append(", createdAt=");
            return n41.s(sbM, this.i, ")");
        }

        public /* synthetic */ c(int i, String str, String str2, String str3, String str4, String str5, String str6, boolean z, String str7, String str8) {
            if (6 != (i & 6)) {
                ta7.a(i, 6, a.a.getDescriptor());
                throw null;
            }
            if ((i & 1) == 0) {
                this.a = null;
            } else {
                this.a = str;
            }
            this.b = str2;
            this.c = str3;
            if ((i & 8) == 0) {
                this.d = null;
            } else {
                this.d = str4;
            }
            if ((i & 16) == 0) {
                this.e = null;
            } else {
                this.e = str5;
            }
            if ((i & 32) == 0) {
                this.f = AppMeasurementSdk.ConditionalUserProperty.ACTIVE;
            } else {
                this.f = str6;
            }
            if ((i & 64) == 0) {
                this.g = false;
            } else {
                this.g = z;
            }
            if ((i & 128) == 0) {
                this.h = null;
            } else {
                this.h = str7;
            }
            if ((i & 256) == 0) {
                this.i = null;
            } else {
                this.i = str8;
            }
        }
    }
}
