import { createRequire as _createRequire } from 'node:module';
const require = _createRequire(import.meta.url);
import {
  createDependenciesService
} from "./chunk-WHDJD2R3.js";
import "./chunk-4EUYO6LF.js";
import {
  useProjectModel
} from "./chunk-4HM4GXIT.js";
import {
  useVeloClient
} from "./chunk-MK2ZHK32.js";
import "./chunk-526J7NQD.js";
import "./chunk-XCIXZDFH.js";
import "./chunk-QRGKMYDD.js";
import "./chunk-HEKVXBWZ.js";
import "./chunk-K72QYUHN.js";
import "./chunk-WSX7GEXO.js";
import "./chunk-MHV22UIU.js";
import "./chunk-IBOXARGJ.js";
import "./chunk-JJWBWHWO.js";
import "./chunk-YTGCPERW.js";
import "./chunk-VZ3FZHJK.js";
import "./chunk-OWRWPLVG.js";
import {
  Trans
} from "./chunk-CIOBCAOI.js";
import "./chunk-RPTAJN5Y.js";
import {
  Alert,
  Badge,
  Spinner,
  Text,
  useAsync
} from "./chunk-2DKXIL7C.js";
import {
  require_react
} from "./chunk-7ZOEVDW3.js";
import "./chunk-AFPDHQYI.js";
import "./chunk-HYKBBZLS.js";
import "./chunk-C5RTKQVL.js";
import "./chunk-LFX6WS3B.js";
import "./chunk-XTVDTH5G.js";
import "./chunk-TMZBOD2B.js";
import "./chunk-DR2IE2NL.js";
import "./chunk-JWVFFICN.js";
import "./chunk-YRSNPU5L.js";
import {
  require_lib
} from "./chunk-PIOT47FJ.js";
import {
  __toESM,
  init_esm_shims
} from "./chunk-EXLZF52D.js";

// ../cli-site/src/components/InstallCommand/InstallCommand.tsx
init_esm_shims();
var import_react = __toESM(require_react(), 1);
var import_variant = __toESM(require_lib(), 1);
var InstallCommand = ({ packageName }) => {
  const { model } = useProjectModel();
  const veloClient = useVeloClient();
  const { status } = useAsync(async () => {
    const { projectFolder } = model;
    const service = await createDependenciesService(projectFolder, veloClient);
    await service.install(packageName);
  }, []);
  return (0, import_variant.match)(status, {
    Loading: () => /* @__PURE__ */ import_react.default.createElement(
      Spinner,
      {
        text: packageName ? /* @__PURE__ */ import_react.default.createElement(
          Trans,
          {
            i18nKey: "install_command.package.loading",
            values: { packageName },
            components: [/* @__PURE__ */ import_react.default.createElement(Text, { bold: true })]
          }
        ) : /* @__PURE__ */ import_react.default.createElement(Trans, { i18nKey: "install_command.all_packages.loading" })
      }
    ),
    Error: () => null,
    Success: () => /* @__PURE__ */ import_react.default.createElement(Alert, { type: "success" }, /* @__PURE__ */ import_react.default.createElement(Badge, { skin: "success" }, /* @__PURE__ */ import_react.default.createElement(Trans, { i18nKey: "general.success" })), " ", packageName ? /* @__PURE__ */ import_react.default.createElement(
      Trans,
      {
        i18nKey: "install_command.package.success",
        values: { packageName },
        components: [/* @__PURE__ */ import_react.default.createElement(Text, { bold: true })]
      }
    ) : /* @__PURE__ */ import_react.default.createElement(Trans, { i18nKey: "install_command.all_packages.success" }))
  });
};
export {
  InstallCommand
};
//# sourceMappingURL=InstallCommand-Y3PSBQXV.js.map