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/plus/saasDevice/devicePlanning/components/DeleteWorkAreaModal/index.tsx
var DeleteWorkAreaModal_exports = {};
__export(DeleteWorkAreaModal_exports, {
  default: () => DeleteWorkAreaModal_default
});
module.exports = __toCommonJS(DeleteWorkAreaModal_exports);
var import_react = __toESM(require("react"));
var import_antd = require("antd");
var import_materials = require("@pisell/materials");
var import_constants = require("../../constants");
var import_OnlineWarningAlert = __toESM(require("../shared/OnlineWarningAlert"));
var import_index = require("./index.less");
var DeleteWorkAreaModal = ({
  open,
  loading,
  submitting,
  record,
  counts,
  translation,
  getText,
  onClose,
  onConfirm
}) => {
  const total = counts.smart + counts.dumb + counts.integrated;
  const hasDevices = total > 0;
  const workAreaName = translation(record == null ? void 0 : record.name) || "";
  return /* @__PURE__ */ import_react.default.createElement(
    import_materials.PisellModal,
    {
      open,
      title: getText("pisell2.saas.device-planning.delete.title"),
      headerDivider: false,
      onCancel: onClose,
      okVisible: !hasDevices,
      okText: getText("pisell2.saas.device-planning.delete.confirm-button"),
      cancelText: getText(
        hasDevices ? "pisell2.saas.device-planning.delete.close" : "pisell2.saas.device-planning.delete.cancel"
      ),
      okButtonProps: {
        block: true,
        size: "large",
        danger: true,
        loading: submitting,
        onClick: onConfirm
      },
      cancelButtonProps: {
        block: true,
        size: "large",
        type: "default",
        disabled: submitting
      },
      destroyOnClose: true,
      maskClosable: false,
      width: 520,
      className: "saas-device-planning-delete-modal",
      bodyStyle: { padding: "0 24px 24px" },
      footer: loading ? null : void 0
    },
    loading ? /* @__PURE__ */ import_react.default.createElement("div", { className: "saas-device-planning-delete-modal__loading" }, /* @__PURE__ */ import_react.default.createElement(import_antd.Spin, null)) : hasDevices ? /* @__PURE__ */ import_react.default.createElement("div", { className: "saas-device-planning-delete-modal__body" }, /* @__PURE__ */ import_react.default.createElement(
      import_OnlineWarningAlert.default,
      {
        message: getText("pisell2.saas.device-planning.delete.block-title"),
        description: (0, import_constants.formatToken)(
          getText("pisell2.saas.device-planning.delete.block-content"),
          { WorkAreaName: workAreaName }
        )
      }
    ), /* @__PURE__ */ import_react.default.createElement("div", { className: "saas-device-planning-delete-modal__label" }, getText("pisell2.saas.device-planning.delete.devices-label")), /* @__PURE__ */ import_react.default.createElement("div", { className: "saas-device-planning-delete-modal__counts" }, counts.smart > 0 ? /* @__PURE__ */ import_react.default.createElement(import_materials.Tag, null, (0, import_constants.formatToken)(
      getText("pisell2.saas.device-planning.delete.smart-count"),
      { N: counts.smart }
    )) : null, counts.dumb > 0 ? /* @__PURE__ */ import_react.default.createElement(import_materials.Tag, null, (0, import_constants.formatToken)(
      getText("pisell2.saas.device-planning.delete.dumb-count"),
      { N: counts.dumb }
    )) : null, counts.integrated > 0 ? /* @__PURE__ */ import_react.default.createElement(import_materials.Tag, null, (0, import_constants.formatToken)(
      getText(
        "pisell2.saas.device-planning.delete.integrated-count"
      ),
      { N: counts.integrated }
    )) : null)) : /* @__PURE__ */ import_react.default.createElement("div", { className: "saas-device-planning-delete-modal__confirm" }, (0, import_constants.formatToken)(getText("pisell2.saas.device-planning.delete.confirm"), {
      WorkAreaName: workAreaName
    }))
  );
};
var DeleteWorkAreaModal_default = DeleteWorkAreaModal;
