import type { ClosedTemporalBound, LimitedTemporalBound, TemporalBound, TemporalInterval, Timestamp } from "@blockprotocol/type-system"; /** * Standard comparison function that returns whether `IntervalA` is before the `IntervalB`. Where "before" * is defined by first comparing the start bounds, and if those are equal, then the end bounds are compared. * * @param {TemporalInterval} intervalA * @param {TemporalInterval} intervalB */ export declare const intervalCompareWithInterval: (intervalA: TemporalInterval, intervalB: TemporalInterval) => number; /** * Sorts a given collection of {@link TimeInterval} in place, sorted first from earliest to latest start bounds, and * then earliest to latest end bounds. * * @param {TemporalInterval[]} intervals */ export declare const sortIntervals: (intervals: TemporalInterval[]) => void; /** * Creates a {@link BoundedTimeInterval} that represents the instant of time identified by the given {@link Timestamp}. * * This is an interval where both bounds are `inclusive`, with limit points at the given {@link Timestamp}. Having an * `exclusive` start _or_ end would result in the interval never containing anything. * * @param {Timestamp} timestamp */ export declare const intervalForTimestamp: (timestamp: Timestamp) => TemporalInterval; /** * Checks whether two given {@link TimeInterval}s are adjacent to one another, where adjacency is defined as * being next to one another on the timeline, without any points between, *and where they are not overlapping*. Thus, * if adjacent, the two intervals should span another given interval. * * @param {TemporalInterval} left - The first interval of the comparison (order is unimportant) * @param {TemporalInterval} right - The second interval of the comparison */ export declare const intervalIsAdjacentToInterval: (left: TemporalInterval, right: TemporalInterval) => boolean; /** * Returns whether or not the `right` {@link TimeInterval} is *completely contained* within the `left` * {@link TimeInterval}. * * @param {TimeInterval} left - Checked if it contains the other * @param {TimeInterval} right - Checked if it's contained _within_ the other */ export declare const intervalContainsInterval: (left: TemporalInterval, right: TemporalInterval) => boolean; /** * Returns whether or not the given {@link Timestamp} falls within the span of a given {@link TimeInterval}. * * @param {TimeInterval} interval * @param {Timestamp} timestamp */ export declare const intervalContainsTimestamp: (interval: TemporalInterval, timestamp: Timestamp) => boolean; /** * Checks whether there is *any* overlap between two {@link TimeInterval} * * @param {TimeInterval} left * @param {TimeInterval} right */ export declare const intervalOverlapsInterval: (left: TemporalInterval, right: TemporalInterval) => boolean; /** * Advanced type to provide stronger type information when using {@link intervalIntersectionWithInterval}. * * If *either* of the `start` {@link TemporalBound}s is bounded, then the resultant `start` {@link TemporalBound} will * be bounded, same goes for `end` {@link TemporalBound}s respectively */ type IntersectionReturn, RightInterval extends TemporalInterval> = [LeftInterval, RightInterval] extends [ TemporalInterval, TemporalInterval ] ? TemporalInterval : never; /** * Returns the intersection (overlapping range) of two given {@link TimeInterval}s, returning `null` if there * isn't any. * * @param {TimeInterval} left * @param {TimeInterval} right */ export declare const intervalIntersectionWithInterval: , RightInterval extends TemporalInterval>(left: LeftInterval, right: RightInterval) => IntersectionReturn | null; /** * Advanced type to provide stronger type information when using {@link intervalMergeWithInterval}. * * If *both* of the `start` {@link TemporalBound}s are bounded, then the resultant `start` {@link TemporalBound} will be * bounded, same goes for end respectively */ type MergeReturn, RightInterval extends TemporalInterval> = [LeftInterval, RightInterval] extends [ TemporalInterval, TemporalInterval ] ? TemporalInterval : never; /** * Returns the {@link TimeInterval} which fully spans the space between the `start` {@link TemporalBound}s and * end {@link TemporalBound}s of two provided {@link TimeInterval}s. * * If the intervals do not overlap and are not adjacent, the resultant interval will span _more_ space than that spanned * by the given intervals. _This is different behavior compared to {@link intervalUnionWithInterval}._ * * @param {TimeInterval} left * @param {TimeInterval} right */ export declare const intervalMergeWithInterval: , RightInterval extends TemporalInterval>(left: LeftInterval, right: RightInterval) => MergeReturn; type UnionReturn, RightInterval extends TemporalInterval> = [MergeReturn] | [LeftInterval, RightInterval] | [RightInterval, LeftInterval]; /** * Given two {@link TimeInterval}s, this returns a list of non-adjacent, non-overlapping * {@link TimeInterval}s which span the space spanned by the input intervals. * * In other words, if the intervals _are_ adjacent, or overlap, then this returns the result of calling * {@link intervalMergeWithInterval} on the intervals, otherwise it returns the two intervals back. * * @param {TimeInterval} left * @param {TimeInterval} right */ export declare const intervalUnionWithInterval: , RightInterval extends TemporalInterval>(left: LeftInterval, right: RightInterval) => UnionReturn; /** * Given a collection of {@link TimeInterval}s, this returns a list of non-adjacent, non-overlapping * {@link TimeInterval}'s which span the space spanned by the input intervals. * * Conceptually this recursively calls {@link intervalUnionWithInterval} pairwise until all intervals have been unioned * with one another. The space spanned by the result will not necessarily be contiguous (may contain gaps). * * @param {TimeInterval[]} intervals */ export declare const unionOfIntervals: >(...intervals: IntervalsType[]) => UnionReturn[number][]; /** * Given two {@link TimeInterval}s, `left` and `right`, this returns `true` if the `left` interval spans a time * range that is completely *before* the time range spanned by the `right` interval (which also implies they do not * overlap), and false otherwise. * * @param {TimeInterval} left * @param {TimeInterval} right */ export declare const intervalIsStrictlyBeforeInterval: (left: TemporalInterval, right: TemporalInterval) => boolean; /** * Given two {@link TimeInterval}s, `left` and `right`, this returns `true` if the `left` interval spans a time * range that is completely *after* the time range spanned by the `right` interval (which also implies they do not * overlap), and false otherwise. * * @param {TimeInterval} left * @param {TimeInterval} right */ export declare const intervalIsStrictlyAfterInterval: (left: TemporalInterval, right: TemporalInterval) => boolean; export {};