import { i as internalSlot } from "../internal-slot/index.js";
var SLOT = internalSlot;
var $SyntaxError = SyntaxError;
var $StopIteration = typeof StopIteration === "object" ? StopIteration : null;
var stopIterationIterator = function getStopIterationIterator(origIterator) {
  if (!$StopIteration) {
    throw new $SyntaxError("this environment lacks StopIteration");
  }
  SLOT.set(origIterator, "[[Done]]", false);
  var siIterator = {
    next: function next() {
      var iterator = SLOT.get(this, "[[Iterator]]");
      var done = SLOT.get(iterator, "[[Done]]");
      try {
        return {
          done,
          value: done ? void 0 : iterator.next()
        };
      } catch (e) {
        SLOT.set(iterator, "[[Done]]", true);
        if (e !== $StopIteration) {
          throw e;
        }
        return {
          done: true,
          value: void 0
        };
      }
    }
  };
  SLOT.set(siIterator, "[[Iterator]]", origIterator);
  return siIterator;
};
export {
  stopIterationIterator as s
};
//# sourceMappingURL=index.js.map
