text: "use strict";
  
  var _merge2 = _interopRequireDefault(require("lodash/merge"));
  
  var _localeMessages = _interopRequireDefault(require("all:part:@sanity/base/locale-messages"));
  
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  
  var mergedMessages = _localeMessages.default.reduce((prev, curr) => (0, _merge2.default)(prev, curr), {});
  
  function fetchLocalizedMessages(language) {
    var languagePrefix = language.split('-')[0];
    var localizedMessages = mergedMessages[language] || mergedMessages[languagePrefix];
  
    if (!localizedMessages) {
      console.warn("No localized messages for language ".concat(language)); // eslint-disable-line no-console
    }
  
    return Promise.resolve(localizedMessages || {});
  }
  
  function fetchAllMessages() {
    return Promise.resolve(mergedMessages);
  }
  
  module.exports = {
    fetchLocalizedMessages,
    fetchAllMessages
  };