package C1;

import I2.A;
import I2.C0320d;
import I2.C0328l;
import I2.InterfaceC0338w;
import I2.InterfaceC0339x;
import I2.V;
import J3.C0437c;
import J3.p;
import J3.s;
import J3.w;
import V4.AbstractC0786y;
import V4.C0749a0;
import V4.C0772m;
import V4.E;
import a.AbstractC0872a;
import android.graphics.Typeface;
import com.google.android.gms.internal.play_billing.zzbt;
import com.google.android.gms.internal.play_billing.zzc;
import com.google.android.gms.internal.play_billing.zzie;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import l4.C2455a;

/* JADX INFO: loaded from: classes.dex */
public final class a implements Runnable {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final /* synthetic */ int f658a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public Object f659b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final Object f660c;

    public /* synthetic */ a(int i6, Object obj, Object obj2) {
        this.f658a = i6;
        this.f659b = obj;
        this.f660c = obj2;
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Removed duplicated region for block: B:39:0x00a7  */
    @Override // java.lang.Runnable
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void run() {
        switch (this.f658a) {
            case 0:
                ((android.support.v4.media.session.b) this.f659b).z((Typeface) this.f660c);
                break;
            case 1:
                ((h) this.f659b).accept(this.f660c);
                break;
            case 2:
                zzie zzieVar = zzie.EXECUTE_ASYNC_TIMEOUT;
                C0328l c0328l = V.f2552k;
                ((C0320d) this.f659b).I(3, c0328l, zzieVar);
                ((com.revenuecat.purchases.google.usecase.a) this.f660c).c(c0328l);
                break;
            case 3:
                C0320d c0320d = (C0320d) this.f659b;
                C0328l c0328l2 = (C0328l) this.f660c;
                if (((InterfaceC0339x) c0320d.f2596f.f1646c) == null) {
                    zzc.zzn("BillingClient", "No valid listener is set in BroadcastManager");
                } else {
                    ((InterfaceC0339x) c0320d.f2596f.f1646c).onPurchasesUpdated(c0328l2, null);
                }
                break;
            case 4:
                zzie zzieVar2 = zzie.EXECUTE_ASYNC_TIMEOUT;
                C0328l c0328l3 = V.f2552k;
                ((C0320d) this.f659b).I(13, c0328l3, zzieVar2);
                ((com.revenuecat.purchases.google.usecase.b) this.f660c).a(c0328l3, null);
                break;
            case 5:
                Future future = (Future) this.f659b;
                if (!future.isDone() && !future.isCancelled()) {
                    future.cancel(true);
                    zzc.zzn("BillingClient", "Async task is taking too long, cancel it!");
                    Runnable runnable = (Runnable) this.f660c;
                    if (runnable != null) {
                        runnable.run();
                    }
                    break;
                }
                break;
            case 6:
                zzie zzieVar3 = zzie.EXECUTE_ASYNC_TIMEOUT;
                C0328l c0328l4 = V.f2552k;
                ((C0320d) this.f659b).I(7, c0328l4, zzieVar3);
                ((com.revenuecat.purchases.google.usecase.c) this.f660c).a(c0328l4, new A(zzbt.zzk(), zzbt.zzk()));
                break;
            case 7:
                zzie zzieVar4 = zzie.EXECUTE_ASYNC_TIMEOUT;
                C0328l c0328l5 = V.f2552k;
                ((C0320d) this.f659b).I(9, c0328l5, zzieVar4);
                ((InterfaceC0338w) this.f660c).b(c0328l5, zzbt.zzk());
                break;
            case 8:
                w wVar = (w) this.f659b;
                boolean z6 = wVar instanceof K3.a;
                s sVar = (s) this.f660c;
                if (z6) {
                    p pVar = (p) ((K3.a) wVar);
                    pVar.getClass();
                    if (pVar instanceof J3.h) {
                        Object obj = pVar.f3536a;
                        Throwable th = obj instanceof C0437c ? ((C0437c) obj).f3513a : null;
                        if (th != null) {
                            sVar.onFailure(th);
                        }
                        break;
                    }
                }
                try {
                    sVar.onSuccess(A4.g.H(wVar));
                } catch (ExecutionException e6) {
                    sVar.onFailure(e6.getCause());
                    return;
                } catch (Throwable th2) {
                    sVar.onFailure(th2);
                    return;
                }
                break;
            case 9:
                ((C0772m) this.f660c).B((C0749a0) this.f659b);
                break;
            case 10:
                ((C0772m) this.f659b).B((W4.d) this.f660c);
                break;
            case 11:
                int i6 = 0;
                while (true) {
                    try {
                        ((Runnable) this.f659b).run();
                    } catch (Throwable th3) {
                        E.s(A4.k.f106a, th3);
                    }
                    a5.g gVar = (a5.g) this.f660c;
                    Runnable runnableT = gVar.t();
                    if (runnableT == null) {
                        break;
                    } else {
                        this.f659b = runnableT;
                        i6++;
                        if (i6 >= 16) {
                            AbstractC0786y abstractC0786y = gVar.f10828c;
                            if (abstractC0786y.g(gVar)) {
                                abstractC0786y.c(gVar, this);
                                break;
                            }
                        }
                    }
                    break;
                }
                break;
            case 12:
                g2.a aVar = (g2.a) this.f660c;
                Object obj2 = this.f659b;
                if (aVar.f16460c.get()) {
                    aVar.f16463f.dispatchOnCancelled(aVar, obj2);
                } else {
                    aVar.f16463f.dispatchOnLoadComplete(aVar, obj2);
                }
                aVar.f16459b = 3;
                break;
            case 13:
                ((l4.c) this.f660c).f20320c.unregisterNetworkCallback((C2455a) this.f659b);
                break;
            default:
                ((l4.c) this.f660c).f20319b.unregisterReceiver((l4.b) this.f659b);
                break;
        }
    }

    public String toString() {
        switch (this.f658a) {
            case 8:
                E3.j jVarI0 = AbstractC0872a.i0(this);
                C4.f fVar = new C4.f(2, false);
                ((C4.f) jVarI0.f1154e).f743d = fVar;
                jVarI0.f1154e = fVar;
                fVar.f742c = (s) this.f660c;
                return jVarI0.toString();
            default:
                return super.toString();
        }
    }

    public /* synthetic */ a(int i6, Object obj, boolean z6, Object obj2) {
        this.f658a = i6;
        this.f660c = obj;
        this.f659b = obj2;
    }
}
