import { jsx as s } from "react/jsx-runtime";
import { useState as a, useRef as p, useEffect as u } from "react";
import { AnimatePresence as y, motion as x } from "motion/react";
const E = 200, b = (r) => {
  const { children: l, show: e = !1, duration: t = 0.2, delay: o = 0, className: c = "" } = r, [m, n] = a(e), [d, i] = a("hidden"), h = p(t);
  u(() => {
    e ? n(!0) : (i("hidden"), setTimeout(() => {
      n(!1);
    }, 0));
  }, [e]);
  const f = () => {
    e && setTimeout(() => i("visible"), h.current * 1e3 + E);
  };
  return /* @__PURE__ */ s(y, { onExitComplete: () => i("hidden"), children: m && /* @__PURE__ */ s(
    x.div,
    {
      initial: { height: 0, opacity: 0 },
      animate: { height: "auto", opacity: 1 },
      exit: { height: 0, opacity: 0 },
      transition: {
        height: { duration: t, delay: o },
        opacity: { duration: t, delay: o },
        ease: "easeIn"
      },
      style: { overflow: d },
      onAnimationComplete: f,
      className: c,
      children: l
    }
  ) });
};
export {
  b as default
};
//# sourceMappingURL=FadeExpander.js.map
