//#region src/hooks/useNumberInput/utils/getLocaleConfig.ts
const defaultConfig = {
	currencySymbol: "",
	groupSeparator: "",
	decimalSeparator: "",
	prefix: "",
	suffix: ""
};
/**
* Get locale config from input or default
*/
const getLocaleConfig = (intlConfig) => {
	const { locale, currency } = intlConfig || {};
	return (locale ? new Intl.NumberFormat(locale, currency ? {
		currency,
		style: "currency"
	} : void 0) : new Intl.NumberFormat()).formatToParts(1000.1).reduce((prev, curr, i) => {
		if (curr.type === "currency") if (i === 0) return {
			...prev,
			currencySymbol: curr.value,
			prefix: curr.value
		};
		else return {
			...prev,
			currencySymbol: curr.value,
			suffix: curr.value
		};
		if (curr.type === "group") return {
			...prev,
			groupSeparator: curr.value
		};
		if (curr.type === "decimal") return {
			...prev,
			decimalSeparator: curr.value
		};
		return prev;
	}, defaultConfig);
};
//#endregion
export { getLocaleConfig };
