'use strict';var wellKnownSymbol=require('./well-known-symbol-d17f132e.js'),functionBindContext=require('./function-bind-context-e4685306.js'),normalizeComponent=require('./normalize-component-ebe0c011.js'),es_string_iterator=require('./es.string.iterator-770ffd9b.js'),createProperty=require('./create-property-843cca47.js');// call something on iterator step with safe closing on error
var callWithSafeIterationClosing = function (iterator, fn, value, ENTRIES) {
  try {
    return ENTRIES ? fn(normalizeComponent.a(value)[0], value[1]) : fn(value);
  // 7.4.6 IteratorClose(iterator, completion)
  } catch (error) {
    es_string_iterator.a(iterator);
    throw error;
  }
};// `Array.from` method implementation
// https://tc39.es/ecma262/#sec-array.from
var arrayFrom = function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {
  var O = wellKnownSymbol.t(arrayLike);
  var C = typeof this == 'function' ? this : Array;
  var argumentsLength = arguments.length;
  var mapfn = argumentsLength > 1 ? arguments[1] : undefined;
  var mapping = mapfn !== undefined;
  var iteratorMethod = es_string_iterator.g(O);
  var index = 0;
  var length, result, step, iterator, next, value;
  if (mapping) mapfn = functionBindContext.f(mapfn, argumentsLength > 2 ? arguments[2] : undefined, 2);
  // if the target is not iterable or it's an array with the default iterator - use a simple case
  if (iteratorMethod != undefined && !(C == Array && es_string_iterator.i(iteratorMethod))) {
    iterator = iteratorMethod.call(O);
    next = iterator.next;
    result = new C();
    for (;!(step = next.call(iterator)).done; index++) {
      value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value;
      createProperty.c(result, index, value);
    }
  } else {
    length = wellKnownSymbol.a(O.length);
    result = new C(length);
    for (;length > index; index++) {
      value = mapping ? mapfn(O[index], index) : O[index];
      createProperty.c(result, index, value);
    }
  }
  result.length = index;
  return result;
};var INCORRECT_ITERATION = !es_string_iterator.c(function (iterable) {
  // eslint-disable-next-line es/no-array-from -- required for testing
  Array.from(iterable);
});

// `Array.from` method
// https://tc39.es/ecma262/#sec-array.from
wellKnownSymbol._({ target: 'Array', stat: true, forced: INCORRECT_ITERATION }, {
  from: arrayFrom
});