package com.ss.android.ugc.aweme.feed.assem.container;

import X.9wF;
import X.AnonymousClass4HR;
import X.C56994d1;
import X.C58804fw;
import X.C58894g5;
import X.C58954gB;
import X.C66974t7;
import X.M12;
import android.view.View;
import android.view.ViewGroup;
import com.bytedance.covode.number.Covode;
import com.bytedance.frameworks.apm.trace.MethodCollector;
import com.ss.android.ugc.aweme.favorites.service.FavoriteServiceImpl;
import com.ss.android.ugc.aweme.feed.assem.base.FeedBaseViewModel;
import com.ss.android.ugc.aweme.feed.model.VideoItemParams;
import java.util.List;
import kotlin.h.b.n;

public final class RightAreaContainerVM extends FeedBaseViewModel<C58894g5> {
    public static final int LIZIZ = 2131363629;
    public static final C58954gB LIZJ = new C58954gB((byte) 0);

    static {
        Covode.recordClassIndex(77050);
    }

    public final /* synthetic */ AnonymousClass4HR defaultState() {
        LIZIZ();
        LIZJ();
        return new C58894g5(LIZIZ(), LIZJ());
    }

    private final C56994d1 LIZJ() {
        float f;
        if (!9wF.LIZIZ.LIZ()) {
            return new C56994d1(64.0f, 48.0f, 0.0f, 0.0f, 15.0f, 0.0f, false, 76);
        }
        if (FavoriteServiceImpl.LJIIJ().LJI() > 0) {
            f = 1.0f;
        } else {
            f = 5.5f;
        }
        return new C56994d1(53.0f, 40.0f, 0.0f, f, 8.0f, 0.0f, true, 4);
    }

    private final C56994d1 LIZIZ() {
        if (9wF.LIZIZ.LIZ()) {
            if (FavoriteServiceImpl.LJIIJ().LJI() > 0) {
                return new C56994d1(45.0f, 36.0f, 10.5f, 4.5f, 6.0f, -4.5f, true);
            }
            return new C56994d1(45.0f, 36.0f, 0.0f, 9.5f, 6.0f, -4.5f, true, 4);
        } else if (!C58804fw.LIZ()) {
            if (FavoriteServiceImpl.LJIIJ().LJII()) {
                return new C56994d1(50.0f, 40.0f, 16.0f, 6.0f, 10.0f, -5.0f, false, 64);
            }
            if (FavoriteServiceImpl.LJIIJ().LJ()) {
                return new C56994d1(50.0f, 40.0f, 16.0f, 6.0f, 3.0f, -5.0f, false, 64);
            }
            if (FavoriteServiceImpl.LJIIJ().LJFF()) {
                return new C56994d1(45.0f, 36.0f, 16.0f, 10.0f, 8.0f, -5.0f, false, 64);
            }
            return new C56994d1(50.0f, 40.0f, 0.0f, 6.0f, 13.0f, -3.0f, false, 68);
        } else if (FavoriteServiceImpl.LJIIJ().LJFF()) {
            return new C56994d1(45.0f, 36.0f, 16.0f, 10.0f, 8.0f, -5.0f, false, 64);
        } else {
            return new C56994d1(50.0f, 40.0f, 0.0f, 6.0f, 13.0f, -3.0f, false, 68);
        }
    }

    public final void LIZ(View view, String str) {
        M12.LIZ(view, str);
        view.setTag(LIZIZ, str);
    }

    public final /* synthetic */ AnonymousClass4HR LIZIZ(AnonymousClass4HR r4, VideoItemParams videoItemParams) {
        C58894g5 r42 = (C58894g5) r4;
        M12.LIZ(r42, videoItemParams);
        return new C58894g5(r42.LIZ, r42.LIZIZ);
    }

    public final void LIZ(ViewGroup viewGroup, View view, String str) {
        MethodCollector.i(8828);
        M12.LIZ(viewGroup, view, str);
        int i = 0;
        for (Object next : (List) C66974t7.LIZIZ.getValue()) {
            int childCount = viewGroup.getChildCount();
            int i2 = 0;
            while (true) {
                if (i2 >= childCount) {
                    break;
                }
                View childAt = viewGroup.getChildAt(i2);
                n.LIZ(childAt, "");
                if (n.LIZ(childAt.getTag(LIZIZ), next)) {
                    i++;
                    break;
                }
                i2++;
            }
            if (n.LIZ(next, str)) {
                viewGroup.addView(view, i);
                MethodCollector.o(8828);
                return;
            }
        }
        MethodCollector.o(8828);
    }
}
