import { u as m, a as f, A as n } from "./useOpenChangeComplete-RUbg6RBw.mjs";
import * as d from "react";
function g(s) {
  return m(s, "base-ui");
}
function q(s, r = !1, a = !1) {
  const [u, i] = d.useState(s && r ? "idle" : void 0), [t, c] = d.useState(s);
  return s && !t && (c(!0), i("starting")), !s && t && u !== "ending" && !a && i("ending"), !s && !t && u === "ending" && i(void 0), f(() => {
    if (!s && t && u !== "ending" && a) {
      const e = n.request(() => {
        i("ending");
      });
      return () => {
        n.cancel(e);
      };
    }
  }, [s, t, u, a]), f(() => {
    if (!s || r)
      return;
    const e = n.request(() => {
      i(void 0);
    });
    return () => {
      n.cancel(e);
    };
  }, [r, s]), f(() => {
    if (!s || !r)
      return;
    s && t && u !== "idle" && i("starting");
    const e = n.request(() => {
      i("idle");
    });
    return () => {
      n.cancel(e);
    };
  }, [r, s, t, i, u]), d.useMemo(() => ({
    mounted: t,
    setMounted: c,
    transitionStatus: u
  }), [t, u]);
}
export {
  g as a,
  q as u
};
//# sourceMappingURL=useTransitionStatus-CktVVKxz.mjs.map
