package com.ss.android.ugc.aweme.ttep.ttepcomponent;

import X.1Hv;
import X.1hK;
import X.2Pr;
import X.5Kh;
import X.78T;
import X.C1134Mkr;
import X.C1943Mxu;
import X.C2322N9p;
import X.C2337NAe;
import X.C2605NKm;
import X.C4087NrO;
import X.C4424Nwp;
import X.IOI;
import X.LsF;
import X.M12;
import X.NDC;
import X.NI0;
import X.NJK;
import X.NJN;
import X.PMk;
import X.PMp;
import com.bytedance.covode.number.Covode;
import com.ss.android.ugc.effectmanager.effect.model.Effect;
import com.ss.android.vesdk.VERecorder;
import java.lang.reflect.Type;

public final class TTEPPreviewEffectLogicComponent extends 1Hv<NJN> implements 5Kh, NJN {
    public static final /* synthetic */ PMp[] $$delegatedProperties;
    public final 1hK activity = ((1hK) getDiContainer().LIZ((Type) 1hK.class, (String) null));
    public final 78T cameraApi$delegate = C4424Nwp.LIZ(getDiContainer(), C1943Mxu.class);
    public final C4087NrO diContainer;
    public final 78T filterApiComponent$delegate = C4424Nwp.LIZ(getDiContainer(), C1134Mkr.class);
    public final 78T gestureApiComponent$delegate = C4424Nwp.LIZ(getDiContainer(), NDC.class);
    public boolean isFirst = true;
    public final 78T stickerApiComponent$delegate = C4424Nwp.LIZ(getDiContainer(), NI0.class);

    private final C1134Mkr getFilterApiComponent() {
        return (C1134Mkr) this.filterApiComponent$delegate.LIZ(this, $$delegatedProperties[1]);
    }

    private final NDC getGestureApiComponent() {
        return (NDC) this.gestureApiComponent$delegate.LIZ(this, $$delegatedProperties[2]);
    }

    private final NI0 getStickerApiComponent() {
        return (NI0) this.stickerApiComponent$delegate.LIZ(this, $$delegatedProperties[0]);
    }

    public final C1943Mxu getCameraApi() {
        return (C1943Mxu) this.cameraApi$delegate.LIZ(this, $$delegatedProperties[3]);
    }

    public final NJN getApiComponent() {
        return this;
    }

    public final C4087NrO getDiContainer() {
        return this.diContainer;
    }

    private final Effect getPreviewEffect() {
        return this.activity.getIntent().getParcelableExtra("extra_ttep_preview_effect");
    }

    public final void applyEffect() {
        if (this.isFirst) {
            this.isFirst = false;
            Effect previewEffect = getPreviewEffect();
            if (previewEffect != null) {
                C2322N9p.LIZ((C2337NAe) getStickerApiComponent(), previewEffect);
            }
        }
    }

    static {
        Class<TTEPPreviewEffectLogicComponent> cls = TTEPPreviewEffectLogicComponent.class;
        Covode.recordClassIndex(120602);
        $$delegatedProperties = new PMp[]{new PMk(cls, "stickerApiComponent", "getStickerApiComponent()Lcom/ss/android/ugc/gamora/recorder/sticker/sticker_core/StickerApiComponent;", 0), new PMk(cls, "filterApiComponent", "getFilterApiComponent()Lcom/bytedance/creativex/recorder/filter/api/FilterApiComponent;", 0), new PMk(cls, "gestureApiComponent", "getGestureApiComponent()Lcom/bytedance/creativex/recorder/gesture/api/GestureApiComponent;", 0), new PMk(cls, "cameraApi", "getCameraApi()Lcom/bytedance/creativex/recorder/camera/api/CameraApiComponent;", 0)};
    }

    public final void onCreate() {
        TTEPPreviewEffectLogicComponent.super.onCreate();
        getCameraApi().LJJIJ().LIZ((LsF<? super Integer, ? super Integer, ? super String, ? super VERecorder, 2Pr>) new NJK(this));
        getFilterApiComponent().setFilterDisable(false, "build_in");
        IOI LJIIIIZZ = getStickerApiComponent().LJIJJ().LIZJ().LJIIIIZZ();
        Effect previewEffect = getPreviewEffect();
        if (previewEffect != null) {
            LJIIIIZZ.LIZ(new C2605NKm(previewEffect, this.activity));
        }
    }

    public TTEPPreviewEffectLogicComponent(C4087NrO nrO) {
        M12.LIZ(nrO);
        this.diContainer = nrO;
    }
}
