package com.ss.android.ugc.aweme.tools.beauty.impl.view;

import X.0CB;
import X.0CH;
import X.19u;
import X.1oX;
import X.6Is;
import X.C3622Njt;
import X.C3736Nlj;
import X.C3783NmU;
import X.C3946Np7;
import X.C3951NpC;
import X.C3955NpG;
import X.C3966NpR;
import X.C3968NpT;
import X.C3969NpU;
import X.C3974NpZ;
import X.C3976Npb;
import X.C3982Nph;
import X.C3988Npn;
import X.C3989Npo;
import X.C3990Npp;
import X.C3992Npr;
import X.C3996Npv;
import X.C4010Nq9;
import X.C4016NqF;
import X.C4019NqI;
import X.C4022NqL;
import X.C4024NqN;
import X.C4026NqP;
import X.C4035NqY;
import X.C4043Nqg;
import X.C4047Nqk;
import X.C4055Nqs;
import X.C4063Nr0;
import X.FYq;
import X.LsF;
import X.M12;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import com.bytedance.covode.number.Covode;
import kotlin.h.b.n;

public class InternalBeautyPanel implements 6Is, C3622Njt {
    public C4047Nqk LIZ;
    public C3955NpG LIZIZ;
    public C4010Nq9 LIZJ;
    public C4022NqL LIZLLL;
    public C4055Nqs LJ;
    public C3969NpU LJFF;
    public C3968NpT LJI;
    public C3990Npp LJII;
    public C3966NpR LJIIIIZZ;
    public C4024NqN LJIIIZ;
    public C3974NpZ LJIIJ;
    public C4043Nqg LJIIJJI;
    public final Context LJIIL;
    public final ViewGroup LJIILIIL;
    public final C3736Nlj LJIILJJIL;
    public final C4019NqI LJIILL;
    public ViewGroup LJIILLIIL;
    public C3946Np7 LJIIZILJ;
    public C3976Npb LJIJ;
    public boolean LJIJI;
    public final FYq LJIJJ;

    static {
        Covode.recordClassIndex(119065);
    }

    public void onStateChanged(0CH r1, 0CB r2) {
    }

    public final C4010Nq9 LIZ() {
        C4010Nq9 nq9 = this.LIZJ;
        if (nq9 == null) {
            n.LIZ("");
        }
        return nq9;
    }

    public final void LIZIZ() {
        if (!this.LJIJI) {
            this.LJIJI = true;
            C3783NmU.LIZIZ.LIZJ("InternalBeautyPanel show");
            C4010Nq9 nq9 = this.LIZJ;
            if (nq9 == null) {
                n.LIZ("");
            }
            nq9.LJI();
            C4010Nq9 nq92 = this.LIZJ;
            if (nq92 == null) {
                n.LIZ("");
            }
            nq92.LJFF();
            C4047Nqk nqk = this.LIZ;
            if (nqk == null) {
                n.LIZ("");
            }
            nqk.LIZ();
            C3946Np7 np7 = this.LJIIZILJ;
            if (np7 != null) {
                np7.LIZ();
            }
        }
    }

    public final void LIZJ() {
        if (this.LJIJI) {
            this.LJIJI = false;
            C3783NmU.LIZIZ.LIZJ("InternalBeautyPanel hide");
            C4043Nqg nqg = this.LJIIJJI;
            nqg.LIZ(nqg.LIZIZ);
            C4047Nqk nqk = this.LIZ;
            if (nqk == null) {
                n.LIZ("");
            }
            nqk.LIZIZ();
            C3946Np7 np7 = this.LJIIZILJ;
            if (np7 != null) {
                np7.LIZIZ();
            }
        }
    }

    public void setContainer(ViewGroup viewGroup) {
        M12.LIZ(viewGroup);
        this.LJIILLIIL = viewGroup;
        C4047Nqk nqk = this.LIZ;
        if (nqk == null) {
            n.LIZ("");
        }
        nqk.setContainer(this.LJIILLIIL);
    }

    public final void LIZ(C3946Np7 np7) {
        this.LJIIZILJ = np7;
        C3955NpG npG = this.LIZIZ;
        if (npG == null) {
            n.LIZ("");
        }
        npG.LIZJ = this.LJIIZILJ;
        C3990Npp npp = this.LJII;
        if (npp == null) {
            n.LIZ("");
        }
        npp.LIZIZ = this.LJIIZILJ;
        C3969NpU npU = this.LJFF;
        if (npU == null) {
            n.LIZ("");
        }
        npU.LIZIZ = this.LJIIZILJ;
        C4024NqN nqN = this.LJIIIZ;
        if (nqN == null) {
            n.LIZ("");
        }
        nqN.LIZIZ = this.LJIIZILJ;
    }

