'use strict';var wellKnownSymbol$1=require('./well-known-symbol-f1447879.js'),normalizeComponent=require('./normalize-component-a3a558e7.js'),arraySpeciesCreate$1=require('./array-species-create-6d7d1ca3.js'),createProperty$1=require('./create-property-7113990d.js'),arrayMethodHasSpeciesSupport$1=require('./array-method-has-species-support-43b9931e.js');var $ = wellKnownSymbol$1._;
var fails = normalizeComponent.f;
var isArray = arraySpeciesCreate$1.i;
var isObject = normalizeComponent.b;
var toObject = wellKnownSymbol$1.t;
var toLength = wellKnownSymbol$1.a;
var createProperty = createProperty$1.c;
var arraySpeciesCreate = arraySpeciesCreate$1.a;
var arrayMethodHasSpeciesSupport = arrayMethodHasSpeciesSupport$1.a;
var wellKnownSymbol = wellKnownSymbol$1.w;
var V8_VERSION = wellKnownSymbol$1.e;

var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';

// We can't use this feature detection in V8 since it causes
// deoptimization and serious performance degradation
// https://github.com/zloirock/core-js/issues/679
var IS_CONCAT_SPREADABLE_SUPPORT = V8_VERSION >= 51 || !fails(function () {
  var array = [];
  array[IS_CONCAT_SPREADABLE] = false;
  return array.concat()[0] !== array;
});

var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');

var isConcatSpreadable = function (O) {
  if (!isObject(O)) return false;
  var spreadable = O[IS_CONCAT_SPREADABLE];
  return spreadable !== undefined ? !!spreadable : isArray(O);
};

var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;

// `Array.prototype.concat` method
// https://tc39.es/ecma262/#sec-array.prototype.concat
// with adding support of @@isConcatSpreadable and @@species
$({ target: 'Array', proto: true, forced: FORCED }, {
  // eslint-disable-next-line no-unused-vars -- required for `.length`
  concat: function concat(arg) {
    var O = toObject(this);
    var A = arraySpeciesCreate(O, 0);
    var n = 0;
    var i, k, length, len, E;
    for (i = -1, length = arguments.length; i < length; i++) {
      E = i === -1 ? O : arguments[i];
      if (isConcatSpreadable(E)) {
        len = toLength(E.length);
        if (n + len > MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
        for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
      } else {
        if (n >= MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
        createProperty(A, n++, E);
      }
    }
    A.length = n;
    return A;
  }
});