package com.bytedance.hybrid.spark.page;

import X.05s;
import X.0AP;
import X.0HH;
import X.1gt;
import X.1hK;
import X.2HN;
import X.3Wd;
import X.4vU;
import X.C0301Jyq;
import X.C0307Jyw;
import X.C1187KWs;
import X.C1254KZh;
import X.C1567Kek;
import X.C1569Kem;
import X.C1574Ker;
import X.C1588Kf5;
import X.C1627Kfi;
import X.C1628Kfj;
import X.C1659KgE;
import X.C1663KgI;
import X.C1713Kh6;
import X.C2753Kxs;
import X.C2755Kxu;
import X.C2759Kxy;
import X.C2760Kxz;
import X.C2761Ky0;
import X.C2764Ky3;
import X.C2766Ky5;
import X.C2767Ky6;
import X.C2768Ky7;
import X.C2769Ky8;
import X.C2773KyC;
import X.C2774KyD;
import X.C2775KyE;
import X.C2776KyF;
import X.C2777KyG;
import X.C2778KyH;
import X.C2779KyI;
import X.C2780KyJ;
import X.C2781KyK;
import X.C2782KyL;
import X.C2783KyM;
import X.C2784KyN;
import X.C2786KyP;
import X.C2787KyQ;
import X.C2810Kyn;
import X.C2813Kyq;
import X.C4221LgS;
import X.HtZ;
import X.HxE;
import X.JJo;
import X.JJu;
import X.JJv;
import X.KLC;
import X.KLF;
import X.KZ3;
import X.M12;
import X.Qx3;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.view.Window;
import androidx.appcompat.app.AppCompatDialogFragment;
import com.bytedance.covode.number.Covode;
import com.bytedance.hybrid.spark.SparkContext;
import com.bytedance.hybrid.spark.anim.BottomSheetBehavior;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import kotlin.h.b.n;

public final class SparkPopup extends AppCompatDialogFragment implements ViewTreeObserver.OnGlobalLayoutListener, C0301Jyq, HtZ, 3Wd {
    public static final C2755Kxu LJII = new C2755Kxu((byte) 0);
    public C1627Kfi LIZ;
    public SparkContext LIZIZ;
    public SparkFragment LIZJ;
    public BottomSheetBehavior<HxE> LIZLLL;
    public C4221LgS LJ;
    public ViewTreeObserver LJFF;
    public final C2761Ky0 LJI = new C2761Ky0();
    public HxE LJIIIIZZ;
    public View LJIIIZ;
    public 1gt LJIIJ;
    public final List<C1713Kh6> LJIIJJI = new ArrayList();
    public JJo LJIIL;
    public final JJv LJIILIIL = new JJv();
    public int LJIILJJIL;
    public int LJIILL;
    public C0307Jyw LJIILLIIL;
    public C2810Kyn LJIIZILJ;
    public HashMap LJIJ;

    static {
        Covode.recordClassIndex(27849);
    }

    private View LJFF() {
        if (this.LJIJ == null) {
            this.LJIJ = new HashMap();
        }
        View view = (View) this.LJIJ.get(2131368703);
        if (view != null) {
            return view;
        }
        View view2 = getView();
        if (view2 == null) {
            return null;
        }
        View findViewById = view2.findViewById(2131368703);
        this.LJIJ.put(2131368703, findViewById);
        return findViewById;
    }

    public final void LIZJ() {
        LIZ(true);
    }

    public final void LIZLLL() {
        SparkFragment sparkFragment = this.LIZJ;
        if (sparkFragment != null) {
            sparkFragment.LIZLLL();
        }
    }

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

    private final SparkFragment LIZ() {
        SparkFragment sparkFragment = this.LIZJ;
        if (sparkFragment == null) {
            return new SparkFragment();
        }
        return sparkFragment;
    }

    private final boolean LJ() {
        C1627Kfi kfi = this.LIZ;
        if (kfi == null) {
            n.LIZ("");
        }
        return !n.LIZ(kfi.getRealGravity(getContext()), "center");
    }

    public final void onStart() {
        C2761Ky0 ky0 = this.LJI;
        M12.LIZ((Object) this);
        ky0.LIZ(this, C2779KyI.LIZ);
        SparkPopup.super.onStart();
        C2761Ky0 ky02 = this.LJI;
        M12.LIZ((Object) this);
        ky02.LIZ(this, C2776KyF.LIZ);
    }

    public final void onStop() {
        C2761Ky0 ky0 = this.LJI;
        M12.LIZ((Object) this);
        ky0.LIZ(this, C2780KyJ.LIZ);
        SparkPopup.super.onStop();
        C2761Ky0 ky02 = this.LJI;
        M12.LIZ((Object) this);
        ky02.LIZ(this, C2777KyG.LIZ);
    }

    private final boolean LIZIZ() {
        C1627Kfi kfi = this.LIZ;
        if (kfi == null) {
            n.LIZ("");
        }
        if (kfi.getEnablePullDownClose()) {
            return true;
        }
        C1627Kfi kfi2 = this.LIZ;
        if (kfi2 == null) {
            n.LIZ("");
        }
        if (kfi2.getDragByGesture()) {
            return true;
        }
        C1627Kfi kfi3 = this.LIZ;
        if (kfi3 == null) {
            n.LIZ("");
        }
        if (n.LIZ(kfi3.getRealGravity(getContext()), "bottom")) {
            return true;
        }
        return false;
    }

    public final void onDestroy() {
        List<C2813Kyq> list;
        C2761Ky0 ky0 = this.LJI;
        M12.LIZ((Object) this);
        ky0.LIZ(this, C2778KyH.LIZ);
        SparkPopup.super.onDestroy();
        C2761Ky0 ky02 = this.LJI;
        M12.LIZ((Object) this);
        ky02.LIZ(this, C2775KyE.LIZ);
        C2810Kyn kyn = this.LJIIZILJ;
        if (kyn != null && (list = kyn.LIZ) != null) {
            for (T next : list) {
                C2761Ky0 ky03 = this.LJI;
                M12.LIZ((Object) next);
                ky03.LIZ.remove(next);
            }
        }
    }

    public final void onPause() {
        C1567Kek kek;
        C1569Kem kitView;
        C2761Ky0 ky0 = this.LJI;
        M12.LIZ((Object) this);
        ky0.LIZ(this, C2783KyM.LIZ);
        SparkFragment sparkFragment = this.LIZJ;
        if (!(sparkFragment == null || (kek = sparkFragment.LIZ) == null || (kitView = kek.getKitView()) == null)) {
            kitView.LIZLLL();
        }
        SparkPopup.super.onPause();
        C2761Ky0 ky02 = this.LJI;
        M12.LIZ((Object) this);
        ky02.LIZ(this, C2781KyK.LIZ);
    }

    public final void onResume() {
        C1567Kek kek;
        C1569Kem kitView;
        C2761Ky0 ky0 = this.LJI;
        M12.LIZ((Object) this);
        ky0.LIZ(this, C2784KyN.LIZ);
        SparkPopup.super.onResume();
        SparkFragment sparkFragment = this.LIZJ;
        if (!(sparkFragment == null || (kek = sparkFragment.LIZ) == null || (kitView = kek.getKitView()) == null)) {
            kitView.LIZJ();
        }
        C2761Ky0 ky02 = this.LJI;
        M12.LIZ((Object) this);
        ky02.LIZ(this, C2782KyL.LIZ);
    }

