@economic/taco 2.60.1-date-fns.0 → 2.61.0-combobox-search.0

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/dist/taco.js CHANGED
@@ -1,3 +1,6 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
1
4
  import * as React from "react";
2
5
  import React__default, { createContext, useMemo, createElement, useContext, useCallback, useLayoutEffect, useRef, useEffect, useState, forwardRef, Children, isValidElement, cloneElement, Fragment, useReducer, memo as memo$2, PureComponent, useImperativeHandle, Component } from "react";
3
6
  import * as ReactDOM from "react-dom";
@@ -4543,7 +4546,7 @@ var zeroGap = {
4543
4546
  right: 0,
4544
4547
  gap: 0
4545
4548
  };
4546
- var parse$2 = function(x2) {
4549
+ var parse$3 = function(x2) {
4547
4550
  return parseInt(x2 || "", 10) || 0;
4548
4551
  };
4549
4552
  var getOffset$1 = function(gapMode) {
@@ -4551,7 +4554,7 @@ var getOffset$1 = function(gapMode) {
4551
4554
  var left = cs[gapMode === "padding" ? "paddingLeft" : "marginLeft"];
4552
4555
  var top = cs[gapMode === "padding" ? "paddingTop" : "marginTop"];
4553
4556
  var right = cs[gapMode === "padding" ? "paddingRight" : "marginRight"];
4554
- return [parse$2(left), parse$2(top), parse$2(right)];
4557
+ return [parse$3(left), parse$3(top), parse$3(right)];
4555
4558
  };
4556
4559
  var getGapWidth = function(gapMode) {
4557
4560
  if (gapMode === void 0) {
@@ -9752,7 +9755,7 @@ const useMergedRef = (ref) => {
9752
9755
  return internalRef;
9753
9756
  };
9754
9757
  const FOCUSABLE_ELEMENTS = [
9755
- "[tabindex]:not([disabled])",
9758
+ '[tabindex]:not([tabindex="-1"]):not([disabled])',
9756
9759
  "input:not([disabled])",
9757
9760
  "select:not([disabled])",
9758
9761
  "textarea:not([disabled])",
@@ -9765,7 +9768,7 @@ const FOCUSABLE_ELEMENTS = [
9765
9768
  "embed",
9766
9769
  "audio[controls]",
9767
9770
  "video[controls]",
9768
- "[contenteditable]",
9771
+ '[contenteditable]:not([contenteditable="false"]):not([disabled])',
9769
9772
  "details:not([disabled])",
9770
9773
  "summary:not(:disabled)"
9771
9774
  ];
@@ -9790,14 +9793,14 @@ const getIndexOfFirstChildOverflowingParent = (element, overscan = 0) => {
9790
9793
  }
9791
9794
  return boundaryChildIndex;
9792
9795
  };
9793
- const getNextFocussableElement = (currentElement) => {
9796
+ const getNextFocussableElement = (currentElement, direction = 1) => {
9794
9797
  if (!currentElement) {
9795
9798
  return null;
9796
9799
  }
9797
9800
  let focussableElements = [...document.querySelectorAll(FOCUSABLE_ELEMENTS.join(","))];
9798
9801
  const currentElementIndex = focussableElements.indexOf(currentElement);
9799
9802
  if (currentElementIndex > -1) {
9800
- focussableElements = focussableElements.slice(currentElementIndex + 1).filter((element) => element.getAttribute("tabindex") !== "-1");
9803
+ focussableElements = focussableElements.slice(currentElementIndex + direction).filter((element) => element.getAttribute("tabindex") !== "-1");
9801
9804
  if (focussableElements.length) {
9802
9805
  focussableElements = focussableElements.filter((element) => {
9803
9806
  var _a;
@@ -9846,6 +9849,9 @@ function isSiblingElementInsideSameParentOverlay(element, sibling) {
9846
9849
  var _a;
9847
9850
  return !!((_a = element == null ? void 0 : element.closest("[role=dialog],[role=menu]")) == null ? void 0 : _a.contains(sibling));
9848
9851
  }
9852
+ function isElementInsideExternalRelatedOverlay(element, tableRef) {
9853
+ return isElementInsideOverlay(element) && !isSiblingElementInsideSameParentOverlay(element, tableRef.current) || isElementInteractive(element) && !isElementInsideOrTriggeredFromContainer(element, tableRef.current);
9854
+ }
9849
9855
  function isElementInteractive(element) {
9850
9856
  if (!element) {
9851
9857
  return false;
@@ -11868,13 +11874,16 @@ function addMonths(date2, amount) {
11868
11874
  }
11869
11875
  const millisecondsInWeek = 6048e5;
11870
11876
  const millisecondsInDay = 864e5;
11877
+ const millisecondsInMinute = 6e4;
11878
+ const millisecondsInHour = 36e5;
11879
+ const millisecondsInSecond = 1e3;
11871
11880
  let defaultOptions$3 = {};
11872
- function getDefaultOptions() {
11881
+ function getDefaultOptions$1() {
11873
11882
  return defaultOptions$3;
11874
11883
  }
11875
11884
  function startOfWeek(date2, options) {
11876
11885
  var _a, _b, _c, _d;
11877
- const defaultOptions2 = getDefaultOptions();
11886
+ const defaultOptions2 = getDefaultOptions$1();
11878
11887
  const weekStartsOn = (options == null ? void 0 : options.weekStartsOn) ?? ((_b = (_a = options == null ? void 0 : options.locale) == null ? void 0 : _a.options) == null ? void 0 : _b.weekStartsOn) ?? defaultOptions2.weekStartsOn ?? ((_d = (_c = defaultOptions2.locale) == null ? void 0 : _c.options) == null ? void 0 : _d.weekStartsOn) ?? 0;
11879
11888
  const _date = toDate(date2);
11880
11889
  const day = _date.getDay();
@@ -12018,7 +12027,7 @@ function startOfYear(date2) {
12018
12027
  }
12019
12028
  function endOfWeek(date2, options) {
12020
12029
  var _a, _b, _c, _d;
12021
- const defaultOptions2 = getDefaultOptions();
12030
+ const defaultOptions2 = getDefaultOptions$1();
12022
12031
  const weekStartsOn = (options == null ? void 0 : options.weekStartsOn) ?? ((_b = (_a = options == null ? void 0 : options.locale) == null ? void 0 : _a.options) == null ? void 0 : _b.weekStartsOn) ?? defaultOptions2.weekStartsOn ?? ((_d = (_c = defaultOptions2.locale) == null ? void 0 : _c.options) == null ? void 0 : _d.weekStartsOn) ?? 0;
12023
12032
  const _date = toDate(date2);
12024
12033
  const day = _date.getDay();
@@ -12534,7 +12543,7 @@ function getWeekYear(date2, options) {
12534
12543
  var _a, _b, _c, _d;
12535
12544
  const _date = toDate(date2);
12536
12545
  const year = _date.getFullYear();
12537
- const defaultOptions2 = getDefaultOptions();
12546
+ const defaultOptions2 = getDefaultOptions$1();
12538
12547
  const firstWeekContainsDate = (options == null ? void 0 : options.firstWeekContainsDate) ?? ((_b = (_a = options == null ? void 0 : options.locale) == null ? void 0 : _a.options) == null ? void 0 : _b.firstWeekContainsDate) ?? defaultOptions2.firstWeekContainsDate ?? ((_d = (_c = defaultOptions2.locale) == null ? void 0 : _c.options) == null ? void 0 : _d.firstWeekContainsDate) ?? 1;
12539
12548
  const firstWeekOfNextYear = constructFrom(date2, 0);
12540
12549
  firstWeekOfNextYear.setFullYear(year + 1, 0, firstWeekContainsDate);
@@ -12554,7 +12563,7 @@ function getWeekYear(date2, options) {
12554
12563
  }
12555
12564
  function startOfWeekYear(date2, options) {
12556
12565
  var _a, _b, _c, _d;
12557
- const defaultOptions2 = getDefaultOptions();
12566
+ const defaultOptions2 = getDefaultOptions$1();
12558
12567
  const firstWeekContainsDate = (options == null ? void 0 : options.firstWeekContainsDate) ?? ((_b = (_a = options == null ? void 0 : options.locale) == null ? void 0 : _a.options) == null ? void 0 : _b.firstWeekContainsDate) ?? defaultOptions2.firstWeekContainsDate ?? ((_d = (_c = defaultOptions2.locale) == null ? void 0 : _c.options) == null ? void 0 : _d.firstWeekContainsDate) ?? 1;
12559
12568
  const year = getWeekYear(date2, options);
12560
12569
  const firstWeek = constructFrom(date2, 0);
@@ -13347,14 +13356,14 @@ function message(token, format2, input) {
13347
13356
  const subject = token[0] === "Y" ? "years" : "days of the month";
13348
13357
  return `Use \`${token.toLowerCase()}\` instead of \`${token}\` (in \`${format2}\`) for formatting ${subject} to the input \`${input}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`;
13349
13358
  }
13350
- const formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
13351
- const longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
13352
- const escapedStringRegExp = /^'([^]*?)'?$/;
13353
- const doubleQuoteRegExp = /''/g;
13354
- const unescapedLatinCharacterRegExp = /[a-zA-Z]/;
13359
+ const formattingTokensRegExp$1 = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
13360
+ const longFormattingTokensRegExp$1 = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
13361
+ const escapedStringRegExp$1 = /^'([^]*?)'?$/;
13362
+ const doubleQuoteRegExp$1 = /''/g;
13363
+ const unescapedLatinCharacterRegExp$1 = /[a-zA-Z]/;
13355
13364
  function format$2(date2, formatStr, options) {
13356
13365
  var _a, _b, _c, _d, _e, _f, _g, _h;
13357
- const defaultOptions2 = getDefaultOptions();
13366
+ const defaultOptions2 = getDefaultOptions$1();
13358
13367
  const locale2 = (options == null ? void 0 : options.locale) ?? defaultOptions2.locale ?? enUS;
13359
13368
  const firstWeekContainsDate = (options == null ? void 0 : options.firstWeekContainsDate) ?? ((_b = (_a = options == null ? void 0 : options.locale) == null ? void 0 : _a.options) == null ? void 0 : _b.firstWeekContainsDate) ?? defaultOptions2.firstWeekContainsDate ?? ((_d = (_c = defaultOptions2.locale) == null ? void 0 : _c.options) == null ? void 0 : _d.firstWeekContainsDate) ?? 1;
13360
13369
  const weekStartsOn = (options == null ? void 0 : options.weekStartsOn) ?? ((_f = (_e = options == null ? void 0 : options.locale) == null ? void 0 : _e.options) == null ? void 0 : _f.weekStartsOn) ?? defaultOptions2.weekStartsOn ?? ((_h = (_g = defaultOptions2.locale) == null ? void 0 : _g.options) == null ? void 0 : _h.weekStartsOn) ?? 0;
@@ -13362,25 +13371,25 @@ function format$2(date2, formatStr, options) {
13362
13371
  if (!isValid(originalDate)) {
13363
13372
  throw new RangeError("Invalid time value");
13364
13373
  }
13365
- let parts = formatStr.match(longFormattingTokensRegExp).map((substring) => {
13374
+ let parts = formatStr.match(longFormattingTokensRegExp$1).map((substring) => {
13366
13375
  const firstCharacter = substring[0];
13367
13376
  if (firstCharacter === "p" || firstCharacter === "P") {
13368
13377
  const longFormatter = longFormatters[firstCharacter];
13369
13378
  return longFormatter(substring, locale2.formatLong);
13370
13379
  }
13371
13380
  return substring;
13372
- }).join("").match(formattingTokensRegExp).map((substring) => {
13381
+ }).join("").match(formattingTokensRegExp$1).map((substring) => {
13373
13382
  if (substring === "''") {
13374
13383
  return { isToken: false, value: "'" };
13375
13384
  }
13376
13385
  const firstCharacter = substring[0];
13377
13386
  if (firstCharacter === "'") {
13378
- return { isToken: false, value: cleanEscapedString(substring) };
13387
+ return { isToken: false, value: cleanEscapedString$1(substring) };
13379
13388
  }
13380
13389
  if (formatters$1[firstCharacter]) {
13381
13390
  return { isToken: true, value: substring };
13382
13391
  }
13383
- if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
13392
+ if (firstCharacter.match(unescapedLatinCharacterRegExp$1)) {
13384
13393
  throw new RangeError(
13385
13394
  "Format string contains an unescaped latin alphabet character `" + firstCharacter + "`"
13386
13395
  );
@@ -13405,12 +13414,12 @@ function format$2(date2, formatStr, options) {
13405
13414
  return formatter(originalDate, token, locale2.localize, formatterOptions);
13406
13415
  }).join("");
13407
13416
  }
13408
- function cleanEscapedString(input) {
13409
- const matched = input.match(escapedStringRegExp);
13417
+ function cleanEscapedString$1(input) {
13418
+ const matched = input.match(escapedStringRegExp$1);
13410
13419
  if (!matched) {
13411
13420
  return input;
13412
13421
  }
13413
- return matched[1].replace(doubleQuoteRegExp, "'");
13422
+ return matched[1].replace(doubleQuoteRegExp$1, "'");
13414
13423
  }
13415
13424
  function getDaysInMonth(date2) {
13416
13425
  const _date = toDate(date2);
@@ -13421,6 +13430,17 @@ function getDaysInMonth(date2) {
13421
13430
  lastDayOfMonth2.setHours(0, 0, 0, 0);
13422
13431
  return lastDayOfMonth2.getDate();
13423
13432
  }
13433
+ function getDefaultOptions() {
13434
+ return Object.assign({}, getDefaultOptions$1());
13435
+ }
13436
+ function getISODay(date2) {
13437
+ const _date = toDate(date2);
13438
+ let day = _date.getDay();
13439
+ if (day === 0) {
13440
+ day = 7;
13441
+ }
13442
+ return day;
13443
+ }
13424
13444
  function getUnixTime(date2) {
13425
13445
  return Math.trunc(+toDate(date2) / 1e3);
13426
13446
  }
@@ -13448,10 +13468,1754 @@ function isBefore(date2, dateToCompare) {
13448
13468
  const _dateToCompare = toDate(dateToCompare);
13449
13469
  return +_date < +_dateToCompare;
13450
13470
  }
13451
- function isEqual$2(leftDate, rightDate) {
13452
- const _dateLeft = toDate(leftDate);
13453
- const _dateRight = toDate(rightDate);
13454
- return +_dateLeft === +_dateRight;
13471
+ function transpose(fromDate, constructor) {
13472
+ const date2 = constructor instanceof Date ? constructFrom(constructor, 0) : new constructor(0);
13473
+ date2.setFullYear(
13474
+ fromDate.getFullYear(),
13475
+ fromDate.getMonth(),
13476
+ fromDate.getDate()
13477
+ );
13478
+ date2.setHours(
13479
+ fromDate.getHours(),
13480
+ fromDate.getMinutes(),
13481
+ fromDate.getSeconds(),
13482
+ fromDate.getMilliseconds()
13483
+ );
13484
+ return date2;
13485
+ }
13486
+ const TIMEZONE_UNIT_PRIORITY = 10;
13487
+ class Setter {
13488
+ constructor() {
13489
+ __publicField(this, "subPriority", 0);
13490
+ }
13491
+ validate(_utcDate, _options) {
13492
+ return true;
13493
+ }
13494
+ }
13495
+ class ValueSetter extends Setter {
13496
+ constructor(value, validateValue, setValue, priority, subPriority) {
13497
+ super();
13498
+ this.value = value;
13499
+ this.validateValue = validateValue;
13500
+ this.setValue = setValue;
13501
+ this.priority = priority;
13502
+ if (subPriority) {
13503
+ this.subPriority = subPriority;
13504
+ }
13505
+ }
13506
+ validate(date2, options) {
13507
+ return this.validateValue(date2, this.value, options);
13508
+ }
13509
+ set(date2, flags, options) {
13510
+ return this.setValue(date2, flags, this.value, options);
13511
+ }
13512
+ }
13513
+ class DateToSystemTimezoneSetter extends Setter {
13514
+ constructor() {
13515
+ super(...arguments);
13516
+ __publicField(this, "priority", TIMEZONE_UNIT_PRIORITY);
13517
+ __publicField(this, "subPriority", -1);
13518
+ }
13519
+ set(date2, flags) {
13520
+ if (flags.timestampIsSet) return date2;
13521
+ return constructFrom(date2, transpose(date2, Date));
13522
+ }
13523
+ }
13524
+ class Parser {
13525
+ run(dateString, token, match2, options) {
13526
+ const result = this.parse(dateString, token, match2, options);
13527
+ if (!result) {
13528
+ return null;
13529
+ }
13530
+ return {
13531
+ setter: new ValueSetter(
13532
+ result.value,
13533
+ this.validate,
13534
+ this.set,
13535
+ this.priority,
13536
+ this.subPriority
13537
+ ),
13538
+ rest: result.rest
13539
+ };
13540
+ }
13541
+ validate(_utcDate, _value, _options) {
13542
+ return true;
13543
+ }
13544
+ }
13545
+ class EraParser extends Parser {
13546
+ constructor() {
13547
+ super(...arguments);
13548
+ __publicField(this, "priority", 140);
13549
+ __publicField(this, "incompatibleTokens", ["R", "u", "t", "T"]);
13550
+ }
13551
+ parse(dateString, token, match2) {
13552
+ switch (token) {
13553
+ // AD, BC
13554
+ case "G":
13555
+ case "GG":
13556
+ case "GGG":
13557
+ return match2.era(dateString, { width: "abbreviated" }) || match2.era(dateString, { width: "narrow" });
13558
+ // A, B
13559
+ case "GGGGG":
13560
+ return match2.era(dateString, { width: "narrow" });
13561
+ // Anno Domini, Before Christ
13562
+ case "GGGG":
13563
+ default:
13564
+ return match2.era(dateString, { width: "wide" }) || match2.era(dateString, { width: "abbreviated" }) || match2.era(dateString, { width: "narrow" });
13565
+ }
13566
+ }
13567
+ set(date2, flags, value) {
13568
+ flags.era = value;
13569
+ date2.setFullYear(value, 0, 1);
13570
+ date2.setHours(0, 0, 0, 0);
13571
+ return date2;
13572
+ }
13573
+ }
13574
+ const numericPatterns = {
13575
+ month: /^(1[0-2]|0?\d)/,
13576
+ // 0 to 12
13577
+ date: /^(3[0-1]|[0-2]?\d)/,
13578
+ // 0 to 31
13579
+ dayOfYear: /^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,
13580
+ // 0 to 366
13581
+ week: /^(5[0-3]|[0-4]?\d)/,
13582
+ // 0 to 53
13583
+ hour23h: /^(2[0-3]|[0-1]?\d)/,
13584
+ // 0 to 23
13585
+ hour24h: /^(2[0-4]|[0-1]?\d)/,
13586
+ // 0 to 24
13587
+ hour11h: /^(1[0-1]|0?\d)/,
13588
+ // 0 to 11
13589
+ hour12h: /^(1[0-2]|0?\d)/,
13590
+ // 0 to 12
13591
+ minute: /^[0-5]?\d/,
13592
+ // 0 to 59
13593
+ second: /^[0-5]?\d/,
13594
+ // 0 to 59
13595
+ singleDigit: /^\d/,
13596
+ // 0 to 9
13597
+ twoDigits: /^\d{1,2}/,
13598
+ // 0 to 99
13599
+ threeDigits: /^\d{1,3}/,
13600
+ // 0 to 999
13601
+ fourDigits: /^\d{1,4}/,
13602
+ // 0 to 9999
13603
+ anyDigitsSigned: /^-?\d+/,
13604
+ singleDigitSigned: /^-?\d/,
13605
+ // 0 to 9, -0 to -9
13606
+ twoDigitsSigned: /^-?\d{1,2}/,
13607
+ // 0 to 99, -0 to -99
13608
+ threeDigitsSigned: /^-?\d{1,3}/,
13609
+ // 0 to 999, -0 to -999
13610
+ fourDigitsSigned: /^-?\d{1,4}/
13611
+ // 0 to 9999, -0 to -9999
13612
+ };
13613
+ const timezonePatterns = {
13614
+ basicOptionalMinutes: /^([+-])(\d{2})(\d{2})?|Z/,
13615
+ basic: /^([+-])(\d{2})(\d{2})|Z/,
13616
+ basicOptionalSeconds: /^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,
13617
+ extended: /^([+-])(\d{2}):(\d{2})|Z/,
13618
+ extendedOptionalSeconds: /^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/
13619
+ };
13620
+ function mapValue(parseFnResult, mapFn) {
13621
+ if (!parseFnResult) {
13622
+ return parseFnResult;
13623
+ }
13624
+ return {
13625
+ value: mapFn(parseFnResult.value),
13626
+ rest: parseFnResult.rest
13627
+ };
13628
+ }
13629
+ function parseNumericPattern(pattern, dateString) {
13630
+ const matchResult = dateString.match(pattern);
13631
+ if (!matchResult) {
13632
+ return null;
13633
+ }
13634
+ return {
13635
+ value: parseInt(matchResult[0], 10),
13636
+ rest: dateString.slice(matchResult[0].length)
13637
+ };
13638
+ }
13639
+ function parseTimezonePattern(pattern, dateString) {
13640
+ const matchResult = dateString.match(pattern);
13641
+ if (!matchResult) {
13642
+ return null;
13643
+ }
13644
+ if (matchResult[0] === "Z") {
13645
+ return {
13646
+ value: 0,
13647
+ rest: dateString.slice(1)
13648
+ };
13649
+ }
13650
+ const sign2 = matchResult[1] === "+" ? 1 : -1;
13651
+ const hours = matchResult[2] ? parseInt(matchResult[2], 10) : 0;
13652
+ const minutes = matchResult[3] ? parseInt(matchResult[3], 10) : 0;
13653
+ const seconds = matchResult[5] ? parseInt(matchResult[5], 10) : 0;
13654
+ return {
13655
+ value: sign2 * (hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * millisecondsInSecond),
13656
+ rest: dateString.slice(matchResult[0].length)
13657
+ };
13658
+ }
13659
+ function parseAnyDigitsSigned(dateString) {
13660
+ return parseNumericPattern(numericPatterns.anyDigitsSigned, dateString);
13661
+ }
13662
+ function parseNDigits(n2, dateString) {
13663
+ switch (n2) {
13664
+ case 1:
13665
+ return parseNumericPattern(numericPatterns.singleDigit, dateString);
13666
+ case 2:
13667
+ return parseNumericPattern(numericPatterns.twoDigits, dateString);
13668
+ case 3:
13669
+ return parseNumericPattern(numericPatterns.threeDigits, dateString);
13670
+ case 4:
13671
+ return parseNumericPattern(numericPatterns.fourDigits, dateString);
13672
+ default:
13673
+ return parseNumericPattern(new RegExp("^\\d{1," + n2 + "}"), dateString);
13674
+ }
13675
+ }
13676
+ function parseNDigitsSigned(n2, dateString) {
13677
+ switch (n2) {
13678
+ case 1:
13679
+ return parseNumericPattern(numericPatterns.singleDigitSigned, dateString);
13680
+ case 2:
13681
+ return parseNumericPattern(numericPatterns.twoDigitsSigned, dateString);
13682
+ case 3:
13683
+ return parseNumericPattern(numericPatterns.threeDigitsSigned, dateString);
13684
+ case 4:
13685
+ return parseNumericPattern(numericPatterns.fourDigitsSigned, dateString);
13686
+ default:
13687
+ return parseNumericPattern(new RegExp("^-?\\d{1," + n2 + "}"), dateString);
13688
+ }
13689
+ }
13690
+ function dayPeriodEnumToHours(dayPeriod) {
13691
+ switch (dayPeriod) {
13692
+ case "morning":
13693
+ return 4;
13694
+ case "evening":
13695
+ return 17;
13696
+ case "pm":
13697
+ case "noon":
13698
+ case "afternoon":
13699
+ return 12;
13700
+ case "am":
13701
+ case "midnight":
13702
+ case "night":
13703
+ default:
13704
+ return 0;
13705
+ }
13706
+ }
13707
+ function normalizeTwoDigitYear(twoDigitYear, currentYear) {
13708
+ const isCommonEra = currentYear > 0;
13709
+ const absCurrentYear = isCommonEra ? currentYear : 1 - currentYear;
13710
+ let result;
13711
+ if (absCurrentYear <= 50) {
13712
+ result = twoDigitYear || 100;
13713
+ } else {
13714
+ const rangeEnd = absCurrentYear + 50;
13715
+ const rangeEndCentury = Math.trunc(rangeEnd / 100) * 100;
13716
+ const isPreviousCentury = twoDigitYear >= rangeEnd % 100;
13717
+ result = twoDigitYear + rangeEndCentury - (isPreviousCentury ? 100 : 0);
13718
+ }
13719
+ return isCommonEra ? result : 1 - result;
13720
+ }
13721
+ function isLeapYearIndex$1(year) {
13722
+ return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;
13723
+ }
13724
+ class YearParser extends Parser {
13725
+ constructor() {
13726
+ super(...arguments);
13727
+ __publicField(this, "priority", 130);
13728
+ __publicField(this, "incompatibleTokens", ["Y", "R", "u", "w", "I", "i", "e", "c", "t", "T"]);
13729
+ }
13730
+ parse(dateString, token, match2) {
13731
+ const valueCallback = (year) => ({
13732
+ year,
13733
+ isTwoDigitYear: token === "yy"
13734
+ });
13735
+ switch (token) {
13736
+ case "y":
13737
+ return mapValue(parseNDigits(4, dateString), valueCallback);
13738
+ case "yo":
13739
+ return mapValue(
13740
+ match2.ordinalNumber(dateString, {
13741
+ unit: "year"
13742
+ }),
13743
+ valueCallback
13744
+ );
13745
+ default:
13746
+ return mapValue(parseNDigits(token.length, dateString), valueCallback);
13747
+ }
13748
+ }
13749
+ validate(_date, value) {
13750
+ return value.isTwoDigitYear || value.year > 0;
13751
+ }
13752
+ set(date2, flags, value) {
13753
+ const currentYear = date2.getFullYear();
13754
+ if (value.isTwoDigitYear) {
13755
+ const normalizedTwoDigitYear = normalizeTwoDigitYear(
13756
+ value.year,
13757
+ currentYear
13758
+ );
13759
+ date2.setFullYear(normalizedTwoDigitYear, 0, 1);
13760
+ date2.setHours(0, 0, 0, 0);
13761
+ return date2;
13762
+ }
13763
+ const year = !("era" in flags) || flags.era === 1 ? value.year : 1 - value.year;
13764
+ date2.setFullYear(year, 0, 1);
13765
+ date2.setHours(0, 0, 0, 0);
13766
+ return date2;
13767
+ }
13768
+ }
13769
+ class LocalWeekYearParser extends Parser {
13770
+ constructor() {
13771
+ super(...arguments);
13772
+ __publicField(this, "priority", 130);
13773
+ __publicField(this, "incompatibleTokens", [
13774
+ "y",
13775
+ "R",
13776
+ "u",
13777
+ "Q",
13778
+ "q",
13779
+ "M",
13780
+ "L",
13781
+ "I",
13782
+ "d",
13783
+ "D",
13784
+ "i",
13785
+ "t",
13786
+ "T"
13787
+ ]);
13788
+ }
13789
+ parse(dateString, token, match2) {
13790
+ const valueCallback = (year) => ({
13791
+ year,
13792
+ isTwoDigitYear: token === "YY"
13793
+ });
13794
+ switch (token) {
13795
+ case "Y":
13796
+ return mapValue(parseNDigits(4, dateString), valueCallback);
13797
+ case "Yo":
13798
+ return mapValue(
13799
+ match2.ordinalNumber(dateString, {
13800
+ unit: "year"
13801
+ }),
13802
+ valueCallback
13803
+ );
13804
+ default:
13805
+ return mapValue(parseNDigits(token.length, dateString), valueCallback);
13806
+ }
13807
+ }
13808
+ validate(_date, value) {
13809
+ return value.isTwoDigitYear || value.year > 0;
13810
+ }
13811
+ set(date2, flags, value, options) {
13812
+ const currentYear = getWeekYear(date2, options);
13813
+ if (value.isTwoDigitYear) {
13814
+ const normalizedTwoDigitYear = normalizeTwoDigitYear(
13815
+ value.year,
13816
+ currentYear
13817
+ );
13818
+ date2.setFullYear(
13819
+ normalizedTwoDigitYear,
13820
+ 0,
13821
+ options.firstWeekContainsDate
13822
+ );
13823
+ date2.setHours(0, 0, 0, 0);
13824
+ return startOfWeek(date2, options);
13825
+ }
13826
+ const year = !("era" in flags) || flags.era === 1 ? value.year : 1 - value.year;
13827
+ date2.setFullYear(year, 0, options.firstWeekContainsDate);
13828
+ date2.setHours(0, 0, 0, 0);
13829
+ return startOfWeek(date2, options);
13830
+ }
13831
+ }
13832
+ class ISOWeekYearParser extends Parser {
13833
+ constructor() {
13834
+ super(...arguments);
13835
+ __publicField(this, "priority", 130);
13836
+ __publicField(this, "incompatibleTokens", [
13837
+ "G",
13838
+ "y",
13839
+ "Y",
13840
+ "u",
13841
+ "Q",
13842
+ "q",
13843
+ "M",
13844
+ "L",
13845
+ "w",
13846
+ "d",
13847
+ "D",
13848
+ "e",
13849
+ "c",
13850
+ "t",
13851
+ "T"
13852
+ ]);
13853
+ }
13854
+ parse(dateString, token) {
13855
+ if (token === "R") {
13856
+ return parseNDigitsSigned(4, dateString);
13857
+ }
13858
+ return parseNDigitsSigned(token.length, dateString);
13859
+ }
13860
+ set(date2, _flags, value) {
13861
+ const firstWeekOfYear = constructFrom(date2, 0);
13862
+ firstWeekOfYear.setFullYear(value, 0, 4);
13863
+ firstWeekOfYear.setHours(0, 0, 0, 0);
13864
+ return startOfISOWeek(firstWeekOfYear);
13865
+ }
13866
+ }
13867
+ class ExtendedYearParser extends Parser {
13868
+ constructor() {
13869
+ super(...arguments);
13870
+ __publicField(this, "priority", 130);
13871
+ __publicField(this, "incompatibleTokens", ["G", "y", "Y", "R", "w", "I", "i", "e", "c", "t", "T"]);
13872
+ }
13873
+ parse(dateString, token) {
13874
+ if (token === "u") {
13875
+ return parseNDigitsSigned(4, dateString);
13876
+ }
13877
+ return parseNDigitsSigned(token.length, dateString);
13878
+ }
13879
+ set(date2, _flags, value) {
13880
+ date2.setFullYear(value, 0, 1);
13881
+ date2.setHours(0, 0, 0, 0);
13882
+ return date2;
13883
+ }
13884
+ }
13885
+ class QuarterParser extends Parser {
13886
+ constructor() {
13887
+ super(...arguments);
13888
+ __publicField(this, "priority", 120);
13889
+ __publicField(this, "incompatibleTokens", [
13890
+ "Y",
13891
+ "R",
13892
+ "q",
13893
+ "M",
13894
+ "L",
13895
+ "w",
13896
+ "I",
13897
+ "d",
13898
+ "D",
13899
+ "i",
13900
+ "e",
13901
+ "c",
13902
+ "t",
13903
+ "T"
13904
+ ]);
13905
+ }
13906
+ parse(dateString, token, match2) {
13907
+ switch (token) {
13908
+ // 1, 2, 3, 4
13909
+ case "Q":
13910
+ case "QQ":
13911
+ return parseNDigits(token.length, dateString);
13912
+ // 1st, 2nd, 3rd, 4th
13913
+ case "Qo":
13914
+ return match2.ordinalNumber(dateString, { unit: "quarter" });
13915
+ // Q1, Q2, Q3, Q4
13916
+ case "QQQ":
13917
+ return match2.quarter(dateString, {
13918
+ width: "abbreviated",
13919
+ context: "formatting"
13920
+ }) || match2.quarter(dateString, {
13921
+ width: "narrow",
13922
+ context: "formatting"
13923
+ });
13924
+ // 1, 2, 3, 4 (narrow quarter; could be not numerical)
13925
+ case "QQQQQ":
13926
+ return match2.quarter(dateString, {
13927
+ width: "narrow",
13928
+ context: "formatting"
13929
+ });
13930
+ // 1st quarter, 2nd quarter, ...
13931
+ case "QQQQ":
13932
+ default:
13933
+ return match2.quarter(dateString, {
13934
+ width: "wide",
13935
+ context: "formatting"
13936
+ }) || match2.quarter(dateString, {
13937
+ width: "abbreviated",
13938
+ context: "formatting"
13939
+ }) || match2.quarter(dateString, {
13940
+ width: "narrow",
13941
+ context: "formatting"
13942
+ });
13943
+ }
13944
+ }
13945
+ validate(_date, value) {
13946
+ return value >= 1 && value <= 4;
13947
+ }
13948
+ set(date2, _flags, value) {
13949
+ date2.setMonth((value - 1) * 3, 1);
13950
+ date2.setHours(0, 0, 0, 0);
13951
+ return date2;
13952
+ }
13953
+ }
13954
+ class StandAloneQuarterParser extends Parser {
13955
+ constructor() {
13956
+ super(...arguments);
13957
+ __publicField(this, "priority", 120);
13958
+ __publicField(this, "incompatibleTokens", [
13959
+ "Y",
13960
+ "R",
13961
+ "Q",
13962
+ "M",
13963
+ "L",
13964
+ "w",
13965
+ "I",
13966
+ "d",
13967
+ "D",
13968
+ "i",
13969
+ "e",
13970
+ "c",
13971
+ "t",
13972
+ "T"
13973
+ ]);
13974
+ }
13975
+ parse(dateString, token, match2) {
13976
+ switch (token) {
13977
+ // 1, 2, 3, 4
13978
+ case "q":
13979
+ case "qq":
13980
+ return parseNDigits(token.length, dateString);
13981
+ // 1st, 2nd, 3rd, 4th
13982
+ case "qo":
13983
+ return match2.ordinalNumber(dateString, { unit: "quarter" });
13984
+ // Q1, Q2, Q3, Q4
13985
+ case "qqq":
13986
+ return match2.quarter(dateString, {
13987
+ width: "abbreviated",
13988
+ context: "standalone"
13989
+ }) || match2.quarter(dateString, {
13990
+ width: "narrow",
13991
+ context: "standalone"
13992
+ });
13993
+ // 1, 2, 3, 4 (narrow quarter; could be not numerical)
13994
+ case "qqqqq":
13995
+ return match2.quarter(dateString, {
13996
+ width: "narrow",
13997
+ context: "standalone"
13998
+ });
13999
+ // 1st quarter, 2nd quarter, ...
14000
+ case "qqqq":
14001
+ default:
14002
+ return match2.quarter(dateString, {
14003
+ width: "wide",
14004
+ context: "standalone"
14005
+ }) || match2.quarter(dateString, {
14006
+ width: "abbreviated",
14007
+ context: "standalone"
14008
+ }) || match2.quarter(dateString, {
14009
+ width: "narrow",
14010
+ context: "standalone"
14011
+ });
14012
+ }
14013
+ }
14014
+ validate(_date, value) {
14015
+ return value >= 1 && value <= 4;
14016
+ }
14017
+ set(date2, _flags, value) {
14018
+ date2.setMonth((value - 1) * 3, 1);
14019
+ date2.setHours(0, 0, 0, 0);
14020
+ return date2;
14021
+ }
14022
+ }
14023
+ class MonthParser extends Parser {
14024
+ constructor() {
14025
+ super(...arguments);
14026
+ __publicField(this, "incompatibleTokens", [
14027
+ "Y",
14028
+ "R",
14029
+ "q",
14030
+ "Q",
14031
+ "L",
14032
+ "w",
14033
+ "I",
14034
+ "D",
14035
+ "i",
14036
+ "e",
14037
+ "c",
14038
+ "t",
14039
+ "T"
14040
+ ]);
14041
+ __publicField(this, "priority", 110);
14042
+ }
14043
+ parse(dateString, token, match2) {
14044
+ const valueCallback = (value) => value - 1;
14045
+ switch (token) {
14046
+ // 1, 2, ..., 12
14047
+ case "M":
14048
+ return mapValue(
14049
+ parseNumericPattern(numericPatterns.month, dateString),
14050
+ valueCallback
14051
+ );
14052
+ // 01, 02, ..., 12
14053
+ case "MM":
14054
+ return mapValue(parseNDigits(2, dateString), valueCallback);
14055
+ // 1st, 2nd, ..., 12th
14056
+ case "Mo":
14057
+ return mapValue(
14058
+ match2.ordinalNumber(dateString, {
14059
+ unit: "month"
14060
+ }),
14061
+ valueCallback
14062
+ );
14063
+ // Jan, Feb, ..., Dec
14064
+ case "MMM":
14065
+ return match2.month(dateString, {
14066
+ width: "abbreviated",
14067
+ context: "formatting"
14068
+ }) || match2.month(dateString, { width: "narrow", context: "formatting" });
14069
+ // J, F, ..., D
14070
+ case "MMMMM":
14071
+ return match2.month(dateString, {
14072
+ width: "narrow",
14073
+ context: "formatting"
14074
+ });
14075
+ // January, February, ..., December
14076
+ case "MMMM":
14077
+ default:
14078
+ return match2.month(dateString, { width: "wide", context: "formatting" }) || match2.month(dateString, {
14079
+ width: "abbreviated",
14080
+ context: "formatting"
14081
+ }) || match2.month(dateString, { width: "narrow", context: "formatting" });
14082
+ }
14083
+ }
14084
+ validate(_date, value) {
14085
+ return value >= 0 && value <= 11;
14086
+ }
14087
+ set(date2, _flags, value) {
14088
+ date2.setMonth(value, 1);
14089
+ date2.setHours(0, 0, 0, 0);
14090
+ return date2;
14091
+ }
14092
+ }
14093
+ class StandAloneMonthParser extends Parser {
14094
+ constructor() {
14095
+ super(...arguments);
14096
+ __publicField(this, "priority", 110);
14097
+ __publicField(this, "incompatibleTokens", [
14098
+ "Y",
14099
+ "R",
14100
+ "q",
14101
+ "Q",
14102
+ "M",
14103
+ "w",
14104
+ "I",
14105
+ "D",
14106
+ "i",
14107
+ "e",
14108
+ "c",
14109
+ "t",
14110
+ "T"
14111
+ ]);
14112
+ }
14113
+ parse(dateString, token, match2) {
14114
+ const valueCallback = (value) => value - 1;
14115
+ switch (token) {
14116
+ // 1, 2, ..., 12
14117
+ case "L":
14118
+ return mapValue(
14119
+ parseNumericPattern(numericPatterns.month, dateString),
14120
+ valueCallback
14121
+ );
14122
+ // 01, 02, ..., 12
14123
+ case "LL":
14124
+ return mapValue(parseNDigits(2, dateString), valueCallback);
14125
+ // 1st, 2nd, ..., 12th
14126
+ case "Lo":
14127
+ return mapValue(
14128
+ match2.ordinalNumber(dateString, {
14129
+ unit: "month"
14130
+ }),
14131
+ valueCallback
14132
+ );
14133
+ // Jan, Feb, ..., Dec
14134
+ case "LLL":
14135
+ return match2.month(dateString, {
14136
+ width: "abbreviated",
14137
+ context: "standalone"
14138
+ }) || match2.month(dateString, { width: "narrow", context: "standalone" });
14139
+ // J, F, ..., D
14140
+ case "LLLLL":
14141
+ return match2.month(dateString, {
14142
+ width: "narrow",
14143
+ context: "standalone"
14144
+ });
14145
+ // January, February, ..., December
14146
+ case "LLLL":
14147
+ default:
14148
+ return match2.month(dateString, { width: "wide", context: "standalone" }) || match2.month(dateString, {
14149
+ width: "abbreviated",
14150
+ context: "standalone"
14151
+ }) || match2.month(dateString, { width: "narrow", context: "standalone" });
14152
+ }
14153
+ }
14154
+ validate(_date, value) {
14155
+ return value >= 0 && value <= 11;
14156
+ }
14157
+ set(date2, _flags, value) {
14158
+ date2.setMonth(value, 1);
14159
+ date2.setHours(0, 0, 0, 0);
14160
+ return date2;
14161
+ }
14162
+ }
14163
+ function setWeek(date2, week, options) {
14164
+ const _date = toDate(date2);
14165
+ const diff = getWeek(_date, options) - week;
14166
+ _date.setDate(_date.getDate() - diff * 7);
14167
+ return _date;
14168
+ }
14169
+ class LocalWeekParser extends Parser {
14170
+ constructor() {
14171
+ super(...arguments);
14172
+ __publicField(this, "priority", 100);
14173
+ __publicField(this, "incompatibleTokens", [
14174
+ "y",
14175
+ "R",
14176
+ "u",
14177
+ "q",
14178
+ "Q",
14179
+ "M",
14180
+ "L",
14181
+ "I",
14182
+ "d",
14183
+ "D",
14184
+ "i",
14185
+ "t",
14186
+ "T"
14187
+ ]);
14188
+ }
14189
+ parse(dateString, token, match2) {
14190
+ switch (token) {
14191
+ case "w":
14192
+ return parseNumericPattern(numericPatterns.week, dateString);
14193
+ case "wo":
14194
+ return match2.ordinalNumber(dateString, { unit: "week" });
14195
+ default:
14196
+ return parseNDigits(token.length, dateString);
14197
+ }
14198
+ }
14199
+ validate(_date, value) {
14200
+ return value >= 1 && value <= 53;
14201
+ }
14202
+ set(date2, _flags, value, options) {
14203
+ return startOfWeek(setWeek(date2, value, options), options);
14204
+ }
14205
+ }
14206
+ function setISOWeek(date2, week) {
14207
+ const _date = toDate(date2);
14208
+ const diff = getISOWeek(_date) - week;
14209
+ _date.setDate(_date.getDate() - diff * 7);
14210
+ return _date;
14211
+ }
14212
+ class ISOWeekParser extends Parser {
14213
+ constructor() {
14214
+ super(...arguments);
14215
+ __publicField(this, "priority", 100);
14216
+ __publicField(this, "incompatibleTokens", [
14217
+ "y",
14218
+ "Y",
14219
+ "u",
14220
+ "q",
14221
+ "Q",
14222
+ "M",
14223
+ "L",
14224
+ "w",
14225
+ "d",
14226
+ "D",
14227
+ "e",
14228
+ "c",
14229
+ "t",
14230
+ "T"
14231
+ ]);
14232
+ }
14233
+ parse(dateString, token, match2) {
14234
+ switch (token) {
14235
+ case "I":
14236
+ return parseNumericPattern(numericPatterns.week, dateString);
14237
+ case "Io":
14238
+ return match2.ordinalNumber(dateString, { unit: "week" });
14239
+ default:
14240
+ return parseNDigits(token.length, dateString);
14241
+ }
14242
+ }
14243
+ validate(_date, value) {
14244
+ return value >= 1 && value <= 53;
14245
+ }
14246
+ set(date2, _flags, value) {
14247
+ return startOfISOWeek(setISOWeek(date2, value));
14248
+ }
14249
+ }
14250
+ const DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
14251
+ const DAYS_IN_MONTH_LEAP_YEAR = [
14252
+ 31,
14253
+ 29,
14254
+ 31,
14255
+ 30,
14256
+ 31,
14257
+ 30,
14258
+ 31,
14259
+ 31,
14260
+ 30,
14261
+ 31,
14262
+ 30,
14263
+ 31
14264
+ ];
14265
+ class DateParser extends Parser {
14266
+ constructor() {
14267
+ super(...arguments);
14268
+ __publicField(this, "priority", 90);
14269
+ __publicField(this, "subPriority", 1);
14270
+ __publicField(this, "incompatibleTokens", [
14271
+ "Y",
14272
+ "R",
14273
+ "q",
14274
+ "Q",
14275
+ "w",
14276
+ "I",
14277
+ "D",
14278
+ "i",
14279
+ "e",
14280
+ "c",
14281
+ "t",
14282
+ "T"
14283
+ ]);
14284
+ }
14285
+ parse(dateString, token, match2) {
14286
+ switch (token) {
14287
+ case "d":
14288
+ return parseNumericPattern(numericPatterns.date, dateString);
14289
+ case "do":
14290
+ return match2.ordinalNumber(dateString, { unit: "date" });
14291
+ default:
14292
+ return parseNDigits(token.length, dateString);
14293
+ }
14294
+ }
14295
+ validate(date2, value) {
14296
+ const year = date2.getFullYear();
14297
+ const isLeapYear = isLeapYearIndex$1(year);
14298
+ const month = date2.getMonth();
14299
+ if (isLeapYear) {
14300
+ return value >= 1 && value <= DAYS_IN_MONTH_LEAP_YEAR[month];
14301
+ } else {
14302
+ return value >= 1 && value <= DAYS_IN_MONTH[month];
14303
+ }
14304
+ }
14305
+ set(date2, _flags, value) {
14306
+ date2.setDate(value);
14307
+ date2.setHours(0, 0, 0, 0);
14308
+ return date2;
14309
+ }
14310
+ }
14311
+ class DayOfYearParser extends Parser {
14312
+ constructor() {
14313
+ super(...arguments);
14314
+ __publicField(this, "priority", 90);
14315
+ __publicField(this, "subpriority", 1);
14316
+ __publicField(this, "incompatibleTokens", [
14317
+ "Y",
14318
+ "R",
14319
+ "q",
14320
+ "Q",
14321
+ "M",
14322
+ "L",
14323
+ "w",
14324
+ "I",
14325
+ "d",
14326
+ "E",
14327
+ "i",
14328
+ "e",
14329
+ "c",
14330
+ "t",
14331
+ "T"
14332
+ ]);
14333
+ }
14334
+ parse(dateString, token, match2) {
14335
+ switch (token) {
14336
+ case "D":
14337
+ case "DD":
14338
+ return parseNumericPattern(numericPatterns.dayOfYear, dateString);
14339
+ case "Do":
14340
+ return match2.ordinalNumber(dateString, { unit: "date" });
14341
+ default:
14342
+ return parseNDigits(token.length, dateString);
14343
+ }
14344
+ }
14345
+ validate(date2, value) {
14346
+ const year = date2.getFullYear();
14347
+ const isLeapYear = isLeapYearIndex$1(year);
14348
+ if (isLeapYear) {
14349
+ return value >= 1 && value <= 366;
14350
+ } else {
14351
+ return value >= 1 && value <= 365;
14352
+ }
14353
+ }
14354
+ set(date2, _flags, value) {
14355
+ date2.setMonth(0, value);
14356
+ date2.setHours(0, 0, 0, 0);
14357
+ return date2;
14358
+ }
14359
+ }
14360
+ function setDay(date2, day, options) {
14361
+ var _a, _b, _c, _d;
14362
+ const defaultOptions2 = getDefaultOptions$1();
14363
+ const weekStartsOn = (options == null ? void 0 : options.weekStartsOn) ?? ((_b = (_a = options == null ? void 0 : options.locale) == null ? void 0 : _a.options) == null ? void 0 : _b.weekStartsOn) ?? defaultOptions2.weekStartsOn ?? ((_d = (_c = defaultOptions2.locale) == null ? void 0 : _c.options) == null ? void 0 : _d.weekStartsOn) ?? 0;
14364
+ const _date = toDate(date2);
14365
+ const currentDay = _date.getDay();
14366
+ const remainder = day % 7;
14367
+ const dayIndex = (remainder + 7) % 7;
14368
+ const delta = 7 - weekStartsOn;
14369
+ const diff = day < 0 || day > 6 ? day - (currentDay + delta) % 7 : (dayIndex + delta) % 7 - (currentDay + delta) % 7;
14370
+ return addDays(_date, diff);
14371
+ }
14372
+ class DayParser extends Parser {
14373
+ constructor() {
14374
+ super(...arguments);
14375
+ __publicField(this, "priority", 90);
14376
+ __publicField(this, "incompatibleTokens", ["D", "i", "e", "c", "t", "T"]);
14377
+ }
14378
+ parse(dateString, token, match2) {
14379
+ switch (token) {
14380
+ // Tue
14381
+ case "E":
14382
+ case "EE":
14383
+ case "EEE":
14384
+ return match2.day(dateString, {
14385
+ width: "abbreviated",
14386
+ context: "formatting"
14387
+ }) || match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" });
14388
+ // T
14389
+ case "EEEEE":
14390
+ return match2.day(dateString, {
14391
+ width: "narrow",
14392
+ context: "formatting"
14393
+ });
14394
+ // Tu
14395
+ case "EEEEEE":
14396
+ return match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" });
14397
+ // Tuesday
14398
+ case "EEEE":
14399
+ default:
14400
+ return match2.day(dateString, { width: "wide", context: "formatting" }) || match2.day(dateString, {
14401
+ width: "abbreviated",
14402
+ context: "formatting"
14403
+ }) || match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" });
14404
+ }
14405
+ }
14406
+ validate(_date, value) {
14407
+ return value >= 0 && value <= 6;
14408
+ }
14409
+ set(date2, _flags, value, options) {
14410
+ date2 = setDay(date2, value, options);
14411
+ date2.setHours(0, 0, 0, 0);
14412
+ return date2;
14413
+ }
14414
+ }
14415
+ class LocalDayParser extends Parser {
14416
+ constructor() {
14417
+ super(...arguments);
14418
+ __publicField(this, "priority", 90);
14419
+ __publicField(this, "incompatibleTokens", [
14420
+ "y",
14421
+ "R",
14422
+ "u",
14423
+ "q",
14424
+ "Q",
14425
+ "M",
14426
+ "L",
14427
+ "I",
14428
+ "d",
14429
+ "D",
14430
+ "E",
14431
+ "i",
14432
+ "c",
14433
+ "t",
14434
+ "T"
14435
+ ]);
14436
+ }
14437
+ parse(dateString, token, match2, options) {
14438
+ const valueCallback = (value) => {
14439
+ const wholeWeekDays = Math.floor((value - 1) / 7) * 7;
14440
+ return (value + options.weekStartsOn + 6) % 7 + wholeWeekDays;
14441
+ };
14442
+ switch (token) {
14443
+ // 3
14444
+ case "e":
14445
+ case "ee":
14446
+ return mapValue(parseNDigits(token.length, dateString), valueCallback);
14447
+ // 3rd
14448
+ case "eo":
14449
+ return mapValue(
14450
+ match2.ordinalNumber(dateString, {
14451
+ unit: "day"
14452
+ }),
14453
+ valueCallback
14454
+ );
14455
+ // Tue
14456
+ case "eee":
14457
+ return match2.day(dateString, {
14458
+ width: "abbreviated",
14459
+ context: "formatting"
14460
+ }) || match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" });
14461
+ // T
14462
+ case "eeeee":
14463
+ return match2.day(dateString, {
14464
+ width: "narrow",
14465
+ context: "formatting"
14466
+ });
14467
+ // Tu
14468
+ case "eeeeee":
14469
+ return match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" });
14470
+ // Tuesday
14471
+ case "eeee":
14472
+ default:
14473
+ return match2.day(dateString, { width: "wide", context: "formatting" }) || match2.day(dateString, {
14474
+ width: "abbreviated",
14475
+ context: "formatting"
14476
+ }) || match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" });
14477
+ }
14478
+ }
14479
+ validate(_date, value) {
14480
+ return value >= 0 && value <= 6;
14481
+ }
14482
+ set(date2, _flags, value, options) {
14483
+ date2 = setDay(date2, value, options);
14484
+ date2.setHours(0, 0, 0, 0);
14485
+ return date2;
14486
+ }
14487
+ }
14488
+ class StandAloneLocalDayParser extends Parser {
14489
+ constructor() {
14490
+ super(...arguments);
14491
+ __publicField(this, "priority", 90);
14492
+ __publicField(this, "incompatibleTokens", [
14493
+ "y",
14494
+ "R",
14495
+ "u",
14496
+ "q",
14497
+ "Q",
14498
+ "M",
14499
+ "L",
14500
+ "I",
14501
+ "d",
14502
+ "D",
14503
+ "E",
14504
+ "i",
14505
+ "e",
14506
+ "t",
14507
+ "T"
14508
+ ]);
14509
+ }
14510
+ parse(dateString, token, match2, options) {
14511
+ const valueCallback = (value) => {
14512
+ const wholeWeekDays = Math.floor((value - 1) / 7) * 7;
14513
+ return (value + options.weekStartsOn + 6) % 7 + wholeWeekDays;
14514
+ };
14515
+ switch (token) {
14516
+ // 3
14517
+ case "c":
14518
+ case "cc":
14519
+ return mapValue(parseNDigits(token.length, dateString), valueCallback);
14520
+ // 3rd
14521
+ case "co":
14522
+ return mapValue(
14523
+ match2.ordinalNumber(dateString, {
14524
+ unit: "day"
14525
+ }),
14526
+ valueCallback
14527
+ );
14528
+ // Tue
14529
+ case "ccc":
14530
+ return match2.day(dateString, {
14531
+ width: "abbreviated",
14532
+ context: "standalone"
14533
+ }) || match2.day(dateString, { width: "short", context: "standalone" }) || match2.day(dateString, { width: "narrow", context: "standalone" });
14534
+ // T
14535
+ case "ccccc":
14536
+ return match2.day(dateString, {
14537
+ width: "narrow",
14538
+ context: "standalone"
14539
+ });
14540
+ // Tu
14541
+ case "cccccc":
14542
+ return match2.day(dateString, { width: "short", context: "standalone" }) || match2.day(dateString, { width: "narrow", context: "standalone" });
14543
+ // Tuesday
14544
+ case "cccc":
14545
+ default:
14546
+ return match2.day(dateString, { width: "wide", context: "standalone" }) || match2.day(dateString, {
14547
+ width: "abbreviated",
14548
+ context: "standalone"
14549
+ }) || match2.day(dateString, { width: "short", context: "standalone" }) || match2.day(dateString, { width: "narrow", context: "standalone" });
14550
+ }
14551
+ }
14552
+ validate(_date, value) {
14553
+ return value >= 0 && value <= 6;
14554
+ }
14555
+ set(date2, _flags, value, options) {
14556
+ date2 = setDay(date2, value, options);
14557
+ date2.setHours(0, 0, 0, 0);
14558
+ return date2;
14559
+ }
14560
+ }
14561
+ function setISODay(date2, day) {
14562
+ const _date = toDate(date2);
14563
+ const currentDay = getISODay(_date);
14564
+ const diff = day - currentDay;
14565
+ return addDays(_date, diff);
14566
+ }
14567
+ class ISODayParser extends Parser {
14568
+ constructor() {
14569
+ super(...arguments);
14570
+ __publicField(this, "priority", 90);
14571
+ __publicField(this, "incompatibleTokens", [
14572
+ "y",
14573
+ "Y",
14574
+ "u",
14575
+ "q",
14576
+ "Q",
14577
+ "M",
14578
+ "L",
14579
+ "w",
14580
+ "d",
14581
+ "D",
14582
+ "E",
14583
+ "e",
14584
+ "c",
14585
+ "t",
14586
+ "T"
14587
+ ]);
14588
+ }
14589
+ parse(dateString, token, match2) {
14590
+ const valueCallback = (value) => {
14591
+ if (value === 0) {
14592
+ return 7;
14593
+ }
14594
+ return value;
14595
+ };
14596
+ switch (token) {
14597
+ // 2
14598
+ case "i":
14599
+ case "ii":
14600
+ return parseNDigits(token.length, dateString);
14601
+ // 2nd
14602
+ case "io":
14603
+ return match2.ordinalNumber(dateString, { unit: "day" });
14604
+ // Tue
14605
+ case "iii":
14606
+ return mapValue(
14607
+ match2.day(dateString, {
14608
+ width: "abbreviated",
14609
+ context: "formatting"
14610
+ }) || match2.day(dateString, {
14611
+ width: "short",
14612
+ context: "formatting"
14613
+ }) || match2.day(dateString, {
14614
+ width: "narrow",
14615
+ context: "formatting"
14616
+ }),
14617
+ valueCallback
14618
+ );
14619
+ // T
14620
+ case "iiiii":
14621
+ return mapValue(
14622
+ match2.day(dateString, {
14623
+ width: "narrow",
14624
+ context: "formatting"
14625
+ }),
14626
+ valueCallback
14627
+ );
14628
+ // Tu
14629
+ case "iiiiii":
14630
+ return mapValue(
14631
+ match2.day(dateString, {
14632
+ width: "short",
14633
+ context: "formatting"
14634
+ }) || match2.day(dateString, {
14635
+ width: "narrow",
14636
+ context: "formatting"
14637
+ }),
14638
+ valueCallback
14639
+ );
14640
+ // Tuesday
14641
+ case "iiii":
14642
+ default:
14643
+ return mapValue(
14644
+ match2.day(dateString, {
14645
+ width: "wide",
14646
+ context: "formatting"
14647
+ }) || match2.day(dateString, {
14648
+ width: "abbreviated",
14649
+ context: "formatting"
14650
+ }) || match2.day(dateString, {
14651
+ width: "short",
14652
+ context: "formatting"
14653
+ }) || match2.day(dateString, {
14654
+ width: "narrow",
14655
+ context: "formatting"
14656
+ }),
14657
+ valueCallback
14658
+ );
14659
+ }
14660
+ }
14661
+ validate(_date, value) {
14662
+ return value >= 1 && value <= 7;
14663
+ }
14664
+ set(date2, _flags, value) {
14665
+ date2 = setISODay(date2, value);
14666
+ date2.setHours(0, 0, 0, 0);
14667
+ return date2;
14668
+ }
14669
+ }
14670
+ class AMPMParser extends Parser {
14671
+ constructor() {
14672
+ super(...arguments);
14673
+ __publicField(this, "priority", 80);
14674
+ __publicField(this, "incompatibleTokens", ["b", "B", "H", "k", "t", "T"]);
14675
+ }
14676
+ parse(dateString, token, match2) {
14677
+ switch (token) {
14678
+ case "a":
14679
+ case "aa":
14680
+ case "aaa":
14681
+ return match2.dayPeriod(dateString, {
14682
+ width: "abbreviated",
14683
+ context: "formatting"
14684
+ }) || match2.dayPeriod(dateString, {
14685
+ width: "narrow",
14686
+ context: "formatting"
14687
+ });
14688
+ case "aaaaa":
14689
+ return match2.dayPeriod(dateString, {
14690
+ width: "narrow",
14691
+ context: "formatting"
14692
+ });
14693
+ case "aaaa":
14694
+ default:
14695
+ return match2.dayPeriod(dateString, {
14696
+ width: "wide",
14697
+ context: "formatting"
14698
+ }) || match2.dayPeriod(dateString, {
14699
+ width: "abbreviated",
14700
+ context: "formatting"
14701
+ }) || match2.dayPeriod(dateString, {
14702
+ width: "narrow",
14703
+ context: "formatting"
14704
+ });
14705
+ }
14706
+ }
14707
+ set(date2, _flags, value) {
14708
+ date2.setHours(dayPeriodEnumToHours(value), 0, 0, 0);
14709
+ return date2;
14710
+ }
14711
+ }
14712
+ class AMPMMidnightParser extends Parser {
14713
+ constructor() {
14714
+ super(...arguments);
14715
+ __publicField(this, "priority", 80);
14716
+ __publicField(this, "incompatibleTokens", ["a", "B", "H", "k", "t", "T"]);
14717
+ }
14718
+ parse(dateString, token, match2) {
14719
+ switch (token) {
14720
+ case "b":
14721
+ case "bb":
14722
+ case "bbb":
14723
+ return match2.dayPeriod(dateString, {
14724
+ width: "abbreviated",
14725
+ context: "formatting"
14726
+ }) || match2.dayPeriod(dateString, {
14727
+ width: "narrow",
14728
+ context: "formatting"
14729
+ });
14730
+ case "bbbbb":
14731
+ return match2.dayPeriod(dateString, {
14732
+ width: "narrow",
14733
+ context: "formatting"
14734
+ });
14735
+ case "bbbb":
14736
+ default:
14737
+ return match2.dayPeriod(dateString, {
14738
+ width: "wide",
14739
+ context: "formatting"
14740
+ }) || match2.dayPeriod(dateString, {
14741
+ width: "abbreviated",
14742
+ context: "formatting"
14743
+ }) || match2.dayPeriod(dateString, {
14744
+ width: "narrow",
14745
+ context: "formatting"
14746
+ });
14747
+ }
14748
+ }
14749
+ set(date2, _flags, value) {
14750
+ date2.setHours(dayPeriodEnumToHours(value), 0, 0, 0);
14751
+ return date2;
14752
+ }
14753
+ }
14754
+ class DayPeriodParser extends Parser {
14755
+ constructor() {
14756
+ super(...arguments);
14757
+ __publicField(this, "priority", 80);
14758
+ __publicField(this, "incompatibleTokens", ["a", "b", "t", "T"]);
14759
+ }
14760
+ parse(dateString, token, match2) {
14761
+ switch (token) {
14762
+ case "B":
14763
+ case "BB":
14764
+ case "BBB":
14765
+ return match2.dayPeriod(dateString, {
14766
+ width: "abbreviated",
14767
+ context: "formatting"
14768
+ }) || match2.dayPeriod(dateString, {
14769
+ width: "narrow",
14770
+ context: "formatting"
14771
+ });
14772
+ case "BBBBB":
14773
+ return match2.dayPeriod(dateString, {
14774
+ width: "narrow",
14775
+ context: "formatting"
14776
+ });
14777
+ case "BBBB":
14778
+ default:
14779
+ return match2.dayPeriod(dateString, {
14780
+ width: "wide",
14781
+ context: "formatting"
14782
+ }) || match2.dayPeriod(dateString, {
14783
+ width: "abbreviated",
14784
+ context: "formatting"
14785
+ }) || match2.dayPeriod(dateString, {
14786
+ width: "narrow",
14787
+ context: "formatting"
14788
+ });
14789
+ }
14790
+ }
14791
+ set(date2, _flags, value) {
14792
+ date2.setHours(dayPeriodEnumToHours(value), 0, 0, 0);
14793
+ return date2;
14794
+ }
14795
+ }
14796
+ class Hour1to12Parser extends Parser {
14797
+ constructor() {
14798
+ super(...arguments);
14799
+ __publicField(this, "priority", 70);
14800
+ __publicField(this, "incompatibleTokens", ["H", "K", "k", "t", "T"]);
14801
+ }
14802
+ parse(dateString, token, match2) {
14803
+ switch (token) {
14804
+ case "h":
14805
+ return parseNumericPattern(numericPatterns.hour12h, dateString);
14806
+ case "ho":
14807
+ return match2.ordinalNumber(dateString, { unit: "hour" });
14808
+ default:
14809
+ return parseNDigits(token.length, dateString);
14810
+ }
14811
+ }
14812
+ validate(_date, value) {
14813
+ return value >= 1 && value <= 12;
14814
+ }
14815
+ set(date2, _flags, value) {
14816
+ const isPM = date2.getHours() >= 12;
14817
+ if (isPM && value < 12) {
14818
+ date2.setHours(value + 12, 0, 0, 0);
14819
+ } else if (!isPM && value === 12) {
14820
+ date2.setHours(0, 0, 0, 0);
14821
+ } else {
14822
+ date2.setHours(value, 0, 0, 0);
14823
+ }
14824
+ return date2;
14825
+ }
14826
+ }
14827
+ class Hour0to23Parser extends Parser {
14828
+ constructor() {
14829
+ super(...arguments);
14830
+ __publicField(this, "priority", 70);
14831
+ __publicField(this, "incompatibleTokens", ["a", "b", "h", "K", "k", "t", "T"]);
14832
+ }
14833
+ parse(dateString, token, match2) {
14834
+ switch (token) {
14835
+ case "H":
14836
+ return parseNumericPattern(numericPatterns.hour23h, dateString);
14837
+ case "Ho":
14838
+ return match2.ordinalNumber(dateString, { unit: "hour" });
14839
+ default:
14840
+ return parseNDigits(token.length, dateString);
14841
+ }
14842
+ }
14843
+ validate(_date, value) {
14844
+ return value >= 0 && value <= 23;
14845
+ }
14846
+ set(date2, _flags, value) {
14847
+ date2.setHours(value, 0, 0, 0);
14848
+ return date2;
14849
+ }
14850
+ }
14851
+ class Hour0To11Parser extends Parser {
14852
+ constructor() {
14853
+ super(...arguments);
14854
+ __publicField(this, "priority", 70);
14855
+ __publicField(this, "incompatibleTokens", ["h", "H", "k", "t", "T"]);
14856
+ }
14857
+ parse(dateString, token, match2) {
14858
+ switch (token) {
14859
+ case "K":
14860
+ return parseNumericPattern(numericPatterns.hour11h, dateString);
14861
+ case "Ko":
14862
+ return match2.ordinalNumber(dateString, { unit: "hour" });
14863
+ default:
14864
+ return parseNDigits(token.length, dateString);
14865
+ }
14866
+ }
14867
+ validate(_date, value) {
14868
+ return value >= 0 && value <= 11;
14869
+ }
14870
+ set(date2, _flags, value) {
14871
+ const isPM = date2.getHours() >= 12;
14872
+ if (isPM && value < 12) {
14873
+ date2.setHours(value + 12, 0, 0, 0);
14874
+ } else {
14875
+ date2.setHours(value, 0, 0, 0);
14876
+ }
14877
+ return date2;
14878
+ }
14879
+ }
14880
+ class Hour1To24Parser extends Parser {
14881
+ constructor() {
14882
+ super(...arguments);
14883
+ __publicField(this, "priority", 70);
14884
+ __publicField(this, "incompatibleTokens", ["a", "b", "h", "H", "K", "t", "T"]);
14885
+ }
14886
+ parse(dateString, token, match2) {
14887
+ switch (token) {
14888
+ case "k":
14889
+ return parseNumericPattern(numericPatterns.hour24h, dateString);
14890
+ case "ko":
14891
+ return match2.ordinalNumber(dateString, { unit: "hour" });
14892
+ default:
14893
+ return parseNDigits(token.length, dateString);
14894
+ }
14895
+ }
14896
+ validate(_date, value) {
14897
+ return value >= 1 && value <= 24;
14898
+ }
14899
+ set(date2, _flags, value) {
14900
+ const hours = value <= 24 ? value % 24 : value;
14901
+ date2.setHours(hours, 0, 0, 0);
14902
+ return date2;
14903
+ }
14904
+ }
14905
+ class MinuteParser extends Parser {
14906
+ constructor() {
14907
+ super(...arguments);
14908
+ __publicField(this, "priority", 60);
14909
+ __publicField(this, "incompatibleTokens", ["t", "T"]);
14910
+ }
14911
+ parse(dateString, token, match2) {
14912
+ switch (token) {
14913
+ case "m":
14914
+ return parseNumericPattern(numericPatterns.minute, dateString);
14915
+ case "mo":
14916
+ return match2.ordinalNumber(dateString, { unit: "minute" });
14917
+ default:
14918
+ return parseNDigits(token.length, dateString);
14919
+ }
14920
+ }
14921
+ validate(_date, value) {
14922
+ return value >= 0 && value <= 59;
14923
+ }
14924
+ set(date2, _flags, value) {
14925
+ date2.setMinutes(value, 0, 0);
14926
+ return date2;
14927
+ }
14928
+ }
14929
+ class SecondParser extends Parser {
14930
+ constructor() {
14931
+ super(...arguments);
14932
+ __publicField(this, "priority", 50);
14933
+ __publicField(this, "incompatibleTokens", ["t", "T"]);
14934
+ }
14935
+ parse(dateString, token, match2) {
14936
+ switch (token) {
14937
+ case "s":
14938
+ return parseNumericPattern(numericPatterns.second, dateString);
14939
+ case "so":
14940
+ return match2.ordinalNumber(dateString, { unit: "second" });
14941
+ default:
14942
+ return parseNDigits(token.length, dateString);
14943
+ }
14944
+ }
14945
+ validate(_date, value) {
14946
+ return value >= 0 && value <= 59;
14947
+ }
14948
+ set(date2, _flags, value) {
14949
+ date2.setSeconds(value, 0);
14950
+ return date2;
14951
+ }
14952
+ }
14953
+ class FractionOfSecondParser extends Parser {
14954
+ constructor() {
14955
+ super(...arguments);
14956
+ __publicField(this, "priority", 30);
14957
+ __publicField(this, "incompatibleTokens", ["t", "T"]);
14958
+ }
14959
+ parse(dateString, token) {
14960
+ const valueCallback = (value) => Math.trunc(value * Math.pow(10, -token.length + 3));
14961
+ return mapValue(parseNDigits(token.length, dateString), valueCallback);
14962
+ }
14963
+ set(date2, _flags, value) {
14964
+ date2.setMilliseconds(value);
14965
+ return date2;
14966
+ }
14967
+ }
14968
+ class ISOTimezoneWithZParser extends Parser {
14969
+ constructor() {
14970
+ super(...arguments);
14971
+ __publicField(this, "priority", 10);
14972
+ __publicField(this, "incompatibleTokens", ["t", "T", "x"]);
14973
+ }
14974
+ parse(dateString, token) {
14975
+ switch (token) {
14976
+ case "X":
14977
+ return parseTimezonePattern(
14978
+ timezonePatterns.basicOptionalMinutes,
14979
+ dateString
14980
+ );
14981
+ case "XX":
14982
+ return parseTimezonePattern(timezonePatterns.basic, dateString);
14983
+ case "XXXX":
14984
+ return parseTimezonePattern(
14985
+ timezonePatterns.basicOptionalSeconds,
14986
+ dateString
14987
+ );
14988
+ case "XXXXX":
14989
+ return parseTimezonePattern(
14990
+ timezonePatterns.extendedOptionalSeconds,
14991
+ dateString
14992
+ );
14993
+ case "XXX":
14994
+ default:
14995
+ return parseTimezonePattern(timezonePatterns.extended, dateString);
14996
+ }
14997
+ }
14998
+ set(date2, flags, value) {
14999
+ if (flags.timestampIsSet) return date2;
15000
+ return constructFrom(
15001
+ date2,
15002
+ date2.getTime() - getTimezoneOffsetInMilliseconds(date2) - value
15003
+ );
15004
+ }
15005
+ }
15006
+ class ISOTimezoneParser extends Parser {
15007
+ constructor() {
15008
+ super(...arguments);
15009
+ __publicField(this, "priority", 10);
15010
+ __publicField(this, "incompatibleTokens", ["t", "T", "X"]);
15011
+ }
15012
+ parse(dateString, token) {
15013
+ switch (token) {
15014
+ case "x":
15015
+ return parseTimezonePattern(
15016
+ timezonePatterns.basicOptionalMinutes,
15017
+ dateString
15018
+ );
15019
+ case "xx":
15020
+ return parseTimezonePattern(timezonePatterns.basic, dateString);
15021
+ case "xxxx":
15022
+ return parseTimezonePattern(
15023
+ timezonePatterns.basicOptionalSeconds,
15024
+ dateString
15025
+ );
15026
+ case "xxxxx":
15027
+ return parseTimezonePattern(
15028
+ timezonePatterns.extendedOptionalSeconds,
15029
+ dateString
15030
+ );
15031
+ case "xxx":
15032
+ default:
15033
+ return parseTimezonePattern(timezonePatterns.extended, dateString);
15034
+ }
15035
+ }
15036
+ set(date2, flags, value) {
15037
+ if (flags.timestampIsSet) return date2;
15038
+ return constructFrom(
15039
+ date2,
15040
+ date2.getTime() - getTimezoneOffsetInMilliseconds(date2) - value
15041
+ );
15042
+ }
15043
+ }
15044
+ class TimestampSecondsParser extends Parser {
15045
+ constructor() {
15046
+ super(...arguments);
15047
+ __publicField(this, "priority", 40);
15048
+ __publicField(this, "incompatibleTokens", "*");
15049
+ }
15050
+ parse(dateString) {
15051
+ return parseAnyDigitsSigned(dateString);
15052
+ }
15053
+ set(date2, _flags, value) {
15054
+ return [constructFrom(date2, value * 1e3), { timestampIsSet: true }];
15055
+ }
15056
+ }
15057
+ class TimestampMillisecondsParser extends Parser {
15058
+ constructor() {
15059
+ super(...arguments);
15060
+ __publicField(this, "priority", 20);
15061
+ __publicField(this, "incompatibleTokens", "*");
15062
+ }
15063
+ parse(dateString) {
15064
+ return parseAnyDigitsSigned(dateString);
15065
+ }
15066
+ set(date2, _flags, value) {
15067
+ return [constructFrom(date2, value), { timestampIsSet: true }];
15068
+ }
15069
+ }
15070
+ const parsers = {
15071
+ G: new EraParser(),
15072
+ y: new YearParser(),
15073
+ Y: new LocalWeekYearParser(),
15074
+ R: new ISOWeekYearParser(),
15075
+ u: new ExtendedYearParser(),
15076
+ Q: new QuarterParser(),
15077
+ q: new StandAloneQuarterParser(),
15078
+ M: new MonthParser(),
15079
+ L: new StandAloneMonthParser(),
15080
+ w: new LocalWeekParser(),
15081
+ I: new ISOWeekParser(),
15082
+ d: new DateParser(),
15083
+ D: new DayOfYearParser(),
15084
+ E: new DayParser(),
15085
+ e: new LocalDayParser(),
15086
+ c: new StandAloneLocalDayParser(),
15087
+ i: new ISODayParser(),
15088
+ a: new AMPMParser(),
15089
+ b: new AMPMMidnightParser(),
15090
+ B: new DayPeriodParser(),
15091
+ h: new Hour1to12Parser(),
15092
+ H: new Hour0to23Parser(),
15093
+ K: new Hour0To11Parser(),
15094
+ k: new Hour1To24Parser(),
15095
+ m: new MinuteParser(),
15096
+ s: new SecondParser(),
15097
+ S: new FractionOfSecondParser(),
15098
+ X: new ISOTimezoneWithZParser(),
15099
+ x: new ISOTimezoneParser(),
15100
+ t: new TimestampSecondsParser(),
15101
+ T: new TimestampMillisecondsParser()
15102
+ };
15103
+ const formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
15104
+ const longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
15105
+ const escapedStringRegExp = /^'([^]*?)'?$/;
15106
+ const doubleQuoteRegExp = /''/g;
15107
+ const notWhitespaceRegExp = /\S/;
15108
+ const unescapedLatinCharacterRegExp = /[a-zA-Z]/;
15109
+ function parse$2(dateStr, formatStr, referenceDate, options) {
15110
+ var _a, _b, _c, _d;
15111
+ const defaultOptions2 = getDefaultOptions();
15112
+ const locale2 = defaultOptions2.locale ?? enUS;
15113
+ const firstWeekContainsDate = defaultOptions2.firstWeekContainsDate ?? ((_b = (_a = defaultOptions2.locale) == null ? void 0 : _a.options) == null ? void 0 : _b.firstWeekContainsDate) ?? 1;
15114
+ const weekStartsOn = defaultOptions2.weekStartsOn ?? ((_d = (_c = defaultOptions2.locale) == null ? void 0 : _c.options) == null ? void 0 : _d.weekStartsOn) ?? 0;
15115
+ if (formatStr === "") {
15116
+ if (dateStr === "") {
15117
+ return toDate(referenceDate);
15118
+ } else {
15119
+ return constructFrom(referenceDate, NaN);
15120
+ }
15121
+ }
15122
+ const subFnOptions = {
15123
+ firstWeekContainsDate,
15124
+ weekStartsOn,
15125
+ locale: locale2
15126
+ };
15127
+ const setters = [new DateToSystemTimezoneSetter()];
15128
+ const tokens = formatStr.match(longFormattingTokensRegExp).map((substring) => {
15129
+ const firstCharacter = substring[0];
15130
+ if (firstCharacter in longFormatters) {
15131
+ const longFormatter = longFormatters[firstCharacter];
15132
+ return longFormatter(substring, locale2.formatLong);
15133
+ }
15134
+ return substring;
15135
+ }).join("").match(formattingTokensRegExp);
15136
+ const usedTokens = [];
15137
+ for (let token of tokens) {
15138
+ if (isProtectedWeekYearToken(token)) {
15139
+ warnOrThrowProtectedError(token, formatStr, dateStr);
15140
+ }
15141
+ if (isProtectedDayOfYearToken(token)) {
15142
+ warnOrThrowProtectedError(token, formatStr, dateStr);
15143
+ }
15144
+ const firstCharacter = token[0];
15145
+ const parser = parsers[firstCharacter];
15146
+ if (parser) {
15147
+ const { incompatibleTokens } = parser;
15148
+ if (Array.isArray(incompatibleTokens)) {
15149
+ const incompatibleToken = usedTokens.find(
15150
+ (usedToken) => incompatibleTokens.includes(usedToken.token) || usedToken.token === firstCharacter
15151
+ );
15152
+ if (incompatibleToken) {
15153
+ throw new RangeError(
15154
+ `The format string mustn't contain \`${incompatibleToken.fullToken}\` and \`${token}\` at the same time`
15155
+ );
15156
+ }
15157
+ } else if (parser.incompatibleTokens === "*" && usedTokens.length > 0) {
15158
+ throw new RangeError(
15159
+ `The format string mustn't contain \`${token}\` and any other token at the same time`
15160
+ );
15161
+ }
15162
+ usedTokens.push({ token: firstCharacter, fullToken: token });
15163
+ const parseResult = parser.run(
15164
+ dateStr,
15165
+ token,
15166
+ locale2.match,
15167
+ subFnOptions
15168
+ );
15169
+ if (!parseResult) {
15170
+ return constructFrom(referenceDate, NaN);
15171
+ }
15172
+ setters.push(parseResult.setter);
15173
+ dateStr = parseResult.rest;
15174
+ } else {
15175
+ if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
15176
+ throw new RangeError(
15177
+ "Format string contains an unescaped latin alphabet character `" + firstCharacter + "`"
15178
+ );
15179
+ }
15180
+ if (token === "''") {
15181
+ token = "'";
15182
+ } else if (firstCharacter === "'") {
15183
+ token = cleanEscapedString(token);
15184
+ }
15185
+ if (dateStr.indexOf(token) === 0) {
15186
+ dateStr = dateStr.slice(token.length);
15187
+ } else {
15188
+ return constructFrom(referenceDate, NaN);
15189
+ }
15190
+ }
15191
+ }
15192
+ if (dateStr.length > 0 && notWhitespaceRegExp.test(dateStr)) {
15193
+ return constructFrom(referenceDate, NaN);
15194
+ }
15195
+ const uniquePrioritySetters = setters.map((setter) => setter.priority).sort((a2, b2) => b2 - a2).filter((priority, index2, array2) => array2.indexOf(priority) === index2).map(
15196
+ (priority) => setters.filter((setter) => setter.priority === priority).sort((a2, b2) => b2.subPriority - a2.subPriority)
15197
+ ).map((setterArray) => setterArray[0]);
15198
+ let date2 = toDate(referenceDate);
15199
+ if (isNaN(date2.getTime())) {
15200
+ return constructFrom(referenceDate, NaN);
15201
+ }
15202
+ const flags = {};
15203
+ for (const setter of uniquePrioritySetters) {
15204
+ if (!setter.validate(date2, subFnOptions)) {
15205
+ return constructFrom(referenceDate, NaN);
15206
+ }
15207
+ const result = setter.set(date2, flags, subFnOptions);
15208
+ if (Array.isArray(result)) {
15209
+ date2 = result[0];
15210
+ Object.assign(flags, result[1]);
15211
+ } else {
15212
+ date2 = result;
15213
+ }
15214
+ }
15215
+ return constructFrom(referenceDate, date2);
15216
+ }
15217
+ function cleanEscapedString(input) {
15218
+ return input.match(escapedStringRegExp)[1].replace(doubleQuoteRegExp, "'");
13455
15219
  }
13456
15220
  function isSameMonth(dateLeft, dateRight) {
13457
15221
  const _dateLeft = toDate(dateLeft);
@@ -13466,6 +15230,184 @@ function isSameYear(dateLeft, dateRight) {
13466
15230
  function subDays(date2, amount) {
13467
15231
  return addDays(date2, -amount);
13468
15232
  }
15233
+ function parseISO(argument, options) {
15234
+ const additionalDigits = 2;
15235
+ const dateStrings = splitDateString(argument);
15236
+ let date2;
15237
+ if (dateStrings.date) {
15238
+ const parseYearResult = parseYear$1(dateStrings.date, additionalDigits);
15239
+ date2 = parseDate(parseYearResult.restDateString, parseYearResult.year);
15240
+ }
15241
+ if (!date2 || isNaN(date2.getTime())) {
15242
+ return /* @__PURE__ */ new Date(NaN);
15243
+ }
15244
+ const timestamp = date2.getTime();
15245
+ let time2 = 0;
15246
+ let offset2;
15247
+ if (dateStrings.time) {
15248
+ time2 = parseTime(dateStrings.time);
15249
+ if (isNaN(time2)) {
15250
+ return /* @__PURE__ */ new Date(NaN);
15251
+ }
15252
+ }
15253
+ if (dateStrings.timezone) {
15254
+ offset2 = parseTimezone(dateStrings.timezone);
15255
+ if (isNaN(offset2)) {
15256
+ return /* @__PURE__ */ new Date(NaN);
15257
+ }
15258
+ } else {
15259
+ const dirtyDate = new Date(timestamp + time2);
15260
+ const result = /* @__PURE__ */ new Date(0);
15261
+ result.setFullYear(
15262
+ dirtyDate.getUTCFullYear(),
15263
+ dirtyDate.getUTCMonth(),
15264
+ dirtyDate.getUTCDate()
15265
+ );
15266
+ result.setHours(
15267
+ dirtyDate.getUTCHours(),
15268
+ dirtyDate.getUTCMinutes(),
15269
+ dirtyDate.getUTCSeconds(),
15270
+ dirtyDate.getUTCMilliseconds()
15271
+ );
15272
+ return result;
15273
+ }
15274
+ return new Date(timestamp + time2 + offset2);
15275
+ }
15276
+ const patterns = {
15277
+ dateTimeDelimiter: /[T ]/,
15278
+ timeZoneDelimiter: /[Z ]/i,
15279
+ timezone: /([Z+-].*)$/
15280
+ };
15281
+ const dateRegex = /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/;
15282
+ const timeRegex = /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/;
15283
+ const timezoneRegex = /^([+-])(\d{2})(?::?(\d{2}))?$/;
15284
+ function splitDateString(dateString) {
15285
+ const dateStrings = {};
15286
+ const array2 = dateString.split(patterns.dateTimeDelimiter);
15287
+ let timeString;
15288
+ if (array2.length > 2) {
15289
+ return dateStrings;
15290
+ }
15291
+ if (/:/.test(array2[0])) {
15292
+ timeString = array2[0];
15293
+ } else {
15294
+ dateStrings.date = array2[0];
15295
+ timeString = array2[1];
15296
+ if (patterns.timeZoneDelimiter.test(dateStrings.date)) {
15297
+ dateStrings.date = dateString.split(patterns.timeZoneDelimiter)[0];
15298
+ timeString = dateString.substr(
15299
+ dateStrings.date.length,
15300
+ dateString.length
15301
+ );
15302
+ }
15303
+ }
15304
+ if (timeString) {
15305
+ const token = patterns.timezone.exec(timeString);
15306
+ if (token) {
15307
+ dateStrings.time = timeString.replace(token[1], "");
15308
+ dateStrings.timezone = token[1];
15309
+ } else {
15310
+ dateStrings.time = timeString;
15311
+ }
15312
+ }
15313
+ return dateStrings;
15314
+ }
15315
+ function parseYear$1(dateString, additionalDigits) {
15316
+ const regex = new RegExp(
15317
+ "^(?:(\\d{4}|[+-]\\d{" + (4 + additionalDigits) + "})|(\\d{2}|[+-]\\d{" + (2 + additionalDigits) + "})$)"
15318
+ );
15319
+ const captures = dateString.match(regex);
15320
+ if (!captures) return { year: NaN, restDateString: "" };
15321
+ const year = captures[1] ? parseInt(captures[1]) : null;
15322
+ const century = captures[2] ? parseInt(captures[2]) : null;
15323
+ return {
15324
+ year: century === null ? year : century * 100,
15325
+ restDateString: dateString.slice((captures[1] || captures[2]).length)
15326
+ };
15327
+ }
15328
+ function parseDate(dateString, year) {
15329
+ if (year === null) return /* @__PURE__ */ new Date(NaN);
15330
+ const captures = dateString.match(dateRegex);
15331
+ if (!captures) return /* @__PURE__ */ new Date(NaN);
15332
+ const isWeekDate = !!captures[4];
15333
+ const dayOfYear = parseDateUnit(captures[1]);
15334
+ const month = parseDateUnit(captures[2]) - 1;
15335
+ const day = parseDateUnit(captures[3]);
15336
+ const week = parseDateUnit(captures[4]);
15337
+ const dayOfWeek = parseDateUnit(captures[5]) - 1;
15338
+ if (isWeekDate) {
15339
+ if (!validateWeekDate(year, week, dayOfWeek)) {
15340
+ return /* @__PURE__ */ new Date(NaN);
15341
+ }
15342
+ return dayOfISOWeekYear(year, week, dayOfWeek);
15343
+ } else {
15344
+ const date2 = /* @__PURE__ */ new Date(0);
15345
+ if (!validateDate(year, month, day) || !validateDayOfYearDate(year, dayOfYear)) {
15346
+ return /* @__PURE__ */ new Date(NaN);
15347
+ }
15348
+ date2.setUTCFullYear(year, month, Math.max(dayOfYear, day));
15349
+ return date2;
15350
+ }
15351
+ }
15352
+ function parseDateUnit(value) {
15353
+ return value ? parseInt(value) : 1;
15354
+ }
15355
+ function parseTime(timeString) {
15356
+ const captures = timeString.match(timeRegex);
15357
+ if (!captures) return NaN;
15358
+ const hours = parseTimeUnit(captures[1]);
15359
+ const minutes = parseTimeUnit(captures[2]);
15360
+ const seconds = parseTimeUnit(captures[3]);
15361
+ if (!validateTime(hours, minutes, seconds)) {
15362
+ return NaN;
15363
+ }
15364
+ return hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * 1e3;
15365
+ }
15366
+ function parseTimeUnit(value) {
15367
+ return value && parseFloat(value.replace(",", ".")) || 0;
15368
+ }
15369
+ function parseTimezone(timezoneString) {
15370
+ if (timezoneString === "Z") return 0;
15371
+ const captures = timezoneString.match(timezoneRegex);
15372
+ if (!captures) return 0;
15373
+ const sign2 = captures[1] === "+" ? -1 : 1;
15374
+ const hours = parseInt(captures[2]);
15375
+ const minutes = captures[3] && parseInt(captures[3]) || 0;
15376
+ if (!validateTimezone(hours, minutes)) {
15377
+ return NaN;
15378
+ }
15379
+ return sign2 * (hours * millisecondsInHour + minutes * millisecondsInMinute);
15380
+ }
15381
+ function dayOfISOWeekYear(isoWeekYear, week, day) {
15382
+ const date2 = /* @__PURE__ */ new Date(0);
15383
+ date2.setUTCFullYear(isoWeekYear, 0, 4);
15384
+ const fourthOfJanuaryDay = date2.getUTCDay() || 7;
15385
+ const diff = (week - 1) * 7 + day + 1 - fourthOfJanuaryDay;
15386
+ date2.setUTCDate(date2.getUTCDate() + diff);
15387
+ return date2;
15388
+ }
15389
+ const daysInMonths = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
15390
+ function isLeapYearIndex(year) {
15391
+ return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;
15392
+ }
15393
+ function validateDate(year, month, date2) {
15394
+ return month >= 0 && month <= 11 && date2 >= 1 && date2 <= (daysInMonths[month] || (isLeapYearIndex(year) ? 29 : 28));
15395
+ }
15396
+ function validateDayOfYearDate(year, dayOfYear) {
15397
+ return dayOfYear >= 1 && dayOfYear <= (isLeapYearIndex(year) ? 366 : 365);
15398
+ }
15399
+ function validateWeekDate(_year, week, day) {
15400
+ return week >= 1 && week <= 53 && day >= 0 && day <= 6;
15401
+ }
15402
+ function validateTime(hours, minutes, seconds) {
15403
+ if (hours === 24) {
15404
+ return minutes === 0 && seconds === 0;
15405
+ }
15406
+ return seconds >= 0 && seconds < 60 && minutes >= 0 && minutes < 60 && hours >= 0 && hours < 25;
15407
+ }
15408
+ function validateTimezone(_hours, minutes) {
15409
+ return minutes >= 0 && minutes <= 59;
15410
+ }
13469
15411
  function setMonth(date2, month) {
13470
15412
  const _date = toDate(date2);
13471
15413
  const year = _date.getFullYear();
@@ -16421,7 +18363,7 @@ const filterData = (data, value = "") => {
16421
18363
  if (value === "" || value === null) {
16422
18364
  return data;
16423
18365
  }
16424
- const filteredOptionValues = /* @__PURE__ */ new Set();
18366
+ const filteredOptions = [];
16425
18367
  const shouldFilterOption = (option) => {
16426
18368
  if (option.disabled) {
16427
18369
  return false;
@@ -16431,13 +18373,22 @@ const filterData = (data, value = "") => {
16431
18373
  data.forEach((option) => {
16432
18374
  if (shouldFilterOption(option)) {
16433
18375
  const parents = getOptionParents(data, option.path);
16434
- filteredOptionValues.add(option.value);
18376
+ const index2 = option.text.toString().toLocaleLowerCase().indexOf(value.toString().toLocaleLowerCase());
18377
+ filteredOptions.push({ value: option.value, score: index2 });
16435
18378
  if (parents !== null) {
16436
- parents.forEach((option2) => filteredOptionValues.add(option2 == null ? void 0 : option2.value));
18379
+ parents.forEach((option2) => filteredOptions.push({ value: option2 == null ? void 0 : option2.value }));
16437
18380
  }
16438
18381
  }
16439
18382
  });
16440
- return data.filter(({ value: value2 }) => filteredOptionValues.has(value2));
18383
+ return data.filter(({ value: value2 }) => filteredOptions.find((x2) => x2.value === value2)).toSorted((a2, b2) => {
18384
+ var _a, _b;
18385
+ const scoreA = (_a = filteredOptions.find((x2) => x2.value === a2.value)) == null ? void 0 : _a.score;
18386
+ const scoreB = (_b = filteredOptions.find((x2) => x2.value === b2.value)) == null ? void 0 : _b.score;
18387
+ if (scoreA !== void 0 && scoreB !== void 0) {
18388
+ return scoreA - scoreB;
18389
+ }
18390
+ return 0;
18391
+ });
16441
18392
  };
16442
18393
  const debouncer = debounce$1((f2) => f2(), 200);
16443
18394
  const convertToInputValue = (value) => String(value ?? "");
@@ -16562,6 +18513,9 @@ const useCombobox = (props, ref) => {
16562
18513
  };
16563
18514
  const handleInputKeyDown = (event) => {
16564
18515
  event.persist();
18516
+ if (isElementInsideTable3OrReport(event.currentTarget) && (event.key === "ArrowUp" || event.key === "ArrowDown") && open) {
18517
+ event.stopPropagation();
18518
+ }
16565
18519
  if (!event.ctrlKey && !event.metaKey) {
16566
18520
  switch (event.key) {
16567
18521
  case "Backspace": {
@@ -16865,11 +18819,12 @@ const useDatepicker = ({ defaultValue: _, calendar: calendar2, onBlur, onChange,
16865
18819
  );
16866
18820
  const formattedValue = valueAsDate ? format$1(valueAsDate) || "" : "";
16867
18821
  event.target.value = formattedValue;
18822
+ const isEmpty = !event.target.value.trim();
16868
18823
  if (onChange) {
16869
- event.detail = valueAsDate;
18824
+ event.detail = !isEmpty ? valueAsDate : null;
16870
18825
  onChange(event);
16871
18826
  } else {
16872
- setInternalValue(formattedValue);
18827
+ setInternalValue(!isEmpty ? formattedValue : "");
16873
18828
  }
16874
18829
  if (onBlur) {
16875
18830
  onBlur(event);
@@ -32742,6 +34697,121 @@ var TableFilterComparator = /* @__PURE__ */ ((TableFilterComparator2) => {
32742
34697
  TableFilterComparator2[TableFilterComparator2["IsNoneOf"] = 15] = "IsNoneOf";
32743
34698
  return TableFilterComparator2;
32744
34699
  })(TableFilterComparator || {});
34700
+ class DataType {
34701
+ }
34702
+ const localeNumberSeparators = /* @__PURE__ */ new Map();
34703
+ class NumericDataType extends DataType {
34704
+ static format(value, locale2, options) {
34705
+ const localisedValue = new Intl.NumberFormat(locale2, options).format(value);
34706
+ return localisedValue.replace(/[\u00A0\u202F]/g, " ");
34707
+ }
34708
+ static parse(value, locale2) {
34709
+ if (value === void 0 || value === null || typeof value !== "string") {
34710
+ return void 0;
34711
+ }
34712
+ if (value === "Infinity" || value === "-Infinity") {
34713
+ return Number(value);
34714
+ }
34715
+ let sanitizedValue = value.replaceAll(" ", "").replace(/[^0-9.,-]+/g, "");
34716
+ if (!sanitizedValue.length) {
34717
+ return void 0;
34718
+ }
34719
+ const decimalSeparator = this.getSeparator(locale2);
34720
+ if (decimalSeparator === ",") {
34721
+ sanitizedValue = sanitizedValue.replaceAll(".", "").replace(",", ".");
34722
+ } else {
34723
+ sanitizedValue = sanitizedValue.replaceAll(",", "");
34724
+ }
34725
+ const output = Number(sanitizedValue);
34726
+ if (isNaN(output)) {
34727
+ return void 0;
34728
+ }
34729
+ return output;
34730
+ }
34731
+ static getSeparator(locale2) {
34732
+ var _a;
34733
+ if (localeNumberSeparators.has(locale2)) {
34734
+ return localeNumberSeparators.get(locale2);
34735
+ }
34736
+ const decimalSeparator = ((_a = new Intl.NumberFormat(locale2).formatToParts(1.1).find((part) => part.type === "decimal")) == null ? void 0 : _a.value) ?? ".";
34737
+ localeNumberSeparators.set(locale2, decimalSeparator);
34738
+ return decimalSeparator;
34739
+ }
34740
+ }
34741
+ const localeDateMasks = /* @__PURE__ */ new Map();
34742
+ class DateTimeDataType extends DataType {
34743
+ static format(value, locale2, options) {
34744
+ let date2;
34745
+ if (typeof value === "string") {
34746
+ date2 = new Date(value);
34747
+ } else if (value instanceof Date) {
34748
+ date2 = value;
34749
+ } else {
34750
+ return "";
34751
+ }
34752
+ if (isNaN(date2.getTime())) {
34753
+ return "";
34754
+ }
34755
+ return new Intl.DateTimeFormat(locale2, options).format(date2).replace(/[\u00A0\u202F]/g, " ");
34756
+ }
34757
+ static parse(value, locale2) {
34758
+ if (value === void 0 || value === null || typeof value !== "string") {
34759
+ return void 0;
34760
+ }
34761
+ const sanitizedValue = value == null ? void 0 : value.trim();
34762
+ if (!(sanitizedValue == null ? void 0 : sanitizedValue.length)) {
34763
+ return void 0;
34764
+ }
34765
+ const setHoursToMidday = (date2) => {
34766
+ date2.setHours(12 - date2.getTimezoneOffset() / 60);
34767
+ };
34768
+ try {
34769
+ const date2 = parseISO(sanitizedValue);
34770
+ if (isValid(date2)) {
34771
+ const timeRegex2 = /^\d{2}:\d{2}(?::\d{2}\.\d+|:\d{2})?(?:Z)?$/;
34772
+ const time2 = sanitizedValue.split("T")[1];
34773
+ if (!time2 || !timeRegex2.test(time2)) {
34774
+ setHoursToMidday(date2);
34775
+ }
34776
+ return date2;
34777
+ }
34778
+ } catch {
34779
+ }
34780
+ const mask = this.getMask(locale2);
34781
+ if (mask) {
34782
+ try {
34783
+ const date2 = parse$2(sanitizedValue, mask, /* @__PURE__ */ new Date());
34784
+ if (isValid(date2)) {
34785
+ setHoursToMidday(date2);
34786
+ return date2;
34787
+ }
34788
+ } catch {
34789
+ }
34790
+ }
34791
+ return void 0;
34792
+ }
34793
+ static getMask(locale2) {
34794
+ if (localeDateMasks.has(locale2)) {
34795
+ return localeDateMasks.get(locale2);
34796
+ }
34797
+ const parts = new Intl.DateTimeFormat(locale2).formatToParts(/* @__PURE__ */ new Date());
34798
+ const mask = parts.reduce((mask2, part) => {
34799
+ switch (part.type) {
34800
+ case "literal":
34801
+ return mask2 + part.value;
34802
+ case "day":
34803
+ return mask2 + "dd";
34804
+ case "month":
34805
+ return mask2 + "MM";
34806
+ case "year":
34807
+ return mask2 + "yyyy";
34808
+ }
34809
+ return mask2;
34810
+ }, "");
34811
+ localeDateMasks.set(locale2, mask);
34812
+ return mask;
34813
+ }
34814
+ }
32745
34815
  const dataTypes = {
32746
34816
  auto: {
32747
34817
  sortingFn: "auto",
@@ -32806,15 +34876,13 @@ function createDatetimeDataType(defaultOptions2) {
32806
34876
  TableFilterComparator.IsEmpty,
32807
34877
  TableFilterComparator.IsNotEmpty
32808
34878
  ],
32809
- getDisplayValue: (value, row, options) => {
32810
- var _a;
34879
+ getDisplayValue: (value, _, options) => {
32811
34880
  if (value === void 0) {
32812
34881
  return "";
32813
34882
  }
32814
- return new Intl.DateTimeFormat((_a = options == null ? void 0 : options.localization) == null ? void 0 : _a.locale, defaultOptions2).format(
32815
- typeof value === "string" ? Date.parse(value) : value
32816
- );
32817
- }
34883
+ return DateTimeDataType.format(value, options == null ? void 0 : options.localization.locale, defaultOptions2);
34884
+ },
34885
+ parse: (value, locale2) => DateTimeDataType.parse(value, locale2)
32818
34886
  };
32819
34887
  }
32820
34888
  function createNumberDataType(align, defaultOptions2) {
@@ -32822,6 +34890,8 @@ function createNumberDataType(align, defaultOptions2) {
32822
34890
  align,
32823
34891
  sortingFn: "basic",
32824
34892
  filterComparators: [
34893
+ TableFilterComparator.Contains,
34894
+ TableFilterComparator.DoesNotContain,
32825
34895
  TableFilterComparator.IsEqualTo,
32826
34896
  TableFilterComparator.IsNotEqualTo,
32827
34897
  TableFilterComparator.IsGreaterThan,
@@ -32833,10 +34903,6 @@ function createNumberDataType(align, defaultOptions2) {
32833
34903
  TableFilterComparator.IsNotEmpty
32834
34904
  ],
32835
34905
  getDisplayValue: (value, row, options) => {
32836
- var _a, _b;
32837
- if (value === void 0) {
32838
- return "";
32839
- }
32840
34906
  const dataTypeOptions = typeof (options == null ? void 0 : options.dataTypeOptions) === "function" ? options == null ? void 0 : options.dataTypeOptions(row) : options == null ? void 0 : options.dataTypeOptions;
32841
34907
  const numberFormatOptions = {
32842
34908
  // format
@@ -32852,20 +34918,14 @@ function createNumberDataType(align, defaultOptions2) {
32852
34918
  numberFormatOptions.currency = dataTypeOptions.currency;
32853
34919
  numberFormatOptions.currencyDisplay = "code";
32854
34920
  }
32855
- let localisedValue = new Intl.NumberFormat((_a = options == null ? void 0 : options.localization) == null ? void 0 : _a.locale, numberFormatOptions).format(Number(value));
32856
- if (!numberFormatOptions.useGrouping) {
32857
- return localisedValue;
32858
- }
32859
- let localisedValueWithoutThousandsSeperator = new Intl.NumberFormat((_b = options == null ? void 0 : options.localization) == null ? void 0 : _b.locale, {
34921
+ const localisedValue = NumericDataType.format(value, options == null ? void 0 : options.localization.locale, numberFormatOptions);
34922
+ const localisedValueWithoutThousandsSeperator = NumericDataType.format(value, options == null ? void 0 : options.localization.locale, {
32860
34923
  ...numberFormatOptions,
32861
34924
  useGrouping: false
32862
- }).format(Number(value));
32863
- if (numberFormatOptions.style === "percent" || numberFormatOptions.style === "currency") {
32864
- localisedValue = localisedValue.replace(/\u00A0/g, " ");
32865
- localisedValueWithoutThousandsSeperator = localisedValueWithoutThousandsSeperator.replace(/\u00A0/g, " ");
32866
- }
34925
+ });
32867
34926
  return [localisedValue, localisedValueWithoutThousandsSeperator];
32868
- }
34927
+ },
34928
+ parse: (value, locale2) => NumericDataType.parse(value, locale2)
32869
34929
  };
32870
34930
  }
32871
34931
  function getDataTypeProperties(dataType) {
@@ -32883,103 +34943,121 @@ function getSortingFn(dataType, customFnOrBuiltIn) {
32883
34943
  const toLowerCase = (value) => String(value ?? "").toLocaleLowerCase();
32884
34944
  const isWeakContains = (left, right) => toLowerCase(left).includes(toLowerCase(right));
32885
34945
  const isWeakEqual = (left, right) => toLowerCase(left) === toLowerCase(right);
32886
- function columnFilterFn(value, filter2) {
34946
+ function columnFilterFn(row, cellValue, meta, filter2, localization) {
32887
34947
  try {
34948
+ const query = filter2.value;
34949
+ const { dataType, dataTypeOptions } = meta ?? {};
32888
34950
  if (filter2.comparator === TableFilterComparator.IsEmpty || filter2.comparator === TableFilterComparator.IsNotEmpty) {
32889
- const isEmpty = value === void 0 || value === null || value === "";
34951
+ const isEmpty = cellValue === void 0 || cellValue === null || cellValue === "";
32890
34952
  return filter2.comparator === TableFilterComparator.IsEmpty ? isEmpty : !isEmpty;
32891
34953
  }
32892
- if (filter2.value === void 0 || filter2.value === null || filter2.value === "") {
34954
+ if (query === void 0 || query === null || query === "") {
32893
34955
  return true;
32894
34956
  }
32895
- const valueAsDate = new Date(value);
34957
+ const evaluate = (matcher) => {
34958
+ return isMatched(query, cellValue, row, dataType, dataTypeOptions, localization, matcher);
34959
+ };
34960
+ const isDateColumn = dataType === "date" || dataType === "datetime";
34961
+ const valueAsDate = new Date(cellValue);
34962
+ const isNumberColumn = dataType === "number" || dataType === "amount";
34963
+ const compareNumbers2 = (fn) => {
34964
+ const input = typeof query === "number" ? query : NumericDataType.parse(query, localization.locale);
34965
+ const value = cellValue;
34966
+ if (input === void 0) {
34967
+ return false;
34968
+ }
34969
+ return fn(input, value);
34970
+ };
32896
34971
  switch (filter2.comparator) {
32897
34972
  case TableFilterComparator.Contains:
32898
- return isWeakContains(value, filter2.value);
34973
+ return evaluate(isWeakContains);
32899
34974
  case TableFilterComparator.DoesNotContain:
32900
- return !isWeakContains(value, filter2.value);
34975
+ return !evaluate(isWeakContains);
32901
34976
  case TableFilterComparator.IsEqualTo: {
32902
- if (isDate(valueAsDate)) {
32903
- return isDate(filter2.value) && isWeakEqual$1(valueAsDate, filter2.value);
32904
- } else if (typeof filter2.value === "boolean") {
32905
- return value === filter2.value;
34977
+ if (dataType === "boolean") {
34978
+ return cellValue === query;
34979
+ } else if (isDateColumn) {
34980
+ return isWeakEqual$1(query, valueAsDate);
32906
34981
  }
32907
- return isWeakEqual(value, filter2.value);
34982
+ return evaluate(isWeakEqual);
32908
34983
  }
32909
34984
  case TableFilterComparator.IsNotEqualTo: {
32910
- if (isDate(valueAsDate)) {
32911
- return isDate(filter2.value) && isWeakEqual$1(valueAsDate, filter2.value) === false;
32912
- } else if (typeof filter2.value === "boolean") {
32913
- return value !== filter2.value;
34985
+ if (dataType === "boolean") {
34986
+ return cellValue !== query;
34987
+ } else if (isDateColumn) {
34988
+ return !isWeakEqual$1(query, valueAsDate);
32914
34989
  }
32915
- return !isWeakEqual(value, filter2.value);
34990
+ return !evaluate(isWeakEqual);
32916
34991
  }
32917
34992
  case TableFilterComparator.IsGreaterThan: {
32918
- if (isDate(valueAsDate)) {
32919
- return isDate(filter2.value) && isAfter(valueAsDate, filter2.value);
32920
- } else {
32921
- const valueAsNumber = parseInt(value);
32922
- return !isNaN(valueAsNumber) && filter2.value !== void 0 && valueAsNumber > filter2.value;
34993
+ if (isDateColumn) {
34994
+ return query.getTime() < valueAsDate.getTime();
34995
+ } else if (isNumberColumn) {
34996
+ return compareNumbers2((q, v2) => q < v2);
32923
34997
  }
34998
+ return false;
32924
34999
  }
32925
35000
  case TableFilterComparator.IsLessThan: {
32926
- if (isDate(valueAsDate)) {
32927
- return isDate(filter2.value) && isBefore(valueAsDate, filter2.value);
32928
- } else {
32929
- const valueAsNumber = parseInt(value);
32930
- return !isNaN(valueAsNumber) && filter2.value !== void 0 && valueAsNumber < filter2.value;
35001
+ if (isDateColumn) {
35002
+ return query.getTime() > valueAsDate.getTime();
35003
+ } else if (isNumberColumn) {
35004
+ return compareNumbers2((q, v2) => q > v2);
32931
35005
  }
35006
+ return false;
32932
35007
  }
32933
35008
  case TableFilterComparator.IsLessThanOrEqualTo: {
32934
- if (isDate(valueAsDate)) {
32935
- return isDate(filter2.value) && (isBefore(valueAsDate, filter2.value) || isEqual$2(valueAsDate, filter2.value));
32936
- } else {
32937
- const valueAsNumber = parseInt(value);
32938
- return !isNaN(valueAsNumber) && filter2.value !== void 0 && valueAsNumber <= filter2.value;
35009
+ if (isDateColumn) {
35010
+ return query.getTime() > valueAsDate.getTime() || isWeakEqual$1(valueAsDate, query);
35011
+ } else if (isNumberColumn) {
35012
+ return compareNumbers2((q, v2) => q >= v2);
32939
35013
  }
35014
+ return false;
32940
35015
  }
32941
35016
  case TableFilterComparator.IsGreaterThanOrEqualTo: {
32942
- if (isDate(valueAsDate)) {
32943
- return isDate(filter2.value) && (isAfter(valueAsDate, filter2.value) || isEqual$2(valueAsDate, filter2.value));
32944
- } else {
32945
- const valueAsNumber = parseInt(value);
32946
- return !isNaN(valueAsNumber) && filter2.value !== void 0 && valueAsNumber >= filter2.value;
35017
+ if (isDateColumn) {
35018
+ return query.getTime() < valueAsDate.getTime() || isWeakEqual$1(valueAsDate, query);
35019
+ } else if (isNumberColumn) {
35020
+ return compareNumbers2((q, v2) => q <= v2);
32947
35021
  }
35022
+ return false;
32948
35023
  }
32949
35024
  case TableFilterComparator.IsBetween: {
32950
- const [fromValue, toValue2] = filter2.value;
32951
- if (isDate(valueAsDate)) {
32952
- if (isDate(fromValue) && isBefore(valueAsDate, fromValue)) {
35025
+ const [fromValue, toValue2] = query;
35026
+ if (isDateColumn) {
35027
+ if (fromValue !== void 0 && valueAsDate.getTime() < fromValue.getTime()) {
32953
35028
  return false;
32954
- } else if (isDate(toValue2) && isAfter(valueAsDate, toValue2)) {
35029
+ } else if (toValue2 !== void 0 && valueAsDate.getTime() > toValue2.getTime()) {
32955
35030
  return false;
32956
35031
  }
32957
35032
  return true;
32958
- } else {
32959
- const valueAsNumber = parseInt(value);
32960
- if (isNaN(valueAsNumber)) {
35033
+ } else if (isNumberColumn) {
35034
+ if (fromValue !== void 0 && cellValue < fromValue) {
32961
35035
  return false;
32962
- }
32963
- if (fromValue !== void 0 && valueAsNumber < fromValue) {
32964
- return false;
32965
- } else if (toValue2 !== void 0 && valueAsNumber > toValue2) {
35036
+ } else if (toValue2 !== void 0 && cellValue > toValue2) {
32966
35037
  return false;
32967
35038
  }
32968
35039
  return true;
32969
35040
  }
35041
+ return false;
32970
35042
  }
32971
35043
  case TableFilterComparator.HasAnyOf:
32972
- return Array.isArray(filter2.value) && Array.isArray(value) ? filter2.value.some((item) => value.includes(item)) : false;
35044
+ return Array.isArray(query) && Array.isArray(cellValue) ? query.some((item) => cellValue.includes(item)) : false;
32973
35045
  case TableFilterComparator.HasNoneOf:
32974
- return Array.isArray(filter2.value) && Array.isArray(value) ? filter2.value.every((item) => value.includes(item) === false) : false;
35046
+ return Array.isArray(query) && Array.isArray(cellValue) ? query.every((item) => cellValue.includes(item) === false) : false;
32975
35047
  case TableFilterComparator.HasAllOf:
32976
- return Array.isArray(filter2.value) && Array.isArray(value) ? filter2.value.filter((v2) => value.includes(v2)).length === filter2.value.length : false;
32977
- case TableFilterComparator.IsOneOf:
32978
- if (!Array.isArray(filter2.value)) return false;
32979
- return filter2.value.some((v2) => isWeakEqual(value, v2));
32980
- case TableFilterComparator.IsNoneOf:
32981
- if (!Array.isArray(filter2.value)) return false;
32982
- return filter2.value.every((v2) => !isWeakEqual(value, v2));
35048
+ return Array.isArray(query) && Array.isArray(cellValue) ? query.filter((v2) => cellValue.includes(v2)).length === query.length : false;
35049
+ case TableFilterComparator.IsOneOf: {
35050
+ if (!Array.isArray(query)) {
35051
+ return false;
35052
+ }
35053
+ return query.some((v2) => isWeakEqual(String(cellValue), v2));
35054
+ }
35055
+ case TableFilterComparator.IsNoneOf: {
35056
+ if (!Array.isArray(query)) {
35057
+ return false;
35058
+ }
35059
+ return query.every((v2) => !isWeakEqual(String(cellValue), v2));
35060
+ }
32983
35061
  }
32984
35062
  return false;
32985
35063
  } catch (e3) {
@@ -32990,12 +35068,12 @@ function columnFilterFn(value, filter2) {
32990
35068
  const flattenCellValue = (cellValue) => {
32991
35069
  return typeof cellValue === "object" ? Object.values(cellValue).map(flattenCellValue) : cellValue;
32992
35070
  };
32993
- function isMatched(searchQuery, cellValue, rowValue, dataType, dataTypeOptions, localization) {
35071
+ function isMatched(query, cellValue, rowValue, dataType, dataTypeOptions, localization, matcher = isWeakContains) {
32994
35072
  if (typeof cellValue === "object") {
32995
- return flattenCellValue(cellValue).flat(Infinity).find((y2) => isWeakContains(y2, searchQuery));
35073
+ return flattenCellValue(cellValue).flat(Infinity).find((y2) => matcher(y2, query));
32996
35074
  } else {
32997
35075
  const cellValueAsString = String(cellValue ?? "");
32998
- if (cellValueAsString !== void 0 && isWeakContains(cellValueAsString, searchQuery)) {
35076
+ if (cellValueAsString !== void 0 && matcher(cellValueAsString, query)) {
32999
35077
  return true;
33000
35078
  } else {
33001
35079
  const dataTypeProperties = getDataTypeProperties(dataType);
@@ -33005,12 +35083,14 @@ function isMatched(searchQuery, cellValue, rowValue, dataType, dataTypeOptions,
33005
35083
  localization
33006
35084
  });
33007
35085
  if (Array.isArray(cellDisplayValue)) {
33008
- for (const displayValue of cellDisplayValue) {
33009
- if (isWeakContains(displayValue, searchQuery)) {
33010
- return true;
33011
- }
33012
- }
33013
- } else if (cellDisplayValue !== void 0 && isWeakContains(cellDisplayValue, searchQuery)) {
35086
+ return cellDisplayValue.some((cdv) => matcher(cdv, query));
35087
+ } else if (cellDisplayValue !== void 0 && isWeakContains(cellDisplayValue, query)) {
35088
+ return true;
35089
+ }
35090
+ }
35091
+ if (typeof query !== typeof cellValue && dataTypeProperties.parse) {
35092
+ const parsedQuery = dataTypeProperties.parse(query, localization.locale);
35093
+ if (parsedQuery !== void 0 && matcher(cellValue, parsedQuery)) {
33014
35094
  return true;
33015
35095
  }
33016
35096
  }
@@ -33456,7 +35536,11 @@ function configureReactTableOptions(options, props, localization) {
33456
35536
  else {
33457
35537
  tableOptions.getFilteredRowModel = getFilteredRowModel();
33458
35538
  tableOptions.filterFns = {
33459
- tacoFilter: (row, columnId, filter2) => columnFilterFn(row.getValue(columnId), filter2)
35539
+ tacoFilter: (row, columnId, filter2) => {
35540
+ var _a;
35541
+ const meta = (_a = row._getAllCellsByColumnId()[columnId]) == null ? void 0 : _a.column.columnDef.meta;
35542
+ return columnFilterFn(row.original, row.getValue(columnId), meta, filter2, localization);
35543
+ }
33460
35544
  };
33461
35545
  }
33462
35546
  }
@@ -33972,8 +36056,10 @@ function useTableRowSelection(isEnabled = false) {
33972
36056
  lastSelectedRowIndex
33973
36057
  };
33974
36058
  }
33975
- function useTableSearch(isEnabled = false, onChangeSearch, defaultEnableGlobalFilter = false) {
33976
- const [enableGlobalFilter, _setEnableGlobalFilter] = React__default.useState(defaultEnableGlobalFilter);
36059
+ function useTableSearch(isEnabled = false, onChangeSearch, defaultEnableGlobalFilter = false, _experimentalDataLoader2 = false) {
36060
+ const [enableGlobalFilter, _setEnableGlobalFilter] = React__default.useState(
36061
+ _experimentalDataLoader2 || defaultEnableGlobalFilter
36062
+ );
33977
36063
  function setEnableGlobalFilter(enabled, instance) {
33978
36064
  _setEnableGlobalFilter(enabled);
33979
36065
  const currentFilter = instance.getState().globalFilter;
@@ -34548,7 +36634,12 @@ function useTableManager(props, ref, meta, internalColumns) {
34548
36634
  const rowGroups = useTableRowGroups(props.rowActionsForGroup);
34549
36635
  const rowHeight = useTableRowHeight(options.enableRowHeight, settings.rowHeight);
34550
36636
  const rowSelection = useTableRowSelection(!!options.enableRowSelection);
34551
- const search = useTableSearch(options.enableSearch, props.onChangeSearch, settings.excludeUnmatchedRecordsInSearch);
36637
+ const search = useTableSearch(
36638
+ options.enableSearch,
36639
+ props.onChangeSearch,
36640
+ settings.excludeUnmatchedRecordsInSearch,
36641
+ props._experimentalDataLoader2
36642
+ );
34552
36643
  const server = useTableServerLoading(
34553
36644
  length,
34554
36645
  data,
@@ -34814,10 +36905,11 @@ function useTableGlobalShortcuts(table, tableRef, scrollToIndex, localShortcuts
34814
36905
  const handleKeyDown = (event) => {
34815
36906
  var _a;
34816
36907
  const trigger = event.target;
34817
- if (isElementInsideOverlay(trigger) && !isSiblingElementInsideSameParentOverlay(trigger, tableRef.current) || isElementInteractive(trigger) && !isElementInsideOrTriggeredFromContainer(trigger, tableRef.current)) {
36908
+ if (isElementInsideExternalRelatedOverlay(trigger, tableRef)) {
34818
36909
  return;
34819
36910
  }
34820
- tableMeta.rowActive.handleKeyDown(event, tableMeta.length, scrollToIndex);
36911
+ const reachableRows = tableMeta.length + table.getBottomRows().length;
36912
+ tableMeta.rowActive.handleKeyDown(event, reachableRows, scrollToIndex);
34821
36913
  tableMeta.rowSelection.handleKeyDown(event, table);
34822
36914
  if (tableMeta.rowActive.rowActiveIndex !== void 0) {
34823
36915
  tableMeta.rowClick.handleKeyDown(event, (_a = rows[tableMeta.rowActive.rowActiveIndex]) == null ? void 0 : _a.original);
@@ -35851,9 +37943,7 @@ function Actions(props) {
35851
37943
  const visibleActions = actions.map((action) => action(data, rowId, tableMeta.rowActions.handlers["cleanup"], table)).filter((action) => !!action);
35852
37944
  const actionsOnRow = visibleActions.length === actionsLength ? visibleActions : visibleActions.slice(0, actionsLength - 1);
35853
37945
  const actionsInMenu = visibleActions.slice(visibleActions.length === actionsLength ? actionsLength : actionsLength - 1);
35854
- const className = clsx(
35855
- "flex justify-end text-right bg-[inherit] shadow-[-6px_0px_6px_var(--table-row-actions-shadow)] print:hidden"
35856
- );
37946
+ const className = clsx("flex justify-end text-right bg-[inherit] print:hidden");
35857
37947
  return /* @__PURE__ */ React__default.createElement("span", { className }, actionsOnRow.map((button, index2) => {
35858
37948
  const tooltip = String(button.props.tooltip ?? button.props["aria-label"] ?? "");
35859
37949
  return React__default.cloneElement(button, {
@@ -35910,7 +38000,8 @@ const renderer$3 = {
35910
38000
  'print:opacity-0 !px-0 !pr-1 overflow-hidden [table_&]:group-[[data-row-active="true"]]/row:sticky right-0',
35911
38001
  'group-[[data-row-active="true"][data-selected="false"]]/row:text-grey-200',
35912
38002
  'group-[[data-row-selected="true"]]/row:text-blue-100',
35913
- 'group-[[data-row-selected="false"]:hover]/row:text-grey-100'
38003
+ 'group-[[data-row-selected="false"]:hover]/row:text-grey-100',
38004
+ "shadow-[-6px_0px_6px_var(--table-row-actions-shadow)]"
35914
38005
  ),
35915
38006
  // TODO: remove when table3 is migrated, this satisfies the legacy table3 type
35916
38007
  enableSearch: false,
@@ -36408,7 +38499,7 @@ function DisplayCell(props) {
36408
38499
  } else {
36409
38500
  content = typeof cell.column.columnDef.cell === "function" ? cell.column.columnDef.cell(cell.getContext()) : cell.getValue();
36410
38501
  }
36411
- return /* @__PURE__ */ React__default.createElement(MemoedDisplayCell, { ...cellAttributes, ...attributes, cellRef, isTruncated }, content);
38502
+ return /* @__PURE__ */ React__default.createElement(MemoedDisplayCell, { ...cellAttributes, ...attributes, cellRef, isTruncated }, content ?? columnMeta.emptyState);
36412
38503
  }
36413
38504
  const MemoedDisplayCell = React__default.memo(function MemoedDisplayCell2(props) {
36414
38505
  const { cellRef, children, isTruncated, ...cellAttributes } = props;
@@ -36962,7 +39053,20 @@ function useAugmentedFocusManager() {
36962
39053
  const focusManager = $9bf71ea28793e738$export$10c5169755ce7bd7();
36963
39054
  const focusPrevious = (arrowNavigation = false) => focusManager == null ? void 0 : focusManager.focusPrevious(arrowNavigation ? FOCUS_MANAGER_OPTIONS_ARROW_KEYS : FOCUS_MANAGER_OPTIONS_TAB);
36964
39055
  const focusNext = (arrowNavigation = false) => focusManager == null ? void 0 : focusManager.focusNext(arrowNavigation ? FOCUS_MANAGER_OPTIONS_ARROW_KEYS : FOCUS_MANAGER_OPTIONS_TAB);
36965
- const focusFirst = () => focusManager == null ? void 0 : focusManager.focusFirst(FOCUS_MANAGER_OPTIONS_TAB);
39056
+ const focusFirst = () => {
39057
+ return focusManager == null ? void 0 : focusManager.focusFirst({
39058
+ ...FOCUS_MANAGER_OPTIONS_TAB,
39059
+ accept: (element) => {
39060
+ if (!FOCUS_MANAGER_OPTIONS_TAB.accept(element)) {
39061
+ return false;
39062
+ }
39063
+ if (element.closest('[data-taco="cell-control"]')) {
39064
+ return true;
39065
+ }
39066
+ return false;
39067
+ }
39068
+ });
39069
+ };
36966
39070
  const focusLast = () => focusManager == null ? void 0 : focusManager.focusLast(FOCUS_MANAGER_OPTIONS_TAB);
36967
39071
  return {
36968
39072
  focusPrevious,
@@ -36982,7 +39086,8 @@ function Body(props) {
36982
39086
  }
36983
39087
  if (tableMeta.rowActive.rowActiveIndex !== void 0) {
36984
39088
  const isFirstRow = tableMeta.rowActive.rowActiveIndex === 0;
36985
- const isLastRow = tableMeta.rowActive.rowActiveIndex === tableMeta.length - 1;
39089
+ const reachableRows = tableMeta.length + table.getBottomRows().length;
39090
+ const isLastRow = tableMeta.rowActive.rowActiveIndex === reachableRows - 1;
36986
39091
  if (event.key === "Tab" || enableHorizontalArrowKeyNavigation && (event.key === "ArrowLeft" || event.key === "ArrowRight")) {
36987
39092
  if (event.key === "Tab" && !hasFocusableElement(event.target.closest("tr[data-row-id]"))) {
36988
39093
  return;
@@ -37425,7 +39530,7 @@ function Search$1(props) {
37425
39530
  tableMeta.search.setCurrentHighlightColumnIndex(nextIndex);
37426
39531
  scrollTo2(tableMeta.search.highlightedColumnIndexes[nextIndex][0]);
37427
39532
  };
37428
- const settings = /* @__PURE__ */ React__default.createElement(
39533
+ const settings = tableMeta.server._experimentalDataLoader2 ? void 0 : /* @__PURE__ */ React__default.createElement(
37429
39534
  Switch$1,
37430
39535
  {
37431
39536
  label: texts.table.search.excludeUnmatchedResults,
@@ -42335,6 +44440,9 @@ const Search = React__default.forwardRef(function ListboxSearch(props, ref) {
42335
44440
  if (event.key === " ") {
42336
44441
  return;
42337
44442
  }
44443
+ if ((event.key === "ArrowLeft" || event.key === "ArrowRight") && event.currentTarget.value.length) {
44444
+ event.stopPropagation();
44445
+ }
42338
44446
  if (isAriaSelectionKey(event) || event.key === "ArrowDown" || event.key === "ArrowUp") {
42339
44447
  event.preventDefault();
42340
44448
  (_a = listboxRef == null ? void 0 : listboxRef.current) == null ? void 0 : _a.dispatchEvent(createCustomKeyboardEvent(event));
@@ -42598,14 +44706,28 @@ const Select22 = React__default.forwardRef(function Select222(props, ref) {
42598
44706
  }
42599
44707
  (_a = listboxRef.current) == null ? void 0 : _a.dispatchEvent(createCustomKeyboardEvent(event));
42600
44708
  };
42601
- const shouldFocusNextRef = React__default.useRef(false);
44709
+ const shouldFocusNextRef = React__default.useRef(void 0);
44710
+ React__default.useEffect(() => {
44711
+ const handleKeyDown2 = (event) => {
44712
+ if (event.key === "ArrowLeft" || event.key === "ArrowRight") {
44713
+ shouldFocusNextRef.current = event.key === "ArrowLeft" ? -1 : 1;
44714
+ setOpen(false);
44715
+ }
44716
+ };
44717
+ if (isElementInsideTable3OrReport(internalRef.current)) {
44718
+ document.addEventListener("keydown", handleKeyDown2);
44719
+ }
44720
+ return () => {
44721
+ document.removeEventListener("keydown", handleKeyDown2);
44722
+ };
44723
+ }, []);
42602
44724
  const handleListboxKeyDown = (event) => {
42603
44725
  if (isAriaDirectionKey(event)) {
42604
44726
  setShouldPauseHoverState(true);
42605
44727
  return;
42606
44728
  }
42607
44729
  if (event.key === "Tab") {
42608
- shouldFocusNextRef.current = true;
44730
+ shouldFocusNextRef.current = event.shiftKey ? -1 : 1;
42609
44731
  setOpen(false);
42610
44732
  return;
42611
44733
  }
@@ -42616,11 +44738,11 @@ const Select22 = React__default.forwardRef(function Select222(props, ref) {
42616
44738
  };
42617
44739
  const handleCloseAutoFocus = (event) => {
42618
44740
  var _a, _b;
42619
- if (shouldFocusNextRef.current) {
44741
+ if (shouldFocusNextRef.current !== void 0) {
42620
44742
  event.preventDefault();
42621
- shouldFocusNextRef.current = false;
42622
44743
  (_a = otherProps.onBlur) == null ? void 0 : _a.call(otherProps, event);
42623
- (_b = getNextFocussableElement(internalRef.current)) == null ? void 0 : _b.focus();
44744
+ (_b = getNextFocussableElement(internalRef.current, shouldFocusNextRef.current)) == null ? void 0 : _b.focus();
44745
+ shouldFocusNextRef.current = void 0;
42624
44746
  return;
42625
44747
  }
42626
44748
  };
@@ -43021,8 +45143,8 @@ function FilterComparator(props) {
43021
45143
  return /* @__PURE__ */ React__default.createElement(Select22, { ...attributes, className: "!w-32 flex-shrink-0", disabled: !column, onChange: handleChange, value }, validComparators.map((comparator) => /* @__PURE__ */ React__default.createElement(Select22.Option, { key: comparator, value: comparator }, getComparatorText(comparator, texts, column))));
43022
45144
  }
43023
45145
  function getComparatorText(comparator, texts, column) {
43024
- var _a, _b;
43025
- const isDate2 = ((_b = (_a = column == null ? void 0 : column.columnDef) == null ? void 0 : _a.meta) == null ? void 0 : _b.control) === "datepicker";
45146
+ var _a, _b, _c;
45147
+ const isDate2 = ((_a = column == null ? void 0 : column.columnDef.meta) == null ? void 0 : _a.dataType) === "date" || ((_b = column == null ? void 0 : column.columnDef.meta) == null ? void 0 : _b.dataType) === "time" || ((_c = column == null ? void 0 : column.columnDef.meta) == null ? void 0 : _c.dataType) === "datetime";
43026
45148
  switch (comparator) {
43027
45149
  case TableFilterComparator.Contains:
43028
45150
  return texts.table.filters.comparators.contains;
@@ -51646,7 +53768,7 @@ function willRowMove(cell, change, rowIndex, localization) {
51646
53768
  const { table } = cell.getContext();
51647
53769
  if (willRowMoveAfterSearch(cell, change, table, localization)) {
51648
53770
  return "search";
51649
- } else if (willRowMoveAfterFilter(cell, change)) {
53771
+ } else if (willRowMoveAfterFilter(cell, change, localization)) {
51650
53772
  return "filter";
51651
53773
  } else if (willRowMoveAfterSorting(cell, change, rowIndex)) {
51652
53774
  return "sorting";
@@ -51661,11 +53783,17 @@ function willRowMoveAfterSearch(cell, change, table, localization) {
51661
53783
  const rowWithChange = { ...cell.row, original: { ...cell.row.original, [cell.column.id]: change } };
51662
53784
  return !globalFilterFn(rowWithChange, cell.column.id, searchQuery, localization);
51663
53785
  }
51664
- function willRowMoveAfterFilter(cell, change) {
53786
+ function willRowMoveAfterFilter(cell, change, localization) {
51665
53787
  if (!cell.column.getIsFiltered()) {
51666
53788
  return false;
51667
53789
  }
51668
- return !columnFilterFn(change, cell.column.getFilterValue());
53790
+ return !columnFilterFn(
53791
+ cell.row.original,
53792
+ change,
53793
+ cell.column.columnDef.meta,
53794
+ cell.column.getFilterValue(),
53795
+ localization
53796
+ );
51669
53797
  }
51670
53798
  function willRowMoveAfterSorting(cell, change, rowIndex) {
51671
53799
  var _a;
@@ -51961,8 +54089,8 @@ function requireIsBuffer() {
51961
54089
  var freeExports = exports && !exports.nodeType && exports;
51962
54090
  var freeModule = freeExports && true && module && !module.nodeType && module;
51963
54091
  var moduleExports = freeModule && freeModule.exports === freeExports;
51964
- var Buffer = moduleExports ? root.Buffer : void 0;
51965
- var nativeIsBuffer = Buffer ? Buffer.isBuffer : void 0;
54092
+ var Buffer2 = moduleExports ? root.Buffer : void 0;
54093
+ var nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : void 0;
51966
54094
  var isBuffer2 = nativeIsBuffer || stubFalse;
51967
54095
  module.exports = isBuffer2;
51968
54096
  })(isBuffer, isBuffer.exports);
@@ -52241,7 +54369,7 @@ function require_cloneBuffer() {
52241
54369
  var freeExports = exports && !exports.nodeType && exports;
52242
54370
  var freeModule = freeExports && true && module && !module.nodeType && module;
52243
54371
  var moduleExports = freeModule && freeModule.exports === freeExports;
52244
- var Buffer = moduleExports ? root.Buffer : void 0, allocUnsafe = Buffer ? Buffer.allocUnsafe : void 0;
54372
+ var Buffer2 = moduleExports ? root.Buffer : void 0, allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : void 0;
52245
54373
  function cloneBuffer(buffer, isDeep) {
52246
54374
  if (isDeep) {
52247
54375
  return buffer.slice();
@@ -53092,17 +55220,18 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
53092
55220
  async function onCellChanged(cell, rowIndex, nextValue, shouldRunUpdaters = true) {
53093
55221
  var _a;
53094
55222
  const changes = nextValue !== void 0 ? { ...state.changes.rows[cell.row.id], [cell.column.id]: nextValue } : { ...state.changes.rows[cell.row.id] };
55223
+ const original = cell.row.original;
53095
55224
  if (!Object.keys(changes).length) {
53096
55225
  return;
53097
55226
  }
53098
55227
  let updatesForOtherCells = {};
53099
55228
  if (typeof handleChange === "function" && shouldRunUpdaters) {
53100
55229
  const previousRowValue = {
53101
- ...state.changes.originals[cell.row.id]
55230
+ ...original
53102
55231
  //...getRowChangeset(updatersRef.current[cell.row.id], rowIdentityAccessor),
53103
55232
  };
53104
55233
  const nextRowValue = {
53105
- ...state.changes.originals[cell.row.id],
55234
+ ...original,
53106
55235
  ...changes
53107
55236
  };
53108
55237
  updatesForOtherCells = await handleChange(
@@ -53116,8 +55245,8 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
53116
55245
  const nextMoveReasons = { ...state.changes.moveReasons[cell.row.id] };
53117
55246
  const nextCellErrors = { ...(_a = state.changes.errors[cell.row.id]) == null ? void 0 : _a.cells };
53118
55247
  let validationErrors = {};
53119
- if (validator && Object.keys(nextChanges).length && state.changes.originals[cell.row.id]) {
53120
- const nextRowValue = { ...state.changes.originals[cell.row.id], ...changes, ...updatesForOtherCells };
55248
+ if (validator && Object.keys(nextChanges).length && original) {
55249
+ const nextRowValue = { ...original, ...changes, ...updatesForOtherCells };
53121
55250
  validationErrors = await validator(nextRowValue) ?? {};
53122
55251
  }
53123
55252
  const cellsToActOn = [cell.column.id, ...Object.keys(updatesForOtherCells)];
@@ -53146,7 +55275,8 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
53146
55275
  cellErrors: nextCellErrors,
53147
55276
  index: rowIndex,
53148
55277
  moveReasons: nextMoveReasons,
53149
- value: nextChanges
55278
+ value: nextChanges,
55279
+ original
53150
55280
  }
53151
55281
  });
53152
55282
  }
@@ -53556,6 +55686,7 @@ function EditingControlCell(props) {
53556
55686
  const type = columnMeta.control ?? "input";
53557
55687
  const handleFocus = useEditingCellAutofocus(props);
53558
55688
  const value = cell.getValue();
55689
+ const rowChanges = tableMeta.editing.getRowValue(cell.row.id);
53559
55690
  const hasNonTextControl = React__default.useMemo(() => {
53560
55691
  var _a;
53561
55692
  return typeof type === "function" && !!((_a = cellRef.current) == null ? void 0 : _a.querySelector('[data-taco="Select2"],[data-taco="switch"],[data-taco="checkbox"]'));
@@ -53571,32 +55702,18 @@ function EditingControlCell(props) {
53571
55702
  },
53572
55703
  [hasNonTextControl, cell.row.id, cell.column.id, cell.row.original, rowIndex, value]
53573
55704
  );
53574
- const blur = React__default.useCallback(
53575
- function blur2() {
53576
- requestAnimationFrame(() => {
53577
- tableMeta.editing.toggleDetailedMode(false);
53578
- tableMeta.editing.onCellChanged(cell, rowIndex, void 0, !hasNonTextControl);
53579
- });
53580
- },
53581
- [hasNonTextControl, cell.row.id, cell.column.id, cell.row.original, rowIndex]
53582
- );
53583
55705
  const handleBlur = React__default.useCallback(
53584
55706
  (event) => {
53585
55707
  if (isElementInsideOrTriggeredFromContainer(event.relatedTarget, event.currentTarget)) {
53586
55708
  return;
53587
55709
  }
53588
- blur();
55710
+ requestAnimationFrame(() => {
55711
+ tableMeta.editing.toggleDetailedMode(false);
55712
+ tableMeta.editing.onCellChanged(cell, rowIndex, void 0, !hasNonTextControl);
55713
+ });
53589
55714
  },
53590
- [blur]
55715
+ [hasNonTextControl, cell.row.id, JSON.stringify(rowChanges), rowIndex, cell.column.id, cell.row.original]
53591
55716
  );
53592
- React__default.useEffect(() => {
53593
- const ref = cellRef.current;
53594
- return () => {
53595
- if (document.activeElement === ref || isElementInsideOrTriggeredFromContainer(document.activeElement, ref)) {
53596
- blur();
53597
- }
53598
- };
53599
- }, []);
53600
55717
  const error = tableMeta.editing.getCellError(cell);
53601
55718
  const controlProps = {
53602
55719
  dataType: columnMeta.dataType,
@@ -54153,16 +56270,15 @@ function CreateNewRow(props) {
54153
56270
  } else {
54154
56271
  tooltip = /* @__PURE__ */ React__default.createElement(Shortcut, { keys: shortcut2 });
54155
56272
  }
54156
- const className = clsx("group/row border-grey-300 !sticky z-[21]", {
56273
+ const className = clsx("group/row !sticky z-[21]", {
54157
56274
  "bottom-10": tableMeta.footer.isEnabled,
54158
- "bottom-0": !tableMeta.footer.isEnabled,
54159
- "border-b": !isScrolled
56275
+ "bottom-0": !tableMeta.footer.isEnabled
54160
56276
  });
54161
- return /* @__PURE__ */ React__default.createElement("tr", { "data-row-create": true, className, tabIndex: -1 }, /* @__PURE__ */ React__default.createElement("td", { className: "!bg-grey-50 col-span-full !border-b-0 !px-1" }, /* @__PURE__ */ React__default.createElement(
56277
+ return /* @__PURE__ */ React__default.createElement("tr", { "data-row-create": true, className, tabIndex: -1 }, /* @__PURE__ */ React__default.createElement("td", { className: "!bg-grey-50 col-span-full !px-1" }, /* @__PURE__ */ React__default.createElement(
54162
56278
  Button$4,
54163
56279
  {
54164
56280
  appearance: "transparent",
54165
- className: "group-hover:bg-grey-200 sticky left-[4px]",
56281
+ className: "group-hover:bg-grey-200 sticky left-[4px] font-bold",
54166
56282
  disabled: isDisabled,
54167
56283
  onClick: handleCreate,
54168
56284
  ref: buttonRef,
@@ -54176,10 +56292,14 @@ function CreateNewRow(props) {
54176
56292
  function TemporaryRow(props) {
54177
56293
  const { createRowButtonRef, isScrolled, table, tableMeta, tableRef } = props;
54178
56294
  const handleKeyDown = async (event) => {
54179
- var _a, _b;
56295
+ var _a;
56296
+ const target = event.target;
56297
+ if (isAriaDirectionKey(event) && isElementInsideExternalRelatedOverlay(target, tableRef)) {
56298
+ return;
56299
+ }
54180
56300
  if (event.key === "ArrowDown") {
54181
56301
  event.preventDefault();
54182
- if (!isElementTriggeredFromContainer(event.target, event.currentTarget)) {
56302
+ if (!isElementTriggeredFromContainer(target, event.currentTarget)) {
54183
56303
  const saved = await tableMeta.editing.saveChanges(table);
54184
56304
  if (saved) {
54185
56305
  (_a = createRowButtonRef.current) == null ? void 0 : _a.focus();
@@ -54188,28 +56308,15 @@ function TemporaryRow(props) {
54188
56308
  } else if (event.key === "ArrowUp") {
54189
56309
  event.preventDefault();
54190
56310
  event.stopPropagation();
56311
+ const lastIndex = tableMeta.length - 1;
56312
+ tableMeta.rowActive.setRowActiveIndex(lastIndex);
54191
56313
  if (tableRef.current) {
54192
- const availableRows = Array.from(
54193
- tableRef.current.querySelectorAll(`tbody tr:not([data-row-id^='${TEMPORARY_ROW_ID_PREFIX}'])`) ?? []
54194
- );
54195
- const footerHeight = ((_b = tableRef.current.querySelector("tfoot")) == null ? void 0 : _b.getBoundingClientRect().height) ?? 0;
54196
- const newRowHeight = event.currentTarget.getBoundingClientRect().height;
54197
- const visibleHeight = tableRef.current.clientHeight - footerHeight - newRowHeight;
54198
- const tableTopOffset = tableRef.current.getBoundingClientRect().top;
54199
- let nextRowIndex;
54200
- for (let index2 = availableRows.length - 1; index2 >= 0; index2--) {
54201
- const rowRect = availableRows[index2].getBoundingClientRect();
54202
- const topPlusHalfRow = rowRect.top + rowRect.height / 2;
54203
- if (topPlusHalfRow - tableTopOffset <= visibleHeight) {
54204
- nextRowIndex = index2;
54205
- break;
56314
+ tableRef.current.scrollTop = tableRef.current.scrollHeight;
56315
+ requestAnimationFrame(() => {
56316
+ if (tableRef.current) {
56317
+ tableRef.current.scrollTop = tableRef.current.scrollHeight;
54206
56318
  }
54207
- }
54208
- if (nextRowIndex) {
54209
- tableMeta.rowActive.setRowActiveIndex(
54210
- Number(availableRows[nextRowIndex < 0 ? 0 : nextRowIndex].getAttribute("data-row-index"))
54211
- );
54212
- }
56319
+ });
54213
56320
  }
54214
56321
  }
54215
56322
  };
@@ -54224,10 +56331,9 @@ function TemporaryRow(props) {
54224
56331
  }
54225
56332
  }
54226
56333
  };
54227
- const className = clsx("group/row border-grey-300 !sticky z-[22] print:hidden", {
54228
- "bottom-[calc(5rem_+_2px)] data-[row-editing-move]:bottom-[calc(5rem_+_2px)]": tableMeta.footer.isEnabled,
54229
- "bottom-[calc(2.5rem_+_2px)] data-[row-editing-move]:bottom-[calc(2.5rem_+_2px)]": !tableMeta.footer.isEnabled,
54230
- "border-t-2 shadow-[0px_-5px_20px_0px_rgba(0,0,0,0.1)] [&>td]:!border-b-0": isScrolled
56334
+ const className = clsx("group/row border-grey-300 !sticky z-[22] print:hidden border-t-2", {
56335
+ "bottom-[calc(5rem_+_5px)] data-[row-editing-move]:bottom-[calc(5rem_+_5px)]": tableMeta.footer.isEnabled,
56336
+ "bottom-[calc(2.5rem_+_5px)] data-[row-editing-move]:bottom-[calc(2.5rem_+_5px)]": !tableMeta.footer.isEnabled
54231
56337
  });
54232
56338
  return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, table.getBottomRows().map((row) => /* @__PURE__ */ React__default.createElement(
54233
56339
  Row$2,
@@ -59130,9 +61236,9 @@ _defineProperty$J(ReactFloater, "propTypes", { autoOpen: PropTypes.bool, callbac
59130
61236
  return !props.component;
59131
61237
  }), debug: PropTypes.bool, disableAnimation: PropTypes.bool, disableFlip: PropTypes.bool, disableHoverToClick: PropTypes.bool, event: PropTypes.oneOf(["hover", "click"]), eventDelay: PropTypes.number, footer: PropTypes.node, getPopper: PropTypes.func, hideArrow: PropTypes.bool, id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), offset: PropTypes.number, open: PropTypes.bool, options: PropTypes.object, placement: PropTypes.oneOf(["top", "top-start", "top-end", "bottom", "bottom-start", "bottom-end", "left", "left-start", "left-end", "right", "right-start", "right-end", "auto", "center"]), showCloseButton: PropTypes.bool, style: PropTypes.object, styles: PropTypes.object, target: PropTypes.oneOfType([PropTypes.object, PropTypes.string]), title: PropTypes.node, wrapperOptions: PropTypes.shape({ offset: PropTypes.number, placement: PropTypes.oneOf(["top", "top-start", "top-end", "bottom", "bottom-start", "bottom-end", "left", "left-start", "left-end", "right", "right-start", "right-end", "auto"]), position: PropTypes.bool }) });
59132
61238
  _defineProperty$J(ReactFloater, "defaultProps", { autoOpen: false, callback: noop$2, debug: false, disableAnimation: false, disableFlip: false, disableHoverToClick: false, event: "click", eventDelay: 0.4, getPopper: noop$2, hideArrow: false, offset: 15, placement: "bottom", showCloseButton: false, styles: {}, target: null, wrapperOptions: { position: false } });
59133
- var __defProp = Object.defineProperty;
59134
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
59135
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
61239
+ var __defProp2 = Object.defineProperty;
61240
+ var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
61241
+ var __publicField2 = (obj, key, value) => __defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
59136
61242
  var ACTIONS = {
59137
61243
  INIT: "init",
59138
61244
  START: "start",
@@ -59835,15 +61941,15 @@ var defaultState = {
59835
61941
  var validKeys = objectKeys(omit(defaultState, "controlled", "size"));
59836
61942
  var Store = class {
59837
61943
  constructor(options) {
59838
- __publicField(this, "beaconPopper");
59839
- __publicField(this, "tooltipPopper");
59840
- __publicField(this, "data", /* @__PURE__ */ new Map());
59841
- __publicField(this, "listener");
59842
- __publicField(this, "store", /* @__PURE__ */ new Map());
59843
- __publicField(this, "addListener", (listener) => {
61944
+ __publicField2(this, "beaconPopper");
61945
+ __publicField2(this, "tooltipPopper");
61946
+ __publicField2(this, "data", /* @__PURE__ */ new Map());
61947
+ __publicField2(this, "listener");
61948
+ __publicField2(this, "store", /* @__PURE__ */ new Map());
61949
+ __publicField2(this, "addListener", (listener) => {
59844
61950
  this.listener = listener;
59845
61951
  });
59846
- __publicField(this, "setSteps", (steps3) => {
61952
+ __publicField2(this, "setSteps", (steps3) => {
59847
61953
  const { size: size2, status } = this.getState();
59848
61954
  const state = {
59849
61955
  size: steps3.length,
@@ -59855,24 +61961,24 @@ var Store = class {
59855
61961
  }
59856
61962
  this.setState(state);
59857
61963
  });
59858
- __publicField(this, "getPopper", (name) => {
61964
+ __publicField2(this, "getPopper", (name) => {
59859
61965
  if (name === "beacon") {
59860
61966
  return this.beaconPopper;
59861
61967
  }
59862
61968
  return this.tooltipPopper;
59863
61969
  });
59864
- __publicField(this, "setPopper", (name, popper) => {
61970
+ __publicField2(this, "setPopper", (name, popper) => {
59865
61971
  if (name === "beacon") {
59866
61972
  this.beaconPopper = popper;
59867
61973
  } else {
59868
61974
  this.tooltipPopper = popper;
59869
61975
  }
59870
61976
  });
59871
- __publicField(this, "cleanupPoppers", () => {
61977
+ __publicField2(this, "cleanupPoppers", () => {
59872
61978
  this.beaconPopper = null;
59873
61979
  this.tooltipPopper = null;
59874
61980
  });
59875
- __publicField(this, "close", (origin = null) => {
61981
+ __publicField2(this, "close", (origin = null) => {
59876
61982
  const { index: index2, status } = this.getState();
59877
61983
  if (status !== STATUS.RUNNING) {
59878
61984
  return;
@@ -59881,7 +61987,7 @@ var Store = class {
59881
61987
  ...this.getNextState({ action: ACTIONS.CLOSE, index: index2 + 1, origin })
59882
61988
  });
59883
61989
  });
59884
- __publicField(this, "go", (nextIndex) => {
61990
+ __publicField2(this, "go", (nextIndex) => {
59885
61991
  const { controlled, status } = this.getState();
59886
61992
  if (controlled || status !== STATUS.RUNNING) {
59887
61993
  return;
@@ -59892,15 +61998,15 @@ var Store = class {
59892
61998
  status: step ? status : STATUS.FINISHED
59893
61999
  });
59894
62000
  });
59895
- __publicField(this, "info", () => this.getState());
59896
- __publicField(this, "next", () => {
62001
+ __publicField2(this, "info", () => this.getState());
62002
+ __publicField2(this, "next", () => {
59897
62003
  const { index: index2, status } = this.getState();
59898
62004
  if (status !== STATUS.RUNNING) {
59899
62005
  return;
59900
62006
  }
59901
62007
  this.setState(this.getNextState({ action: ACTIONS.NEXT, index: index2 + 1 }));
59902
62008
  });
59903
- __publicField(this, "open", () => {
62009
+ __publicField2(this, "open", () => {
59904
62010
  const { status } = this.getState();
59905
62011
  if (status !== STATUS.RUNNING) {
59906
62012
  return;
@@ -59909,7 +62015,7 @@ var Store = class {
59909
62015
  ...this.getNextState({ action: ACTIONS.UPDATE, lifecycle: LIFECYCLE.TOOLTIP })
59910
62016
  });
59911
62017
  });
59912
- __publicField(this, "prev", () => {
62018
+ __publicField2(this, "prev", () => {
59913
62019
  const { index: index2, status } = this.getState();
59914
62020
  if (status !== STATUS.RUNNING) {
59915
62021
  return;
@@ -59918,7 +62024,7 @@ var Store = class {
59918
62024
  ...this.getNextState({ action: ACTIONS.PREV, index: index2 - 1 })
59919
62025
  });
59920
62026
  });
59921
- __publicField(this, "reset", (restart = false) => {
62027
+ __publicField2(this, "reset", (restart = false) => {
59922
62028
  const { controlled } = this.getState();
59923
62029
  if (controlled) {
59924
62030
  return;
@@ -59928,7 +62034,7 @@ var Store = class {
59928
62034
  status: restart ? STATUS.RUNNING : STATUS.READY
59929
62035
  });
59930
62036
  });
59931
- __publicField(this, "skip", () => {
62037
+ __publicField2(this, "skip", () => {
59932
62038
  const { status } = this.getState();
59933
62039
  if (status !== STATUS.RUNNING) {
59934
62040
  return;
@@ -59939,7 +62045,7 @@ var Store = class {
59939
62045
  status: STATUS.SKIPPED
59940
62046
  });
59941
62047
  });
59942
- __publicField(this, "start", (nextIndex) => {
62048
+ __publicField2(this, "start", (nextIndex) => {
59943
62049
  const { index: index2, size: size2 } = this.getState();
59944
62050
  this.setState({
59945
62051
  ...this.getNextState(
@@ -59952,7 +62058,7 @@ var Store = class {
59952
62058
  status: size2 ? STATUS.RUNNING : STATUS.WAITING
59953
62059
  });
59954
62060
  });
59955
- __publicField(this, "stop", (advance = false) => {
62061
+ __publicField2(this, "stop", (advance = false) => {
59956
62062
  const { index: index2, status } = this.getState();
59957
62063
  if ([STATUS.FINISHED, STATUS.SKIPPED].includes(status)) {
59958
62064
  return;
@@ -59962,7 +62068,7 @@ var Store = class {
59962
62068
  status: STATUS.PAUSED
59963
62069
  });
59964
62070
  });
59965
- __publicField(this, "update", (state) => {
62071
+ __publicField2(this, "update", (state) => {
59966
62072
  var _a, _b;
59967
62073
  if (!hasValidKeys(state, validKeys)) {
59968
62074
  throw new Error(`State is not valid. Valid keys: ${validKeys.join(", ")}`);
@@ -60093,16 +62199,16 @@ var Spotlight_default = JoyrideSpotlight;
60093
62199
  var JoyrideOverlay = class extends React.Component {
60094
62200
  constructor() {
60095
62201
  super(...arguments);
60096
- __publicField(this, "isActive", false);
60097
- __publicField(this, "resizeTimeout");
60098
- __publicField(this, "scrollTimeout");
60099
- __publicField(this, "scrollParent");
60100
- __publicField(this, "state", {
62202
+ __publicField2(this, "isActive", false);
62203
+ __publicField2(this, "resizeTimeout");
62204
+ __publicField2(this, "scrollTimeout");
62205
+ __publicField2(this, "scrollParent");
62206
+ __publicField2(this, "state", {
60101
62207
  isScrolling: false,
60102
62208
  mouseOverSpotlight: false,
60103
62209
  showSpotlight: true
60104
62210
  });
60105
- __publicField(this, "hideSpotlight", () => {
62211
+ __publicField2(this, "hideSpotlight", () => {
60106
62212
  const { continuous: continuous2, disableOverlay, lifecycle } = this.props;
60107
62213
  const hiddenLifecycles = [
60108
62214
  LIFECYCLE.INIT,
@@ -60112,7 +62218,7 @@ var JoyrideOverlay = class extends React.Component {
60112
62218
  ];
60113
62219
  return disableOverlay || (continuous2 ? hiddenLifecycles.includes(lifecycle) : lifecycle !== LIFECYCLE.TOOLTIP);
60114
62220
  });
60115
- __publicField(this, "handleMouseMove", (event) => {
62221
+ __publicField2(this, "handleMouseMove", (event) => {
60116
62222
  const { mouseOverSpotlight } = this.state;
60117
62223
  const { height, left, position, top, width } = this.spotlightStyles;
60118
62224
  const offsetY = position === "fixed" ? event.clientY : event.pageY;
@@ -60124,7 +62230,7 @@ var JoyrideOverlay = class extends React.Component {
60124
62230
  this.updateState({ mouseOverSpotlight: inSpotlight });
60125
62231
  }
60126
62232
  });
60127
- __publicField(this, "handleScroll", () => {
62233
+ __publicField2(this, "handleScroll", () => {
60128
62234
  const { target } = this.props;
60129
62235
  const element = getElement(target);
60130
62236
  if (this.scrollParent !== document) {
@@ -60140,7 +62246,7 @@ var JoyrideOverlay = class extends React.Component {
60140
62246
  this.updateState({});
60141
62247
  }
60142
62248
  });
60143
- __publicField(this, "handleResize", () => {
62249
+ __publicField2(this, "handleResize", () => {
60144
62250
  clearTimeout(this.resizeTimeout);
60145
62251
  this.resizeTimeout = window.setTimeout(() => {
60146
62252
  if (!this.isActive) {
@@ -60275,7 +62381,7 @@ var JoyrideOverlay = class extends React.Component {
60275
62381
  var JoyridePortal = class extends React.Component {
60276
62382
  constructor() {
60277
62383
  super(...arguments);
60278
- __publicField(this, "node", null);
62384
+ __publicField2(this, "node", null);
60279
62385
  }
60280
62386
  componentDidMount() {
60281
62387
  const { id: id2 } = this.props;
@@ -60337,29 +62443,29 @@ var JoyridePortal = class extends React.Component {
60337
62443
  };
60338
62444
  var Scope = class {
60339
62445
  constructor(element, options) {
60340
- __publicField(this, "element");
60341
- __publicField(this, "options");
60342
- __publicField(this, "canBeTabbed", (element2) => {
62446
+ __publicField2(this, "element");
62447
+ __publicField2(this, "options");
62448
+ __publicField2(this, "canBeTabbed", (element2) => {
60343
62449
  const { tabIndex } = element2;
60344
62450
  if (tabIndex === null || tabIndex < 0) {
60345
62451
  return false;
60346
62452
  }
60347
62453
  return this.canHaveFocus(element2);
60348
62454
  });
60349
- __publicField(this, "canHaveFocus", (element2) => {
62455
+ __publicField2(this, "canHaveFocus", (element2) => {
60350
62456
  const validTabNodes = /input|select|textarea|button|object/;
60351
62457
  const nodeName = element2.nodeName.toLowerCase();
60352
62458
  const isValid2 = validTabNodes.test(nodeName) && !element2.getAttribute("disabled") || nodeName === "a" && !!element2.getAttribute("href");
60353
62459
  return isValid2 && this.isVisible(element2);
60354
62460
  });
60355
- __publicField(this, "findValidTabElements", () => [].slice.call(this.element.querySelectorAll("*"), 0).filter(this.canBeTabbed));
60356
- __publicField(this, "handleKeyDown", (event) => {
62461
+ __publicField2(this, "findValidTabElements", () => [].slice.call(this.element.querySelectorAll("*"), 0).filter(this.canBeTabbed));
62462
+ __publicField2(this, "handleKeyDown", (event) => {
60357
62463
  const { code = "Tab" } = this.options;
60358
62464
  if (event.code === code) {
60359
62465
  this.interceptTab(event);
60360
62466
  }
60361
62467
  });
60362
- __publicField(this, "interceptTab", (event) => {
62468
+ __publicField2(this, "interceptTab", (event) => {
60363
62469
  event.preventDefault();
60364
62470
  const elements = this.findValidTabElements();
60365
62471
  const { shiftKey } = event;
@@ -60376,7 +62482,7 @@ var Scope = class {
60376
62482
  }
60377
62483
  elements[x2].focus();
60378
62484
  });
60379
- __publicField(this, "isHidden", (element2) => {
62485
+ __publicField2(this, "isHidden", (element2) => {
60380
62486
  const noSize = element2.offsetWidth <= 0 && element2.offsetHeight <= 0;
60381
62487
  const style = window.getComputedStyle(element2);
60382
62488
  if (noSize && !element2.innerHTML) {
@@ -60384,7 +62490,7 @@ var Scope = class {
60384
62490
  }
60385
62491
  return noSize && style.getPropertyValue("overflow") !== "visible" || style.getPropertyValue("display") === "none";
60386
62492
  });
60387
- __publicField(this, "isVisible", (element2) => {
62493
+ __publicField2(this, "isVisible", (element2) => {
60388
62494
  let parentElement = element2;
60389
62495
  while (parentElement) {
60390
62496
  if (parentElement instanceof HTMLElement) {
@@ -60399,16 +62505,16 @@ var Scope = class {
60399
62505
  }
60400
62506
  return true;
60401
62507
  });
60402
- __publicField(this, "removeScope", () => {
62508
+ __publicField2(this, "removeScope", () => {
60403
62509
  window.removeEventListener("keydown", this.handleKeyDown);
60404
62510
  });
60405
- __publicField(this, "checkFocus", (target) => {
62511
+ __publicField2(this, "checkFocus", (target) => {
60406
62512
  if (document.activeElement !== target) {
60407
62513
  target.focus();
60408
62514
  window.requestAnimationFrame(() => this.checkFocus(target));
60409
62515
  }
60410
62516
  });
60411
- __publicField(this, "setFocus", () => {
62517
+ __publicField2(this, "setFocus", () => {
60412
62518
  const { selector } = this.options;
60413
62519
  if (!selector) {
60414
62520
  return;
@@ -60430,8 +62536,8 @@ var Scope = class {
60430
62536
  var JoyrideBeacon = class extends React.Component {
60431
62537
  constructor(props) {
60432
62538
  super(props);
60433
- __publicField(this, "beacon", null);
60434
- __publicField(this, "setBeaconRef", (c2) => {
62539
+ __publicField2(this, "beacon", null);
62540
+ __publicField2(this, "setBeaconRef", (c2) => {
60435
62541
  this.beacon = c2;
60436
62542
  });
60437
62543
  if (props.beaconComponent) {
@@ -60613,17 +62719,17 @@ var Container_default = JoyrideTooltipContainer;
60613
62719
  var JoyrideTooltip = class extends React.Component {
60614
62720
  constructor() {
60615
62721
  super(...arguments);
60616
- __publicField(this, "handleClickBack", (event) => {
62722
+ __publicField2(this, "handleClickBack", (event) => {
60617
62723
  event.preventDefault();
60618
62724
  const { helpers } = this.props;
60619
62725
  helpers.prev();
60620
62726
  });
60621
- __publicField(this, "handleClickClose", (event) => {
62727
+ __publicField2(this, "handleClickClose", (event) => {
60622
62728
  event.preventDefault();
60623
62729
  const { helpers } = this.props;
60624
62730
  helpers.close("button_close");
60625
62731
  });
60626
- __publicField(this, "handleClickPrimary", (event) => {
62732
+ __publicField2(this, "handleClickPrimary", (event) => {
60627
62733
  event.preventDefault();
60628
62734
  const { continuous: continuous2, helpers } = this.props;
60629
62735
  if (!continuous2) {
@@ -60632,12 +62738,12 @@ var JoyrideTooltip = class extends React.Component {
60632
62738
  }
60633
62739
  helpers.next();
60634
62740
  });
60635
- __publicField(this, "handleClickSkip", (event) => {
62741
+ __publicField2(this, "handleClickSkip", (event) => {
60636
62742
  event.preventDefault();
60637
62743
  const { helpers } = this.props;
60638
62744
  helpers.skip();
60639
62745
  });
60640
- __publicField(this, "getElementsProps", () => {
62746
+ __publicField2(this, "getElementsProps", () => {
60641
62747
  const { continuous: continuous2, index: index2, isLastStep, setTooltipRef, size: size2, step } = this.props;
60642
62748
  const { back, close, last: last2, next, nextLabelWithProgress, skip } = step.locale;
60643
62749
  const backText = getReactNodeText(back);
@@ -60739,19 +62845,19 @@ var JoyrideTooltip = class extends React.Component {
60739
62845
  var JoyrideStep = class extends React.Component {
60740
62846
  constructor() {
60741
62847
  super(...arguments);
60742
- __publicField(this, "scope", null);
60743
- __publicField(this, "tooltip", null);
60744
- __publicField(this, "handleClickHoverBeacon", (event) => {
62848
+ __publicField2(this, "scope", null);
62849
+ __publicField2(this, "tooltip", null);
62850
+ __publicField2(this, "handleClickHoverBeacon", (event) => {
60745
62851
  const { step, store } = this.props;
60746
62852
  if (event.type === "mouseenter" && step.event !== "hover") {
60747
62853
  return;
60748
62854
  }
60749
62855
  store.update({ lifecycle: LIFECYCLE.TOOLTIP });
60750
62856
  });
60751
- __publicField(this, "setTooltipRef", (element) => {
62857
+ __publicField2(this, "setTooltipRef", (element) => {
60752
62858
  this.tooltip = element;
60753
62859
  });
60754
- __publicField(this, "setPopper", (popper, type) => {
62860
+ __publicField2(this, "setPopper", (popper, type) => {
60755
62861
  var _a;
60756
62862
  const { action, lifecycle, step, store } = this.props;
60757
62863
  if (type === "wrapper") {
@@ -60769,7 +62875,7 @@ var JoyrideStep = class extends React.Component {
60769
62875
  step.floaterProps.getPopper(popper, type);
60770
62876
  }
60771
62877
  });
60772
- __publicField(this, "renderTooltip", (renderProps) => {
62878
+ __publicField2(this, "renderTooltip", (renderProps) => {
60773
62879
  const { continuous: continuous2, helpers, index: index2, size: size2, step } = this.props;
60774
62880
  return /* @__PURE__ */ React.createElement(
60775
62881
  JoyrideTooltip,
@@ -60941,15 +63047,15 @@ var JoyrideStep = class extends React.Component {
60941
63047
  var Joyride = class extends React.Component {
60942
63048
  constructor(props) {
60943
63049
  super(props);
60944
- __publicField(this, "helpers");
60945
- __publicField(this, "store");
60946
- __publicField(this, "callback", (data) => {
63050
+ __publicField2(this, "helpers");
63051
+ __publicField2(this, "store");
63052
+ __publicField2(this, "callback", (data) => {
60947
63053
  const { callback } = this.props;
60948
63054
  if (src_default.function(callback)) {
60949
63055
  callback(data);
60950
63056
  }
60951
63057
  });
60952
- __publicField(this, "handleKeyboard", (event) => {
63058
+ __publicField2(this, "handleKeyboard", (event) => {
60953
63059
  const { index: index2, lifecycle } = this.state;
60954
63060
  const { steps: steps2 } = this.props;
60955
63061
  const step = steps2[index2];
@@ -60959,7 +63065,7 @@ var Joyride = class extends React.Component {
60959
63065
  }
60960
63066
  }
60961
63067
  });
60962
- __publicField(this, "handleClickOverlay", () => {
63068
+ __publicField2(this, "handleClickOverlay", () => {
60963
63069
  const { index: index2 } = this.state;
60964
63070
  const { steps: steps2 } = this.props;
60965
63071
  const step = getMergedStep(this.props, steps2[index2]);
@@ -60967,7 +63073,7 @@ var Joyride = class extends React.Component {
60967
63073
  this.helpers.close("overlay");
60968
63074
  }
60969
63075
  });
60970
- __publicField(this, "syncState", (state) => {
63076
+ __publicField2(this, "syncState", (state) => {
60971
63077
  this.setState(state);
60972
63078
  });
60973
63079
  const { debug: debug2, getHelpers, run = true, stepIndex } = props;
@@ -61217,7 +63323,7 @@ var Joyride = class extends React.Component {
61217
63323
  return /* @__PURE__ */ React.createElement("div", { className: "react-joyride" }, content.step, content.overlay);
61218
63324
  }
61219
63325
  };
61220
- __publicField(Joyride, "defaultProps", defaultProps$4);
63326
+ __publicField2(Joyride, "defaultProps", defaultProps$4);
61221
63327
  var components_default = Joyride;
61222
63328
  const Tooltip$2 = ({
61223
63329
  continuous: continuous2,
@@ -86199,7 +88305,7 @@ function getDataKey(sorting, filters, hiddenColumns, search) {
86199
88305
  function useTableDataLoader2(fetchPage, fetchAll, options = { pageSize: DEFAULT_PAGE_SIZE$1 }) {
86200
88306
  const { pageSize } = options;
86201
88307
  const DATASET_SIZE = DATASET_SIZE_MULTIPLIER * pageSize;
86202
- const length = React__default.useRef(0);
88308
+ const length = React__default.useRef(void 0);
86203
88309
  const [data, setData] = React__default.useState({ rows: [], pages: [], cache: {}, lastFetchedPage: void 0 });
86204
88310
  const _pendingPageRequests = React__default.useRef({});
86205
88311
  const _lastUsedSorting = React__default.useRef([]);