import { jsx, jsxs } from "react/jsx-runtime";
import { useState } from "react";
import { Modal, Radio } from "antd";
import { useTranslation } from "react-i18next";
import { useStyles } from "../../style.mjs";
import { PluginNpmForm } from "../form/PluginNpmForm.mjs";
import { PluginUploadForm } from "../form/PluginUploadForm.mjs";
import { PluginUrlForm } from "../form/PluginUrlForm.mjs";
const PluginUpgradeModal = (param)=>{
    let { onClose, isShow, pluginData } = param;
    const { t } = useTranslation();
    const { theme } = useStyles();
    const [type, setType] = useState('npm');
    return /*#__PURE__*/ jsxs(Modal, {
        onCancel: ()=>onClose(),
        footer: null,
        destroyOnClose: true,
        title: t('Update plugin'),
        width: 580,
        open: isShow,
        children: [
            /*#__PURE__*/ jsx("div", {
                style: {
                    marginTop: theme.marginLG,
                    marginBottom: theme.marginLG
                },
                children: /*#__PURE__*/ jsxs(Radio.Group, {
                    optionType: "button",
                    defaultValue: type,
                    onChange: (e)=>setType(e.target.value),
                    children: [
                        /*#__PURE__*/ jsx(Radio, {
                            value: "npm",
                            children: t('Npm package')
                        }),
                        /*#__PURE__*/ jsx(Radio, {
                            value: "upload",
                            children: t('Upload plugin')
                        }),
                        /*#__PURE__*/ jsx(Radio, {
                            value: "url",
                            children: t('Compressed file url')
                        })
                    ]
                })
            }),
            'npm' === type && /*#__PURE__*/ jsx(PluginNpmForm, {
                isUpgrade: true,
                onClose: onClose,
                pluginData: pluginData
            }),
            'upload' === type && /*#__PURE__*/ jsx(PluginUploadForm, {
                isUpgrade: true,
                onClose: onClose,
                pluginData: pluginData
            }),
            'url' === type && /*#__PURE__*/ jsx(PluginUrlForm, {
                isUpgrade: true,
                onClose: onClose,
                pluginData: pluginData
            })
        ]
    });
};
export { PluginUpgradeModal };
