"use strict";

exports.__esModule = true;
exports.getPropertyOrDefaultFromMap = getPropertyOrDefaultFromMap;
exports.getPropertyOrDefault = getPropertyOrDefault;
exports.isObjectContainsPropertyWithAnyValue = exports.isObjectContainsPropertyWithValue = void 0;

(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 _require = require("immutable"),
    Map = _require.Map;

var caseInsensitiveCompare = function caseInsensitiveCompare(prop, property) {
  return prop.toLowerCase() === property.toLowerCase();
};

var caseInsensitiveStartWithCompare = function caseInsensitiveStartWithCompare(prop, property) {
  return prop.toLowerCase().startsWith(property.toLowerCase());
};

function getPropertyOrDefaultFromMap(map, property, defaultValue, ignoreCase, startWith) {
  if (ignoreCase === false && startWith === false) return map.get(property) || defaultValue;
  var compareFunction = startWith ? caseInsensitiveStartWithCompare : caseInsensitiveCompare;
  return map.find(function (value, key) {
    return compareFunction(key, property);
  }) || defaultValue;
}

function getPropertyOrDefault(obj, property, defaultValue, ignoreCase, startWith) {
  if (ignoreCase === void 0) {
    ignoreCase = false;
  }

  if (startWith === void 0) {
    startWith = false;
  }

  if (!obj) {
    return defaultValue;
  }

  if (Map.isMap(obj)) {
    return getPropertyOrDefaultFromMap(obj, property, defaultValue, ignoreCase, startWith);
  }

  if (ignoreCase === false && startWith === false) {
    return obj.hasOwnProperty(property) ? obj[property] : defaultValue;
  }

  var compareFunction = startWith ? caseInsensitiveStartWithCompare : caseInsensitiveCompare;

  for (var prop in obj) {
    if (obj.hasOwnProperty(prop) && compareFunction(prop, property)) {
      return obj[prop];
    }
  }

  return defaultValue;
}

var isObjectContainsPropertyWithValue = function isObjectContainsPropertyWithValue(obj, propertyName, value) {
  if (obj === null || obj === undefined) return false;

  if (obj.hasOwnProperty(propertyName) && obj[propertyName] === value) {
    return true;
  }

  for (var prop in obj) {
    if (obj.hasOwnProperty(prop) && typeof obj[prop] === "object") {
      if (isObjectContainsPropertyWithValue(obj[prop], propertyName, value)) return true;
    }
  }

  return false;
};

exports.isObjectContainsPropertyWithValue = isObjectContainsPropertyWithValue;

var isObjectContainsPropertyWithAnyValue = function isObjectContainsPropertyWithAnyValue(obj, propertyName) {
  if (!obj) return false;

  if (obj.hasOwnProperty(propertyName) && obj[propertyName]) {
    return true;
  }

  for (var prop in obj) {
    if (obj.hasOwnProperty(prop) && typeof obj[prop] === "object") {
      if (isObjectContainsPropertyWithAnyValue(obj[prop], propertyName)) return true;
    }
  }

  return false;
};

exports.isObjectContainsPropertyWithAnyValue = isObjectContainsPropertyWithAnyValue;
;

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

  if (!reactHotLoader) {
    return;
  }

  reactHotLoader.register(caseInsensitiveCompare, "caseInsensitiveCompare", "/home/vsts/work/1/s/src/utils/propertyHelper.js");
  reactHotLoader.register(caseInsensitiveStartWithCompare, "caseInsensitiveStartWithCompare", "/home/vsts/work/1/s/src/utils/propertyHelper.js");
  reactHotLoader.register(getPropertyOrDefaultFromMap, "getPropertyOrDefaultFromMap", "/home/vsts/work/1/s/src/utils/propertyHelper.js");
  reactHotLoader.register(getPropertyOrDefault, "getPropertyOrDefault", "/home/vsts/work/1/s/src/utils/propertyHelper.js");
  reactHotLoader.register(isObjectContainsPropertyWithValue, "isObjectContainsPropertyWithValue", "/home/vsts/work/1/s/src/utils/propertyHelper.js");
  reactHotLoader.register(isObjectContainsPropertyWithAnyValue, "isObjectContainsPropertyWithAnyValue", "/home/vsts/work/1/s/src/utils/propertyHelper.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(caseInsensitiveCompare, "caseInsensitiveCompare", "/home/vsts/work/1/s/src/utils/propertyHelper.js");
  reactHotLoader.register(caseInsensitiveStartWithCompare, "caseInsensitiveStartWithCompare", "/home/vsts/work/1/s/src/utils/propertyHelper.js");
  reactHotLoader.register(getPropertyOrDefaultFromMap, "getPropertyOrDefaultFromMap", "/home/vsts/work/1/s/src/utils/propertyHelper.js");
  reactHotLoader.register(getPropertyOrDefault, "getPropertyOrDefault", "/home/vsts/work/1/s/src/utils/propertyHelper.js");
  reactHotLoader.register(isObjectContainsPropertyWithValue, "isObjectContainsPropertyWithValue", "/home/vsts/work/1/s/src/utils/propertyHelper.js");
  reactHotLoader.register(isObjectContainsPropertyWithAnyValue, "isObjectContainsPropertyWithAnyValue", "/home/vsts/work/1/s/src/utils/propertyHelper.js");
})();

;

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