package v6;

import I0.j;
import android.app.Activity;
import android.content.Context;
import android.content.ContextWrapper;
import com.google.android.gms.internal.measurement.C1;
import com.martsnew.tv.TVApp;
import h0.C1025z;
import h0.ComponentCallbacksC1023x;
import l6.C1139a;
import n4.u0;
import r5.C1496a;
import r5.C1499d;
import r5.C1501f;
import x6.InterfaceC1723a;
import x6.InterfaceC1724b;

/* JADX INFO: loaded from: classes.dex */
public final class f implements InterfaceC1724b {

    /* JADX INFO: renamed from: q, reason: collision with root package name */
    public final /* synthetic */ int f18121q = 1;

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    public final Object f18122r = new Object();

    /* JADX INFO: renamed from: s, reason: collision with root package name */
    public volatile InterfaceC1723a f18123s;

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

    public f(C1139a c1139a) {
        this.f18124t = c1139a;
    }

    public static final Context b(Context context) {
        while ((context instanceof ContextWrapper) && !(context instanceof Activity)) {
            context = ((ContextWrapper) context).getBaseContext();
        }
        return context;
    }

    private final Object c() {
        if (((C1501f) this.f18123s) == null) {
            synchronized (this.f18122r) {
                if (((C1501f) this.f18123s) == null) {
                    this.f18123s = new C1501f(new j((TVApp) ((C1139a) this.f18124t).f14409q, false));
                }
            }
        }
        return (C1501f) this.f18123s;
    }

    public C1499d a() {
        ComponentCallbacksC1023x componentCallbacksC1023x = (ComponentCallbacksC1023x) this.f18124t;
        C1025z c1025z = componentCallbacksC1023x.f13266L;
        if ((c1025z == null ? null : c1025z.f13309x) == null) {
            throw new NullPointerException("Hilt Fragments must be attached before creating the component.");
        }
        u0.g((c1025z == null ? null : c1025z.f13309x) instanceof InterfaceC1724b, "Hilt Fragments must be attached to an @AndroidEntryPoint Activity. Found: %s", (c1025z == null ? null : c1025z.f13309x).getClass());
        C1025z c1025z2 = componentCallbacksC1023x.f13266L;
        return new C1499d(((C1496a) ((g) C1.u(g.class, c1025z2 != null ? c1025z2.f13309x : null))).f16456c);
    }

    @Override // x6.InterfaceC1724b
    public final Object l() {
        switch (this.f18121q) {
            case u0.f15495q /* 0 */:
                return c();
            default:
                if (((C1499d) this.f18123s) == null) {
                    synchronized (this.f18122r) {
                        try {
                            if (((C1499d) this.f18123s) == null) {
                                this.f18123s = a();
                            }
                        } finally {
                        }
                        break;
                    }
                }
                return (C1499d) this.f18123s;
        }
    }

    public f(ComponentCallbacksC1023x componentCallbacksC1023x) {
        this.f18124t = componentCallbacksC1023x;
    }
}
