"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
exports.Range = void 0;
(function(Range) {
  function intersect(one, other) {
    if (one.start >= other.end || other.start >= one.end) {
      return { start: 0, end: 0 };
    }
    const start = Math.max(one.start, other.start);
    const end = Math.min(one.end, other.end);
    if (end - start <= 0) {
      return { start: 0, end: 0 };
    }
    return { start, end };
  }
  Range.intersect = intersect;
  function isEmpty(range) {
    return range.end - range.start <= 0;
  }
  Range.isEmpty = isEmpty;
  function intersects(one, other) {
    return !isEmpty(intersect(one, other));
  }
  Range.intersects = intersects;
  function relativeComplement(one, other) {
    const result = [];
    const first = { start: one.start, end: Math.min(other.start, one.end) };
    const second = { start: Math.max(other.end, one.start), end: one.end };
    if (!isEmpty(first)) {
      result.push(first);
    }
    if (!isEmpty(second)) {
      result.push(second);
    }
    return result;
  }
  Range.relativeComplement = relativeComplement;
})(exports.Range || (exports.Range = {}));
