"use strict";
const React = require("react");
const index = require("../../Button/index.js");
const is = require("../../_util/is.js");
const emotionReactJsxRuntime_browser_esm = require("../../../../../../../@emotion_react@11.10.4_3toe27fv7etiytxb5kxc7fxaw4/node_modules/@emotion/react/jsx-runtime/dist/emotion-react-jsx-runtime.browser.esm.js");
function Shortcuts(props, ref) {
  var prefixCls = props.prefixCls, _a = props.shortcuts, shortcuts = _a === void 0 ? [] : _a, onSelectNow = props.onSelectNow, nowText = props.nowText, showNowBtn = props.showNowBtn, showTime = props.showTime, onMouseEnterShortcut = props.onMouseEnterShortcut, onMouseLeaveShortcut = props.onMouseLeaveShortcut;
  function onMouseEnter(shortcut) {
    onMouseEnterShortcut && onMouseEnterShortcut(shortcut);
  }
  function onMouseLeave(shortcut) {
    onMouseLeaveShortcut && onMouseLeaveShortcut(shortcut);
  }
  function onClick(shortcut, e) {
    var onSelectShortcut = props.onSelectShortcut;
    onSelectShortcut && onSelectShortcut(shortcut, e);
  }
  var hasShortcuts = is.isArray(shortcuts) && shortcuts.length > 0;
  var shouldShowNowBtn = showNowBtn && showTime && !hasShortcuts;
  return /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsxs("div", {
    ref,
    className: prefixCls + "-shortcuts",
    children: [shouldShowNowBtn && /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx(index, {
      size: "mini",
      onClick: onSelectNow,
      children: nowText
    }), hasShortcuts && shortcuts.map(function(shortcut, index$1) {
      return /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx(index, {
        size: "mini",
        onMouseEnter: function() {
          return onMouseEnter(shortcut);
        },
        onMouseLeave: function() {
          return onMouseLeave(shortcut);
        },
        onClick: function(e) {
          return onClick(shortcut, e);
        },
        children: shortcut.text
      }, index$1);
    })]
  });
}
const Shortcuts$1 = React.forwardRef(Shortcuts);
module.exports = Shortcuts$1;
//# sourceMappingURL=shortcuts.js.map
