"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, "EstInfo", {
    enumerable: true,
    get: function() {
        return EstInfo;
    }
});
const _jsxruntime = require("react/jsx-runtime");
const _icons = require("../../../icon/icons");
const _numeral = require("../../../text/numeral");
const _hooks = require("@orderly.network/hooks");
const _types = require("@orderly.network/types");
const _react = require("react");
const EstInfo = ({ estLeverage, estLiqPrice, precision })=>{
    const { currentLeverage } = (0, _hooks.useMarginRatio)();
    const { state } = (0, _hooks.useAccount)();
    const leverageElement = (0, _react.useMemo)(()=>{
        if (state.status < _types.AccountStatusEnum.EnableTrading) {
            return "0.00x";
        }
        if (typeof estLeverage === "undefined" || estLeverage === null) {
            return /*#__PURE__*/ (0, _jsxruntime.jsx)(_numeral.Numeral, {
                className: "orderly-text-base-contrast",
                surfix: "x",
                children: currentLeverage
            });
        }
        return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
            children: [
                /*#__PURE__*/ (0, _jsxruntime.jsx)(_numeral.Numeral, {
                    className: "orderly-text-base-contrast",
                    surfix: "x",
                    children: currentLeverage
                }),
                /*#__PURE__*/ (0, _jsxruntime.jsx)(_icons.ArrowRightIcon, {
                    size: 8
                }),
                /*#__PURE__*/ (0, _jsxruntime.jsx)(_numeral.Numeral, {
                    className: "orderly-text-base-contrast",
                    surfix: "x",
                    children: Math.abs(estLeverage)
                })
            ]
        });
    }, [
        currentLeverage,
        estLeverage,
        state.status
    ]);
    return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
        children: [
            /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
                className: "orderly-flex orderly-justify-between orderly-text-base-contrast-54",
                children: [
                    /*#__PURE__*/ (0, _jsxruntime.jsx)("span", {
                        children: "Est. Liq. price"
                    }),
                    /*#__PURE__*/ (0, _jsxruntime.jsxs)("span", {
                        className: "orderly-flex orderly-gap-1",
                        children: [
                            /*#__PURE__*/ (0, _jsxruntime.jsx)("span", {
                                className: "orderly-text-base-contrast",
                                children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_numeral.Numeral, {
                                    precision: precision,
                                    children: estLiqPrice ?? "--"
                                })
                            }),
                            /*#__PURE__*/ (0, _jsxruntime.jsx)("span", {
                                children: "USDC"
                            })
                        ]
                    })
                ]
            }),
            /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
                className: "orderly-flex orderly-justify-between orderly-text-base-contrast-54",
                children: [
                    /*#__PURE__*/ (0, _jsxruntime.jsx)("span", {
                        children: "Account leverage"
                    }),
                    /*#__PURE__*/ (0, _jsxruntime.jsx)("span", {
                        className: "orderly-flex orderly-items-center orderly-gap-1",
                        children: leverageElement
                    })
                ]
            })
        ]
    });
};

//# sourceMappingURL=setInfo.js.map