    /* JADX WARNING: Code restructure failed: missing block: B:26:0x0068, code lost:
        if (r2 <= (r1 - r0.getMinMarginTop())) goto L_0x006a;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:36:0x009a, code lost:
        if (r2 > (r1 - (r0.getMinMarginTop() * 2))) goto L_0x009c;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:37:0x009c, code lost:
        r0 = r8.LIZ;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:38:0x009e, code lost:
        if (r0 != null) goto L_0x00a3;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:39:0x00a0, code lost:
        kotlin.h.b.n.LIZ("");
     */
    /* JADX WARNING: Code restructure failed: missing block: B:41:0x00a7, code lost:
        if (r0.getMinMarginTop() <= 0) goto L_0x012e;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:42:0x00a9, code lost:
        r0 = r8.LJIIIIZZ;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:43:0x00ab, code lost:
        if (r0 != null) goto L_0x00b0;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:44:0x00ad, code lost:
        kotlin.h.b.n.LIZ("");
     */
    /* JADX WARNING: Code restructure failed: missing block: B:45:0x00b0, code lost:
        r1 = r0.getMeasuredHeight();
        r0 = r8.LIZ;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:46:0x00b6, code lost:
        if (r0 != null) goto L_0x00bb;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:47:0x00b8, code lost:
        kotlin.h.b.n.LIZ("");
     */
    /* JADX WARNING: Code restructure failed: missing block: B:48:0x00bb, code lost:
        r1 = r1 + r0.getMinMarginTop();
        r0 = (android.widget.FrameLayout) LJFF();
        kotlin.h.b.n.LIZ(r0, "");
     */
    /* JADX WARNING: Code restructure failed: missing block: B:49:0x00cd, code lost:
        if (r1 < r0.getMeasuredHeight()) goto L_0x012e;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:51:0x00d1, code lost:
        if (r8.LJIILL != 0) goto L_0x00e0;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:52:0x00d3, code lost:
        r0 = r8.LJIIIIZZ;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:53:0x00d5, code lost:
        if (r0 != null) goto L_0x00da;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:54:0x00d7, code lost:
        kotlin.h.b.n.LIZ("");
     */
    /* JADX WARNING: Code restructure failed: missing block: B:55:0x00da, code lost:
        r8.LJIILL = r0.getMeasuredHeight();
     */
    /* JADX WARNING: Code restructure failed: missing block: B:56:0x00e0, code lost:
        r2 = r8.LJIILL;
        r0 = (android.widget.FrameLayout) LJFF();
        kotlin.h.b.n.LIZ(r0, "");
        r1 = r0.getMeasuredHeight();
        r0 = r8.LIZ;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:57:0x00f1, code lost:
        if (r0 != null) goto L_0x00f6;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:58:0x00f3, code lost:
        kotlin.h.b.n.LIZ("");
     */
    /* JADX WARNING: Code restructure failed: missing block: B:59:0x00f6, code lost:
        r1 = X.Qx3.LIZLLL(r2, r1 - r0.getMinMarginTop());
        r0 = r8.LJIIIIZZ;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:60:0x0101, code lost:
        if (r0 != null) goto L_0x0106;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:61:0x0103, code lost:
        kotlin.h.b.n.LIZ("");
     */
    /* JADX WARNING: Code restructure failed: missing block: B:62:0x0106, code lost:
        r0 = r0.getLayoutParams();
     */
    /* JADX WARNING: Code restructure failed: missing block: B:63:0x010a, code lost:
        if (r0 == null) goto L_0x010e;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:64:0x010c, code lost:
        r0.height = r1;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:66:0x0112, code lost:
        if (LIZIZ() == false) goto L_0x0138;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:67:0x0114, code lost:
        r2 = r8.LJIIIIZZ;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:68:0x0116, code lost:
        if (r2 != null) goto L_0x0142;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:69:0x0118, code lost:
        kotlin.h.b.n.LIZ("");
     */
    /* JADX WARNING: Code restructure failed: missing block: B:70:0x011b, code lost:
        r0 = r8.LIZLLL;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:71:0x011d, code lost:
        if (r0 != null) goto L_0x0122;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:72:0x011f, code lost:
        kotlin.h.b.n.LIZ("");
     */
    /* JADX WARNING: Code restructure failed: missing block: B:73:0x0122, code lost:
        r0.LJJI = true;
        r0 = r8.LJIIIIZZ;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:74:0x0126, code lost:
        if (r0 != null) goto L_0x012b;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:75:0x0128, code lost:
        kotlin.h.b.n.LIZ("");
     */
    /* JADX WARNING: Code restructure failed: missing block: B:76:0x012b, code lost:
        r0.requestLayout();
     */
    /* JADX WARNING: Code restructure failed: missing block: B:79:0x0138, code lost:
        r1 = X.C2759Kxy.LIZ;
        r2 = r8.LJIIIIZZ;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:80:0x013c, code lost:
        if (r2 != null) goto L_0x0144;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:81:0x013e, code lost:
        kotlin.h.b.n.LIZ("");
     */
    /* JADX WARNING: Code restructure failed: missing block: B:82:0x0142, code lost:
        r1 = X.C2759Kxy.LIZ;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:83:0x0144, code lost:
        r1.LIZ((android.view.View) r2, 81);
     */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final void onGlobalLayout() {
        /*
            r8 = this;
            android.graphics.Rect r1 = new android.graphics.Rect
            r1.<init>()
            android.view.View r0 = r8.getView()
            if (r0 == 0) goto L_0x000e
            r0.getWindowVisibleDisplayFrame(r1)
        L_0x000e:
            int r3 = r1.height()
            int r2 = r8.LJIILJJIL
            if (r2 != 0) goto L_0x0019
            r8.LJIILJJIL = r3
            return
        L_0x0019:
            if (r2 != r3) goto L_0x001c
            return
        L_0x001c:
            int r0 = r2 - r3
            r1 = 100
            r7 = 1
            r5 = 0
            java.lang.String r4 = ""
            if (r0 <= r1) goto L_0x014a
            int r5 = r3 - r2
            X.1hK r0 = r8.getActivity()
            if (r0 == 0) goto L_0x012e
            android.view.View r0 = r8.getView()
            if (r0 == 0) goto L_0x012e
            X.1hK r0 = r8.getActivity()
            if (r0 == 0) goto L_0x012e
            boolean r0 = r8.LJ()
            if (r0 == 0) goto L_0x006a
            X.Kfi r1 = r8.LIZ
            if (r1 != 0) goto L_0x0047
            kotlin.h.b.n.LIZ(r4)
        L_0x0047:
            X.1hK r0 = r8.getActivity()
            int r2 = r1.getRealHeight(r0)
            android.view.View r0 = r8.LJFF()
            android.widget.FrameLayout r0 = (android.widget.FrameLayout) r0
            kotlin.h.b.n.LIZ(r0, r4)
            int r1 = r0.getMeasuredHeight()
            X.Kfi r0 = r8.LIZ
            if (r0 != 0) goto L_0x0063
            kotlin.h.b.n.LIZ(r4)
        L_0x0063:
            int r0 = r0.getMinMarginTop()
            int r1 = r1 - r0
            if (r2 > r1) goto L_0x009c
        L_0x006a:
            boolean r0 = r8.LJ()
            if (r0 != 0) goto L_0x012e
            X.Kfi r1 = r8.LIZ
            if (r1 != 0) goto L_0x0077
            kotlin.h.b.n.LIZ(r4)
        L_0x0077:
            X.1hK r0 = r8.getActivity()
            int r2 = r1.getRealHeight(r0)
            android.view.View r0 = r8.LJFF()
            android.widget.FrameLayout r0 = (android.widget.FrameLayout) r0
            kotlin.h.b.n.LIZ(r0, r4)
            int r1 = r0.getMeasuredHeight()
            X.Kfi r0 = r8.LIZ
            if (r0 != 0) goto L_0x0093
            kotlin.h.b.n.LIZ(r4)
        L_0x0093:
            int r0 = r0.getMinMarginTop()
            int r0 = r0 * 2
            int r1 = r1 - r0
            if (r2 <= r1) goto L_0x012e
        L_0x009c:
            X.Kfi r0 = r8.LIZ
            if (r0 != 0) goto L_0x00a3
            kotlin.h.b.n.LIZ(r4)
        L_0x00a3:
            int r0 = r0.getMinMarginTop()
            if (r0 <= 0) goto L_0x012e
            X.HxE r0 = r8.LJIIIIZZ
            if (r0 != 0) goto L_0x00b0
            kotlin.h.b.n.LIZ(r4)
        L_0x00b0:
            int r1 = r0.getMeasuredHeight()
            X.Kfi r0 = r8.LIZ
            if (r0 != 0) goto L_0x00bb
            kotlin.h.b.n.LIZ(r4)
        L_0x00bb:
            int r0 = r0.getMinMarginTop()
            int r1 = r1 + r0
            android.view.View r0 = r8.LJFF()
            android.widget.FrameLayout r0 = (android.widget.FrameLayout) r0
            kotlin.h.b.n.LIZ(r0, r4)
            int r0 = r0.getMeasuredHeight()
            if (r1 < r0) goto L_0x012e
            int r0 = r8.LJIILL
            if (r0 != 0) goto L_0x00e0
            X.HxE r0 = r8.LJIIIIZZ
            if (r0 != 0) goto L_0x00da
            kotlin.h.b.n.LIZ(r4)
        L_0x00da:
            int r0 = r0.getMeasuredHeight()
            r8.LJIILL = r0
        L_0x00e0:
            int r2 = r8.LJIILL
            android.view.View r0 = r8.LJFF()
            android.widget.FrameLayout r0 = (android.widget.FrameLayout) r0
            kotlin.h.b.n.LIZ(r0, r4)
            int r1 = r0.getMeasuredHeight()
            X.Kfi r0 = r8.LIZ
            if (r0 != 0) goto L_0x00f6
            kotlin.h.b.n.LIZ(r4)
        L_0x00f6:
            int r0 = r0.getMinMarginTop()
            int r1 = r1 - r0
            int r1 = X.Qx3.LIZLLL(r2, r1)
            X.HxE r0 = r8.LJIIIIZZ
            if (r0 != 0) goto L_0x0106
            kotlin.h.b.n.LIZ(r4)
        L_0x0106:
            android.view.ViewGroup$LayoutParams r0 = r0.getLayoutParams()
            if (r0 == 0) goto L_0x010e
            r0.height = r1
        L_0x010e:
            boolean r0 = r8.LIZIZ()
            if (r0 == 0) goto L_0x0138
            X.HxE r2 = r8.LJIIIIZZ
            if (r2 != 0) goto L_0x0142
            kotlin.h.b.n.LIZ(r4)
        L_0x011b:
            com.bytedance.hybrid.spark.anim.BottomSheetBehavior<X.HxE> r0 = r8.LIZLLL
            if (r0 != 0) goto L_0x0122
            kotlin.h.b.n.LIZ(r4)
        L_0x0122:
            r0.LJJI = r7
            X.HxE r0 = r8.LJIIIIZZ
            if (r0 != 0) goto L_0x012b
            kotlin.h.b.n.LIZ(r4)
        L_0x012b:
            r0.requestLayout()
        L_0x012e:
            int r0 = java.lang.Math.abs(r5)
            r8.LIZ((int) r0)
            r8.LJIILJJIL = r3
            return
        L_0x0138:
            X.Kxt r1 = X.C2759Kxy.LIZ
            X.HxE r2 = r8.LJIIIIZZ
            if (r2 != 0) goto L_0x0144
            kotlin.h.b.n.LIZ(r4)
            goto L_0x0144
        L_0x0142:
            X.Kxt r1 = X.C2759Kxy.LIZ
        L_0x0144:
            r0 = 81
            r1.LIZ((android.view.View) r2, (int) r0)
            goto L_0x011b
        L_0x014a:
            int r0 = r3 - r2
            if (r0 <= r1) goto L_0x01b8
            int r6 = r3 - r2
            X.1hK r0 = r8.getActivity()
            if (r0 == 0) goto L_0x01ae
            android.view.View r2 = r8.getView()
            if (r2 == 0) goto L_0x01ae
            int r0 = r8.LJIILL
            if (r0 <= 0) goto L_0x01ae
            X.Kfi r0 = r8.LIZ
            if (r0 != 0) goto L_0x0167
            kotlin.h.b.n.LIZ(r4)
        L_0x0167:
            int r0 = r0.getMinMarginTop()
            if (r0 <= 0) goto L_0x01ae
            X.HxE r0 = r8.LJIIIIZZ
            if (r0 != 0) goto L_0x0174
            kotlin.h.b.n.LIZ(r4)
        L_0x0174:
            android.view.ViewGroup$LayoutParams r1 = r0.getLayoutParams()
            int r0 = r8.LJIILL
            r1.height = r0
            com.bytedance.hybrid.spark.anim.BottomSheetBehavior<X.HxE> r0 = r8.LIZLLL
            if (r0 != 0) goto L_0x0183
            kotlin.h.b.n.LIZ(r4)
        L_0x0183:
            r0.LJJI = r7
            X.HxE r0 = r8.LJIIIIZZ
            if (r0 != 0) goto L_0x018c
            kotlin.h.b.n.LIZ(r4)
        L_0x018c:
            r0.requestLayout()
            X.Kxt r1 = X.C2759Kxy.LIZ
            X.Kfi r0 = r8.LIZ
            if (r0 != 0) goto L_0x0198
            kotlin.h.b.n.LIZ(r4)
        L_0x0198:
            kotlin.h.b.n.LIZ(r2, r4)
            int r2 = r1.LIZ((X.C1627Kfi) r0, (android.view.View) r2)
            boolean r0 = r8.LIZIZ()
            if (r0 == 0) goto L_0x01b9
            X.HxE r1 = r8.LJIIIIZZ
            if (r1 != 0) goto L_0x01c3
            kotlin.h.b.n.LIZ(r4)
        L_0x01ac:
            r8.LJIILL = r5
        L_0x01ae:
            int r0 = java.lang.Math.abs(r6)
            int r0 = -r0
            r8.LIZ((int) r0)
            r8.LJIILJJIL = r3
        L_0x01b8:
            return
        L_0x01b9:
            X.Kxt r0 = X.C2759Kxy.LIZ
            X.HxE r1 = r8.LJIIIIZZ
            if (r1 != 0) goto L_0x01c5
            kotlin.h.b.n.LIZ(r4)
            goto L_0x01c5
        L_0x01c3:
            X.Kxt r0 = X.C2759Kxy.LIZ
        L_0x01c5:
            r0.LIZ((android.view.View) r1, (int) r2)
            goto L_0x01ac
        */
        throw new UnsupportedOperationException("Method not decompiled: com.bytedance.hybrid.spark.page.SparkPopup.onGlobalLayout():void");
    }

