package com.ss.android.ugc.aweme.commercialize.live.business.links.ui;

import X.0AP;
import X.0HH;
import X.1hK;
import X.7he;
import X.C0984KOx;
import X.C1022KQj;
import X.C1157KVo;
import X.C1278Ka5;
import X.C1603KfK;
import X.C1905KkC;
import X.C1999Kli;
import X.C3164LAt;
import X.Crj;
import X.Hoq;
import X.Hot;
import X.KFR;
import X.M12;
import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.fragment.app.DialogFragment;
import com.bytedance.covode.number.Covode;
import com.bytedance.hybrid.spark.page.SparkFragment;
import com.bytedance.ies.bullet.ui.common.BulletActivityWrapper;
import com.bytedance.ies.bullet.ui.common.BulletContainerFragment;
import com.ss.android.ugc.aweme.bullet.impl.BulletService;
import com.ss.android.ugc.aweme.spark.AdSparkContext;
import com.ss.android.ugc.aweme.spark.AdSparkUtils;
import com.ss.android.ugc.aweme.spark.IAdSparkUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Objects;
import kotlin.h.b.n;

public final class LynxContainerWrapperFragment extends DialogFragment implements C1603KfK {
    public static final Hoq LIZ = new Hoq((byte) 0);
    public final Crj LIZIZ = 7he.LIZ(new Hot(this));
    public BulletContainerFragment LIZJ;
    public SparkFragment LIZLLL;
    public HashMap LJ;

    static {
        Covode.recordClassIndex(59076);
    }

    private final String LIZ() {
        return (String) this.LIZIZ.getValue();
    }

    public final void LIZ(C0984KOx kOx, Uri uri, C1157KVo kVo) {
        M12.LIZ(kOx, uri, kVo);
    }

    public final void LIZ(Uri uri) {
        M12.LIZ((Object) uri);
    }

    public final void LIZ(Uri uri, Throwable th) {
        M12.LIZ((Object) uri, (Object) th);
    }

    public final void LIZ(View view, Uri uri, C0984KOx kOx) {
        M12.LIZ(view, uri, kOx);
    }

    public final void LIZ(List<? extends C1278Ka5<? extends View>> list, Uri uri, C0984KOx kOx, boolean z) {
        M12.LIZ(list, uri, kOx);
    }

    public final int getTheme() {
        return 2131886954;
    }

    public final /* synthetic */ void onDestroyView() {
        LynxContainerWrapperFragment.super.onDestroyView();
        HashMap hashMap = this.LJ;
        if (hashMap != null) {
            hashMap.clear();
        }
    }

    public final void onStart() {
        LynxContainerWrapperFragment.super.onStart();
        String LIZ2 = LIZ();
        if (LIZ2 != null && !C3164LAt.LIZIZ.LIZ().LIZLLL) {
            n.LIZIZ(LIZ2, "");
            Uri LIZ3 = C1022KQj.LIZ(LIZ2);
            BulletContainerFragment bulletContainerFragment = this.LIZJ;
            if (bulletContainerFragment == null) {
                n.LIZ("");
            }
            bulletContainerFragment.LIZ(LIZ3, (Bundle) null, (C1603KfK) this);
        }
    }

    public final void onViewCreated(View view, Bundle bundle) {
        SparkFragment sparkFragment;
        M12.LIZ((Object) view);
        LynxContainerWrapperFragment.super.onViewCreated(view, bundle);
        BulletContainerFragment bulletContainerFragment = new BulletContainerFragment();
        C1905KkC kkC = new C1905KkC(bulletContainerFragment);
        kkC.LIZ(BulletService.LIZJ().LIZ());
        1hK requireActivity = requireActivity();
        Objects.requireNonNull(requireActivity, "null cannot be cast to non-null type android.app.Activity");
        kkC.LIZ((KFR) new BulletActivityWrapper(requireActivity));
        kkC.LIZ();
        this.LIZJ = bulletContainerFragment;
        Context context = view.getContext();
        n.LIZIZ(context, "");
        IAdSparkUtils LIZIZ2 = AdSparkUtils.LIZIZ();
        if (LIZIZ2 != null) {
            sparkFragment = LIZIZ2.LIZ();
        } else {
            sparkFragment = new SparkFragment();
        }
        IAdSparkUtils LIZIZ3 = AdSparkUtils.LIZIZ();
        AdSparkContext adSparkContext = null;
        if (LIZIZ3 != null) {
            String LIZ2 = LIZ();
            if (LIZ2 == null) {
                LIZ2 = "about:blank";
            }
            adSparkContext = C1999Kli.LIZ(LIZIZ3, context, LIZ2, (Bundle) null, 12);
        }
        Bundle bundle2 = new Bundle();
        bundle2.putParcelable("sparkContext", adSparkContext);
        sparkFragment.setArguments(bundle2);
        this.LIZLLL = sparkFragment;
        if (C3164LAt.LIZIZ.LIZ().LIZLLL) {
            0AP LIZ3 = getChildFragmentManager().LIZ();
            SparkFragment sparkFragment2 = this.LIZLLL;
            if (sparkFragment2 == null) {
                n.LIZ("");
            }
            LIZ3.LIZIZ(2131370502, sparkFragment2);
            LIZ3.LIZJ();
            return;
        }
        0AP LIZ4 = getChildFragmentManager().LIZ();
        BulletContainerFragment bulletContainerFragment2 = this.LIZJ;
        if (bulletContainerFragment2 == null) {
            n.LIZ("");
        }
        LIZ4.LIZIZ(2131363069, bulletContainerFragment2);
        LIZ4.LIZJ();
    }

    public final View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        M12.LIZ((Object) layoutInflater);
        if (C3164LAt.LIZIZ.LIZ().LIZLLL) {
            return 0HH.LIZ(layoutInflater, 2131559760, viewGroup, false);
        }
        return 0HH.LIZ(layoutInflater, 2131559725, viewGroup, false);
    }
}
