/**
 * @since 2.7.0
 * @internal
 */ /**
 * A small util that is used to increment or decrement a number until it reaches
 * the max value or -1. When that happens, it will loop around to 0 or the max
 * value respectively. This does not work for different increment numbers or any
 * values below 0 for now.
 *
 * @internal
 * @param options - {@link LoopOptions}
 * @since 2.7.0 The `min` option was added and the arguments changed to an
 * object
 */ export function loop(options) {
    const { value, min = 0, max, increment, minmax = false } = options;
    let next = value + (increment ? 1 : -1);
    if (minmax) {
        next = Math.min(max, Math.max(min, next));
    } else if (next > max) {
        next = min;
    } else if (next < min) {
        next = max;
    }
    return next;
}

//# sourceMappingURL=loop.js.map