    public final void LIZ(C0307Jyw jyw) {
        M12.LIZ((Object) jyw);
        this.LJIILLIIL = jyw;
    }

    public static final /* synthetic */ C1627Kfi LIZ(SparkPopup sparkPopup) {
        C1627Kfi kfi = sparkPopup.LIZ;
        if (kfi == null) {
            n.LIZ("");
        }
        return kfi;
    }

    public final void onConfigurationChanged(Configuration configuration) {
        M12.LIZ((Object) configuration);
        SparkPopup.super.onConfigurationChanged(configuration);
        C2761Ky0 ky0 = this.LJI;
        M12.LIZ((Object) this, (Object) configuration);
        ky0.LIZ(this, new C2767Ky6(configuration));
    }

    public final Dialog onCreateDialog(Bundle bundle) {
        Context requireContext = requireContext();
        n.LIZ(requireContext, "");
        4vU kgE = new C1659KgE(this, requireContext);
        1hK activity = getActivity();
        if (activity != null) {
            kgE.setOwnerActivity(activity);
        }
        kgE.LIZ = this.LIZIZ;
        return kgE;
    }

    public final void onSaveInstanceState(Bundle bundle) {
        M12.LIZ((Object) bundle);
        C2761Ky0 ky0 = this.LJI;
        M12.LIZ((Object) this, (Object) bundle);
        ky0.LIZ(this, new C2769Ky8(bundle));
        SparkPopup.super.onSaveInstanceState(bundle);
        C2761Ky0 ky02 = this.LJI;
        M12.LIZ((Object) this, (Object) bundle);
        ky02.LIZ(this, new C2768Ky7(bundle));
    }

