package yh;

import android.content.Context;
import androidx.fragment.app.z;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import yh.r;

/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes4.dex */
public final class o {

    /* renamed from: a, reason: collision with root package name */
    final Map f52744a = new HashMap();

    /* renamed from: b, reason: collision with root package name */
    private final r.b f52745b;

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes4.dex */
    public class a implements n {

        /* renamed from: p, reason: collision with root package name */
        final /* synthetic */ androidx.lifecycle.n f52746p;

        a(androidx.lifecycle.n nVar) {
            this.f52746p = nVar;
        }

        @Override // yh.n
        public void onDestroy() {
            o.this.f52744a.remove(this.f52746p);
        }

        @Override // yh.n
        public void onStart() {
        }

        @Override // yh.n
        public void onStop() {
        }
    }

    /* JADX INFO: Access modifiers changed from: private */
    /* loaded from: classes4.dex */
    public final class b implements s {

        /* renamed from: a, reason: collision with root package name */
        private final z f52748a;

        b(z zVar) {
            this.f52748a = zVar;
        }

        private void b(z zVar, Set set) {
            List z02 = zVar.z0();
            int size = z02.size();
            for (int i10 = 0; i10 < size; i10++) {
                androidx.fragment.app.f fVar = (androidx.fragment.app.f) z02.get(i10);
                b(fVar.getChildFragmentManager(), set);
                com.bumptech.glide.l a10 = o.this.a(fVar.getLifecycle());
                if (a10 != null) {
                    set.add(a10);
                }
            }
        }

        @Override // yh.s
        public Set a() {
            HashSet hashSet = new HashSet();
            b(this.f52748a, hashSet);
            return hashSet;
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public o(r.b bVar) {
        this.f52745b = bVar;
    }

    com.bumptech.glide.l a(androidx.lifecycle.n nVar) {
        ei.l.a();
        return (com.bumptech.glide.l) this.f52744a.get(nVar);
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public com.bumptech.glide.l b(Context context, com.bumptech.glide.b bVar, androidx.lifecycle.n nVar, z zVar, boolean z10) {
        ei.l.a();
        com.bumptech.glide.l a10 = a(nVar);
        if (a10 != null) {
            return a10;
        }
        m mVar = new m(nVar);
        com.bumptech.glide.l a11 = this.f52745b.a(bVar, mVar, new b(zVar), context);
        this.f52744a.put(nVar, a11);
        mVar.a(new a(nVar));
        if (z10) {
            a11.onStart();
        }
        return a11;
    }
}
