'use strict';

var React = require('react');
var translationsContext = require('./translationsContext-78113889.js');
var i18nValues_enPH = require('./i18n-values/en-PH.js');
var i18nValues_hiIN = require('./i18n-values/hi-IN.js');
var i18nValues_idID = require('./i18n-values/id-ID.js');
var i18nValues_kmKH = require('./i18n-values/km-KH.js');
var i18nValues_msMY = require('./i18n-values/ms-MY.js');
var i18nValues_myMM = require('./i18n-values/my-MM.js');
var i18nValues_thTH = require('./i18n-values/th-TH.js');
var i18nValues_tlPH = require('./i18n-values/tl-PH.js');
var i18nValues_viVN = require('./i18n-values/vi-VN.js');
var i18nValues_viVN_MB = require('./i18n-values/vi-VN_MB.js');
var i18nValues_zhSG = require('./i18n-values/zh-SG.js');
var i18nValues_zhTW = require('./i18n-values/zh-TW.js');

function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }

var React__default = /*#__PURE__*/_interopDefault(React);

const translationsMap = {
    'en-PH': i18nValues_enPH["default"],
    'vi-VN': i18nValues_viVN["default"],
    'hi-IN': i18nValues_hiIN["default"],
    'id-ID': i18nValues_idID["default"],
    'ms-MY': i18nValues_msMY["default"],
    'my-MM': i18nValues_myMM["default"],
    'km-KH': i18nValues_kmKH["default"],
    'zh-TW': i18nValues_zhTW["default"],
    'zh-SG': i18nValues_zhSG["default"],
    'th-TH': i18nValues_thTH["default"],
    'tl-PH': i18nValues_tlPH["default"],
    'vi-VN_MB': i18nValues_viVN_MB["default"],
};
/**
 * @deprecated Consider to use TranslationsProviderV2
 */
const TranslationsProvider = ({ locale = 'en-PH', overrides, overrideCurrentLocale, children, shouldLoadTranslation = true, loader = null, onTranslationsLoaded, }) => {
    const overridedValues = (overrides && overrides[locale]) || overrideCurrentLocale;
    const [values, setValues] = React.useState(() => (Object.assign(Object.assign({}, overridedValues), (shouldLoadTranslation ? translationsMap[locale] : {}))));
    React.useEffect(() => {
        setValues(Object.assign(Object.assign({}, overridedValues), (shouldLoadTranslation ? translationsMap[locale] : {})));
    }, [shouldLoadTranslation, locale]);
    const contextValue = React.useMemo(() => {
        if (!values) {
            return null;
        }
        return {
            locale,
            values,
        };
    }, [locale, values]);
    React.useEffect(() => {
        if (onTranslationsLoaded && Object.keys(values).length) {
            onTranslationsLoaded(values);
        }
    }, [values]);
    return (React__default["default"].createElement(translationsContext.TranslationsContext.Provider, { value: contextValue }, contextValue ? children : loader));
};

exports.TranslationsProvider = TranslationsProvider;
exports.translationsMap = translationsMap;
