import { jsxs, jsx } from "react/jsx-runtime";
import { useMemo } from "react";
import { Button } from "../Button/index.js";
/* empty css                   */
import Dialog from "../../node_modules/@mui/material/Dialog/Dialog.js";
import CloseIcon from "../../node_modules/@mui/icons-material/esm/Close.js";
import DialogContent from "../../node_modules/@mui/material/DialogContent/DialogContent.js";
import DialogTitle from "../../node_modules/@mui/material/DialogTitle/DialogTitle.js";
import DialogContentText from "../../node_modules/@mui/material/DialogContentText/DialogContentText.js";
import DialogActions from "../../node_modules/@mui/material/DialogActions/DialogActions.js";
function getVariantClassName(variant) {
  switch (variant) {
    case "error":
      return "ia-prompt-error";
    case "success":
      return "ia-prompt-success";
    case "warning":
      return "ia-prompt-warning";
    case "info":
    default:
      return "ia-prompt-info";
  }
}
function Prompt({
  variant = "info",
  title,
  children,
  primaryButtonLabel,
  secondaryButtonLabel,
  isOpen,
  onPrimaryButtonClick,
  onSecondaryButtonClick,
  handleClose,
  primaryButtonProps,
  secondaryButtonProps,
  ...args
}) {
  const variantClassName = useMemo(() => getVariantClassName(variant), [variant]);
  return /* @__PURE__ */ jsxs(
    Dialog,
    {
      "aria-describedby": "alert-dialog-description",
      "aria-labelledby": "alert-dialog-title",
      className: `ia-styles ia-prompt ${variantClassName}`,
      open: isOpen,
      onClose: handleClose,
      ...args,
      children: [
        handleClose && /* @__PURE__ */ jsx(
          "div",
          {
            "aria-label": "Close",
            className: "ia-prompt-close-button",
            role: "button",
            tabIndex: 0,
            onClick: handleClose,
            onKeyDown: (e) => {
              if (e.key === "Enter" || e.key === " ") handleClose();
            },
            children: /* @__PURE__ */ jsx(CloseIcon, { className: "ia-prompt-close-icon" })
          }
        ),
        /* @__PURE__ */ jsxs(DialogContent, { children: [
          /* @__PURE__ */ jsx("div", { className: `ia-prompt-info-icon-container ${variantClassName}` }),
          /* @__PURE__ */ jsx(DialogTitle, { className: `ia-dialog-title ${variantClassName}`, id: "alert-dialog-title", children: title }),
          /* @__PURE__ */ jsx(DialogContentText, { className: "ia-dialog-content", id: "alert-dialog-description", children })
        ] }),
        /* @__PURE__ */ jsxs(DialogActions, { children: [
          secondaryButtonLabel ? /* @__PURE__ */ jsx(Button, { variant: "text", onClick: onSecondaryButtonClick, ...secondaryButtonProps, children: secondaryButtonLabel }) : null,
          primaryButtonLabel && variant !== "success" ? /* @__PURE__ */ jsx(
            Button,
            {
              autoFocus: true,
              type: variant === "error" ? "destructive" : "default",
              onClick: onPrimaryButtonClick,
              ...primaryButtonProps,
              children: primaryButtonLabel
            }
          ) : null
        ] })
      ]
    }
  );
}
Prompt.displayName = "Prompt";
export {
  Prompt
};
