import { jsx, jsxs } from 'react/jsx-runtime';
import { forwardRef } from 'react';
import { c as cn } from './utils-DdHUxIdC.js';
import { Kbd as Kbd$1, KbdGroup as KbdGroup$1 } from './primitives/Kbd.js';
import { TooltipProvider, Tooltip, TooltipTrigger, TooltipContent } from './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 = forwardRef(({ tooltipProps, className, ...otherProps }, ref) => {
    const kbd = (jsx(Kbd$1, { ref: ref, className: cn(className), ...otherProps }));
    if (!tooltipProps?.content) {
        return kbd;
    }
    const side = SIDE_MAP[tooltipProps.position ?? "auto"] ?? "top";
    return (jsx(TooltipProvider, { children: jsxs(Tooltip, { children: [jsx(TooltipTrigger, { asChild: true, children: kbd }), jsx(TooltipContent, { side: side, children: tooltipProps.content })] }) }));
});
Kbd.displayName = "Kbd";
const KbdGroup = KbdGroup$1;
const KbdNamespace = Object.assign(Kbd, { Group: KbdGroup });

export { KbdNamespace as K };
//# sourceMappingURL=Kbd-EqbC0bua.js.map
