package o;

import android.content.Context;
import android.view.MenuItem;
import android.view.SubMenu;
import androidx.collection.t0;

/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes.dex */
public abstract class b {

    /* renamed from: a, reason: collision with root package name */
    final Context f30409a;

    /* renamed from: b, reason: collision with root package name */
    private t0 f30410b;

    /* renamed from: c, reason: collision with root package name */
    private t0 f30411c;

    /* JADX INFO: Access modifiers changed from: package-private */
    public b(Context context) {
        this.f30409a = context;
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public final MenuItem c(MenuItem menuItem) {
        if (!(menuItem instanceof n3.b)) {
            return menuItem;
        }
        n3.b bVar = (n3.b) menuItem;
        if (this.f30410b == null) {
            this.f30410b = new t0();
        }
        MenuItem menuItem2 = (MenuItem) this.f30410b.get(menuItem);
        if (menuItem2 != null) {
            return menuItem2;
        }
        c cVar = new c(this.f30409a, bVar);
        this.f30410b.put(bVar, cVar);
        return cVar;
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public final SubMenu d(SubMenu subMenu) {
        return subMenu;
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public final void e() {
        t0 t0Var = this.f30410b;
        if (t0Var != null) {
            t0Var.clear();
        }
        t0 t0Var2 = this.f30411c;
        if (t0Var2 != null) {
            t0Var2.clear();
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public final void f(int i10) {
        if (this.f30410b == null) {
            return;
        }
        int i11 = 0;
        while (i11 < this.f30410b.size()) {
            if (((n3.b) this.f30410b.f(i11)).getGroupId() == i10) {
                this.f30410b.h(i11);
                i11--;
            }
            i11++;
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public final void g(int i10) {
        if (this.f30410b == null) {
            return;
        }
        for (int i11 = 0; i11 < this.f30410b.size(); i11++) {
            if (((n3.b) this.f30410b.f(i11)).getItemId() == i10) {
                this.f30410b.h(i11);
                return;
            }
        }
    }
}
