package L1;

import android.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Pair;
import java.util.Objects;

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

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

    /* JADX INFO: renamed from: l, reason: collision with root package name */
    public final /* synthetic */ C0088c1 f1530l;

    public /* synthetic */ O0(C0088c1 c0088c1, int i) {
        this.f1529k = i;
        this.f1530l = c0088c1;
    }

    @Override // java.lang.Runnable
    public final void run() {
        switch (this.f1529k) {
            case 0:
                this.f1530l.H();
                break;
            case 1:
                C0114l0 c0114l0 = this.f1530l.f1726B;
                C0146w0 c0146w0 = c0114l0.f1897l;
                C0137t0 c0137t0 = c0146w0.q;
                C0146w0.l(c0137t0);
                c0137t0.k();
                if (c0114l0.e()) {
                    boolean zD = c0114l0.d();
                    C0088c1 c0088c1 = c0146w0.f2042w;
                    C0108j0 c0108j0 = c0146w0.f2036o;
                    if (zD) {
                        C0146w0.j(c0108j0);
                        c0108j0.f1861G.b(null);
                        Bundle bundle = new Bundle();
                        bundle.putString("source", "(not set)");
                        bundle.putString("medium", "(not set)");
                        bundle.putString("_cis", "intent");
                        bundle.putLong("_cc", 1L);
                        C0146w0.k(c0088c1);
                        c0088c1.r("auto", "_cmpx", bundle);
                    } else {
                        C0146w0.j(c0108j0);
                        C0105i0 c0105i0 = c0108j0.f1861G;
                        String strA = c0105i0.a();
                        if (TextUtils.isEmpty(strA)) {
                            X x5 = c0146w0.p;
                            C0146w0.l(x5);
                            x5.q.b("Cache still valid but referrer not found");
                        } else {
                            long jA = c0108j0.f1862H.a() / 3600000;
                            Uri uri = Uri.parse(strA);
                            Bundle bundle2 = new Bundle();
                            Pair pair = new Pair(uri.getPath(), bundle2);
                            for (String str : uri.getQueryParameterNames()) {
                                bundle2.putString(str, uri.getQueryParameter(str));
                            }
                            ((Bundle) pair.second).putLong("_cc", (jA - 1) * 3600000);
                            Object obj = pair.first;
                            String str2 = obj == null ? "app" : (String) obj;
                            C0146w0.k(c0088c1);
                            c0088c1.r(str2, "_cmp", (Bundle) pair.second);
                        }
                        c0105i0.b(null);
                    }
                    C0146w0.j(c0108j0);
                    c0108j0.f1862H.b(0L);
                    break;
                }
                break;
            case 2:
                C0088c1 c0088c12 = this.f1530l;
                c0088c12.k();
                C0146w0 c0146w02 = (C0146w0) c0088c12.f29k;
                C0108j0 c0108j02 = c0146w02.f2036o;
                C0146w0.j(c0108j02);
                boolean zA = c0108j02.f1858D.a();
                X x6 = c0146w02.p;
                if (zA) {
                    C0146w0.l(x6);
                    x6.f1630w.b("Deferred Deep Link already retrieved. Not fetching again.");
                } else {
                    C0108j0 c0108j03 = c0146w02.f2036o;
                    C0146w0.j(c0108j03);
                    C0099g0 c0099g0 = c0108j03.f1859E;
                    long jA2 = c0099g0.a();
                    c0099g0.b(1 + jA2);
                    if (jA2 >= 5) {
                        C0146w0.l(x6);
                        x6.f1626s.b("Permanently failed to retrieve Deferred Deep Link. Reached maximum retries.");
                        c0108j03.f1858D.b(true);
                    } else {
                        if (c0088c12.f1728D == null) {
                            c0088c12.f1728D = new P0(c0088c12, c0146w02, 3);
                        }
                        c0088c12.f1728D.b(0L);
                    }
                }
                break;
            default:
                this.f1530l.H();
                break;
        }
    }

    public O0(C0088c1 c0088c1) {
        this.f1529k = 1;
        Objects.requireNonNull(c0088c1);
        this.f1530l = c0088c1;
    }
}
