"use client";
import * as React from "react";
import { useComboboxRootContext } from "../root/ComboboxRootContext.js";
import { ComboboxPortalContext } from "./ComboboxPortalContext.js";
import { selectors } from "../store.js";
import { jsx } from "react/jsx-runtime";
import { FloatingPortal } from "../../floating-ui-react/components/FloatingPortal.js";
import { useStore } from "../../../../utils/esm/store/useStore.js";
const ComboboxPortal = /* @__PURE__ */ React.forwardRef(function ComboboxPortal2(props, forwardedRef) {
  const {
    keepMounted = false,
    ...portalProps
  } = props;
  const store = useComboboxRootContext();
  const mounted = useStore(store, selectors.mounted);
  const forceMounted = useStore(store, selectors.forceMounted);
  const shouldRender = mounted || keepMounted || forceMounted;
  if (!shouldRender) {
    return null;
  }
  return /* @__PURE__ */ jsx(ComboboxPortalContext.Provider, {
    value: keepMounted,
    children: /* @__PURE__ */ jsx(FloatingPortal, {
      ref: forwardedRef,
      ...portalProps
    })
  });
});
if (process.env.NODE_ENV !== "production") ComboboxPortal.displayName = "ComboboxPortal";
export {
  ComboboxPortal
};
//# sourceMappingURL=ComboboxPortal.js.map
