"use client";
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
import { createContext, useContext } from "react";
import { jsx } from "react/jsx-runtime";

//#region src/components/client/BottomSheet/UDSBottomSheetConfigProvider.tsx
const BottomSheetContext = createContext(void 0);
const UDSBottomSheetConfigProvider = ({ children, value }) => {
	const existingContext = useContext(BottomSheetContext);
	const isMerge = typeof value === "object" && "type" in value && value.type === "merge";
	if (isMerge && !existingContext) throw new Error("Cannot merge context values without an existing BottomSheetContext");
	const finalValue = isMerge ? {
		...existingContext,
		...value.value
	} : value;
	return /* @__PURE__ */ jsx(BottomSheetContext.Provider, {
		value: finalValue,
		children
	});
};
UDSBottomSheetConfigProvider.displayName = "UDSBottomSheetConfigProvider";
function useBottomSheetConfig() {
	const context = useContext(BottomSheetContext);
	if (!context) throw new Error("useBottomSheetConfig must be used within a UDSBottomSheetConfigProvider");
	return context;
}

//#endregion
export { UDSBottomSheetConfigProvider, useBottomSheetConfig };