"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const index$2 = require("../../_virtual/index10.cjs");
const index$3 = require("../is-arguments/index.cjs");
const index$4 = require("../stop-iteration-iterator/index.cjs");
const index = require("../has-symbols/index.cjs");
const shams = require("../has-symbols/shams.cjs");
const index$5 = require('./_node_modules/isarray/index.cjs');
const index$6 = require("../is-string/index.cjs");
const index$1 = require("../get-intrinsic/index.cjs");
const callBound$1 = require("../call-bind/callBound.cjs");
const index$7 = require("../is-map/index.cjs");
const index$8 = require("../is-set/index.cjs");
var isArguments = index$3.isArguments;
var getStopIterationIterator = index$4.stopIterationIterator;
if (index.hasSymbols() || shams.shams()) {
  var $iterator = Symbol.iterator;
  index$2.__module.exports = function getIterator(iterable) {
    if (iterable != null && typeof iterable[$iterator] !== "undefined") {
      return iterable[$iterator]();
    }
    if (isArguments(iterable)) {
      return Array.prototype[$iterator].call(iterable);
    }
  };
} else {
  var isArray = index$5.__require();
  var isString = index$6.isString;
  var GetIntrinsic = index$1.getIntrinsic;
  var $Map = GetIntrinsic("%Map%", true);
  var $Set = GetIntrinsic("%Set%", true);
  var callBound = callBound$1.callBound;
  var $arrayPush = callBound("Array.prototype.push");
  var $charCodeAt = callBound("String.prototype.charCodeAt");
  var $stringSlice = callBound("String.prototype.slice");
  var advanceStringIndex = function advanceStringIndex2(S, index2) {
    var length = S.length;
    if (index2 + 1 >= length) {
      return index2 + 1;
    }
    var first = $charCodeAt(S, index2);
    if (first < 55296 || first > 56319) {
      return index2 + 1;
    }
    var second = $charCodeAt(S, index2 + 1);
    if (second < 56320 || second > 57343) {
      return index2 + 1;
    }
    return index2 + 2;
  };
  var getArrayIterator = function getArrayIterator2(arraylike) {
    var i = 0;
    return {
      next: function next() {
        var done = i >= arraylike.length;
        var value;
        if (!done) {
          value = arraylike[i];
          i += 1;
        }
        return {
          done,
          value
        };
      }
    };
  };
  var getNonCollectionIterator = function getNonCollectionIterator2(iterable, noPrimordialCollections) {
    if (isArray(iterable) || isArguments(iterable)) {
      return getArrayIterator(iterable);
    }
    if (isString(iterable)) {
      var i = 0;
      return {
        next: function next() {
          var nextIndex = advanceStringIndex(iterable, i);
          var value = $stringSlice(iterable, i, nextIndex);
          i = nextIndex;
          return {
            done: nextIndex > iterable.length,
            value
          };
        }
      };
    }
    if (noPrimordialCollections && typeof iterable["_es6-shim iterator_"] !== "undefined") {
      return iterable["_es6-shim iterator_"]();
    }
  };
  if (!$Map && !$Set) {
    index$2.__module.exports = function getIterator(iterable) {
      if (iterable != null) {
        return getNonCollectionIterator(iterable, true);
      }
    };
  } else {
    var isMap = index$7.isMap;
    var isSet = index$8.isSet;
    var $mapForEach = callBound("Map.prototype.forEach", true);
    var $setForEach = callBound("Set.prototype.forEach", true);
    if (typeof process === "undefined" || !process.versions || !process.versions.node) {
      var $mapIterator = callBound("Map.prototype.iterator", true);
      var $setIterator = callBound("Set.prototype.iterator", true);
    }
    var $mapAtAtIterator = callBound("Map.prototype.@@iterator", true) || callBound("Map.prototype._es6-shim iterator_", true);
    var $setAtAtIterator = callBound("Set.prototype.@@iterator", true) || callBound("Set.prototype._es6-shim iterator_", true);
    var getCollectionIterator = function getCollectionIterator2(iterable) {
      if (isMap(iterable)) {
        if ($mapIterator) {
          return getStopIterationIterator($mapIterator(iterable));
        }
        if ($mapAtAtIterator) {
          return $mapAtAtIterator(iterable);
        }
        if ($mapForEach) {
          var entries = [];
          $mapForEach(iterable, function(v, k) {
            $arrayPush(entries, [k, v]);
          });
          return getArrayIterator(entries);
        }
      }
      if (isSet(iterable)) {
        if ($setIterator) {
          return getStopIterationIterator($setIterator(iterable));
        }
        if ($setAtAtIterator) {
          return $setAtAtIterator(iterable);
        }
        if ($setForEach) {
          var values = [];
          $setForEach(iterable, function(v) {
            $arrayPush(values, v);
          });
          return getArrayIterator(values);
        }
      }
    };
    index$2.__module.exports = function getIterator(iterable) {
      return getCollectionIterator(iterable) || getNonCollectionIterator(iterable);
    };
  }
}
var esGetIteratorExports = index$2.__module.exports;
exports.esGetIteratorExports = esGetIteratorExports;
//# sourceMappingURL=index.cjs.map
