"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, "MemorizedAssetsDetail", {
    enumerable: true,
    get: function() {
        return MemorizedAssetsDetail;
    }
});
const _jsxruntime = require("react/jsx-runtime");
const _react = require("react");
const _text = require("../../../text");
const _hooks = require("@orderly.network/hooks");
const _provider = require("../../../provider");
const _modal = require("../../../modal");
const _withdraw = require("../../../block/withdraw");
const _freeCollat = require("../../../block/orderEntry/sections/freeCollat");
const AssetsDetail = ()=>{
    const { freeCollateral } = (0, _hooks.useCollateral)({
        dp: 2
    });
    const [{ aggregated }] = (0, _hooks.usePositionStream)();
    const { onSettle } = (0, _react.useContext)(_provider.AssetsContext);
    const onSettleClick = (0, _react.useCallback)(()=>{
        _modal.modal.confirm({
            title: "Settle PnL",
            content: /*#__PURE__*/ (0, _jsxruntime.jsx)(_withdraw.SettlePnlContent, {}),
            maxWidth: "xs",
            onCancel () {
                return Promise.reject("cancel");
            },
            onOk () {
                return onSettle().catch((e)=>{});
            }
        }).then(()=>{}, (error)=>{});
    }, []);
    return /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
        className: "orderly-text-xs orderly-pb-4 orderly-mb-4 orderly-border-b orderly-border-divider orderly-space-y-2 orderly-tabular-nums",
        children: /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
            className: "orderly-flex orderly-justify-between orderly-text-base-contrast-54",
            children: [
                /*#__PURE__*/ (0, _jsxruntime.jsx)(_freeCollat.DesktopFreeCollat, {
                    title: "Free collateral",
                    className: "orderly-text-xs"
                }),
                /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
                    className: "orderly-flex orderly-justify-end orderly-gap-1",
                    children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_text.Numeral, {
                        surfix: /*#__PURE__*/ (0, _jsxruntime.jsx)("span", {
                            className: "orderly-text-base-contrast-36",
                            children: "USDC"
                        }),
                        children: freeCollateral
                    })
                })
            ]
        })
    });
};
const MemorizedAssetsDetail = /*#__PURE__*/ (0, _react.memo)(AssetsDetail);

//# sourceMappingURL=assetsDetail.js.map