"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = exports.ModalHeader = exports.ModalBody = exports.ModalActions = void 0;

var _base = _interopRequireDefault(require("@emotion/styled/base"));

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

var _MenuIcon = _interopRequireDefault(require("../icons/MenuIcon"));

var _Overlay = _interopRequireDefault(require("../layout/Overlay"));

var _jsxRuntime = require("@emotion/react/jsx-runtime");

var _excluded = ["children", "onClose"],
    _excluded2 = ["isOpen", "onClose", "children"];

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

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }

function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }

function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }

var _ref2 = process.env.NODE_ENV === "production" ? {
  name: "1djcb6b",
  styles: "--tw-backdrop-blur:blur(8px);backdrop-filter:var(--tw-backdrop-filter);position:sticky;padding-left:1.25rem;padding-right:1.25rem;padding-top:1.25rem;padding-bottom:1.25rem;left:0px;right:0px;top:0px;margin-left:-1.25rem;margin-right:-1.25rem;margin-top:-1.25rem;z-index:10"
} : {
  name: "111q5y4-ModalHeader",
  styles: "--tw-backdrop-blur:blur(8px);backdrop-filter:var(--tw-backdrop-filter);position:sticky;padding-left:1.25rem;padding-right:1.25rem;padding-top:1.25rem;padding-bottom:1.25rem;left:0px;right:0px;top:0px;margin-left:-1.25rem;margin-right:-1.25rem;margin-top:-1.25rem;z-index:10;label:ModalHeader;",
  toString: _EMOTION_STRINGIFIED_CSS_ERROR__
};

var _ref3 = process.env.NODE_ENV === "production" ? {
  name: "1eoy87d",
  styles: "display:flex;justify-content:space-between"
} : {
  name: "1sbzri0-ModalHeader",
  styles: "display:flex;justify-content:space-between;label:ModalHeader;",
  toString: _EMOTION_STRINGIFIED_CSS_ERROR__
};

var _ref4 = process.env.NODE_ENV === "production" ? {
  name: "1f87p0t",
  styles: "height:1rem"
} : {
  name: "1dynx07-ModalHeader",
  styles: "height:1rem;label:ModalHeader;",
  toString: _EMOTION_STRINGIFIED_CSS_ERROR__
};

var ModalHeader = function ModalHeader(_ref) {
  var children = _ref.children,
      onClose = _ref.onClose,
      restProps = _objectWithoutProperties(_ref, _excluded);

  return (0, _jsxRuntime.jsx)("div", _objectSpread(_objectSpread({
    css: _ref2
  }, restProps), {}, {
    children: (0, _jsxRuntime.jsxs)("div", {
      css: _ref3,
      children: [children, onClose && (0, _jsxRuntime.jsx)("button", {
        onClick: onClose,
        children: (0, _jsxRuntime.jsx)(_MenuIcon["default"], {
          css: _ref4,
          isOpen: true
        })
      })]
    })
  }));
};

