'use strict';

var jsxRuntime = require('react/jsx-runtime');
var React = require('react');
var utils = require('./utils-CTr7wn5d.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 = (jsxRuntime.jsx(primitives_Kbd.Kbd, { ref: ref, className: utils.cn(className), ...otherProps }));
    if (!tooltipProps?.content) {
        return kbd;
    }
    const side = SIDE_MAP[tooltipProps.position ?? "auto"] ?? "top";
    return (jsxRuntime.jsx(primitives_Tooltip.TooltipProvider, { children: jsxRuntime.jsxs(primitives_Tooltip.Tooltip, { children: [jsxRuntime.jsx(primitives_Tooltip.TooltipTrigger, { asChild: true, children: kbd }), jsxRuntime.jsx(primitives_Tooltip.TooltipContent, { side: side, children: tooltipProps.content })] }) }));
});
Kbd.displayName = "Kbd";
const KbdGroup = primitives_Kbd.KbdGroup;
const KbdNamespace = Object.assign(Kbd, { Group: KbdGroup });

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