@dereekb/date 13.4.0 → 13.4.1

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;
@@ -2378,6 +2560,7 @@ function calculateAllConversions(date, converter) {
2378
2560
  instance = config;
2379
2561
  } else {
2380
2562
  var type = typeof config === "undefined" ? "undefined" : _type_of$6(config);
2563
+ // eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check
2381
2564
  switch(type){
2382
2565
  case 'object':
2383
2566
  instance = new DateTimezoneUtcNormalInstance(config);
@@ -2393,7 +2576,7 @@ function calculateAllConversions(date, converter) {
2393
2576
  });
2394
2577
  break;
2395
2578
  default:
2396
- throw new Error('Invalid input passed to dateTimezoneUtcNormal()');
2579
+ throw new Error('Invalid input type "'.concat(type, '" passed to dateTimezoneUtcNormal()'));
2397
2580
  }
2398
2581
  }
2399
2582
  return instance;
@@ -2416,6 +2599,8 @@ function calculateAllConversions(date, converter) {
2416
2599
  *
2417
2600
  * Prefer this over constructing a new instance when you need system-timezone conversions,
2418
2601
  * as the singleton avoids unnecessary allocations.
2602
+ *
2603
+ * @returns the shared system-timezone DateTimezoneUtcNormalInstance singleton
2419
2604
  */ function systemDateTimezoneUtcNormal() {
2420
2605
  return SYSTEM_DATE_TIMEZONE_UTC_NORMAL_INSTANCE;
2421
2606
  }
@@ -2432,10 +2617,13 @@ function calculateAllConversions(date, converter) {
2432
2617
  * const target = baseDateToTargetDate(base, 'America/Denver');
2433
2618
  * // target is 2024-06-15T14:00:00.000-06:00 (2PM MDT)
2434
2619
  * ```
2620
+ *
2621
+ * @param date - the BaseDateAsUTC to convert
2622
+ * @param timezone - the target IANA timezone string
2623
+ * @returns a real instant in the specified timezone
2435
2624
  */ function baseDateToTargetDate(date, timezone) {
2436
2625
  var instance = new DateTimezoneUtcNormalInstance(timezone);
2437
- var result = instance.baseDateToTargetDate(date);
2438
- return result;
2626
+ return instance.baseDateToTargetDate(date);
2439
2627
  }
2440
2628
  /**
2441
2629
  * Convenience function that strips the timezone offset from a target-timezone date,
@@ -2450,30 +2638,46 @@ function calculateAllConversions(date, converter) {
2450
2638
  * const base = targetDateToBaseDate(target, 'America/Denver');
2451
2639
  * // base is 2024-06-15T14:00:00.000Z — wall-clock 2PM preserved as UTC
2452
2640
  * ```
2641
+ *
2642
+ * @param date - the target-timezone date to convert
2643
+ * @param timezone - the IANA timezone the date is expressed in
2644
+ * @returns a BaseDateAsUTC with wall-clock time preserved as UTC
2453
2645
  */ function targetDateToBaseDate(date, timezone) {
2454
2646
  return new DateTimezoneUtcNormalInstance(timezone).targetDateToBaseDate(date);
2455
2647
  }
2456
2648
  /**
2457
2649
  * Converts a {@link BaseDateAsUTC} to a target date in the system's local timezone
2458
2650
  * using the shared system-timezone instance.
2651
+ *
2652
+ * @param date - the BaseDateAsUTC to convert
2653
+ * @returns the date converted to the system's local timezone
2459
2654
  */ function systemBaseDateToNormalDate(date) {
2460
2655
  return SYSTEM_DATE_TIMEZONE_UTC_NORMAL_INSTANCE.baseDateToTargetDate(date);
2461
2656
  }
2462
2657
  /**
2463
2658
  * Converts a target date in the system's local timezone back to a {@link BaseDateAsUTC}
2464
2659
  * using the shared system-timezone instance.
2660
+ *
2661
+ * @param date - the system-timezone target date to convert back to base
2662
+ * @returns the corresponding BaseDateAsUTC
2465
2663
  */ function systemNormalDateToBaseDate(date) {
2466
2664
  return SYSTEM_DATE_TIMEZONE_UTC_NORMAL_INSTANCE.targetDateToBaseDate(date);
2467
2665
  }
2468
2666
  /**
2469
2667
  * Returns the millisecond offset needed to convert a {@link BaseDateAsUTC} to a target date
2470
2668
  * in the system's local timezone.
2669
+ *
2670
+ * @param date - the date to compute the offset for
2671
+ * @returns the offset in milliseconds
2471
2672
  */ function systemBaseDateToNormalDateOffset(date) {
2472
2673
  return SYSTEM_DATE_TIMEZONE_UTC_NORMAL_INSTANCE.baseDateToTargetDateOffset(date);
2473
2674
  }
2474
2675
  /**
2475
2676
  * Returns the millisecond offset needed to convert a target date in the system's
2476
2677
  * local timezone back to a {@link BaseDateAsUTC}.
2678
+ *
2679
+ * @param date - the date to compute the offset for
2680
+ * @returns the offset in milliseconds
2477
2681
  */ function systemNormalDateToBaseDateOffset(date) {
2478
2682
  return SYSTEM_DATE_TIMEZONE_UTC_NORMAL_INSTANCE.targetDateToBaseDateOffset(date);
2479
2683
  }
@@ -2481,6 +2685,9 @@ function calculateAllConversions(date, converter) {
2481
2685
  * Returns whether the system's local timezone observes daylight saving time in the given year.
2482
2686
  *
2483
2687
  * Compares the offset on January 1 and July 1; if they differ, DST is in effect for part of the year.
2688
+ *
2689
+ * @param year - the year to check, as a Date
2690
+ * @returns true if the system timezone observes DST in the given year
2484
2691
  */ function systemExperiencesDaylightSavings(year) {
2485
2692
  return SYSTEM_DATE_TIMEZONE_UTC_NORMAL_INSTANCE.targetTimezoneExperiencesDaylightSavings(year);
2486
2693
  }
@@ -2496,7 +2703,9 @@ function calculateAllConversions(date, converter) {
2496
2703
  * const result = fn(someDate, (d) => startOfDay(d));
2497
2704
  * ```
2498
2705
  *
2706
+ * @param timezoneInput - timezone configuration for the conversion
2499
2707
  * @param transformType - defaults to `'systemDateToTargetDate'`
2708
+ * @returns a function that transforms dates within the specified timezone normalization
2500
2709
  */ function transformDateInTimezoneNormalFunction(timezoneInput) {
2501
2710
  var transformType = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 'systemDateToTargetDate';
2502
2711
  var timezoneInstance = dateTimezoneUtcNormal(timezoneInput);
@@ -2515,7 +2724,9 @@ function calculateAllConversions(date, converter) {
2515
2724
  * Creates a {@link TransformDateRangeToTimezoneFunction} that converts both dates in
2516
2725
  * a {@link DateRange} using the specified transform type.
2517
2726
  *
2727
+ * @param timezoneInput - timezone configuration for the conversion
2518
2728
  * @param transformType - defaults to `'systemDateToTargetDate'`
2729
+ * @returns a function that converts DateRange dates using the specified transform
2519
2730
  */ function transformDateRangeToTimezoneFunction(timezoneInput) {
2520
2731
  var transformType = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 'systemDateToTargetDate';
2521
2732
  var timezoneInstance = dateTimezoneUtcNormal(timezoneInput);
@@ -2528,7 +2739,9 @@ function calculateAllConversions(date, converter) {
2528
2739
  * Creates a {@link TransformDateRangeInTimezoneNormalFunction} that converts a date range
2529
2740
  * into the specified date space, applies a user-provided range transformation, then converts back.
2530
2741
  *
2742
+ * @param timezoneInput - timezone configuration for the conversion
2531
2743
  * @param transformType - defaults to `'systemDateToTargetDate'`
2744
+ * @returns a function that transforms date ranges within the specified timezone normalization
2532
2745
  */ function transformDateRangeInTimezoneNormalFunction(timezoneInput) {
2533
2746
  var transformType = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 'systemDateToTargetDate';
2534
2747
  var timezoneInstance = dateTimezoneUtcNormal(timezoneInput);
@@ -2552,6 +2765,9 @@ function calculateAllConversions(date, converter) {
2552
2765
  * const midnight = startOfDayInDenver('2024-06-15');
2553
2766
  * // midnight is 2024-06-15T06:00:00.000Z (midnight MDT = 6AM UTC)
2554
2767
  * ```
2768
+ *
2769
+ * @param timezone - timezone configuration to bind the factory to
2770
+ * @returns a factory that converts ISO8601 day strings to start-of-day dates
2555
2771
  */ function startOfDayInTimezoneDayStringFactory(timezone) {
2556
2772
  var timezoneInstance = dateTimezoneUtcNormal(timezone);
2557
2773
  return function(day) {
@@ -2567,6 +2783,10 @@ function calculateAllConversions(date, converter) {
2567
2783
  * ```ts
2568
2784
  * const midnight = startOfDayInTimezoneFromISO8601DayString('2024-06-15', 'America/Denver');
2569
2785
  * ```
2786
+ *
2787
+ * @param day - the ISO8601 day string to parse
2788
+ * @param timezone - timezone configuration for the start-of-day calculation
2789
+ * @returns the start-of-day instant in the given timezone
2570
2790
  */ function startOfDayInTimezoneFromISO8601DayString(day, timezone) {
2571
2791
  return startOfDayInTimezoneDayStringFactory(timezone)(day);
2572
2792
  }
@@ -2583,8 +2803,12 @@ function calculateAllConversions(date, converter) {
2583
2803
  * const result = setOnDate({ date: someDate, hours: 14, minutes: 30, inputType: 'target' });
2584
2804
  * // result is someDate with hours set to 14:30 in Denver time
2585
2805
  * ```
2806
+ *
2807
+ * @param timezone - the timezone configuration to bind to
2808
+ * @returns a function that sets hours/minutes on dates in the given timezone
2586
2809
  */ function setOnDateWithTimezoneNormalFunction(timezone) {
2587
2810
  var timezoneInstance = dateTimezoneUtcNormal(timezone);
2811
+ // eslint-disable-next-line sonarjs/cognitive-complexity
2588
2812
  var fn = function fn(input) {
2589
2813
  var inputDate = input.date, copyFromInput = input.copyFrom, copyHours = input.copyHours, copyMinutes = input.copyMinutes, inputInputType = input.inputType, outputType = input.outputType, inputHours = input.hours, inputMinutes = input.minutes, roundDownToMinute = input.roundDownToMinute;
2590
2814
  var DEFAULT_TYPE = 'target';
@@ -2600,7 +2824,7 @@ function calculateAllConversions(date, converter) {
2600
2824
  return roundDownToMinute ? roundDateDownTo(inputDate, 'minute') : inputDate;
2601
2825
  }
2602
2826
  if (inputType !== 'base') {
2603
- copyFrom = copyFrom != null ? timezoneInstance.convertDate(copyFrom, 'base', inputType) : undefined;
2827
+ copyFrom = timezoneInstance.convertDate(copyFrom, 'base', inputType);
2604
2828
  }
2605
2829
  }
2606
2830
  // set baseDate
@@ -2649,6 +2873,7 @@ function calculateAllConversions(date, converter) {
2649
2873
  *
2650
2874
  * @param input - the date whose day is preserved
2651
2875
  * @param timezone - the timezone context for the hour/minute interpretation
2876
+ * @returns the input date with hours and minutes set to the current time in the given timezone
2652
2877
  */ function copyHoursAndMinutesFromNowWithTimezoneNormal(input, timezone) {
2653
2878
  return copyHoursAndMinutesFromDateWithTimezoneNormal(input, 'now', timezone);
2654
2879
  }
@@ -2669,16 +2894,16 @@ function calculateAllConversions(date, converter) {
2669
2894
  * @param input - the date whose day is preserved
2670
2895
  * @param copyFrom - the date (or `'now'`) whose hours/minutes are copied
2671
2896
  * @param timezone - the timezone context for interpreting both dates
2897
+ * @returns the input date with hours and minutes copied from the source
2672
2898
  */ function copyHoursAndMinutesFromDateWithTimezoneNormal(input, copyFrom, timezone) {
2673
2899
  var timezoneInstance = dateTimezoneUtcNormal(timezone);
2674
- var result = timezoneInstance.setOnDate({
2900
+ return timezoneInstance.setOnDate({
2675
2901
  date: input,
2676
2902
  copyFrom: copyFrom,
2677
2903
  inputType: 'target',
2678
2904
  copyHours: true,
2679
2905
  copyMinutes: true
2680
2906
  });
2681
- return result;
2682
2907
  }
2683
2908
 
2684
2909
  function _define_property$e(obj, key, value) {
@@ -2739,6 +2964,7 @@ function _object_spread$c(target) {
2739
2964
  *
2740
2965
  * @param dateRange - the range to fit
2741
2966
  * @param timezone - the timezone for day boundary calculation
2967
+ * @returns the date range fitted to a single day period
2742
2968
  */ function fitDateRangeToDayPeriod(dateRange, timezone) {
2743
2969
  return fitDateRangeToDayPeriodFunction(timezone)(dateRange);
2744
2970
  }
@@ -2749,6 +2975,7 @@ function _object_spread$c(target) {
2749
2975
  * Useful when the same range formatting logic needs to be applied repeatedly with consistent settings.
2750
2976
  *
2751
2977
  * @param inputConfig - format function or full configuration
2978
+ * @returns a reusable function that formats date ranges into strings
2752
2979
  *
2753
2980
  * @example
2754
2981
  * ```ts
@@ -2785,6 +3012,7 @@ function _object_spread$c(target) {
2785
3012
  * @param range - date range to format
2786
3013
  * @param inputConfig - format function or full configuration
2787
3014
  * @param separator - optional separator override when inputConfig is a function
3015
+ * @returns the formatted date range string
2788
3016
  *
2789
3017
  * @example
2790
3018
  * ```ts
@@ -2808,6 +3036,7 @@ function _object_spread$c(target) {
2808
3036
  * (e.g., "3 hours", "about 2 days"). Delegates to date-fns `formatDistance` or `formatDistanceStrict`.
2809
3037
  *
2810
3038
  * @param inputConfig - controls distance formatting, optional transforms, and same-day handling
3039
+ * @returns a reusable function that computes and formats date range distances
2811
3040
  *
2812
3041
  * @example
2813
3042
  * ```ts
@@ -2861,6 +3090,7 @@ function _object_spread$c(target) {
2861
3090
  *
2862
3091
  * @param range - date range to compute distance for
2863
3092
  * @param inputConfig - optional distance formatting configuration
3093
+ * @returns the human-readable distance string
2864
3094
  *
2865
3095
  * @example
2866
3096
  * ```ts
@@ -2901,7 +3131,7 @@ function formatToDayRangeString(startOrDateRange, endOrFormat, inputFormat) {
2901
3131
  end = endOrFormat;
2902
3132
  }
2903
3133
  }
2904
- var format = inputFormat !== null && inputFormat !== void 0 ? inputFormat : formatToShortDateString;
3134
+ var format = inputFormat !== null && inputFormat !== void 0 ? inputFormat : formatToMonthDaySlashDate;
2905
3135
  return formatDateRange(dateOrDateRangeToDateRange(startOrDateRange, end), {
2906
3136
  format: format,
2907
3137
  simplifySameDate: true
@@ -2912,6 +3142,7 @@ function formatToDayRangeString(startOrDateRange, endOrFormat, inputFormat) {
2912
3142
  * instead of throwing.
2913
3143
  *
2914
3144
  * @param input - date, date string, or nullish value
3145
+ * @returns the ISO 8601 date string, or `undefined` if the input is invalid or nullish
2915
3146
  *
2916
3147
  * @example
2917
3148
  * ```ts
@@ -2934,6 +3165,7 @@ function formatToDayRangeString(startOrDateRange, endOrFormat, inputFormat) {
2934
3165
  * Formats a Date to a full ISO 8601 date-time string via `Date.toISOString()`. Defaults to the current date/time.
2935
3166
  *
2936
3167
  * @param date - date to format; defaults to `new Date()`
3168
+ * @returns the full ISO 8601 date-time string
2937
3169
  *
2938
3170
  * @example
2939
3171
  * ```ts
@@ -2953,6 +3185,7 @@ function formatToDayRangeString(startOrDateRange, endOrFormat, inputFormat) {
2953
3185
  * Use {@link toISO8601DayStringForUTC} when the UTC date is needed instead.
2954
3186
  *
2955
3187
  * @param dateOrString - date or existing day string
3188
+ * @returns the ISO 8601 day string in system timezone
2956
3189
  *
2957
3190
  * @example
2958
3191
  * ```ts
@@ -2972,6 +3205,7 @@ function formatToDayRangeString(startOrDateRange, endOrFormat, inputFormat) {
2972
3205
  * Defaults to the current date.
2973
3206
  *
2974
3207
  * @param date - date to format; defaults to `new Date()`
3208
+ * @returns the ISO 8601 day string in system timezone
2975
3209
  *
2976
3210
  * @example
2977
3211
  * ```ts
@@ -2991,6 +3225,7 @@ function formatToDayRangeString(startOrDateRange, endOrFormat, inputFormat) {
2991
3225
  * Use {@link toISO8601DayStringForSystem} when the system-local date is needed instead.
2992
3226
  *
2993
3227
  * @param dateOrString - date or existing day string
3228
+ * @returns the ISO 8601 day string in UTC
2994
3229
  *
2995
3230
  * @example
2996
3231
  * ```ts
@@ -3011,6 +3246,7 @@ function formatToDayRangeString(startOrDateRange, endOrFormat, inputFormat) {
3011
3246
  * Defaults to the current date.
3012
3247
  *
3013
3248
  * @param date - date to format; defaults to `new Date()`
3249
+ * @returns the ISO 8601 day string using UTC date components
3014
3250
  *
3015
3251
  * @example
3016
3252
  * ```ts
@@ -3023,12 +3259,18 @@ function formatToDayRangeString(startOrDateRange, endOrFormat, inputFormat) {
3023
3259
  var date = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : new Date();
3024
3260
  return "".concat(date.getUTCFullYear(), "-").concat((date.getUTCMonth() + 1).toString().padStart(2, '0'), "-").concat(date.getUTCDate().toString().padStart(2, '0'));
3025
3261
  }
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;
3262
+ /**
3263
+ * date-fns format string for `MM/dd/yyyy` (e.g., `"01/15/2024"`).
3264
+ */ var MONTH_DAY_SLASH_DATE_STRING_FORMAT = 'MM/dd/yyyy';
3265
+ /**
3266
+ * @deprecated Use MONTH_DAY_SLASH_DATE_STRING_FORMAT instead.
3267
+ */ // eslint-disable-next-line @typescript-eslint/naming-convention
3268
+ var monthDaySlashDateStringFormat = MONTH_DAY_SLASH_DATE_STRING_FORMAT;
3028
3269
  /**
3029
3270
  * Formats a Date as a month/day/year slash-separated string (`MM/dd/yyyy`). Defaults to the current date.
3030
3271
  *
3031
3272
  * @param date - date to format; defaults to `new Date()`
3273
+ * @returns the formatted `MM/dd/yyyy` string
3032
3274
  *
3033
3275
  * @example
3034
3276
  * ```ts
@@ -3044,12 +3286,18 @@ function formatToDayRangeString(startOrDateRange, endOrFormat, inputFormat) {
3044
3286
  /**
3045
3287
  * @deprecated use formatToMonthDaySlashDate instead.
3046
3288
  */ 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;
3289
+ /**
3290
+ * date-fns format string for `MM/dd` (e.g., `"01/15"`).
3291
+ */ var DATE_MONTH_DAY_STRING_FORMAT = 'MM/dd';
3292
+ /**
3293
+ * @deprecated Use DATE_MONTH_DAY_STRING_FORMAT instead.
3294
+ */ // eslint-disable-next-line @typescript-eslint/naming-convention
3295
+ var dateMonthDayStringFormat = DATE_MONTH_DAY_STRING_FORMAT;
3049
3296
  /**
3050
3297
  * Formats a Date as a month/day string (`MM/dd`) without the year. Defaults to the current date.
3051
3298
  *
3052
3299
  * @param date - date to format; defaults to `new Date()`
3300
+ * @returns the formatted `MM/dd` string
3053
3301
  *
3054
3302
  * @example
3055
3303
  * ```ts
@@ -3066,6 +3314,7 @@ function formatToDayRangeString(startOrDateRange, endOrFormat, inputFormat) {
3066
3314
  * Formats a Date as a human-friendly weekday and month/day string (e.g., `"Mon, Jan 15th"`).
3067
3315
  *
3068
3316
  * @param date - date to format
3317
+ * @returns the formatted weekday and month/day string
3069
3318
  *
3070
3319
  * @example
3071
3320
  * ```ts
@@ -3077,12 +3326,18 @@ function formatToDayRangeString(startOrDateRange, endOrFormat, inputFormat) {
3077
3326
  */ function formatToDateString(date) {
3078
3327
  return format$1(date, 'EEE, MMM do');
3079
3328
  }
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;
3329
+ /**
3330
+ * date-fns format string for 12-hour time with AM/PM (e.g., `"9:00 AM"`).
3331
+ */ var DATE_TIME_STRING_FORMAT = 'h:mm a';
3332
+ /**
3333
+ * @deprecated Use DATE_TIME_STRING_FORMAT instead.
3334
+ */ // eslint-disable-next-line @typescript-eslint/naming-convention
3335
+ var dateTimeStringFormat = DATE_TIME_STRING_FORMAT;
3082
3336
  /**
3083
3337
  * Formats a Date as a 12-hour time string with AM/PM (e.g., `"9:00 AM"`).
3084
3338
  *
3085
3339
  * @param date - date to format
3340
+ * @returns the formatted 12-hour time string with AM/PM
3086
3341
  *
3087
3342
  * @example
3088
3343
  * ```ts
@@ -3094,12 +3349,18 @@ function formatToDayRangeString(startOrDateRange, endOrFormat, inputFormat) {
3094
3349
  */ function formatToTimeString(date) {
3095
3350
  return format$1(date, DATE_TIME_STRING_FORMAT);
3096
3351
  }
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;
3352
+ /**
3353
+ * Combined date-fns format string for `MM/dd/yyyy h:mm a` (e.g., `"01/15/2024 9:00 AM"`).
3354
+ */ var DATE_SHORT_DATE_AND_TIME_STRING_FORMAT = "".concat(MONTH_DAY_SLASH_DATE_STRING_FORMAT, " ").concat(DATE_TIME_STRING_FORMAT);
3355
+ /**
3356
+ * @deprecated Use DATE_SHORT_DATE_AND_TIME_STRING_FORMAT instead.
3357
+ */ // eslint-disable-next-line @typescript-eslint/naming-convention
3358
+ var dateShortDateAndTimeStringFormat = DATE_SHORT_DATE_AND_TIME_STRING_FORMAT;
3099
3359
  /**
3100
3360
  * Formats a Date as a short date and time string (e.g., `"01/15/2024 9:00 AM"`).
3101
3361
  *
3102
3362
  * @param date - date to format
3363
+ * @returns the formatted short date and time string
3103
3364
  *
3104
3365
  * @example
3105
3366
  * ```ts
@@ -3117,6 +3378,7 @@ function formatToDayRangeString(startOrDateRange, endOrFormat, inputFormat) {
3117
3378
  *
3118
3379
  * @param start - start date/time
3119
3380
  * @param end - end date/time
3381
+ * @returns the formatted time string with an appended duration indicator
3120
3382
  *
3121
3383
  * @example
3122
3384
  * ```ts
@@ -3138,7 +3400,8 @@ function formatToDayRangeString(startOrDateRange, endOrFormat, inputFormat) {
3138
3400
  includeSeconds: false
3139
3401
  }), ")");
3140
3402
  } else {
3141
- subtitle = "".concat(minutes ? "(".concat(minutes, " Minutes)") : '');
3403
+ var minutesLabel = minutes ? "(".concat(minutes, " Minutes)") : '';
3404
+ subtitle = minutesLabel;
3142
3405
  }
3143
3406
  return "".concat(formatToTimeString(start), " ").concat(subtitle);
3144
3407
  }
@@ -3161,6 +3424,11 @@ function formatToDayRangeString(startOrDateRange, endOrFormat, inputFormat) {
3161
3424
  * formatStartedEndedDistanceString(activeRange);
3162
3425
  * // "started about 1 hour ago"
3163
3426
  * ```
3427
+ *
3428
+ * @param dateRange - date range with start and end dates
3429
+ * @param dateRange.start - the start date of the range
3430
+ * @param dateRange.end - the end date of the range
3431
+ * @returns the relative-time label describing the date range state
3164
3432
  */ function formatStartedEndedDistanceString(param) {
3165
3433
  var start = param.start, end = param.end;
3166
3434
  var state = dateRangeRelativeState({
@@ -3192,6 +3460,7 @@ function formatToDayRangeString(startOrDateRange, endOrFormat, inputFormat) {
3192
3460
  * Useful for converting heterogeneous date inputs into a consistent midnight-aligned Date.
3193
3461
  *
3194
3462
  * @param input - date or day string to normalize
3463
+ * @returns a Date set to midnight of the corresponding day in the system timezone
3195
3464
  *
3196
3465
  * @example
3197
3466
  * ```ts
@@ -3211,6 +3480,7 @@ function formatToDayRangeString(startOrDateRange, endOrFormat, inputFormat) {
3211
3480
  * in the system timezone. Supports year formats with more than 4 digits but does not support negative years.
3212
3481
  *
3213
3482
  * @param dayString - ISO 8601 day or date string to parse
3483
+ * @returns a Date at the start of the parsed day in the system timezone
3214
3484
  *
3215
3485
  * @example
3216
3486
  * ```ts
@@ -3427,6 +3697,11 @@ function _type_of$5(obj) {
3427
3697
  * 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
3698
  *
3429
3699
  * The start date from the inputDate is considered to to have the offset noted in DateCell, and will be retained.
3700
+ *
3701
+ * @param durationInput - the duration span containing the startsAt time and event duration in minutes
3702
+ * @param rangeInput - specifies the date range: a number of days, a DateRange, or a DateRangeDayDistanceInput
3703
+ * @param timezoneInput - optional timezone configuration; defaults to the system timezone if omitted
3704
+ * @returns a fully computed FullDateCellTiming with start, startsAt, end, duration, and timezone
3430
3705
  */ function dateCellTiming(durationInput, rangeInput, timezoneInput) {
3431
3706
  var duration = durationInput.duration;
3432
3707
  if (duration > MINUTES_IN_DAY) {
@@ -3481,7 +3756,12 @@ function _type_of$5(obj) {
3481
3756
  var utcDay = formatToISO8601DayStringForUTC(startsAtInUtc);
3482
3757
  var start = normalInstance.startOfDayInTargetTimezone(utcDay);
3483
3758
  var safeMirror = isEqualDate(startsAtInUtc, startsAtInUtcInitial);
3484
- var _normalInstance_safeMirroredConvertDate = normalInstance.safeMirroredConvertDate(startsAtInUtc, inputStartsAt, 'target', safeMirror), startsAt = _normalInstance_safeMirroredConvertDate.date, daylightSavingsOffset = _normalInstance_safeMirroredConvertDate.daylightSavingsOffset;
3759
+ var _normalInstance_safeMirroredConvertDate = normalInstance.safeMirroredConvertDate({
3760
+ baseDate: startsAtInUtc,
3761
+ originalContextDate: inputStartsAt,
3762
+ contextType: 'target',
3763
+ safeConvert: safeMirror
3764
+ }), startsAt = _normalInstance_safeMirroredConvertDate.date, daylightSavingsOffset = _normalInstance_safeMirroredConvertDate.daylightSavingsOffset;
3485
3765
  // calculate end to be the ending date/time of the final duration span
3486
3766
  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
3767
  var lastStartInTarget = normalInstance.targetDateToBaseDate(lastStartsAtInBaseTimezone);
@@ -3741,8 +4021,16 @@ function _calculateExpectedDateCellTimingDurationPair(timing) {
3741
4021
  var normalInstance = dateTimezoneUtcNormal(timezone);
3742
4022
  var startsAtInUtcNormal = normalInstance.baseDateToTargetDate(startsAt); // convert to UTC normal
3743
4023
  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;
4024
+ var _normalInstance_safeMirroredConvertDate = normalInstance.safeMirroredConvertDate({
4025
+ baseDate: startsAtInUtcNormal,
4026
+ originalContextDate: startsAt,
4027
+ contextType: 'target'
4028
+ }), startDaylightSavingsOffset = _normalInstance_safeMirroredConvertDate.daylightSavingsOffset;
4029
+ var _normalInstance_safeMirroredConvertDate1 = normalInstance.safeMirroredConvertDate({
4030
+ baseDate: endInUtcNormal,
4031
+ originalContextDate: end,
4032
+ contextType: 'target'
4033
+ }), endDaylightSavingsOffset = _normalInstance_safeMirroredConvertDate1.daylightSavingsOffset;
3746
4034
  if (startDaylightSavingsOffset) {
3747
4035
  startsAtInUtcNormal = addHours(startsAtInUtcNormal, startDaylightSavingsOffset);
3748
4036
  }
@@ -3828,7 +4116,7 @@ function _calculateExpectedDateCellTimingDurationPair(timing) {
3828
4116
  isExpectedValidEnd = expectedDuration === duration; // should be the expected duration
3829
4117
  isValid = isExpectedValidEnd;
3830
4118
  }
3831
- var result = {
4119
+ return {
3832
4120
  isValid: isValid,
3833
4121
  endIsAfterTheStartsAtTime: endIsAfterTheStartsAtTime,
3834
4122
  durationGreaterThanZero: durationGreaterThanZero,
@@ -3837,7 +4125,6 @@ function _calculateExpectedDateCellTimingDurationPair(timing) {
3837
4125
  isExpectedValidEnd: isExpectedValidEnd,
3838
4126
  normalInstance: normalInstance
3839
4127
  };
3840
- return result;
3841
4128
  }
3842
4129
  /**
3843
4130
  * Returns true if the {@link DateCellTiming} passes all validation checks.
@@ -3902,13 +4189,13 @@ function _calculateExpectedDateCellTimingDurationPair(timing) {
3902
4189
  return isValid;
3903
4190
  }
3904
4191
 
3905
- function _array_like_to_array$5(arr, len) {
4192
+ function _array_like_to_array$6(arr, len) {
3906
4193
  if (len == null || len > arr.length) len = arr.length;
3907
4194
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
3908
4195
  return arr2;
3909
4196
  }
3910
- function _array_without_holes$2(arr) {
3911
- if (Array.isArray(arr)) return _array_like_to_array$5(arr);
4197
+ function _array_without_holes$4(arr) {
4198
+ if (Array.isArray(arr)) return _array_like_to_array$6(arr);
3912
4199
  }
3913
4200
  function _define_property$c(obj, key, value) {
3914
4201
  if (key in obj) {
@@ -3923,10 +4210,10 @@ function _define_property$c(obj, key, value) {
3923
4210
  }
3924
4211
  return obj;
3925
4212
  }
3926
- function _iterable_to_array$2(iter) {
4213
+ function _iterable_to_array$4(iter) {
3927
4214
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
3928
4215
  }
3929
- function _non_iterable_spread$2() {
4216
+ function _non_iterable_spread$4() {
3930
4217
  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
4218
  }
3932
4219
  function _object_spread$a(target) {
@@ -3963,20 +4250,20 @@ function _object_spread_props$8(target, source) {
3963
4250
  }
3964
4251
  return target;
3965
4252
  }
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();
4253
+ function _to_consumable_array$4(arr) {
4254
+ return _array_without_holes$4(arr) || _iterable_to_array$4(arr) || _unsupported_iterable_to_array$6(arr) || _non_iterable_spread$4();
3968
4255
  }
3969
4256
  function _type_of$4(obj) {
3970
4257
  "@swc/helpers - typeof";
3971
4258
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
3972
4259
  }
3973
- function _unsupported_iterable_to_array$5(o, minLen) {
4260
+ function _unsupported_iterable_to_array$6(o, minLen) {
3974
4261
  if (!o) return;
3975
- if (typeof o === "string") return _array_like_to_array$5(o, minLen);
4262
+ if (typeof o === "string") return _array_like_to_array$6(o, minLen);
3976
4263
  var n = Object.prototype.toString.call(o).slice(8, -1);
3977
4264
  if (n === "Object" && o.constructor) n = o.constructor.name;
3978
4265
  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);
4266
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$6(o, minLen);
3980
4267
  }
3981
4268
  /**
3982
4269
  * Returns true if the input is a DateCellRange.
@@ -3984,6 +4271,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
3984
4271
  * Does not check validity. Use {@link isValidDateCellRange} for that.
3985
4272
  *
3986
4273
  * @param input - value to check
4274
+ * @returns true if the input is a DateCellRange
3987
4275
  */ function isDateCellRange(input) {
3988
4276
  return (typeof input === "undefined" ? "undefined" : _type_of$4(input)) === 'object' ? Number.isInteger(input.i) && input.to === undefined || Number.isInteger(input.to) : false;
3989
4277
  }
@@ -3994,6 +4282,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
3994
4282
  * that is greater than or equal to `i`.
3995
4283
  *
3996
4284
  * @param input - range to validate
4285
+ * @returns true if the range has valid non-negative indexes and `to` (when defined) is greater than or equal to `i`
3997
4286
  */ function isValidDateCellRange(input) {
3998
4287
  var i = input.i, to = input.to;
3999
4288
  if (!isValidDateCellIndex(i)) {
@@ -4009,6 +4298,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4009
4298
  * Validates that each range is individually valid and that no ranges overlap or appear out of order.
4010
4299
  *
4011
4300
  * @param input - array of ranges to validate as a non-overlapping ascending series
4301
+ * @returns true if the array is sorted in ascending order with no overlapping or duplicate indexes
4012
4302
  */ function isValidDateCellRangeSeries(input) {
4013
4303
  if (!Array.isArray(input)) {
4014
4304
  return false;
@@ -4020,13 +4310,30 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4020
4310
  return false;
4021
4311
  }
4022
4312
  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;
4313
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
4314
+ try {
4315
+ for(var _iterator = input[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
4316
+ var range = _step.value;
4317
+ if (range.i <= greatestIndex) {
4318
+ return false;
4319
+ } else {
4320
+ var _range_to;
4321
+ 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.
4322
+ greatestIndex = nextGreatestIndex;
4323
+ }
4324
+ }
4325
+ } catch (err) {
4326
+ _didIteratorError = true;
4327
+ _iteratorError = err;
4328
+ } finally{
4329
+ try {
4330
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
4331
+ _iterator.return();
4332
+ }
4333
+ } finally{
4334
+ if (_didIteratorError) {
4335
+ throw _iteratorError;
4336
+ }
4030
4337
  }
4031
4338
  }
4032
4339
  return true;
@@ -4037,6 +4344,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4037
4344
  * The input range is not expected to be sorted.
4038
4345
  *
4039
4346
  * @param input - unsorted array of date cell ranges to scan
4347
+ * @returns the smallest starting index found, or 0 if the input is empty
4040
4348
  */ function getLeastDateCellIndexInDateCellRanges(input) {
4041
4349
  var _ref;
4042
4350
  var _getLeastAndGreatestDateCellIndexInDateCellRanges;
@@ -4048,6 +4356,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4048
4356
  * The input range is not expected to be sorted.
4049
4357
  *
4050
4358
  * @param input - unsorted array of date cell ranges to scan
4359
+ * @returns the largest ending index found, or 0 if the input is empty
4051
4360
  */ function getGreatestDateCellIndexInDateCellRanges(input) {
4052
4361
  var _ref;
4053
4362
  var _getLeastAndGreatestDateCellIndexInDateCellRanges;
@@ -4059,6 +4368,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4059
4368
  * The input range is not expected to be sorted.
4060
4369
  *
4061
4370
  * @param input - unsorted array of date cell ranges to scan
4371
+ * @returns an object with the least and greatest indexes and their source items, or null if the input is empty
4062
4372
  */ function getLeastAndGreatestDateCellIndexInDateCellRanges(input) {
4063
4373
  if (!input.length) {
4064
4374
  return null;
@@ -4067,17 +4377,34 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4067
4377
  var greatestIndex = 0;
4068
4378
  var leastIndexItem = input[0];
4069
4379
  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;
4380
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
4381
+ try {
4382
+ for(var _iterator = input[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
4383
+ var range = _step.value;
4384
+ var _range_to;
4385
+ var leastRangeIndex = range.i;
4386
+ var greatestRangeIndex = (_range_to = range.to) !== null && _range_to !== void 0 ? _range_to : range.i;
4387
+ if (leastRangeIndex < leastIndex) {
4388
+ leastIndex = leastRangeIndex;
4389
+ leastIndexItem = range;
4390
+ }
4391
+ if (greatestRangeIndex > greatestIndex) {
4392
+ greatestIndex = greatestRangeIndex;
4393
+ greatestIndexItem = range;
4394
+ }
4077
4395
  }
4078
- if (greatestRangeIndex > greatestIndex) {
4079
- greatestIndex = greatestRangeIndex;
4080
- greatestIndexItem = range;
4396
+ } catch (err) {
4397
+ _didIteratorError = true;
4398
+ _iteratorError = err;
4399
+ } finally{
4400
+ try {
4401
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
4402
+ _iterator.return();
4403
+ }
4404
+ } finally{
4405
+ if (_didIteratorError) {
4406
+ throw _iteratorError;
4407
+ }
4081
4408
  }
4082
4409
  }
4083
4410
  return {
@@ -4093,6 +4420,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4093
4420
  *
4094
4421
  * @param i - starting cell index
4095
4422
  * @param to - ending cell index (inclusive); defaults to `i`
4423
+ * @returns a DateCellRangeWithRange spanning from `i` to `to`
4096
4424
  */ function dateCellRange(i, to) {
4097
4425
  return {
4098
4426
  i: i,
@@ -4103,6 +4431,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4103
4431
  * Creates a single-cell {@link DateCellRangeWithRange} where both `i` and `to` equal the given index.
4104
4432
  *
4105
4433
  * @param dateCellIndex - the index for both start and end of the range
4434
+ * @returns a DateCellRangeWithRange where `i` and `to` both equal the given index
4106
4435
  */ function dateCellRangeWithRangeFromIndex(dateCellIndex) {
4107
4436
  return dateCellRange(dateCellIndex, dateCellIndex);
4108
4437
  }
@@ -4111,6 +4440,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4111
4440
  * ensuring the result always has an explicit `to` value.
4112
4441
  *
4113
4442
  * @param input - index, cell, or range to normalize
4443
+ * @returns a DateCellRangeWithRange with an explicit `to` value
4114
4444
  */ function dateCellRangeWithRange(input) {
4115
4445
  if (typeof input === 'number') {
4116
4446
  return dateCellRangeWithRangeFromIndex(input);
@@ -4123,12 +4453,12 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4123
4453
  * fully contains the configured `inputRange`.
4124
4454
  *
4125
4455
  * @param inputRange - the range that must be fully included
4456
+ * @returns a function that returns true when its argument fully contains `inputRange`
4126
4457
  */ function dateCellRangeIncludedByRangeFunction(inputRange) {
4127
4458
  var _dateCellRangeWithRange = dateCellRangeWithRange(inputRange), i = _dateCellRangeWithRange.i, to = _dateCellRangeWithRange.to;
4128
4459
  return function(input) {
4129
- var _ref;
4130
4460
  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;
4461
+ return range.i <= i && range.to >= to;
4132
4462
  };
4133
4463
  }
4134
4464
  /**
@@ -4136,12 +4466,12 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4136
4466
  * has any overlap with the configured `inputRange`.
4137
4467
  *
4138
4468
  * @param inputRange - the range to test for overlap against
4469
+ * @returns a function that returns true when its argument overlaps with `inputRange`
4139
4470
  */ function dateCellRangeOverlapsRangeFunction(inputRange) {
4140
4471
  var _dateCellRangeWithRange = dateCellRangeWithRange(inputRange), i = _dateCellRangeWithRange.i, to = _dateCellRangeWithRange.to;
4141
4472
  return function(input) {
4142
- var _ref;
4143
4473
  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;
4474
+ return range.i <= to && range.to >= i;
4145
4475
  };
4146
4476
  }
4147
4477
  /**
@@ -4149,6 +4479,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4149
4479
  *
4150
4480
  * @param rangeA - first range to compare
4151
4481
  * @param rangeB - second range to compare
4482
+ * @returns true if the two ranges share at least one common index
4152
4483
  */ function dateCellRangeOverlapsRange(rangeA, rangeB) {
4153
4484
  return dateCellRangeOverlapsRangeFunction(rangeA)(rangeB);
4154
4485
  }
@@ -4156,6 +4487,8 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4156
4487
  * Returns a sort comparator that orders ranges first by starting index (`i`), then by ending index (`to`).
4157
4488
  *
4158
4489
  * In many cases {@link sortAscendingIndexNumberRefFunction} may be preferential when `to` ordering is not needed.
4490
+ *
4491
+ * @returns a comparator function that sorts ranges by `i` then by `to`
4159
4492
  */ function sortDateCellRangeAndSizeFunction() {
4160
4493
  return function(a, b) {
4161
4494
  var _a_to, _b_to;
@@ -4166,6 +4499,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4166
4499
  * Sorts the input date ranges in-place by ascending index using {@link sortAscendingIndexNumberRefFunction}.
4167
4500
  *
4168
4501
  * @param input - array of ranges to sort (mutated in place)
4502
+ * @returns the same array, sorted in ascending index order
4169
4503
  */ function sortDateCellRanges(input) {
4170
4504
  return input.sort(sortAscendingIndexNumberRefFunction());
4171
4505
  }
@@ -4176,6 +4510,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4176
4510
  * The input is sorted internally before grouping.
4177
4511
  *
4178
4512
  * @param input - cells or ranges to merge into contiguous groups
4513
+ * @returns an array of non-overlapping contiguous DateCellRangeWithRange values
4179
4514
  *
4180
4515
  * @example
4181
4516
  * ```ts
@@ -4223,6 +4558,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4223
4558
  * Returns an array containing every individual index in the given date cell range (inclusive of both `i` and `to`).
4224
4559
  *
4225
4560
  * @param input - range to expand into individual indexes
4561
+ * @returns an array of every DateCellIndex from `i` to `to` inclusive
4226
4562
  */ function allIndexesInDateCellRange(input) {
4227
4563
  return input.to != null ? range(input.i, input.to + 1) : [
4228
4564
  input.i
@@ -4232,6 +4568,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4232
4568
  * Flattens an array of indexes and/or ranges into a single array of individual {@link DateCellIndex} values.
4233
4569
  *
4234
4570
  * @param input - mix of raw indexes and ranges to flatten
4571
+ * @returns a flat array of all individual DateCellIndex values
4235
4572
  */ function allIndexesInDateCellRangesToArray(input) {
4236
4573
  var result = [];
4237
4574
  input.forEach(function(x) {
@@ -4248,6 +4585,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4248
4585
  * Returns a deduplicated {@link Set} of all indexes within the input ranges.
4249
4586
  *
4250
4587
  * @param input - mix of raw indexes and ranges to collect
4588
+ * @returns a Set containing every unique DateCellIndex from the input
4251
4589
  */ function allIndexesInDateCellRanges(input) {
4252
4590
  return new Set(allIndexesInDateCellRangesToArray(input));
4253
4591
  }
@@ -4256,6 +4594,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4256
4594
  *
4257
4595
  * @param blocks - cells or ranges to filter
4258
4596
  * @param range - bounding range that blocks must fall within
4597
+ * @returns only the blocks that fall entirely within the given range
4259
4598
  */ function filterDateCellsInDateCellRange(blocks, range) {
4260
4599
  var dateCellIsWithinDateCellRange = isDateCellWithinDateCellRangeFunction(range);
4261
4600
  return blocks.filter(dateCellIsWithinDateCellRange);
@@ -4265,6 +4604,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4265
4604
  * is fully contained within `inputRange`.
4266
4605
  *
4267
4606
  * @param inputRange - the bounding range to test containment against
4607
+ * @returns a function that returns true when its argument is fully contained within `inputRange`
4268
4608
  */ function isDateCellWithinDateCellRangeFunction(inputRange) {
4269
4609
  var range = dateCellRangeWithRange(inputRange);
4270
4610
  return function(input) {
@@ -4286,6 +4626,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4286
4626
  *
4287
4627
  * @param range - the outer bounding range
4288
4628
  * @param contains - the cell or range to test for containment
4629
+ * @returns true if `contains` is fully within `range`
4289
4630
  */ function isDateCellWithinDateCellRange(range, contains) {
4290
4631
  return isDateCellWithinDateCellRangeFunction(range)(dateCellRangeWithRange(contains));
4291
4632
  }
@@ -4295,6 +4636,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4295
4636
  * Internally groups overlapping ranges before counting so each index is counted only once.
4296
4637
  *
4297
4638
  * @param inputDateCellRange - one or more cells/ranges to analyze
4639
+ * @returns count, total, and average statistics for the given ranges
4298
4640
  */ function dateCellRangeBlocksCountInfo(inputDateCellRange) {
4299
4641
  var group = groupToDateCellRanges(asArray(inputDateCellRange));
4300
4642
  var count = 0;
@@ -4317,6 +4659,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4317
4659
  * Shorthand for `dateCellRangeBlocksCountInfo(input).count`.
4318
4660
  *
4319
4661
  * @param inputDateCellRange - one or more cells/ranges to count
4662
+ * @returns the total number of individual cell indexes
4320
4663
  *
4321
4664
  * @example
4322
4665
  * ```ts
@@ -4331,13 +4674,14 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4331
4674
  * grouped range from `ranges` fully covers a given input range.
4332
4675
  *
4333
4676
  * @param ranges - the covering ranges to test against
4677
+ * @returns a function that returns true when any single grouped range fully covers the input range
4334
4678
  */ function dateCellRangesFullyCoverDateCellRangeFunction(ranges) {
4335
4679
  var groupedRanges = Array.isArray(ranges) ? groupToDateCellRanges(ranges) : [
4336
4680
  dateCellRangeWithRange(ranges)
4337
4681
  ];
4338
4682
  return function(inputRange) {
4339
4683
  var fn = dateCellRangeIncludedByRangeFunction(inputRange);
4340
- return groupedRanges.findIndex(fn) !== -1;
4684
+ return groupedRanges.some(fn);
4341
4685
  };
4342
4686
  }
4343
4687
  /**
@@ -4348,6 +4692,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4348
4692
  * nearest future range's starting index is used.
4349
4693
  *
4350
4694
  * @param input - the current index and ranges to evaluate
4695
+ * @returns classification of ranges as past/present/future and the next upcoming index
4351
4696
  *
4352
4697
  * @example
4353
4698
  * ```ts
@@ -4404,6 +4749,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4404
4749
  *
4405
4750
  * @param range - the date cell range to classify
4406
4751
  * @param nowIndex - the reference index representing "now"
4752
+ * @returns 'past', 'present', or 'future' depending on the range's position relative to `nowIndex`
4407
4753
  */ function dateRelativeStateForDateCellRangeComparedToIndex(range, nowIndex) {
4408
4754
  var _dateCellRange = dateCellRange(range.i, range.to), i = _dateCellRange.i, to = _dateCellRange.to;
4409
4755
  var state;
@@ -4421,6 +4767,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4421
4767
  * from `i` to `to` (inclusive). Each copy retains all properties of the original block.
4422
4768
  *
4423
4769
  * @param block - the range to expand
4770
+ * @returns an array of single-cell copies, one per index from `i` to `to`
4424
4771
  *
4425
4772
  * @example
4426
4773
  * ```ts
@@ -4439,6 +4786,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4439
4786
  * Returns true if the input spans more than one cell (i.e., has a `to` value strictly greater than `i`).
4440
4787
  *
4441
4788
  * @param input - range or cell to check
4789
+ * @returns true if `to` is defined and strictly greater than `i`
4442
4790
  */ function dateCellRangeHasRange(input) {
4443
4791
  return input.to != null && input.to > input.i;
4444
4792
  }
@@ -4446,6 +4794,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4446
4794
  * Returns the effective ending index of a range: `to` if defined, otherwise `i`.
4447
4795
  *
4448
4796
  * @param input - range or cell to read
4797
+ * @returns the `to` index if defined, otherwise `i`
4449
4798
  */ function dateCellEndIndex(input) {
4450
4799
  var _input_to;
4451
4800
  return (_input_to = input.to) !== null && _input_to !== void 0 ? _input_to : input.i;
@@ -4456,8 +4805,9 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4456
4805
  * and `to` is the maximum ending index across all blocks.
4457
4806
  *
4458
4807
  * @param input - cells or ranges to group
4808
+ * @returns a UniqueDateCellRangeGroup containing the sorted blocks with `i` at 0
4459
4809
  */ function groupUniqueDateCells(input) {
4460
- var blocks = sortDateCellRanges(_to_consumable_array$2(input));
4810
+ var blocks = sortDateCellRanges(_to_consumable_array$4(input));
4461
4811
  var i = 0;
4462
4812
  var to;
4463
4813
  if (blocks.length === 0) {
@@ -4478,6 +4828,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4478
4828
  * according to the provided configuration. Handles overlap resolution, gap filling, and boundary clamping.
4479
4829
  *
4480
4830
  * @param config - controls start/end bounds, fill strategy, and overlap retention behavior
4831
+ * @returns a function that merges, fills, and resolves overlaps in date cell range arrays
4481
4832
  *
4482
4833
  * @example
4483
4834
  * ```ts
@@ -4495,9 +4846,10 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4495
4846
  var retainOnOverlap = inputRetainOnOverlap !== null && inputRetainOnOverlap !== void 0 ? inputRetainOnOverlap : 'next';
4496
4847
  var maxAllowedIndex = endAtIndex !== null && endAtIndex !== void 0 ? endAtIndex : Number.MAX_SAFE_INTEGER;
4497
4848
  var fillFactory = inputFillFactory;
4498
- if (!fillFactory && fill === 'fill') {
4849
+ if (!inputFillFactory && fill === 'fill') {
4499
4850
  throw new Error('fillFactory is required when fillOption is "fill".');
4500
4851
  }
4852
+ // eslint-disable-next-line sonarjs/cognitive-complexity
4501
4853
  return function(input, newBlocks) {
4502
4854
  var addBlockWithRange = function addBlockWithRange(inputBlock, i) {
4503
4855
  var inputTo = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : i;
@@ -4535,7 +4887,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4535
4887
  to: to
4536
4888
  };
4537
4889
  var block = fillFactory(dateCellRange);
4538
- addBlockWithRange(block, i, to !== null && to !== void 0 ? to : i);
4890
+ addBlockWithRange(block, i, to);
4539
4891
  } else if (fill === 'empty') ; else if (blocks.length > 0) {
4540
4892
  // only extend if one or more blocks have been pushed
4541
4893
  var blockToExtend = lastValue(blocks);
@@ -4556,6 +4908,8 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4556
4908
  };
4557
4909
  var shouldRetainCurrentOverNext = /**
4558
4910
  * Used to determine how to handle two neighboring objects.
4911
+ *
4912
+ * @returns true if the current block should be retained over the next block
4559
4913
  */ function shouldRetainCurrentOverNext() {
4560
4914
  if (current.priority === next.priority) {
4561
4915
  return retainOnOverlap === 'current';
@@ -4596,6 +4950,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4596
4950
  priority: priority
4597
4951
  } : sorted[i];
4598
4952
  next = sorted[i + 1];
4953
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- next may be undefined when sorted[i+1] is out of bounds
4599
4954
  if (next) {
4600
4955
  nextStartIndex = next.block.i;
4601
4956
  // complete loop once past the max allowed index
@@ -4712,6 +5067,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4712
5067
  }
4713
5068
  }
4714
5069
  }
5070
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- current may be undefined when sorted is empty
4715
5071
  if (current != null) {
4716
5072
  // if current != null, then atleast one block was input/remaining.
4717
5073
  var lastStartIndex = current.block.i;
@@ -4726,12 +5082,11 @@ function _unsupported_iterable_to_array$5(o, minLen) {
4726
5082
  } else if (fill === 'fill') {
4727
5083
  completeBlocks();
4728
5084
  }
4729
- var result = {
5085
+ return {
4730
5086
  i: 0,
4731
5087
  blocks: blocks,
4732
5088
  discarded: discarded
4733
5089
  };
4734
- return result;
4735
5090
  };
4736
5091
  }
4737
5092
 
@@ -4794,6 +5149,9 @@ function _type_of$3(obj) {
4794
5149
  * When `limitToCompletedIndexes` is true, only indexes whose timing duration has fully elapsed are included,
4795
5150
  * with the max boundary lazily refreshed as time passes.
4796
5151
  *
5152
+ * @param config - Configuration specifying the timing, range fit, and completion constraints.
5153
+ * @returns A factory function that produces a clamped {@link DateCellRangeWithRange} from optional start/end input.
5154
+ *
4797
5155
  * @example
4798
5156
  * ```ts
4799
5157
  * const timing = dateCellTiming({ startsAt, duration: 60 }, 5);
@@ -4869,6 +5227,10 @@ function _type_of$3(obj) {
4869
5227
  * Computes a {@link DateCellRangeWithRange} from a timing and optional start/end input.
4870
5228
  *
4871
5229
  * Shorthand for creating a {@link dateCellRangeOfTimingFactory} and immediately invoking it.
5230
+ *
5231
+ * @param config - A {@link DateCellTiming} or full factory configuration.
5232
+ * @param input - Optional start/end boundaries for the range.
5233
+ * @returns A clamped {@link DateCellRangeWithRange} derived from the timing and input.
4872
5234
  */ function dateCellRangeOfTiming(config, input) {
4873
5235
  return dateCellRangeOfTimingFactory(isDateCellTiming(config) ? {
4874
5236
  timing: config
@@ -4879,6 +5241,10 @@ function _type_of$3(obj) {
4879
5241
  * of the timing schedule. Useful for determining which days have already finished.
4880
5242
  *
4881
5243
  * By default fitToTimingRange is true.
5244
+ *
5245
+ * @param timing - The timing schedule to evaluate.
5246
+ * @param config - Optional configuration for the current time reference and range fitting.
5247
+ * @returns A {@link DateCellRangeWithRange} covering only the completed day indexes.
4882
5248
  */ function dateCellTimingCompletedTimeRange(timing, config) {
4883
5249
  var _ref;
4884
5250
  return dateCellRangeOfTiming({
@@ -4892,6 +5258,10 @@ function _type_of$3(obj) {
4892
5258
  * Returns the latest completed day index for a {@link DateCellTiming}.
4893
5259
  *
4894
5260
  * Returns -1 if no days have been completed yet.
5261
+ *
5262
+ * @param timing - The timing schedule to evaluate.
5263
+ * @param now - Optional reference time; defaults to the current time.
5264
+ * @returns The zero-based index of the last fully completed day, or -1 if none.
4895
5265
  */ function dateCellTimingLatestCompletedIndex(timing, now) {
4896
5266
  return dateCellTimingCompletedTimeRange(timing, {
4897
5267
  now: now
@@ -4899,6 +5269,9 @@ function _type_of$3(obj) {
4899
5269
  }
4900
5270
  /**
4901
5271
  * Converts a {@link DateCellRange} (inclusive `to`) to a {@link DateCellIndexRange} (exclusive `maxIndex`).
5272
+ *
5273
+ * @param range - The inclusive date cell range to convert.
5274
+ * @returns A {@link DateCellIndexRange} with exclusive `maxIndex`.
4902
5275
  */ function dateCellRangeToDateCellIndexRange(range) {
4903
5276
  var _range_to;
4904
5277
  return {
@@ -4908,6 +5281,9 @@ function _type_of$3(obj) {
4908
5281
  }
4909
5282
  /**
4910
5283
  * Converts a {@link DateCellIndexRange} (exclusive `maxIndex`) back to a {@link DateCellRangeWithRange} (inclusive `to`).
5284
+ *
5285
+ * @param range - The exclusive date cell index range to convert.
5286
+ * @returns A {@link DateCellRangeWithRange} with inclusive `to`.
4911
5287
  */ function dateCellIndexRangeToDateCellRange(range) {
4912
5288
  return {
4913
5289
  i: range.minIndex,
@@ -4919,6 +5295,11 @@ function _type_of$3(obj) {
4919
5295
  *
4920
5296
  * An arbitrary limit can also be applied. When `fitToTimingRange` is true (default),
4921
5297
  * the limit is intersected with the timing's own range; otherwise the limit is used as-is.
5298
+ *
5299
+ * @param timing - The timing schedule to derive the range from.
5300
+ * @param limit - Optional range input to constrain the output.
5301
+ * @param fitToTimingRange - Whether to intersect the limit with the timing's own range. Defaults to true.
5302
+ * @returns A {@link DateCellIndexRange} representing the computed index bounds.
4922
5303
  */ function dateCellIndexRange(timing, limit) {
4923
5304
  var fitToTimingRange = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : true;
4924
5305
  var indexFactory = dateCellTimingRelativeIndexFactory(timing);
@@ -4947,6 +5328,9 @@ function _type_of$3(obj) {
4947
5328
  * by combining its timing and blocks.
4948
5329
  *
4949
5330
  * Shorthand for calling {@link expandDateCellTiming} with `collection.timing` and `collection.blocks`.
5331
+ *
5332
+ * @param collection - The date cell collection containing timing and blocks to expand.
5333
+ * @returns An array of {@link DateCellDurationSpan} values with concrete start times and durations.
4950
5334
  */ function expandDateCellCollection(collection) {
4951
5335
  return expandDateCellTiming(collection.timing, collection.blocks);
4952
5336
  }
@@ -4954,6 +5338,10 @@ function _type_of$3(obj) {
4954
5338
  * Expands the given blocks into {@link DateCellDurationSpan} values using the provided timing.
4955
5339
  *
4956
5340
  * Shorthand for creating a {@link dateCellTimingExpansionFactory} and immediately invoking it.
5341
+ *
5342
+ * @param timing - The timing schedule providing start times and duration.
5343
+ * @param blocks - The date cell blocks to expand into duration spans.
5344
+ * @returns An array of {@link DateCellDurationSpan} values with concrete start times.
4957
5345
  */ function expandDateCellTiming(timing, blocks) {
4958
5346
  return dateCellTimingExpansionFactory({
4959
5347
  timing: timing
@@ -4967,6 +5355,9 @@ function _type_of$3(obj) {
4967
5355
  * Filtering is applied both at the block level and at the computed duration span level,
4968
5356
  * and evaluation can be capped for performance with large datasets.
4969
5357
  *
5358
+ * @param config - Configuration specifying the timing, range limits, filters, and output caps.
5359
+ * @returns A factory function that expands date cell blocks into {@link DateCellDurationSpan} arrays.
5360
+ *
4970
5361
  * @example
4971
5362
  * ```ts
4972
5363
  * const timing = dateCellTiming({ startsAt, duration: 60 }, 5);
@@ -5064,6 +5455,9 @@ function _type_of$3(obj) {
5064
5455
  * const dateInfo = infoFactory(someDate);
5065
5456
  * console.log(dateInfo.dayIndex); // which day index this date falls on
5066
5457
  * ```
5458
+ *
5459
+ * @param config - Configuration providing the timing and optional range limit.
5460
+ * @returns A factory that computes {@link DateCellDayTimingInfo} for any date or day index.
5067
5461
  */ function dateCellDayTimingInfoFactory(config) {
5068
5462
  var timing = config.timing, rangeLimit = config.rangeLimit;
5069
5463
  var duration = timing.duration;
@@ -5128,8 +5522,11 @@ function _type_of$3(obj) {
5128
5522
  * Type guard that returns true if the input is a {@link DateCellTimingRelativeIndexFactory}.
5129
5523
  *
5130
5524
  * Checks for the presence of `_timing` and `_normalInstance` properties on a function.
5525
+ *
5526
+ * @param input - The value to check.
5527
+ * @returns True if the input is a {@link DateCellTimingRelativeIndexFactory}.
5131
5528
  */ function isDateCellTimingRelativeIndexFactory(input) {
5132
- return typeof input === 'function' && input._timing != null && input._normalInstance != null;
5529
+ return typeof input === 'function' && '_timing' in input && '_normalInstance' in input;
5133
5530
  }
5134
5531
  /**
5135
5532
  * Creates a {@link DateCellTimingRelativeIndexFactory} that converts dates, ISO8601 day strings,
@@ -5157,6 +5554,9 @@ function _type_of$3(obj) {
5157
5554
  * indexFactory._timing; // the original timing
5158
5555
  * indexFactory._normalInstance; // timezone normalizer
5159
5556
  * ```
5557
+ *
5558
+ * @param input - A timing configuration or an existing factory (returned as-is).
5559
+ * @returns A factory that converts dates, ISO8601 day strings, or indexes to zero-based day offsets.
5160
5560
  */ function dateCellTimingRelativeIndexFactory(input) {
5161
5561
  if (isDateCellTimingRelativeIndexFactory(input)) {
5162
5562
  return input;
@@ -5195,6 +5595,9 @@ function _type_of$3(obj) {
5195
5595
  * dates, date ranges, and cell ranges into a flat array of day indexes.
5196
5596
  *
5197
5597
  * Date ranges and cell ranges are expanded to include every index within the range.
5598
+ *
5599
+ * @param indexFactory - The relative index factory used for date-to-index conversion.
5600
+ * @returns A factory that flattens mixed date/range arrays into day index arrays.
5198
5601
  */ function dateCellTimingRelativeIndexArrayFactory(indexFactory) {
5199
5602
  var factory = function factory(input) {
5200
5603
  var inputAsArray = asArray(input);
@@ -5236,6 +5639,10 @@ function _type_of$3(obj) {
5236
5639
  * // Get the index for a specific date
5237
5640
  * const index = getRelativeIndexForDateCellTiming(timing, someDate);
5238
5641
  * ```
5642
+ *
5643
+ * @param timing - The timing providing the start date and timezone context.
5644
+ * @param date - A date or index to convert; defaults to the current date/time.
5645
+ * @returns The zero-based day index relative to the timing's start.
5239
5646
  */ function getRelativeIndexForDateCellTiming(timing) {
5240
5647
  var date = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : new Date();
5241
5648
  return dateCellTimingRelativeIndexFactory(timing)(date);
@@ -5262,6 +5669,9 @@ function _type_of$3(obj) {
5262
5669
  * // Convert index 3 to a date with a specific reference time
5263
5670
  * const dateForDay3AtNoon = dateFactory(3, noonDate);
5264
5671
  * ```
5672
+ *
5673
+ * @param timing - The timing providing the start date and timezone context.
5674
+ * @returns A factory that maps day indexes to calendar dates preserving the current time-of-day.
5265
5675
  */ function dateCellTimingDateFactory(timing) {
5266
5676
  var _dateCellTimingStartPair = dateCellTimingStartPair(timing), start = _dateCellTimingStartPair.start, normalInstance = _dateCellTimingStartPair.normalInstance;
5267
5677
  var utcStartDate = normalInstance.baseDateToTargetDate(start);
@@ -5277,8 +5687,8 @@ function _type_of$3(obj) {
5277
5687
  if (startUtcHours > nowHours) {
5278
5688
  input += 1;
5279
5689
  }
5280
- var nowWithDateForIndex = addHours(utcStartDateWithNowTime, input * HOURS_IN_DAY); // add days to apply the correct offset to the target index
5281
- return nowWithDateForIndex;
5690
+ // add days to apply the correct offset to the target index
5691
+ return addHours(utcStartDateWithNowTime, input * HOURS_IN_DAY);
5282
5692
  }
5283
5693
  };
5284
5694
  factory._timing = timing;
@@ -5295,6 +5705,9 @@ function _type_of$3(obj) {
5295
5705
  * const timing = dateCellTiming({ startsAt, duration: 60 }, 5);
5296
5706
  * const lastIndex = dateCellTimingEndIndex(timing); // 4 (zero-based, 5 days)
5297
5707
  * ```
5708
+ *
5709
+ * @param input - A timing or an existing relative index factory.
5710
+ * @returns The zero-based index of the last day in the schedule.
5298
5711
  */ function dateCellTimingEndIndex(input) {
5299
5712
  var factory = dateCellTimingRelativeIndexFactory(input);
5300
5713
  return factory(factory._timing.end);
@@ -5304,6 +5717,9 @@ function _type_of$3(obj) {
5304
5717
  * for any day index relative to the timing's start.
5305
5718
  *
5306
5719
  * The returned date represents the beginning of the day in the timing's timezone context.
5720
+ *
5721
+ * @param input - A timing or an existing relative index factory.
5722
+ * @returns A factory that maps day indexes to the start-of-day date in the timing's timezone.
5307
5723
  */ function dateCellTimingStartDateFactory(input) {
5308
5724
  var indexFactory = dateCellTimingRelativeIndexFactory(input);
5309
5725
  var _dateCellTimingStartPair = dateCellTimingStartPair(indexFactory._timing), start = _dateCellTimingStartPair.start, normalInstance = _dateCellTimingStartPair.normalInstance;
@@ -5341,6 +5757,10 @@ function dateCellTimingEndDateFactory(input) {
5341
5757
  /**
5342
5758
  * Convenience function that returns the calendar date for a given day index or date
5343
5759
  * relative to the timing. Shorthand for creating a {@link dateCellTimingDateFactory} and invoking it.
5760
+ *
5761
+ * @param timing - The timing providing the start date and timezone context.
5762
+ * @param input - A date or day index to convert.
5763
+ * @returns The calendar date corresponding to the input, preserving current time-of-day.
5344
5764
  */ function getRelativeDateForDateCellTiming(timing, input) {
5345
5765
  return dateCellTimingDateFactory(timing)(input);
5346
5766
  }
@@ -5366,6 +5786,9 @@ function dateCellTimingEndDateFactory(input) {
5366
5786
  * });
5367
5787
  * // result has the same start day and end day, but new time-of-day and 90-minute duration
5368
5788
  * ```
5789
+ *
5790
+ * @param input - Configuration specifying the timing to update, the event source, and which aspects to replace.
5791
+ * @returns A new {@link FullDateCellTiming} with the requested aspects replaced.
5369
5792
  */ function updateDateCellTimingWithDateCellTimingEvent(input) {
5370
5793
  var timing = input.timing, event = input.event, replaceStartDay = input.replaceStartDay, replaceStartsAt = input.replaceStartsAt, startDateDay = input.startDayDate, endOnEvent = input.endOnEvent, replaceDuration = input.replaceDuration;
5371
5794
  var timezone = timing.timezone;
@@ -5382,7 +5805,8 @@ function dateCellTimingEndDateFactory(input) {
5382
5805
  var _dateCellTimingStartPair = dateCellTimingStartPair({
5383
5806
  startsAt: event.startsAt,
5384
5807
  timezone: timezone
5385
- }), eventStartDate = _dateCellTimingStartPair.start, normalInstance = _dateCellTimingStartPair.normalInstance;
5808
+ }), initialEventStartDate = _dateCellTimingStartPair.start, normalInstance = _dateCellTimingStartPair.normalInstance;
5809
+ var eventStartDate = initialEventStartDate;
5386
5810
  if (startDateDay != null) {
5387
5811
  var startDateFactory = dateCellTimingStartDateFactory(timing);
5388
5812
  eventStartDate = startDateFactory(startDateDay);
@@ -5446,6 +5870,9 @@ function dateCellTimingEndDateFactory(input) {
5446
5870
  * isInRange(6); // false - index 6 is outside [2, 5]
5447
5871
  * isInRange(someDate); // converts date to index, then checks containment
5448
5872
  * ```
5873
+ *
5874
+ * @param config - Configuration specifying the reference range and optional timezone context.
5875
+ * @returns A predicate function that checks containment within the configured range.
5449
5876
  */ function isDateWithinDateCellRangeFunction(config) {
5450
5877
  var inputStartsAt = config.startsAt, inputRange = config.range;
5451
5878
  var startsAt = inputStartsAt;
@@ -5466,13 +5893,11 @@ function dateCellTimingEndDateFactory(input) {
5466
5893
  } else {
5467
5894
  rangeInput = inputRange;
5468
5895
  }
5469
- if (!inputStartsAt) {
5470
- if (dateRange && isDateInput) {
5471
- startsAt = {
5472
- startsAt: inputRange,
5473
- timezone: guessCurrentTimezone()
5474
- };
5475
- }
5896
+ if (!inputStartsAt && dateRange && isDateInput) {
5897
+ startsAt = {
5898
+ startsAt: inputRange,
5899
+ timezone: guessCurrentTimezone()
5900
+ };
5476
5901
  }
5477
5902
  if (!startsAt) {
5478
5903
  throw new Error('Invalid isDateWithinDateCellRangeFunction() config. StartsAt date info could not be determined from input.');
@@ -5625,6 +6050,7 @@ function _object_spread_props$6(target, source) {
5625
6050
  * Useful for identifying events or blocks that have already begun relative to a point in time.
5626
6051
  *
5627
6052
  * @param now - Reference time to compare against. Defaults to the current time.
6053
+ * @returns a filter function that returns true for spans whose start time is at or before the reference time
5628
6054
  *
5629
6055
  * @example
5630
6056
  * ```ts
@@ -5643,6 +6069,7 @@ function _object_spread_props$6(target, source) {
5643
6069
  * The inverse of {@link dateCellDurationSpanHasStartedFilterFunction}. Useful for finding upcoming or future events.
5644
6070
  *
5645
6071
  * @param now - Reference time to compare against. Defaults to the current time.
6072
+ * @returns a filter function that returns true for spans whose start time is strictly after the reference time
5646
6073
  *
5647
6074
  * @example
5648
6075
  * ```ts
@@ -5662,6 +6089,7 @@ function _object_spread_props$6(target, source) {
5662
6089
  * Useful for identifying completed events.
5663
6090
  *
5664
6091
  * @param now - Reference time to compare against. Defaults to the current time.
6092
+ * @returns a filter function that returns true for spans whose computed end time is at or before the reference time
5665
6093
  *
5666
6094
  * @example
5667
6095
  * ```ts
@@ -5682,6 +6110,7 @@ function _object_spread_props$6(target, source) {
5682
6110
  * still in progress or have not yet occurred.
5683
6111
  *
5684
6112
  * @param now - Reference time to compare against. Defaults to the current time.
6113
+ * @returns a filter function that returns true for spans whose computed end time is strictly after the reference time
5685
6114
  *
5686
6115
  * @example
5687
6116
  * ```ts
@@ -5703,6 +6132,7 @@ function _object_spread_props$6(target, source) {
5703
6132
  * indices clamped to the range boundaries. Non-overlapping cells are excluded entirely.
5704
6133
  *
5705
6134
  * @param range - The target range to fit cells into.
6135
+ * @returns a reusable function that clamps or filters date cells to the configured range
5706
6136
  *
5707
6137
  * @example
5708
6138
  * ```ts
@@ -5743,6 +6173,7 @@ function _object_spread_props$6(target, source) {
5743
6173
  *
5744
6174
  * @param range - The target range to fit cells into.
5745
6175
  * @param input - The date cells to clamp or filter.
6176
+ * @returns an array of date cells clamped to the range, with non-overlapping cells removed
5746
6177
  *
5747
6178
  * @example
5748
6179
  * ```ts
@@ -5757,6 +6188,7 @@ function _object_spread_props$6(target, source) {
5757
6188
  *
5758
6189
  * @param range - The target range to fit the cell into.
5759
6190
  * @param input - The single date cell to clamp or exclude.
6191
+ * @returns the clamped date cell, or `undefined` if it does not overlap the range
5760
6192
  *
5761
6193
  * @example
5762
6194
  * ```ts
@@ -5771,7 +6203,7 @@ function _object_spread_props$6(target, source) {
5771
6203
  ])[0];
5772
6204
  }
5773
6205
 
5774
- function _array_like_to_array$4(arr, len) {
6206
+ function _array_like_to_array$5(arr, len) {
5775
6207
  if (len == null || len > arr.length) len = arr.length;
5776
6208
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
5777
6209
  return arr2;
@@ -5779,6 +6211,9 @@ function _array_like_to_array$4(arr, len) {
5779
6211
  function _array_with_holes$2(arr) {
5780
6212
  if (Array.isArray(arr)) return arr;
5781
6213
  }
6214
+ function _array_without_holes$3(arr) {
6215
+ if (Array.isArray(arr)) return _array_like_to_array$5(arr);
6216
+ }
5782
6217
  function _instanceof(left, right) {
5783
6218
  if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
5784
6219
  return !!right[Symbol.hasInstance](left);
@@ -5786,6 +6221,9 @@ function _instanceof(left, right) {
5786
6221
  return left instanceof right;
5787
6222
  }
5788
6223
  }
6224
+ function _iterable_to_array$3(iter) {
6225
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
6226
+ }
5789
6227
  function _iterable_to_array_limit$2(arr, i) {
5790
6228
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
5791
6229
  if (_i == null) return;
@@ -5813,16 +6251,22 @@ function _iterable_to_array_limit$2(arr, i) {
5813
6251
  function _non_iterable_rest$2() {
5814
6252
  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
6253
  }
6254
+ function _non_iterable_spread$3() {
6255
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
6256
+ }
5816
6257
  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();
6258
+ 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
6259
  }
5819
- function _unsupported_iterable_to_array$4(o, minLen) {
6260
+ function _to_consumable_array$3(arr) {
6261
+ return _array_without_holes$3(arr) || _iterable_to_array$3(arr) || _unsupported_iterable_to_array$5(arr) || _non_iterable_spread$3();
6262
+ }
6263
+ function _unsupported_iterable_to_array$5(o, minLen) {
5820
6264
  if (!o) return;
5821
- if (typeof o === "string") return _array_like_to_array$4(o, minLen);
6265
+ if (typeof o === "string") return _array_like_to_array$5(o, minLen);
5822
6266
  var n = Object.prototype.toString.call(o).slice(8, -1);
5823
6267
  if (n === "Object" && o.constructor) n = o.constructor.name;
5824
6268
  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);
6269
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$5(o, minLen);
5826
6270
  }
5827
6271
  /**
5828
6272
  * Used for default YearWeekCode values
@@ -5928,8 +6372,7 @@ function _unsupported_iterable_to_array$4(o, minLen) {
5928
6372
  * @param input - timezone string, config, or instance
5929
6373
  * @returns the resolved normal instance
5930
6374
  */ function yearWeekCodeDateTimezoneInstance(input) {
5931
- var normal = input ? _instanceof(input, DateTimezoneUtcNormalInstance) ? input : dateTimezoneUtcNormal(input) : SYSTEM_DATE_TIMEZONE_UTC_NORMAL_INSTANCE;
5932
- return normal;
6375
+ return input ? _instanceof(input, DateTimezoneUtcNormalInstance) ? input : dateTimezoneUtcNormal(input) : SYSTEM_DATE_TIMEZONE_UTC_NORMAL_INSTANCE;
5933
6376
  }
5934
6377
  function yearWeekCode(dateOrYear, inputWeek) {
5935
6378
  return yearWeekCodeFactory({
@@ -5981,6 +6424,7 @@ function yearWeekCode(dateOrYear, inputWeek) {
5981
6424
  *
5982
6425
  * @param dateRange - the range to compute week codes for
5983
6426
  * @param dateRangeTimezone - the timezone context for accurate week boundary calculation
6427
+ * @returns an array of YearWeekCode values covering the range
5984
6428
  */ function yearWeekCodeForDateRangeInTimezone(dateRange, dateRangeTimezone) {
5985
6429
  return yearWeekCodeForDateRangeFactory(yearWeekCodeFactory({
5986
6430
  timezone: dateRangeTimezone
@@ -6013,6 +6457,7 @@ function yearWeekCode(dateOrYear, inputWeek) {
6013
6457
  * Returns all {@link YearWeekCode} values for the calendar month containing the given date, using the system timezone.
6014
6458
  *
6015
6459
  * @param date - a date within the target month
6460
+ * @returns an array of YearWeekCode values for the month
6016
6461
  */ function yearWeekCodeForCalendarMonth(date) {
6017
6462
  return yearWeekCodeForCalendarMonthFactory(yearWeekCodeFactory({
6018
6463
  timezone: SYSTEM_DATE_TIMEZONE_UTC_NORMAL_INSTANCE
@@ -6056,8 +6501,8 @@ function yearWeekCode(dateOrYear, inputWeek) {
6056
6501
  var utcYearDate = new Date(Date.UTC(pair.year, 0, 1, 0, 0, 0, 0));
6057
6502
  var systemYearDate = normal.systemDateToBaseDate(utcYearDate); // convert to system before using system date functions
6058
6503
  var date = startOfWeek(setWeek(systemYearDate, pair.week));
6059
- var fixed = normal.targetDateToSystemDate(date); // back to timezone
6060
- return fixed;
6504
+ // back to timezone
6505
+ return normal.targetDateToSystemDate(date);
6061
6506
  };
6062
6507
  }
6063
6508
  /**
@@ -6111,10 +6556,10 @@ function yearWeekCode(dateOrYear, inputWeek) {
6111
6556
  }
6112
6557
  return yearWeekCode;
6113
6558
  });
6114
- var groups = Array.from(map.entries()).map(function(param) {
6559
+ var groups = _to_consumable_array$3(map.entries()).map(function(param) {
6115
6560
  var _param = _sliced_to_array$2(param, 2), week = _param[0], _$items = _param[1];
6116
6561
  return {
6117
- week: week || 0,
6562
+ week: week !== null && week !== void 0 ? week : 0,
6118
6563
  items: _$items
6119
6564
  };
6120
6565
  });
@@ -6153,8 +6598,7 @@ function yearWeekCode(dateOrYear, inputWeek) {
6153
6598
  var normalInstance = startDateFactory._indexFactory._normalInstance;
6154
6599
  return function(indexOrDate) {
6155
6600
  var dateInSystemTimezone = normalInstance.systemDateToTargetDate(startDateFactory(indexOrDate));
6156
- var yearWeekCode = yearWeekCodeFromDate(dateInSystemTimezone);
6157
- return yearWeekCode;
6601
+ return yearWeekCodeFromDate(dateInSystemTimezone);
6158
6602
  };
6159
6603
  }
6160
6604
  /**
@@ -6165,21 +6609,20 @@ function yearWeekCode(dateOrYear, inputWeek) {
6165
6609
  */ function dateCellIndexYearWeekCodeGroupFactory(config) {
6166
6610
  var dateCellIndexReader = config.dateCellIndexReader, inputDateCellIndexYearWeekCodeFactory = config.dateCellIndexYearWeekCodeFactory;
6167
6611
  var dateCellIndexYearWeekCode = typeof inputDateCellIndexYearWeekCodeFactory === 'function' ? inputDateCellIndexYearWeekCodeFactory : dateCellIndexYearWeekCodeFactory(inputDateCellIndexYearWeekCodeFactory);
6168
- var factory = yearWeekCodeGroupFactory({
6612
+ return yearWeekCodeGroupFactory({
6169
6613
  yearWeekCodeFactory: dateCellIndexYearWeekCode,
6170
6614
  yearWeekCodeReader: dateCellIndexYearWeekCode,
6171
6615
  dateReader: dateCellIndexReader
6172
6616
  });
6173
- return factory;
6174
6617
  }
6175
6618
 
6176
- function _array_like_to_array$3(arr, len) {
6619
+ function _array_like_to_array$4(arr, len) {
6177
6620
  if (len == null || len > arr.length) len = arr.length;
6178
6621
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
6179
6622
  return arr2;
6180
6623
  }
6181
- function _array_without_holes$1(arr) {
6182
- if (Array.isArray(arr)) return _array_like_to_array$3(arr);
6624
+ function _array_without_holes$2(arr) {
6625
+ if (Array.isArray(arr)) return _array_like_to_array$4(arr);
6183
6626
  }
6184
6627
  function _define_property$9(obj, key, value) {
6185
6628
  if (key in obj) {
@@ -6194,10 +6637,10 @@ function _define_property$9(obj, key, value) {
6194
6637
  }
6195
6638
  return obj;
6196
6639
  }
6197
- function _iterable_to_array$1(iter) {
6640
+ function _iterable_to_array$2(iter) {
6198
6641
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
6199
6642
  }
6200
- function _non_iterable_spread$1() {
6643
+ function _non_iterable_spread$2() {
6201
6644
  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
6645
  }
6203
6646
  function _object_spread$7(target) {
@@ -6234,20 +6677,20 @@ function _object_spread_props$5(target, source) {
6234
6677
  }
6235
6678
  return target;
6236
6679
  }
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();
6680
+ function _to_consumable_array$2(arr) {
6681
+ return _array_without_holes$2(arr) || _iterable_to_array$2(arr) || _unsupported_iterable_to_array$4(arr) || _non_iterable_spread$2();
6239
6682
  }
6240
6683
  function _type_of$2(obj) {
6241
6684
  "@swc/helpers - typeof";
6242
6685
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
6243
6686
  }
6244
- function _unsupported_iterable_to_array$3(o, minLen) {
6687
+ function _unsupported_iterable_to_array$4(o, minLen) {
6245
6688
  if (!o) return;
6246
- if (typeof o === "string") return _array_like_to_array$3(o, minLen);
6689
+ if (typeof o === "string") return _array_like_to_array$4(o, minLen);
6247
6690
  var n = Object.prototype.toString.call(o).slice(8, -1);
6248
6691
  if (n === "Object" && o.constructor) n = o.constructor.name;
6249
6692
  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);
6693
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$4(o, minLen);
6251
6694
  }
6252
6695
  /**
6253
6696
  * Encodes days of the week as numeric codes for use in schedule filtering.
@@ -6312,7 +6755,7 @@ function _unsupported_iterable_to_array$3(o, minLen) {
6312
6755
  * @param input - schedule day codes to convert (WEEKDAY/WEEKEND shorthand codes are expanded)
6313
6756
  * @returns an EnabledDays object with boolean flags for each day
6314
6757
  */ function enabledDaysFromDateCellScheduleDayCodes(input) {
6315
- var days = expandDateCellScheduleDayCodesToDayOfWeekSet(Array.from(new Set(input)));
6758
+ var days = expandDateCellScheduleDayCodesToDayOfWeekSet(_to_consumable_array$2(new Set(input)));
6316
6759
  return enabledDaysFromDaysOfWeek(days);
6317
6760
  }
6318
6761
  /**
@@ -6389,7 +6832,8 @@ var DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = /^[0-9]{0,9}$/;
6389
6832
  * simplifyDateCellScheduleDayCodes([2, 4]);
6390
6833
  * // Returns [DateCellScheduleDayCode.MONDAY, DateCellScheduleDayCode.WEDNESDAY] // [2, 4]
6391
6834
  * ```
6392
- */ function simplifyDateCellScheduleDayCodes(codes) {
6835
+ */ // eslint-disable-next-line sonarjs/cognitive-complexity
6836
+ function simplifyDateCellScheduleDayCodes(codes) {
6393
6837
  var codesSet = new Set(codes);
6394
6838
  var result = [];
6395
6839
  if (codesSet.size >= 2) {
@@ -6460,7 +6904,7 @@ var DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = /^[0-9]{0,9}$/;
6460
6904
  * @param input - day codes to expand
6461
6905
  * @returns sorted array of individual day codes (1-7 only, no shorthand)
6462
6906
  */ function expandDateCellScheduleDayCodes(input) {
6463
- return Array.from(expandDateCellScheduleDayCodesToDayCodesSet(input)).sort(sortNumbersAscendingFunction);
6907
+ return _to_consumable_array$2(expandDateCellScheduleDayCodesToDayCodesSet(input)).sort(sortNumbersAscendingFunction);
6464
6908
  }
6465
6909
  /**
6466
6910
  * Expands the input DateCellScheduleDayCodesInput to a Set of individual DateCellScheduleDayCode values (1-7), expanding shorthand codes like WEEKDAY and WEEKEND.
@@ -6471,6 +6915,7 @@ var DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = /^[0-9]{0,9}$/;
6471
6915
  var codes = rawDateCellScheduleDayCodes(input);
6472
6916
  var days = new Set();
6473
6917
  codes.forEach(function(code) {
6918
+ // eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check
6474
6919
  switch(code){
6475
6920
  case 0:
6476
6921
  break;
@@ -6496,9 +6941,10 @@ var DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = /^[0-9]{0,9}$/;
6496
6941
  * @returns raw array of day codes with NONE values removed
6497
6942
  */ function rawDateCellScheduleDayCodes(input) {
6498
6943
  var dayCodes;
6944
+ // eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check
6499
6945
  switch(typeof input === "undefined" ? "undefined" : _type_of$2(input)){
6500
6946
  case 'string':
6501
- dayCodes = Array.from(new Set(input)).map(function(x) {
6947
+ dayCodes = _to_consumable_array$2(new Set(input)).map(function(x) {
6502
6948
  return Number(x);
6503
6949
  });
6504
6950
  break;
@@ -6508,7 +6954,7 @@ var DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = /^[0-9]{0,9}$/;
6508
6954
  ];
6509
6955
  break;
6510
6956
  default:
6511
- dayCodes = Array.from(input);
6957
+ dayCodes = _to_consumable_array$2(input);
6512
6958
  break;
6513
6959
  }
6514
6960
  return dayCodes.filter(function(x) {
@@ -6617,7 +7063,6 @@ var DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = /^[0-9]{0,9}$/;
6617
7063
  var timezone = inputTimezone !== null && inputTimezone !== void 0 ? inputTimezone : requireCurrentTimezone(); // treat input as the current timezone
6618
7064
  var normalInstance = dateTimezoneUtcNormal(timezone);
6619
7065
  var start;
6620
- var end;
6621
7066
  // either start or startsAt is provided
6622
7067
  if (inputStart != null) {
6623
7068
  var startInSystemTimezone = normalInstance.systemDateToTargetDate(inputStart); // start needs to be in the system timezone normal before processing.
@@ -6634,7 +7079,7 @@ var DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = /^[0-9]{0,9}$/;
6634
7079
  }
6635
7080
  }
6636
7081
  // set the end value
6637
- end = inputEnd !== null && inputEnd !== void 0 ? inputEnd : addMinutes(start, 1); // default the end to one minute after the start
7082
+ var end = inputEnd !== null && inputEnd !== void 0 ? inputEnd : addMinutes(start, 1); // default the end to one minute after the start
6638
7083
  return {
6639
7084
  w: w,
6640
7085
  ex: ex,
@@ -6836,11 +7281,12 @@ var DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = /^[0-9]{0,9}$/;
6836
7281
  * filter(5); // false (Saturday Jan 11)
6837
7282
  * ```
6838
7283
  */ function dateCellScheduleDateFilter(config) {
7284
+ var _ref;
6839
7285
  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
7286
  var timezone = inputTimezone !== null && inputTimezone !== void 0 ? inputTimezone : requireCurrentTimezone(); // if the timezone is not provided, assume the startsAt is a system timezone normal.
6841
7287
  var normalInstance = dateTimezoneUtcNormal(timezone);
6842
7288
  // 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();
7289
+ var startsAt = (_ref = inputStartsAt !== null && inputStartsAt !== void 0 ? inputStartsAt : inputStart) !== null && _ref !== void 0 ? _ref : normalInstance.startOfDayInTargetTimezone();
6844
7290
  var allowedDays = expandDateCellScheduleDayCodesToDayOfWeekSet(w);
6845
7291
  var startsAtInSystem = normalInstance.systemDateToTargetDate(startsAt); // convert to the system date
6846
7292
  var firstDateDay = getDay(startsAtInSystem);
@@ -6866,15 +7312,13 @@ var DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = /^[0-9]{0,9}$/;
6866
7312
  var excludedIndexes = new Set(config.ex);
6867
7313
  var fn = function fn(input) {
6868
7314
  var i;
6869
- var day;
6870
7315
  if (typeof input === 'number') {
6871
7316
  i = input;
6872
7317
  } else {
6873
7318
  i = _dateCellTimingRelativeIndexFactory(input);
6874
7319
  }
6875
- day = dayForIndex(i);
6876
- var result = i >= minAllowedIndex && i <= maxAllowedIndex && allowedDays.has(day) && !excludedIndexes.has(i) || includedIndexes.has(i);
6877
- return result;
7320
+ var day = dayForIndex(i);
7321
+ return i >= minAllowedIndex && i <= maxAllowedIndex && allowedDays.has(day) && !excludedIndexes.has(i) || includedIndexes.has(i);
6878
7322
  };
6879
7323
  fn._dateCellTimingRelativeIndexFactory = _dateCellTimingRelativeIndexFactory;
6880
7324
  return fn;
@@ -6928,6 +7372,8 @@ var DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = /^[0-9]{0,9}$/;
6928
7372
  * Creates a DateCellScheduleDateCellTimingFilter that tests whether a DateCell block's index is allowed by the schedule within the given timing.
6929
7373
  *
6930
7374
  * @param config - timing and schedule to build the filter from
7375
+ * @param config.timing - the DateCellTiming that defines the date range and event times for the filter
7376
+ * @param config.schedule - the DateCellSchedule that controls which day codes and indices are included or excluded
6931
7377
  * @returns a decision function returning true for allowed blocks
6932
7378
  */ function dateCellScheduleDateCellTimingFilter(param) {
6933
7379
  var timing = param.timing, schedule = param.schedule;
@@ -6951,7 +7397,6 @@ var DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = /^[0-9]{0,9}$/;
6951
7397
  * @returns an expansion factory that converts DateCellRange arrays into filtered DateCellDurationSpan arrays
6952
7398
  */ function expandDateCellScheduleFactory(config) {
6953
7399
  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
7400
  var durationSpanFilters = [];
6956
7401
  if (inputDurationSpanFilter) {
6957
7402
  durationSpanFilters.push(inputDurationSpanFilter);
@@ -6968,14 +7413,13 @@ var DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = /^[0-9]{0,9}$/;
6968
7413
  durationSpanFilters.push(dateCellDurationSpanHasNotEndedFilterFunction(now));
6969
7414
  }
6970
7415
  }
6971
- durationSpanFilter = mergeFilterFunctions.apply(void 0, _to_consumable_array$1(durationSpanFilters));
6972
- var expansionFactory = dateCellTimingExpansionFactory({
7416
+ var durationSpanFilter = mergeFilterFunctions.apply(void 0, _to_consumable_array$2(durationSpanFilters));
7417
+ return dateCellTimingExpansionFactory({
6973
7418
  timing: config.timing,
6974
7419
  filter: invertFilter(dateCellScheduleDateCellTimingFilter(config), invertSchedule),
6975
7420
  durationSpanFilter: durationSpanFilter,
6976
7421
  maxDateCellsToReturn: maxDateCellsToReturn
6977
7422
  });
6978
- return expansionFactory;
6979
7423
  }
6980
7424
  /**
6981
7425
  * Expands a DateCellTiming and DateCellSchedule into concrete DateCellDurationSpan values representing each active block in the event.
@@ -7061,16 +7505,155 @@ var DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = /^[0-9]{0,9}$/;
7061
7505
  });
7062
7506
  }
7063
7507
 
7508
+ function _define_property$8(obj, key, value) {
7509
+ if (key in obj) {
7510
+ Object.defineProperty(obj, key, {
7511
+ value: value,
7512
+ enumerable: true,
7513
+ configurable: true,
7514
+ writable: true
7515
+ });
7516
+ } else {
7517
+ obj[key] = value;
7518
+ }
7519
+ return obj;
7520
+ }
7521
+ function _object_spread$6(target) {
7522
+ for(var i = 1; i < arguments.length; i++){
7523
+ var source = arguments[i] != null ? arguments[i] : {};
7524
+ var ownKeys = Object.keys(source);
7525
+ if (typeof Object.getOwnPropertySymbols === "function") {
7526
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
7527
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
7528
+ }));
7529
+ }
7530
+ ownKeys.forEach(function(key) {
7531
+ _define_property$8(target, key, source[key]);
7532
+ });
7533
+ }
7534
+ return target;
7535
+ }
7536
+ /**
7537
+ * Distinguishes between time-based calendar events and all-day/multi-day events.
7538
+ */ var CalendarDateType;
7539
+ (function(CalendarDateType) {
7540
+ /**
7541
+ * Event starts at a specific time and lasts for a certain duration.
7542
+ */ CalendarDateType["TIME"] = "time";
7543
+ /**
7544
+ * Event is specifically for a number of days. Duration is still tracked in minutes.
7545
+ */ CalendarDateType["DAYS"] = "days";
7546
+ })(CalendarDateType || (CalendarDateType = {}));
7547
+ /**
7548
+ * Creates a {@link CalendarDateFactory} that produces all-day calendar events with timezone-aware start times.
7549
+ *
7550
+ * The factory converts an ISO 8601 day string to a UTC date, then applies timezone normalization
7551
+ * so the resulting `startsAt` represents the correct moment for the target timezone.
7552
+ *
7553
+ * @param config - optional timezone configuration
7554
+ * @returns a factory function that creates CalendarDate objects
7555
+ *
7556
+ * @example
7557
+ * ```ts
7558
+ * const factory = calendarDateFactory({ timezone: 'America/Denver' });
7559
+ * const event = factory('2024-01-15', 3);
7560
+ * // event.type === CalendarDateType.DAYS
7561
+ * // event.duration === daysToMinutes(3)
7562
+ * ```
7563
+ */ function calendarDateFactory(config) {
7564
+ var normalConfig = (config === null || config === void 0 ? void 0 : config.timezone) === undefined ? {
7565
+ useSystemTimezone: true
7566
+ } : {
7567
+ timezone: config.timezone ? config.timezone : undefined
7568
+ };
7569
+ var normal = dateTimezoneUtcNormal(normalConfig);
7570
+ return function(day, days) {
7571
+ var date = parseISO8601DayStringToUTCDate(day);
7572
+ var startsAt = normal.targetDateToBaseDate(date);
7573
+ return {
7574
+ type: CalendarDateType.DAYS,
7575
+ startsAt: startsAt,
7576
+ duration: daysToMinutes(days)
7577
+ };
7578
+ };
7579
+ }
7580
+ /**
7581
+ * Convenience function that creates a single all-day {@link CalendarDate} with optional timezone.
7582
+ *
7583
+ * Shorthand for creating a factory and immediately invoking it.
7584
+ *
7585
+ * @param day - ISO 8601 day string (e.g. '2024-01-15')
7586
+ * @param days - number of days the event spans
7587
+ * @param timezone - IANA timezone string, false for UTC, or undefined for system timezone
7588
+ * @returns a CalendarDate with type DAYS
7589
+ *
7590
+ * @example
7591
+ * ```ts
7592
+ * const event = calendarDate('2024-01-15', 1, 'America/Denver');
7593
+ * // event.type === CalendarDateType.DAYS
7594
+ * ```
7595
+ */ function calendarDate(day, days, timezone) {
7596
+ return calendarDateFactory({
7597
+ timezone: timezone
7598
+ })(day, days);
7599
+ }
7600
+ /**
7601
+ * Wraps an existing {@link DateDurationSpan} as a time-based {@link CalendarDate}.
7602
+ *
7603
+ * @param dateDurationSpan - the duration span to wrap
7604
+ * @returns a CalendarDate with type TIME
7605
+ *
7606
+ * @example
7607
+ * ```ts
7608
+ * const span: DateDurationSpan = { startsAt: new Date(), duration: 60 };
7609
+ * const event = calendarDateForDateDurationSpan(span);
7610
+ * // event.type === CalendarDateType.TIME
7611
+ * ```
7612
+ */ function calendarDateForDateDurationSpan(dateDurationSpan) {
7613
+ return _object_spread$6({
7614
+ type: CalendarDateType.TIME
7615
+ }, dateDurationSpan);
7616
+ }
7617
+
7618
+ function _array_like_to_array$3(arr, len) {
7619
+ if (len == null || len > arr.length) len = arr.length;
7620
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
7621
+ return arr2;
7622
+ }
7623
+ function _array_without_holes$1(arr) {
7624
+ if (Array.isArray(arr)) return _array_like_to_array$3(arr);
7625
+ }
7626
+ function _iterable_to_array$1(iter) {
7627
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
7628
+ }
7629
+ function _non_iterable_spread$1() {
7630
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
7631
+ }
7632
+ function _to_consumable_array$1(arr) {
7633
+ return _array_without_holes$1(arr) || _iterable_to_array$1(arr) || _unsupported_iterable_to_array$3(arr) || _non_iterable_spread$1();
7634
+ }
7635
+ function _unsupported_iterable_to_array$3(o, minLen) {
7636
+ if (!o) return;
7637
+ if (typeof o === "string") return _array_like_to_array$3(o, minLen);
7638
+ var n = Object.prototype.toString.call(o).slice(8, -1);
7639
+ if (n === "Object" && o.constructor) n = o.constructor.name;
7640
+ if (n === "Map" || n === "Set") return Array.from(n);
7641
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$3(o, minLen);
7642
+ }
7064
7643
  /**
7065
7644
  * Returns all recognized IANA timezone strings, including the explicit UTC entry.
7066
7645
  *
7646
+ * @returns all known IANA timezone strings plus UTC
7647
+ *
7067
7648
  * @example
7068
7649
  * ```ts
7069
7650
  * const zones = allTimezoneStrings();
7070
7651
  * // ['Africa/Abidjan', ..., 'UTC']
7071
7652
  * ```
7072
7653
  */ function allTimezoneStrings() {
7073
- return timeZonesNames.concat(UTC_TIMEZONE_STRING);
7654
+ return _to_consumable_array$1(timeZonesNames).concat([
7655
+ UTC_TIMEZONE_STRING
7656
+ ]);
7074
7657
  }
7075
7658
  /**
7076
7659
  * Lazily-computed set of all known timezone strings for O(1) membership checks.
@@ -7096,6 +7679,8 @@ var DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = /^[0-9]{0,9}$/;
7096
7679
  /**
7097
7680
  * Returns the {@link TimezoneInfo} for the current system timezone, falling back to UTC.
7098
7681
  *
7682
+ * @returns timezone info for the current system timezone
7683
+ *
7099
7684
  * @example
7100
7685
  * ```ts
7101
7686
  * const info = timezoneInfoForSystem();
@@ -7111,6 +7696,10 @@ var DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = /^[0-9]{0,9}$/;
7111
7696
  * The date matters because abbreviations change with DST transitions.
7112
7697
  * Returns `"UKNOWN"` if no timezone is provided.
7113
7698
  *
7699
+ * @param timezone - the IANA timezone string (or UTC abbreviation) to get the abbreviation for
7700
+ * @param date - the date at which to evaluate the abbreviation (defaults to now)
7701
+ * @returns the short timezone abbreviation
7702
+ *
7114
7703
  * @example
7115
7704
  * ```ts
7116
7705
  * getTimezoneAbbreviation('America/New_York'); // 'EST' or 'EDT'
@@ -7124,6 +7713,10 @@ var DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = /^[0-9]{0,9}$/;
7124
7713
  *
7125
7714
  * Returns `"Unknown Timezone"` if no timezone is provided.
7126
7715
  *
7716
+ * @param timezone - the IANA timezone string to get the long name for
7717
+ * @param date - the date at which to evaluate the name (defaults to now)
7718
+ * @returns the full timezone display name
7719
+ *
7127
7720
  * @example
7128
7721
  * ```ts
7129
7722
  * getTimezoneLongName('America/New_York'); // 'Eastern Standard Time'
@@ -7135,6 +7728,10 @@ var DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = /^[0-9]{0,9}$/;
7135
7728
  /**
7136
7729
  * Builds a {@link TimezoneInfo} for the given timezone, computing abbreviation and search variants.
7137
7730
  *
7731
+ * @param timezone - the IANA timezone string to build info for
7732
+ * @param date - the date at which to evaluate the abbreviation (defaults to now)
7733
+ * @returns the computed TimezoneInfo
7734
+ *
7138
7735
  * @example
7139
7736
  * ```ts
7140
7737
  * const info = timezoneStringToTimezoneInfo('America/Chicago');
@@ -7144,14 +7741,13 @@ var DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = /^[0-9]{0,9}$/;
7144
7741
  */ function timezoneStringToTimezoneInfo(timezone) {
7145
7742
  var date = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : new Date();
7146
7743
  var abbreviation = getTimezoneAbbreviation(timezone, date);
7147
- var result = {
7744
+ return {
7148
7745
  timezone: timezone,
7149
7746
  search: timezoneStringToSearchableString(timezone),
7150
7747
  lowercase: timezone.toLowerCase(),
7151
7748
  abbreviation: abbreviation,
7152
7749
  lowercaseAbbreviation: abbreviation.toLowerCase()
7153
7750
  };
7154
- return result;
7155
7751
  }
7156
7752
  /**
7157
7753
  * Filters timezone infos by a search string, matching against the searchable name,
@@ -7159,6 +7755,10 @@ var DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = /^[0-9]{0,9}$/;
7159
7755
  *
7160
7756
  * For queries longer than 2 characters, substring matching on the searchable name is also used.
7161
7757
  *
7758
+ * @param search - the search query string
7759
+ * @param infos - the array of TimezoneInfo objects to filter
7760
+ * @returns the matching TimezoneInfo entries
7761
+ *
7162
7762
  * @example
7163
7763
  * ```ts
7164
7764
  * const results = searchTimezoneInfos('eastern', allTimezoneInfos());
@@ -7181,6 +7781,9 @@ var timezoneStringToSearchableStringReplace = replaceStringsFunction({
7181
7781
  *
7182
7782
  * Replaces `/` and `_` with spaces (e.g., `"America/New_York"` becomes `"america new york"`).
7183
7783
  *
7784
+ * @param timezone - the IANA timezone string to convert
7785
+ * @returns the searchable lowercase string
7786
+ *
7184
7787
  * @example
7185
7788
  * ```ts
7186
7789
  * timezoneStringToSearchableString('America/New_York'); // 'america new york'
@@ -7193,6 +7796,9 @@ var timezoneStringToSearchableStringReplace = replaceStringsFunction({
7193
7796
  *
7194
7797
  * Uses the cached set from {@link allKnownTimezoneStrings} for O(1) lookup.
7195
7798
  *
7799
+ * @param input - the string to check
7800
+ * @returns whether the input is a known timezone
7801
+ *
7196
7802
  * @example
7197
7803
  * ```ts
7198
7804
  * isKnownTimezone('America/New_York'); // true
@@ -7202,116 +7808,6 @@ var timezoneStringToSearchableStringReplace = replaceStringsFunction({
7202
7808
  return allKnownTimezoneStrings().has(input);
7203
7809
  }
7204
7810
 
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
7811
  function _array_like_to_array$2(arr, len) {
7316
7812
  if (len == null || len > arr.length) len = arr.length;
7317
7813
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
@@ -7351,7 +7847,7 @@ var _type, _type1;
7351
7847
  * const result = knownTimezoneType('America/Denver');
7352
7848
  * ```
7353
7849
  */ var knownTimezoneType = type('string > 0').narrow(function(val, ctx) {
7354
- return val != null && isKnownTimezone(val) || ctx.mustBe('a known timezone');
7850
+ return isKnownTimezone(val) || ctx.mustBe('a known timezone');
7355
7851
  });
7356
7852
  // MARK: DateDurationSpan
7357
7853
  /**
@@ -7465,21 +7961,21 @@ var _type, _type1;
7465
7961
  * Accepts both Date objects and date strings (parsed via `string.date.parse`), then validates the resulting timing
7466
7962
  * using {@link isValidDateCellTiming}.
7467
7963
  */ var validDateCellTimingType = dateCellTimingType.narrow(function(val, ctx) {
7468
- return val != null && isValidDateCellTiming(val) || ctx.mustBe('a valid DateCellTiming');
7964
+ return isValidDateCellTiming(val) || ctx.mustBe('a valid DateCellTiming');
7469
7965
  });
7470
7966
  /**
7471
7967
  * ArkType DTO schema that validates a value is a valid {@link DateCellRange} (non-negative indexes, `to >= i`).
7472
7968
  *
7473
7969
  * Validates cell range data from JSON/DTO input.
7474
7970
  */ var validDateCellRangeType = dateCellRangeType.narrow(function(val, ctx) {
7475
- return val != null && isValidDateCellRange(val) || ctx.mustBe('a valid DateCellRange');
7971
+ return isValidDateCellRange(val) || ctx.mustBe('a valid DateCellRange');
7476
7972
  });
7477
7973
  /**
7478
7974
  * ArkType DTO schema that validates a value is a sorted array of non-overlapping {@link DateCellRange} values.
7479
7975
  *
7480
7976
  * Validates cell range series data from JSON/DTO input.
7481
7977
  */ 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');
7978
+ return isValidDateCellRangeSeries(val) || ctx.mustBe('a valid DateCellRange series with items sorted in ascending order and no repeat indexes');
7483
7979
  });
7484
7980
 
7485
7981
  function _assert_this_initialized$1(self) {
@@ -7759,7 +8255,7 @@ function _object_spread_props$4(target, source) {
7759
8255
  logicalDate = 'now';
7760
8256
  }
7761
8257
  var intervalPeriod = period !== null && period !== void 0 ? period : MS_IN_SECOND;
7762
- var factory = inputFactory ? inputFactory : protectedFactory(logicalDateStringCodeDateFactory(logicalDate));
8258
+ var factory = inputFactory !== null && inputFactory !== void 0 ? inputFactory : protectedFactory(logicalDateStringCodeDateFactory(logicalDate));
7763
8259
  var obs = interval(intervalPeriod, scheduler).pipe(startWith(-1), map(factory));
7764
8260
  if (emitAll !== true) {
7765
8261
  obs = obs.pipe(distinctUntilChanged(isSameDate));
@@ -7851,7 +8347,8 @@ function _define_property$6(obj, key, value) {
7851
8347
  {
7852
8348
  key: "instant",
7853
8349
  get: function get() {
7854
- return this._config.instant || 'now';
8350
+ var _this__config_instant;
8351
+ return (_this__config_instant = this._config.instant) !== null && _this__config_instant !== void 0 ? _this__config_instant : 'now';
7855
8352
  }
7856
8353
  },
7857
8354
  {
@@ -7896,10 +8393,8 @@ function _define_property$6(obj, key, value) {
7896
8393
  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
8394
  var isPast = limits.isPast, max = limits.max;
7898
8395
  var limit = max;
7899
- if (typeof max !== 'string' && isPast) {
7900
- if (!max || isBefore$1(max, instant)) {
7901
- limit = DATE_NOW_VALUE;
7902
- }
8396
+ if (typeof max !== 'string' && isPast && (!max || isBefore$1(max, instant))) {
8397
+ limit = DATE_NOW_VALUE;
7903
8398
  }
7904
8399
  return limit;
7905
8400
  }
@@ -7914,6 +8409,8 @@ function _define_property$6(obj, key, value) {
7914
8409
  * const limiter = new LimitDateTimeInstance({ limits: { isFuture: true } });
7915
8410
  * const range = limiter.dateRange(); // { start: <now>, end: undefined }
7916
8411
  * ```
8412
+ *
8413
+ * @returns A partial {@link DateRange} with `start` and/or `end` derived from the limits.
7917
8414
  */ key: "dateRange",
7918
8415
  value: function dateRange() {
7919
8416
  var _this__config = this._config, _this__config_instant = _this__config.instant, instant = _this__config_instant === void 0 ? new Date() : _this__config_instant;
@@ -7926,6 +8423,7 @@ function _define_property$6(obj, key, value) {
7926
8423
  * like "now" or relative future offsets to resolve against the given moment.
7927
8424
  *
7928
8425
  * @param instant - The reference point in time for resolving dynamic limits.
8426
+ * @returns A partial {@link DateRange} resolved against the given instant.
7929
8427
  */ key: "dateRangeForInstant",
7930
8428
  value: function dateRangeForInstant(instant) {
7931
8429
  var _this = this, min = _this.min, max = _this.max;
@@ -7949,6 +8447,8 @@ function _define_property$6(obj, key, value) {
7949
8447
  * });
7950
8448
  * const safe = limiter.clamp(new Date()); // at least 30 minutes from now
7951
8449
  * ```
8450
+ *
8451
+ * @returns The clamped date within the allowed range.
7952
8452
  */ key: "clamp",
7953
8453
  value: function clamp(date) {
7954
8454
  var result = date;
@@ -7986,6 +8486,8 @@ function _define_property$6(obj, key, value) {
7986
8486
  * const clamped = limiter.clampDateRange({ start: pastDate, end: futureDate });
7987
8487
  * // clamped.start will be at least now
7988
8488
  * ```
8489
+ *
8490
+ * @returns The date range clamped to the allowed limits.
7989
8491
  */ key: "clampDateRange",
7990
8492
  value: function clampDateRange(dateRange) {
7991
8493
  return clampDateRangeToDateRange(dateRange, this.dateRange());
@@ -8007,6 +8509,8 @@ function _define_property$6(obj, key, value) {
8007
8509
  * });
8008
8510
  * const clamped = limiter.clamp(someDate);
8009
8511
  * ```
8512
+ *
8513
+ * @returns A new {@link LimitDateTimeInstance}.
8010
8514
  */ function limitDateTimeInstance(config) {
8011
8515
  return new LimitDateTimeInstance(config);
8012
8516
  }
@@ -8098,14 +8602,14 @@ function _object_spread_props$3(target, source) {
8098
8602
  function DateTimeMinuteInstance() {
8099
8603
  var config = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, dateOverride = arguments.length > 1 ? arguments[1] : void 0;
8100
8604
  _class_call_check$5(this, DateTimeMinuteInstance);
8101
- var _config_step;
8605
+ var _ref, _config_step;
8102
8606
  _define_property$5(this, "_config", void 0);
8103
8607
  _define_property$5(this, "_date", void 0);
8104
8608
  _define_property$5(this, "_step", void 0);
8105
8609
  _define_property$5(this, "_limit", void 0);
8106
8610
  _define_property$5(this, "_dateFilter", void 0);
8107
8611
  this._config = config;
8108
- this._date = (dateOverride == undefined ? config.date : dateOverride) || new Date();
8612
+ this._date = (_ref = dateOverride !== null && dateOverride !== void 0 ? dateOverride : config.date) !== null && _ref !== void 0 ? _ref : new Date();
8109
8613
  this._step = (_config_step = config.step) !== null && _config_step !== void 0 ? _config_step : 1;
8110
8614
  this._limit = new LimitDateTimeInstance(config);
8111
8615
  this._dateFilter = config.schedule ? dateCellScheduleDateFilter(config.schedule) : undefined;
@@ -8139,6 +8643,8 @@ function _object_spread_props$3(target, source) {
8139
8643
  key: "limitInstance",
8140
8644
  get: /**
8141
8645
  * Returns the LimitDateTimeInstance. This does not take the schedule into consideration.
8646
+ *
8647
+ * @returns The underlying {@link LimitDateTimeInstance}.
8142
8648
  */ function get() {
8143
8649
  return this._limit;
8144
8650
  }
@@ -8161,6 +8667,8 @@ function _object_spread_props$3(target, source) {
8161
8667
  * // true if June 15 is a weekday and overlaps the limit range
8162
8668
  * instance.dateDayContainsValidDateValue(new Date('2024-06-15'));
8163
8669
  * ```
8670
+ *
8671
+ * @returns `true` if the day contains at least one valid date/time value.
8164
8672
  */ key: "dateDayContainsValidDateValue",
8165
8673
  value: function dateDayContainsValidDateValue(date) {
8166
8674
  var isInSchedule = this.dateIsInSchedule(date);
@@ -8199,6 +8707,8 @@ function _object_spread_props$3(target, source) {
8199
8707
  *
8200
8708
  * instance.isInValidRange(new Date('2024-06-15T10:00:00')); // true if a weekday
8201
8709
  * ```
8710
+ *
8711
+ * @returns `true` if the date is within the min/max limits and on a scheduled day.
8202
8712
  */ key: "isInValidRange",
8203
8713
  value: function isInValidRange(date) {
8204
8714
  var result = this.getStatus(date);
@@ -8221,6 +8731,8 @@ function _object_spread_props$3(target, source) {
8221
8731
  *
8222
8732
  * instance.isValid(new Date('2099-03-15T10:00:00')); // true if all constraints pass
8223
8733
  * ```
8734
+ *
8735
+ * @returns `true` if the date passes all configured constraints.
8224
8736
  */ key: "isValid",
8225
8737
  value: function isValid(date) {
8226
8738
  var result = this.getStatus(date);
@@ -8244,6 +8756,8 @@ function _object_spread_props$3(target, source) {
8244
8756
  * // status.isAfterMinimum === false (before min)
8245
8757
  * // status.inFuture === false (if date is in the past)
8246
8758
  * ```
8759
+ *
8760
+ * @returns A {@link DateTimeMinuteDateStatus} snapshot for the given date.
8247
8761
  */ key: "getStatus",
8248
8762
  value: function getStatus() {
8249
8763
  var date = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.date;
@@ -8302,6 +8816,8 @@ function _object_spread_props$3(target, source) {
8302
8816
  *
8303
8817
  * instance.dateIsInSchedule(new Date('2024-06-15')); // true (Saturday = false)
8304
8818
  * ```
8819
+ *
8820
+ * @returns `true` if the date is on a scheduled day or no schedule is configured.
8305
8821
  */ key: "dateIsInSchedule",
8306
8822
  value: function dateIsInSchedule() {
8307
8823
  var date = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.date;
@@ -8326,6 +8842,8 @@ function _object_spread_props$3(target, source) {
8326
8842
  * instance.round({ roundToSteps: true }); // 2024-06-15T09:00:00
8327
8843
  * instance.round({ roundToSteps: true, roundToBound: true }); // clamped to min if below
8328
8844
  * ```
8845
+ *
8846
+ * @returns The rounded (and optionally clamped) date.
8329
8847
  */ key: "round",
8330
8848
  value: function round(round) {
8331
8849
  var _round_step;
@@ -8355,6 +8873,8 @@ function _object_spread_props$3(target, source) {
8355
8873
  *
8356
8874
  * instance.clamp(new Date('2024-05-25')); // clamped to min, then nearest weekday
8357
8875
  * ```
8876
+ *
8877
+ * @returns The date clamped to both the limits and the schedule.
8358
8878
  */ key: "clamp",
8359
8879
  value: function clamp() {
8360
8880
  var date = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.date, maxClampDistance = arguments.length > 1 ? arguments[1] : void 0;
@@ -8375,6 +8895,8 @@ function _object_spread_props$3(target, source) {
8375
8895
  *
8376
8896
  * instance.clampToLimit(new Date('2025-03-01')); // returns max (2024-12-31)
8377
8897
  * ```
8898
+ *
8899
+ * @returns The date clamped to the configured min/max limits.
8378
8900
  */ key: "clampToLimit",
8379
8901
  value: function clampToLimit() {
8380
8902
  var date = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.date;
@@ -8399,7 +8921,10 @@ function _object_spread_props$3(target, source) {
8399
8921
  * // If June 15, 2024 is a Saturday, returns the next Monday
8400
8922
  * instance.clampToSchedule(new Date('2024-06-15'));
8401
8923
  * ```
8402
- */ key: "clampToSchedule",
8924
+ *
8925
+ * @returns The nearest valid scheduled date, or the input date if already valid or no schedule is configured.
8926
+ */ // eslint-disable-next-line sonarjs/cognitive-complexity
8927
+ key: "clampToSchedule",
8403
8928
  value: function clampToSchedule() {
8404
8929
  var date = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.date, maxClampDistance = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 370;
8405
8930
  var nextAvailableDate;
@@ -8433,9 +8958,7 @@ function _object_spread_props$3(target, source) {
8433
8958
  }
8434
8959
  }
8435
8960
  // set a default from the given input if applicable
8436
- if (nextAvailableDate == null) {
8437
- nextAvailableDate = this.clampToLimit(date);
8438
- }
8961
+ nextAvailableDate !== null && nextAvailableDate !== void 0 ? nextAvailableDate : nextAvailableDate = this.clampToLimit(date);
8439
8962
  }
8440
8963
  }
8441
8964
  return nextAvailableDate !== null && nextAvailableDate !== void 0 ? nextAvailableDate : date;
@@ -8460,6 +8983,8 @@ function _object_spread_props$3(target, source) {
8460
8983
  * // Find the next weekday after a Saturday
8461
8984
  * instance.findNextAvailableDayInSchedule(new Date('2024-06-15'), 'future');
8462
8985
  * ```
8986
+ *
8987
+ * @returns The next valid schedule date, or `undefined` if none found within the max distance.
8463
8988
  */ key: "findNextAvailableDayInSchedule",
8464
8989
  value: function findNextAvailableDayInSchedule(date, direction) {
8465
8990
  var maxDistance = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 370;
@@ -8495,6 +9020,8 @@ function _object_spread_props$3(target, source) {
8495
9020
  * instance.isInSchedule(new Date('2024-06-17')); // true (Monday)
8496
9021
  * instance.isInSchedule(new Date('2024-06-16')); // false (Sunday)
8497
9022
  * ```
9023
+ *
9024
+ * @returns `true` if the date is on a scheduled day or no schedule is configured.
8498
9025
  */ key: "isInSchedule",
8499
9026
  value: function isInSchedule(date) {
8500
9027
  return this._dateFilter ? this._dateFilter(date) : true;
@@ -8554,6 +9081,8 @@ function _object_spread_props$3(target, source) {
8554
9081
  *
8555
9082
  * isValid(new Date('2024-06-17T10:00:00')); // true if future weekday after min
8556
9083
  * ```
9084
+ *
9085
+ * @returns A decision function that returns `true` for valid dates.
8557
9086
  */ function dateTimeMinuteDecisionFunction(config) {
8558
9087
  var instance = new DateTimeMinuteInstance(config, null);
8559
9088
  return function(date) {
@@ -8586,6 +9115,8 @@ function _object_spread_props$3(target, source) {
8586
9115
  * // true only if both 00:00 and 23:59 on June 15 pass all constraints
8587
9116
  * isFullDayValid(new Date('2024-06-15'));
8588
9117
  * ```
9118
+ *
9119
+ * @returns A decision function that returns `true` for valid days.
8589
9120
  */ function dateTimeMinuteWholeDayDecisionFunction(config) {
8590
9121
  var startAndEndOfDayMustBeValid = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
8591
9122
  var instance = new DateTimeMinuteInstance(config, null);
@@ -8670,6 +9201,7 @@ function _object_spread_props$2(target, source) {
8670
9201
  * guaranteeing that `raw` and `result` are defined.
8671
9202
  *
8672
9203
  * @param result - The parse result to check.
9204
+ * @returns `true` if the result is valid, narrowing the type to {@link ValidDateFromTimestringResult}.
8673
9205
  *
8674
9206
  * @example
8675
9207
  * ```ts
@@ -8713,6 +9245,7 @@ function _object_spread_props$2(target, source) {
8713
9245
  *
8714
9246
  * @param date - The date to check. Defaults to now.
8715
9247
  * @param timezone - Overrides the instance's configured timezone for this call.
9248
+ * @returns {@link TimeAM.AM} or {@link TimeAM.PM} depending on the time of day.
8716
9249
  *
8717
9250
  * @example
8718
9251
  * ```ts
@@ -8732,6 +9265,7 @@ function _object_spread_props$2(target, source) {
8732
9265
  *
8733
9266
  * @param date - The date to format.
8734
9267
  * @param timezone - Overrides the instance's configured timezone for this call.
9268
+ * @returns The formatted time string (e.g., "1:30PM").
8735
9269
  *
8736
9270
  * @example
8737
9271
  * ```ts
@@ -8826,18 +9360,35 @@ function _object_spread_props$2(target, source) {
8826
9360
  'h:mm',
8827
9361
  'HH:mm' // 01:20
8828
9362
  ];
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.
9363
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
9364
+ try {
9365
+ // tslint:disable-next-line: prefer-for-of
9366
+ for(var _iterator = formats[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
9367
+ var format = _step.value;
9368
+ systemParsedDateTime = parse(input, format, relativeDate);
9369
+ if (isValid(systemParsedDateTime)) {
9370
+ valid = true;
9371
+ break; // Use time.
9372
+ }
9373
+ }
9374
+ } catch (err) {
9375
+ _didIteratorError = true;
9376
+ _iteratorError = err;
9377
+ } finally{
9378
+ try {
9379
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
9380
+ _iterator.return();
9381
+ }
9382
+ } finally{
9383
+ if (_didIteratorError) {
9384
+ throw _iteratorError;
9385
+ }
8835
9386
  }
8836
9387
  }
8837
9388
  var removedPm = false;
8838
9389
  function removeAmPm(inputString) {
8839
9390
  inputString = inputString.toLowerCase();
8840
- removedPm = inputString.indexOf('pm') !== -1;
9391
+ removedPm = inputString.includes('pm');
8841
9392
  inputString = inputString.replace(/am|pm/g, '');
8842
9393
  return inputString;
8843
9394
  }
@@ -8869,6 +9420,7 @@ function _object_spread_props$2(target, source) {
8869
9420
  case 6:
8870
9421
  // 1212AM
8871
9422
  removeAmPm(input);
9423
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- removedPm is set via closure side effect in removeAmPm()
8872
9424
  if (removedPm) {
8873
9425
  removedPm = input[0] !== '2'; // If 2, ignore the PM part.
8874
9426
  }
@@ -8937,6 +9489,8 @@ function _object_spread_props$2(target, source) {
8937
9489
  /**
8938
9490
  * Creates a {@link DateTimeUtilityInstance} configured for UTC.
8939
9491
  *
9492
+ * @returns A new {@link DateTimeUtilityInstance} using the UTC timezone.
9493
+ *
8940
9494
  * @example
8941
9495
  * ```ts
8942
9496
  * const utcInstance = dateTimeInstanceUtc();
@@ -8950,6 +9504,7 @@ function _object_spread_props$2(target, source) {
8950
9504
  * Defaults to UTC when no timezone is provided.
8951
9505
  *
8952
9506
  * @param timezone - The IANA timezone identifier (e.g., 'America/New_York').
9507
+ * @returns A new {@link DateTimeUtilityInstance} for the specified timezone.
8953
9508
  *
8954
9509
  * @example
8955
9510
  * ```ts
@@ -8964,6 +9519,7 @@ function _object_spread_props$2(target, source) {
8964
9519
  *
8965
9520
  * @param date - The date to check. Defaults to now.
8966
9521
  * @param timezone - The IANA timezone to evaluate in. Defaults to UTC.
9522
+ * @returns {@link TimeAM.AM} or {@link TimeAM.PM} depending on the time of day.
8967
9523
  *
8968
9524
  * @example
8969
9525
  * ```ts
@@ -8981,6 +9537,7 @@ function _object_spread_props$2(target, source) {
8981
9537
  * unlike {@link toReadableTimeString} which defaults to UTC.
8982
9538
  *
8983
9539
  * @param date - The date to format.
9540
+ * @returns The formatted time string in the system's local timezone.
8984
9541
  *
8985
9542
  * @example
8986
9543
  * ```ts
@@ -8994,6 +9551,7 @@ function _object_spread_props$2(target, source) {
8994
9551
  *
8995
9552
  * @param date - The date to format.
8996
9553
  * @param timezone - The IANA timezone to format in. Defaults to UTC.
9554
+ * @returns The formatted time string (e.g., "10:30AM").
8997
9555
  *
8998
9556
  * @example
8999
9557
  * ```ts
@@ -9009,6 +9567,7 @@ function _object_spread_props$2(target, source) {
9009
9567
  *
9010
9568
  * @param input - A time string such as "1:30PM", "13:30", or "1PM".
9011
9569
  * @param config - Optional configuration specifying the timezone and reference date.
9570
+ * @returns The parsed time string result, or `undefined` if parsing failed.
9012
9571
  *
9013
9572
  * @example
9014
9573
  * ```ts
@@ -9027,6 +9586,7 @@ function _object_spread_props$2(target, source) {
9027
9586
  *
9028
9587
  * @param input - A time string such as "1:30PM" or "13:30".
9029
9588
  * @param config - Optional configuration specifying the timezone and reference date.
9589
+ * @returns The resolved date, or `undefined` if the input could not be parsed.
9030
9590
  *
9031
9591
  * @example
9032
9592
  * ```ts
@@ -9040,6 +9600,7 @@ function _object_spread_props$2(target, source) {
9040
9600
  * Creates a {@link LimitDateTimeInstance} for clamping and constraining dates to a configured range.
9041
9601
  *
9042
9602
  * @param config - The limit configuration specifying min/max bounds, future requirements, etc.
9603
+ * @returns A new {@link LimitDateTimeInstance} configured with the given bounds.
9043
9604
  *
9044
9605
  * @example
9045
9606
  * ```ts
@@ -9149,6 +9710,7 @@ function _object_spread_props$1(target, source) {
9149
9710
  date: toZonedTime(find.range.date, find.timezone)
9150
9711
  }) : find.range;
9151
9712
  var dates = dateRange(range);
9713
+ // eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check
9152
9714
  switch(range.type){
9153
9715
  case DateRangeType.DAY:
9154
9716
  case DateRangeType.WEEK:
@@ -9344,13 +9906,12 @@ function _object_spread$1(target) {
9344
9906
  // A single field that manages start/end will start and end at the same instant (end = start)
9345
9907
  // so we merge the gte/lte values.
9346
9908
  var merged = mergeMongoDBLikeRangeFilters(startsAt, endsAt);
9347
- startsAtFilter = merged ? _define_property$2({}, fields.start, merged) : undefined;
9909
+ startsAtFilter = _define_property$2({}, fields.start, merged);
9348
9910
  } else {
9349
9911
  startsAtFilter = startsAt ? _define_property$2({}, fields.start, startsAt) : undefined;
9350
9912
  endsAtFilter = endsAt && fields.end ? _define_property$2({}, fields.end, endsAt) : undefined;
9351
9913
  }
9352
- var filter = _object_spread$1({}, startsAtFilter, endsAtFilter);
9353
- return filter;
9914
+ return _object_spread$1({}, startsAtFilter, endsAtFilter);
9354
9915
  }
9355
9916
  };
9356
9917
  }
@@ -9473,6 +10034,8 @@ function _is_native_reflect_construct() {
9473
10034
  * const rule = new DateRRule({ freq: RRule.DAILY, count: 5, dtstart: startDate });
9474
10035
  * const lastDate = rule.last(); // fifth occurrence
9475
10036
  * ```
10037
+ *
10038
+ * @returns The last occurrence date, or `undefined` if there are none.
9476
10039
  */ key: "last",
9477
10040
  value: function last() {
9478
10041
  return this._iter(new LastIterResult());
@@ -9487,6 +10050,9 @@ function _is_native_reflect_construct() {
9487
10050
  * const rule = new DateRRule({ freq: RRule.WEEKLY, dtstart: startDate });
9488
10051
  * const nextDate = rule.next(new Date());
9489
10052
  * ```
10053
+ *
10054
+ * @param minDate - The earliest date to consider.
10055
+ * @returns The first occurrence on or after `minDate`, or `undefined` if none.
9490
10056
  */ key: "next",
9491
10057
  value: function next(minDate) {
9492
10058
  return this._iter(new NextIterResult(minDate));
@@ -9501,6 +10067,11 @@ function _is_native_reflect_construct() {
9501
10067
  * const rule = new DateRRule({ freq: RRule.DAILY, dtstart: startDate });
9502
10068
  * const exists = rule.any({ minDate: rangeStart, maxDate: rangeEnd });
9503
10069
  * ```
10070
+ *
10071
+ * @param filter - Optional date bounds with `minDate` and `maxDate`.
10072
+ * @param filter.minDate - Optional minimum date bound.
10073
+ * @param filter.maxDate - Optional maximum date bound.
10074
+ * @returns `true` if at least one recurrence falls within the bounds.
9504
10075
  */ key: "any",
9505
10076
  value: function any() {
9506
10077
  var filter = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
@@ -9761,7 +10332,10 @@ function _unsupported_iterable_to_array$1(o, minLen) {
9761
10332
  /**
9762
10333
  * Delimiter separating the property name/params from values in an RRule line.
9763
10334
  */ var RRULE_STRING_SPLITTER = ':';
9764
- /** @deprecated use RRULE_STRING_SPLITTER instead. */ var RRuleStringSplitter = RRULE_STRING_SPLITTER;
10335
+ /**
10336
+ * @deprecated use RRULE_STRING_SPLITTER instead.
10337
+ */ // eslint-disable-next-line @typescript-eslint/naming-convention
10338
+ var RRuleStringSplitter = RRULE_STRING_SPLITTER;
9765
10339
  /**
9766
10340
  * Utility class for parsing and manipulating RFC 5545 RRule strings.
9767
10341
  *
@@ -9792,6 +10366,9 @@ function _unsupported_iterable_to_array$1(o, minLen) {
9792
10366
  * // result.basic = ['RRULE:FREQ=DAILY']
9793
10367
  * // result.exdates contains the parsed exclusion dates
9794
10368
  * ```
10369
+ *
10370
+ * @param input - The RRule string line set to separate.
10371
+ * @returns The separated basic rules and parsed EXDATE exclusion dates.
9795
10372
  */ function separateRRuleStringSetValues(input) {
9796
10373
  var basic = [];
9797
10374
  var exdateRules = [];
@@ -9821,6 +10398,8 @@ function _unsupported_iterable_to_array$1(o, minLen) {
9821
10398
  /**
9822
10399
  * Parses an EXDATE line into its timezone and date components.
9823
10400
  *
10401
+ * @param line - The raw EXDATE line string to parse.
10402
+ * @returns The parsed EXDATE attribute with timezone and dates.
9824
10403
  * @throws Error if the line is not an EXDATE property.
9825
10404
  */ function parseExdateAttributeFromLine(line) {
9826
10405
  var property = this.parseProperty(line);
@@ -9832,6 +10411,9 @@ function _unsupported_iterable_to_array$1(o, minLen) {
9832
10411
  key: "parseExdateAttributeFromProperty",
9833
10412
  value: /**
9834
10413
  * Extracts timezone and UTC-normalized dates from an already-parsed EXDATE property.
10414
+ *
10415
+ * @param property - The parsed EXDATE property to extract from.
10416
+ * @returns The EXDATE attribute containing timezone and UTC-normalized dates.
9835
10417
  */ function parseExdateAttributeFromProperty(property) {
9836
10418
  var _property_params_find;
9837
10419
  var timezone = (_property_params_find = property.params.find(function(x) {
@@ -9855,6 +10437,9 @@ function _unsupported_iterable_to_array$1(o, minLen) {
9855
10437
  value: /**
9856
10438
  * Convenience wrapper that creates a timezone converter and delegates to {@link parseDateTimeString}.
9857
10439
  *
10440
+ * @param rfcDateString - The RFC 5545 date or date-time string to parse.
10441
+ * @param timezone - Optional timezone for non-UTC date strings.
10442
+ * @returns The parsed JavaScript Date.
9858
10443
  * @throws Error if the date string is not UTC and no timezone is provided.
9859
10444
  */ function parseDateTimeStringWithTimezone(rfcDateString, timezone) {
9860
10445
  return DateRRuleParseUtility.parseDateTimeString(rfcDateString, timezone ? new DateTimezoneUtcNormalInstance({
@@ -9870,6 +10455,9 @@ function _unsupported_iterable_to_array$1(o, minLen) {
9870
10455
  * If the string does not end in `Z` (indicating UTC), the converter is used to normalize
9871
10456
  * the local date representation to its true UTC equivalent.
9872
10457
  *
10458
+ * @param rfcDateString - The RFC 5545 date or date-time string to parse.
10459
+ * @param converter - Optional timezone converter for non-UTC date strings.
10460
+ * @returns The parsed JavaScript Date.
9873
10461
  * @throws Error if the string cannot be parsed or a non-UTC string lacks a converter.
9874
10462
  */ function parseDateTimeString(rfcDateString, converter) {
9875
10463
  var RFC5545_DATE_TIME_FORMAT = /^((\d{4})(\d{2})(\d{2}))(T(\d{2})(\d{2})(\d{2})Z?)?$/;
@@ -9913,6 +10501,9 @@ function _unsupported_iterable_to_array$1(o, minLen) {
9913
10501
  * DateRRuleParseUtility.formatDateTimeString(new Date('2021-06-11T11:00:00Z'));
9914
10502
  * // => '20210611T110000Z'
9915
10503
  * ```
10504
+ *
10505
+ * @param date - The date to format.
10506
+ * @returns The RFC 5545 UTC date-time string representation.
9916
10507
  */ function formatDateTimeString(date) {
9917
10508
  return format(date, "yyyyMMdd'T'HHmmss'Z'");
9918
10509
  }
@@ -9921,6 +10512,9 @@ function _unsupported_iterable_to_array$1(o, minLen) {
9921
10512
  key: "parseProperty",
9922
10513
  value: /**
9923
10514
  * Parses a full RRule line string into a structured {@link RRuleProperty}.
10515
+ *
10516
+ * @param line - The raw RRule line string to parse.
10517
+ * @returns The structured property with type, params, and values.
9924
10518
  */ function parseProperty(line) {
9925
10519
  var rawLine = DateRRuleParseUtility.parseRawLine(line);
9926
10520
  return DateRRuleParseUtility.propertyFromRawLine(rawLine);
@@ -9930,6 +10524,9 @@ function _unsupported_iterable_to_array$1(o, minLen) {
9930
10524
  key: "propertyFromRawLine",
9931
10525
  value: /**
9932
10526
  * Converts an {@link RRuleRawLine} into a structured {@link RRuleProperty} by splitting the type and params.
10527
+ *
10528
+ * @param rawLine - The raw line to convert.
10529
+ * @returns The structured property with separated type, params, and values.
9933
10530
  */ function propertyFromRawLine(rawLine) {
9934
10531
  var typeAndParams = rawLine.params.split(';');
9935
10532
  var type = typeAndParams[0].toUpperCase();
@@ -9945,6 +10542,9 @@ function _unsupported_iterable_to_array$1(o, minLen) {
9945
10542
  key: "parseRawParam",
9946
10543
  value: /**
9947
10544
  * Splits a raw param string (e.g., `"TZID=America/New_York"`) into key-value form.
10545
+ *
10546
+ * @param param - The raw param string to split.
10547
+ * @returns The parsed key-value param.
9948
10548
  */ function parseRawParam(param) {
9949
10549
  var _splitJoinRemainder = _sliced_to_array$1(splitJoinRemainder(param, '=', 2), 2), key = _splitJoinRemainder[0], value = _splitJoinRemainder[1];
9950
10550
  return {
@@ -9958,6 +10558,9 @@ function _unsupported_iterable_to_array$1(o, minLen) {
9958
10558
  value: /**
9959
10559
  * Splits a raw line at the colon delimiter into params and values portions.
9960
10560
  * Falls back to treating a single-segment line as an RRULE value.
10561
+ *
10562
+ * @param line - The raw RRule line string to split.
10563
+ * @returns The raw line with separated params and values.
9961
10564
  */ function parseRawLine(line) {
9962
10565
  var _splitJoinRemainder = _sliced_to_array$1(splitJoinRemainder(line, RRULE_STRING_SPLITTER, 2), 2), params = _splitJoinRemainder[0], values = _splitJoinRemainder[1];
9963
10566
  var result;
@@ -9980,6 +10583,9 @@ function _unsupported_iterable_to_array$1(o, minLen) {
9980
10583
  value: // MARK: String
9981
10584
  /**
9982
10585
  * Splits a newline-delimited RRule string into individual line strings.
10586
+ *
10587
+ * @param lines - The newline-delimited RRule string to split.
10588
+ * @returns An array of individual RRule line strings.
9983
10589
  */ function toRRuleStringSet(lines) {
9984
10590
  return lines.split('\n');
9985
10591
  }
@@ -9988,6 +10594,9 @@ function _unsupported_iterable_to_array$1(o, minLen) {
9988
10594
  key: "toRRuleLines",
9989
10595
  value: /**
9990
10596
  * Joins an array of RRule line strings into a single newline-delimited string.
10597
+ *
10598
+ * @param rruleStringSet - The array of RRule line strings to join.
10599
+ * @returns A single newline-delimited RRule string.
9991
10600
  */ function toRRuleLines(rruleStringSet) {
9992
10601
  return rruleStringSet.join('\n');
9993
10602
  }
@@ -9998,6 +10607,8 @@ function _unsupported_iterable_to_array$1(o, minLen) {
9998
10607
  /**
9999
10608
  * Asserts that the property has the expected type, throwing if it does not match.
10000
10609
  *
10610
+ * @param type - The expected property type.
10611
+ * @param property - The property to check.
10001
10612
  * @throws Error if the property type does not match the expected type.
10002
10613
  */ function assertPropertyType(type, property) {
10003
10614
  if (property.type !== type) {
@@ -10138,7 +10749,7 @@ function _unsupported_iterable_to_array(o, minLen) {
10138
10749
  this.options = options;
10139
10750
  var tzid = rrule.origOptions.tzid;
10140
10751
  var dtstart = rrule.origOptions.dtstart;
10141
- var timezone = tzid || options.timezone;
10752
+ var timezone = tzid !== null && tzid !== void 0 ? tzid : options.timezone;
10142
10753
  /**
10143
10754
  * The normal instance for DateRRuleInstance is used backwards in most cases because DateRRule always
10144
10755
  * parses dates as UTC, so we handle all input dates as base dates, an
@@ -10189,8 +10800,7 @@ function _unsupported_iterable_to_array(o, minLen) {
10189
10800
  var from = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : new Date();
10190
10801
  var baseFrom = this.normalInstance.baseDateToTargetDate(from);
10191
10802
  var rawNext = this.rrule.next(baseFrom);
10192
- var next = rawNext ? this.normalInstance.targetDateToBaseDate(rawNext) : undefined;
10193
- return next;
10803
+ return rawNext ? this.normalInstance.targetDateToBaseDate(rawNext) : undefined;
10194
10804
  }
10195
10805
  },
10196
10806
  {
@@ -10331,11 +10941,12 @@ function _unsupported_iterable_to_array(o, minLen) {
10331
10941
  /**
10332
10942
  * Returns `true` when the underlying RRule has neither a `count` nor an
10333
10943
  * `until` constraint, meaning it recurs indefinitely.
10944
+ *
10945
+ * @returns `true` if the rule recurs indefinitely.
10334
10946
  */ key: "hasForeverRange",
10335
10947
  value: function hasForeverRange() {
10336
10948
  var options = this.rrule.options;
10337
- var forever = !options.count && !options.until;
10338
- return forever;
10949
+ return !options.count && !options.until;
10339
10950
  }
10340
10951
  }
10341
10952
  ], [