"use client";
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const require_runtime = require('../../../_virtual/_rolldown/runtime.cjs');
let react = require("react");
let react_jsx_runtime = require("react/jsx-runtime");

//#region src/components/client/Popover/UDSPopoverConfigProvider.tsx
const PopoverContext = (0, react.createContext)(void 0);
const UDSPopoverConfigProvider = ({ children, value }) => {
	const existingContext = (0, react.useContext)(PopoverContext);
	if ("type" in value) {
		if (!existingContext) throw new Error("Cannot merge context values without an existing PopoverContext");
		return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PopoverContext.Provider, {
			value: {
				...existingContext,
				...value.value
			},
			children
		});
	}
	return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PopoverContext.Provider, {
		value,
		children
	});
};
UDSPopoverConfigProvider.displayName = "UDSPopoverConfigProvider";
function usePopoverConfig(options) {
	const context = (0, react.useContext)(PopoverContext);
	if (!context) throw new Error("usePopoverConfig must be used within a UDSConfigProvider or UDSPopoverConfigProvider");
	const { placementMap, placement, ...contextRest } = context;
	return {
		...contextRest,
		ariaKitPlacement: placementMap[options?.placement ?? placement]
	};
}

//#endregion
exports.UDSPopoverConfigProvider = UDSPopoverConfigProvider;
exports.usePopoverConfig = usePopoverConfig;