package ඓ.ῲ.K.㑃;

import android.content.Context;
import android.util.Log;
import androidx.fragment.app.Fragment;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import ඓ.ῲ.K.ComponentCallbacks2C1161;
import ඓ.ῲ.K.ComponentCallbacks2C1163;
import ῲ.Ԕ.K.AbstractC1531;

/* renamed from: ඓ.ῲ.K.㑃.㗗  reason: contains not printable characters */
/* compiled from: SupportRequestManagerFragment */
public class C1182 extends Fragment {

    /* renamed from: ʬ  reason: contains not printable characters */
    public final AbstractC1188 f4718 = new C1183();

    /* renamed from: ඓ  reason: contains not printable characters */
    public C1182 f4719;

    /* renamed from: ῲ  reason: contains not printable characters */
    public final C1178 f4720;

    /* renamed from: ⁱ  reason: contains not printable characters */
    public Fragment f4721;

    /* renamed from: 㴹  reason: contains not printable characters */
    public ComponentCallbacks2C1163 f4722;

    /* renamed from: 㸾  reason: contains not printable characters */
    public final Set<C1182> f4723 = new HashSet();

    /* renamed from: ඓ.ῲ.K.㑃.㗗$K  reason: contains not printable characters */
    /* compiled from: SupportRequestManagerFragment */
    public class C1183 implements AbstractC1188 {
        public C1183() {
        }

        public String toString() {
            return super.toString() + "{fragment=" + C1182.this + "}";
        }

        @Override // ඓ.ῲ.K.㑃.AbstractC1188
        /* renamed from: K  reason: contains not printable characters */
        public Set<ComponentCallbacks2C1163> m3171() {
            Set<C1182> r0 = C1182.this.m3169();
            HashSet hashSet = new HashSet(r0.size());
            for (C1182 r2 : r0) {
                if (r2.m3162() != null) {
                    hashSet.add(r2.m3162());
                }
            }
            return hashSet;
        }
    }

    public C1182() {
        C1178 k = new C1178();
        this.f4720 = k;
    }

    @Override // androidx.fragment.app.Fragment
    public void onAttach(Context context) {
        super.onAttach(context);
        Fragment fragment = this;
        while (fragment.getParentFragment() != null) {
            fragment = fragment.getParentFragment();
        }
        AbstractC1531 fragmentManager = fragment.getFragmentManager();
        if (fragmentManager != null) {
            try {
                m3164(getContext(), fragmentManager);
            } catch (IllegalStateException e) {
                if (Log.isLoggable("SupportRMFragment", 5)) {
                    Log.w("SupportRMFragment", "Unable to register fragment with root", e);
                }
            }
        } else if (Log.isLoggable("SupportRMFragment", 5)) {
            Log.w("SupportRMFragment", "Unable to register fragment with root, ancestor detached");
        }
    }

    @Override // androidx.fragment.app.Fragment
    public void onDestroy() {
        super.onDestroy();
        this.f4720.m3149();
        m3170();
    }

    @Override // androidx.fragment.app.Fragment
    public void onDetach() {
        super.onDetach();
        this.f4721 = null;
        m3170();
    }

    @Override // androidx.fragment.app.Fragment
    public void onStart() {
        super.onStart();
        this.f4720.m3147();
    }

    @Override // androidx.fragment.app.Fragment
    public void onStop() {
        super.onStop();
        this.f4720.m3146();
    }

    @Override // androidx.fragment.app.Fragment
    public String toString() {
        return super.toString() + "{parent=" + m3168() + "}";
    }

    /* renamed from: ᕣ  reason: contains not printable characters */
    public ComponentCallbacks2C1163 m3162() {
        return this.f4722;
    }

    /* renamed from: ᨨ  reason: contains not printable characters */
    public C1178 m3163() {
        return this.f4720;
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m3166(ComponentCallbacks2C1163 r1) {
        this.f4722 = r1;
    }

    /* renamed from: 㑃  reason: contains not printable characters */
    public AbstractC1188 m3167() {
        return this.f4718;
    }

    /* renamed from: 㳳  reason: contains not printable characters */
    public final Fragment m3168() {
        Fragment parentFragment = getParentFragment();
        return parentFragment != null ? parentFragment : this.f4721;
    }

    /* renamed from: 㿎  reason: contains not printable characters */
    public Set<C1182> m3169() {
        boolean z;
        C1182 r0 = this.f4719;
        if (r0 == null) {
            return Collections.emptySet();
        }
        if (equals(r0)) {
            return Collections.unmodifiableSet(this.f4723);
        }
        HashSet hashSet = new HashSet();
        for (C1182 r2 : this.f4719.m3169()) {
            Fragment r3 = r2.m3168();
            Fragment r4 = m3168();
            while (true) {
                Fragment parentFragment = r3.getParentFragment();
                if (parentFragment == null) {
                    z = false;
                    break;
                } else if (parentFragment.equals(r4)) {
                    z = true;
                    break;
                } else {
                    r3 = r3.getParentFragment();
                }
            }
            if (z) {
                hashSet.add(r2);
            }
        }
        return Collections.unmodifiableSet(hashSet);
    }

    /* renamed from: 䁗  reason: contains not printable characters */
    public final void m3170() {
        C1182 r0 = this.f4719;
        if (r0 != null) {
            r0.f4723.remove(this);
            this.f4719 = null;
        }
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m3165(Fragment fragment) {
        this.f4721 = fragment;
        if (fragment != null && fragment.getContext() != null) {
            Fragment fragment2 = fragment;
            while (fragment2.getParentFragment() != null) {
                fragment2 = fragment2.getParentFragment();
            }
            AbstractC1531 fragmentManager = fragment2.getFragmentManager();
            if (fragmentManager != null) {
                m3164(fragment.getContext(), fragmentManager);
            }
        }
    }

    /* renamed from: K  reason: contains not printable characters */
    public final void m3164(Context context, AbstractC1531 r3) {
        m3170();
        this.f4719 = ComponentCallbacks2C1161.m3105(context).f4671.m3159(context, r3);
        if (!equals(this.f4719)) {
            this.f4719.f4723.add(this);
        }
    }
}
