require("./chunk-9hOWP6kD.cjs");
let react = require("react");
let react_jsx_runtime = require("react/jsx-runtime");
//#region ../../platform/i18n/src/locale-context.tsx
const LocaleCtx = (0, react.createContext)(null);
function LocaleProvider({ initialLocale, onLocaleChange, children }) {
	const [locale, setLocaleState] = (0, react.useState)(initialLocale);
	const value = (0, react.useMemo)(() => ({
		locale,
		setLocale(next) {
			setLocaleState(next);
			onLocaleChange?.(next);
		}
	}), [locale, onLocaleChange]);
	return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LocaleCtx.Provider, {
		value,
		children
	});
}
function useActiveLocale() {
	const value = (0, react.useContext)(LocaleCtx);
	if (!value) throw new Error("useActiveLocale must be used within a LocaleProvider");
	return value;
}
//#endregion
Object.defineProperty(exports, "LocaleProvider", {
	enumerable: true,
	get: function() {
		return LocaleProvider;
	}
});
Object.defineProperty(exports, "useActiveLocale", {
	enumerable: true,
	get: function() {
		return useActiveLocale;
	}
});

//# sourceMappingURL=locale-context-34b1u6At.cjs.map