import { createContext, useContext, useMemo, useState } from "react";
import { jsx } from "react/jsx-runtime";
//#region ../../platform/i18n/src/locale-context.tsx
const LocaleCtx = createContext(null);
function LocaleProvider({ initialLocale, onLocaleChange, children }) {
	const [locale, setLocaleState] = useState(initialLocale);
	const value = useMemo(() => ({
		locale,
		setLocale(next) {
			setLocaleState(next);
			onLocaleChange?.(next);
		}
	}), [locale, onLocaleChange]);
	return /* @__PURE__ */ jsx(LocaleCtx.Provider, {
		value,
		children
	});
}
function useActiveLocale() {
	const value = useContext(LocaleCtx);
	if (!value) throw new Error("useActiveLocale must be used within a LocaleProvider");
	return value;
}
//#endregion
export { useActiveLocale as n, LocaleProvider as t };

//# sourceMappingURL=locale-context-B_ufX9EH.mjs.map