exports.ModalHeader = ModalHeader;
var ModalBody = (0, _base["default"])("div", process.env.NODE_ENV === "production" ? {
  target: "e1mhxobz1"
} : {
  target: "e1mhxobz1",
  label: "ModalBody"
})(process.env.NODE_ENV === "production" ? {
  name: "1qnmu7n",
  styles: "padding-top:1.25rem"
} : {
  name: "1qnmu7n",
  styles: "padding-top:1.25rem",
  map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9tb2RhbC9Nb2RhbC50c3giXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBNEJ5QiIsImZpbGUiOiIuLi8uLi9zcmMvbW9kYWwvTW9kYWwudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IFJlYWN0LCB7IEZ1bmN0aW9uQ29tcG9uZW50IH0gZnJvbSAncmVhY3QnO1xuaW1wb3J0IHR3LCB7IHN0eWxlZCB9IGZyb20gJ3R3aW4ubWFjcm8nO1xuXG5pbXBvcnQgTWVudUljb24gZnJvbSAnLi4vaWNvbnMvTWVudUljb24nO1xuaW1wb3J0IE92ZXJsYXkgZnJvbSAnLi4vbGF5b3V0L092ZXJsYXknO1xuXG50eXBlIE1vZGFsUHJvcHMgPSB7XG4gIGlzT3Blbj86IGJvb2xlYW47XG4gIG9uQ2xvc2U/OiAoKSA9PiB2b2lkO1xufTtcblxuZXhwb3J0IGNvbnN0IE1vZGFsSGVhZGVyOiBGdW5jdGlvbkNvbXBvbmVudDxSZWFjdC5IVE1MUHJvcHM8SFRNTERpdkVsZW1lbnQ+ICZcbiAgT21pdDxNb2RhbFByb3BzLCAnaXNPcGVuJz4+ID0gKHsgY2hpbGRyZW4sIG9uQ2xvc2UsIC4uLnJlc3RQcm9wcy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ZGl2IHR3PVwicmVsYXRpdmUgbWF4LXctc2NyZWVuLXNtIHB4LTggbWQ6cHgtMjQgZmxleCBpdGVtcy1jZW50ZXIganVzdGlmeS1jZW50ZXJcIj5cbiAgICAgICAgICAgIDxkaXZcbiAgICAgICAgICAgICAgdHc9XCJwb2ludGVyLWV2ZW50cy1hdXRvIHJvdW5kZWQtc20gc2hhZG93IG92ZXJmbG93LXktYXV0byBweC01IHBiLTUgbWF4LWgtWzkwdmhdXCJcbiAgICAgICAgICAgICAgey4uLnByb3BzfVxuICAgICAgICAgICAgPlxuICAgICAgICAgICAgICB7Y2hpbGRyZW59XG4gICAgICAgICAgICA8L2Rpdj5cbiAgICAgICAgICA8L2Rpdj5cbiAgICAgICAgPC9PdmVybGF5PlxuICAgICAgKX1cbiAgICA8Lz5cbiAgKTtcbn07XG5cbmV4cG9ydCBkZWZhdWx0IE1vZGFsO1xuIl19 */",
  toString: _EMOTION_STRINGIFIED_CSS_ERROR__
});
exports.ModalBody = ModalBody;
var ModalActions = (0, _base["default"])("div", process.env.NODE_ENV === "production" ? {
  target: "e1mhxobz0"
} : {
  target: "e1mhxobz0",
  label: "ModalActions"
})(process.env.NODE_ENV === "production" ? {
  name: "1qnmu7n",
  styles: "padding-top:1.25rem"
} : {
  name: "1qnmu7n",
  styles: "padding-top:1.25rem",
  map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9tb2RhbC9Nb2RhbC50c3giXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBNkI0QiIsImZpbGUiOiIuLi8uLi9zcmMvbW9kYWwvTW9kYWwudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IFJlYWN0LCB7IEZ1bmN0aW9uQ29tcG9uZW50IH0gZnJvbSAncmVhY3QnO1xuaW1wb3J0IHR3LCB7IHN0eWxlZCB9IGZyb20gJ3R3aW4ubWFjcm8nO1xuXG5pbX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HM+ID0gKHsgaXNPcGVuID0gZmFsc2UsIG9uQ2xvc2UsIGNoaWxkcmVuLCAuLi5wcm9wcyB9KSA9PiB7XG4gIHJldHVybiAoXG4gICAgPD5cbiAgICAgIHtpc09wZW4gJiYgKFxuICAgICAgICA8T3ZlcmxheVxuICAgICAgICAgIHR3PVwiZmxleCBpdGVtcy1jZW50ZXIganVzdGlmeS1jZW50ZXIgYmFja2Ryb3AtYmx1ci1tZFwiXG4gICAgICAgICAgaXNPcGVuPXtpc09wZW59XG4gICAgICAgID5cbiAgICAgICAgICA8ZGl2IG9uQ2xpY2s9e29uQ2xvc2V9IHR3PVwiYWJzb2x1dGUgaW5zZXQtMCB3LWZ1bGwgaC1mdWxsXCIgLz5cbiAgICAgICAgICA8ZGl2IHR3PVwicmVsYXRpdmUgbWF4LXctc2NyZWVuLXNtIHB4LTggbWQ6cHgtMjQgZmxleCBpdGVtcy1jZW50ZXIganVzdGlmeS1jZW50ZXJcIj5cbiAgICAgICAgICAgIDxkaXZcbiAgICAgICAgICAgICAgdHc9XCJwb2ludGVyLWV2ZW50cy1hdXRvIHJvdW5kZWQtc20gc2hhZG93IG92ZXJmbG93LXktYXV0byBweC01IHBiLTUgbWF4LWgtWzkwdmhdXCJcbiAgICAgICAgICAgICAgey4uLnByb3BzfVxuICAgICAgICAgICAgPlxuICAgICAgICAgICAgICB7Y2hpbGRyZW59XG4gICAgICAgICAgICA8L2Rpdj5cbiAgICAgICAgICA8L2Rpdj5cbiAgICAgICAgPC9PdmVybGF5PlxuICAgICAgKX1cbiAgICA8Lz5cbiAgKTtcbn07XG5cbmV4cG9ydCBkZWZhdWx0IE1vZGFsO1xuIl19 */",
  toString: _EMOTION_STRINGIFIED_CSS_ERROR__
});
exports.ModalActions = ModalActions;