    public final void LIZ(C3976Npb npb) {
        this.LJIJ = npb;
        C3955NpG npG = this.LIZIZ;
        if (npG == null) {
            n.LIZ("");
        }
        npG.LIZIZ = this.LJIJ;
        C3969NpU npU = this.LJFF;
        if (npU == null) {
            n.LIZ("");
        }
        npU.LIZJ = this.LJIJ;
        C3990Npp npp = this.LJII;
        if (npp == null) {
            n.LIZ("");
        }
        npp.LIZJ = this.LJIJ;
        C4022NqL nqL = this.LIZLLL;
        if (nqL == null) {
            n.LIZ("");
        }
        nqL.LIZJ = this.LJIJ;
    }

    public InternalBeautyPanel(Context context, ViewGroup viewGroup, C3736Nlj nlj, C4019NqI nqI) {
        Context context2 = context;
        this.LJIIL = context2;
        ViewGroup viewGroup2 = viewGroup;
        this.LJIILIIL = viewGroup2;
        C3736Nlj nlj2 = nlj;
        this.LJIILJJIL = nlj2;
        C4019NqI nqI2 = nqI;
        this.LJIILL = nqI2;
        this.LJIILLIIL = viewGroup2;
        this.LJIJ = nqI2.LJIILJJIL;
        this.LJIIJJI = new C4043Nqg();
        FYq fYq = new FYq();
        this.LJIJJ = fYq;
        C4047Nqk nqk = (C4047Nqk) nqI2.LIZIZ.LIZLLL.invoke(context2, viewGroup2, nqI2);
        nqk = nqk == null ? new C3992Npr(context2, viewGroup2, nqI2, (byte) 0) : nqk;
        this.LIZ = nqk;
        fYq.LIZ(C4047Nqk.class, nqk);
        C4047Nqk nqk2 = this.LIZ;
        if (nqk2 == null) {
            n.LIZ("");
        }
        nqk2.setDismissViewClickListener(new C4063Nr0(this));
        C4047Nqk nqk3 = this.LIZ;
        if (nqk3 == null) {
            n.LIZ("");
        }
        nqk3.LIZJ();
        this.LIZIZ = new C3955NpG(nlj2, this.LJIJ, this.LJIIZILJ, this.LJIIJJI, fYq);
        LsF<? super Context, ? super View, ? super C4019NqI, ? super C3955NpG, ? extends C4010Nq9> lsF = nqI2.LIZJ.LJJIFFI;
        C4047Nqk nqk4 = this.LIZ;
        if (nqk4 == null) {
            n.LIZ("");
        }
        View root = nqk4.getRoot();
        C3955NpG npG = this.LIZIZ;
        if (npG == null) {
            n.LIZ("");
        }
        C4010Nq9 nq9 = (C4010Nq9) lsF.invoke(context2, root, nqI2, npG);
        if (nq9 == null) {
            C4047Nqk nqk5 = this.LIZ;
            if (nqk5 == null) {
                n.LIZ("");
            }
            View root2 = nqk5.getRoot();
            C3955NpG npG2 = this.LIZIZ;
            if (npG2 == null) {
                n.LIZ("");
            }
            M12.LIZ(context2, root2, npG2, nqI2);
            nq9 = new C3951NpC(context2, root2, nqI2, npG2);
        }
        this.LIZJ = nq9;
        fYq.LIZ(C4010Nq9.class, nq9);
        this.LJFF = new C3969NpU(nlj2, this.LJIIZILJ, this.LJIJ, fYq);
        LsF<? super Context, ? super View, ? super C4019NqI, ? super C3969NpU, ? extends C3968NpT> lsF2 = nqI2.LIZLLL.LJIIJ;
        C4047Nqk nqk6 = this.LIZ;
        if (nqk6 == null) {
            n.LIZ("");
        }
        View root3 = nqk6.getRoot();
        C3969NpU npU = this.LJFF;
        if (npU == null) {
            n.LIZ("");
        }
        C3968NpT npT = (C3968NpT) lsF2.invoke(context2, root3, nqI2, npU);
        if (npT == null) {
            C4047Nqk nqk7 = this.LIZ;
            if (nqk7 == null) {
                n.LIZ("");
            }
            View root4 = nqk7.getRoot();
            C3969NpU npU2 = this.LJFF;
            if (npU2 == null) {
                n.LIZ("");
            }
            npT = new C3982Nph(context2, root4, nqI2, npU2);
        }
        this.LJI = npT;
        fYq.LIZ(C3968NpT.class, npT);
        C3946Np7 np7 = this.LJIIZILJ;
        C3976Npb npb = this.LJIJ;
        C4043Nqg nqg = this.LJIIJJI;
        M12.LIZ(nlj2, nqg, fYq, nqI2);
        this.LJII = new C3990Npp(nlj2, np7, npb, nqg, fYq, nqI2);
        LsF<? super Context, ? super View, ? super C4019NqI, ? super C3990Npp, ? extends C3966NpR> lsF3 = nqI2.LJFF.LIZ;
        C4047Nqk nqk8 = this.LIZ;
        if (nqk8 == null) {
            n.LIZ("");
        }
        View root5 = nqk8.getRoot();
        C3990Npp npp = this.LJII;
        if (npp == null) {
            n.LIZ("");
        }
        C3966NpR npR = (C3966NpR) lsF3.invoke(context2, root5, nqI2, npp);
        if (npR == null) {
            C4047Nqk nqk9 = this.LIZ;
            if (nqk9 == null) {
                n.LIZ("");
            }
            View root6 = nqk9.getRoot();
            C3990Npp npp2 = this.LJII;
            if (npp2 == null) {
                n.LIZ("");
            }
            M12.LIZ(context2, root6, npp2, nqI2);
            npR = new C3989Npo(context2, root6, nqI2, npp2);
        }
        this.LJIIIIZZ = npR;
        fYq.LIZ(C3966NpR.class, npR);
        C4043Nqg nqg2 = this.LJIIJJI;
        C3976Npb npb2 = this.LJIJ;
        C4010Nq9 nq92 = this.LIZJ;
        if (nq92 == null) {
            n.LIZ("");
        }
        this.LIZLLL = new C4022NqL(nlj2, nqg2, npb2, nq92);
        LsF<? super Context, ? super View, ? super C4019NqI, ? super C4022NqL, ? extends C4055Nqs> lsF4 = nqI2.LJ.LIZ;
        C4047Nqk nqk10 = this.LIZ;
        if (nqk10 == null) {
            n.LIZ("");
        }
        View root7 = nqk10.getRoot();
        C4022NqL nqL = this.LIZLLL;
        if (nqL == null) {
            n.LIZ("");
        }
        C4055Nqs nqs = (C4055Nqs) lsF4.invoke(context2, root7, nqI2, nqL);
        if (nqs == null) {
            C4047Nqk nqk11 = this.LIZ;
            if (nqk11 == null) {
                n.LIZ("");
            }
            View root8 = nqk11.getRoot();
            C4022NqL nqL2 = this.LIZLLL;
            if (nqL2 == null) {
                n.LIZ("");
            }
            nqs = new C3988Npn(context2, root8, nqI2, nqL2);
        }
        this.LJ = nqs;
        fYq.LIZ(C4055Nqs.class, nqs);
        C3946Np7 np72 = this.LJIIZILJ;
        C4043Nqg nqg3 = this.LJIIJJI;
        C3966NpR npR2 = this.LJIIIIZZ;
        if (npR2 == null) {
            n.LIZ("");
        }
        C4055Nqs nqs2 = this.LJ;
        if (nqs2 == null) {
            n.LIZ("");
        }
        this.LJIIIZ = new C4024NqN(nlj2, np72, nqg3, npR2, nqs2);
        LsF<? super Context, ? super View, ? super C4019NqI, ? super C4024NqN, ? extends C3974NpZ> lsF5 = nqI2.LJI.LIZ;
        C4047Nqk nqk12 = this.LIZ;
        if (nqk12 == null) {
            n.LIZ("");
        }
        View root9 = nqk12.getRoot();
        C4024NqN nqN = this.LJIIIZ;
        if (nqN == null) {
            n.LIZ("");
        }
        C3974NpZ npZ = (C3974NpZ) lsF5.invoke(context2, root9, nqI2, nqN);
        if (npZ == null) {
            C4047Nqk nqk13 = this.LIZ;
            if (nqk13 == null) {
                n.LIZ("");
            }
            View root10 = nqk13.getRoot();
            C4024NqN nqN2 = this.LJIIIZ;
            if (nqN2 == null) {
                n.LIZ("");
            }
            npZ = new C4016NqF(context2, root10, nqI2, nqN2);
        }
        this.LJIIJ = npZ;
        fYq.LIZ(C3974NpZ.class, npZ);
        if (context2 instanceof 1oX) {
            ((19u) context2).getLifecycle().LIZ(this);
            1oX r2 = (1oX) context2;
            nlj2.LIZIZ().LIZ(r2, new C3996Npv(this));
            nlj2.LJIIIIZZ().observe(r2, new C4026NqP(this));
            nlj2.LJI().LIZ(r2, new C4035NqY(this));
        }
    }

    public /* synthetic */ InternalBeautyPanel(Context context, ViewGroup viewGroup, C3736Nlj nlj, C4019NqI nqI, byte b) {
        this(context, viewGroup, nlj, nqI);
    }
}
