'use strict';

var jsxRuntime = require('react/jsx-runtime');
var React = require('react');
var utils = require('./utils-BhM0B89p.js');
var primitives_Kbd = require('./primitives/Kbd.js');
var primitives_Tooltip = require('./primitives/Tooltip.js');

const SIDE_MAP = {
  top: "top",
  bottom: "bottom",
  left: "left",
  right: "right",
  "top-start": "top",
  "top-end": "top",
  "bottom-start": "bottom",
  "bottom-end": "bottom",
  "left-start": "left",
  "left-end": "left",
  "right-start": "right",
  "right-end": "right",
  auto: "top"
};

const Kbd = React.forwardRef(
  ({ tooltipProps, className, ...otherProps }, ref) => {
    const kbd = /* @__PURE__ */ jsxRuntime.jsx(primitives_Kbd.Kbd, { ref, className: utils.cn(className), ...otherProps });
    if (!tooltipProps?.content) {
      return kbd;
    }
    const side = SIDE_MAP[tooltipProps.position ?? "auto"] ?? "top";
    return /* @__PURE__ */ jsxRuntime.jsx(primitives_Tooltip.TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(primitives_Tooltip.Tooltip, { children: [
      /* @__PURE__ */ jsxRuntime.jsx(primitives_Tooltip.TooltipTrigger, { asChild: true, children: kbd }),
      /* @__PURE__ */ jsxRuntime.jsx(primitives_Tooltip.TooltipContent, { side, children: tooltipProps.content })
    ] }) });
  }
);
Kbd.displayName = "Kbd";
const KbdGroup = primitives_Kbd.KbdGroup;
const KbdNamespace = Object.assign(Kbd, { Group: KbdGroup });

exports.KbdNamespace = KbdNamespace;
//# sourceMappingURL=Kbd-D2nELu5m.js.map
