"use strict";

exports.__esModule = true;
exports.setTranslationWithFallbackField = exports.setTranslationWithFallbackValue = void 0;

var _flatten = require("./flatten");

(function () {
  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
  enterModule && enterModule(module);
})();

(function () {
  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
  enterModule && enterModule(module);
})();

var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
  return a;
};

var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
  return a;
};

var setTranslationWithFallbackValue = function setTranslationWithFallbackValue(locale, obj, fallbackValue) {
  for (var _len = arguments.length, field = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
    field[_key - 3] = arguments[_key];
  }

  if (!obj || !obj.getIn((0, _flatten.flatten)([field]))) return obj;
  var value = obj.getIn((0, _flatten.flatten)([field, locale])) || fallbackValue || "";
  return obj.setIn((0, _flatten.flatten)([field]), value);
};

exports.setTranslationWithFallbackValue = setTranslationWithFallbackValue;

var setTranslationWithFallbackField = function setTranslationWithFallbackField(locale, obj, fallbackField) {
  for (var _len2 = arguments.length, field = new Array(_len2 > 3 ? _len2 - 3 : 0), _key2 = 3; _key2 < _len2; _key2++) {
    field[_key2 - 3] = arguments[_key2];
  }

  return setTranslationWithFallbackValue.apply(void 0, [locale, obj, obj == null ? void 0 : obj.get(fallbackField)].concat(field));
};

exports.setTranslationWithFallbackField = setTranslationWithFallbackField;
;

(function () {
  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;

  if (!reactHotLoader) {
    return;
  }

  reactHotLoader.register(setTranslationWithFallbackValue, "setTranslationWithFallbackValue", "/home/vsts/work/1/s/src/utils/setTranslationWithFallback.js");
  reactHotLoader.register(setTranslationWithFallbackField, "setTranslationWithFallbackField", "/home/vsts/work/1/s/src/utils/setTranslationWithFallback.js");
})();

;

(function () {
  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
  leaveModule && leaveModule(module);
})();

;

(function () {
  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;

  if (!reactHotLoader) {
    return;
  }

  reactHotLoader.register(setTranslationWithFallbackValue, "setTranslationWithFallbackValue", "/home/vsts/work/1/s/src/utils/setTranslationWithFallback.js");
  reactHotLoader.register(setTranslationWithFallbackField, "setTranslationWithFallbackField", "/home/vsts/work/1/s/src/utils/setTranslationWithFallback.js");
})();

;

(function () {
  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
  leaveModule && leaveModule(module);
})();