"use strict";

require("core-js/modules/es.symbol.js");
require("core-js/modules/es.array.filter.js");
require("core-js/modules/es.array.for-each.js");
require("core-js/modules/es.array.push.js");
require("core-js/modules/es.object.define-properties.js");
require("core-js/modules/es.object.define-property.js");
require("core-js/modules/es.object.get-own-property-descriptor.js");
require("core-js/modules/es.object.get-own-property-descriptors.js");
require("core-js/modules/es.object.keys.js");
require("core-js/modules/es.object.to-string.js");
require("core-js/modules/esnext.iterator.constructor.js");
require("core-js/modules/esnext.iterator.filter.js");
require("core-js/modules/esnext.iterator.for-each.js");
require("core-js/modules/web.dom-collections.for-each.js");
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.FcrConfirmDialog = void 0;
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _classnames = _interopRequireDefault(require("classnames"));
var _button = require("../button");
var _checkbox = require("../checkbox");
var _ = require(".");
require("./confirm-dialog.css");
var _jsxRuntime = require("react/jsx-runtime");
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var FcrConfirmDialog = exports.FcrConfirmDialog = function FcrConfirmDialog(props) {
  var onCancel = props.onCancel,
    visible = props.visible,
    onClose = props.onClose,
    content = props.content,
    children = props.children,
    title = props.title,
    closable = props.closable,
    footer = props.footer,
    closeIcon = props.closeIcon,
    maskClosable = props.maskClosable,
    onOk = props.onOk,
    checkable = props.checkable,
    checkedProps = props.checkedProps,
    width = props.width,
    icon = props.icon,
    okText = props.okText,
    cancelText = props.cancelText,
    afterClose = props.afterClose,
    okButtonProps = props.okButtonProps,
    cancelButtonProps = props.cancelButtonProps,
    _props$okButtonVisibl = props.okButtonVisible,
    okButtonVisible = _props$okButtonVisibl === void 0 ? true : _props$okButtonVisibl,
    _props$cancelButtonVi = props.cancelButtonVisible,
    cancelButtonVisible = _props$cancelButtonVi === void 0 ? true : _props$cancelButtonVi,
    getContainer = props.getContainer;
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_.BaseDialog, {
    wrapClassName: "fcr-confirm-dialog-wrap",
    classNames: "fcr-confirm-dialog",
    getContainer: getContainer,
    afterClose: afterClose,
    closable: closable,
    closeIcon: closeIcon,
    width: width || 415,
    maskClosable: maskClosable,
    visible: visible,
    onClose: onClose,
    children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
      className: "fcr-confirm-dialog-inner-wrap",
      children: [icon && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
        className: "fcr-confirm-dialog-inner-icon",
        children: icon
      }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
        children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
          className: (0, _classnames["default"])('fcr-confirm-dialog-title'),
          children: title
        }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
          className: (0, _classnames["default"])('fcr-confirm-dialog-inner'),
          children: content || children
        })]
      })]
    }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
      className: (0, _classnames["default"])('fcr-confirm-dialog-footer'),
      children: [checkable && /*#__PURE__*/(0, _jsxRuntime.jsx)(_checkbox.FcrCheckbox, _objectSpread({}, checkedProps)), footer || /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
        className: (0, _classnames["default"])('fcr-confirm-dialog-footer-btns'),
        children: [cancelButtonVisible && /*#__PURE__*/(0, _jsxRuntime.jsx)(_button.FcrButton, _objectSpread(_objectSpread({
          type: "gray",
          onClick: function onClick() {
            onCancel === null || onCancel === void 0 || onCancel();
            onClose === null || onClose === void 0 || onClose();
          },
          size: "S"
        }, cancelButtonProps), {}, {
          children: cancelText || 'Cancel'
        })), okButtonVisible && /*#__PURE__*/(0, _jsxRuntime.jsx)(_button.FcrButton, _objectSpread(_objectSpread({
          onClick: onOk,
          size: "S"
        }, okButtonProps), {}, {
          children: okText || 'OK'
        }))]
      })]
    })]
  });
};