    private final void LIZ(int i) {
        Window window;
        View decorView;
        Dialog dialog = getDialog();
        if (dialog != null && (window = dialog.getWindow()) != null && (decorView = window.getDecorView()) != null) {
            n.LIZ(decorView, "");
            if ((decorView.getWindowSystemUiVisibility() & 1536) != 0) {
                C1627Kfi kfi = this.LIZ;
                if (kfi == null) {
                    n.LIZ("");
                }
                if (kfi.getEngineType() == KLF.WEB) {
                    decorView.setPadding(decorView.getPaddingLeft(), decorView.getPaddingTop(), decorView.getPaddingRight(), decorView.getPaddingBottom() + i);
                    decorView.requestLayout();
                }
            }
        }
    }

    /* JADX WARNING: Can't fix incorrect switch cases order */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final void LIZ(boolean r10) {
        /*
            r9 = this;
            com.bytedance.hybrid.spark.page.SparkFragment r0 = r9.LIZJ
            r3 = 0
            if (r0 == 0) goto L_0x0195
            X.1hK r0 = r0.getActivity()
        L_0x0009:
            boolean r0 = r0 instanceof com.bytedance.hybrid.spark.page.SparkActivity
            java.lang.String r2 = ""
            if (r0 == 0) goto L_0x0022
            com.bytedance.hybrid.spark.page.SparkFragment r0 = r9.LIZJ
            if (r0 == 0) goto L_0x01b0
            X.1hK r0 = r0.getActivity()
            if (r0 == 0) goto L_0x01b0
            com.bytedance.hybrid.spark.page.SparkActivity r0 = (com.bytedance.hybrid.spark.page.SparkActivity) r0
            com.bytedance.hybrid.spark.page.SparkFragment r0 = r0.LJIIIIZZ
            if (r0 != 0) goto L_0x0184
            kotlin.h.b.n.LIZ(r2)
        L_0x0022:
            X.0AA r0 = r9.getFragmentManager()
            if (r0 == 0) goto L_0x004c
            if (r10 == 0) goto L_0x0170
            X.JJo r5 = r9.LJIIL
            if (r5 != 0) goto L_0x0031
            kotlin.h.b.n.LIZ(r2)
        L_0x0031:
            X.KgF r4 = new X.KgF
            r4.<init>(r9)
            java.lang.String r6 = r5.LIZIZ()
            int r0 = r6.hashCode()
            java.lang.String r7 = "null cannot be cast to non-null type android.app.Activity"
            java.lang.String r3 = "null cannot be cast to non-null type android.view.WindowManager"
            java.lang.String r8 = "window"
            r1 = 300(0x12c, double:1.48E-321)
            switch(r0) {
                case -1383228885: goto L_0x0145;
                case 3005871: goto L_0x011b;
                case 3317767: goto L_0x00bc;
                case 3387192: goto L_0x00b0;
                case 108511772: goto L_0x0053;
                default: goto L_0x0049;
            }
        L_0x0049:
            r4.invoke()
        L_0x004c:
            X.Ky0 r1 = r9.LJI
            r0 = r9
            r1.LIZIZ(r0)
            return
        L_0x0053:
            java.lang.String r0 = "right"
            boolean r0 = r6.equals(r0)
            if (r0 == 0) goto L_0x0049
            android.util.DisplayMetrics r6 = new android.util.DisplayMetrics
            r6.<init>()
            android.view.View r0 = r5.LIZ
            android.content.Context r0 = r0.getContext()
            boolean r0 = r0 instanceof android.app.Activity
            if (r0 == 0) goto L_0x00a1
            android.view.View r0 = r5.LIZ
            android.content.Context r0 = r0.getContext()
            if (r0 == 0) goto L_0x0198
            android.app.Activity r0 = (android.app.Activity) r0
            android.view.WindowManager r0 = r0.getWindowManager()
        L_0x0078:
            if (r0 == 0) goto L_0x0083
            android.view.Display r0 = r0.getDefaultDisplay()
            if (r0 == 0) goto L_0x0083
            r0.getMetrics(r6)
        L_0x0083:
            android.view.View r0 = r5.LIZ
            android.view.ViewPropertyAnimator r3 = r0.animate()
            int r0 = r6.widthPixels
            float r0 = (float) r0
            android.view.ViewPropertyAnimator r0 = r3.translationX(r0)
            android.view.ViewPropertyAnimator r1 = r0.setDuration(r1)
            X.KyU r0 = new X.KyU
            r0.<init>(r4)
            android.view.ViewPropertyAnimator r0 = r1.setListener(r0)
            r0.start()
            goto L_0x004c
        L_0x00a1:
            android.view.View r0 = r5.LIZ
            android.content.Context r0 = r0.getContext()
            java.lang.Object r0 = X.JJo.LIZ(r0, r8)
            if (r0 == 0) goto L_0x019e
            android.view.WindowManager r0 = (android.view.WindowManager) r0
            goto L_0x0078
        L_0x00b0:
            java.lang.String r0 = "none"
            boolean r0 = r6.equals(r0)
            if (r0 == 0) goto L_0x0049
            r4.invoke()
            goto L_0x004c
        L_0x00bc:
            java.lang.String r0 = "left"
            boolean r0 = r6.equals(r0)
            if (r0 == 0) goto L_0x0049
            android.util.DisplayMetrics r6 = new android.util.DisplayMetrics
            r6.<init>()
            android.view.View r0 = r5.LIZ
            android.content.Context r0 = r0.getContext()
            boolean r0 = r0 instanceof android.app.Activity
            if (r0 == 0) goto L_0x010c
            android.view.View r0 = r5.LIZ
            android.content.Context r0 = r0.getContext()
            if (r0 == 0) goto L_0x01a4
            android.app.Activity r0 = (android.app.Activity) r0
            android.view.WindowManager r0 = r0.getWindowManager()
        L_0x00e1:
            if (r0 == 0) goto L_0x00ec
            android.view.Display r0 = r0.getDefaultDisplay()
            if (r0 == 0) goto L_0x00ec
            r0.getMetrics(r6)
        L_0x00ec:
            android.view.View r0 = r5.LIZ
            android.view.ViewPropertyAnimator r3 = r0.animate()
            int r0 = r6.widthPixels
            float r0 = (float) r0
            float r0 = -r0
            android.view.ViewPropertyAnimator r0 = r3.translationX(r0)
            android.view.ViewPropertyAnimator r1 = r0.setDuration(r1)
            X.KyT r0 = new X.KyT
            r0.<init>(r4)
            android.view.ViewPropertyAnimator r0 = r1.setListener(r0)
            r0.start()
            goto L_0x004c
        L_0x010c:
            android.view.View r0 = r5.LIZ
            android.content.Context r0 = r0.getContext()
            java.lang.Object r0 = X.JJo.LIZ(r0, r8)
            if (r0 == 0) goto L_0x01aa
            android.view.WindowManager r0 = (android.view.WindowManager) r0
            goto L_0x00e1
        L_0x011b:
            java.lang.String r0 = "auto"
            boolean r0 = r6.equals(r0)
            if (r0 == 0) goto L_0x0049
            android.view.View r3 = r5.LIZ
            r0 = 1065353216(0x3f800000, float:1.0)
            r3.setAlpha(r0)
            android.view.ViewPropertyAnimator r3 = r3.animate()
            r0 = 0
            android.view.ViewPropertyAnimator r0 = r3.alpha(r0)
            android.view.ViewPropertyAnimator r1 = r0.setDuration(r1)
            X.JKE r0 = new X.JKE
            r0.<init>(r5, r4)
            android.view.ViewPropertyAnimator r0 = r1.setListener(r0)
            r0.start()
            goto L_0x004c
        L_0x0145:
            java.lang.String r0 = "bottom"
            boolean r0 = r6.equals(r0)
            if (r0 == 0) goto L_0x0049
            android.view.View r0 = r5.LIZ
            android.view.ViewPropertyAnimator r3 = r0.animate()
            android.view.View r0 = r5.LIZ
            int r0 = r0.getHeight()
            float r0 = (float) r0
            android.view.ViewPropertyAnimator r0 = r3.translationY(r0)
            android.view.ViewPropertyAnimator r1 = r0.setDuration(r1)
            X.KyS r0 = new X.KyS
            r0.<init>(r4)
            android.view.ViewPropertyAnimator r0 = r1.setListener(r0)
            r0.start()
            goto L_0x004c
        L_0x0170:
            r9.dismissAllowingStateLoss()     // Catch:{ all -> 0x017a }
            X.2Pr r0 = X.2Pr.LIZ     // Catch:{ all -> 0x017a }
            X.2te.constructor-impl(r0)     // Catch:{ all -> 0x017a }
            goto L_0x004c
        L_0x017a:
            r0 = move-exception
            java.lang.Object r0 = X.2th.LIZ(r0)
            X.2te.constructor-impl(r0)
            goto L_0x004c
        L_0x0184:
            X.Kek r0 = r0.LIZ
            if (r0 == 0) goto L_0x0022
            X.Kem r1 = r0.getKitView()
            if (r1 == 0) goto L_0x0022
            java.lang.String r0 = "onDismissPopup"
            r1.LIZ((java.lang.String) r0, (org.json.JSONObject) r3)
            goto L_0x0022
        L_0x0195:
            r0 = r3
            goto L_0x0009
        L_0x0198:
            X.7xU r0 = new X.7xU
            r0.<init>(r7)
            throw r0
        L_0x019e:
            X.7xU r0 = new X.7xU
            r0.<init>(r3)
            throw r0
        L_0x01a4:
            X.7xU r0 = new X.7xU
            r0.<init>(r7)
            throw r0
        L_0x01aa:
            X.7xU r0 = new X.7xU
            r0.<init>(r3)
            throw r0
        L_0x01b0:
            X.7xU r1 = new X.7xU
            java.lang.String r0 = "null cannot be cast to non-null type com.bytedance.hybrid.spark.page.SparkActivity"
            r1.<init>(r0)
            throw r1
        */
        throw new UnsupportedOperationException("Method not decompiled: com.bytedance.hybrid.spark.page.SparkPopup.LIZ(boolean):void");
    }

