var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/components/pisellModal/components/PcModal/index.tsx
var PcModal_exports = {};
__export(PcModal_exports, {
  default: () => PcModal_default
});
module.exports = __toCommonJS(PcModal_exports);
var import_react = __toESM(require("react"));
var import_antd = require("antd");
var import_classnames = __toESM(require("classnames"));
var import_utils = require("@pisell/utils");
var import_XClose = __toESM(require("@pisell/icon/es/XClose"));
var import_Delete_wght300_24px = __toESM(require("@pisell/icon/src/Delete_wght300_24px"));
var import_modal = __toESM(require("../../../modal"));
var import_constants = require("../../constants");
var import_index = require("./index.less");
var PcModal = (props) => {
  const {
    wrapClassName,
    okButtonProps,
    cancelButtonProps,
    width: propsWidth,
    size = "middle",
    closeIcon: propsCloseIcon,
    headerDivider,
    footerDivider,
    title,
    centered = true,
    deleteButtonProps,
    onDelete,
    cancelVisible = true,
    okVisible = true,
    actions,
    footer,
    header
  } = props;
  const width = (0, import_react.useMemo)(() => {
    return propsWidth || import_constants.sizeMap[size];
  }, [propsWidth, size]);
  const closeIcon = (0, import_react.useMemo)(() => {
    if ((0, import_utils.isUndefined)(propsCloseIcon)) {
      return /* @__PURE__ */ import_react.default.createElement(import_XClose.default, { style: { fontSize: 20 } });
    }
  }, [propsCloseIcon]);
  const deleteBtn = (0, import_react.useMemo)(() => {
    if (!deleteButtonProps) {
      return null;
    }
    return /* @__PURE__ */ import_react.default.createElement("span", { style: { flexShrink: 0 } }, /* @__PURE__ */ import_react.default.createElement(
      import_antd.Button,
      {
        icon: /* @__PURE__ */ import_react.default.createElement(import_Delete_wght300_24px.default, { style: { fontSize: 20 } }),
        size: "large",
        ...deleteButtonProps,
        onClick: (e) => {
          var _a;
          (_a = deleteButtonProps == null ? void 0 : deleteButtonProps.onClick) == null ? void 0 : _a.call(deleteButtonProps, e);
          onDelete == null ? void 0 : onDelete();
        }
      }
    ));
  }, [deleteButtonProps]);
  const isHideFooter = (0, import_react.useMemo)(() => {
    return (0, import_utils.isBoolean)(footer) && !footer || footer === null;
  }, [footer]);
  const isHideHeader = (0, import_react.useMemo)(() => {
    return (0, import_utils.isBoolean)(header) && !header || header === null;
  }, [header]);
  const renderFooter = (_, { OkBtn, CancelBtn }) => {
    if (footer) {
      return footer;
    }
    if ([deleteBtn, actions, cancelVisible, okVisible].every((item) => !item)) {
      return null;
    }
    return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, deleteBtn, actions, cancelVisible && /* @__PURE__ */ import_react.default.createElement(CancelBtn, null), okVisible && /* @__PURE__ */ import_react.default.createElement(OkBtn, null));
  };
  return /* @__PURE__ */ import_react.default.createElement(
    import_modal.default,
    {
      keyboard: false,
      ...props,
      centered,
      title: title || /* @__PURE__ */ import_react.default.createElement("div", { style: { height: 24 } }),
      width,
      wrapClassName: (0, import_classnames.default)("pisell-pc-modal", {
        [wrapClassName]: wrapClassName
      }),
      closeIcon,
      footer: isHideFooter ? null : renderFooter,
      okButtonProps: {
        block: true,
        size: "large",
        style: {
          margin: 0
        },
        ...okButtonProps || {}
      },
      cancelButtonProps: {
        block: true,
        size: "large",
        ...cancelButtonProps || {}
      },
      styles: {
        header: {
          borderBottom: headerDivider ? "1px solid var(--Gray-200, #EAECF0)" : "none",
          display: isHideHeader ? "none" : "block"
        },
        footer: {
          borderTop: footerDivider ? "1px solid var(--Gray-200, #EAECF0)" : "none"
        }
      }
    }
  );
};
var PcModal_default = PcModal;
