import { jsx as x } from "react/jsx-runtime";
import { useState as d, useRef as E, useMemo as h, useEffect as w } from "react";
import { c as A, s as B, a as C } from "../tools/tools.js";
const L = function(p) {
  const {
    active: e = !1,
    as: y = "div",
    className: l,
    dropOldClass: c,
    fade: a = !0,
    style: f,
    variables: u,
    ...N
  } = p, [n, t] = d(!1), [m, r] = d(!1), v = E(null), b = h(() => {
    const s = A(
      !c && "tab-pane",
      a && "fade",
      n && "active",
      m && "show",
      l
    ), o = B((i, T) => ({ tKey: C(T) }), u, f);
    return {
      className: s,
      style: o
    };
  }, [n, l, c, a, m, f, u]);
  return w(() => {
    if (!a) {
      t(e), r(e);
      return;
    }
    if (e) {
      if (!n) {
        t(!0);
        return;
      }
      const s = v.current;
      if (!s)
        return;
      const o = () => {
        e ? r(!0) : t(!1);
      };
      s.addEventListener("transitionend", o), t(!0);
      const i = requestAnimationFrame(() => {
        r(!0);
      });
      return () => {
        s.removeEventListener("transitionend", o), i && cancelAnimationFrame(i);
      };
    } else
      r(!1), t(!1);
  }, [n, e, a]), /* @__PURE__ */ x(y, { ...N, ...b, ref: v });
};
L.displayName = "BRL.NavTabPane";
export {
  L as N
};
//# sourceMappingURL=nav-tab-pane.js.map
