"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _react = _interopRequireDefault(require("react"));

var _dynamic = _interopRequireDefault(require("next/dynamic"));

var _reactstrap = require("reactstrap");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

const FileRobotImageEditor = (0, _dynamic.default)(() => Promise.resolve().then(() => _interopRequireWildcard(require("react-filerobot-image-editor"))).then(mod => mod), {
  ssr: false
});

const FileRobotEditor = ({
  changeEditImage,
  show,
  setShow,
  editImage = ""
}) => {
  let modalClass = "modal";

  if (show) {
    modalClass += " show d-block";
  }

  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, show && !!editImage && /*#__PURE__*/_react.default.createElement(_reactstrap.Modal, {
    isOpen: show,
    size: "lg",
    style: {
      width: 700
    }
  }, /*#__PURE__*/_react.default.createElement(_reactstrap.ModalBody, {
    style: {
      width: '100%'
    }
  }, /*#__PURE__*/_react.default.createElement("div", {
    style: {
      height: 500
    }
  }, /*#__PURE__*/_react.default.createElement(FileRobotImageEditor, {
    source: editImage,
    closeAfterSave: true,
    defaultSavedImageName: 'uploadedImage',
    avoidChangesNotSavedAlertOnLeave: true,
    onSave: (editedImageObject, designState) => {
      console.log(editedImageObject, designState);
      changeEditImage(editedImageObject, designState);
    },
    onClose: () => setShow(false),
    Crop: {
      ratio: 'custom'
    },
    onBeforeSave: () => false,
    tabsIds: ['Adjust', 'Resize', 'Annotate', 'Watermark', 'Finetune', 'Filters'] // or {['Adjust', 'Annotate', 'Watermark']}
    ,
    defaultTabId: 'Adjust' // or 'Annotate'
    ,
    defaultToolId: 'Crop' // or 'Text'

  })))));
};

var _default = FileRobotEditor;
exports.default = _default;
{
  /* <div id="form-builder-file-robort-editor" className={`${modalClass} FileRobotEditor `}>
                     <div className="modal-dialog modal-lg ">
                         <div className="modal-content border border-light p-3 mb-4">
                             <div style={{ height: 500 }}>
                                 <FileRobotImageEditor
                                     source={editImage}
                                     closeAfterSave={true}
                                     defaultSavedImageName={'uploadedImage'}
                                     avoidChangesNotSavedAlertOnLeave={true}
                                     onSave={(editedImageObject, designState) => {
                                         console.log(editedImageObject, designState)
                                         changeEditImage(editedImageObject, designState)
                                     }}
                                     onClose={() => setShow(false)}
                                     Crop={{ ratio: 'custom' }}
                                     onBeforeSave={() => false}
                                     tabsIds={['Adjust', 'Resize', 'Annotate', 'Watermark', 'Finetune',
                                         'Filters']} // or {['Adjust', 'Annotate', 'Watermark']}
                                     defaultTabId={'Adjust'} // or 'Annotate'
                                     defaultToolId={'Crop'} // or 'Text'
                                  />
                             </div>
                         </div>
                     </div>
                 </div> */
}