    /* JADX WARNING: Code restructure failed: missing block: B:78:0x0159, code lost:
        if (r2 <= (r1 - r0.getMinMarginTop())) goto L_0x015b;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:88:0x0188, code lost:
        if (r2 > (r1 - (r0.getMinMarginTop() * 2))) goto L_0x018a;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:89:0x018a, code lost:
        r3 = r9.getPaddingLeft();
        r2 = r9.getPaddingTop();
        r0 = r8.LIZ;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:90:0x0194, code lost:
        if (r0 != null) goto L_0x0199;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:91:0x0196, code lost:
        kotlin.h.b.n.LIZ("");
     */
    /* JADX WARNING: Code restructure failed: missing block: B:92:0x0199, code lost:
        r9.setPadding(r3, r2 + r0.getMinMarginTop(), r9.getPaddingRight(), r9.getPaddingBottom());
     */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final void onViewCreated(android.view.View r9, android.os.Bundle r10) {
        /*
            r8 = this;
            X.M12.LIZ((java.lang.Object) r9)
            X.Ky0 r1 = r8.LJI
            r4 = r8
            X.M12.LIZ((java.lang.Object) r4, (java.lang.Object) r9)
            X.KyA r0 = new X.KyA
            r0.<init>(r9, r10)
            r1.LIZ(r4, r0)
            com.bytedance.hybrid.spark.page.SparkPopup.super.onViewCreated(r9, r10)
            java.util.List<X.Kh6> r6 = r8.LJIIJJI
            boolean r0 = r8.LIZIZ()
            java.lang.String r5 = ""
            if (r0 == 0) goto L_0x00c7
            X.Kxv r2 = new X.Kxv
            X.Kfi r1 = r8.LIZ
            if (r1 != 0) goto L_0x0027
            kotlin.h.b.n.LIZ(r5)
        L_0x0027:
            X.HxE r0 = r8.LJIIIIZZ
            if (r0 != 0) goto L_0x002e
            kotlin.h.b.n.LIZ(r5)
        L_0x002e:
            r2.<init>(r1, r0)
            r6.add(r2)
            X.Kxx r3 = new X.Kxx
            X.Kfi r2 = r8.LIZ
            if (r2 != 0) goto L_0x003d
            kotlin.h.b.n.LIZ(r5)
        L_0x003d:
            X.HxE r1 = r8.LJIIIIZZ
            if (r1 != 0) goto L_0x0044
            kotlin.h.b.n.LIZ(r5)
        L_0x0044:
            X.1hK r0 = r8.getActivity()
            r3.<init>(r2, r1, r0)
            r6.add(r3)
        L_0x004e:
            X.HxF r3 = new X.HxF
            X.Kfi r2 = r8.LIZ
            if (r2 != 0) goto L_0x0057
            kotlin.h.b.n.LIZ(r5)
        L_0x0057:
            X.HxE r1 = r8.LJIIIIZZ
            if (r1 != 0) goto L_0x005e
            kotlin.h.b.n.LIZ(r5)
        L_0x005e:
            boolean r0 = r8.LIZIZ()
            r3.<init>(r2, r1, r0)
            r6.add(r3)
            X.Khl r2 = new X.Khl
            X.Kfi r1 = r8.LIZ
            if (r1 != 0) goto L_0x0071
            kotlin.h.b.n.LIZ(r5)
        L_0x0071:
            android.view.View r0 = r8.LJIIIZ
            if (r0 != 0) goto L_0x0078
            kotlin.h.b.n.LIZ(r5)
        L_0x0078:
            r2.<init>(r1, r0)
            r6.add(r2)
            X.Kfp r2 = new X.Kfp
            X.Kfi r1 = r8.LIZ
            if (r1 != 0) goto L_0x0087
            kotlin.h.b.n.LIZ(r5)
        L_0x0087:
            android.view.View r0 = r8.LJIIIZ
            if (r0 != 0) goto L_0x008e
            kotlin.h.b.n.LIZ(r5)
        L_0x008e:
            r2.<init>(r1, r0)
            r6.add(r2)
            X.Kf8 r7 = new X.Kf8
            com.bytedance.hybrid.spark.page.SparkFragment r3 = r8.LIZJ
            X.Kfi r2 = r8.LIZ
            if (r2 != 0) goto L_0x009f
            kotlin.h.b.n.LIZ(r5)
        L_0x009f:
            android.view.View r1 = r8.LJIIIZ
            if (r1 != 0) goto L_0x00a6
            kotlin.h.b.n.LIZ(r5)
        L_0x00a6:
            X.KyO r0 = new X.KyO
            r0.<init>(r8)
            r7.<init>(r3, r2, r1, r0)
            r6.add(r7)
            java.util.List<X.Kh6> r0 = r8.LJIIJJI
            java.util.Iterator r1 = r0.iterator()
        L_0x00b7:
            boolean r0 = r1.hasNext()
            if (r0 == 0) goto L_0x00f9
            java.lang.Object r0 = r1.next()
            X.Kh6 r0 = (X.C1713Kh6) r0
            r0.LIZ()
            goto L_0x00b7
        L_0x00c7:
            X.Kxv r2 = new X.Kxv
            X.Kfi r1 = r8.LIZ
            if (r1 != 0) goto L_0x00d0
            kotlin.h.b.n.LIZ(r5)
        L_0x00d0:
            X.HxE r0 = r8.LJIIIIZZ
            if (r0 != 0) goto L_0x00d7
            kotlin.h.b.n.LIZ(r5)
        L_0x00d7:
            r2.<init>(r1, r0)
            r6.add(r2)
            X.Kxx r3 = new X.Kxx
            X.Kfi r2 = r8.LIZ
            if (r2 != 0) goto L_0x00e6
            kotlin.h.b.n.LIZ(r5)
        L_0x00e6:
            X.HxE r1 = r8.LJIIIIZZ
            if (r1 != 0) goto L_0x00ed
            kotlin.h.b.n.LIZ(r5)
        L_0x00ed:
            X.1hK r0 = r8.getActivity()
            r3.<init>(r2, r1, r0)
            r6.add(r3)
            goto L_0x004e
        L_0x00f9:
            X.KXm r6 = X.C1207KXm.LIZ
            android.app.Dialog r0 = r8.getDialog()
            if (r0 == 0) goto L_0x01b7
            android.view.Window r3 = r0.getWindow()
        L_0x0105:
            X.Kfi r2 = r8.LIZ
            if (r2 != 0) goto L_0x010c
            kotlin.h.b.n.LIZ(r5)
        L_0x010c:
            X.HxE r1 = r8.LJIIIIZZ
            if (r1 != 0) goto L_0x0113
            kotlin.h.b.n.LIZ(r5)
        L_0x0113:
            r0 = 1
            r6.LIZ(r3, r2, r1, r0)
            X.Kxw r2 = new X.Kxw
            r2.<init>(r8, r9)
            r0 = 200(0xc8, double:9.9E-322)
            r9.postDelayed(r2, r0)
            X.1hK r0 = r8.getActivity()
            if (r0 == 0) goto L_0x01a9
            X.1hK r3 = r8.getActivity()
            r0 = 0
            if (r3 == 0) goto L_0x01a9
            boolean r0 = r8.LJ()
            if (r0 == 0) goto L_0x015b
            X.Kfi r1 = r8.LIZ
            if (r1 != 0) goto L_0x013b
            kotlin.h.b.n.LIZ(r5)
        L_0x013b:
            X.1hK r0 = r8.getActivity()
            int r2 = r1.getRealHeight(r0)
            kotlin.h.b.n.LIZ(r3, r5)
            X.M12.LIZ((java.lang.Object) r3)
            int r1 = X.C1663KgI.LIZ()
            X.Kfi r0 = r8.LIZ
            if (r0 != 0) goto L_0x0154
            kotlin.h.b.n.LIZ(r5)
        L_0x0154:
            int r0 = r0.getMinMarginTop()
            int r1 = r1 - r0
            if (r2 > r1) goto L_0x018a
        L_0x015b:
            boolean r0 = r8.LJ()
            if (r0 != 0) goto L_0x01a9
            X.Kfi r1 = r8.LIZ
            if (r1 != 0) goto L_0x0168
            kotlin.h.b.n.LIZ(r5)
        L_0x0168:
            X.1hK r0 = r8.getActivity()
            int r2 = r1.getRealHeight(r0)
            kotlin.h.b.n.LIZ(r3, r5)
            X.M12.LIZ((java.lang.Object) r3)
            int r1 = X.C1663KgI.LIZ()
            X.Kfi r0 = r8.LIZ
            if (r0 != 0) goto L_0x0181
            kotlin.h.b.n.LIZ(r5)
        L_0x0181:
            int r0 = r0.getMinMarginTop()
            int r0 = r0 * 2
            int r1 = r1 - r0
            if (r2 <= r1) goto L_0x01a9
        L_0x018a:
            int r3 = r9.getPaddingLeft()
            int r2 = r9.getPaddingTop()
            X.Kfi r0 = r8.LIZ
            if (r0 != 0) goto L_0x0199
            kotlin.h.b.n.LIZ(r5)
        L_0x0199:
            int r0 = r0.getMinMarginTop()
            int r2 = r2 + r0
            int r1 = r9.getPaddingRight()
            int r0 = r9.getPaddingBottom()
            r9.setPadding(r3, r2, r1, r0)
        L_0x01a9:
            X.Ky0 r1 = r8.LJI
            X.M12.LIZ((java.lang.Object) r4, (java.lang.Object) r9)
            X.Ky9 r0 = new X.Ky9
            r0.<init>(r9, r10)
            r1.LIZ(r4, r0)
            return
        L_0x01b7:
            r3 = 0
            goto L_0x0105
        */
        throw new UnsupportedOperationException("Method not decompiled: com.bytedance.hybrid.spark.page.SparkPopup.onViewCreated(android.view.View, android.os.Bundle):void");
    }

