'use strict';var _typeof=require('./typeof-6b9e62b8.js'),unsupportedIterableToArray=require('./unsupportedIterableToArray-40a00645.js');require('./es.array.join-88750c41.js'),require('./es.array.map-30953c40.js'),require('./regexp-exec-abstract-216cd44a.js'),require('./es.string.split-98e29ede.js');var _export=require('./export-61511812.js'),normalizeComponent=require('./normalize-component-d9981c57.js'),arrayIteration=require('./array-iteration-f35df2b6.js'),createProperty=require('./create-property-240c71a5.js'),arrayMethodHasSpeciesSupport=require('./array-method-has-species-support-983ac207.js');require('./es.object.to-string-f27a75a8.js'),require('./es.regexp.to-string-5606f728.js'),require('./es.string.replace-25e9e098.js'),require('./es.array.includes-3990bfec.js'),require('./es.string.includes-ec03e639.js'),require('./es.array.sort-60060df6.js'),require('./web.dom-collections.for-each-721f3fb0.js'),require('./es.object.keys-c57f02bd.js');function _arrayWithHoles(arr) {
  if (Array.isArray(arr)) return arr;
}function _iterableToArrayLimit(arr, i) {
  var _i = arr && (typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]);

  if (_i == null) return;
  var _arr = [];
  var _n = true;
  var _d = false;

  var _s, _e;

  try {
    for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
      _arr.push(_s.value);

      if (i && _arr.length === i) break;
    }
  } catch (err) {
    _d = true;
    _e = err;
  } finally {
    try {
      if (!_n && _i["return"] != null) _i["return"]();
    } finally {
      if (_d) throw _e;
    }
  }

  return _arr;
}function _nonIterableRest() {
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}function _slicedToArray(arr, i) {
  return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || unsupportedIterableToArray._(arr, i) || _nonIterableRest();
}var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport.a('slice');

var SPECIES = _export.w('species');
var nativeSlice = [].slice;
var max = Math.max;

// `Array.prototype.slice` method
// https://tc39.es/ecma262/#sec-array.prototype.slice
// fallback for not array-like ES3 strings and DOM objects
_export._({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
  slice: function slice(start, end) {
    var O = _export.f(this);
    var length = _export.d(O.length);
    var k = _export.C(start, length);
    var fin = _export.C(end === undefined ? length : end, length);
    // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible
    var Constructor, result, n;
    if (arrayIteration.i(O)) {
      Constructor = O.constructor;
      // cross-realm fallback
      if (typeof Constructor == 'function' && (Constructor === Array || arrayIteration.i(Constructor.prototype))) {
        Constructor = undefined;
      } else if (normalizeComponent.i(Constructor)) {
        Constructor = Constructor[SPECIES];
        if (Constructor === null) Constructor = undefined;
      }
      if (Constructor === Array || Constructor === undefined) {
        return nativeSlice.call(O, k, fin);
      }
    }
    result = new (Constructor === undefined ? Array : Constructor)(max(fin - k, 0));
    for (n = 0; k < fin; k++, n++) if (k in O) createProperty.c(result, n, O[k]);
    result.length = n;
    return result;
  }
});var createId = function createId() {
  return Math.random().toString(36).substr(2, 9);
};
/**
 *
 * @param {string} string - the nested object property path in dot notation
 * @param {Object} object - the object from which the property value should be extracted
 * @returns {*} - the value contained in the nested object
 */

var extractNestedPropertyValue = function extractNestedPropertyValue(string, object) {
  return string.split('.').reduce(function (a, b) {
    return a[b];
  }, object);
};
/**
 * function taking a string and returning returning any name format in an array
 * with primary compare value (=last name) first and
 * secondary compare value (=first name) second
 *
 * @param compareString {string}
 * @returns {[string, string]}
 */

var getNameSortValue = function getNameSortValue(compareString) {
  var compareStringSansNumbers = compareString.replace(/,? [0-9-]+/g, '');

  if (compareStringSansNumbers.includes(',')) {
    var compareArray = compareStringSansNumbers.split(', ');
    return [compareArray[0], compareArray.splice(1).join()];
  }

  var compArray = compareStringSansNumbers.split(' ');
  return [compArray.pop(), compareStringSansNumbers];
};
/**
 * function for sorting also allowing special sorting of objects for specified
 * attribute
 *
 * @param list {Array}: the list to sort
 * @param objectProp {String}: the property to sort an object by
 * @param sortByName {Boolean}: does it require special name sorting
 * @param valueFunction {Function}: possibility to apply a special function to
 * the value before any further handling (e.g. used for getting language specific
 * label
 * @returns {[*]}
 */

var sort = function sort(list) {
  var objectProp = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
  var sortByName = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  var valueFunction = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  return list.sort(function (a, b) {
    // assign respective list values to variables
    var compareValueA = a;
    var compareValueB = b; // if a property name was passed use its value for comparison

    if (objectProp) {
      compareValueA = compareValueA[objectProp];
      compareValueB = compareValueB[objectProp];
    } // if a special function was provided apply it to the value


    if (valueFunction) {
      compareValueA = valueFunction(compareValueA);
      compareValueB = valueFunction(compareValueB);
    } // if sortByName was specified, get the respective compare values


    if (sortByName) {
      var secondaryCompareValueA = '';
      var secondaryCompareValueB = '';

      var _getNameSortValue = getNameSortValue(compareValueA);

      var _getNameSortValue2 = _slicedToArray(_getNameSortValue, 2);

      compareValueA = _getNameSortValue2[0];
      secondaryCompareValueA = _getNameSortValue2[1];

      var _getNameSortValue3 = getNameSortValue(compareValueB);

      var _getNameSortValue4 = _slicedToArray(_getNameSortValue3, 2);

      compareValueB = _getNameSortValue4[0];
      secondaryCompareValueB = _getNameSortValue4[1];

      // if primary compare values are equal - use secondary compare value
      if (compareValueA.toLowerCase() === compareValueB.toLowerCase()) {
        compareValueA = secondaryCompareValueA;
        compareValueB = secondaryCompareValueB;
      }
    } // now do the actual value comparison


    if (compareValueA.toLowerCase() > compareValueB.toLowerCase()) {
      return 1;
    }

    return -1;
  });
};
var hasData = function hasData(fieldValues) {
  var hasContent = false;

  if (fieldValues && _typeof._(fieldValues) === 'object') {
    if (fieldValues.length >= 0) {
      fieldValues.forEach(function (values) {
        hasContent = hasData(values) || hasContent;
      });
    } else {
      var objectKeys = Object.keys(fieldValues);
      objectKeys.forEach(function (key) {
        hasContent = hasData(fieldValues[key]) || hasContent;
      });
    }
  } else {
    hasContent = fieldValues === 0 || !!fieldValues || hasContent;
  }

  return hasContent;
};exports._=_slicedToArray;exports.a=_arrayWithHoles;exports.b=_nonIterableRest;exports.c=createId;exports.e=extractNestedPropertyValue;exports.h=hasData;exports.s=sort;