package h0;

import B0.RunnableC0014a;
import F5.C0115b;
import O1.C0225a;
import a.AbstractC0386a;
import android.app.Activity;
import android.app.Application;
import android.content.ComponentCallbacks;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.Intent;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Bundle;
import android.util.AttributeSet;
import android.util.Log;
import android.util.SparseArray;
import android.view.ContextMenu;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.lifecycle.C0518x;
import androidx.lifecycle.EnumC0510o;
import androidx.lifecycle.InterfaceC0505j;
import androidx.lifecycle.InterfaceC0516v;
import com.martsnew.tv.R;
import com.martsnew.tv.ui.update.TVUpdateFragment;
import d3.V0;
import d5.AbstractC0844a;
import f.InterfaceC0894b;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import r0.C1484c;
import y5.AbstractActivityC1764i;

/* JADX INFO: renamed from: h0.x, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public class ComponentCallbacksC1023x implements ComponentCallbacks, View.OnCreateContextMenuListener, InterfaceC0516v, androidx.lifecycle.a0, InterfaceC0505j, U1.e {

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

    /* JADX INFO: renamed from: A, reason: collision with root package name */
    public boolean f13257A;

    /* JADX INFO: renamed from: B, reason: collision with root package name */
    public boolean f13258B;

    /* JADX INFO: renamed from: C, reason: collision with root package name */
    public boolean f13259C;
    public boolean D;

    /* JADX INFO: renamed from: E, reason: collision with root package name */
    public boolean f13260E;

    /* JADX INFO: renamed from: F, reason: collision with root package name */
    public boolean f13261F;

    /* JADX INFO: renamed from: G, reason: collision with root package name */
    public boolean f13262G;
    public boolean H;

    /* JADX INFO: renamed from: I, reason: collision with root package name */
    public boolean f13263I;

    /* JADX INFO: renamed from: J, reason: collision with root package name */
    public int f13264J;

    /* JADX INFO: renamed from: K, reason: collision with root package name */
    public P f13265K;

    /* JADX INFO: renamed from: L, reason: collision with root package name */
    public C1025z f13266L;

    /* JADX INFO: renamed from: N, reason: collision with root package name */
    public ComponentCallbacksC1023x f13268N;

    /* JADX INFO: renamed from: O, reason: collision with root package name */
    public int f13269O;

    /* JADX INFO: renamed from: P, reason: collision with root package name */
    public int f13270P;

    /* JADX INFO: renamed from: Q, reason: collision with root package name */
    public String f13271Q;

    /* JADX INFO: renamed from: R, reason: collision with root package name */
    public boolean f13272R;

    /* JADX INFO: renamed from: S, reason: collision with root package name */
    public boolean f13273S;

    /* JADX INFO: renamed from: T, reason: collision with root package name */
    public boolean f13274T;

    /* JADX INFO: renamed from: V, reason: collision with root package name */
    public boolean f13276V;

    /* JADX INFO: renamed from: W, reason: collision with root package name */
    public ViewGroup f13277W;
    public View X;

    /* JADX INFO: renamed from: Y, reason: collision with root package name */
    public boolean f13278Y;

    /* JADX INFO: renamed from: a0, reason: collision with root package name */
    public C1021v f13280a0;

    /* JADX INFO: renamed from: b0, reason: collision with root package name */
    public boolean f13281b0;

    /* JADX INFO: renamed from: c0, reason: collision with root package name */
    public boolean f13282c0;

    /* JADX INFO: renamed from: d0, reason: collision with root package name */
    public String f13283d0;

    /* JADX INFO: renamed from: e0, reason: collision with root package name */
    public EnumC0510o f13284e0;

    /* JADX INFO: renamed from: f0, reason: collision with root package name */
    public C0518x f13285f0;

    /* JADX INFO: renamed from: g0, reason: collision with root package name */
    public Y f13286g0;

    /* JADX INFO: renamed from: h0, reason: collision with root package name */
    public final androidx.lifecycle.A f13287h0;

    /* JADX INFO: renamed from: i0, reason: collision with root package name */
    public androidx.lifecycle.T f13288i0;

    /* JADX INFO: renamed from: j0, reason: collision with root package name */
    public C0225a f13289j0;

    /* JADX INFO: renamed from: k0, reason: collision with root package name */
    public final AtomicInteger f13290k0;

    /* JADX INFO: renamed from: l0, reason: collision with root package name */
    public final ArrayList f13291l0;

    /* JADX INFO: renamed from: m0, reason: collision with root package name */
    public final C1018s f13292m0;

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    public Bundle f13294r;

    /* JADX INFO: renamed from: s, reason: collision with root package name */
    public SparseArray f13295s;

    /* JADX INFO: renamed from: t, reason: collision with root package name */
    public Bundle f13296t;

    /* JADX INFO: renamed from: v, reason: collision with root package name */
    public Bundle f13298v;

    /* JADX INFO: renamed from: w, reason: collision with root package name */
    public ComponentCallbacksC1023x f13299w;

    /* JADX INFO: renamed from: y, reason: collision with root package name */
    public int f13301y;

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

    /* JADX INFO: renamed from: u, reason: collision with root package name */
    public String f13297u = UUID.randomUUID().toString();

    /* JADX INFO: renamed from: x, reason: collision with root package name */
    public String f13300x = null;

    /* JADX INFO: renamed from: z, reason: collision with root package name */
    public Boolean f13302z = null;

    /* JADX INFO: renamed from: M, reason: collision with root package name */
    public P f13267M = new P();

    /* JADX INFO: renamed from: U, reason: collision with root package name */
    public final boolean f13275U = true;

    /* JADX INFO: renamed from: Z, reason: collision with root package name */
    public boolean f13279Z = true;

    public ComponentCallbacksC1023x() {
        new M4.k(23, this);
        this.f13284e0 = EnumC0510o.f8838u;
        this.f13287h0 = new androidx.lifecycle.A();
        this.f13290k0 = new AtomicInteger();
        this.f13291l0 = new ArrayList();
        this.f13292m0 = new C1018s(this);
        w();
    }

    public void A() {
        this.f13276V = true;
    }

    public void B(int i, int i5, Intent intent) {
        if (P.L(2)) {
            Log.v("FragmentManager", "Fragment " + this + " received the following in onActivityResult(): requestCode: " + i + " resultCode: " + i5 + " data: " + intent);
        }
    }

    @Override // androidx.lifecycle.InterfaceC0516v
    public final O3.e C() {
        return this.f13285f0;
    }

    public void D(Activity activity) {
        this.f13276V = true;
    }

    public void E(Context context) {
        this.f13276V = true;
        C1025z c1025z = this.f13266L;
        AbstractActivityC1764i abstractActivityC1764i = c1025z == null ? null : c1025z.f13305t;
        if (abstractActivityC1764i != null) {
            this.f13276V = false;
            D(abstractActivityC1764i);
        }
    }

    public void F(Bundle bundle) {
        Bundle bundle2;
        this.f13276V = true;
        Bundle bundle3 = this.f13294r;
        if (bundle3 != null && (bundle2 = bundle3.getBundle("childFragmentManager")) != null) {
            this.f13267M.Y(bundle2);
            P p3 = this.f13267M;
            p3.H = false;
            p3.f13059I = false;
            p3.f13065O.f13106g = false;
            p3.u(1);
        }
        P p4 = this.f13267M;
        if (p4.f13087v >= 1) {
            return;
        }
        p4.H = false;
        p4.f13059I = false;
        p4.f13065O.f13106g = false;
        p4.u(1);
    }

    public View G(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        return null;
    }

    public androidx.lifecycle.Y H() {
        Application application;
        if (this.f13265K == null) {
            throw new IllegalStateException("Can't access ViewModels from detached fragment");
        }
        if (this.f13288i0 == null) {
            Context applicationContext = Z().getApplicationContext();
            while (true) {
                if (!(applicationContext instanceof ContextWrapper)) {
                    application = null;
                    break;
                }
                if (applicationContext instanceof Application) {
                    application = (Application) applicationContext;
                    break;
                }
                applicationContext = ((ContextWrapper) applicationContext).getBaseContext();
            }
            if (application == null && P.L(3)) {
                Log.d("FragmentManager", "Could not find Application instance from Context " + Z().getApplicationContext() + ", you will need CreationExtras to use AndroidViewModel with the default ViewModelProvider.Factory");
            }
            this.f13288i0 = new androidx.lifecycle.T(application, this, this.f13298v);
        }
        return this.f13288i0;
    }

    public void I() {
        this.f13276V = true;
    }

    public void J() {
        this.f13276V = true;
    }

    public void K() {
        this.f13276V = true;
    }

    public LayoutInflater L(Bundle bundle) {
        C1025z c1025z = this.f13266L;
        if (c1025z == null) {
            throw new IllegalStateException("onGetLayoutInflater() cannot be executed until the Fragment is attached to the FragmentManager.");
        }
        AbstractActivityC1764i abstractActivityC1764i = c1025z.f13309x;
        LayoutInflater layoutInflaterCloneInContext = abstractActivityC1764i.getLayoutInflater().cloneInContext(abstractActivityC1764i);
        layoutInflaterCloneInContext.setFactory2(this.f13267M.f13072f);
        return layoutInflaterCloneInContext;
    }

    public void N(Context context, AttributeSet attributeSet, Bundle bundle) {
        this.f13276V = true;
        C1025z c1025z = this.f13266L;
        if ((c1025z == null ? null : c1025z.f13305t) != null) {
            this.f13276V = true;
        }
    }

    public void O() {
        this.f13276V = true;
    }

    public void Q() {
        this.f13276V = true;
    }

    public void S() {
        this.f13276V = true;
    }

    public void T() {
        this.f13276V = true;
    }

    public void V(Bundle bundle) {
        this.f13276V = true;
    }

    public void W(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        this.f13267M.S();
        this.f13263I = true;
        this.f13286g0 = new Y(this, r(), new RunnableC0014a(22, this));
        View viewG = G(layoutInflater, viewGroup, bundle);
        this.X = viewG;
        if (viewG == null) {
            if (this.f13286g0.f13140u != null) {
                throw new IllegalStateException("Called getViewLifecycleOwner() but onCreateView() returned null");
            }
            this.f13286g0 = null;
            return;
        }
        this.f13286g0.c();
        if (P.L(3)) {
            Log.d("FragmentManager", "Setting ViewLifecycleOwner on View " + this.X + " for Fragment " + this);
        }
        View view = this.X;
        Y y8 = this.f13286g0;
        P6.g.e(view, "<this>");
        view.setTag(R.id.view_tree_lifecycle_owner, y8);
        View view2 = this.X;
        Y y9 = this.f13286g0;
        P6.g.e(view2, "<this>");
        view2.setTag(R.id.view_tree_view_model_store_owner, y9);
        View view3 = this.X;
        Y y10 = this.f13286g0;
        P6.g.e(view3, "<this>");
        view3.setTag(R.id.view_tree_saved_state_registry_owner, y10);
        androidx.lifecycle.A a3 = this.f13287h0;
        Y y11 = this.f13286g0;
        a3.getClass();
        androidx.lifecycle.A.a("setValue");
        a3.f8753g++;
        a3.f8751e = y11;
        a3.c(null);
    }

    public final r X(InterfaceC0894b interfaceC0894b, s7.l lVar) {
        TVUpdateFragment tVUpdateFragment = (TVUpdateFragment) this;
        V0 v02 = new V0(16, tVUpdateFragment);
        if (this.f13293q > 1) {
            throw new IllegalStateException(AbstractC0844a.k("Fragment ", this, " is attempting to registerForActivityResult after being created. Fragments must call registerForActivityResult() before they are created (i.e. initialization, onAttach(), or onCreate())."));
        }
        AtomicReference atomicReference = new AtomicReference();
        C1020u c1020u = new C1020u(tVUpdateFragment, v02, atomicReference, lVar, interfaceC0894b);
        if (this.f13293q >= 0) {
            c1020u.a();
        } else {
            this.f13291l0.add(c1020u);
        }
        return new r(atomicReference);
    }

    public final AbstractActivityC1764i Y() {
        AbstractActivityC1764i abstractActivityC1764iM = m();
        if (abstractActivityC1764iM != null) {
            return abstractActivityC1764iM;
        }
        throw new IllegalStateException(AbstractC0844a.k("Fragment ", this, " not attached to an activity."));
    }

    public final Context Z() {
        Context contextO = o();
        if (contextO != null) {
            return contextO;
        }
        throw new IllegalStateException(AbstractC0844a.k("Fragment ", this, " not attached to a context."));
    }

    @Override // androidx.lifecycle.InterfaceC0505j
    public final C1484c a() {
        Application application;
        Context applicationContext = Z().getApplicationContext();
        while (true) {
            if (!(applicationContext instanceof ContextWrapper)) {
                application = null;
                break;
            }
            if (applicationContext instanceof Application) {
                application = (Application) applicationContext;
                break;
            }
            applicationContext = ((ContextWrapper) applicationContext).getBaseContext();
        }
        if (application == null && P.L(3)) {
            Log.d("FragmentManager", "Could not find Application instance from Context " + Z().getApplicationContext() + ", you will not be able to use AndroidViewModel with the default ViewModelProvider.Factory");
        }
        C1484c c1484c = new C1484c(0);
        LinkedHashMap linkedHashMap = c1484c.f16348a;
        if (application != null) {
            linkedHashMap.put(androidx.lifecycle.X.f8819e, application);
        }
        linkedHashMap.put(androidx.lifecycle.P.f8797a, this);
        linkedHashMap.put(androidx.lifecycle.P.f8798b, this);
        Bundle bundle = this.f13298v;
        if (bundle != null) {
            linkedHashMap.put(androidx.lifecycle.P.f8799c, bundle);
        }
        return c1484c;
    }

    public final ComponentCallbacksC1023x a0() {
        ComponentCallbacksC1023x componentCallbacksC1023x = this.f13268N;
        if (componentCallbacksC1023x != null) {
            return componentCallbacksC1023x;
        }
        if (o() == null) {
            throw new IllegalStateException(AbstractC0844a.k("Fragment ", this, " is not attached to any Fragment or host"));
        }
        throw new IllegalStateException("Fragment " + this + " is not a child Fragment, it is directly attached to " + o());
    }

    public final View b0() {
        View view = this.X;
        if (view != null) {
            return view;
        }
        throw new IllegalStateException(AbstractC0844a.k("Fragment ", this, " did not return a View from onCreateView() or this was called before onCreateView()."));
    }

    public final void c0(int i, int i5, int i8, int i9) {
        if (this.f13280a0 == null && i == 0 && i5 == 0 && i8 == 0 && i9 == 0) {
            return;
        }
        k().f13247b = i;
        k().f13248c = i5;
        k().f13249d = i8;
        k().f13250e = i9;
    }

    public final void d0(Bundle bundle) {
        P p3 = this.f13265K;
        if (p3 != null) {
            if (p3 == null ? false : p3.Q()) {
                throw new IllegalStateException("Fragment already added and state has been saved");
            }
        }
        this.f13298v = bundle;
    }

    public final void e0(Intent intent) {
        C1025z c1025z = this.f13266L;
        if (c1025z == null) {
            throw new IllegalStateException(AbstractC0844a.k("Fragment ", this, " not attached to Activity"));
        }
        c1025z.f13306u.startActivity(intent, null);
    }

    @Override // U1.e
    public final C0225a h() {
        return (C0225a) this.f13289j0.f5011s;
    }

    public AbstractC0386a j() {
        return new C1019t(this);
    }

    public final C1021v k() {
        if (this.f13280a0 == null) {
            C1021v c1021v = new C1021v();
            Object obj = f13256n0;
            c1021v.f13252g = obj;
            c1021v.f13253h = obj;
            c1021v.i = obj;
            c1021v.f13254j = 1.0f;
            c1021v.f13255k = null;
            this.f13280a0 = c1021v;
        }
        return this.f13280a0;
    }

    public final AbstractActivityC1764i m() {
        C1025z c1025z = this.f13266L;
        if (c1025z == null) {
            return null;
        }
        return c1025z.f13305t;
    }

    public final P n() {
        if (this.f13266L != null) {
            return this.f13267M;
        }
        throw new IllegalStateException(AbstractC0844a.k("Fragment ", this, " has not been attached yet."));
    }

    public Context o() {
        C1025z c1025z = this.f13266L;
        if (c1025z == null) {
            return null;
        }
        return c1025z.f13306u;
    }

    @Override // android.content.ComponentCallbacks
    public final void onConfigurationChanged(Configuration configuration) {
        this.f13276V = true;
    }

    @Override // android.view.View.OnCreateContextMenuListener
    public final void onCreateContextMenu(ContextMenu contextMenu, View view, ContextMenu.ContextMenuInfo contextMenuInfo) {
        Y().onCreateContextMenu(contextMenu, view, contextMenuInfo);
    }

    @Override // android.content.ComponentCallbacks
    public final void onLowMemory() {
        this.f13276V = true;
    }

    public final int p() {
        EnumC0510o enumC0510o = this.f13284e0;
        return (enumC0510o == EnumC0510o.f8835r || this.f13268N == null) ? enumC0510o.ordinal() : Math.min(enumC0510o.ordinal(), this.f13268N.p());
    }

    public final P q() {
        P p3 = this.f13265K;
        if (p3 != null) {
            return p3;
        }
        throw new IllegalStateException(AbstractC0844a.k("Fragment ", this, " not associated with a fragment manager."));
    }

    @Override // androidx.lifecycle.a0
    public final androidx.lifecycle.Z r() {
        if (this.f13265K == null) {
            throw new IllegalStateException("Can't access ViewModels from detached fragment");
        }
        if (p() == 1) {
            throw new IllegalStateException("Calling getViewModelStore() before a Fragment reaches onCreate() when using setMaxLifecycle(INITIALIZED) is not supported");
        }
        HashMap map = this.f13265K.f13065O.f13103d;
        androidx.lifecycle.Z z8 = (androidx.lifecycle.Z) map.get(this.f13297u);
        if (z8 != null) {
            return z8;
        }
        androidx.lifecycle.Z z9 = new androidx.lifecycle.Z();
        map.put(this.f13297u, z9);
        return z9;
    }

    public final Resources s() {
        return Z().getResources();
    }

    public final String t(int i) {
        return s().getString(i);
    }

    public final String toString() {
        StringBuilder sb = new StringBuilder(128);
        sb.append(getClass().getSimpleName());
        sb.append("{");
        sb.append(Integer.toHexString(System.identityHashCode(this)));
        sb.append("} (");
        sb.append(this.f13297u);
        if (this.f13269O != 0) {
            sb.append(" id=0x");
            sb.append(Integer.toHexString(this.f13269O));
        }
        if (this.f13271Q != null) {
            sb.append(" tag=");
            sb.append(this.f13271Q);
        }
        sb.append(")");
        return sb.toString();
    }

    public final String u(int i, Object... objArr) {
        return s().getString(i, objArr);
    }

    public final Y v() {
        Y y8 = this.f13286g0;
        if (y8 != null) {
            return y8;
        }
        throw new IllegalStateException(AbstractC0844a.k("Can't access the Fragment View's LifecycleOwner for ", this, " when getView() is null i.e., before onCreateView() or after onDestroyView()"));
    }

    public final void w() {
        this.f13285f0 = new C0518x(this);
        this.f13289j0 = new C0225a(new V1.a(this, new C0115b(3, this)), 15);
        this.f13288i0 = null;
        ArrayList arrayList = this.f13291l0;
        C1018s c1018s = this.f13292m0;
        if (arrayList.contains(c1018s)) {
            return;
        }
        if (this.f13293q >= 0) {
            c1018s.a();
        } else {
            arrayList.add(c1018s);
        }
    }

    public final void x() {
        w();
        this.f13283d0 = this.f13297u;
        this.f13297u = UUID.randomUUID().toString();
        this.f13257A = false;
        this.f13258B = false;
        this.f13260E = false;
        this.f13261F = false;
        this.H = false;
        this.f13264J = 0;
        this.f13265K = null;
        this.f13267M = new P();
        this.f13266L = null;
        this.f13269O = 0;
        this.f13270P = 0;
        this.f13271Q = null;
        this.f13272R = false;
        this.f13273S = false;
    }

    public final boolean y() {
        if (this.f13272R) {
            return true;
        }
        P p3 = this.f13265K;
        if (p3 != null) {
            ComponentCallbacksC1023x componentCallbacksC1023x = this.f13268N;
            p3.getClass();
            if (componentCallbacksC1023x == null ? false : componentCallbacksC1023x.y()) {
                return true;
            }
        }
        return false;
    }

    public final boolean z() {
        return this.f13264J > 0;
    }

    public void M(boolean z8) {
    }

    public void P(boolean z8) {
    }

    public void R(Bundle bundle) {
    }

    public void U(View view, Bundle bundle) {
    }
}
