package com.ss.android.ugc.aweme.sticker.types.multi;

import X.0CB;
import X.0CH;
import X.6Is;
import X.C1294MnR;
import X.C2229N6a;
import X.C2268N7n;
import X.C2272N7r;
import X.C2310N9d;
import X.C2336NAd;
import X.IN4;
import X.Lel;
import X.M12;
import X.N6X;
import com.bytedance.covode.number.Covode;
import com.ss.android.ugc.aweme.sticker.view.internal.viewmodels.StickerListViewModel;
import com.ss.android.ugc.effectmanager.effect.model.Effect;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import kotlin.h.b.n;

public final class MultiStickerListViewModel extends StickerListViewModel implements 6Is, C2272N7r {
    static {
        Covode.recordClassIndex(116460);
    }

    public final void LIZ(String str) {
        M12.LIZ(str);
    }

    public final void onStateChanged(0CH r1, 0CB r2) {
        super.onStateChanged(r1, r2);
    }

    public final Effect LIZ(C2229N6a<Effect> n6a) {
        M12.LIZ(n6a);
        List list = (List) this.LJIIJJI.getValue();
        if (list != null) {
            C2310N9d n9d = this.LJIILJJIL;
            n.LIZIZ(list, "");
            int i = n6a.LIZIZ;
            M12.LIZ(n9d, list);
            if (list.size() >= i) {
                if (i < 0) {
                    i = 0;
                }
                int size = list.size();
                for (int i2 = i + 1; i2 < size; i2++) {
                    if (N6X.LIZLLL(n9d, (Effect) list.get(i2))) {
                        return (Effect) list.get(i2);
                    }
                }
            }
        }
        return null;
    }

    public final void LIZ(Effect effect) {
        M12.LIZ(effect);
        List<Object> children = effect.getChildren();
        if (children == null || children.isEmpty()) {
            this.LJIIL.setValue(C1294MnR.EMPTY);
            this.LJIIJJI.setValue(Lel.INSTANCE);
            return;
        }
        this.LJIIL.setValue(C1294MnR.NONE);
        Map LIZ = this.LJIILJJIL.LIZJ().LJIIIZ().LIZ();
        ArrayList arrayList = new ArrayList();
        for (Object obj : children) {
            Object obj2 = LIZ.get(obj);
            if (obj2 != null) {
                arrayList.add(obj2);
            }
        }
        LIZ((List<? extends Effect>) arrayList);
    }

    public final boolean LIZ(Effect effect, boolean z) {
        M12.LIZ(effect);
        if (!z) {
            return N6X.LIZIZ(this.LJIILJJIL, effect);
        }
        return N6X.LIZJ(this.LJIILJJIL, effect);
    }

    /* JADX WARNING: Illegal instructions before constructor call */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public /* synthetic */ MultiStickerListViewModel(X.0CH r7, X.C2310N9d r8, X.C2336NAd r9, X.C2268N7n r10) {
        /*
            r6 = this;
            X.IN5 r5 = new X.IN5
            r2 = r8
            X.IbZ r0 = r2.LIZJ()
            X.IN6 r0 = r0.LJ()
            r5.<init>(r0)
            r0 = r6
            r1 = r7
            r4 = r10
            r3 = r9
            r0.<init>(r1, r2, r3, r4, r5)
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.sticker.types.multi.MultiStickerListViewModel.<init>(X.0CH, X.N9d, X.NAd, X.N7n):void");
    }

    /* JADX INFO: super call moved to the top of the method (can break code semantics) */
    public MultiStickerListViewModel(0CH r1, C2310N9d n9d, C2336NAd nAd, C2268N7n n7n, IN4 in4) {
        super(r1, n9d, nAd, n7n, in4);
        M12.LIZ(r1, n9d, nAd, n7n, in4);
    }
}
