@dereekb/date 13.4.0 → 13.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.esm.js CHANGED
@@ -8,6 +8,14 @@ import { ARKTYPE_DATE_DTO_TYPE } from '@dereekb/model';
8
8
  import { interval, startWith, map, distinctUntilChanged } from 'rxjs';
9
9
  import { RRule } from 'rrule';
10
10
 
11
+ function _array_like_to_array$7(arr, len) {
12
+ if (len == null || len > arr.length) len = arr.length;
13
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
14
+ return arr2;
15
+ }
16
+ function _array_without_holes$5(arr) {
17
+ if (Array.isArray(arr)) return _array_like_to_array$7(arr);
18
+ }
11
19
  function _define_property$h(obj, key, value) {
12
20
  if (key in obj) {
13
21
  Object.defineProperty(obj, key, {
@@ -21,6 +29,12 @@ function _define_property$h(obj, key, value) {
21
29
  }
22
30
  return obj;
23
31
  }
32
+ function _iterable_to_array$5(iter) {
33
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
34
+ }
35
+ function _non_iterable_spread$5() {
36
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
37
+ }
24
38
  function _object_spread$e(target) {
25
39
  for(var i = 1; i < arguments.length; i++){
26
40
  var source = arguments[i] != null ? arguments[i] : {};
@@ -36,6 +50,17 @@ function _object_spread$e(target) {
36
50
  }
37
51
  return target;
38
52
  }
53
+ function _to_consumable_array$5(arr) {
54
+ return _array_without_holes$5(arr) || _iterable_to_array$5(arr) || _unsupported_iterable_to_array$7(arr) || _non_iterable_spread$5();
55
+ }
56
+ function _unsupported_iterable_to_array$7(o, minLen) {
57
+ if (!o) return;
58
+ if (typeof o === "string") return _array_like_to_array$7(o, minLen);
59
+ var n = Object.prototype.toString.call(o).slice(8, -1);
60
+ if (n === "Object" && o.constructor) n = o.constructor.name;
61
+ if (n === "Map" || n === "Set") return Array.from(n);
62
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$7(o, minLen);
63
+ }
39
64
  /**
40
65
  * Sentinel date representing the maximum future date (January 1, 9999 UTC).
41
66
  *
@@ -133,6 +158,8 @@ function _object_spread$e(target) {
133
158
  *
134
159
  * Useful as a default for "no expiration" comparisons.
135
160
  *
161
+ * @returns the MAX_FUTURE_DATE sentinel
162
+ *
136
163
  * @example
137
164
  * ```ts
138
165
  * const futureDate = maxFutureDate();
@@ -203,8 +230,7 @@ function _object_spread$e(target) {
203
230
  * // tz === 'America/New_York' (or similar)
204
231
  * ```
205
232
  */ function guessCurrentTimezone() {
206
- var _Intl_DateTimeFormat_resolvedOptions, _Intl_DateTimeFormat;
207
- return (_Intl_DateTimeFormat = Intl.DateTimeFormat()) === null || _Intl_DateTimeFormat === void 0 ? void 0 : (_Intl_DateTimeFormat_resolvedOptions = _Intl_DateTimeFormat.resolvedOptions()) === null || _Intl_DateTimeFormat_resolvedOptions === void 0 ? void 0 : _Intl_DateTimeFormat_resolvedOptions.timeZone;
233
+ return Intl.DateTimeFormat().resolvedOptions().timeZone;
208
234
  }
209
235
  /**
210
236
  * Returns the current system's timezone, throwing if detection fails.
@@ -294,15 +320,15 @@ function isBefore(a, b) {
294
320
  }
295
321
  function isSameDate(a, b) {
296
322
  var defaultValue = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : null;
297
- return a != null && b != null ? isEqual(a, b) : defaultValue != null ? defaultValue : a == b;
323
+ return a != null && b != null ? isEqual(a, b) : defaultValue !== null && defaultValue !== void 0 ? defaultValue : a == b;
298
324
  }
299
325
  function isSameDateHoursAndMinutes(a, b) {
300
326
  var defaultValue = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : null;
301
- return a != null && b != null ? isEqual(roundDownToMinute(a), roundDownToMinute(b)) : defaultValue != null ? defaultValue : a == b;
327
+ return a != null && b != null ? isEqual(roundDownToMinute(a), roundDownToMinute(b)) : defaultValue !== null && defaultValue !== void 0 ? defaultValue : a == b;
302
328
  }
303
329
  function isSameDateDay(a, b) {
304
330
  var defaultValue = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : null;
305
- return a != null && b != null ? isSameDay(a, b) : defaultValue != null ? defaultValue : a == b;
331
+ return a != null && b != null ? isSameDay(a, b) : defaultValue !== null && defaultValue !== void 0 ? defaultValue : a == b;
306
332
  }
307
333
  // MARK: Unix Date/Time
308
334
  /**
@@ -346,6 +372,10 @@ function isSameDateDay(a, b) {
346
372
  * Sets the hours and optionally minutes on a target date (defaults to now), with optional rounding to strip seconds/milliseconds.
347
373
  *
348
374
  * @param config - hours, optional minutes, and rounding options
375
+ * @param config.hours - the hours value to set
376
+ * @param config.minutes - optional minutes value to set
377
+ * @param config.removeSeconds - whether to zero out seconds
378
+ * @param config.roundDownToMinute - whether to zero out seconds and milliseconds (defaults to true)
349
379
  * @param target - date to modify (defaults to the current date/time)
350
380
  * @returns a new Date with the specified time values applied
351
381
  *
@@ -575,7 +605,7 @@ function roundDateTo(date, roundToUnit) {
575
605
  * // names === ['Mon', 'Tue']
576
606
  * ```
577
607
  */ function readDaysOfWeekNames(values, readDate, nameFunction) {
578
- return Array.from(readDaysOfWeek(values, readDate)).sort(sortNumbersAscendingFunction).map(nameFunction);
608
+ return _to_consumable_array$5(readDaysOfWeek(values, readDate)).sort(sortNumbersAscendingFunction).map(nameFunction);
579
609
  }
580
610
  /**
581
611
  * Checks whether the given date falls exactly at midnight (00:00:00.000) in UTC.
@@ -844,6 +874,9 @@ function _is_native_reflect_construct$2() {
844
874
  /**
845
875
  * Type guard to check if a value conforms to the {@link DateRangeStart} interface.
846
876
  *
877
+ * @param value - the value to check
878
+ * @returns true if the value has a valid Date `start` property
879
+ *
847
880
  * @example
848
881
  * ```ts
849
882
  * isDateRangeStart({ start: new Date() }); // true
@@ -872,6 +905,9 @@ function _is_native_reflect_construct$2() {
872
905
  * Counts the total number of calendar days spanned by the range, inclusive of both endpoints.
873
906
  * Always returns at least 1, even for same-day ranges.
874
907
  *
908
+ * @param dateRange - the date range to measure
909
+ * @returns the number of days in the range, inclusive
910
+ *
875
911
  * @example
876
912
  * ```ts
877
913
  * const range = { start: new Date('2024-01-01'), end: new Date('2024-01-03') };
@@ -883,6 +919,9 @@ function _is_native_reflect_construct$2() {
883
919
  /**
884
920
  * Type guard to check if a value is a valid {@link DateRange} with both start and end as Date objects.
885
921
  *
922
+ * @param input - the value to check
923
+ * @returns true if the value has valid Date `start` and `end` properties
924
+ *
886
925
  * @example
887
926
  * ```ts
888
927
  * isDateRange({ start: new Date(), end: new Date() }); // true
@@ -896,6 +935,10 @@ function _is_native_reflect_construct$2() {
896
935
  * Compares two date ranges for exact millisecond equality on both start and end.
897
936
  * Returns true if both are nullish.
898
937
  *
938
+ * @param a - first date range to compare
939
+ * @param b - second date range to compare
940
+ * @returns true if both ranges are equal or both are nullish
941
+ *
899
942
  * @example
900
943
  * ```ts
901
944
  * const a = { start: new Date('2024-01-01'), end: new Date('2024-01-31') };
@@ -910,6 +953,10 @@ function _is_native_reflect_construct$2() {
910
953
  * Compares two date ranges for calendar-day equality, ignoring time-of-day differences.
911
954
  * Returns true if both are nullish.
912
955
  *
956
+ * @param a - first date range to compare
957
+ * @param b - second date range to compare
958
+ * @returns true if both ranges fall on the same calendar days or both are nullish
959
+ *
913
960
  * @example
914
961
  * ```ts
915
962
  * const a = { start: new Date('2024-01-01T08:00:00'), end: new Date('2024-01-31T10:00:00') };
@@ -922,6 +969,9 @@ function _is_native_reflect_construct$2() {
922
969
  /**
923
970
  * Checks whether the range is unbounded (neither start nor end is set), meaning it conceptually includes all dates.
924
971
  *
972
+ * @param input - the partial date range to check
973
+ * @returns true if neither start nor end is set
974
+ *
925
975
  * @example
926
976
  * ```ts
927
977
  * isInfiniteDateRange({}); // true
@@ -933,6 +983,9 @@ function _is_native_reflect_construct$2() {
933
983
  /**
934
984
  * Checks whether the range has only one of start or end set, but not both.
935
985
  *
986
+ * @param input - the partial date range to check
987
+ * @returns true if exactly one of start or end is set
988
+ *
936
989
  * @example
937
990
  * ```ts
938
991
  * isPartialDateRange({ start: new Date() }); // true
@@ -944,6 +997,9 @@ function _is_native_reflect_construct$2() {
944
997
  /**
945
998
  * Checks whether the range has both start and end set.
946
999
  *
1000
+ * @param input - the partial date range to check
1001
+ * @returns true if both start and end are set
1002
+ *
947
1003
  * @example
948
1004
  * ```ts
949
1005
  * isFullDateRange({ start: new Date(), end: new Date() }); // true
@@ -956,6 +1012,10 @@ function _is_native_reflect_construct$2() {
956
1012
  * Normalizes a Date or {@link DateRange} into a DateRange. When given a single Date,
957
1013
  * uses it as start and optionally uses the provided end date (defaults to the same date).
958
1014
  *
1015
+ * @param startOrDateRange - a Date or existing DateRange
1016
+ * @param end - optional end date when the first argument is a plain Date
1017
+ * @returns a DateRange
1018
+ *
959
1019
  * @example
960
1020
  * ```ts
961
1021
  * const range = dateOrDateRangeToDateRange(new Date('2024-01-01'), new Date('2024-01-31'));
@@ -1028,6 +1088,9 @@ var DateRangeType;
1028
1088
  * Creates a {@link DateRange} from the given type and optional parameters. Supports many range
1029
1089
  * strategies including fixed periods (day, week, month), directional ranges, and radii.
1030
1090
  *
1091
+ * @param input - the range type or full configuration object
1092
+ * @param inputRoundToMinute - optional override to round the date to the start of its minute
1093
+ * @returns a computed DateRange
1031
1094
  * @throws Error if the type is not a recognized {@link DateRangeType}
1032
1095
  *
1033
1096
  * @example
@@ -1061,25 +1124,27 @@ var DateRangeType;
1061
1124
  start = startOfFn(preStart);
1062
1125
  end = endOfFn(preEnd);
1063
1126
  }
1064
- function calculateStartAndEndForBetween(addFn) {
1065
- var distance = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, startOfFn = arguments.length > 2 ? arguments[2] : void 0, endOfFn = arguments.length > 3 ? arguments[3] : void 0;
1127
+ function calculateStartAndEndForBetween(config) {
1128
+ var addFn = config.addFn, tmp = config.distance, betweenDistance = tmp === void 0 ? 0 : tmp, startOfFn = config.startOfFn, endOfFn = config.endOfFn;
1066
1129
  var preStart;
1067
1130
  var preEnd;
1068
- switch(distance){
1131
+ switch(betweenDistance){
1069
1132
  case 0:
1070
1133
  preStart = date;
1071
1134
  preEnd = date;
1072
1135
  break;
1073
1136
  default:
1074
- var hasNegativeDistance = distance < 0;
1075
- if (hasNegativeDistance) {
1076
- preStart = addFn(date, distance);
1077
- preEnd = date;
1078
- } else {
1079
- preStart = date;
1080
- preEnd = addFn(date, distance);
1137
+ {
1138
+ var hasNegativeDistance = betweenDistance < 0;
1139
+ if (hasNegativeDistance) {
1140
+ preStart = addFn(date, betweenDistance);
1141
+ preEnd = date;
1142
+ } else {
1143
+ preStart = date;
1144
+ preEnd = addFn(date, betweenDistance);
1145
+ }
1146
+ break;
1081
1147
  }
1082
- break;
1083
1148
  }
1084
1149
  start = startOfFn(preStart);
1085
1150
  end = endOfFn(preEnd);
@@ -1101,19 +1166,44 @@ var DateRangeType;
1101
1166
  calculateStartAndEndForDate(startOfMinute, endOfMinute);
1102
1167
  break;
1103
1168
  case DateRangeType.MINUTES_RANGE:
1104
- calculateStartAndEndForBetween(addMinutes, rawDistance, startOfMinute, endOfMinute);
1169
+ calculateStartAndEndForBetween({
1170
+ addFn: addMinutes,
1171
+ distance: rawDistance,
1172
+ startOfFn: startOfMinute,
1173
+ endOfFn: endOfMinute
1174
+ });
1105
1175
  break;
1106
1176
  case DateRangeType.HOURS_RANGE:
1107
- calculateStartAndEndForBetween(addHours, rawDistance, startOfHour, endOfHour);
1177
+ calculateStartAndEndForBetween({
1178
+ addFn: addHours,
1179
+ distance: rawDistance,
1180
+ startOfFn: startOfHour,
1181
+ endOfFn: endOfHour
1182
+ });
1108
1183
  break;
1109
1184
  case DateRangeType.DAYS_RANGE:
1110
- calculateStartAndEndForBetween(addDays, rawDistance, startOfDay, endOfDay);
1185
+ calculateStartAndEndForBetween({
1186
+ addFn: addDays,
1187
+ distance: rawDistance,
1188
+ startOfFn: startOfDay,
1189
+ endOfFn: endOfDay
1190
+ });
1111
1191
  break;
1112
1192
  case DateRangeType.WEEKS_RANGE:
1113
- calculateStartAndEndForBetween(addWeeks, rawDistance, startOfWeek, endOfWeek);
1193
+ calculateStartAndEndForBetween({
1194
+ addFn: addWeeks,
1195
+ distance: rawDistance,
1196
+ startOfFn: startOfWeek,
1197
+ endOfFn: endOfWeek
1198
+ });
1114
1199
  break;
1115
1200
  case DateRangeType.MONTHS_RANGE:
1116
- calculateStartAndEndForBetween(addMonths, rawDistance, startOfMonth, endOfMonth);
1201
+ calculateStartAndEndForBetween({
1202
+ addFn: addMonths,
1203
+ distance: rawDistance,
1204
+ startOfFn: startOfMonth,
1205
+ endOfFn: endOfMonth
1206
+ });
1117
1207
  break;
1118
1208
  case DateRangeType.MINUTES_RADIUS:
1119
1209
  distance = Math.abs(distance);
@@ -1136,10 +1226,12 @@ var DateRangeType;
1136
1226
  end = addDays(date, distance * 7);
1137
1227
  break;
1138
1228
  case DateRangeType.CALENDAR_MONTH:
1139
- var monthStart = startOfMonth(endOfWeek(date));
1140
- start = startOfWeek(monthStart);
1141
- end = endOfWeek(endOfMonth(monthStart));
1142
- break;
1229
+ {
1230
+ var monthStart = startOfMonth(endOfWeek(date));
1231
+ start = startOfWeek(monthStart);
1232
+ end = endOfWeek(endOfMonth(monthStart));
1233
+ break;
1234
+ }
1143
1235
  default:
1144
1236
  throw new Error("Unknown date range type: ".concat(type));
1145
1237
  }
@@ -1152,6 +1244,9 @@ var DateRangeType;
1152
1244
  * Returns a range spanning the full calendar day (first to last millisecond) of the given date.
1153
1245
  * Convenience wrapper around {@link dateRange} with {@link DateRangeType.DAY}.
1154
1246
  *
1247
+ * @param date - the date whose full day range to return
1248
+ * @returns a DateRange from start of day to end of day
1249
+ *
1155
1250
  * @example
1156
1251
  * ```ts
1157
1252
  * const range = dateRangeFromStartAndEndOfDay(new Date('2024-06-15T14:30:00'));
@@ -1190,6 +1285,8 @@ var DEFAULT_ITERATE_DAYS_IN_DATE_RANGE_MAX_ITERATIONS = 4000;
1190
1285
  * Creates a reusable function that iterates over dates within a range using a configurable step function.
1191
1286
  * Supports max iteration limits and early bail-out via {@link endItreateDaysInDateRangeEarly}.
1192
1287
  *
1288
+ * @param input - configuration or a step function for advancing between dates
1289
+ * @returns a reusable iteration function
1193
1290
  * @throws Error if max iterations is exceeded and throwErrorOnMaxIterations is true
1194
1291
  *
1195
1292
  * @example
@@ -1243,6 +1340,8 @@ var DEFAULT_EXPAND_DAYS_FOR_DATE_RANGE_MAX_EXPANSION_SIZE = 1500;
1243
1340
  * Creates a reusable function that expands a {@link DateRange} into an array of individual day dates.
1244
1341
  * Includes a configurable safety limit to prevent accidental memory exhaustion from large ranges.
1245
1342
  *
1343
+ * @param config - optional configuration for the max expansion size
1344
+ * @returns a function that expands a DateRange into an array of Dates
1246
1345
  * @throws Error if the range spans more days than the configured maxExpansionSize
1247
1346
  *
1248
1347
  * @example
@@ -1272,6 +1371,9 @@ var DEFAULT_EXPAND_DAYS_FOR_DATE_RANGE_MAX_EXPANSION_SIZE = 1500;
1272
1371
  * Expands a {@link DateRange} into an array of one Date per day. Uses the default max expansion size.
1273
1372
  * Convenience wrapper around {@link expandDaysForDateRangeFunction}.
1274
1373
  *
1374
+ * @param range - the date range to expand
1375
+ * @returns an array of Dates, one per day in the range
1376
+ *
1275
1377
  * @example
1276
1378
  * ```ts
1277
1379
  * const days = expandDaysForDateRange({ start: new Date('2024-01-01'), end: new Date('2024-01-03') });
@@ -1283,6 +1385,12 @@ var DEFAULT_EXPAND_DAYS_FOR_DATE_RANGE_MAX_EXPANSION_SIZE = 1500;
1283
1385
  /**
1284
1386
  * Determines whether the current moment (or provided `now`) falls before, within, or after the given range.
1285
1387
  *
1388
+ * @param dateRange - the date range to compare against
1389
+ * @param dateRange.start - the start of the range
1390
+ * @param dateRange.end - the end of the range
1391
+ * @param now - the reference date, defaults to the current moment
1392
+ * @returns 'past', 'present', or 'future'
1393
+ *
1286
1394
  * @example
1287
1395
  * ```ts
1288
1396
  * const range = { start: new Date('2024-01-01'), end: new Date('2024-12-31') };
@@ -1305,6 +1413,10 @@ var DEFAULT_EXPAND_DAYS_FOR_DATE_RANGE_MAX_EXPANSION_SIZE = 1500;
1305
1413
  /**
1306
1414
  * Groups an array of date ranges into past, present, and future buckets based on the current moment (or provided `now`).
1307
1415
  *
1416
+ * @param dateRanges - the date ranges to group
1417
+ * @param _now - the reference date, defaults to the current moment
1418
+ * @returns an object with past, present, and future arrays
1419
+ *
1308
1420
  * @example
1309
1421
  * ```ts
1310
1422
  * const ranges = [
@@ -1323,6 +1435,10 @@ var DEFAULT_EXPAND_DAYS_FOR_DATE_RANGE_MAX_EXPANSION_SIZE = 1500;
1323
1435
  * Checks whether a date falls within a (possibly partial) date range.
1324
1436
  * Convenience wrapper around {@link isDateInDateRangeFunction}.
1325
1437
  *
1438
+ * @param date - the date to test
1439
+ * @param dateRange - the range to test against
1440
+ * @returns true if the date falls within the range
1441
+ *
1326
1442
  * @example
1327
1443
  * ```ts
1328
1444
  * const range = { start: new Date('2024-01-01'), end: new Date('2024-12-31') };
@@ -1337,6 +1453,9 @@ var DEFAULT_EXPAND_DAYS_FOR_DATE_RANGE_MAX_EXPANSION_SIZE = 1500;
1337
1453
  * Handles partial ranges: if only start is set, checks >= start; if only end, checks <= end;
1338
1454
  * if neither, all dates are considered in range.
1339
1455
  *
1456
+ * @param dateRange - the boundary range to test against
1457
+ * @returns a function that tests whether a date falls within the range
1458
+ *
1340
1459
  * @example
1341
1460
  * ```ts
1342
1461
  * const isInQ1 = isDateInDateRangeFunction({
@@ -1371,7 +1490,7 @@ var DEFAULT_EXPAND_DAYS_FOR_DATE_RANGE_MAX_EXPANSION_SIZE = 1500;
1371
1490
  return time <= endTime1;
1372
1491
  };
1373
1492
  } else {
1374
- fn = function fn(input) {
1493
+ fn = function fn(_input) {
1375
1494
  return true;
1376
1495
  };
1377
1496
  }
@@ -1382,6 +1501,10 @@ var DEFAULT_EXPAND_DAYS_FOR_DATE_RANGE_MAX_EXPANSION_SIZE = 1500;
1382
1501
  * Checks whether a date range is fully contained within another (possibly partial) date range.
1383
1502
  * Convenience wrapper around {@link isDateRangeInDateRangeFunction}.
1384
1503
  *
1504
+ * @param compareDateRange - the range to test for containment
1505
+ * @param dateRange - the boundary range
1506
+ * @returns true if compareDateRange is fully within dateRange
1507
+ *
1385
1508
  * @example
1386
1509
  * ```ts
1387
1510
  * const outer = { start: new Date('2024-01-01'), end: new Date('2024-12-31') };
@@ -1395,6 +1518,9 @@ var DEFAULT_EXPAND_DAYS_FOR_DATE_RANGE_MAX_EXPANSION_SIZE = 1500;
1395
1518
  * Creates a reusable function that tests whether a given date range is fully contained within
1396
1519
  * the configured boundary range. Both start and end of the input must be within bounds.
1397
1520
  *
1521
+ * @param dateRange - the boundary range
1522
+ * @returns a function that tests containment of other ranges
1523
+ *
1398
1524
  * @example
1399
1525
  * ```ts
1400
1526
  * const isInYear = isDateRangeInDateRangeFunction({
@@ -1416,6 +1542,10 @@ var DEFAULT_EXPAND_DAYS_FOR_DATE_RANGE_MAX_EXPANSION_SIZE = 1500;
1416
1542
  * Checks whether two date ranges overlap in any way (partial or full).
1417
1543
  * Convenience wrapper around {@link dateRangeOverlapsDateRangeFunction}.
1418
1544
  *
1545
+ * @param compareDateRange - the range to test for overlap
1546
+ * @param dateRange - the reference range
1547
+ * @returns true if the ranges overlap
1548
+ *
1419
1549
  * @example
1420
1550
  * ```ts
1421
1551
  * const a = { start: new Date('2024-01-01'), end: new Date('2024-06-30') };
@@ -1429,6 +1559,9 @@ var DEFAULT_EXPAND_DAYS_FOR_DATE_RANGE_MAX_EXPANSION_SIZE = 1500;
1429
1559
  * Creates a reusable function that tests whether input ranges overlap the configured boundary range.
1430
1560
  * Two ranges overlap if one starts before the other ends, and vice versa.
1431
1561
  *
1562
+ * @param dateRange - the boundary range to test overlap against
1563
+ * @returns a function that tests overlap of other ranges
1564
+ *
1432
1565
  * @example
1433
1566
  * ```ts
1434
1567
  * const overlapsQ1 = dateRangeOverlapsDateRangeFunction({
@@ -1460,6 +1593,9 @@ var DEFAULT_EXPAND_DAYS_FOR_DATE_RANGE_MAX_EXPANSION_SIZE = 1500;
1460
1593
  *
1461
1594
  * Operates in UTC, so daylight savings transitions are not considered.
1462
1595
  *
1596
+ * @param dateRange - the date range to fit into a single day period
1597
+ * @returns a new date range with the same start and an end within 24 hours of start
1598
+ *
1463
1599
  * @example
1464
1600
  * ```ts
1465
1601
  * // 10AM to 1PM across 3 days becomes same-day 10AM to 1PM
@@ -1487,6 +1623,9 @@ var DEFAULT_EXPAND_DAYS_FOR_DATE_RANGE_MAX_EXPANSION_SIZE = 1500;
1487
1623
  * Dates before start are clamped to start; dates after end are clamped to end.
1488
1624
  * Partial ranges clamp only on the side that is defined.
1489
1625
  *
1626
+ * @param dateRange - the boundary range for clamping
1627
+ * @returns a function that clamps dates to the range
1628
+ *
1490
1629
  * @example
1491
1630
  * ```ts
1492
1631
  * const clamp = clampDateFunction({
@@ -1502,15 +1641,16 @@ var DEFAULT_EXPAND_DAYS_FOR_DATE_RANGE_MAX_EXPANSION_SIZE = 1500;
1502
1641
  var hasStartDate = dateRange.start != null;
1503
1642
  var hasEndDate = dateRange.end != null;
1504
1643
  if (hasStartDate || hasEndDate) {
1644
+ var _ref, _ref1;
1505
1645
  var _dateRange_start, _dateRange_end;
1506
1646
  // Start Clamp
1507
- var startTime = ((_dateRange_start = dateRange.start) === null || _dateRange_start === void 0 ? void 0 : _dateRange_start.getTime()) || 0;
1647
+ var startTime = (_ref = (_dateRange_start = dateRange.start) === null || _dateRange_start === void 0 ? void 0 : _dateRange_start.getTime()) !== null && _ref !== void 0 ? _ref : 0;
1508
1648
  var clampStart = function clampStart(input) {
1509
1649
  var time = input.getTime();
1510
1650
  return time >= startTime ? input : dateRange.start;
1511
1651
  };
1512
1652
  // End Clamp
1513
- var endTime = ((_dateRange_end = dateRange.end) === null || _dateRange_end === void 0 ? void 0 : _dateRange_end.getTime()) || 0;
1653
+ var endTime = (_ref1 = (_dateRange_end = dateRange.end) === null || _dateRange_end === void 0 ? void 0 : _dateRange_end.getTime()) !== null && _ref1 !== void 0 ? _ref1 : 0;
1514
1654
  var clampEnd = function clampEnd(input) {
1515
1655
  var time = input.getTime();
1516
1656
  return time <= endTime ? input : dateRange.end;
@@ -1540,6 +1680,10 @@ var DEFAULT_EXPAND_DAYS_FOR_DATE_RANGE_MAX_EXPANSION_SIZE = 1500;
1540
1680
  * Clamps a single date to fall within the given range boundaries.
1541
1681
  * Convenience wrapper around {@link clampDateFunction}.
1542
1682
  *
1683
+ * @param date - the date to clamp
1684
+ * @param dateRange - the boundary range
1685
+ * @returns the clamped date
1686
+ *
1543
1687
  * @example
1544
1688
  * ```ts
1545
1689
  * const range = { start: new Date('2024-01-01'), end: new Date('2024-12-31') };
@@ -1567,6 +1711,10 @@ function clampDateRangeFunction(dateRange) {
1567
1711
  * Clamps a date range to fit within a boundary range.
1568
1712
  * Convenience wrapper around {@link clampDateRangeFunction}.
1569
1713
  *
1714
+ * @param inputDateRange - the date range to clamp
1715
+ * @param limitToDateRange - the boundary range
1716
+ * @returns the clamped date range
1717
+ *
1570
1718
  * @example
1571
1719
  * ```ts
1572
1720
  * const input = { start: new Date('2023-06-01'), end: new Date('2024-06-30') };
@@ -1580,6 +1728,9 @@ function clampDateRangeFunction(dateRange) {
1580
1728
  /**
1581
1729
  * Creates a function that applies a date transformation to both start and end of a {@link DateRange}.
1582
1730
  *
1731
+ * @param transform - the transformation to apply to both dates
1732
+ * @returns a function that transforms both dates of a DateRange
1733
+ *
1583
1734
  * @example
1584
1735
  * ```ts
1585
1736
  * import { startOfHour } from 'date-fns';
@@ -1603,6 +1754,9 @@ function clampDateRangeFunction(dateRange) {
1603
1754
  * Returns each unique day of the week present in the range, in the order they appear starting from
1604
1755
  * the range's start day. For ranges spanning 7+ days, returns all days of the week.
1605
1756
  *
1757
+ * @param dateRange - the date range to inspect
1758
+ * @returns an array of unique day-of-week values present in the range
1759
+ *
1606
1760
  * @example
1607
1761
  * ```ts
1608
1762
  * // Wednesday through Friday
@@ -1766,8 +1920,11 @@ function _type_of$6(obj) {
1766
1920
  * isValidDateTimezoneConversionConfig({ timezone: 'America/Chicago' }); // true
1767
1921
  * isValidDateTimezoneConversionConfig({}); // false
1768
1922
  * ```
1923
+ *
1924
+ * @param input - the conversion config to validate
1925
+ * @returns true if the config has at least one meaningful conversion property set
1769
1926
  */ function isValidDateTimezoneConversionConfig(input) {
1770
- return input.useSystemTimezone || input.timezone != null || input.timezoneOffset != null || input.noConversion || false;
1927
+ return input.useSystemTimezone === true || input.timezone != null || input.timezoneOffset != null || input.noConversion === true;
1771
1928
  }
1772
1929
  /**
1773
1930
  * Compares two configs for logical equivalence, accounting for the fact that
@@ -1778,12 +1935,16 @@ function _type_of$6(obj) {
1778
1935
  * isSameDateTimezoneConversionConfig({ timezone: 'UTC' }, { timezone: undefined }); // true
1779
1936
  * isSameDateTimezoneConversionConfig({ useSystemTimezone: true }, { timezone: 'America/Denver' }); // false
1780
1937
  * ```
1938
+ *
1939
+ * @param a - first conversion config to compare
1940
+ * @param b - second conversion config to compare
1941
+ * @returns true if both configs are logically equivalent
1781
1942
  */ function isSameDateTimezoneConversionConfig(a, b) {
1782
1943
  var isSame = false;
1783
1944
  if (a.useSystemTimezone || b.useSystemTimezone || a.timezoneOffset || b.timezoneOffset) {
1784
1945
  isSame = isSameNonNullValue(a.useSystemTimezone, b.useSystemTimezone) || isSameNonNullValue(a.timezoneOffset, b.timezoneOffset);
1785
1946
  } else {
1786
- isSame = isConsideredUtcTimezoneString(a.timezone) && isConsideredUtcTimezoneString(b.timezone) || a != null && a === b;
1947
+ isSame = isConsideredUtcTimezoneString(a.timezone) && isConsideredUtcTimezoneString(b.timezone) || a === b;
1787
1948
  }
1788
1949
  return isSame;
1789
1950
  }
@@ -1802,6 +1963,7 @@ function _type_of$6(obj) {
1802
1963
  * ```
1803
1964
  *
1804
1965
  * @param date - required to determine the correct offset for that instant (DST-aware)
1966
+ * @returns the system timezone UTC offset in milliseconds
1805
1967
  */ function getCurrentSystemOffsetInMs(date) {
1806
1968
  // Use native getTimezoneOffset() instead of calculateTimezoneOffset() to avoid
1807
1969
  // a DST edge case where toZonedTime() creates an epoch that lands on the system's
@@ -1818,6 +1980,7 @@ function _type_of$6(obj) {
1818
1980
  * ```
1819
1981
  *
1820
1982
  * @param date - required to determine the correct offset for that instant (DST-aware)
1983
+ * @returns the system timezone UTC offset truncated to whole hours
1821
1984
  */ function getCurrentSystemOffsetInHours(date) {
1822
1985
  return millisecondsToHours(getCurrentSystemOffsetInMs(date));
1823
1986
  }
@@ -1834,6 +1997,7 @@ function _type_of$6(obj) {
1834
1997
  * ```
1835
1998
  *
1836
1999
  * @param date - required to determine the correct offset for that instant (DST-aware)
2000
+ * @returns the system timezone UTC offset in minutes
1837
2001
  */ function getCurrentSystemOffsetInMinutes(date) {
1838
2002
  return millisecondsToMinutes(getCurrentSystemOffsetInMs(date));
1839
2003
  }
@@ -1854,6 +2018,7 @@ function _type_of$6(obj) {
1854
2018
  *
1855
2019
  * @param timezone - IANA timezone string (e.g. 'America/New_York')
1856
2020
  * @param date - the instant to evaluate, since DST may shift the offset
2021
+ * @returns the UTC offset for the given timezone at the given instant, in milliseconds
1857
2022
  */ function calculateTimezoneOffset(timezone, date) {
1858
2023
  var tzOffset;
1859
2024
  // UTC always has zero offset; skip toZonedTime which can produce wrong results
@@ -1880,7 +2045,15 @@ function _type_of$6(obj) {
1880
2045
  }
1881
2046
  return tzOffset;
1882
2047
  }
1883
- function calculateAllConversions(date, converter) {
2048
+ /**
2049
+ * Calculates offset values for every pair of conversion targets (target, base, system)
2050
+ * and returns them as a keyed map (e.g. `'target-base'`, `'base-system'`).
2051
+ *
2052
+ * @param date - the reference date used to compute offsets
2053
+ * @param converter - the converter instance providing offset calculations
2054
+ * @param map - optional mapping function applied to each raw millisecond offset
2055
+ * @returns a map of conversion-pair keys to their computed offset values
2056
+ */ function calculateAllConversions(date, converter) {
1884
2057
  var map = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : function(x) {
1885
2058
  return x;
1886
2059
  };
@@ -1907,6 +2080,9 @@ function calculateAllConversions(date, converter) {
1907
2080
  * inverseDateTimezoneUtcNormalInstanceTransformType('targetDateToBaseDate'); // 'baseDateToTargetDate'
1908
2081
  * inverseDateTimezoneUtcNormalInstanceTransformType('systemDateToTargetDate'); // 'targetDateToSystemDate'
1909
2082
  * ```
2083
+ *
2084
+ * @param input - the transform type to invert
2085
+ * @returns the inverse transform type for round-trip conversion
1910
2086
  */ function inverseDateTimezoneUtcNormalInstanceTransformType(input) {
1911
2087
  var result;
1912
2088
  switch(input){
@@ -1928,6 +2104,8 @@ function calculateAllConversions(date, converter) {
1928
2104
  case 'targetDateToSystemDate':
1929
2105
  result = 'systemDateToTargetDate';
1930
2106
  break;
2107
+ default:
2108
+ throw new Error("Unexpected transform type: ".concat(input));
1931
2109
  }
1932
2110
  return result;
1933
2111
  }
@@ -1959,8 +2137,7 @@ function calculateAllConversions(date, converter) {
1959
2137
  };
1960
2138
  };
1961
2139
  var calculateOffset = function calculateOffset(date) {
1962
- var offset = getOffsetInMsFn(date);
1963
- return offset;
2140
+ return getOffsetInMsFn(date);
1964
2141
  };
1965
2142
  var calculateSystemNormalDifference = function calculateSystemNormalDifference(date) {
1966
2143
  var normalOffset = calculateOffset(date);
@@ -2069,12 +2246,11 @@ function calculateAllConversions(date, converter) {
2069
2246
  * For example, when daylight savings changed on November 3, 2024 the offset returned was 5 but to get back to the original an offset of 6 was required.
2070
2247
  * This is where some contextual data was not being used. This function uses that contextual data to make sure the reverse will be consistent.
2071
2248
  *
2072
- * @param baseDate The base date. Should have been derived from the originalContextDate using the convertDate() function
2073
- * @param originalContextDate Original date used to derive the baseDate.
2074
- * @param fromOrTo the "type" of date the originalContextDate is
2249
+ * @param config - configuration for the safe mirrored conversion
2250
+ * @returns the converted date and the DST offset adjustment applied
2075
2251
  */ key: "safeMirroredConvertDate",
2076
- value: function safeMirroredConvertDate(baseDate, originalContextDate, contextType) {
2077
- var safeConvert = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : true;
2252
+ value: function safeMirroredConvertDate(config) {
2253
+ var baseDate = config.baseDate, originalContextDate = config.originalContextDate, contextType = config.contextType, _config_safeConvert = config.safeConvert, safeConvert = _config_safeConvert === void 0 ? true : _config_safeConvert;
2078
2254
  if (contextType === 'base') {
2079
2255
  return {
2080
2256
  date: baseDate,
@@ -2237,7 +2413,8 @@ function calculateAllConversions(date, converter) {
2237
2413
  /**
2238
2414
  * Returns true if the input is midnight in the target timezone.
2239
2415
  *
2240
- * @param date
2416
+ * @param date - the date to check
2417
+ * @returns true if the date is at the start of the day in the target timezone
2241
2418
  */ key: "isStartOfDayInTargetTimezone",
2242
2419
  value: function isStartOfDayInTargetTimezone(date) {
2243
2420
  var utcNormal = this.baseDateToTargetDate(date);
@@ -2248,7 +2425,8 @@ function calculateAllConversions(date, converter) {
2248
2425
  /**
2249
2426
  * Start of the given day in the target timezone.
2250
2427
  *
2251
- * @param date The input is treated as an instant in time.
2428
+ * @param date - the input is treated as an instant in time
2429
+ * @returns the start-of-day date in the target timezone
2252
2430
  */ key: "startOfDayInTargetTimezone",
2253
2431
  value: function startOfDayInTargetTimezone(date) {
2254
2432
  var baseDay = this.startOfDayInBaseDate(date);
@@ -2259,7 +2437,8 @@ function calculateAllConversions(date, converter) {
2259
2437
  /**
2260
2438
  * Start of the given day in UTC.
2261
2439
  *
2262
- * @param date
2440
+ * @param date - the date or ISO8601 day string to get the start of day for
2441
+ * @returns the start of the day as a BaseDateAsUTC
2263
2442
  */ key: "startOfDayInBaseDate",
2264
2443
  value: function startOfDayInBaseDate(date) {
2265
2444
  if (typeof date === 'string') {
@@ -2274,8 +2453,8 @@ function calculateAllConversions(date, converter) {
2274
2453
  /**
2275
2454
  * End of the given day in UTC.
2276
2455
  *
2277
- * @param date
2278
- * @returns
2456
+ * @param date - the date or ISO8601 day string to get the end of day for
2457
+ * @returns the end of the day as a BaseDateAsUTC (23:59:59.999)
2279
2458
  */ key: "endOfDayInBaseDate",
2280
2459
  value: function endOfDayInBaseDate(date) {
2281
2460
  var result = this.startOfDayInBaseDate(date);
@@ -2287,8 +2466,8 @@ function calculateAllConversions(date, converter) {
2287
2466
  /**
2288
2467
  * Start of the given day for the system.
2289
2468
  *
2290
- * @param date
2291
- * @returns
2469
+ * @param date - the date or ISO8601 day string to get the start of day for
2470
+ * @returns the start of the day in the system timezone
2292
2471
  */ key: "startOfDayInSystemDate",
2293
2472
  value: function startOfDayInSystemDate(date) {
2294
2473
  if (typeof date === 'string') {
@@ -2303,8 +2482,8 @@ function calculateAllConversions(date, converter) {
2303
2482
  /**
2304
2483
  * End of the given day for the system.
2305
2484
  *
2306
- * @param date
2307
- * @returns
2485
+ * @param date - the date or ISO8601 day string to get the end of day for
2486
+ * @returns the end of the day in the system timezone
2308
2487
  */ key: "endOfDayInSystemDate",
2309
2488
  value: function endOfDayInSystemDate(date) {
2310
2489
  return endOfDay(this.startOfDayInSystemDate(date));
@@ -2312,9 +2491,10 @@ function calculateAllConversions(date, converter) {
2312
2491
  },
2313
2492
  {
2314
2493
  /**
2315
- * Whether or not the system experiences daylight savings for the given year.
2494
+ * Whether or not the target timezone experiences daylight savings for the given year.
2316
2495
  *
2317
- * @param year
2496
+ * @param year - the year to check, as a Date or number; defaults to the current year
2497
+ * @returns true if the target timezone has different offsets in January and July
2318
2498
  */ key: "targetTimezoneExperiencesDaylightSavings",
2319
2499
  value: function targetTimezoneExperiencesDaylightSavings() {
2320
2500
  var year = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : new Date();
@@ -2371,6 +2551,8 @@ function calculateAllConversions(date, converter) {
2371
2551
  * const same = dateTimezoneUtcNormal(denver); // same reference
2372
2552
  * ```
2373
2553
  *
2554
+ * @param config - timezone input: an existing instance, timezone string, millisecond offset, or config object
2555
+ * @returns a DateTimezoneUtcNormalInstance for the given input
2374
2556
  * @throws Error if the input type is not recognized
2375
2557
  */ function dateTimezoneUtcNormal(config) {
2376
2558
  var instance;
@@ -2393,7 +2575,7 @@ function calculateAllConversions(date, converter) {
2393
2575
  });
2394
2576
  break;
2395
2577
  default:
2396
- throw new Error('Invalid input passed to dateTimezoneUtcNormal()');
2578
+ throw new Error('Invalid input type "'.concat(type, '" passed to dateTimezoneUtcNormal()'));
2397
2579
  }
2398
2580
  }
2399
2581
  return instance;
@@ -2416,6 +2598,8 @@ function calculateAllConversions(date, converter) {
2416
2598
  *
2417
2599
  * Prefer this over constructing a new instance when you need system-timezone conversions,
2418
2600
  * as the singleton avoids unnecessary allocations.
2601
+ *
2602
+ * @returns the shared system-timezone DateTimezoneUtcNormalInstance singleton
2419
2603
  */ function systemDateTimezoneUtcNormal() {
2420
2604
  return SYSTEM_DATE_TIMEZONE_UTC_NORMAL_INSTANCE;
2421
2605
  }
@@ -2432,10 +2616,13 @@ function calculateAllConversions(date, converter) {
2432
2616
  * const target = baseDateToTargetDate(base, 'America/Denver');
2433
2617
  * // target is 2024-06-15T14:00:00.000-06:00 (2PM MDT)
2434
2618
  * ```
2619
+ *
2620
+ * @param date - the BaseDateAsUTC to convert
2621
+ * @param timezone - the target IANA timezone string
2622
+ * @returns a real instant in the specified timezone
2435
2623
  */ function baseDateToTargetDate(date, timezone) {
2436
2624
  var instance = new DateTimezoneUtcNormalInstance(timezone);
2437
- var result = instance.baseDateToTargetDate(date);
2438
- return result;
2625
+ return instance.baseDateToTargetDate(date);
2439
2626
  }
2440
2627
  /**
2441
2628
  * Convenience function that strips the timezone offset from a target-timezone date,
@@ -2450,30 +2637,46 @@ function calculateAllConversions(date, converter) {
2450
2637
  * const base = targetDateToBaseDate(target, 'America/Denver');
2451
2638
  * // base is 2024-06-15T14:00:00.000Z — wall-clock 2PM preserved as UTC
2452
2639
  * ```
2640
+ *
2641
+ * @param date - the target-timezone date to convert
2642
+ * @param timezone - the IANA timezone the date is expressed in
2643
+ * @returns a BaseDateAsUTC with wall-clock time preserved as UTC
2453
2644
  */ function targetDateToBaseDate(date, timezone) {
2454
2645
  return new DateTimezoneUtcNormalInstance(timezone).targetDateToBaseDate(date);
2455
2646
  }
2456
2647
  /**
2457
2648
  * Converts a {@link BaseDateAsUTC} to a target date in the system's local timezone
2458
2649
  * using the shared system-timezone instance.
2650
+ *
2651
+ * @param date - the BaseDateAsUTC to convert
2652
+ * @returns the date converted to the system's local timezone
2459
2653
  */ function systemBaseDateToNormalDate(date) {
2460
2654
  return SYSTEM_DATE_TIMEZONE_UTC_NORMAL_INSTANCE.baseDateToTargetDate(date);
2461
2655
  }
2462
2656
  /**
2463
2657
  * Converts a target date in the system's local timezone back to a {@link BaseDateAsUTC}
2464
2658
  * using the shared system-timezone instance.
2659
+ *
2660
+ * @param date - the system-timezone target date to convert back to base
2661
+ * @returns the corresponding BaseDateAsUTC
2465
2662
  */ function systemNormalDateToBaseDate(date) {
2466
2663
  return SYSTEM_DATE_TIMEZONE_UTC_NORMAL_INSTANCE.targetDateToBaseDate(date);
2467
2664
  }
2468
2665
  /**
2469
2666
  * Returns the millisecond offset needed to convert a {@link BaseDateAsUTC} to a target date
2470
2667
  * in the system's local timezone.
2668
+ *
2669
+ * @param date - the date to compute the offset for
2670
+ * @returns the offset in milliseconds
2471
2671
  */ function systemBaseDateToNormalDateOffset(date) {
2472
2672
  return SYSTEM_DATE_TIMEZONE_UTC_NORMAL_INSTANCE.baseDateToTargetDateOffset(date);
2473
2673
  }
2474
2674
  /**
2475
2675
  * Returns the millisecond offset needed to convert a target date in the system's
2476
2676
  * local timezone back to a {@link BaseDateAsUTC}.
2677
+ *
2678
+ * @param date - the date to compute the offset for
2679
+ * @returns the offset in milliseconds
2477
2680
  */ function systemNormalDateToBaseDateOffset(date) {
2478
2681
  return SYSTEM_DATE_TIMEZONE_UTC_NORMAL_INSTANCE.targetDateToBaseDateOffset(date);
2479
2682
  }
@@ -2481,6 +2684,9 @@ function calculateAllConversions(date, converter) {
2481
2684
  * Returns whether the system's local timezone observes daylight saving time in the given year.
2482
2685
  *
2483
2686
  * Compares the offset on January 1 and July 1; if they differ, DST is in effect for part of the year.
2687
+ *
2688
+ * @param year - the year to check, as a Date
2689
+ * @returns true if the system timezone observes DST in the given year
2484
2690
  */ function systemExperiencesDaylightSavings(year) {
2485
2691
  return SYSTEM_DATE_TIMEZONE_UTC_NORMAL_INSTANCE.targetTimezoneExperiencesDaylightSavings(year);
2486
2692
  }
@@ -2496,7 +2702,9 @@ function calculateAllConversions(date, converter) {
2496
2702
  * const result = fn(someDate, (d) => startOfDay(d));
2497
2703
  * ```
2498
2704
  *
2705
+ * @param timezoneInput - timezone configuration for the conversion
2499
2706
  * @param transformType - defaults to `'systemDateToTargetDate'`
2707
+ * @returns a function that transforms dates within the specified timezone normalization
2500
2708
  */ function transformDateInTimezoneNormalFunction(timezoneInput) {
2501
2709
  var transformType = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 'systemDateToTargetDate';
2502
2710
  var timezoneInstance = dateTimezoneUtcNormal(timezoneInput);
@@ -2515,7 +2723,9 @@ function calculateAllConversions(date, converter) {
2515
2723
  * Creates a {@link TransformDateRangeToTimezoneFunction} that converts both dates in
2516
2724
  * a {@link DateRange} using the specified transform type.
2517
2725
  *
2726
+ * @param timezoneInput - timezone configuration for the conversion
2518
2727
  * @param transformType - defaults to `'systemDateToTargetDate'`
2728
+ * @returns a function that converts DateRange dates using the specified transform
2519
2729
  */ function transformDateRangeToTimezoneFunction(timezoneInput) {
2520
2730
  var transformType = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 'systemDateToTargetDate';
2521
2731
  var timezoneInstance = dateTimezoneUtcNormal(timezoneInput);
@@ -2528,7 +2738,9 @@ function calculateAllConversions(date, converter) {
2528
2738
  * Creates a {@link TransformDateRangeInTimezoneNormalFunction} that converts a date range
2529
2739
  * into the specified date space, applies a user-provided range transformation, then converts back.
2530
2740
  *
2741
+ * @param timezoneInput - timezone configuration for the conversion
2531
2742
  * @param transformType - defaults to `'systemDateToTargetDate'`
2743
+ * @returns a function that transforms date ranges within the specified timezone normalization
2532
2744
  */ function transformDateRangeInTimezoneNormalFunction(timezoneInput) {
2533
2745
  var transformType = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 'systemDateToTargetDate';
2534
2746
  var timezoneInstance = dateTimezoneUtcNormal(timezoneInput);
@@ -2552,6 +2764,9 @@ function calculateAllConversions(date, converter) {
2552
2764
  * const midnight = startOfDayInDenver('2024-06-15');
2553
2765
  * // midnight is 2024-06-15T06:00:00.000Z (midnight MDT = 6AM UTC)
2554
2766
  * ```
2767
+ *
2768
+ * @param timezone - timezone configuration to bind the factory to
2769
+ * @returns a factory that converts ISO8601 day strings to start-of-day dates
2555
2770
  */ function startOfDayInTimezoneDayStringFactory(timezone) {
2556
2771
  var timezoneInstance = dateTimezoneUtcNormal(timezone);
2557
2772
  return function(day) {
@@ -2567,6 +2782,10 @@ function calculateAllConversions(date, converter) {
2567
2782
  * ```ts
2568
2783
  * const midnight = startOfDayInTimezoneFromISO8601DayString('2024-06-15', 'America/Denver');
2569
2784
  * ```
2785
+ *
2786
+ * @param day - the ISO8601 day string to parse
2787
+ * @param timezone - timezone configuration for the start-of-day calculation
2788
+ * @returns the start-of-day instant in the given timezone
2570
2789
  */ function startOfDayInTimezoneFromISO8601DayString(day, timezone) {
2571
2790
  return startOfDayInTimezoneDayStringFactory(timezone)(day);
2572
2791
  }
@@ -2583,6 +2802,9 @@ function calculateAllConversions(date, converter) {
2583
2802
  * const result = setOnDate({ date: someDate, hours: 14, minutes: 30, inputType: 'target' });
2584
2803
  * // result is someDate with hours set to 14:30 in Denver time
2585
2804
  * ```
2805
+ *
2806
+ * @param timezone - the timezone configuration to bind to
2807
+ * @returns a function that sets hours/minutes on dates in the given timezone
2586
2808
  */ function setOnDateWithTimezoneNormalFunction(timezone) {
2587
2809
  var timezoneInstance = dateTimezoneUtcNormal(timezone);
2588
2810
  var fn = function fn(input) {
@@ -2600,7 +2822,7 @@ function calculateAllConversions(date, converter) {
2600
2822
  return roundDownToMinute ? roundDateDownTo(inputDate, 'minute') : inputDate;
2601
2823
  }
2602
2824
  if (inputType !== 'base') {
2603
- copyFrom = copyFrom != null ? timezoneInstance.convertDate(copyFrom, 'base', inputType) : undefined;
2825
+ copyFrom = timezoneInstance.convertDate(copyFrom, 'base', inputType);
2604
2826
  }
2605
2827
  }
2606
2828
  // set baseDate
@@ -2649,6 +2871,7 @@ function calculateAllConversions(date, converter) {
2649
2871
  *
2650
2872
  * @param input - the date whose day is preserved
2651
2873
  * @param timezone - the timezone context for the hour/minute interpretation
2874
+ * @returns the input date with hours and minutes set to the current time in the given timezone
2652
2875
  */ function copyHoursAndMinutesFromNowWithTimezoneNormal(input, timezone) {
2653
2876
  return copyHoursAndMinutesFromDateWithTimezoneNormal(input, 'now', timezone);
2654
2877
  }
@@ -2669,16 +2892,16 @@ function calculateAllConversions(date, converter) {
2669
2892
  * @param input - the date whose day is preserved
2670
2893
  * @param copyFrom - the date (or `'now'`) whose hours/minutes are copied
2671
2894
  * @param timezone - the timezone context for interpreting both dates
2895
+ * @returns the input date with hours and minutes copied from the source
2672
2896
  */ function copyHoursAndMinutesFromDateWithTimezoneNormal(input, copyFrom, timezone) {
2673
2897
  var timezoneInstance = dateTimezoneUtcNormal(timezone);
2674
- var result = timezoneInstance.setOnDate({
2898
+ return timezoneInstance.setOnDate({
2675
2899
  date: input,
2676
2900
  copyFrom: copyFrom,
2677
2901
  inputType: 'target',
2678
2902
  copyHours: true,
2679
2903
  copyMinutes: true
2680
2904
  });
2681
- return result;
2682
2905
  }
2683
2906
 
2684
2907
  function _define_property$e(obj, key, value) {
@@ -2739,6 +2962,7 @@ function _object_spread$c(target) {
2739
2962
  *
2740
2963
  * @param dateRange - the range to fit
2741
2964
  * @param timezone - the timezone for day boundary calculation
2965
+ * @returns the date range fitted to a single day period
2742
2966
  */ function fitDateRangeToDayPeriod(dateRange, timezone) {
2743
2967
  return fitDateRangeToDayPeriodFunction(timezone)(dateRange);
2744
2968
  }
@@ -2749,6 +2973,7 @@ function _object_spread$c(target) {
2749
2973
  * Useful when the same range formatting logic needs to be applied repeatedly with consistent settings.
2750
2974
  *
2751
2975
  * @param inputConfig - format function or full configuration
2976
+ * @returns a reusable function that formats date ranges into strings
2752
2977
  *
2753
2978
  * @example
2754
2979
  * ```ts
@@ -2785,6 +3010,7 @@ function _object_spread$c(target) {
2785
3010
  * @param range - date range to format
2786
3011
  * @param inputConfig - format function or full configuration
2787
3012
  * @param separator - optional separator override when inputConfig is a function
3013
+ * @returns the formatted date range string
2788
3014
  *
2789
3015
  * @example
2790
3016
  * ```ts
@@ -2808,6 +3034,7 @@ function _object_spread$c(target) {
2808
3034
  * (e.g., "3 hours", "about 2 days"). Delegates to date-fns `formatDistance` or `formatDistanceStrict`.
2809
3035
  *
2810
3036
  * @param inputConfig - controls distance formatting, optional transforms, and same-day handling
3037
+ * @returns a reusable function that computes and formats date range distances
2811
3038
  *
2812
3039
  * @example
2813
3040
  * ```ts
@@ -2861,6 +3088,7 @@ function _object_spread$c(target) {
2861
3088
  *
2862
3089
  * @param range - date range to compute distance for
2863
3090
  * @param inputConfig - optional distance formatting configuration
3091
+ * @returns the human-readable distance string
2864
3092
  *
2865
3093
  * @example
2866
3094
  * ```ts
@@ -2901,7 +3129,7 @@ function formatToDayRangeString(startOrDateRange, endOrFormat, inputFormat) {
2901
3129
  end = endOrFormat;
2902
3130
  }
2903
3131
  }
2904
- var format = inputFormat !== null && inputFormat !== void 0 ? inputFormat : formatToShortDateString;
3132
+ var format = inputFormat !== null && inputFormat !== void 0 ? inputFormat : formatToMonthDaySlashDate;
2905
3133
  return formatDateRange(dateOrDateRangeToDateRange(startOrDateRange, end), {
2906
3134
  format: format,
2907
3135
  simplifySameDate: true
@@ -2912,6 +3140,7 @@ function formatToDayRangeString(startOrDateRange, endOrFormat, inputFormat) {
2912
3140
  * instead of throwing.
2913
3141
  *
2914
3142
  * @param input - date, date string, or nullish value
3143
+ * @returns the ISO 8601 date string, or `undefined` if the input is invalid or nullish
2915
3144
  *
2916
3145
  * @example
2917
3146
  * ```ts
@@ -2934,6 +3163,7 @@ function formatToDayRangeString(startOrDateRange, endOrFormat, inputFormat) {
2934
3163
  * Formats a Date to a full ISO 8601 date-time string via `Date.toISOString()`. Defaults to the current date/time.
2935
3164
  *
2936
3165
  * @param date - date to format; defaults to `new Date()`
3166
+ * @returns the full ISO 8601 date-time string
2937
3167
  *
2938
3168
  * @example
2939
3169
  * ```ts
@@ -2953,6 +3183,7 @@ function formatToDayRangeString(startOrDateRange, endOrFormat, inputFormat) {
2953
3183
  * Use {@link toISO8601DayStringForUTC} when the UTC date is needed instead.
2954
3184
  *
2955
3185
  * @param dateOrString - date or existing day string
3186
+ * @returns the ISO 8601 day string in system timezone
2956
3187
  *
2957
3188
  * @example
2958
3189
  * ```ts
@@ -2972,6 +3203,7 @@ function formatToDayRangeString(startOrDateRange, endOrFormat, inputFormat) {
2972
3203
  * Defaults to the current date.
2973
3204
  *
2974
3205
  * @param date - date to format; defaults to `new Date()`
3206
+ * @returns the ISO 8601 day string in system timezone
2975
3207
  *
2976
3208
  * @example
2977
3209
  * ```ts
@@ -2991,6 +3223,7 @@ function formatToDayRangeString(startOrDateRange, endOrFormat, inputFormat) {
2991
3223
  * Use {@link toISO8601DayStringForSystem} when the system-local date is needed instead.
2992
3224
  *
2993
3225
  * @param dateOrString - date or existing day string
3226
+ * @returns the ISO 8601 day string in UTC
2994
3227
  *
2995
3228
  * @example
2996
3229
  * ```ts
@@ -3011,6 +3244,7 @@ function formatToDayRangeString(startOrDateRange, endOrFormat, inputFormat) {
3011
3244
  * Defaults to the current date.
3012
3245
  *
3013
3246
  * @param date - date to format; defaults to `new Date()`
3247
+ * @returns the ISO 8601 day string using UTC date components
3014
3248
  *
3015
3249
  * @example
3016
3250
  * ```ts
@@ -3023,12 +3257,18 @@ function formatToDayRangeString(startOrDateRange, endOrFormat, inputFormat) {
3023
3257
  var date = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : new Date();
3024
3258
  return "".concat(date.getUTCFullYear(), "-").concat((date.getUTCMonth() + 1).toString().padStart(2, '0'), "-").concat(date.getUTCDate().toString().padStart(2, '0'));
3025
3259
  }
3026
- /** date-fns format string for `MM/dd/yyyy` (e.g., `"01/15/2024"`). */ var MONTH_DAY_SLASH_DATE_STRING_FORMAT = 'MM/dd/yyyy';
3027
- /** @deprecated use MONTH_DAY_SLASH_DATE_STRING_FORMAT instead. */ var monthDaySlashDateStringFormat = MONTH_DAY_SLASH_DATE_STRING_FORMAT;
3260
+ /**
3261
+ * date-fns format string for `MM/dd/yyyy` (e.g., `"01/15/2024"`).
3262
+ */ var MONTH_DAY_SLASH_DATE_STRING_FORMAT = 'MM/dd/yyyy';
3263
+ /**
3264
+ * @deprecated Use MONTH_DAY_SLASH_DATE_STRING_FORMAT instead.
3265
+ */ // eslint-disable-next-line @typescript-eslint/naming-convention
3266
+ var monthDaySlashDateStringFormat = MONTH_DAY_SLASH_DATE_STRING_FORMAT;
3028
3267
  /**
3029
3268
  * Formats a Date as a month/day/year slash-separated string (`MM/dd/yyyy`). Defaults to the current date.
3030
3269
  *
3031
3270
  * @param date - date to format; defaults to `new Date()`
3271
+ * @returns the formatted `MM/dd/yyyy` string
3032
3272
  *
3033
3273
  * @example
3034
3274
  * ```ts
@@ -3044,12 +3284,18 @@ function formatToDayRangeString(startOrDateRange, endOrFormat, inputFormat) {
3044
3284
  /**
3045
3285
  * @deprecated use formatToMonthDaySlashDate instead.
3046
3286
  */ var formatToShortDateString = formatToMonthDaySlashDate;
3047
- /** date-fns format string for `MM/dd` (e.g., `"01/15"`). */ var DATE_MONTH_DAY_STRING_FORMAT = 'MM/dd';
3048
- /** @deprecated use DATE_MONTH_DAY_STRING_FORMAT instead. */ var dateMonthDayStringFormat = DATE_MONTH_DAY_STRING_FORMAT;
3287
+ /**
3288
+ * date-fns format string for `MM/dd` (e.g., `"01/15"`).
3289
+ */ var DATE_MONTH_DAY_STRING_FORMAT = 'MM/dd';
3290
+ /**
3291
+ * @deprecated Use DATE_MONTH_DAY_STRING_FORMAT instead.
3292
+ */ // eslint-disable-next-line @typescript-eslint/naming-convention
3293
+ var dateMonthDayStringFormat = DATE_MONTH_DAY_STRING_FORMAT;
3049
3294
  /**
3050
3295
  * Formats a Date as a month/day string (`MM/dd`) without the year. Defaults to the current date.
3051
3296
  *
3052
3297
  * @param date - date to format; defaults to `new Date()`
3298
+ * @returns the formatted `MM/dd` string
3053
3299
  *
3054
3300
  * @example
3055
3301
  * ```ts
@@ -3066,6 +3312,7 @@ function formatToDayRangeString(startOrDateRange, endOrFormat, inputFormat) {
3066
3312
  * Formats a Date as a human-friendly weekday and month/day string (e.g., `"Mon, Jan 15th"`).
3067
3313
  *
3068
3314
  * @param date - date to format
3315
+ * @returns the formatted weekday and month/day string
3069
3316
  *
3070
3317
  * @example
3071
3318
  * ```ts
@@ -3077,12 +3324,18 @@ function formatToDayRangeString(startOrDateRange, endOrFormat, inputFormat) {
3077
3324
  */ function formatToDateString(date) {
3078
3325
  return format$1(date, 'EEE, MMM do');
3079
3326
  }
3080
- /** date-fns format string for 12-hour time with AM/PM (e.g., `"9:00 AM"`). */ var DATE_TIME_STRING_FORMAT = 'h:mm a';
3081
- /** @deprecated use DATE_TIME_STRING_FORMAT instead. */ var dateTimeStringFormat = DATE_TIME_STRING_FORMAT;
3327
+ /**
3328
+ * date-fns format string for 12-hour time with AM/PM (e.g., `"9:00 AM"`).
3329
+ */ var DATE_TIME_STRING_FORMAT = 'h:mm a';
3330
+ /**
3331
+ * @deprecated Use DATE_TIME_STRING_FORMAT instead.
3332
+ */ // eslint-disable-next-line @typescript-eslint/naming-convention
3333
+ var dateTimeStringFormat = DATE_TIME_STRING_FORMAT;
3082
3334
  /**
3083
3335
  * Formats a Date as a 12-hour time string with AM/PM (e.g., `"9:00 AM"`).
3084
3336
  *
3085
3337
  * @param date - date to format
3338
+ * @returns the formatted 12-hour time string with AM/PM
3086
3339
  *
3087
3340
  * @example
3088
3341
  * ```ts
@@ -3094,12 +3347,18 @@ function formatToDayRangeString(startOrDateRange, endOrFormat, inputFormat) {
3094
3347
  */ function formatToTimeString(date) {
3095
3348
  return format$1(date, DATE_TIME_STRING_FORMAT);
3096
3349
  }
3097
- /** Combined date-fns format string for `MM/dd/yyyy h:mm a` (e.g., `"01/15/2024 9:00 AM"`). */ var DATE_SHORT_DATE_AND_TIME_STRING_FORMAT = "".concat(MONTH_DAY_SLASH_DATE_STRING_FORMAT, " ").concat(DATE_TIME_STRING_FORMAT);
3098
- /** @deprecated use DATE_SHORT_DATE_AND_TIME_STRING_FORMAT instead. */ var dateShortDateAndTimeStringFormat = DATE_SHORT_DATE_AND_TIME_STRING_FORMAT;
3350
+ /**
3351
+ * Combined date-fns format string for `MM/dd/yyyy h:mm a` (e.g., `"01/15/2024 9:00 AM"`).
3352
+ */ var DATE_SHORT_DATE_AND_TIME_STRING_FORMAT = "".concat(MONTH_DAY_SLASH_DATE_STRING_FORMAT, " ").concat(DATE_TIME_STRING_FORMAT);
3353
+ /**
3354
+ * @deprecated Use DATE_SHORT_DATE_AND_TIME_STRING_FORMAT instead.
3355
+ */ // eslint-disable-next-line @typescript-eslint/naming-convention
3356
+ var dateShortDateAndTimeStringFormat = DATE_SHORT_DATE_AND_TIME_STRING_FORMAT;
3099
3357
  /**
3100
3358
  * Formats a Date as a short date and time string (e.g., `"01/15/2024 9:00 AM"`).
3101
3359
  *
3102
3360
  * @param date - date to format
3361
+ * @returns the formatted short date and time string
3103
3362
  *
3104
3363
  * @example
3105
3364
  * ```ts
@@ -3117,6 +3376,7 @@ function formatToDayRangeString(startOrDateRange, endOrFormat, inputFormat) {
3117
3376
  *
3118
3377
  * @param start - start date/time
3119
3378
  * @param end - end date/time
3379
+ * @returns the formatted time string with an appended duration indicator
3120
3380
  *
3121
3381
  * @example
3122
3382
  * ```ts
@@ -3138,7 +3398,8 @@ function formatToDayRangeString(startOrDateRange, endOrFormat, inputFormat) {
3138
3398
  includeSeconds: false
3139
3399
  }), ")");
3140
3400
  } else {
3141
- subtitle = "".concat(minutes ? "(".concat(minutes, " Minutes)") : '');
3401
+ var minutesLabel = minutes ? "(".concat(minutes, " Minutes)") : '';
3402
+ subtitle = minutesLabel;
3142
3403
  }
3143
3404
  return "".concat(formatToTimeString(start), " ").concat(subtitle);
3144
3405
  }
@@ -3161,6 +3422,11 @@ function formatToDayRangeString(startOrDateRange, endOrFormat, inputFormat) {
3161
3422
  * formatStartedEndedDistanceString(activeRange);
3162
3423
  * // "started about 1 hour ago"
3163
3424
  * ```
3425
+ *
3426
+ * @param dateRange - date range with start and end dates
3427
+ * @param dateRange.start - the start date of the range
3428
+ * @param dateRange.end - the end date of the range
3429
+ * @returns the relative-time label describing the date range state
3164
3430
  */ function formatStartedEndedDistanceString(param) {
3165
3431
  var start = param.start, end = param.end;
3166
3432
  var state = dateRangeRelativeState({
@@ -3192,6 +3458,7 @@ function formatToDayRangeString(startOrDateRange, endOrFormat, inputFormat) {
3192
3458
  * Useful for converting heterogeneous date inputs into a consistent midnight-aligned Date.
3193
3459
  *
3194
3460
  * @param input - date or day string to normalize
3461
+ * @returns a Date set to midnight of the corresponding day in the system timezone
3195
3462
  *
3196
3463
  * @example
3197
3464
  * ```ts
@@ -3211,6 +3478,7 @@ function formatToDayRangeString(startOrDateRange, endOrFormat, inputFormat) {
3211
3478
  * in the system timezone. Supports year formats with more than 4 digits but does not support negative years.
3212
3479
  *
3213
3480
  * @param dayString - ISO 8601 day or date string to parse
3481
+ * @returns a Date at the start of the parsed day in the system timezone
3214
3482
  *
3215
3483
  * @example
3216
3484
  * ```ts
@@ -3427,6 +3695,11 @@ function _type_of$5(obj) {
3427
3695
  * The end date is used just to determine the number of days, but a minimum of 1 day is always enforced as a DateCellTiming must contain atleast 1 day.
3428
3696
  *
3429
3697
  * The start date from the inputDate is considered to to have the offset noted in DateCell, and will be retained.
3698
+ *
3699
+ * @param durationInput - the duration span containing the startsAt time and event duration in minutes
3700
+ * @param rangeInput - specifies the date range: a number of days, a DateRange, or a DateRangeDayDistanceInput
3701
+ * @param timezoneInput - optional timezone configuration; defaults to the system timezone if omitted
3702
+ * @returns a fully computed FullDateCellTiming with start, startsAt, end, duration, and timezone
3430
3703
  */ function dateCellTiming(durationInput, rangeInput, timezoneInput) {
3431
3704
  var duration = durationInput.duration;
3432
3705
  if (duration > MINUTES_IN_DAY) {
@@ -3481,7 +3754,12 @@ function _type_of$5(obj) {
3481
3754
  var utcDay = formatToISO8601DayStringForUTC(startsAtInUtc);
3482
3755
  var start = normalInstance.startOfDayInTargetTimezone(utcDay);
3483
3756
  var safeMirror = isEqualDate(startsAtInUtc, startsAtInUtcInitial);
3484
- var _normalInstance_safeMirroredConvertDate = normalInstance.safeMirroredConvertDate(startsAtInUtc, inputStartsAt, 'target', safeMirror), startsAt = _normalInstance_safeMirroredConvertDate.date, daylightSavingsOffset = _normalInstance_safeMirroredConvertDate.daylightSavingsOffset;
3757
+ var _normalInstance_safeMirroredConvertDate = normalInstance.safeMirroredConvertDate({
3758
+ baseDate: startsAtInUtc,
3759
+ originalContextDate: inputStartsAt,
3760
+ contextType: 'target',
3761
+ safeConvert: safeMirror
3762
+ }), startsAt = _normalInstance_safeMirroredConvertDate.date, daylightSavingsOffset = _normalInstance_safeMirroredConvertDate.daylightSavingsOffset;
3485
3763
  // calculate end to be the ending date/time of the final duration span
3486
3764
  var lastStartsAtInBaseTimezone = addHours(startsAtInUtc, numberOfDayBlocks * 24 + daylightSavingsOffset); // use addHours instead of addDays, since addDays will take into account a daylight savings change if the system time changes
3487
3765
  var lastStartInTarget = normalInstance.targetDateToBaseDate(lastStartsAtInBaseTimezone);
@@ -3741,8 +4019,16 @@ function _calculateExpectedDateCellTimingDurationPair(timing) {
3741
4019
  var normalInstance = dateTimezoneUtcNormal(timezone);
3742
4020
  var startsAtInUtcNormal = normalInstance.baseDateToTargetDate(startsAt); // convert to UTC normal
3743
4021
  var endInUtcNormal = normalInstance.baseDateToTargetDate(end);
3744
- var _normalInstance_safeMirroredConvertDate = normalInstance.safeMirroredConvertDate(startsAtInUtcNormal, startsAt, 'target'), startDaylightSavingsOffset = _normalInstance_safeMirroredConvertDate.daylightSavingsOffset;
3745
- var _normalInstance_safeMirroredConvertDate1 = normalInstance.safeMirroredConvertDate(endInUtcNormal, end, 'target'), endDaylightSavingsOffset = _normalInstance_safeMirroredConvertDate1.daylightSavingsOffset;
4022
+ var _normalInstance_safeMirroredConvertDate = normalInstance.safeMirroredConvertDate({
4023
+ baseDate: startsAtInUtcNormal,
4024
+ originalContextDate: startsAt,
4025
+ contextType: 'target'
4026
+ }), startDaylightSavingsOffset = _normalInstance_safeMirroredConvertDate.daylightSavingsOffset;
4027
+ var _normalInstance_safeMirroredConvertDate1 = normalInstance.safeMirroredConvertDate({
4028
+ baseDate: endInUtcNormal,
4029
+ originalContextDate: end,
4030
+ contextType: 'target'
4031
+ }), endDaylightSavingsOffset = _normalInstance_safeMirroredConvertDate1.daylightSavingsOffset;
3746
4032
  if (startDaylightSavingsOffset) {
3747
4033
  startsAtInUtcNormal = addHours(startsAtInUtcNormal, startDaylightSavingsOffset);
3748
4034
  }
@@ -3828,7 +4114,7 @@ function _calculateExpectedDateCellTimingDurationPair(timing) {
3828
4114
  isExpectedValidEnd = expectedDuration === duration; // should be the expected duration
3829
4115
  isValid = isExpectedValidEnd;
3830
4116
  }
3831
- var result = {
4117
+ return {
3832
4118
  isValid: isValid,
3833
4119
  endIsAfterTheStartsAtTime: endIsAfterTheStartsAtTime,
3834
4120
  durationGreaterThanZero: durationGreaterThanZero,
@@ -3837,7 +4123,6 @@ function _calculateExpectedDateCellTimingDurationPair(timing) {
3837
4123
  isExpectedValidEnd: isExpectedValidEnd,
3838
4124
  normalInstance: normalInstance
3839
4125
  };
3840
- return result;
3841
4126
  }
3842
4127
  /**
3843
4128
  * Returns true if the {@link DateCellTiming} passes all validation checks.
@@ -3902,13 +4187,13 @@ function _calculateExpectedDateCellTimingDurationPair(timing) {
3902
4187
  return isValid;
3903
4188
  }
3904
4189
 
3905
- function _array_like_to_array$5(arr, len) {
4190
+ function _array_like_to_array$6(arr, len) {
3906
4191
  if (len == null || len > arr.length) len = arr.length;
3907
4192
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
3908
4193
  return arr2;
3909
4194
  }
3910
- function _array_without_holes$2(arr) {
3911
- if (Array.isArray(arr)) return _array_like_to_array$5(arr);
4195
+ function _array_without_holes$4(arr) {
4196
+ if (Array.isArray(arr)) return _array_like_to_array$6(arr);
3912
4197
  }
3913
4198
  function _define_property$c(obj, key, value) {
3914
4199
  if (key in obj) {
@@ -3923,10 +4208,10 @@ function _define_property$c(obj, key, value) {
3923
4208
  }
3924
4209
  return obj;
3925
4210
  }
3926
- function _iterable_to_array$2(iter) {
4211
+ function _iterable_to_array$4(iter) {
3927
4212
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
3928
4213
  }
3929
- function _non_iterable_spread$2() {
4214
+ function _non_iterable_spread$4() {
3930
4215
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
3931
4216
  }
3932
4217
  function _object_spread$a(target) {
@@ -3963,20 +4248,20 @@ function _object_spread_props$8(target, source) {
3963
4248
  }
3964
4249
  return target;
3965
4250
  }
3966
- function _to_consumable_array$2(arr) {
3967
- return _array_without_holes$2(arr) || _iterable_to_array$2(arr) || _unsupported_iterable_to_array$5(arr) || _non_iterable_spread$2();
4251
+ function _to_consumable_array$4(arr) {
4252
+ return _array_without_holes$4(arr) || _iterable_to_array$4(arr) || _unsupported_iterable_to_array$6(arr) || _non_iterable_spread$4();
3968
4253
  }
3969
4254
  function _type_of$4(obj) {
3970
4255
  "@swc/helpers - typeof";
3971
4256
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
3972
4257
  }
3973
- function _unsupported_iterable_to_array$5(o, minLen) {
4258
+ function _unsupported_iterable_to_array$6(o, minLen) {
3974
4259
  if (!o) return;
3975
- if (typeof o === "string") return _array_like_to_array$5(o, minLen);
4260
+ if (typeof o === "string") return _array_like_to_array$6(o, minLen);
3976
4261
  var n = Object.prototype.toString.call(o).slice(8, -1);
3977
4262
  if (n === "Object" && o.constructor) n = o.constructor.name;
3978
4263
  if (n === "Map" || n === "Set") return Array.from(n);
3979
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$5(o, minLen);
4264
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$6(o, minLen);
3980
4265
  }
3981
4266
  /**
3982
4267
  * Returns true if the input is a DateCellRange.
@@ -3984,6 +4269,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
3984
4269
  * Does not check validity. Use {@link isValidDateCellRange} for that.
3985
4270
  *
3986
4271
  * @param input - value to check
4272
+ * @returns true if the input is a DateCellRange
3987
4273
  */ function isDateCellRange(input) {
3988
4274
  return (typeof input === "undefined" ? "undefined" : _type_of$4(input)) === 'object' ? Number.isInteger(input.i) && input.to === undefined || Number.isInteger(input.to) : false;
3989
4275
  }
@@ -3994,6 +4280,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
3994
4280
  * that is greater than or equal to `i`.
3995
4281
  *
3996
4282
  * @param input - range to validate
4283
+ * @returns true if the range has valid non-negative indexes and `to` (when defined) is greater than or equal to `i`
3997
4284
  */ function isValidDateCellRange(input) {
3998
4285
  var i = input.i, to = input.to;
3999
4286
  if (!isValidDateCellIndex(i)) {
@@ -4009,6 +4296,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4009
4296
  * Validates that each range is individually valid and that no ranges overlap or appear out of order.
4010
4297
  *
4011
4298
  * @param input - array of ranges to validate as a non-overlapping ascending series
4299
+ * @returns true if the array is sorted in ascending order with no overlapping or duplicate indexes
4012
4300
  */ function isValidDateCellRangeSeries(input) {
4013
4301
  if (!Array.isArray(input)) {
4014
4302
  return false;
@@ -4020,13 +4308,30 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4020
4308
  return false;
4021
4309
  }
4022
4310
  var greatestIndex = -1;
4023
- for(var i = 0; i < input.length; i += 1){
4024
- var range = input[i];
4025
- if (range.i <= greatestIndex) {
4026
- return false;
4027
- } else {
4028
- var nextGreatestIndex = range.to || range.i; // to is greater than or equal to i in a valid date block range.
4029
- greatestIndex = nextGreatestIndex;
4311
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
4312
+ try {
4313
+ for(var _iterator = input[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
4314
+ var range = _step.value;
4315
+ if (range.i <= greatestIndex) {
4316
+ return false;
4317
+ } else {
4318
+ var _range_to;
4319
+ var nextGreatestIndex = (_range_to = range.to) !== null && _range_to !== void 0 ? _range_to : range.i; // to is greater than or equal to i in a valid date block range.
4320
+ greatestIndex = nextGreatestIndex;
4321
+ }
4322
+ }
4323
+ } catch (err) {
4324
+ _didIteratorError = true;
4325
+ _iteratorError = err;
4326
+ } finally{
4327
+ try {
4328
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
4329
+ _iterator.return();
4330
+ }
4331
+ } finally{
4332
+ if (_didIteratorError) {
4333
+ throw _iteratorError;
4334
+ }
4030
4335
  }
4031
4336
  }
4032
4337
  return true;
@@ -4037,6 +4342,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4037
4342
  * The input range is not expected to be sorted.
4038
4343
  *
4039
4344
  * @param input - unsorted array of date cell ranges to scan
4345
+ * @returns the smallest starting index found, or 0 if the input is empty
4040
4346
  */ function getLeastDateCellIndexInDateCellRanges(input) {
4041
4347
  var _ref;
4042
4348
  var _getLeastAndGreatestDateCellIndexInDateCellRanges;
@@ -4048,6 +4354,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4048
4354
  * The input range is not expected to be sorted.
4049
4355
  *
4050
4356
  * @param input - unsorted array of date cell ranges to scan
4357
+ * @returns the largest ending index found, or 0 if the input is empty
4051
4358
  */ function getGreatestDateCellIndexInDateCellRanges(input) {
4052
4359
  var _ref;
4053
4360
  var _getLeastAndGreatestDateCellIndexInDateCellRanges;
@@ -4059,6 +4366,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4059
4366
  * The input range is not expected to be sorted.
4060
4367
  *
4061
4368
  * @param input - unsorted array of date cell ranges to scan
4369
+ * @returns an object with the least and greatest indexes and their source items, or null if the input is empty
4062
4370
  */ function getLeastAndGreatestDateCellIndexInDateCellRanges(input) {
4063
4371
  if (!input.length) {
4064
4372
  return null;
@@ -4067,17 +4375,34 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4067
4375
  var greatestIndex = 0;
4068
4376
  var leastIndexItem = input[0];
4069
4377
  var greatestIndexItem = input[0];
4070
- for(var i = 0; i < input.length; i += 1){
4071
- var range = input[i];
4072
- var leastRangeIndex = range.i;
4073
- var greatestRangeIndex = range.to || range.i;
4074
- if (leastRangeIndex < leastIndex) {
4075
- leastIndex = leastRangeIndex;
4076
- leastIndexItem = range;
4378
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
4379
+ try {
4380
+ for(var _iterator = input[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
4381
+ var range = _step.value;
4382
+ var _range_to;
4383
+ var leastRangeIndex = range.i;
4384
+ var greatestRangeIndex = (_range_to = range.to) !== null && _range_to !== void 0 ? _range_to : range.i;
4385
+ if (leastRangeIndex < leastIndex) {
4386
+ leastIndex = leastRangeIndex;
4387
+ leastIndexItem = range;
4388
+ }
4389
+ if (greatestRangeIndex > greatestIndex) {
4390
+ greatestIndex = greatestRangeIndex;
4391
+ greatestIndexItem = range;
4392
+ }
4077
4393
  }
4078
- if (greatestRangeIndex > greatestIndex) {
4079
- greatestIndex = greatestRangeIndex;
4080
- greatestIndexItem = range;
4394
+ } catch (err) {
4395
+ _didIteratorError = true;
4396
+ _iteratorError = err;
4397
+ } finally{
4398
+ try {
4399
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
4400
+ _iterator.return();
4401
+ }
4402
+ } finally{
4403
+ if (_didIteratorError) {
4404
+ throw _iteratorError;
4405
+ }
4081
4406
  }
4082
4407
  }
4083
4408
  return {
@@ -4093,6 +4418,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4093
4418
  *
4094
4419
  * @param i - starting cell index
4095
4420
  * @param to - ending cell index (inclusive); defaults to `i`
4421
+ * @returns a DateCellRangeWithRange spanning from `i` to `to`
4096
4422
  */ function dateCellRange(i, to) {
4097
4423
  return {
4098
4424
  i: i,
@@ -4103,6 +4429,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4103
4429
  * Creates a single-cell {@link DateCellRangeWithRange} where both `i` and `to` equal the given index.
4104
4430
  *
4105
4431
  * @param dateCellIndex - the index for both start and end of the range
4432
+ * @returns a DateCellRangeWithRange where `i` and `to` both equal the given index
4106
4433
  */ function dateCellRangeWithRangeFromIndex(dateCellIndex) {
4107
4434
  return dateCellRange(dateCellIndex, dateCellIndex);
4108
4435
  }
@@ -4111,6 +4438,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4111
4438
  * ensuring the result always has an explicit `to` value.
4112
4439
  *
4113
4440
  * @param input - index, cell, or range to normalize
4441
+ * @returns a DateCellRangeWithRange with an explicit `to` value
4114
4442
  */ function dateCellRangeWithRange(input) {
4115
4443
  if (typeof input === 'number') {
4116
4444
  return dateCellRangeWithRangeFromIndex(input);
@@ -4123,12 +4451,12 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4123
4451
  * fully contains the configured `inputRange`.
4124
4452
  *
4125
4453
  * @param inputRange - the range that must be fully included
4454
+ * @returns a function that returns true when its argument fully contains `inputRange`
4126
4455
  */ function dateCellRangeIncludedByRangeFunction(inputRange) {
4127
4456
  var _dateCellRangeWithRange = dateCellRangeWithRange(inputRange), i = _dateCellRangeWithRange.i, to = _dateCellRangeWithRange.to;
4128
4457
  return function(input) {
4129
- var _ref;
4130
4458
  var range = dateCellRangeWithRange(input);
4131
- return range.i <= i && ((_ref = range === null || range === void 0 ? void 0 : range.to) !== null && _ref !== void 0 ? _ref : range.i) >= to;
4459
+ return range.i <= i && range.to >= to;
4132
4460
  };
4133
4461
  }
4134
4462
  /**
@@ -4136,12 +4464,12 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4136
4464
  * has any overlap with the configured `inputRange`.
4137
4465
  *
4138
4466
  * @param inputRange - the range to test for overlap against
4467
+ * @returns a function that returns true when its argument overlaps with `inputRange`
4139
4468
  */ function dateCellRangeOverlapsRangeFunction(inputRange) {
4140
4469
  var _dateCellRangeWithRange = dateCellRangeWithRange(inputRange), i = _dateCellRangeWithRange.i, to = _dateCellRangeWithRange.to;
4141
4470
  return function(input) {
4142
- var _ref;
4143
4471
  var range = dateCellRangeWithRange(input);
4144
- return range.i <= to && ((_ref = range === null || range === void 0 ? void 0 : range.to) !== null && _ref !== void 0 ? _ref : range.i) >= i;
4472
+ return range.i <= to && range.to >= i;
4145
4473
  };
4146
4474
  }
4147
4475
  /**
@@ -4149,6 +4477,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4149
4477
  *
4150
4478
  * @param rangeA - first range to compare
4151
4479
  * @param rangeB - second range to compare
4480
+ * @returns true if the two ranges share at least one common index
4152
4481
  */ function dateCellRangeOverlapsRange(rangeA, rangeB) {
4153
4482
  return dateCellRangeOverlapsRangeFunction(rangeA)(rangeB);
4154
4483
  }
@@ -4156,6 +4485,8 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4156
4485
  * Returns a sort comparator that orders ranges first by starting index (`i`), then by ending index (`to`).
4157
4486
  *
4158
4487
  * In many cases {@link sortAscendingIndexNumberRefFunction} may be preferential when `to` ordering is not needed.
4488
+ *
4489
+ * @returns a comparator function that sorts ranges by `i` then by `to`
4159
4490
  */ function sortDateCellRangeAndSizeFunction() {
4160
4491
  return function(a, b) {
4161
4492
  var _a_to, _b_to;
@@ -4166,6 +4497,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4166
4497
  * Sorts the input date ranges in-place by ascending index using {@link sortAscendingIndexNumberRefFunction}.
4167
4498
  *
4168
4499
  * @param input - array of ranges to sort (mutated in place)
4500
+ * @returns the same array, sorted in ascending index order
4169
4501
  */ function sortDateCellRanges(input) {
4170
4502
  return input.sort(sortAscendingIndexNumberRefFunction());
4171
4503
  }
@@ -4176,6 +4508,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4176
4508
  * The input is sorted internally before grouping.
4177
4509
  *
4178
4510
  * @param input - cells or ranges to merge into contiguous groups
4511
+ * @returns an array of non-overlapping contiguous DateCellRangeWithRange values
4179
4512
  *
4180
4513
  * @example
4181
4514
  * ```ts
@@ -4223,6 +4556,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4223
4556
  * Returns an array containing every individual index in the given date cell range (inclusive of both `i` and `to`).
4224
4557
  *
4225
4558
  * @param input - range to expand into individual indexes
4559
+ * @returns an array of every DateCellIndex from `i` to `to` inclusive
4226
4560
  */ function allIndexesInDateCellRange(input) {
4227
4561
  return input.to != null ? range(input.i, input.to + 1) : [
4228
4562
  input.i
@@ -4232,6 +4566,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4232
4566
  * Flattens an array of indexes and/or ranges into a single array of individual {@link DateCellIndex} values.
4233
4567
  *
4234
4568
  * @param input - mix of raw indexes and ranges to flatten
4569
+ * @returns a flat array of all individual DateCellIndex values
4235
4570
  */ function allIndexesInDateCellRangesToArray(input) {
4236
4571
  var result = [];
4237
4572
  input.forEach(function(x) {
@@ -4248,6 +4583,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4248
4583
  * Returns a deduplicated {@link Set} of all indexes within the input ranges.
4249
4584
  *
4250
4585
  * @param input - mix of raw indexes and ranges to collect
4586
+ * @returns a Set containing every unique DateCellIndex from the input
4251
4587
  */ function allIndexesInDateCellRanges(input) {
4252
4588
  return new Set(allIndexesInDateCellRangesToArray(input));
4253
4589
  }
@@ -4256,6 +4592,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4256
4592
  *
4257
4593
  * @param blocks - cells or ranges to filter
4258
4594
  * @param range - bounding range that blocks must fall within
4595
+ * @returns only the blocks that fall entirely within the given range
4259
4596
  */ function filterDateCellsInDateCellRange(blocks, range) {
4260
4597
  var dateCellIsWithinDateCellRange = isDateCellWithinDateCellRangeFunction(range);
4261
4598
  return blocks.filter(dateCellIsWithinDateCellRange);
@@ -4265,6 +4602,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4265
4602
  * is fully contained within `inputRange`.
4266
4603
  *
4267
4604
  * @param inputRange - the bounding range to test containment against
4605
+ * @returns a function that returns true when its argument is fully contained within `inputRange`
4268
4606
  */ function isDateCellWithinDateCellRangeFunction(inputRange) {
4269
4607
  var range = dateCellRangeWithRange(inputRange);
4270
4608
  return function(input) {
@@ -4286,6 +4624,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4286
4624
  *
4287
4625
  * @param range - the outer bounding range
4288
4626
  * @param contains - the cell or range to test for containment
4627
+ * @returns true if `contains` is fully within `range`
4289
4628
  */ function isDateCellWithinDateCellRange(range, contains) {
4290
4629
  return isDateCellWithinDateCellRangeFunction(range)(dateCellRangeWithRange(contains));
4291
4630
  }
@@ -4295,6 +4634,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4295
4634
  * Internally groups overlapping ranges before counting so each index is counted only once.
4296
4635
  *
4297
4636
  * @param inputDateCellRange - one or more cells/ranges to analyze
4637
+ * @returns count, total, and average statistics for the given ranges
4298
4638
  */ function dateCellRangeBlocksCountInfo(inputDateCellRange) {
4299
4639
  var group = groupToDateCellRanges(asArray(inputDateCellRange));
4300
4640
  var count = 0;
@@ -4317,6 +4657,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4317
4657
  * Shorthand for `dateCellRangeBlocksCountInfo(input).count`.
4318
4658
  *
4319
4659
  * @param inputDateCellRange - one or more cells/ranges to count
4660
+ * @returns the total number of individual cell indexes
4320
4661
  *
4321
4662
  * @example
4322
4663
  * ```ts
@@ -4331,13 +4672,14 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4331
4672
  * grouped range from `ranges` fully covers a given input range.
4332
4673
  *
4333
4674
  * @param ranges - the covering ranges to test against
4675
+ * @returns a function that returns true when any single grouped range fully covers the input range
4334
4676
  */ function dateCellRangesFullyCoverDateCellRangeFunction(ranges) {
4335
4677
  var groupedRanges = Array.isArray(ranges) ? groupToDateCellRanges(ranges) : [
4336
4678
  dateCellRangeWithRange(ranges)
4337
4679
  ];
4338
4680
  return function(inputRange) {
4339
4681
  var fn = dateCellRangeIncludedByRangeFunction(inputRange);
4340
- return groupedRanges.findIndex(fn) !== -1;
4682
+ return groupedRanges.some(fn);
4341
4683
  };
4342
4684
  }
4343
4685
  /**
@@ -4348,6 +4690,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4348
4690
  * nearest future range's starting index is used.
4349
4691
  *
4350
4692
  * @param input - the current index and ranges to evaluate
4693
+ * @returns classification of ranges as past/present/future and the next upcoming index
4351
4694
  *
4352
4695
  * @example
4353
4696
  * ```ts
@@ -4404,6 +4747,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4404
4747
  *
4405
4748
  * @param range - the date cell range to classify
4406
4749
  * @param nowIndex - the reference index representing "now"
4750
+ * @returns 'past', 'present', or 'future' depending on the range's position relative to `nowIndex`
4407
4751
  */ function dateRelativeStateForDateCellRangeComparedToIndex(range, nowIndex) {
4408
4752
  var _dateCellRange = dateCellRange(range.i, range.to), i = _dateCellRange.i, to = _dateCellRange.to;
4409
4753
  var state;
@@ -4421,6 +4765,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4421
4765
  * from `i` to `to` (inclusive). Each copy retains all properties of the original block.
4422
4766
  *
4423
4767
  * @param block - the range to expand
4768
+ * @returns an array of single-cell copies, one per index from `i` to `to`
4424
4769
  *
4425
4770
  * @example
4426
4771
  * ```ts
@@ -4439,6 +4784,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4439
4784
  * Returns true if the input spans more than one cell (i.e., has a `to` value strictly greater than `i`).
4440
4785
  *
4441
4786
  * @param input - range or cell to check
4787
+ * @returns true if `to` is defined and strictly greater than `i`
4442
4788
  */ function dateCellRangeHasRange(input) {
4443
4789
  return input.to != null && input.to > input.i;
4444
4790
  }
@@ -4446,6 +4792,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4446
4792
  * Returns the effective ending index of a range: `to` if defined, otherwise `i`.
4447
4793
  *
4448
4794
  * @param input - range or cell to read
4795
+ * @returns the `to` index if defined, otherwise `i`
4449
4796
  */ function dateCellEndIndex(input) {
4450
4797
  var _input_to;
4451
4798
  return (_input_to = input.to) !== null && _input_to !== void 0 ? _input_to : input.i;
@@ -4456,8 +4803,9 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4456
4803
  * and `to` is the maximum ending index across all blocks.
4457
4804
  *
4458
4805
  * @param input - cells or ranges to group
4806
+ * @returns a UniqueDateCellRangeGroup containing the sorted blocks with `i` at 0
4459
4807
  */ function groupUniqueDateCells(input) {
4460
- var blocks = sortDateCellRanges(_to_consumable_array$2(input));
4808
+ var blocks = sortDateCellRanges(_to_consumable_array$4(input));
4461
4809
  var i = 0;
4462
4810
  var to;
4463
4811
  if (blocks.length === 0) {
@@ -4478,6 +4826,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4478
4826
  * according to the provided configuration. Handles overlap resolution, gap filling, and boundary clamping.
4479
4827
  *
4480
4828
  * @param config - controls start/end bounds, fill strategy, and overlap retention behavior
4829
+ * @returns a function that merges, fills, and resolves overlaps in date cell range arrays
4481
4830
  *
4482
4831
  * @example
4483
4832
  * ```ts
@@ -4495,9 +4844,10 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4495
4844
  var retainOnOverlap = inputRetainOnOverlap !== null && inputRetainOnOverlap !== void 0 ? inputRetainOnOverlap : 'next';
4496
4845
  var maxAllowedIndex = endAtIndex !== null && endAtIndex !== void 0 ? endAtIndex : Number.MAX_SAFE_INTEGER;
4497
4846
  var fillFactory = inputFillFactory;
4498
- if (!fillFactory && fill === 'fill') {
4847
+ if (!inputFillFactory && fill === 'fill') {
4499
4848
  throw new Error('fillFactory is required when fillOption is "fill".');
4500
4849
  }
4850
+ // eslint-disable-next-line sonarjs/cognitive-complexity
4501
4851
  return function(input, newBlocks) {
4502
4852
  var addBlockWithRange = function addBlockWithRange(inputBlock, i) {
4503
4853
  var inputTo = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : i;
@@ -4535,7 +4885,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4535
4885
  to: to
4536
4886
  };
4537
4887
  var block = fillFactory(dateCellRange);
4538
- addBlockWithRange(block, i, to !== null && to !== void 0 ? to : i);
4888
+ addBlockWithRange(block, i, to);
4539
4889
  } else if (fill === 'empty') ; else if (blocks.length > 0) {
4540
4890
  // only extend if one or more blocks have been pushed
4541
4891
  var blockToExtend = lastValue(blocks);
@@ -4556,6 +4906,8 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4556
4906
  };
4557
4907
  var shouldRetainCurrentOverNext = /**
4558
4908
  * Used to determine how to handle two neighboring objects.
4909
+ *
4910
+ * @returns true if the current block should be retained over the next block
4559
4911
  */ function shouldRetainCurrentOverNext() {
4560
4912
  if (current.priority === next.priority) {
4561
4913
  return retainOnOverlap === 'current';
@@ -4726,12 +5078,11 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4726
5078
  } else if (fill === 'fill') {
4727
5079
  completeBlocks();
4728
5080
  }
4729
- var result = {
5081
+ return {
4730
5082
  i: 0,
4731
5083
  blocks: blocks,
4732
5084
  discarded: discarded
4733
5085
  };
4734
- return result;
4735
5086
  };
4736
5087
  }
4737
5088
 
@@ -4794,6 +5145,9 @@ function _type_of$3(obj) {
4794
5145
  * When `limitToCompletedIndexes` is true, only indexes whose timing duration has fully elapsed are included,
4795
5146
  * with the max boundary lazily refreshed as time passes.
4796
5147
  *
5148
+ * @param config - Configuration specifying the timing, range fit, and completion constraints.
5149
+ * @returns A factory function that produces a clamped {@link DateCellRangeWithRange} from optional start/end input.
5150
+ *
4797
5151
  * @example
4798
5152
  * ```ts
4799
5153
  * const timing = dateCellTiming({ startsAt, duration: 60 }, 5);
@@ -4869,6 +5223,10 @@ function _type_of$3(obj) {
4869
5223
  * Computes a {@link DateCellRangeWithRange} from a timing and optional start/end input.
4870
5224
  *
4871
5225
  * Shorthand for creating a {@link dateCellRangeOfTimingFactory} and immediately invoking it.
5226
+ *
5227
+ * @param config - A {@link DateCellTiming} or full factory configuration.
5228
+ * @param input - Optional start/end boundaries for the range.
5229
+ * @returns A clamped {@link DateCellRangeWithRange} derived from the timing and input.
4872
5230
  */ function dateCellRangeOfTiming(config, input) {
4873
5231
  return dateCellRangeOfTimingFactory(isDateCellTiming(config) ? {
4874
5232
  timing: config
@@ -4879,6 +5237,10 @@ function _type_of$3(obj) {
4879
5237
  * of the timing schedule. Useful for determining which days have already finished.
4880
5238
  *
4881
5239
  * By default fitToTimingRange is true.
5240
+ *
5241
+ * @param timing - The timing schedule to evaluate.
5242
+ * @param config - Optional configuration for the current time reference and range fitting.
5243
+ * @returns A {@link DateCellRangeWithRange} covering only the completed day indexes.
4882
5244
  */ function dateCellTimingCompletedTimeRange(timing, config) {
4883
5245
  var _ref;
4884
5246
  return dateCellRangeOfTiming({
@@ -4892,6 +5254,10 @@ function _type_of$3(obj) {
4892
5254
  * Returns the latest completed day index for a {@link DateCellTiming}.
4893
5255
  *
4894
5256
  * Returns -1 if no days have been completed yet.
5257
+ *
5258
+ * @param timing - The timing schedule to evaluate.
5259
+ * @param now - Optional reference time; defaults to the current time.
5260
+ * @returns The zero-based index of the last fully completed day, or -1 if none.
4895
5261
  */ function dateCellTimingLatestCompletedIndex(timing, now) {
4896
5262
  return dateCellTimingCompletedTimeRange(timing, {
4897
5263
  now: now
@@ -4899,6 +5265,9 @@ function _type_of$3(obj) {
4899
5265
  }
4900
5266
  /**
4901
5267
  * Converts a {@link DateCellRange} (inclusive `to`) to a {@link DateCellIndexRange} (exclusive `maxIndex`).
5268
+ *
5269
+ * @param range - The inclusive date cell range to convert.
5270
+ * @returns A {@link DateCellIndexRange} with exclusive `maxIndex`.
4902
5271
  */ function dateCellRangeToDateCellIndexRange(range) {
4903
5272
  var _range_to;
4904
5273
  return {
@@ -4908,6 +5277,9 @@ function _type_of$3(obj) {
4908
5277
  }
4909
5278
  /**
4910
5279
  * Converts a {@link DateCellIndexRange} (exclusive `maxIndex`) back to a {@link DateCellRangeWithRange} (inclusive `to`).
5280
+ *
5281
+ * @param range - The exclusive date cell index range to convert.
5282
+ * @returns A {@link DateCellRangeWithRange} with inclusive `to`.
4911
5283
  */ function dateCellIndexRangeToDateCellRange(range) {
4912
5284
  return {
4913
5285
  i: range.minIndex,
@@ -4919,6 +5291,11 @@ function _type_of$3(obj) {
4919
5291
  *
4920
5292
  * An arbitrary limit can also be applied. When `fitToTimingRange` is true (default),
4921
5293
  * the limit is intersected with the timing's own range; otherwise the limit is used as-is.
5294
+ *
5295
+ * @param timing - The timing schedule to derive the range from.
5296
+ * @param limit - Optional range input to constrain the output.
5297
+ * @param fitToTimingRange - Whether to intersect the limit with the timing's own range. Defaults to true.
5298
+ * @returns A {@link DateCellIndexRange} representing the computed index bounds.
4922
5299
  */ function dateCellIndexRange(timing, limit) {
4923
5300
  var fitToTimingRange = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : true;
4924
5301
  var indexFactory = dateCellTimingRelativeIndexFactory(timing);
@@ -4947,6 +5324,9 @@ function _type_of$3(obj) {
4947
5324
  * by combining its timing and blocks.
4948
5325
  *
4949
5326
  * Shorthand for calling {@link expandDateCellTiming} with `collection.timing` and `collection.blocks`.
5327
+ *
5328
+ * @param collection - The date cell collection containing timing and blocks to expand.
5329
+ * @returns An array of {@link DateCellDurationSpan} values with concrete start times and durations.
4950
5330
  */ function expandDateCellCollection(collection) {
4951
5331
  return expandDateCellTiming(collection.timing, collection.blocks);
4952
5332
  }
@@ -4954,6 +5334,10 @@ function _type_of$3(obj) {
4954
5334
  * Expands the given blocks into {@link DateCellDurationSpan} values using the provided timing.
4955
5335
  *
4956
5336
  * Shorthand for creating a {@link dateCellTimingExpansionFactory} and immediately invoking it.
5337
+ *
5338
+ * @param timing - The timing schedule providing start times and duration.
5339
+ * @param blocks - The date cell blocks to expand into duration spans.
5340
+ * @returns An array of {@link DateCellDurationSpan} values with concrete start times.
4957
5341
  */ function expandDateCellTiming(timing, blocks) {
4958
5342
  return dateCellTimingExpansionFactory({
4959
5343
  timing: timing
@@ -4967,6 +5351,9 @@ function _type_of$3(obj) {
4967
5351
  * Filtering is applied both at the block level and at the computed duration span level,
4968
5352
  * and evaluation can be capped for performance with large datasets.
4969
5353
  *
5354
+ * @param config - Configuration specifying the timing, range limits, filters, and output caps.
5355
+ * @returns A factory function that expands date cell blocks into {@link DateCellDurationSpan} arrays.
5356
+ *
4970
5357
  * @example
4971
5358
  * ```ts
4972
5359
  * const timing = dateCellTiming({ startsAt, duration: 60 }, 5);
@@ -5064,6 +5451,9 @@ function _type_of$3(obj) {
5064
5451
  * const dateInfo = infoFactory(someDate);
5065
5452
  * console.log(dateInfo.dayIndex); // which day index this date falls on
5066
5453
  * ```
5454
+ *
5455
+ * @param config - Configuration providing the timing and optional range limit.
5456
+ * @returns A factory that computes {@link DateCellDayTimingInfo} for any date or day index.
5067
5457
  */ function dateCellDayTimingInfoFactory(config) {
5068
5458
  var timing = config.timing, rangeLimit = config.rangeLimit;
5069
5459
  var duration = timing.duration;
@@ -5128,8 +5518,11 @@ function _type_of$3(obj) {
5128
5518
  * Type guard that returns true if the input is a {@link DateCellTimingRelativeIndexFactory}.
5129
5519
  *
5130
5520
  * Checks for the presence of `_timing` and `_normalInstance` properties on a function.
5521
+ *
5522
+ * @param input - The value to check.
5523
+ * @returns True if the input is a {@link DateCellTimingRelativeIndexFactory}.
5131
5524
  */ function isDateCellTimingRelativeIndexFactory(input) {
5132
- return typeof input === 'function' && input._timing != null && input._normalInstance != null;
5525
+ return typeof input === 'function' && '_timing' in input && '_normalInstance' in input;
5133
5526
  }
5134
5527
  /**
5135
5528
  * Creates a {@link DateCellTimingRelativeIndexFactory} that converts dates, ISO8601 day strings,
@@ -5157,6 +5550,9 @@ function _type_of$3(obj) {
5157
5550
  * indexFactory._timing; // the original timing
5158
5551
  * indexFactory._normalInstance; // timezone normalizer
5159
5552
  * ```
5553
+ *
5554
+ * @param input - A timing configuration or an existing factory (returned as-is).
5555
+ * @returns A factory that converts dates, ISO8601 day strings, or indexes to zero-based day offsets.
5160
5556
  */ function dateCellTimingRelativeIndexFactory(input) {
5161
5557
  if (isDateCellTimingRelativeIndexFactory(input)) {
5162
5558
  return input;
@@ -5195,6 +5591,9 @@ function _type_of$3(obj) {
5195
5591
  * dates, date ranges, and cell ranges into a flat array of day indexes.
5196
5592
  *
5197
5593
  * Date ranges and cell ranges are expanded to include every index within the range.
5594
+ *
5595
+ * @param indexFactory - The relative index factory used for date-to-index conversion.
5596
+ * @returns A factory that flattens mixed date/range arrays into day index arrays.
5198
5597
  */ function dateCellTimingRelativeIndexArrayFactory(indexFactory) {
5199
5598
  var factory = function factory(input) {
5200
5599
  var inputAsArray = asArray(input);
@@ -5236,6 +5635,10 @@ function _type_of$3(obj) {
5236
5635
  * // Get the index for a specific date
5237
5636
  * const index = getRelativeIndexForDateCellTiming(timing, someDate);
5238
5637
  * ```
5638
+ *
5639
+ * @param timing - The timing providing the start date and timezone context.
5640
+ * @param date - A date or index to convert; defaults to the current date/time.
5641
+ * @returns The zero-based day index relative to the timing's start.
5239
5642
  */ function getRelativeIndexForDateCellTiming(timing) {
5240
5643
  var date = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : new Date();
5241
5644
  return dateCellTimingRelativeIndexFactory(timing)(date);
@@ -5262,6 +5665,9 @@ function _type_of$3(obj) {
5262
5665
  * // Convert index 3 to a date with a specific reference time
5263
5666
  * const dateForDay3AtNoon = dateFactory(3, noonDate);
5264
5667
  * ```
5668
+ *
5669
+ * @param timing - The timing providing the start date and timezone context.
5670
+ * @returns A factory that maps day indexes to calendar dates preserving the current time-of-day.
5265
5671
  */ function dateCellTimingDateFactory(timing) {
5266
5672
  var _dateCellTimingStartPair = dateCellTimingStartPair(timing), start = _dateCellTimingStartPair.start, normalInstance = _dateCellTimingStartPair.normalInstance;
5267
5673
  var utcStartDate = normalInstance.baseDateToTargetDate(start);
@@ -5277,8 +5683,8 @@ function _type_of$3(obj) {
5277
5683
  if (startUtcHours > nowHours) {
5278
5684
  input += 1;
5279
5685
  }
5280
- var nowWithDateForIndex = addHours(utcStartDateWithNowTime, input * HOURS_IN_DAY); // add days to apply the correct offset to the target index
5281
- return nowWithDateForIndex;
5686
+ // add days to apply the correct offset to the target index
5687
+ return addHours(utcStartDateWithNowTime, input * HOURS_IN_DAY);
5282
5688
  }
5283
5689
  };
5284
5690
  factory._timing = timing;
@@ -5295,6 +5701,9 @@ function _type_of$3(obj) {
5295
5701
  * const timing = dateCellTiming({ startsAt, duration: 60 }, 5);
5296
5702
  * const lastIndex = dateCellTimingEndIndex(timing); // 4 (zero-based, 5 days)
5297
5703
  * ```
5704
+ *
5705
+ * @param input - A timing or an existing relative index factory.
5706
+ * @returns The zero-based index of the last day in the schedule.
5298
5707
  */ function dateCellTimingEndIndex(input) {
5299
5708
  var factory = dateCellTimingRelativeIndexFactory(input);
5300
5709
  return factory(factory._timing.end);
@@ -5304,6 +5713,9 @@ function _type_of$3(obj) {
5304
5713
  * for any day index relative to the timing's start.
5305
5714
  *
5306
5715
  * The returned date represents the beginning of the day in the timing's timezone context.
5716
+ *
5717
+ * @param input - A timing or an existing relative index factory.
5718
+ * @returns A factory that maps day indexes to the start-of-day date in the timing's timezone.
5307
5719
  */ function dateCellTimingStartDateFactory(input) {
5308
5720
  var indexFactory = dateCellTimingRelativeIndexFactory(input);
5309
5721
  var _dateCellTimingStartPair = dateCellTimingStartPair(indexFactory._timing), start = _dateCellTimingStartPair.start, normalInstance = _dateCellTimingStartPair.normalInstance;
@@ -5341,6 +5753,10 @@ function dateCellTimingEndDateFactory(input) {
5341
5753
  /**
5342
5754
  * Convenience function that returns the calendar date for a given day index or date
5343
5755
  * relative to the timing. Shorthand for creating a {@link dateCellTimingDateFactory} and invoking it.
5756
+ *
5757
+ * @param timing - The timing providing the start date and timezone context.
5758
+ * @param input - A date or day index to convert.
5759
+ * @returns The calendar date corresponding to the input, preserving current time-of-day.
5344
5760
  */ function getRelativeDateForDateCellTiming(timing, input) {
5345
5761
  return dateCellTimingDateFactory(timing)(input);
5346
5762
  }
@@ -5366,6 +5782,9 @@ function dateCellTimingEndDateFactory(input) {
5366
5782
  * });
5367
5783
  * // result has the same start day and end day, but new time-of-day and 90-minute duration
5368
5784
  * ```
5785
+ *
5786
+ * @param input - Configuration specifying the timing to update, the event source, and which aspects to replace.
5787
+ * @returns A new {@link FullDateCellTiming} with the requested aspects replaced.
5369
5788
  */ function updateDateCellTimingWithDateCellTimingEvent(input) {
5370
5789
  var timing = input.timing, event = input.event, replaceStartDay = input.replaceStartDay, replaceStartsAt = input.replaceStartsAt, startDateDay = input.startDayDate, endOnEvent = input.endOnEvent, replaceDuration = input.replaceDuration;
5371
5790
  var timezone = timing.timezone;
@@ -5382,7 +5801,8 @@ function dateCellTimingEndDateFactory(input) {
5382
5801
  var _dateCellTimingStartPair = dateCellTimingStartPair({
5383
5802
  startsAt: event.startsAt,
5384
5803
  timezone: timezone
5385
- }), eventStartDate = _dateCellTimingStartPair.start, normalInstance = _dateCellTimingStartPair.normalInstance;
5804
+ }), initialEventStartDate = _dateCellTimingStartPair.start, normalInstance = _dateCellTimingStartPair.normalInstance;
5805
+ var eventStartDate = initialEventStartDate;
5386
5806
  if (startDateDay != null) {
5387
5807
  var startDateFactory = dateCellTimingStartDateFactory(timing);
5388
5808
  eventStartDate = startDateFactory(startDateDay);
@@ -5446,6 +5866,9 @@ function dateCellTimingEndDateFactory(input) {
5446
5866
  * isInRange(6); // false - index 6 is outside [2, 5]
5447
5867
  * isInRange(someDate); // converts date to index, then checks containment
5448
5868
  * ```
5869
+ *
5870
+ * @param config - Configuration specifying the reference range and optional timezone context.
5871
+ * @returns A predicate function that checks containment within the configured range.
5449
5872
  */ function isDateWithinDateCellRangeFunction(config) {
5450
5873
  var inputStartsAt = config.startsAt, inputRange = config.range;
5451
5874
  var startsAt = inputStartsAt;
@@ -5466,13 +5889,11 @@ function dateCellTimingEndDateFactory(input) {
5466
5889
  } else {
5467
5890
  rangeInput = inputRange;
5468
5891
  }
5469
- if (!inputStartsAt) {
5470
- if (dateRange && isDateInput) {
5471
- startsAt = {
5472
- startsAt: inputRange,
5473
- timezone: guessCurrentTimezone()
5474
- };
5475
- }
5892
+ if (!inputStartsAt && dateRange && isDateInput) {
5893
+ startsAt = {
5894
+ startsAt: inputRange,
5895
+ timezone: guessCurrentTimezone()
5896
+ };
5476
5897
  }
5477
5898
  if (!startsAt) {
5478
5899
  throw new Error('Invalid isDateWithinDateCellRangeFunction() config. StartsAt date info could not be determined from input.');
@@ -5625,6 +6046,7 @@ function _object_spread_props$6(target, source) {
5625
6046
  * Useful for identifying events or blocks that have already begun relative to a point in time.
5626
6047
  *
5627
6048
  * @param now - Reference time to compare against. Defaults to the current time.
6049
+ * @returns a filter function that returns true for spans whose start time is at or before the reference time
5628
6050
  *
5629
6051
  * @example
5630
6052
  * ```ts
@@ -5643,6 +6065,7 @@ function _object_spread_props$6(target, source) {
5643
6065
  * The inverse of {@link dateCellDurationSpanHasStartedFilterFunction}. Useful for finding upcoming or future events.
5644
6066
  *
5645
6067
  * @param now - Reference time to compare against. Defaults to the current time.
6068
+ * @returns a filter function that returns true for spans whose start time is strictly after the reference time
5646
6069
  *
5647
6070
  * @example
5648
6071
  * ```ts
@@ -5662,6 +6085,7 @@ function _object_spread_props$6(target, source) {
5662
6085
  * Useful for identifying completed events.
5663
6086
  *
5664
6087
  * @param now - Reference time to compare against. Defaults to the current time.
6088
+ * @returns a filter function that returns true for spans whose computed end time is at or before the reference time
5665
6089
  *
5666
6090
  * @example
5667
6091
  * ```ts
@@ -5682,6 +6106,7 @@ function _object_spread_props$6(target, source) {
5682
6106
  * still in progress or have not yet occurred.
5683
6107
  *
5684
6108
  * @param now - Reference time to compare against. Defaults to the current time.
6109
+ * @returns a filter function that returns true for spans whose computed end time is strictly after the reference time
5685
6110
  *
5686
6111
  * @example
5687
6112
  * ```ts
@@ -5703,6 +6128,7 @@ function _object_spread_props$6(target, source) {
5703
6128
  * indices clamped to the range boundaries. Non-overlapping cells are excluded entirely.
5704
6129
  *
5705
6130
  * @param range - The target range to fit cells into.
6131
+ * @returns a reusable function that clamps or filters date cells to the configured range
5706
6132
  *
5707
6133
  * @example
5708
6134
  * ```ts
@@ -5743,6 +6169,7 @@ function _object_spread_props$6(target, source) {
5743
6169
  *
5744
6170
  * @param range - The target range to fit cells into.
5745
6171
  * @param input - The date cells to clamp or filter.
6172
+ * @returns an array of date cells clamped to the range, with non-overlapping cells removed
5746
6173
  *
5747
6174
  * @example
5748
6175
  * ```ts
@@ -5757,6 +6184,7 @@ function _object_spread_props$6(target, source) {
5757
6184
  *
5758
6185
  * @param range - The target range to fit the cell into.
5759
6186
  * @param input - The single date cell to clamp or exclude.
6187
+ * @returns the clamped date cell, or `undefined` if it does not overlap the range
5760
6188
  *
5761
6189
  * @example
5762
6190
  * ```ts
@@ -5771,7 +6199,7 @@ function _object_spread_props$6(target, source) {
5771
6199
  ])[0];
5772
6200
  }
5773
6201
 
5774
- function _array_like_to_array$4(arr, len) {
6202
+ function _array_like_to_array$5(arr, len) {
5775
6203
  if (len == null || len > arr.length) len = arr.length;
5776
6204
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
5777
6205
  return arr2;
@@ -5779,6 +6207,9 @@ function _array_like_to_array$4(arr, len) {
5779
6207
  function _array_with_holes$2(arr) {
5780
6208
  if (Array.isArray(arr)) return arr;
5781
6209
  }
6210
+ function _array_without_holes$3(arr) {
6211
+ if (Array.isArray(arr)) return _array_like_to_array$5(arr);
6212
+ }
5782
6213
  function _instanceof(left, right) {
5783
6214
  if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
5784
6215
  return !!right[Symbol.hasInstance](left);
@@ -5786,6 +6217,9 @@ function _instanceof(left, right) {
5786
6217
  return left instanceof right;
5787
6218
  }
5788
6219
  }
6220
+ function _iterable_to_array$3(iter) {
6221
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
6222
+ }
5789
6223
  function _iterable_to_array_limit$2(arr, i) {
5790
6224
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
5791
6225
  if (_i == null) return;
@@ -5813,16 +6247,22 @@ function _iterable_to_array_limit$2(arr, i) {
5813
6247
  function _non_iterable_rest$2() {
5814
6248
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
5815
6249
  }
6250
+ function _non_iterable_spread$3() {
6251
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
6252
+ }
5816
6253
  function _sliced_to_array$2(arr, i) {
5817
- return _array_with_holes$2(arr) || _iterable_to_array_limit$2(arr, i) || _unsupported_iterable_to_array$4(arr, i) || _non_iterable_rest$2();
6254
+ return _array_with_holes$2(arr) || _iterable_to_array_limit$2(arr, i) || _unsupported_iterable_to_array$5(arr, i) || _non_iterable_rest$2();
5818
6255
  }
5819
- function _unsupported_iterable_to_array$4(o, minLen) {
6256
+ function _to_consumable_array$3(arr) {
6257
+ return _array_without_holes$3(arr) || _iterable_to_array$3(arr) || _unsupported_iterable_to_array$5(arr) || _non_iterable_spread$3();
6258
+ }
6259
+ function _unsupported_iterable_to_array$5(o, minLen) {
5820
6260
  if (!o) return;
5821
- if (typeof o === "string") return _array_like_to_array$4(o, minLen);
6261
+ if (typeof o === "string") return _array_like_to_array$5(o, minLen);
5822
6262
  var n = Object.prototype.toString.call(o).slice(8, -1);
5823
6263
  if (n === "Object" && o.constructor) n = o.constructor.name;
5824
6264
  if (n === "Map" || n === "Set") return Array.from(n);
5825
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$4(o, minLen);
6265
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$5(o, minLen);
5826
6266
  }
5827
6267
  /**
5828
6268
  * Used for default YearWeekCode values
@@ -5928,8 +6368,7 @@ function _unsupported_iterable_to_array$4(o, minLen) {
5928
6368
  * @param input - timezone string, config, or instance
5929
6369
  * @returns the resolved normal instance
5930
6370
  */ function yearWeekCodeDateTimezoneInstance(input) {
5931
- var normal = input ? _instanceof(input, DateTimezoneUtcNormalInstance) ? input : dateTimezoneUtcNormal(input) : SYSTEM_DATE_TIMEZONE_UTC_NORMAL_INSTANCE;
5932
- return normal;
6371
+ return input ? _instanceof(input, DateTimezoneUtcNormalInstance) ? input : dateTimezoneUtcNormal(input) : SYSTEM_DATE_TIMEZONE_UTC_NORMAL_INSTANCE;
5933
6372
  }
5934
6373
  function yearWeekCode(dateOrYear, inputWeek) {
5935
6374
  return yearWeekCodeFactory({
@@ -5981,6 +6420,7 @@ function yearWeekCode(dateOrYear, inputWeek) {
5981
6420
  *
5982
6421
  * @param dateRange - the range to compute week codes for
5983
6422
  * @param dateRangeTimezone - the timezone context for accurate week boundary calculation
6423
+ * @returns an array of YearWeekCode values covering the range
5984
6424
  */ function yearWeekCodeForDateRangeInTimezone(dateRange, dateRangeTimezone) {
5985
6425
  return yearWeekCodeForDateRangeFactory(yearWeekCodeFactory({
5986
6426
  timezone: dateRangeTimezone
@@ -6013,6 +6453,7 @@ function yearWeekCode(dateOrYear, inputWeek) {
6013
6453
  * Returns all {@link YearWeekCode} values for the calendar month containing the given date, using the system timezone.
6014
6454
  *
6015
6455
  * @param date - a date within the target month
6456
+ * @returns an array of YearWeekCode values for the month
6016
6457
  */ function yearWeekCodeForCalendarMonth(date) {
6017
6458
  return yearWeekCodeForCalendarMonthFactory(yearWeekCodeFactory({
6018
6459
  timezone: SYSTEM_DATE_TIMEZONE_UTC_NORMAL_INSTANCE
@@ -6056,8 +6497,8 @@ function yearWeekCode(dateOrYear, inputWeek) {
6056
6497
  var utcYearDate = new Date(Date.UTC(pair.year, 0, 1, 0, 0, 0, 0));
6057
6498
  var systemYearDate = normal.systemDateToBaseDate(utcYearDate); // convert to system before using system date functions
6058
6499
  var date = startOfWeek(setWeek(systemYearDate, pair.week));
6059
- var fixed = normal.targetDateToSystemDate(date); // back to timezone
6060
- return fixed;
6500
+ // back to timezone
6501
+ return normal.targetDateToSystemDate(date);
6061
6502
  };
6062
6503
  }
6063
6504
  /**
@@ -6111,10 +6552,10 @@ function yearWeekCode(dateOrYear, inputWeek) {
6111
6552
  }
6112
6553
  return yearWeekCode;
6113
6554
  });
6114
- var groups = Array.from(map.entries()).map(function(param) {
6555
+ var groups = _to_consumable_array$3(map.entries()).map(function(param) {
6115
6556
  var _param = _sliced_to_array$2(param, 2), week = _param[0], _$items = _param[1];
6116
6557
  return {
6117
- week: week || 0,
6558
+ week: week !== null && week !== void 0 ? week : 0,
6118
6559
  items: _$items
6119
6560
  };
6120
6561
  });
@@ -6153,8 +6594,7 @@ function yearWeekCode(dateOrYear, inputWeek) {
6153
6594
  var normalInstance = startDateFactory._indexFactory._normalInstance;
6154
6595
  return function(indexOrDate) {
6155
6596
  var dateInSystemTimezone = normalInstance.systemDateToTargetDate(startDateFactory(indexOrDate));
6156
- var yearWeekCode = yearWeekCodeFromDate(dateInSystemTimezone);
6157
- return yearWeekCode;
6597
+ return yearWeekCodeFromDate(dateInSystemTimezone);
6158
6598
  };
6159
6599
  }
6160
6600
  /**
@@ -6165,21 +6605,20 @@ function yearWeekCode(dateOrYear, inputWeek) {
6165
6605
  */ function dateCellIndexYearWeekCodeGroupFactory(config) {
6166
6606
  var dateCellIndexReader = config.dateCellIndexReader, inputDateCellIndexYearWeekCodeFactory = config.dateCellIndexYearWeekCodeFactory;
6167
6607
  var dateCellIndexYearWeekCode = typeof inputDateCellIndexYearWeekCodeFactory === 'function' ? inputDateCellIndexYearWeekCodeFactory : dateCellIndexYearWeekCodeFactory(inputDateCellIndexYearWeekCodeFactory);
6168
- var factory = yearWeekCodeGroupFactory({
6608
+ return yearWeekCodeGroupFactory({
6169
6609
  yearWeekCodeFactory: dateCellIndexYearWeekCode,
6170
6610
  yearWeekCodeReader: dateCellIndexYearWeekCode,
6171
6611
  dateReader: dateCellIndexReader
6172
6612
  });
6173
- return factory;
6174
6613
  }
6175
6614
 
6176
- function _array_like_to_array$3(arr, len) {
6615
+ function _array_like_to_array$4(arr, len) {
6177
6616
  if (len == null || len > arr.length) len = arr.length;
6178
6617
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
6179
6618
  return arr2;
6180
6619
  }
6181
- function _array_without_holes$1(arr) {
6182
- if (Array.isArray(arr)) return _array_like_to_array$3(arr);
6620
+ function _array_without_holes$2(arr) {
6621
+ if (Array.isArray(arr)) return _array_like_to_array$4(arr);
6183
6622
  }
6184
6623
  function _define_property$9(obj, key, value) {
6185
6624
  if (key in obj) {
@@ -6194,10 +6633,10 @@ function _define_property$9(obj, key, value) {
6194
6633
  }
6195
6634
  return obj;
6196
6635
  }
6197
- function _iterable_to_array$1(iter) {
6636
+ function _iterable_to_array$2(iter) {
6198
6637
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
6199
6638
  }
6200
- function _non_iterable_spread$1() {
6639
+ function _non_iterable_spread$2() {
6201
6640
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
6202
6641
  }
6203
6642
  function _object_spread$7(target) {
@@ -6234,20 +6673,20 @@ function _object_spread_props$5(target, source) {
6234
6673
  }
6235
6674
  return target;
6236
6675
  }
6237
- function _to_consumable_array$1(arr) {
6238
- return _array_without_holes$1(arr) || _iterable_to_array$1(arr) || _unsupported_iterable_to_array$3(arr) || _non_iterable_spread$1();
6676
+ function _to_consumable_array$2(arr) {
6677
+ return _array_without_holes$2(arr) || _iterable_to_array$2(arr) || _unsupported_iterable_to_array$4(arr) || _non_iterable_spread$2();
6239
6678
  }
6240
6679
  function _type_of$2(obj) {
6241
6680
  "@swc/helpers - typeof";
6242
6681
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
6243
6682
  }
6244
- function _unsupported_iterable_to_array$3(o, minLen) {
6683
+ function _unsupported_iterable_to_array$4(o, minLen) {
6245
6684
  if (!o) return;
6246
- if (typeof o === "string") return _array_like_to_array$3(o, minLen);
6685
+ if (typeof o === "string") return _array_like_to_array$4(o, minLen);
6247
6686
  var n = Object.prototype.toString.call(o).slice(8, -1);
6248
6687
  if (n === "Object" && o.constructor) n = o.constructor.name;
6249
6688
  if (n === "Map" || n === "Set") return Array.from(n);
6250
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$3(o, minLen);
6689
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$4(o, minLen);
6251
6690
  }
6252
6691
  /**
6253
6692
  * Encodes days of the week as numeric codes for use in schedule filtering.
@@ -6312,7 +6751,7 @@ function _unsupported_iterable_to_array$3(o, minLen) {
6312
6751
  * @param input - schedule day codes to convert (WEEKDAY/WEEKEND shorthand codes are expanded)
6313
6752
  * @returns an EnabledDays object with boolean flags for each day
6314
6753
  */ function enabledDaysFromDateCellScheduleDayCodes(input) {
6315
- var days = expandDateCellScheduleDayCodesToDayOfWeekSet(Array.from(new Set(input)));
6754
+ var days = expandDateCellScheduleDayCodesToDayOfWeekSet(_to_consumable_array$2(new Set(input)));
6316
6755
  return enabledDaysFromDaysOfWeek(days);
6317
6756
  }
6318
6757
  /**
@@ -6460,7 +6899,7 @@ var DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = /^[0-9]{0,9}$/;
6460
6899
  * @param input - day codes to expand
6461
6900
  * @returns sorted array of individual day codes (1-7 only, no shorthand)
6462
6901
  */ function expandDateCellScheduleDayCodes(input) {
6463
- return Array.from(expandDateCellScheduleDayCodesToDayCodesSet(input)).sort(sortNumbersAscendingFunction);
6902
+ return _to_consumable_array$2(expandDateCellScheduleDayCodesToDayCodesSet(input)).sort(sortNumbersAscendingFunction);
6464
6903
  }
6465
6904
  /**
6466
6905
  * Expands the input DateCellScheduleDayCodesInput to a Set of individual DateCellScheduleDayCode values (1-7), expanding shorthand codes like WEEKDAY and WEEKEND.
@@ -6498,7 +6937,7 @@ var DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = /^[0-9]{0,9}$/;
6498
6937
  var dayCodes;
6499
6938
  switch(typeof input === "undefined" ? "undefined" : _type_of$2(input)){
6500
6939
  case 'string':
6501
- dayCodes = Array.from(new Set(input)).map(function(x) {
6940
+ dayCodes = _to_consumable_array$2(new Set(input)).map(function(x) {
6502
6941
  return Number(x);
6503
6942
  });
6504
6943
  break;
@@ -6508,7 +6947,7 @@ var DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = /^[0-9]{0,9}$/;
6508
6947
  ];
6509
6948
  break;
6510
6949
  default:
6511
- dayCodes = Array.from(input);
6950
+ dayCodes = _to_consumable_array$2(input);
6512
6951
  break;
6513
6952
  }
6514
6953
  return dayCodes.filter(function(x) {
@@ -6617,7 +7056,6 @@ var DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = /^[0-9]{0,9}$/;
6617
7056
  var timezone = inputTimezone !== null && inputTimezone !== void 0 ? inputTimezone : requireCurrentTimezone(); // treat input as the current timezone
6618
7057
  var normalInstance = dateTimezoneUtcNormal(timezone);
6619
7058
  var start;
6620
- var end;
6621
7059
  // either start or startsAt is provided
6622
7060
  if (inputStart != null) {
6623
7061
  var startInSystemTimezone = normalInstance.systemDateToTargetDate(inputStart); // start needs to be in the system timezone normal before processing.
@@ -6634,7 +7072,7 @@ var DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = /^[0-9]{0,9}$/;
6634
7072
  }
6635
7073
  }
6636
7074
  // set the end value
6637
- end = inputEnd !== null && inputEnd !== void 0 ? inputEnd : addMinutes(start, 1); // default the end to one minute after the start
7075
+ var end = inputEnd !== null && inputEnd !== void 0 ? inputEnd : addMinutes(start, 1); // default the end to one minute after the start
6638
7076
  return {
6639
7077
  w: w,
6640
7078
  ex: ex,
@@ -6836,11 +7274,12 @@ var DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = /^[0-9]{0,9}$/;
6836
7274
  * filter(5); // false (Saturday Jan 11)
6837
7275
  * ```
6838
7276
  */ function dateCellScheduleDateFilter(config) {
7277
+ var _ref;
6839
7278
  var w = config.w, inputStart = config.start, inputStartsAt = config.startsAt, inputEnd = config.end, inputTimezone = config.timezone, _config_setStartAsMinDate = config.setStartAsMinDate, setStartAsMinDate = _config_setStartAsMinDate === void 0 ? true : _config_setStartAsMinDate, minMaxDateRange = config.minMaxDateRange;
6840
7279
  var timezone = inputTimezone !== null && inputTimezone !== void 0 ? inputTimezone : requireCurrentTimezone(); // if the timezone is not provided, assume the startsAt is a system timezone normal.
6841
7280
  var normalInstance = dateTimezoneUtcNormal(timezone);
6842
7281
  // derive the startsAt time for the range. If not provided, defaults to inputStart, or midnight today in the target timezone.
6843
- var startsAt = inputStartsAt != null ? inputStartsAt : inputStart !== null && inputStart !== void 0 ? inputStart : normalInstance.startOfDayInTargetTimezone();
7282
+ var startsAt = (_ref = inputStartsAt !== null && inputStartsAt !== void 0 ? inputStartsAt : inputStart) !== null && _ref !== void 0 ? _ref : normalInstance.startOfDayInTargetTimezone();
6844
7283
  var allowedDays = expandDateCellScheduleDayCodesToDayOfWeekSet(w);
6845
7284
  var startsAtInSystem = normalInstance.systemDateToTargetDate(startsAt); // convert to the system date
6846
7285
  var firstDateDay = getDay(startsAtInSystem);
@@ -6866,15 +7305,13 @@ var DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = /^[0-9]{0,9}$/;
6866
7305
  var excludedIndexes = new Set(config.ex);
6867
7306
  var fn = function fn(input) {
6868
7307
  var i;
6869
- var day;
6870
7308
  if (typeof input === 'number') {
6871
7309
  i = input;
6872
7310
  } else {
6873
7311
  i = _dateCellTimingRelativeIndexFactory(input);
6874
7312
  }
6875
- day = dayForIndex(i);
6876
- var result = i >= minAllowedIndex && i <= maxAllowedIndex && allowedDays.has(day) && !excludedIndexes.has(i) || includedIndexes.has(i);
6877
- return result;
7313
+ var day = dayForIndex(i);
7314
+ return i >= minAllowedIndex && i <= maxAllowedIndex && allowedDays.has(day) && !excludedIndexes.has(i) || includedIndexes.has(i);
6878
7315
  };
6879
7316
  fn._dateCellTimingRelativeIndexFactory = _dateCellTimingRelativeIndexFactory;
6880
7317
  return fn;
@@ -6928,6 +7365,8 @@ var DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = /^[0-9]{0,9}$/;
6928
7365
  * Creates a DateCellScheduleDateCellTimingFilter that tests whether a DateCell block's index is allowed by the schedule within the given timing.
6929
7366
  *
6930
7367
  * @param config - timing and schedule to build the filter from
7368
+ * @param config.timing - the DateCellTiming that defines the date range and event times for the filter
7369
+ * @param config.schedule - the DateCellSchedule that controls which day codes and indices are included or excluded
6931
7370
  * @returns a decision function returning true for allowed blocks
6932
7371
  */ function dateCellScheduleDateCellTimingFilter(param) {
6933
7372
  var timing = param.timing, schedule = param.schedule;
@@ -6951,7 +7390,6 @@ var DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = /^[0-9]{0,9}$/;
6951
7390
  * @returns an expansion factory that converts DateCellRange arrays into filtered DateCellDurationSpan arrays
6952
7391
  */ function expandDateCellScheduleFactory(config) {
6953
7392
  var _config_invertSchedule = config.invertSchedule, invertSchedule = _config_invertSchedule === void 0 ? false : _config_invertSchedule, now = config.now, onlyBlocksThatHaveEnded = config.onlyBlocksThatHaveEnded, onlyBlocksThatHaveStarted = config.onlyBlocksThatHaveStarted, onlyBlocksNotYetEnded = config.onlyBlocksNotYetEnded, onlyBlocksNotYetStarted = config.onlyBlocksNotYetStarted, maxDateCellsToReturn = config.maxDateCellsToReturn, inputDurationSpanFilter = config.durationSpanFilter;
6954
- var durationSpanFilter;
6955
7393
  var durationSpanFilters = [];
6956
7394
  if (inputDurationSpanFilter) {
6957
7395
  durationSpanFilters.push(inputDurationSpanFilter);
@@ -6968,14 +7406,13 @@ var DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = /^[0-9]{0,9}$/;
6968
7406
  durationSpanFilters.push(dateCellDurationSpanHasNotEndedFilterFunction(now));
6969
7407
  }
6970
7408
  }
6971
- durationSpanFilter = mergeFilterFunctions.apply(void 0, _to_consumable_array$1(durationSpanFilters));
6972
- var expansionFactory = dateCellTimingExpansionFactory({
7409
+ var durationSpanFilter = mergeFilterFunctions.apply(void 0, _to_consumable_array$2(durationSpanFilters));
7410
+ return dateCellTimingExpansionFactory({
6973
7411
  timing: config.timing,
6974
7412
  filter: invertFilter(dateCellScheduleDateCellTimingFilter(config), invertSchedule),
6975
7413
  durationSpanFilter: durationSpanFilter,
6976
7414
  maxDateCellsToReturn: maxDateCellsToReturn
6977
7415
  });
6978
- return expansionFactory;
6979
7416
  }
6980
7417
  /**
6981
7418
  * Expands a DateCellTiming and DateCellSchedule into concrete DateCellDurationSpan values representing each active block in the event.
@@ -7061,16 +7498,155 @@ var DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = /^[0-9]{0,9}$/;
7061
7498
  });
7062
7499
  }
7063
7500
 
7501
+ function _define_property$8(obj, key, value) {
7502
+ if (key in obj) {
7503
+ Object.defineProperty(obj, key, {
7504
+ value: value,
7505
+ enumerable: true,
7506
+ configurable: true,
7507
+ writable: true
7508
+ });
7509
+ } else {
7510
+ obj[key] = value;
7511
+ }
7512
+ return obj;
7513
+ }
7514
+ function _object_spread$6(target) {
7515
+ for(var i = 1; i < arguments.length; i++){
7516
+ var source = arguments[i] != null ? arguments[i] : {};
7517
+ var ownKeys = Object.keys(source);
7518
+ if (typeof Object.getOwnPropertySymbols === "function") {
7519
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
7520
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
7521
+ }));
7522
+ }
7523
+ ownKeys.forEach(function(key) {
7524
+ _define_property$8(target, key, source[key]);
7525
+ });
7526
+ }
7527
+ return target;
7528
+ }
7529
+ /**
7530
+ * Distinguishes between time-based calendar events and all-day/multi-day events.
7531
+ */ var CalendarDateType;
7532
+ (function(CalendarDateType) {
7533
+ /**
7534
+ * Event starts at a specific time and lasts for a certain duration.
7535
+ */ CalendarDateType["TIME"] = "time";
7536
+ /**
7537
+ * Event is specifically for a number of days. Duration is still tracked in minutes.
7538
+ */ CalendarDateType["DAYS"] = "days";
7539
+ })(CalendarDateType || (CalendarDateType = {}));
7540
+ /**
7541
+ * Creates a {@link CalendarDateFactory} that produces all-day calendar events with timezone-aware start times.
7542
+ *
7543
+ * The factory converts an ISO 8601 day string to a UTC date, then applies timezone normalization
7544
+ * so the resulting `startsAt` represents the correct moment for the target timezone.
7545
+ *
7546
+ * @param config - optional timezone configuration
7547
+ * @returns a factory function that creates CalendarDate objects
7548
+ *
7549
+ * @example
7550
+ * ```ts
7551
+ * const factory = calendarDateFactory({ timezone: 'America/Denver' });
7552
+ * const event = factory('2024-01-15', 3);
7553
+ * // event.type === CalendarDateType.DAYS
7554
+ * // event.duration === daysToMinutes(3)
7555
+ * ```
7556
+ */ function calendarDateFactory(config) {
7557
+ var normalConfig = (config === null || config === void 0 ? void 0 : config.timezone) === undefined ? {
7558
+ useSystemTimezone: true
7559
+ } : {
7560
+ timezone: config.timezone ? config.timezone : undefined
7561
+ };
7562
+ var normal = dateTimezoneUtcNormal(normalConfig);
7563
+ return function(day, days) {
7564
+ var date = parseISO8601DayStringToUTCDate(day);
7565
+ var startsAt = normal.targetDateToBaseDate(date);
7566
+ return {
7567
+ type: CalendarDateType.DAYS,
7568
+ startsAt: startsAt,
7569
+ duration: daysToMinutes(days)
7570
+ };
7571
+ };
7572
+ }
7573
+ /**
7574
+ * Convenience function that creates a single all-day {@link CalendarDate} with optional timezone.
7575
+ *
7576
+ * Shorthand for creating a factory and immediately invoking it.
7577
+ *
7578
+ * @param day - ISO 8601 day string (e.g. '2024-01-15')
7579
+ * @param days - number of days the event spans
7580
+ * @param timezone - IANA timezone string, false for UTC, or undefined for system timezone
7581
+ * @returns a CalendarDate with type DAYS
7582
+ *
7583
+ * @example
7584
+ * ```ts
7585
+ * const event = calendarDate('2024-01-15', 1, 'America/Denver');
7586
+ * // event.type === CalendarDateType.DAYS
7587
+ * ```
7588
+ */ function calendarDate(day, days, timezone) {
7589
+ return calendarDateFactory({
7590
+ timezone: timezone
7591
+ })(day, days);
7592
+ }
7593
+ /**
7594
+ * Wraps an existing {@link DateDurationSpan} as a time-based {@link CalendarDate}.
7595
+ *
7596
+ * @param dateDurationSpan - the duration span to wrap
7597
+ * @returns a CalendarDate with type TIME
7598
+ *
7599
+ * @example
7600
+ * ```ts
7601
+ * const span: DateDurationSpan = { startsAt: new Date(), duration: 60 };
7602
+ * const event = calendarDateForDateDurationSpan(span);
7603
+ * // event.type === CalendarDateType.TIME
7604
+ * ```
7605
+ */ function calendarDateForDateDurationSpan(dateDurationSpan) {
7606
+ return _object_spread$6({
7607
+ type: CalendarDateType.TIME
7608
+ }, dateDurationSpan);
7609
+ }
7610
+
7611
+ function _array_like_to_array$3(arr, len) {
7612
+ if (len == null || len > arr.length) len = arr.length;
7613
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
7614
+ return arr2;
7615
+ }
7616
+ function _array_without_holes$1(arr) {
7617
+ if (Array.isArray(arr)) return _array_like_to_array$3(arr);
7618
+ }
7619
+ function _iterable_to_array$1(iter) {
7620
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
7621
+ }
7622
+ function _non_iterable_spread$1() {
7623
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
7624
+ }
7625
+ function _to_consumable_array$1(arr) {
7626
+ return _array_without_holes$1(arr) || _iterable_to_array$1(arr) || _unsupported_iterable_to_array$3(arr) || _non_iterable_spread$1();
7627
+ }
7628
+ function _unsupported_iterable_to_array$3(o, minLen) {
7629
+ if (!o) return;
7630
+ if (typeof o === "string") return _array_like_to_array$3(o, minLen);
7631
+ var n = Object.prototype.toString.call(o).slice(8, -1);
7632
+ if (n === "Object" && o.constructor) n = o.constructor.name;
7633
+ if (n === "Map" || n === "Set") return Array.from(n);
7634
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$3(o, minLen);
7635
+ }
7064
7636
  /**
7065
7637
  * Returns all recognized IANA timezone strings, including the explicit UTC entry.
7066
7638
  *
7639
+ * @returns all known IANA timezone strings plus UTC
7640
+ *
7067
7641
  * @example
7068
7642
  * ```ts
7069
7643
  * const zones = allTimezoneStrings();
7070
7644
  * // ['Africa/Abidjan', ..., 'UTC']
7071
7645
  * ```
7072
7646
  */ function allTimezoneStrings() {
7073
- return timeZonesNames.concat(UTC_TIMEZONE_STRING);
7647
+ return _to_consumable_array$1(timeZonesNames).concat([
7648
+ UTC_TIMEZONE_STRING
7649
+ ]);
7074
7650
  }
7075
7651
  /**
7076
7652
  * Lazily-computed set of all known timezone strings for O(1) membership checks.
@@ -7096,6 +7672,8 @@ var DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = /^[0-9]{0,9}$/;
7096
7672
  /**
7097
7673
  * Returns the {@link TimezoneInfo} for the current system timezone, falling back to UTC.
7098
7674
  *
7675
+ * @returns timezone info for the current system timezone
7676
+ *
7099
7677
  * @example
7100
7678
  * ```ts
7101
7679
  * const info = timezoneInfoForSystem();
@@ -7111,6 +7689,10 @@ var DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = /^[0-9]{0,9}$/;
7111
7689
  * The date matters because abbreviations change with DST transitions.
7112
7690
  * Returns `"UKNOWN"` if no timezone is provided.
7113
7691
  *
7692
+ * @param timezone - the IANA timezone string (or UTC abbreviation) to get the abbreviation for
7693
+ * @param date - the date at which to evaluate the abbreviation (defaults to now)
7694
+ * @returns the short timezone abbreviation
7695
+ *
7114
7696
  * @example
7115
7697
  * ```ts
7116
7698
  * getTimezoneAbbreviation('America/New_York'); // 'EST' or 'EDT'
@@ -7124,6 +7706,10 @@ var DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = /^[0-9]{0,9}$/;
7124
7706
  *
7125
7707
  * Returns `"Unknown Timezone"` if no timezone is provided.
7126
7708
  *
7709
+ * @param timezone - the IANA timezone string to get the long name for
7710
+ * @param date - the date at which to evaluate the name (defaults to now)
7711
+ * @returns the full timezone display name
7712
+ *
7127
7713
  * @example
7128
7714
  * ```ts
7129
7715
  * getTimezoneLongName('America/New_York'); // 'Eastern Standard Time'
@@ -7135,6 +7721,10 @@ var DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = /^[0-9]{0,9}$/;
7135
7721
  /**
7136
7722
  * Builds a {@link TimezoneInfo} for the given timezone, computing abbreviation and search variants.
7137
7723
  *
7724
+ * @param timezone - the IANA timezone string to build info for
7725
+ * @param date - the date at which to evaluate the abbreviation (defaults to now)
7726
+ * @returns the computed TimezoneInfo
7727
+ *
7138
7728
  * @example
7139
7729
  * ```ts
7140
7730
  * const info = timezoneStringToTimezoneInfo('America/Chicago');
@@ -7144,14 +7734,13 @@ var DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = /^[0-9]{0,9}$/;
7144
7734
  */ function timezoneStringToTimezoneInfo(timezone) {
7145
7735
  var date = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : new Date();
7146
7736
  var abbreviation = getTimezoneAbbreviation(timezone, date);
7147
- var result = {
7737
+ return {
7148
7738
  timezone: timezone,
7149
7739
  search: timezoneStringToSearchableString(timezone),
7150
7740
  lowercase: timezone.toLowerCase(),
7151
7741
  abbreviation: abbreviation,
7152
7742
  lowercaseAbbreviation: abbreviation.toLowerCase()
7153
7743
  };
7154
- return result;
7155
7744
  }
7156
7745
  /**
7157
7746
  * Filters timezone infos by a search string, matching against the searchable name,
@@ -7159,6 +7748,10 @@ var DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = /^[0-9]{0,9}$/;
7159
7748
  *
7160
7749
  * For queries longer than 2 characters, substring matching on the searchable name is also used.
7161
7750
  *
7751
+ * @param search - the search query string
7752
+ * @param infos - the array of TimezoneInfo objects to filter
7753
+ * @returns the matching TimezoneInfo entries
7754
+ *
7162
7755
  * @example
7163
7756
  * ```ts
7164
7757
  * const results = searchTimezoneInfos('eastern', allTimezoneInfos());
@@ -7181,6 +7774,9 @@ var timezoneStringToSearchableStringReplace = replaceStringsFunction({
7181
7774
  *
7182
7775
  * Replaces `/` and `_` with spaces (e.g., `"America/New_York"` becomes `"america new york"`).
7183
7776
  *
7777
+ * @param timezone - the IANA timezone string to convert
7778
+ * @returns the searchable lowercase string
7779
+ *
7184
7780
  * @example
7185
7781
  * ```ts
7186
7782
  * timezoneStringToSearchableString('America/New_York'); // 'america new york'
@@ -7193,6 +7789,9 @@ var timezoneStringToSearchableStringReplace = replaceStringsFunction({
7193
7789
  *
7194
7790
  * Uses the cached set from {@link allKnownTimezoneStrings} for O(1) lookup.
7195
7791
  *
7792
+ * @param input - the string to check
7793
+ * @returns whether the input is a known timezone
7794
+ *
7196
7795
  * @example
7197
7796
  * ```ts
7198
7797
  * isKnownTimezone('America/New_York'); // true
@@ -7202,116 +7801,6 @@ var timezoneStringToSearchableStringReplace = replaceStringsFunction({
7202
7801
  return allKnownTimezoneStrings().has(input);
7203
7802
  }
7204
7803
 
7205
- function _define_property$8(obj, key, value) {
7206
- if (key in obj) {
7207
- Object.defineProperty(obj, key, {
7208
- value: value,
7209
- enumerable: true,
7210
- configurable: true,
7211
- writable: true
7212
- });
7213
- } else {
7214
- obj[key] = value;
7215
- }
7216
- return obj;
7217
- }
7218
- function _object_spread$6(target) {
7219
- for(var i = 1; i < arguments.length; i++){
7220
- var source = arguments[i] != null ? arguments[i] : {};
7221
- var ownKeys = Object.keys(source);
7222
- if (typeof Object.getOwnPropertySymbols === "function") {
7223
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
7224
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
7225
- }));
7226
- }
7227
- ownKeys.forEach(function(key) {
7228
- _define_property$8(target, key, source[key]);
7229
- });
7230
- }
7231
- return target;
7232
- }
7233
- /**
7234
- * Distinguishes between time-based calendar events and all-day/multi-day events.
7235
- */ var CalendarDateType;
7236
- (function(CalendarDateType) {
7237
- /**
7238
- * Event starts at a specific time and lasts for a certain duration.
7239
- */ CalendarDateType["TIME"] = "time";
7240
- /**
7241
- * Event is specifically for a number of days. Duration is still tracked in minutes.
7242
- */ CalendarDateType["DAYS"] = "days";
7243
- })(CalendarDateType || (CalendarDateType = {}));
7244
- /**
7245
- * Creates a {@link CalendarDateFactory} that produces all-day calendar events with timezone-aware start times.
7246
- *
7247
- * The factory converts an ISO 8601 day string to a UTC date, then applies timezone normalization
7248
- * so the resulting `startsAt` represents the correct moment for the target timezone.
7249
- *
7250
- * @param config - optional timezone configuration
7251
- * @returns a factory function that creates CalendarDate objects
7252
- *
7253
- * @example
7254
- * ```ts
7255
- * const factory = calendarDateFactory({ timezone: 'America/Denver' });
7256
- * const event = factory('2024-01-15', 3);
7257
- * // event.type === CalendarDateType.DAYS
7258
- * // event.duration === daysToMinutes(3)
7259
- * ```
7260
- */ function calendarDateFactory(config) {
7261
- var normalConfig = (config === null || config === void 0 ? void 0 : config.timezone) === undefined ? {
7262
- useSystemTimezone: true
7263
- } : {
7264
- timezone: config.timezone ? config.timezone : undefined
7265
- };
7266
- var normal = dateTimezoneUtcNormal(normalConfig);
7267
- return function(day, days) {
7268
- var date = parseISO8601DayStringToUTCDate(day);
7269
- var startsAt = normal.targetDateToBaseDate(date);
7270
- return {
7271
- type: CalendarDateType.DAYS,
7272
- startsAt: startsAt,
7273
- duration: daysToMinutes(days)
7274
- };
7275
- };
7276
- }
7277
- /**
7278
- * Convenience function that creates a single all-day {@link CalendarDate} with optional timezone.
7279
- *
7280
- * Shorthand for creating a factory and immediately invoking it.
7281
- *
7282
- * @param day - ISO 8601 day string (e.g. '2024-01-15')
7283
- * @param days - number of days the event spans
7284
- * @param timezone - IANA timezone string, false for UTC, or undefined for system timezone
7285
- * @returns a CalendarDate with type DAYS
7286
- *
7287
- * @example
7288
- * ```ts
7289
- * const event = calendarDate('2024-01-15', 1, 'America/Denver');
7290
- * // event.type === CalendarDateType.DAYS
7291
- * ```
7292
- */ function calendarDate(day, days, timezone) {
7293
- return calendarDateFactory({
7294
- timezone: timezone
7295
- })(day, days);
7296
- }
7297
- /**
7298
- * Wraps an existing {@link DateDurationSpan} as a time-based {@link CalendarDate}.
7299
- *
7300
- * @param dateDurationSpan - the duration span to wrap
7301
- * @returns a CalendarDate with type TIME
7302
- *
7303
- * @example
7304
- * ```ts
7305
- * const span: DateDurationSpan = { startsAt: new Date(), duration: 60 };
7306
- * const event = calendarDateForDateDurationSpan(span);
7307
- * // event.type === CalendarDateType.TIME
7308
- * ```
7309
- */ function calendarDateForDateDurationSpan(dateDurationSpan) {
7310
- return _object_spread$6({
7311
- type: CalendarDateType.TIME
7312
- }, dateDurationSpan);
7313
- }
7314
-
7315
7804
  function _array_like_to_array$2(arr, len) {
7316
7805
  if (len == null || len > arr.length) len = arr.length;
7317
7806
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
@@ -7351,7 +7840,7 @@ var _type, _type1;
7351
7840
  * const result = knownTimezoneType('America/Denver');
7352
7841
  * ```
7353
7842
  */ var knownTimezoneType = type('string > 0').narrow(function(val, ctx) {
7354
- return val != null && isKnownTimezone(val) || ctx.mustBe('a known timezone');
7843
+ return isKnownTimezone(val) || ctx.mustBe('a known timezone');
7355
7844
  });
7356
7845
  // MARK: DateDurationSpan
7357
7846
  /**
@@ -7465,21 +7954,21 @@ var _type, _type1;
7465
7954
  * Accepts both Date objects and date strings (parsed via `string.date.parse`), then validates the resulting timing
7466
7955
  * using {@link isValidDateCellTiming}.
7467
7956
  */ var validDateCellTimingType = dateCellTimingType.narrow(function(val, ctx) {
7468
- return val != null && isValidDateCellTiming(val) || ctx.mustBe('a valid DateCellTiming');
7957
+ return isValidDateCellTiming(val) || ctx.mustBe('a valid DateCellTiming');
7469
7958
  });
7470
7959
  /**
7471
7960
  * ArkType DTO schema that validates a value is a valid {@link DateCellRange} (non-negative indexes, `to >= i`).
7472
7961
  *
7473
7962
  * Validates cell range data from JSON/DTO input.
7474
7963
  */ var validDateCellRangeType = dateCellRangeType.narrow(function(val, ctx) {
7475
- return val != null && isValidDateCellRange(val) || ctx.mustBe('a valid DateCellRange');
7964
+ return isValidDateCellRange(val) || ctx.mustBe('a valid DateCellRange');
7476
7965
  });
7477
7966
  /**
7478
7967
  * ArkType DTO schema that validates a value is a sorted array of non-overlapping {@link DateCellRange} values.
7479
7968
  *
7480
7969
  * Validates cell range series data from JSON/DTO input.
7481
7970
  */ var validDateCellRangeSeriesType = type(dateCellRangeType.array()).narrow(function(val, ctx) {
7482
- return val != null && isValidDateCellRangeSeries(val) || ctx.mustBe('a valid DateCellRange series with items sorted in ascending order and no repeat indexes');
7971
+ return isValidDateCellRangeSeries(val) || ctx.mustBe('a valid DateCellRange series with items sorted in ascending order and no repeat indexes');
7483
7972
  });
7484
7973
 
7485
7974
  function _assert_this_initialized$1(self) {
@@ -7759,7 +8248,7 @@ function _object_spread_props$4(target, source) {
7759
8248
  logicalDate = 'now';
7760
8249
  }
7761
8250
  var intervalPeriod = period !== null && period !== void 0 ? period : MS_IN_SECOND;
7762
- var factory = inputFactory ? inputFactory : protectedFactory(logicalDateStringCodeDateFactory(logicalDate));
8251
+ var factory = inputFactory !== null && inputFactory !== void 0 ? inputFactory : protectedFactory(logicalDateStringCodeDateFactory(logicalDate));
7763
8252
  var obs = interval(intervalPeriod, scheduler).pipe(startWith(-1), map(factory));
7764
8253
  if (emitAll !== true) {
7765
8254
  obs = obs.pipe(distinctUntilChanged(isSameDate));
@@ -7851,7 +8340,8 @@ function _define_property$6(obj, key, value) {
7851
8340
  {
7852
8341
  key: "instant",
7853
8342
  get: function get() {
7854
- return this._config.instant || 'now';
8343
+ var _this__config_instant;
8344
+ return (_this__config_instant = this._config.instant) !== null && _this__config_instant !== void 0 ? _this__config_instant : 'now';
7855
8345
  }
7856
8346
  },
7857
8347
  {
@@ -7896,10 +8386,8 @@ function _define_property$6(obj, key, value) {
7896
8386
  var _this__config = this._config, _this__config_instant = _this__config.instant, instant = _this__config_instant === void 0 ? new Date() : _this__config_instant, _this__config_limits = _this__config.limits, limits = _this__config_limits === void 0 ? {} : _this__config_limits;
7897
8387
  var isPast = limits.isPast, max = limits.max;
7898
8388
  var limit = max;
7899
- if (typeof max !== 'string' && isPast) {
7900
- if (!max || isBefore$1(max, instant)) {
7901
- limit = DATE_NOW_VALUE;
7902
- }
8389
+ if (typeof max !== 'string' && isPast && (!max || isBefore$1(max, instant))) {
8390
+ limit = DATE_NOW_VALUE;
7903
8391
  }
7904
8392
  return limit;
7905
8393
  }
@@ -7914,6 +8402,8 @@ function _define_property$6(obj, key, value) {
7914
8402
  * const limiter = new LimitDateTimeInstance({ limits: { isFuture: true } });
7915
8403
  * const range = limiter.dateRange(); // { start: <now>, end: undefined }
7916
8404
  * ```
8405
+ *
8406
+ * @returns A partial {@link DateRange} with `start` and/or `end` derived from the limits.
7917
8407
  */ key: "dateRange",
7918
8408
  value: function dateRange() {
7919
8409
  var _this__config = this._config, _this__config_instant = _this__config.instant, instant = _this__config_instant === void 0 ? new Date() : _this__config_instant;
@@ -7926,6 +8416,7 @@ function _define_property$6(obj, key, value) {
7926
8416
  * like "now" or relative future offsets to resolve against the given moment.
7927
8417
  *
7928
8418
  * @param instant - The reference point in time for resolving dynamic limits.
8419
+ * @returns A partial {@link DateRange} resolved against the given instant.
7929
8420
  */ key: "dateRangeForInstant",
7930
8421
  value: function dateRangeForInstant(instant) {
7931
8422
  var _this = this, min = _this.min, max = _this.max;
@@ -7949,6 +8440,8 @@ function _define_property$6(obj, key, value) {
7949
8440
  * });
7950
8441
  * const safe = limiter.clamp(new Date()); // at least 30 minutes from now
7951
8442
  * ```
8443
+ *
8444
+ * @returns The clamped date within the allowed range.
7952
8445
  */ key: "clamp",
7953
8446
  value: function clamp(date) {
7954
8447
  var result = date;
@@ -7986,6 +8479,8 @@ function _define_property$6(obj, key, value) {
7986
8479
  * const clamped = limiter.clampDateRange({ start: pastDate, end: futureDate });
7987
8480
  * // clamped.start will be at least now
7988
8481
  * ```
8482
+ *
8483
+ * @returns The date range clamped to the allowed limits.
7989
8484
  */ key: "clampDateRange",
7990
8485
  value: function clampDateRange(dateRange) {
7991
8486
  return clampDateRangeToDateRange(dateRange, this.dateRange());
@@ -8007,6 +8502,8 @@ function _define_property$6(obj, key, value) {
8007
8502
  * });
8008
8503
  * const clamped = limiter.clamp(someDate);
8009
8504
  * ```
8505
+ *
8506
+ * @returns A new {@link LimitDateTimeInstance}.
8010
8507
  */ function limitDateTimeInstance(config) {
8011
8508
  return new LimitDateTimeInstance(config);
8012
8509
  }
@@ -8098,14 +8595,14 @@ function _object_spread_props$3(target, source) {
8098
8595
  function DateTimeMinuteInstance() {
8099
8596
  var config = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, dateOverride = arguments.length > 1 ? arguments[1] : void 0;
8100
8597
  _class_call_check$5(this, DateTimeMinuteInstance);
8101
- var _config_step;
8598
+ var _ref, _config_step;
8102
8599
  _define_property$5(this, "_config", void 0);
8103
8600
  _define_property$5(this, "_date", void 0);
8104
8601
  _define_property$5(this, "_step", void 0);
8105
8602
  _define_property$5(this, "_limit", void 0);
8106
8603
  _define_property$5(this, "_dateFilter", void 0);
8107
8604
  this._config = config;
8108
- this._date = (dateOverride == undefined ? config.date : dateOverride) || new Date();
8605
+ this._date = (_ref = dateOverride !== null && dateOverride !== void 0 ? dateOverride : config.date) !== null && _ref !== void 0 ? _ref : new Date();
8109
8606
  this._step = (_config_step = config.step) !== null && _config_step !== void 0 ? _config_step : 1;
8110
8607
  this._limit = new LimitDateTimeInstance(config);
8111
8608
  this._dateFilter = config.schedule ? dateCellScheduleDateFilter(config.schedule) : undefined;
@@ -8139,6 +8636,8 @@ function _object_spread_props$3(target, source) {
8139
8636
  key: "limitInstance",
8140
8637
  get: /**
8141
8638
  * Returns the LimitDateTimeInstance. This does not take the schedule into consideration.
8639
+ *
8640
+ * @returns The underlying {@link LimitDateTimeInstance}.
8142
8641
  */ function get() {
8143
8642
  return this._limit;
8144
8643
  }
@@ -8161,6 +8660,8 @@ function _object_spread_props$3(target, source) {
8161
8660
  * // true if June 15 is a weekday and overlaps the limit range
8162
8661
  * instance.dateDayContainsValidDateValue(new Date('2024-06-15'));
8163
8662
  * ```
8663
+ *
8664
+ * @returns `true` if the day contains at least one valid date/time value.
8164
8665
  */ key: "dateDayContainsValidDateValue",
8165
8666
  value: function dateDayContainsValidDateValue(date) {
8166
8667
  var isInSchedule = this.dateIsInSchedule(date);
@@ -8199,6 +8700,8 @@ function _object_spread_props$3(target, source) {
8199
8700
  *
8200
8701
  * instance.isInValidRange(new Date('2024-06-15T10:00:00')); // true if a weekday
8201
8702
  * ```
8703
+ *
8704
+ * @returns `true` if the date is within the min/max limits and on a scheduled day.
8202
8705
  */ key: "isInValidRange",
8203
8706
  value: function isInValidRange(date) {
8204
8707
  var result = this.getStatus(date);
@@ -8221,6 +8724,8 @@ function _object_spread_props$3(target, source) {
8221
8724
  *
8222
8725
  * instance.isValid(new Date('2099-03-15T10:00:00')); // true if all constraints pass
8223
8726
  * ```
8727
+ *
8728
+ * @returns `true` if the date passes all configured constraints.
8224
8729
  */ key: "isValid",
8225
8730
  value: function isValid(date) {
8226
8731
  var result = this.getStatus(date);
@@ -8244,6 +8749,8 @@ function _object_spread_props$3(target, source) {
8244
8749
  * // status.isAfterMinimum === false (before min)
8245
8750
  * // status.inFuture === false (if date is in the past)
8246
8751
  * ```
8752
+ *
8753
+ * @returns A {@link DateTimeMinuteDateStatus} snapshot for the given date.
8247
8754
  */ key: "getStatus",
8248
8755
  value: function getStatus() {
8249
8756
  var date = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.date;
@@ -8302,6 +8809,8 @@ function _object_spread_props$3(target, source) {
8302
8809
  *
8303
8810
  * instance.dateIsInSchedule(new Date('2024-06-15')); // true (Saturday = false)
8304
8811
  * ```
8812
+ *
8813
+ * @returns `true` if the date is on a scheduled day or no schedule is configured.
8305
8814
  */ key: "dateIsInSchedule",
8306
8815
  value: function dateIsInSchedule() {
8307
8816
  var date = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.date;
@@ -8326,6 +8835,8 @@ function _object_spread_props$3(target, source) {
8326
8835
  * instance.round({ roundToSteps: true }); // 2024-06-15T09:00:00
8327
8836
  * instance.round({ roundToSteps: true, roundToBound: true }); // clamped to min if below
8328
8837
  * ```
8838
+ *
8839
+ * @returns The rounded (and optionally clamped) date.
8329
8840
  */ key: "round",
8330
8841
  value: function round(round) {
8331
8842
  var _round_step;
@@ -8355,6 +8866,8 @@ function _object_spread_props$3(target, source) {
8355
8866
  *
8356
8867
  * instance.clamp(new Date('2024-05-25')); // clamped to min, then nearest weekday
8357
8868
  * ```
8869
+ *
8870
+ * @returns The date clamped to both the limits and the schedule.
8358
8871
  */ key: "clamp",
8359
8872
  value: function clamp() {
8360
8873
  var date = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.date, maxClampDistance = arguments.length > 1 ? arguments[1] : void 0;
@@ -8375,6 +8888,8 @@ function _object_spread_props$3(target, source) {
8375
8888
  *
8376
8889
  * instance.clampToLimit(new Date('2025-03-01')); // returns max (2024-12-31)
8377
8890
  * ```
8891
+ *
8892
+ * @returns The date clamped to the configured min/max limits.
8378
8893
  */ key: "clampToLimit",
8379
8894
  value: function clampToLimit() {
8380
8895
  var date = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.date;
@@ -8399,6 +8914,8 @@ function _object_spread_props$3(target, source) {
8399
8914
  * // If June 15, 2024 is a Saturday, returns the next Monday
8400
8915
  * instance.clampToSchedule(new Date('2024-06-15'));
8401
8916
  * ```
8917
+ *
8918
+ * @returns The nearest valid scheduled date, or the input date if already valid or no schedule is configured.
8402
8919
  */ key: "clampToSchedule",
8403
8920
  value: function clampToSchedule() {
8404
8921
  var date = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.date, maxClampDistance = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 370;
@@ -8433,9 +8950,7 @@ function _object_spread_props$3(target, source) {
8433
8950
  }
8434
8951
  }
8435
8952
  // set a default from the given input if applicable
8436
- if (nextAvailableDate == null) {
8437
- nextAvailableDate = this.clampToLimit(date);
8438
- }
8953
+ nextAvailableDate !== null && nextAvailableDate !== void 0 ? nextAvailableDate : nextAvailableDate = this.clampToLimit(date);
8439
8954
  }
8440
8955
  }
8441
8956
  return nextAvailableDate !== null && nextAvailableDate !== void 0 ? nextAvailableDate : date;
@@ -8460,6 +8975,8 @@ function _object_spread_props$3(target, source) {
8460
8975
  * // Find the next weekday after a Saturday
8461
8976
  * instance.findNextAvailableDayInSchedule(new Date('2024-06-15'), 'future');
8462
8977
  * ```
8978
+ *
8979
+ * @returns The next valid schedule date, or `undefined` if none found within the max distance.
8463
8980
  */ key: "findNextAvailableDayInSchedule",
8464
8981
  value: function findNextAvailableDayInSchedule(date, direction) {
8465
8982
  var maxDistance = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 370;
@@ -8495,6 +9012,8 @@ function _object_spread_props$3(target, source) {
8495
9012
  * instance.isInSchedule(new Date('2024-06-17')); // true (Monday)
8496
9013
  * instance.isInSchedule(new Date('2024-06-16')); // false (Sunday)
8497
9014
  * ```
9015
+ *
9016
+ * @returns `true` if the date is on a scheduled day or no schedule is configured.
8498
9017
  */ key: "isInSchedule",
8499
9018
  value: function isInSchedule(date) {
8500
9019
  return this._dateFilter ? this._dateFilter(date) : true;
@@ -8554,6 +9073,8 @@ function _object_spread_props$3(target, source) {
8554
9073
  *
8555
9074
  * isValid(new Date('2024-06-17T10:00:00')); // true if future weekday after min
8556
9075
  * ```
9076
+ *
9077
+ * @returns A decision function that returns `true` for valid dates.
8557
9078
  */ function dateTimeMinuteDecisionFunction(config) {
8558
9079
  var instance = new DateTimeMinuteInstance(config, null);
8559
9080
  return function(date) {
@@ -8586,6 +9107,8 @@ function _object_spread_props$3(target, source) {
8586
9107
  * // true only if both 00:00 and 23:59 on June 15 pass all constraints
8587
9108
  * isFullDayValid(new Date('2024-06-15'));
8588
9109
  * ```
9110
+ *
9111
+ * @returns A decision function that returns `true` for valid days.
8589
9112
  */ function dateTimeMinuteWholeDayDecisionFunction(config) {
8590
9113
  var startAndEndOfDayMustBeValid = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
8591
9114
  var instance = new DateTimeMinuteInstance(config, null);
@@ -8670,6 +9193,7 @@ function _object_spread_props$2(target, source) {
8670
9193
  * guaranteeing that `raw` and `result` are defined.
8671
9194
  *
8672
9195
  * @param result - The parse result to check.
9196
+ * @returns `true` if the result is valid, narrowing the type to {@link ValidDateFromTimestringResult}.
8673
9197
  *
8674
9198
  * @example
8675
9199
  * ```ts
@@ -8713,6 +9237,7 @@ function _object_spread_props$2(target, source) {
8713
9237
  *
8714
9238
  * @param date - The date to check. Defaults to now.
8715
9239
  * @param timezone - Overrides the instance's configured timezone for this call.
9240
+ * @returns {@link TimeAM.AM} or {@link TimeAM.PM} depending on the time of day.
8716
9241
  *
8717
9242
  * @example
8718
9243
  * ```ts
@@ -8732,6 +9257,7 @@ function _object_spread_props$2(target, source) {
8732
9257
  *
8733
9258
  * @param date - The date to format.
8734
9259
  * @param timezone - Overrides the instance's configured timezone for this call.
9260
+ * @returns The formatted time string (e.g., "1:30PM").
8735
9261
  *
8736
9262
  * @example
8737
9263
  * ```ts
@@ -8826,18 +9352,35 @@ function _object_spread_props$2(target, source) {
8826
9352
  'h:mm',
8827
9353
  'HH:mm' // 01:20
8828
9354
  ];
8829
- // tslint:disable-next-line: prefer-for-of
8830
- for(var i = 0; i < formats.length; i += 1){
8831
- systemParsedDateTime = parse(input, formats[i], relativeDate);
8832
- if (isValid(systemParsedDateTime)) {
8833
- valid = true;
8834
- break; // Use time.
9355
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
9356
+ try {
9357
+ // tslint:disable-next-line: prefer-for-of
9358
+ for(var _iterator = formats[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
9359
+ var format = _step.value;
9360
+ systemParsedDateTime = parse(input, format, relativeDate);
9361
+ if (isValid(systemParsedDateTime)) {
9362
+ valid = true;
9363
+ break; // Use time.
9364
+ }
9365
+ }
9366
+ } catch (err) {
9367
+ _didIteratorError = true;
9368
+ _iteratorError = err;
9369
+ } finally{
9370
+ try {
9371
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
9372
+ _iterator.return();
9373
+ }
9374
+ } finally{
9375
+ if (_didIteratorError) {
9376
+ throw _iteratorError;
9377
+ }
8835
9378
  }
8836
9379
  }
8837
9380
  var removedPm = false;
8838
9381
  function removeAmPm(inputString) {
8839
9382
  inputString = inputString.toLowerCase();
8840
- removedPm = inputString.indexOf('pm') !== -1;
9383
+ removedPm = inputString.includes('pm');
8841
9384
  inputString = inputString.replace(/am|pm/g, '');
8842
9385
  return inputString;
8843
9386
  }
@@ -8937,6 +9480,8 @@ function _object_spread_props$2(target, source) {
8937
9480
  /**
8938
9481
  * Creates a {@link DateTimeUtilityInstance} configured for UTC.
8939
9482
  *
9483
+ * @returns A new {@link DateTimeUtilityInstance} using the UTC timezone.
9484
+ *
8940
9485
  * @example
8941
9486
  * ```ts
8942
9487
  * const utcInstance = dateTimeInstanceUtc();
@@ -8950,6 +9495,7 @@ function _object_spread_props$2(target, source) {
8950
9495
  * Defaults to UTC when no timezone is provided.
8951
9496
  *
8952
9497
  * @param timezone - The IANA timezone identifier (e.g., 'America/New_York').
9498
+ * @returns A new {@link DateTimeUtilityInstance} for the specified timezone.
8953
9499
  *
8954
9500
  * @example
8955
9501
  * ```ts
@@ -8964,6 +9510,7 @@ function _object_spread_props$2(target, source) {
8964
9510
  *
8965
9511
  * @param date - The date to check. Defaults to now.
8966
9512
  * @param timezone - The IANA timezone to evaluate in. Defaults to UTC.
9513
+ * @returns {@link TimeAM.AM} or {@link TimeAM.PM} depending on the time of day.
8967
9514
  *
8968
9515
  * @example
8969
9516
  * ```ts
@@ -8981,6 +9528,7 @@ function _object_spread_props$2(target, source) {
8981
9528
  * unlike {@link toReadableTimeString} which defaults to UTC.
8982
9529
  *
8983
9530
  * @param date - The date to format.
9531
+ * @returns The formatted time string in the system's local timezone.
8984
9532
  *
8985
9533
  * @example
8986
9534
  * ```ts
@@ -8994,6 +9542,7 @@ function _object_spread_props$2(target, source) {
8994
9542
  *
8995
9543
  * @param date - The date to format.
8996
9544
  * @param timezone - The IANA timezone to format in. Defaults to UTC.
9545
+ * @returns The formatted time string (e.g., "10:30AM").
8997
9546
  *
8998
9547
  * @example
8999
9548
  * ```ts
@@ -9009,6 +9558,7 @@ function _object_spread_props$2(target, source) {
9009
9558
  *
9010
9559
  * @param input - A time string such as "1:30PM", "13:30", or "1PM".
9011
9560
  * @param config - Optional configuration specifying the timezone and reference date.
9561
+ * @returns The parsed time string result, or `undefined` if parsing failed.
9012
9562
  *
9013
9563
  * @example
9014
9564
  * ```ts
@@ -9027,6 +9577,7 @@ function _object_spread_props$2(target, source) {
9027
9577
  *
9028
9578
  * @param input - A time string such as "1:30PM" or "13:30".
9029
9579
  * @param config - Optional configuration specifying the timezone and reference date.
9580
+ * @returns The resolved date, or `undefined` if the input could not be parsed.
9030
9581
  *
9031
9582
  * @example
9032
9583
  * ```ts
@@ -9040,6 +9591,7 @@ function _object_spread_props$2(target, source) {
9040
9591
  * Creates a {@link LimitDateTimeInstance} for clamping and constraining dates to a configured range.
9041
9592
  *
9042
9593
  * @param config - The limit configuration specifying min/max bounds, future requirements, etc.
9594
+ * @returns A new {@link LimitDateTimeInstance} configured with the given bounds.
9043
9595
  *
9044
9596
  * @example
9045
9597
  * ```ts
@@ -9149,6 +9701,7 @@ function _object_spread_props$1(target, source) {
9149
9701
  date: toZonedTime(find.range.date, find.timezone)
9150
9702
  }) : find.range;
9151
9703
  var dates = dateRange(range);
9704
+ // eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check
9152
9705
  switch(range.type){
9153
9706
  case DateRangeType.DAY:
9154
9707
  case DateRangeType.WEEK:
@@ -9344,13 +9897,12 @@ function _object_spread$1(target) {
9344
9897
  // A single field that manages start/end will start and end at the same instant (end = start)
9345
9898
  // so we merge the gte/lte values.
9346
9899
  var merged = mergeMongoDBLikeRangeFilters(startsAt, endsAt);
9347
- startsAtFilter = merged ? _define_property$2({}, fields.start, merged) : undefined;
9900
+ startsAtFilter = _define_property$2({}, fields.start, merged);
9348
9901
  } else {
9349
9902
  startsAtFilter = startsAt ? _define_property$2({}, fields.start, startsAt) : undefined;
9350
9903
  endsAtFilter = endsAt && fields.end ? _define_property$2({}, fields.end, endsAt) : undefined;
9351
9904
  }
9352
- var filter = _object_spread$1({}, startsAtFilter, endsAtFilter);
9353
- return filter;
9905
+ return _object_spread$1({}, startsAtFilter, endsAtFilter);
9354
9906
  }
9355
9907
  };
9356
9908
  }
@@ -9473,6 +10025,8 @@ function _is_native_reflect_construct() {
9473
10025
  * const rule = new DateRRule({ freq: RRule.DAILY, count: 5, dtstart: startDate });
9474
10026
  * const lastDate = rule.last(); // fifth occurrence
9475
10027
  * ```
10028
+ *
10029
+ * @returns The last occurrence date, or `undefined` if there are none.
9476
10030
  */ key: "last",
9477
10031
  value: function last() {
9478
10032
  return this._iter(new LastIterResult());
@@ -9487,6 +10041,9 @@ function _is_native_reflect_construct() {
9487
10041
  * const rule = new DateRRule({ freq: RRule.WEEKLY, dtstart: startDate });
9488
10042
  * const nextDate = rule.next(new Date());
9489
10043
  * ```
10044
+ *
10045
+ * @param minDate - The earliest date to consider.
10046
+ * @returns The first occurrence on or after `minDate`, or `undefined` if none.
9490
10047
  */ key: "next",
9491
10048
  value: function next(minDate) {
9492
10049
  return this._iter(new NextIterResult(minDate));
@@ -9501,6 +10058,11 @@ function _is_native_reflect_construct() {
9501
10058
  * const rule = new DateRRule({ freq: RRule.DAILY, dtstart: startDate });
9502
10059
  * const exists = rule.any({ minDate: rangeStart, maxDate: rangeEnd });
9503
10060
  * ```
10061
+ *
10062
+ * @param filter - Optional date bounds with `minDate` and `maxDate`.
10063
+ * @param filter.minDate - Optional minimum date bound.
10064
+ * @param filter.maxDate - Optional maximum date bound.
10065
+ * @returns `true` if at least one recurrence falls within the bounds.
9504
10066
  */ key: "any",
9505
10067
  value: function any() {
9506
10068
  var filter = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
@@ -9761,7 +10323,10 @@ function _unsupported_iterable_to_array$1(o, minLen) {
9761
10323
  /**
9762
10324
  * Delimiter separating the property name/params from values in an RRule line.
9763
10325
  */ var RRULE_STRING_SPLITTER = ':';
9764
- /** @deprecated use RRULE_STRING_SPLITTER instead. */ var RRuleStringSplitter = RRULE_STRING_SPLITTER;
10326
+ /**
10327
+ * @deprecated use RRULE_STRING_SPLITTER instead.
10328
+ */ // eslint-disable-next-line @typescript-eslint/naming-convention
10329
+ var RRuleStringSplitter = RRULE_STRING_SPLITTER;
9765
10330
  /**
9766
10331
  * Utility class for parsing and manipulating RFC 5545 RRule strings.
9767
10332
  *
@@ -9792,6 +10357,9 @@ function _unsupported_iterable_to_array$1(o, minLen) {
9792
10357
  * // result.basic = ['RRULE:FREQ=DAILY']
9793
10358
  * // result.exdates contains the parsed exclusion dates
9794
10359
  * ```
10360
+ *
10361
+ * @param input - The RRule string line set to separate.
10362
+ * @returns The separated basic rules and parsed EXDATE exclusion dates.
9795
10363
  */ function separateRRuleStringSetValues(input) {
9796
10364
  var basic = [];
9797
10365
  var exdateRules = [];
@@ -9821,6 +10389,8 @@ function _unsupported_iterable_to_array$1(o, minLen) {
9821
10389
  /**
9822
10390
  * Parses an EXDATE line into its timezone and date components.
9823
10391
  *
10392
+ * @param line - The raw EXDATE line string to parse.
10393
+ * @returns The parsed EXDATE attribute with timezone and dates.
9824
10394
  * @throws Error if the line is not an EXDATE property.
9825
10395
  */ function parseExdateAttributeFromLine(line) {
9826
10396
  var property = this.parseProperty(line);
@@ -9832,6 +10402,9 @@ function _unsupported_iterable_to_array$1(o, minLen) {
9832
10402
  key: "parseExdateAttributeFromProperty",
9833
10403
  value: /**
9834
10404
  * Extracts timezone and UTC-normalized dates from an already-parsed EXDATE property.
10405
+ *
10406
+ * @param property - The parsed EXDATE property to extract from.
10407
+ * @returns The EXDATE attribute containing timezone and UTC-normalized dates.
9835
10408
  */ function parseExdateAttributeFromProperty(property) {
9836
10409
  var _property_params_find;
9837
10410
  var timezone = (_property_params_find = property.params.find(function(x) {
@@ -9855,6 +10428,9 @@ function _unsupported_iterable_to_array$1(o, minLen) {
9855
10428
  value: /**
9856
10429
  * Convenience wrapper that creates a timezone converter and delegates to {@link parseDateTimeString}.
9857
10430
  *
10431
+ * @param rfcDateString - The RFC 5545 date or date-time string to parse.
10432
+ * @param timezone - Optional timezone for non-UTC date strings.
10433
+ * @returns The parsed JavaScript Date.
9858
10434
  * @throws Error if the date string is not UTC and no timezone is provided.
9859
10435
  */ function parseDateTimeStringWithTimezone(rfcDateString, timezone) {
9860
10436
  return DateRRuleParseUtility.parseDateTimeString(rfcDateString, timezone ? new DateTimezoneUtcNormalInstance({
@@ -9870,6 +10446,9 @@ function _unsupported_iterable_to_array$1(o, minLen) {
9870
10446
  * If the string does not end in `Z` (indicating UTC), the converter is used to normalize
9871
10447
  * the local date representation to its true UTC equivalent.
9872
10448
  *
10449
+ * @param rfcDateString - The RFC 5545 date or date-time string to parse.
10450
+ * @param converter - Optional timezone converter for non-UTC date strings.
10451
+ * @returns The parsed JavaScript Date.
9873
10452
  * @throws Error if the string cannot be parsed or a non-UTC string lacks a converter.
9874
10453
  */ function parseDateTimeString(rfcDateString, converter) {
9875
10454
  var RFC5545_DATE_TIME_FORMAT = /^((\d{4})(\d{2})(\d{2}))(T(\d{2})(\d{2})(\d{2})Z?)?$/;
@@ -9913,6 +10492,9 @@ function _unsupported_iterable_to_array$1(o, minLen) {
9913
10492
  * DateRRuleParseUtility.formatDateTimeString(new Date('2021-06-11T11:00:00Z'));
9914
10493
  * // => '20210611T110000Z'
9915
10494
  * ```
10495
+ *
10496
+ * @param date - The date to format.
10497
+ * @returns The RFC 5545 UTC date-time string representation.
9916
10498
  */ function formatDateTimeString(date) {
9917
10499
  return format(date, "yyyyMMdd'T'HHmmss'Z'");
9918
10500
  }
@@ -9921,6 +10503,9 @@ function _unsupported_iterable_to_array$1(o, minLen) {
9921
10503
  key: "parseProperty",
9922
10504
  value: /**
9923
10505
  * Parses a full RRule line string into a structured {@link RRuleProperty}.
10506
+ *
10507
+ * @param line - The raw RRule line string to parse.
10508
+ * @returns The structured property with type, params, and values.
9924
10509
  */ function parseProperty(line) {
9925
10510
  var rawLine = DateRRuleParseUtility.parseRawLine(line);
9926
10511
  return DateRRuleParseUtility.propertyFromRawLine(rawLine);
@@ -9930,6 +10515,9 @@ function _unsupported_iterable_to_array$1(o, minLen) {
9930
10515
  key: "propertyFromRawLine",
9931
10516
  value: /**
9932
10517
  * Converts an {@link RRuleRawLine} into a structured {@link RRuleProperty} by splitting the type and params.
10518
+ *
10519
+ * @param rawLine - The raw line to convert.
10520
+ * @returns The structured property with separated type, params, and values.
9933
10521
  */ function propertyFromRawLine(rawLine) {
9934
10522
  var typeAndParams = rawLine.params.split(';');
9935
10523
  var type = typeAndParams[0].toUpperCase();
@@ -9945,6 +10533,9 @@ function _unsupported_iterable_to_array$1(o, minLen) {
9945
10533
  key: "parseRawParam",
9946
10534
  value: /**
9947
10535
  * Splits a raw param string (e.g., `"TZID=America/New_York"`) into key-value form.
10536
+ *
10537
+ * @param param - The raw param string to split.
10538
+ * @returns The parsed key-value param.
9948
10539
  */ function parseRawParam(param) {
9949
10540
  var _splitJoinRemainder = _sliced_to_array$1(splitJoinRemainder(param, '=', 2), 2), key = _splitJoinRemainder[0], value = _splitJoinRemainder[1];
9950
10541
  return {
@@ -9958,6 +10549,9 @@ function _unsupported_iterable_to_array$1(o, minLen) {
9958
10549
  value: /**
9959
10550
  * Splits a raw line at the colon delimiter into params and values portions.
9960
10551
  * Falls back to treating a single-segment line as an RRULE value.
10552
+ *
10553
+ * @param line - The raw RRule line string to split.
10554
+ * @returns The raw line with separated params and values.
9961
10555
  */ function parseRawLine(line) {
9962
10556
  var _splitJoinRemainder = _sliced_to_array$1(splitJoinRemainder(line, RRULE_STRING_SPLITTER, 2), 2), params = _splitJoinRemainder[0], values = _splitJoinRemainder[1];
9963
10557
  var result;
@@ -9980,6 +10574,9 @@ function _unsupported_iterable_to_array$1(o, minLen) {
9980
10574
  value: // MARK: String
9981
10575
  /**
9982
10576
  * Splits a newline-delimited RRule string into individual line strings.
10577
+ *
10578
+ * @param lines - The newline-delimited RRule string to split.
10579
+ * @returns An array of individual RRule line strings.
9983
10580
  */ function toRRuleStringSet(lines) {
9984
10581
  return lines.split('\n');
9985
10582
  }
@@ -9988,6 +10585,9 @@ function _unsupported_iterable_to_array$1(o, minLen) {
9988
10585
  key: "toRRuleLines",
9989
10586
  value: /**
9990
10587
  * Joins an array of RRule line strings into a single newline-delimited string.
10588
+ *
10589
+ * @param rruleStringSet - The array of RRule line strings to join.
10590
+ * @returns A single newline-delimited RRule string.
9991
10591
  */ function toRRuleLines(rruleStringSet) {
9992
10592
  return rruleStringSet.join('\n');
9993
10593
  }
@@ -9998,6 +10598,8 @@ function _unsupported_iterable_to_array$1(o, minLen) {
9998
10598
  /**
9999
10599
  * Asserts that the property has the expected type, throwing if it does not match.
10000
10600
  *
10601
+ * @param type - The expected property type.
10602
+ * @param property - The property to check.
10001
10603
  * @throws Error if the property type does not match the expected type.
10002
10604
  */ function assertPropertyType(type, property) {
10003
10605
  if (property.type !== type) {
@@ -10138,7 +10740,7 @@ function _unsupported_iterable_to_array(o, minLen) {
10138
10740
  this.options = options;
10139
10741
  var tzid = rrule.origOptions.tzid;
10140
10742
  var dtstart = rrule.origOptions.dtstart;
10141
- var timezone = tzid || options.timezone;
10743
+ var timezone = tzid !== null && tzid !== void 0 ? tzid : options.timezone;
10142
10744
  /**
10143
10745
  * The normal instance for DateRRuleInstance is used backwards in most cases because DateRRule always
10144
10746
  * parses dates as UTC, so we handle all input dates as base dates, an
@@ -10189,8 +10791,7 @@ function _unsupported_iterable_to_array(o, minLen) {
10189
10791
  var from = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : new Date();
10190
10792
  var baseFrom = this.normalInstance.baseDateToTargetDate(from);
10191
10793
  var rawNext = this.rrule.next(baseFrom);
10192
- var next = rawNext ? this.normalInstance.targetDateToBaseDate(rawNext) : undefined;
10193
- return next;
10794
+ return rawNext ? this.normalInstance.targetDateToBaseDate(rawNext) : undefined;
10194
10795
  }
10195
10796
  },
10196
10797
  {
@@ -10331,11 +10932,12 @@ function _unsupported_iterable_to_array(o, minLen) {
10331
10932
  /**
10332
10933
  * Returns `true` when the underlying RRule has neither a `count` nor an
10333
10934
  * `until` constraint, meaning it recurs indefinitely.
10935
+ *
10936
+ * @returns `true` if the rule recurs indefinitely.
10334
10937
  */ key: "hasForeverRange",
10335
10938
  value: function hasForeverRange() {
10336
10939
  var options = this.rrule.options;
10337
- var forever = !options.count && !options.until;
10338
- return forever;
10940
+ return !options.count && !options.until;
10339
10941
  }
10340
10942
  }
10341
10943
  ], [