package o; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.concurrent.CopyOnWriteArrayList; import o.AHZ; import o.C7587crD; import o.InterfaceC16541pFg; import o.wdQ; /* renamed from: o.crD, reason: case insensitive filesystem */ /* loaded from: classes.dex */ public class C7587crD { public final Runnable a; public final CopyOnWriteArrayList b = new CopyOnWriteArrayList<>(); private final Map c = new HashMap(); public C7587crD(Runnable runnable) { this.a = runnable; } public final void rI_(Menu menu) { Iterator it = this.b.iterator(); while (it.hasNext()) { it.next().yR_(menu); } } public final void rF_(Menu menu, MenuInflater menuInflater) { Iterator it = this.b.iterator(); while (it.hasNext()) { it.next().yO_(menu, menuInflater); } } public final boolean rH_(MenuItem menuItem) { Iterator it = this.b.iterator(); while (it.hasNext()) { if (it.next().yQ_(menuItem)) { return true; } } return false; } public final void rG_(Menu menu) { Iterator it = this.b.iterator(); while (it.hasNext()) { it.next().yP_(menu); } } public final void b(AHZ ahz) { this.b.add(ahz); this.a.run(); } public final void a(final AHZ ahz, InterfaceC16541pFg interfaceC16541pFg) { this.b.add(ahz); this.a.run(); wdQ lifecycle = interfaceC16541pFg.getLifecycle(); LWm remove = this.c.remove(ahz); if (remove != null) { remove.b.a(remove.d); remove.d = null; } this.c.put(ahz, new LWm(lifecycle, new InterfaceC3451axm(this, ahz) { // from class: androidx.core.view.MenuHostHelper$$ExternalSyntheticLambda0 public final C7587crD a; public final AHZ e; @Override // o.InterfaceC3451axm public final void c(InterfaceC16541pFg interfaceC16541pFg2, wdQ.HBt hBt) { C7587crD c7587crD = this.a; AHZ ahz2 = this.e; if (hBt == wdQ.HBt.ON_DESTROY) { c7587crD.c(ahz2); } } { this.a = this; this.e = ahz; } })); } public final void c(final AHZ ahz, InterfaceC16541pFg interfaceC16541pFg, final wdQ.IeS ieS) { wdQ lifecycle = interfaceC16541pFg.getLifecycle(); LWm remove = this.c.remove(ahz); if (remove != null) { remove.b.a(remove.d); remove.d = null; } this.c.put(ahz, new LWm(lifecycle, new InterfaceC3451axm(this, ieS, ahz) { // from class: androidx.core.view.MenuHostHelper$$ExternalSyntheticLambda1 public final wdQ.IeS c; public final AHZ d; public final C7587crD e; @Override // o.InterfaceC3451axm public final void c(InterfaceC16541pFg interfaceC16541pFg2, wdQ.HBt hBt) { C7587crD c7587crD = this.e; wdQ.IeS ieS2 = this.c; AHZ ahz2 = this.d; if (hBt != wdQ.HBt.b(ieS2)) { if (hBt == wdQ.HBt.ON_DESTROY) { c7587crD.c(ahz2); return; } else { if (hBt == wdQ.HBt.d(ieS2)) { c7587crD.b.remove(ahz2); c7587crD.a.run(); return; } return; } } c7587crD.b.add(ahz2); c7587crD.a.run(); } { this.e = this; this.c = ieS; this.d = ahz; } })); } public final void c(AHZ ahz) { this.b.remove(ahz); LWm remove = this.c.remove(ahz); if (remove != null) { remove.b.a(remove.d); remove.d = null; } this.a.run(); } /* JADX INFO: Access modifiers changed from: package-private */ /* renamed from: o.crD$LWm */ /* loaded from: classes.dex */ public static class LWm { final wdQ b; InterfaceC3451axm d; LWm(wdQ wdq, InterfaceC3451axm interfaceC3451axm) { this.b = wdq; this.d = interfaceC3451axm; wdq.e(interfaceC3451axm); } } }