package o;

import android.graphics.Rect;
import android.view.View;
import android.view.ViewGroup;
import java.util.ArrayList;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* loaded from: classes.dex */
public class BC extends AbstractC2792wC {
    @Override // o.AbstractC2792wC
    public final void a(View view, Object obj) {
        ((AbstractC3019yg0) obj).b(view);
    }

    @Override // o.AbstractC2792wC
    public final void b(Object obj, ArrayList arrayList) {
        AbstractC3019yg0 abstractC3019yg0 = (AbstractC3019yg0) obj;
        if (abstractC3019yg0 == null) {
            return;
        }
        int i = 0;
        if (abstractC3019yg0 instanceof Kg0) {
            Kg0 kg0 = (Kg0) abstractC3019yg0;
            int size = kg0.M.size();
            while (i < size) {
                b((i < 0 || i >= kg0.M.size()) ? null : (AbstractC3019yg0) kg0.M.get(i), arrayList);
                i++;
            }
            return;
        }
        if (AbstractC2792wC.h(abstractC3019yg0.p) && AbstractC2792wC.h(abstractC3019yg0.q)) {
            int size2 = arrayList.size();
            while (i < size2) {
                abstractC3019yg0.b((View) arrayList.get(i));
                i++;
            }
        }
    }

    @Override // o.AbstractC2792wC
    public final void c(ViewGroup viewGroup, Object obj) {
        Ig0.a(viewGroup, (AbstractC3019yg0) obj);
    }

    @Override // o.AbstractC2792wC
    public final boolean e(Object obj) {
        return obj instanceof AbstractC3019yg0;
    }

    @Override // o.AbstractC2792wC
    public final Object f(Object obj) {
        if (obj != null) {
            return ((AbstractC3019yg0) obj).clone();
        }
        return null;
    }

    @Override // o.AbstractC2792wC
    public final Object i(Object obj, Object obj2, Object obj3) {
        AbstractC3019yg0 abstractC3019yg0 = (AbstractC3019yg0) obj;
        AbstractC3019yg0 abstractC3019yg02 = (AbstractC3019yg0) obj2;
        AbstractC3019yg0 abstractC3019yg03 = (AbstractC3019yg0) obj3;
        if (abstractC3019yg0 != null && abstractC3019yg02 != null) {
            Kg0 kg0 = new Kg0();
            kg0.K(abstractC3019yg0);
            kg0.K(abstractC3019yg02);
            kg0.N = false;
            abstractC3019yg0 = kg0;
        } else if (abstractC3019yg0 == null) {
            abstractC3019yg0 = abstractC3019yg02 != null ? abstractC3019yg02 : null;
        }
        if (abstractC3019yg03 == null) {
            return abstractC3019yg0;
        }
        Kg0 kg02 = new Kg0();
        if (abstractC3019yg0 != null) {
            kg02.K(abstractC3019yg0);
        }
        kg02.K(abstractC3019yg03);
        return kg02;
    }

    @Override // o.AbstractC2792wC
    public final Object j(Object obj, Object obj2) {
        Kg0 kg0 = new Kg0();
        if (obj != null) {
            kg0.K((AbstractC3019yg0) obj);
        }
        kg0.K((AbstractC3019yg0) obj2);
        return kg0;
    }

    @Override // o.AbstractC2792wC
    public final void k(Object obj, View view, ArrayList arrayList) {
        ((AbstractC3019yg0) obj).a(new C2982yC(view, arrayList));
    }

    @Override // o.AbstractC2792wC
    public final void l(Object obj, Object obj2, ArrayList arrayList, Object obj3, ArrayList arrayList2) {
        ((AbstractC3019yg0) obj).a(new C3077zC(this, obj2, arrayList, obj3, arrayList2));
    }

    @Override // o.AbstractC2792wC
    public final void m(View view, Object obj) {
        if (view != null) {
            AbstractC2792wC.g(view, new Rect());
            ((AbstractC3019yg0) obj).D(new C2887xC());
        }
    }

    @Override // o.AbstractC2792wC
    public final void n(Object obj, Rect rect) {
        ((AbstractC3019yg0) obj).D(new C2887xC());
    }

    @Override // o.AbstractC2792wC
    public final void o(Object obj, C2638ug c2638ug, RunnableC0890cD runnableC0890cD) {
        AbstractC3019yg0 abstractC3019yg0 = (AbstractC3019yg0) obj;
        c2638ug.a(new C0346Nj(2, abstractC3019yg0, runnableC0890cD));
        abstractC3019yg0.a(new AC(runnableC0890cD));
    }

    @Override // o.AbstractC2792wC
    public final void p(Object obj, View view, ArrayList arrayList) {
        Kg0 kg0 = (Kg0) obj;
        ArrayList arrayList2 = kg0.q;
        arrayList2.clear();
        int size = arrayList.size();
        for (int i = 0; i < size; i++) {
            AbstractC2792wC.d(arrayList2, (View) arrayList.get(i));
        }
        arrayList2.add(view);
        arrayList.add(view);
        b(kg0, arrayList);
    }

    @Override // o.AbstractC2792wC
    public final void q(Object obj, ArrayList arrayList, ArrayList arrayList2) {
        Kg0 kg0 = (Kg0) obj;
        if (kg0 != null) {
            ArrayList arrayList3 = kg0.q;
            arrayList3.clear();
            arrayList3.addAll(arrayList2);
            s(kg0, arrayList, arrayList2);
        }
    }

    @Override // o.AbstractC2792wC
    public final Object r(Object obj) {
        if (obj == null) {
            return null;
        }
        Kg0 kg0 = new Kg0();
        kg0.K((AbstractC3019yg0) obj);
        return kg0;
    }

    public final void s(Object obj, ArrayList arrayList, ArrayList arrayList2) {
        AbstractC3019yg0 abstractC3019yg0 = (AbstractC3019yg0) obj;
        int i = 0;
        if (abstractC3019yg0 instanceof Kg0) {
            Kg0 kg0 = (Kg0) abstractC3019yg0;
            int size = kg0.M.size();
            while (i < size) {
                s((i < 0 || i >= kg0.M.size()) ? null : (AbstractC3019yg0) kg0.M.get(i), arrayList, arrayList2);
                i++;
            }
            return;
        }
        if (AbstractC2792wC.h(abstractC3019yg0.p)) {
            ArrayList arrayList3 = abstractC3019yg0.q;
            if (arrayList3.size() == arrayList.size() && arrayList3.containsAll(arrayList)) {
                int size2 = arrayList2 == null ? 0 : arrayList2.size();
                while (i < size2) {
                    abstractC3019yg0.b((View) arrayList2.get(i));
                    i++;
                }
                for (int size3 = arrayList.size() - 1; size3 >= 0; size3--) {
                    abstractC3019yg0.z((View) arrayList.get(size3));
                }
            }
        }
    }
}
