import React from 'react';
import { SoftI18nConsumer } from '../Context';
const defaultFormatter = new Intl.NumberFormat('en');
function defaultFormatNumber(value) {
    return defaultFormatter.format(value);
}
function hasValues(x) {
    return x.values != null;
}
// @ts-ignore
const SoftI18nNumber = props => (React.createElement(SoftI18nConsumer, null, i18nConfig => {
    const formatNumber = i18nConfig.formatNumber || defaultFormatNumber;
    if (hasValues(props)) {
        return props.children(props.values.map(value => formatNumber(value)));
    }
    const formattedValue = (formatNumber || defaultFormatNumber)(props.value);
    if (props.children) {
        return props.children(formattedValue);
    }
    else {
        return formattedValue;
    }
}));
export { SoftI18nNumber };
//# sourceMappingURL=SoftI18nNumber.js.map