package p7;

import android.content.Context;
import android.text.TextUtils;
import androidx.media3.exoplayer.rtsp.SessionDescription;
import com.google.android.gms.internal.ads.ao;
import com.google.android.gms.internal.ads.tn;
import org.json.JSONException;
import org.json.JSONObject;

/* JADX INFO: loaded from: classes2.dex */
public final /* synthetic */ class c implements Runnable {

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

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final /* synthetic */ i f31657b;

    public /* synthetic */ c(i iVar, int i10) {
        this.f31656a = i10;
        this.f31657b = iVar;
    }

    @Override // java.lang.Runnable
    public final void run() {
        switch (this.f31656a) {
            case 0:
                i iVar = this.f31657b;
                iVar.f(iVar.f31683a);
                return;
            case 1:
                i iVar2 = this.f31657b;
                iVar2.getClass();
                m7.n nVar = m7.n.C;
                l lVar = nVar.f30476o;
                Context context = iVar2.f31683a;
                String str = iVar2.f31686d;
                String str2 = iVar2.f31687e;
                lVar.getClass();
                tn tnVar = ao.J5;
                n7.y yVar = n7.y.f31093e;
                String strZzo = l.zzo(context, lVar.j(context, (String) yVar.f31096c.b(tnVar), str, str2).toString(), str2);
                if (TextUtils.isEmpty(strZzo)) {
                    q7.j.a("Not linked for in app preview.");
                } else {
                    try {
                        JSONObject jSONObject = new JSONObject(strZzo.trim());
                        String strOptString = jSONObject.optString("gct");
                        lVar.f31720f = jSONObject.optString("status");
                        if (((Boolean) yVar.f31096c.b(ao.f9104ua)).booleanValue()) {
                            String str3 = lVar.f31720f;
                            boolean z10 = SessionDescription.SUPPORTED_SDP_VERSION.equals(str3) || "2".equals(str3);
                            lVar.f(z10);
                            nVar.f30469h.g().g(!z10 ? "" : str);
                        }
                        synchronized (lVar.f31715a) {
                            lVar.f31717c = strOptString;
                            break;
                        }
                        String str4 = lVar.f31720f;
                        if ("2".equals(str4)) {
                            q7.j.a("Creative is not pushed for this device.");
                            lVar.i("There was no creative pushed from DFP to the device.", context, false, false);
                            return;
                        } else if ("1".equals(str4)) {
                            q7.j.a("The app is not linked for creative preview.");
                            lVar.c(context, str, str2);
                            return;
                        } else {
                            if (SessionDescription.SUPPORTED_SDP_VERSION.equals(str4)) {
                                q7.j.a("Device is linked for in app preview.");
                                lVar.i("The device is successfully linked for creative preview.", context, false, true);
                                return;
                            }
                            return;
                        }
                        break;
                    } catch (JSONException unused) {
                    }
                }
                lVar.i("In-app preview failed to load because of a system error. Please try again later.", context, true, true);
                return;
            case 2:
                this.f31657b.d();
                return;
            case 3:
                i iVar3 = this.f31657b;
                iVar3.f(iVar3.f31683a);
                return;
            case 4:
                i iVar4 = this.f31657b;
                iVar4.getClass();
                m7.n.C.f30476o.a(iVar4.f31683a);
                return;
            case 5:
                i iVar5 = this.f31657b;
                iVar5.getClass();
                m7.n.C.f30476o.a(iVar5.f31683a);
                return;
            default:
                i iVar6 = this.f31657b;
                iVar6.f31688f = 4;
                iVar6.b();
                return;
        }
    }
}
