"use client";
'use strict';

var React = require('react');
var framerMotion = require('framer-motion');
var utils = require('@hanzo/ui/lib/utils');
var jsxRuntime = require('react/jsx-runtime');

function _interopNamespace(e) {
  if (e && e.__esModule) return e;
  var n = Object.create(null);
  if (e) {
    Object.keys(e).forEach(function (k) {
      if (k !== 'default') {
        var d = Object.getOwnPropertyDescriptor(e, k);
        Object.defineProperty(n, k, d.get ? d : {
          enumerable: true,
          get: function () { return e[k]; }
        });
      }
    });
  }
  n.default = e;
  return Object.freeze(n);
}

var React__namespace = /*#__PURE__*/_interopNamespace(React);

var AnimatedTooltip = React__namespace.forwardRef(
  ({ className, content, children, delay = 0, ...props }, ref) => {
    const [isVisible, setIsVisible] = React__namespace.useState(false);
    return /* @__PURE__ */ jsxRuntime.jsxs(
      "div",
      {
        ref,
        className: utils.cn("relative inline-block", className),
        onMouseEnter: () => setIsVisible(true),
        onMouseLeave: () => setIsVisible(false),
        ...props,
        children: [
          children,
          /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: isVisible && /* @__PURE__ */ jsxRuntime.jsxs(
            framerMotion.motion.div,
            {
              initial: { opacity: 0, y: 10, scale: 0.95 },
              animate: { opacity: 1, y: 0, scale: 1 },
              exit: { opacity: 0, y: 10, scale: 0.95 },
              transition: {
                duration: 0.2,
                delay: delay / 1e3,
                ease: "easeOut"
              },
              className: "absolute left-1/2 -translate-x-1/2 bottom-full mb-2 px-3 py-1.5 bg-popover text-popover-foreground text-sm rounded-md shadow-md whitespace-nowrap z-50",
              children: [
                content,
                /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute left-1/2 -translate-x-1/2 top-full w-0 h-0 border-l-4 border-r-4 border-t-4 border-l-transparent border-r-transparent border-t-popover" })
              ]
            }
          ) })
        ]
      }
    );
  }
);
AnimatedTooltip.displayName = "AnimatedTooltip";

exports.AnimatedTooltip = AnimatedTooltip;
