"use client";
import { usePopoverAnchor } from './OMU7RWRV.js';
import { useDialogDisclosure } from './NTITENHD.js';
import { usePopoverProviderContext, PopoverScopedContextProvider } from './MTZPJQMC.js';
import { createHook, forwardRef as forwardRef2, createElement } from './LMDWO4NN.js';
import { useEvent, useWrapElement } from './ABQUS43J.js';
import { __objRest, __spreadProps, __spreadValues } from './3YLGPPWQ.js';
import { invariant } from '../../../../../../@ariakit_core@0.4.15/node_modules/@ariakit/core/esm/__chunks/PBFD2E7P.js';
import { jsx } from 'react/jsx-runtime';

var TagName = "button";
var usePopoverDisclosure = createHook(function usePopoverDisclosure2(_a) {
  var _b = _a, { store } = _b, props = __objRest(_b, ["store"]);
  const context = usePopoverProviderContext();
  store = store || context;
  invariant(
    store,
    process.env.NODE_ENV !== "production" && "PopoverDisclosure must receive a `store` prop or be wrapped in a PopoverProvider component."
  );
  const onClickProp = props.onClick;
  const onClick = useEvent((event) => {
    store == null ? void 0 : store.setAnchorElement(event.currentTarget);
    onClickProp == null ? void 0 : onClickProp(event);
  });
  props = useWrapElement(
    props,
    (element) => /* @__PURE__ */ jsx(PopoverScopedContextProvider, { value: store, children: element }),
    [store]
  );
  props = __spreadProps(__spreadValues({}, props), {
    onClick
  });
  props = usePopoverAnchor(__spreadValues({ store }, props));
  props = useDialogDisclosure(__spreadValues({ store }, props));
  return props;
});
forwardRef2(function PopoverDisclosure2(props) {
  const htmlProps = usePopoverDisclosure(props);
  return createElement(TagName, htmlProps);
});

export { usePopoverDisclosure };
//# sourceMappingURL=WMYDSCNQ.js.map
