/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
"use client";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
require("../../../_virtual/_rolldown/runtime.cjs");
let react = require("react");
let react_jsx_runtime = require("react/jsx-runtime");
//#region src/components/client/Tooltip/UDSTooltipConfigProvider.tsx
const TooltipContext = (0, react.createContext)(void 0);
const UDSTooltipConfigProvider = ({ children, value }) => {
	const existingContext = (0, react.useContext)(TooltipContext);
	if ("type" in value) {
		if (!existingContext) throw new Error("Cannot merge context values without an existing TooltipContext");
		return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TooltipContext.Provider, {
			value: {
				...existingContext,
				...value.value
			},
			children
		});
	}
	return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TooltipContext.Provider, {
		value,
		children
	});
};
UDSTooltipConfigProvider.displayName = "UDSTooltipConfigProvider";
function useTooltipConfig(options) {
	const context = (0, react.useContext)(TooltipContext);
	if (!context) throw new Error("useTooltipConfig must be used within a UDSConfigProvider or UDSTooltipConfigProvider");
	const { placementMap, placement, ...contextRest } = context;
	return {
		...contextRest,
		ariaKitPlacement: placementMap[options?.placement ?? placement]
	};
}
//#endregion
exports.UDSTooltipConfigProvider = UDSTooltipConfigProvider;
exports.useTooltipConfig = useTooltipConfig;
