import { t as CalendarDate } from "./calendar-date-CNNsHVof.cjs"; //#region src/core/calendar-range.d.ts /** * CalendarRange — an inclusive, ordered span of calendar days. * * Date-level by design: range membership and grid rendering work on whole days. * Time-aware range bounds (when time is enabled) are tracked separately as * CalendarDateTime on the selection; this span drives the day grid. * * Invariant: `compareDate(start, end) <= 0`. Build via {@link orderRange} to * guarantee it (handles reverse drag). */ type CalendarRange = { readonly start: CalendarDate; readonly end: CalendarDate; }; //#endregion //#region src/core/date-rule-engine.d.ts /** * Shared rule engine behind both the `disabled` and `exclude` props — they have * identical rule shapes and only differ in meaning (disabled = cannot select; * exclude = skipped inside a span, splitting it). One compiled engine, queried * many times. * * Performance is a first-class concern: `matches` is the per-cell hot path that * runs on every grid render, including low-end phones. It does zero allocation * and checks rules cheapest-first (empty short-circuit → all flag → weekday bit * mask → exact-date Set → min/max compare → range binary search → predicates * last). Reasons are computed lazily and only when a UI asks (tooltip / aria). */ /** A day in rule config: a `CalendarDate` struct or a plain JS `Date`. */ type DateRuleDayInput = CalendarDate | Date; /** A span in rule config: `{start,end}` (v3) or `{from,to}` (v2 alias). */ type DateRuleRangeInput = { start: DateRuleDayInput; end: DateRuleDayInput; } | { from: DateRuleDayInput; to: DateRuleDayInput; }; type DateRuleConfig = { /** Match every day. */ all?: boolean; /** Match Saturday and Sunday. */ weekends?: boolean; /** Match these weekdays (0 = Sun .. 6 = Sat). */ weekdays?: number[]; /** Match days strictly before this date. Also sets the inferred lower limit. */ before?: DateRuleDayInput; /** Match days strictly after this date. Also sets the inferred upper limit. */ after?: DateRuleDayInput; /** Match these exact days. */ dates?: DateRuleDayInput[]; /** Match days inside any of these spans. */ ranges?: DateRuleRangeInput[]; /** Arbitrary match — evaluated last, never indexed or cached. */ predicate?: (date: CalendarDate) => boolean; }; type DateRuleReason = "all" | "weekday" | "date" | "before" | "after" | "range" | "predicate"; type DateRuleEngine = { /** * Hot path: does this day match the rules? O(1)–O(log R), allocation-free. * Pass `weekday` (0=Sun..6=Sat) when a grid cell already has it to avoid * recomputing weekday math for weekday/weekend rules. */ matches(date: CalendarDate, weekday?: number): boolean; /** True when no rule is configured — callers can skip the engine entirely. */ isEmpty: boolean; /** True when {@link getReason} can return a tag (i.e. not empty). */ hasReasons: boolean; /** Lazy, opt-in: which rule matched, for tooltips / aria / validation. */ getReason(date: CalendarDate, weekday?: number): DateRuleReason | null; /** Bounds implied by `before`/`after`, for view clamping. */ limits: { min?: CalendarDate; max?: CalendarDate; }; }; /** * Compile a rule config once into a queryable engine. Malformed entries are * skipped defensively with a dev warning (never throws). Both `disabled` and * `exclude` call this; day inputs accept plain JS `Date` (v2 parity). */ declare function compileDateRules(config?: DateRuleConfig): DateRuleEngine; //#endregion export { type DateRuleReason as a, type DateRuleRangeInput as i, type DateRuleDayInput as n, compileDateRules as o, type DateRuleEngine as r, type CalendarRange as s, type DateRuleConfig as t };