var _ref6 = process.env.NODE_ENV === "production" ? {
  name: "1n5dtlr",
  styles: "display:flex;align-items:center;justify-content:center;--tw-backdrop-blur:blur(12px);backdrop-filter:var(--tw-backdrop-filter)"
} : {
  name: "1lg2v1y-Modal",
  styles: "display:flex;align-items:center;justify-content:center;--tw-backdrop-blur:blur(12px);backdrop-filter:var(--tw-backdrop-filter);label:Modal;",
  toString: _EMOTION_STRINGIFIED_CSS_ERROR__
};

var _ref7 = process.env.NODE_ENV === "production" ? {
  name: "153gfdi",
  styles: "position:absolute;top:0px;right:0px;bottom:0px;left:0px;width:100%;height:100%"
} : {
  name: "1ttu6f0-Modal",
  styles: "position:absolute;top:0px;right:0px;bottom:0px;left:0px;width:100%;height:100%;label:Modal;",
  toString: _EMOTION_STRINGIFIED_CSS_ERROR__
};

var _ref8 = process.env.NODE_ENV === "production" ? {
  name: "kc18p8",
  styles: "position:relative;max-width:640px;padding-left:2rem;padding-right:2rem;display:flex;align-items:center;justify-content:center;@media (min-width: 768px){padding-left:6rem;padding-right:6rem;}"
} : {
  name: "a4727n-Modal",
  styles: "position:relative;max-width:640px;padding-left:2rem;padding-right:2rem;display:flex;align-items:center;justify-content:center;@media (min-width: 768px){padding-left:6rem;padding-right:6rem;};label:Modal;",
  toString: _EMOTION_STRINGIFIED_CSS_ERROR__
};

var _ref9 = process.env.NODE_ENV === "production" ? {
  name: "u0240i",
  styles: "pointer-events:auto;border-radius:0.125rem;--tw-shadow:0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);overflow-y:auto;padding-left:1.25rem;padding-right:1.25rem;padding-bottom:1.25rem;max-height:90vh"
} : {
  name: "14k59wi-Modal",
  styles: "pointer-events:auto;border-radius:0.125rem;--tw-shadow:0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);overflow-y:auto;padding-left:1.25rem;padding-right:1.25rem;padding-bottom:1.25rem;max-height:90vh;label:Modal;",
  toString: _EMOTION_STRINGIFIED_CSS_ERROR__
};

var Modal = function Modal(_ref5) {
  var _ref5$isOpen = _ref5.isOpen,
      isOpen = _ref5$isOpen === void 0 ? false : _ref5$isOpen,
      onClose = _ref5.onClose,
      children = _ref5.children,
      props = _objectWithoutProperties(_ref5, _excluded2);

  return (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
    children: isOpen && (0, _jsxRuntime.jsxs)(_Overlay["default"], {
      css: _ref6,
      isOpen: isOpen,
      children: [(0, _jsxRuntime.jsx)("div", {
        onClick: onClose,
        css: _ref7
      }), (0, _jsxRuntime.jsx)("div", {
        css: _ref8,
        children: (0, _jsxRuntime.jsx)("div", _objectSpread(_objectSpread({
          css: _ref9
        }, props), {}, {
          children: children
        }))
      })]
    })
  });
};

var _default = Modal;
exports["default"] = _default;