"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, "ChainDialog", {
    enumerable: true,
    get: function() {
        return ChainDialog;
    }
});
const _jsxruntime = require("react/jsx-runtime");
const _modalHelper = require("../../../modal/modalHelper");
const _chainListView = require("./chainListView");
const _modal = require("../../../modal");
const _dialog = require("../../../dialog/dialog");
const ChainDialog = (0, _modalHelper.create)((props)=>{
    const { visible, onOpenChange, hide, resolve } = (0, _modal.useModal)();
    const { onItemClick, ...rest } = props;
    const _onItemClick = async (value)=>{
        const result = onItemClick?.(value) || value;
        resolve(result);
        hide();
    };
    const _onOpenChange = (open)=>{
        if (!open) {
            resolve("cancel");
        }
        onOpenChange(open);
    };
    return /*#__PURE__*/ (0, _jsxruntime.jsx)(_dialog.Dialog, {
        open: visible,
        onOpenChange: _onOpenChange,
        children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_dialog.DialogContent, {
            onOpenAutoFocus: (event)=>event.preventDefault(),
            closable: true,
            children: [
                /*#__PURE__*/ (0, _jsxruntime.jsx)(_dialog.DialogHeader, {
                    children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_dialog.DialogTitle, {
                        className: "orderly-switch-network-dialog-title",
                        children: "Switch network"
                    })
                }),
                /*#__PURE__*/ (0, _jsxruntime.jsx)(_dialog.DialogBody, {
                    className: "orderly-max-h-[335.5px] orderly-overflow-y-auto",
                    children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_chainListView.ChainListView, {
                        ...rest,
                        onItemClick: _onItemClick
                    })
                })
            ]
        })
    });
});

//# sourceMappingURL=chainDialog.js.map