    public final void onRequestPermissionsResult(int i, String[] strArr, int[] iArr) {
        M12.LIZ((Object) strArr, (Object) iArr);
        SparkPopup.super.onRequestPermissionsResult(i, strArr, iArr);
        C2761Ky0 ky0 = this.LJI;
        M12.LIZ(this, strArr, iArr);
        ky0.LIZ(this, new C2764Ky3(i, strArr, iArr));
    }

    public final void LIZ(Context context, SparkContext sparkContext, C1574Ker ker) {
        M12.LIZ(context, sparkContext, ker);
        SparkFragment LIZ2 = LIZ();
        this.LIZJ = LIZ2;
        if (LIZ2 != null) {
            LIZ2.LIZ(context, sparkContext, ker);
        }
    }

    public final void onActivityResult(int i, int i2, Intent intent) {
        C1588Kf5 kf5;
        KZ3 kz3;
        C2761Ky0 ky0 = this.LJI;
        M12.LIZ((Object) this);
        ky0.LIZ(this, new C2766Ky5(i, i2, intent));
        SparkPopup.super.onActivityResult(i, i2, intent);
        C0307Jyw jyw = this.LJIILLIIL;
        if (jyw != null) {
            jyw.LIZ(i, i2, intent);
        }
        SparkContext sparkContext = this.LIZIZ;
        if (!(sparkContext == null || (kz3 = (KZ3) sparkContext.LIZ(KZ3.class)) == null)) {
            kz3.LIZ(i, i2, intent);
        }
        SparkContext sparkContext2 = this.LIZIZ;
        if (sparkContext2 != null && (kf5 = (C1588Kf5) sparkContext2.LIZ(C1588Kf5.class)) != null) {
            if (!(kf5 instanceof C1588Kf5)) {
                kf5 = null;
            }
            if (kf5 != null) {
                C1588Kf5 kf52 = kf5;
                while (kf52 != null) {
                    do {
                        kf52.LIZ(i, i2, intent);
                    } while (!(kf52 instanceof C1254KZh));
                    Object LIZJ2 = kf52.LIZJ();
                    if (LIZJ2 != null && (LIZJ2 instanceof C1588Kf5)) {
                        kf52 = (C1588Kf5) LIZJ2;
                    } else {
                        return;
                    }
                }
            }
        }
    }

