package com.lynx.tasm.navigator;

import X.C4514QoR;
import X.C4539Qoq;
import X.C4540Qor;
import X.C4541Qos;
import X.C4542Qot;
import X.C4546Qox;
import X.ITb;
import X.KU0;
import X.LhC;
import android.content.Context;
import android.text.TextUtils;
import com.bytedance.covode.number.Covode;
import com.lynx.jsbridge.LynxModule;
import com.lynx.react.bridge.ReadableMap;
import java.util.HashMap;

public class NavigationModule extends LynxModule {
    public static String NAME = "NavigationModule";

    @ITb
    public String getString() {
        return NAME;
    }

    static {
        Covode.recordClassIndex(46975);
    }

    @ITb
    public void goBack() {
        LhC.LIZ(new Runnable() {
            static {
                Covode.recordClassIndex(46979);
            }

            public final void run() {
                C4539Qoq LIZJ = C4540Qor.LIZ.LIZJ();
                if (LIZJ == null) {
                    return;
                }
                if (!LIZJ.LIZ.isEmpty()) {
                    LIZJ.LIZ((C4514QoR) LIZJ.LIZLLL.remove(LIZJ.LIZ.pop()));
                    return;
                }
                C4546Qox LIZ2 = LIZJ.LIZ();
                if (LIZ2 != null) {
                    LIZ2.LJIJJLI();
                }
            }
        });
    }

    public NavigationModule(Context context) {
        super(context);
    }

    @ITb
    public void registerRoute(final ReadableMap readableMap) {
        LhC.LIZ(new Runnable() {
            static {
                Covode.recordClassIndex(46976);
            }

            public final void run() {
                C4540Qor qor = C4540Qor.LIZ;
                ReadableMap readableMap = readableMap;
                C4539Qoq LIZJ = qor.LIZJ();
                if (LIZJ != null) {
                    LIZJ.LIZJ = readableMap.toHashMap();
                }
            }
        });
    }

    public NavigationModule(Context context, Object obj) {
        super(context, obj);
    }

    @ITb
    public void navigateTo(final String str, final ReadableMap readableMap) {
        LhC.LIZ(new Runnable() {
            static {
                Covode.recordClassIndex(46977);
            }

            public final void run() {
                C4539Qoq LIZJ2;
                HashMap hashMap = new HashMap();
                ReadableMap readableMap = readableMap;
                if (readableMap != null) {
                    hashMap = readableMap.toHashMap();
                }
                C4540Qor qor = C4540Qor.LIZ;
                String str = str;
                if (TextUtils.isEmpty(str)) {
                    return;
                }
                if ((qor.LIZIZ == null || !qor.LIZIZ.LIZ()) && (LIZJ2 = qor.LIZJ()) != null) {
                    KU0 ku0 = new KU0(LIZJ2.LIZ(str), hashMap);
                    LIZJ2.LIZ(ku0, new C4541Qos(LIZJ2, ku0, str));
                }
            }
        });
    }

    @ITb
    public void replace(final String str, final ReadableMap readableMap) {
        LhC.LIZ(new Runnable() {
            static {
                Covode.recordClassIndex(46978);
            }

            public final void run() {
                C4539Qoq LIZJ2;
                HashMap hashMap = new HashMap();
                ReadableMap readableMap = readableMap;
                if (readableMap != null) {
                    hashMap = readableMap.toHashMap();
                }
                C4540Qor qor = C4540Qor.LIZ;
                String str = str;
                if (!TextUtils.isEmpty(str) && (LIZJ2 = qor.LIZJ()) != null) {
                    KU0 ku0 = new KU0(LIZJ2.LIZ(str), hashMap);
                    LIZJ2.LIZ(ku0, new C4542Qot(LIZJ2, ku0, str));
                }
            }
        });
    }
}