    public final View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        SparkContext sparkContext;
        String str;
        C2810Kyn kyn;
        C1187KWs kWs;
        C1627Kfi kfi;
        boolean z;
        int i;
        C1628Kfj LIZ2;
        SparkContext sparkContext2;
        List<C2813Kyq> list;
        LayoutInflater layoutInflater2 = layoutInflater;
        M12.LIZ((Object) layoutInflater2);
        Bundle arguments = getArguments();
        if (arguments != null) {
            sparkContext = (SparkContext) arguments.getParcelable("sparkContext");
        } else {
            sparkContext = null;
        }
        this.LIZIZ = sparkContext;
        KLC klc = KLC.LIZIZ;
        SparkContext sparkContext3 = this.LIZIZ;
        if (sparkContext3 == null || (str = sparkContext3.LJFF) == null) {
            str = "";
        }
        klc.LIZ(str, "container_init_end", System.currentTimeMillis());
        SparkContext sparkContext4 = this.LIZIZ;
        if (sparkContext4 != null) {
            kyn = (C2810Kyn) sparkContext4.LIZ(C2810Kyn.class);
        } else {
            kyn = null;
        }
        this.LJIIZILJ = kyn;
        if (!(kyn == null || (list = kyn.LIZ) == null)) {
            for (T next : list) {
                C2761Ky0 ky0 = this.LJI;
                M12.LIZ((Object) next);
                ky0.LIZ.add(next);
            }
        }
        C2761Ky0 ky02 = this.LJI;
        M12.LIZ((Object) this, (Object) layoutInflater2);
        Bundle bundle2 = bundle;
        ViewGroup viewGroup2 = viewGroup;
        ky02.LIZ(this, new C2760Kxz(layoutInflater2, viewGroup2, bundle2));
        SparkContext sparkContext5 = this.LIZIZ;
        if ((sparkContext5 == null || sparkContext5.LIZ() == null) && (sparkContext2 = this.LIZIZ) != null) {
            sparkContext2.LIZ((HtZ) this);
        }
        SparkContext sparkContext6 = this.LIZIZ;
        if (sparkContext6 != null) {
            kWs = sparkContext6.LIZJ;
        } else {
            kWs = null;
        }
        if (kWs != null) {
            kWs.put("isPopup", (Object) 1);
        }
        SparkContext sparkContext7 = this.LIZIZ;
        if (sparkContext7 == null || (LIZ2 = sparkContext7.LIZ(-1)) == null || !(LIZ2 instanceof C1627Kfi) || (kfi = (C1627Kfi) LIZ2) == null) {
            kfi = new C1627Kfi((KLF) null, 1, (2HN) null);
        }
        this.LIZ = kfi;
        if (LIZIZ()) {
            View LIZ3 = 0HH.LIZ(layoutInflater2, 2131561365, viewGroup2, false);
            HxE findViewById = LIZ3.findViewById(2131368700);
            HxE hxE = findViewById;
            0AP LIZ4 = getChildFragmentManager().LIZ();
            SparkFragment LIZ5 = LIZ();
            this.LIZJ = LIZ5;
            Bundle bundle3 = new Bundle();
            bundle3.putParcelable("sparkContext", this.LIZIZ);
            LIZ5.setArguments(bundle3);
            LIZ4.LIZ(2131364575, LIZ5, "popup");
            LIZ4.LIZJ();
            hxE.setOnClickListener(C2786KyP.LIZ);
            n.LIZ(findViewById, "");
            this.LJIIIIZZ = hxE;
            View findViewById2 = LIZ3.findViewById(2131368699);
            n.LIZ(findViewById2, "");
            this.LJIIIZ = findViewById2;
            C1627Kfi kfi2 = this.LIZ;
            if (kfi2 == null) {
                n.LIZ("");
            }
            int height = LIZ3.getHeight();
            if (kfi2.getVariableHeight() <= height && (kfi2.getDragHeight() <= height || !kfi2.getDragByGesture() || !kfi2.getEnablePullDownClose() || !n.LIZ(kfi2.getRealTransitionAnimation(getContext()), "bottom") || !n.LIZ(kfi2.getRealGravity(getContext()), "bottom"))) {
                z = false;
            } else {
                z = true;
            }
            C4221LgS lgS = (C4221LgS) LIZ3.findViewById(2131370262);
            this.LJ = lgS;
            if (lgS != null) {
                if (z) {
                    i = 0;
                } else {
                    i = 8;
                }
                lgS.setVisibility(i);
            }
            HxE hxE2 = this.LJIIIIZZ;
            if (hxE2 == null) {
                n.LIZ("");
            }
            05s layoutParams = hxE2.getLayoutParams();
            if (layoutParams instanceof 05s) {
                BottomSheetBehavior<HxE> bottomSheetBehavior = layoutParams.LIZ;
                if (bottomSheetBehavior instanceof BottomSheetBehavior) {
                    BottomSheetBehavior<HxE> bottomSheetBehavior2 = (BottomSheetBehavior) bottomSheetBehavior;
                    bottomSheetBehavior2.LIZIZ(true);
                    C2753Kxs kxs = new C2753Kxs(z, this, layoutInflater2, viewGroup2, bundle2);
                    if (!bottomSheetBehavior2.LJJIIZI.contains(kxs)) {
                        bottomSheetBehavior2.LJJIIZI.add(kxs);
                    }
                    n.LIZ(bottomSheetBehavior2, "");
                    this.LIZLLL = bottomSheetBehavior2;
                    this.LJIILIIL.LIZ = JJu.NONE;
                    BottomSheetBehavior<HxE> bottomSheetBehavior3 = this.LIZLLL;
                    if (bottomSheetBehavior3 == null) {
                        n.LIZ("");
                    }
                    bottomSheetBehavior3.LJJIJIIJIL = this.LJIILIIL;
                    BottomSheetBehavior<HxE> bottomSheetBehavior4 = this.LIZLLL;
                    if (bottomSheetBehavior4 == null) {
                        n.LIZ("");
                    }
                    bottomSheetBehavior4.LIZ(false);
                    BottomSheetBehavior<HxE> bottomSheetBehavior5 = this.LIZLLL;
                    if (bottomSheetBehavior5 == null) {
                        n.LIZ("");
                    }
                    C1627Kfi kfi3 = this.LIZ;
                    if (kfi3 == null) {
                        n.LIZ("");
                    }
                    bottomSheetBehavior5.LIZIZ(kfi3.getEnablePullDownClose());
                    BottomSheetBehavior<HxE> bottomSheetBehavior6 = this.LIZLLL;
                    if (bottomSheetBehavior6 == null) {
                        n.LIZ("");
                    }
                    C1627Kfi kfi4 = this.LIZ;
                    if (kfi4 == null) {
                        n.LIZ("");
                    }
                    bottomSheetBehavior6.LJIILLIIL = kfi4.getDragByGesture();
                    BottomSheetBehavior<HxE> bottomSheetBehavior7 = this.LIZLLL;
                    if (bottomSheetBehavior7 == null) {
                        n.LIZ("");
                    }
                    C1627Kfi kfi5 = this.LIZ;
                    if (kfi5 == null) {
                        n.LIZ("");
                    }
                    int minMarginTop = kfi5.getMinMarginTop();
                    if (minMarginTop >= 0) {
                        bottomSheetBehavior7.LJIIIIZZ = minMarginTop;
                        C2755Kxu kxu = LJII;
                        1hK activity = getActivity();
                        C1627Kfi kfi6 = this.LIZ;
                        if (kfi6 == null) {
                            n.LIZ("");
                        }
                        int LIZ6 = kxu.LIZ(activity, kfi6);
                        if (LIZ6 <= 0) {
                            BottomSheetBehavior<HxE> bottomSheetBehavior8 = this.LIZLLL;
                            if (bottomSheetBehavior8 == null) {
                                n.LIZ("");
                            }
                            bottomSheetBehavior8.LJIJ = C1663KgI.LIZ();
                            BottomSheetBehavior<HxE> bottomSheetBehavior9 = this.LIZLLL;
                            if (bottomSheetBehavior9 == null) {
                                n.LIZ("");
                            }
                            bottomSheetBehavior9.LIZ(C1663KgI.LIZ() - 1);
                            BottomSheetBehavior<HxE> bottomSheetBehavior10 = this.LIZLLL;
                            if (bottomSheetBehavior10 == null) {
                                n.LIZ("");
                            }
                            bottomSheetBehavior10.LJIILL = true;
                            BottomSheetBehavior<HxE> bottomSheetBehavior11 = this.LIZLLL;
                            if (bottomSheetBehavior11 == null) {
                                n.LIZ("");
                            }
                            bottomSheetBehavior11.LIZIZ(3);
                        } else {
                            C1627Kfi kfi7 = this.LIZ;
                            if (kfi7 == null) {
                                n.LIZ("");
                            }
                            if (kfi7.getDragByGesture()) {
                                C1627Kfi kfi8 = this.LIZ;
                                if (kfi8 == null) {
                                    n.LIZ("");
                                }
                                if (LIZ6 < kfi8.getDragHeight()) {
                                    BottomSheetBehavior<HxE> bottomSheetBehavior12 = this.LIZLLL;
                                    if (bottomSheetBehavior12 == null) {
                                        n.LIZ("");
                                    }
                                    bottomSheetBehavior12.LIZ(Qx3.LIZLLL(LIZ6, C1663KgI.LIZ()));
                                    BottomSheetBehavior<HxE> bottomSheetBehavior13 = this.LIZLLL;
                                    if (bottomSheetBehavior13 == null) {
                                        n.LIZ("");
                                    }
                                    C1627Kfi kfi9 = this.LIZ;
                                    if (kfi9 == null) {
                                        n.LIZ("");
                                    }
                                    bottomSheetBehavior13.LJIJ = kfi9.getDragHeight();
                                    BottomSheetBehavior<HxE> bottomSheetBehavior14 = this.LIZLLL;
                                    if (bottomSheetBehavior14 == null) {
                                        n.LIZ("");
                                    }
                                    C1627Kfi kfi10 = this.LIZ;
                                    if (kfi10 == null) {
                                        n.LIZ("");
                                    }
                                    bottomSheetBehavior14.LJIJI = kfi10.getDragUpThreshold();
                                    BottomSheetBehavior<HxE> bottomSheetBehavior15 = this.LIZLLL;
                                    if (bottomSheetBehavior15 == null) {
                                        n.LIZ("");
                                    }
                                    C1627Kfi kfi11 = this.LIZ;
                                    if (kfi11 == null) {
                                        n.LIZ("");
                                    }
                                    bottomSheetBehavior15.LJIJJ = kfi11.getDragDownThreshold();
                                    BottomSheetBehavior<HxE> bottomSheetBehavior16 = this.LIZLLL;
                                    if (bottomSheetBehavior16 == null) {
                                        n.LIZ("");
                                    }
                                    C1627Kfi kfi12 = this.LIZ;
                                    if (kfi12 == null) {
                                        n.LIZ("");
                                    }
                                    bottomSheetBehavior16.LJIL = kfi12.getDragDownCloseThreshold();
                                    BottomSheetBehavior<HxE> bottomSheetBehavior17 = this.LIZLLL;
                                    if (bottomSheetBehavior17 == null) {
                                        n.LIZ("");
                                    }
                                    C1627Kfi kfi13 = this.LIZ;
                                    if (kfi13 == null) {
                                        n.LIZ("");
                                    }
                                    bottomSheetBehavior17.LJIJJLI = kfi13.getPeekDownCloseThreshold();
                                    BottomSheetBehavior<HxE> bottomSheetBehavior18 = this.LIZLLL;
                                    if (bottomSheetBehavior18 == null) {
                                        n.LIZ("");
                                    }
                                    bottomSheetBehavior18.LIZIZ(4);
                                    BottomSheetBehavior<HxE> bottomSheetBehavior19 = this.LIZLLL;
                                    if (bottomSheetBehavior19 == null) {
                                        n.LIZ("");
                                    }
                                    C1627Kfi kfi14 = this.LIZ;
                                    if (kfi14 == null) {
                                        n.LIZ("");
                                    }
                                    bottomSheetBehavior19.LJIILL = !kfi14.getDragBack();
                                }
                            }
                            BottomSheetBehavior<HxE> bottomSheetBehavior20 = this.LIZLLL;
                            if (bottomSheetBehavior20 == null) {
                                n.LIZ("");
                            }
                            bottomSheetBehavior20.LJIJ = LIZ6;
                            BottomSheetBehavior<HxE> bottomSheetBehavior21 = this.LIZLLL;
                            if (bottomSheetBehavior21 == null) {
                                n.LIZ("");
                            }
                            bottomSheetBehavior21.LIZ(LIZ6 - 1);
                            BottomSheetBehavior<HxE> bottomSheetBehavior22 = this.LIZLLL;
                            if (bottomSheetBehavior22 == null) {
                                n.LIZ("");
                            }
                            bottomSheetBehavior22.LJIILL = false;
                            BottomSheetBehavior<HxE> bottomSheetBehavior23 = this.LIZLLL;
                            if (bottomSheetBehavior23 == null) {
                                n.LIZ("");
                            }
                            bottomSheetBehavior23.LIZIZ(3);
                            BottomSheetBehavior<HxE> bottomSheetBehavior24 = this.LIZLLL;
                            if (bottomSheetBehavior24 == null) {
                                n.LIZ("");
                            }
                            if (bottomSheetBehavior24.LJIILJJIL) {
                                BottomSheetBehavior<HxE> bottomSheetBehavior25 = this.LIZLLL;
                                if (bottomSheetBehavior25 == null) {
                                    n.LIZ("");
                                }
                                bottomSheetBehavior25.LJIILLIIL = true;
                            }
                        }
                        1gt findViewById3 = LIZ3.findViewById(2131368701);
                        n.LIZ(findViewById3, "");
                        this.LJIIJ = findViewById3;
                        C1627Kfi kfi15 = this.LIZ;
                        if (kfi15 == null) {
                            n.LIZ("");
                        }
                        HxE hxE3 = this.LJIIIIZZ;
                        if (hxE3 == null) {
                            n.LIZ("");
                        }
                        JJo jJo = new JJo(kfi15, hxE3, this.LJIILIIL);
                        this.LJIIL = jJo;
                        jJo.LIZ(C2773KyC.LIZ);
                        this.LJI.LIZ(this, layoutInflater2, viewGroup2, bundle2);
                        return LIZ3;
                    }
                    throw new IllegalArgumentException("minMarginTop must be greater than or equal to 0");
                }
                throw new IllegalArgumentException("The view is not associated with BottomSheetBehavior");
            }
            throw new IllegalArgumentException("The view is not a child of CoordinatorLayout");
        }
        View LIZ7 = 0HH.LIZ(layoutInflater2, 2131561364, viewGroup2, false);
        HxE findViewById4 = LIZ7.findViewById(2131368700);
        HxE hxE4 = findViewById4;
        0AP LIZ8 = getChildFragmentManager().LIZ();
        SparkFragment LIZ9 = LIZ();
        this.LIZJ = LIZ9;
        Bundle bundle4 = new Bundle();
        bundle4.putParcelable("sparkContext", this.LIZIZ);
        LIZ9.setArguments(bundle4);
        LIZ8.LIZ(2131368700, LIZ9, "popup");
        LIZ8.LIZJ();
        hxE4.setOnClickListener(C2787KyQ.LIZ);
        n.LIZ(findViewById4, "");
        this.LJIIIIZZ = hxE4;
        View findViewById5 = LIZ7.findViewById(2131368699);
        n.LIZ(findViewById5, "");
        this.LJIIIZ = findViewById5;
        List<C1713Kh6> list2 = this.LJIIJJI;
        C1627Kfi kfi16 = this.LIZ;
        if (kfi16 == null) {
            n.LIZ("");
        }
        HxE hxE5 = this.LJIIIIZZ;
        if (hxE5 == null) {
            n.LIZ("");
        }
        list2.add(new C2759Kxy(kfi16, hxE5));
        C1627Kfi kfi17 = this.LIZ;
        if (kfi17 == null) {
            n.LIZ("");
        }
        HxE hxE6 = this.LJIIIIZZ;
        if (hxE6 == null) {
            n.LIZ("");
        }
        JJo jJo2 = new JJo(kfi17, hxE6, this.LJIILIIL);
        this.LJIIL = jJo2;
        jJo2.LIZ(C2774KyD.LIZ);
        this.LJI.LIZ(this, layoutInflater2, viewGroup2, bundle2);
        return LIZ7;
    }
}
