kiban-design-system 1.1.1 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -9090,10 +9090,18 @@ class Locale {
9090
9090
 
9091
9091
  months(length, format = false) {
9092
9092
  return listStuff(this, length, months, () => {
9093
+ // Workaround for "ja" locale: formatToParts does not label all parts of the month
9094
+ // as "month" and for this locale there is no difference between "format" and "non-format".
9095
+ // As such, just use format() instead of formatToParts() and take the whole string
9096
+ const monthSpecialCase = this.intl === "ja" || this.intl.startsWith("ja-");
9097
+ format &= !monthSpecialCase;
9093
9098
  const intl = format ? { month: length, day: "numeric" } : { month: length },
9094
9099
  formatStr = format ? "format" : "standalone";
9095
9100
  if (!this.monthsCache[formatStr][length]) {
9096
- this.monthsCache[formatStr][length] = mapMonths((dt) => this.extract(dt, intl, "month"));
9101
+ const mapper = !monthSpecialCase
9102
+ ? (dt) => this.extract(dt, intl, "month")
9103
+ : (dt) => this.dtFormatter(dt, intl).format();
9104
+ this.monthsCache[formatStr][length] = mapMonths(mapper);
9097
9105
  }
9098
9106
  return this.monthsCache[formatStr][length];
9099
9107
  });
@@ -10079,10 +10087,24 @@ function parseMillis(fraction) {
10079
10087
  }
10080
10088
  }
10081
10089
 
10082
- function roundTo(number, digits, towardZero = false) {
10083
- const factor = 10 ** digits,
10084
- rounder = towardZero ? Math.trunc : Math.round;
10085
- return rounder(number * factor) / factor;
10090
+ function roundTo(number, digits, rounding = "round") {
10091
+ const factor = 10 ** digits;
10092
+ switch (rounding) {
10093
+ case "expand":
10094
+ return number > 0
10095
+ ? Math.ceil(number * factor) / factor
10096
+ : Math.floor(number * factor) / factor;
10097
+ case "trunc":
10098
+ return Math.trunc(number * factor) / factor;
10099
+ case "round":
10100
+ return Math.round(number * factor) / factor;
10101
+ case "floor":
10102
+ return Math.floor(number * factor) / factor;
10103
+ case "ceil":
10104
+ return Math.ceil(number * factor) / factor;
10105
+ default:
10106
+ throw new RangeError(`Value rounding ${rounding} is out of range`);
10107
+ }
10086
10108
  }
10087
10109
 
10088
10110
  // DATE BASICS
@@ -10190,7 +10212,7 @@ function signedOffset(offHourStr, offMinuteStr) {
10190
10212
 
10191
10213
  function asNumber(value) {
10192
10214
  const numericValue = Number(value);
10193
- if (typeof value === "boolean" || value === "" || Number.isNaN(numericValue))
10215
+ if (typeof value === "boolean" || value === "" || !Number.isFinite(numericValue))
10194
10216
  throw new InvalidArgumentError(`Invalid unit value ${value}`);
10195
10217
  return numericValue;
10196
10218
  }
@@ -10449,8 +10471,12 @@ class Formatter {
10449
10471
  for (let i = 0; i < fmt.length; i++) {
10450
10472
  const c = fmt.charAt(i);
10451
10473
  if (c === "'") {
10452
- if (currentFull.length > 0) {
10453
- splits.push({ literal: bracketed || /^\s+$/.test(currentFull), val: currentFull });
10474
+ // turn '' into a literal signal quote instead of just skipping the empty literal
10475
+ if (currentFull.length > 0 || bracketed) {
10476
+ splits.push({
10477
+ literal: bracketed || /^\s+$/.test(currentFull),
10478
+ val: currentFull === "" ? "'" : currentFull,
10479
+ });
10454
10480
  }
10455
10481
  current = null;
10456
10482
  currentFull = "";
@@ -10514,7 +10540,7 @@ class Formatter {
10514
10540
  return this.dtFormatter(dt, opts).resolvedOptions();
10515
10541
  }
10516
10542
 
10517
- num(n, p = 0) {
10543
+ num(n, p = 0, signDisplay = undefined) {
10518
10544
  // we get some perf out of doing this here, annoyingly
10519
10545
  if (this.opts.forceSimple) {
10520
10546
  return padStart(n, p);
@@ -10525,6 +10551,9 @@ class Formatter {
10525
10551
  if (p > 0) {
10526
10552
  opts.padTo = p;
10527
10553
  }
10554
+ if (signDisplay) {
10555
+ opts.signDisplay = signDisplay;
10556
+ }
10528
10557
 
10529
10558
  return this.loc.numberFormatter(opts).format(n);
10530
10559
  }
@@ -10760,32 +10789,44 @@ class Formatter {
10760
10789
  }
10761
10790
 
10762
10791
  formatDurationFromString(dur, fmt) {
10792
+ const invertLargest = this.opts.signMode === "negativeLargestOnly" ? -1 : 1;
10763
10793
  const tokenToField = (token) => {
10764
10794
  switch (token[0]) {
10765
10795
  case "S":
10766
- return "millisecond";
10796
+ return "milliseconds";
10767
10797
  case "s":
10768
- return "second";
10798
+ return "seconds";
10769
10799
  case "m":
10770
- return "minute";
10800
+ return "minutes";
10771
10801
  case "h":
10772
- return "hour";
10802
+ return "hours";
10773
10803
  case "d":
10774
- return "day";
10804
+ return "days";
10775
10805
  case "w":
10776
- return "week";
10806
+ return "weeks";
10777
10807
  case "M":
10778
- return "month";
10808
+ return "months";
10779
10809
  case "y":
10780
- return "year";
10810
+ return "years";
10781
10811
  default:
10782
10812
  return null;
10783
10813
  }
10784
10814
  },
10785
- tokenToString = (lildur) => (token) => {
10815
+ tokenToString = (lildur, info) => (token) => {
10786
10816
  const mapped = tokenToField(token);
10787
10817
  if (mapped) {
10788
- return this.num(lildur.get(mapped), token.length);
10818
+ const inversionFactor =
10819
+ info.isNegativeDuration && mapped !== info.largestUnit ? invertLargest : 1;
10820
+ let signDisplay;
10821
+ if (this.opts.signMode === "negativeLargestOnly" && mapped !== info.largestUnit) {
10822
+ signDisplay = "never";
10823
+ } else if (this.opts.signMode === "all") {
10824
+ signDisplay = "always";
10825
+ } else {
10826
+ // "auto" and "negative" are the same, but "auto" has better support
10827
+ signDisplay = "auto";
10828
+ }
10829
+ return this.num(lildur.get(mapped) * inversionFactor, token.length, signDisplay);
10789
10830
  } else {
10790
10831
  return token;
10791
10832
  }
@@ -10795,8 +10836,14 @@ class Formatter {
10795
10836
  (found, { literal, val }) => (literal ? found : found.concat(val)),
10796
10837
  []
10797
10838
  ),
10798
- collapsed = dur.shiftTo(...realTokens.map(tokenToField).filter((t) => t));
10799
- return stringifyTokens(tokens, tokenToString(collapsed));
10839
+ collapsed = dur.shiftTo(...realTokens.map(tokenToField).filter((t) => t)),
10840
+ durationInfo = {
10841
+ isNegativeDuration: collapsed < 0,
10842
+ // this relies on "collapsed" being based on "shiftTo", which builds up the object
10843
+ // in order
10844
+ largestUnit: Object.keys(collapsed.values)[0],
10845
+ };
10846
+ return stringifyTokens(tokens, tokenToString(collapsed, durationInfo));
10800
10847
  }
10801
10848
  }
10802
10849
 
@@ -10857,11 +10904,11 @@ function simpleParse(...keys) {
10857
10904
  }
10858
10905
 
10859
10906
  // ISO and SQL parsing
10860
- const offsetRegex = /(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/;
10907
+ const offsetRegex = /(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/;
10861
10908
  const isoExtendedZone = `(?:${offsetRegex.source}?(?:\\[(${ianaRegex.source})\\])?)?`;
10862
10909
  const isoTimeBaseRegex = /(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/;
10863
10910
  const isoTimeRegex = RegExp(`${isoTimeBaseRegex.source}${isoExtendedZone}`);
10864
- const isoTimeExtensionRegex = RegExp(`(?:T${isoTimeRegex.source})?`);
10911
+ const isoTimeExtensionRegex = RegExp(`(?:[Tt]${isoTimeRegex.source})?`);
10865
10912
  const isoYmdRegex = /([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/;
10866
10913
  const isoWeekRegex = /(\d{4})-?W(\d\d)(?:-?(\d))?/;
10867
10914
  const isoOrdinalRegex = /(\d{4})-?(\d{3})/;
@@ -11576,9 +11623,13 @@ class Duration {
11576
11623
  * @param {string} fmt - the format string
11577
11624
  * @param {Object} opts - options
11578
11625
  * @param {boolean} [opts.floor=true] - floor numerical values
11626
+ * @param {'negative'|'all'|'negativeLargestOnly'} [opts.signMode=negative] - How to handle signs
11579
11627
  * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("y d s") //=> "1 6 2"
11580
11628
  * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("yy dd sss") //=> "01 06 002"
11581
11629
  * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("M S") //=> "12 518402000"
11630
+ * @example Duration.fromObject({ days: 6, seconds: 2 }).toFormat("d s", { signMode: "all" }) //=> "+6 +2"
11631
+ * @example Duration.fromObject({ days: -6, seconds: -2 }).toFormat("d s", { signMode: "all" }) //=> "-6 -2"
11632
+ * @example Duration.fromObject({ days: -6, seconds: -2 }).toFormat("d s", { signMode: "negativeLargestOnly" }) //=> "-6 2"
11582
11633
  * @return {string}
11583
11634
  */
11584
11635
  toFormat(fmt, opts = {}) {
@@ -11598,21 +11649,25 @@ class Duration {
11598
11649
  * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options
11599
11650
  * @param {Object} opts - Formatting options. Accepts the same keys as the options parameter of the native `Intl.NumberFormat` constructor, as well as `listStyle`.
11600
11651
  * @param {string} [opts.listStyle='narrow'] - How to format the merged list. Corresponds to the `style` property of the options parameter of the native `Intl.ListFormat` constructor.
11652
+ * @param {boolean} [opts.showZeros=true] - Show all units previously used by the duration even if they are zero
11601
11653
  * @example
11602
11654
  * ```js
11603
- * var dur = Duration.fromObject({ days: 1, hours: 5, minutes: 6 })
11604
- * dur.toHuman() //=> '1 day, 5 hours, 6 minutes'
11605
- * dur.toHuman({ listStyle: "long" }) //=> '1 day, 5 hours, and 6 minutes'
11606
- * dur.toHuman({ unitDisplay: "short" }) //=> '1 day, 5 hr, 6 min'
11655
+ * var dur = Duration.fromObject({ months: 1, weeks: 0, hours: 5, minutes: 6 })
11656
+ * dur.toHuman() //=> '1 month, 0 weeks, 5 hours, 6 minutes'
11657
+ * dur.toHuman({ listStyle: "long" }) //=> '1 month, 0 weeks, 5 hours, and 6 minutes'
11658
+ * dur.toHuman({ unitDisplay: "short" }) //=> '1 mth, 0 wks, 5 hr, 6 min'
11659
+ * dur.toHuman({ showZeros: false }) //=> '1 month, 5 hours, 6 minutes'
11607
11660
  * ```
11608
11661
  */
11609
11662
  toHuman(opts = {}) {
11610
11663
  if (!this.isValid) return INVALID$2;
11611
11664
 
11665
+ const showZeros = opts.showZeros !== false;
11666
+
11612
11667
  const l = orderedUnits$1
11613
11668
  .map((unit) => {
11614
11669
  const val = this.values[unit];
11615
- if (isUndefined(val)) {
11670
+ if (isUndefined(val) || (val === 0 && !showZeros)) {
11616
11671
  return null;
11617
11672
  }
11618
11673
  return this.loc
@@ -11972,6 +12027,17 @@ class Duration {
11972
12027
  return clone$2(this, { values: negated }, true);
11973
12028
  }
11974
12029
 
12030
+ /**
12031
+ * Removes all units with values equal to 0 from this Duration.
12032
+ * @example Duration.fromObject({ years: 2, days: 0, hours: 0, minutes: 0 }).removeZeros().toObject() //=> { years: 2 }
12033
+ * @return {Duration}
12034
+ */
12035
+ removeZeros() {
12036
+ if (!this.isValid) return this;
12037
+ const vals = removeZeroes(this.values);
12038
+ return clone$2(this, { values: vals }, true);
12039
+ }
12040
+
11975
12041
  /**
11976
12042
  * Get the years.
11977
12043
  * @type {number}
@@ -12282,7 +12348,8 @@ class Interval {
12282
12348
  }
12283
12349
 
12284
12350
  /**
12285
- * Returns the end of the Interval
12351
+ * Returns the end of the Interval. This is the first instant which is not part of the interval
12352
+ * (Interval is half-open).
12286
12353
  * @type {DateTime}
12287
12354
  */
12288
12355
  get end() {
@@ -13713,21 +13780,22 @@ function toTechFormat(dt, format, allowZ = true) {
13713
13780
  : null;
13714
13781
  }
13715
13782
 
13716
- function toISODate(o, extended) {
13783
+ function toISODate(o, extended, precision) {
13717
13784
  const longFormat = o.c.year > 9999 || o.c.year < 0;
13718
13785
  let c = "";
13719
13786
  if (longFormat && o.c.year >= 0) c += "+";
13720
13787
  c += padStart(o.c.year, longFormat ? 6 : 4);
13721
-
13788
+ if (precision === "year") return c;
13722
13789
  if (extended) {
13723
13790
  c += "-";
13724
13791
  c += padStart(o.c.month);
13792
+ if (precision === "month") return c;
13725
13793
  c += "-";
13726
- c += padStart(o.c.day);
13727
13794
  } else {
13728
13795
  c += padStart(o.c.month);
13729
- c += padStart(o.c.day);
13796
+ if (precision === "month") return c;
13730
13797
  }
13798
+ c += padStart(o.c.day);
13731
13799
  return c;
13732
13800
  }
13733
13801
 
@@ -13737,26 +13805,39 @@ function toISOTime(
13737
13805
  suppressSeconds,
13738
13806
  suppressMilliseconds,
13739
13807
  includeOffset,
13740
- extendedZone
13808
+ extendedZone,
13809
+ precision
13741
13810
  ) {
13742
- let c = padStart(o.c.hour);
13743
- if (extended) {
13744
- c += ":";
13745
- c += padStart(o.c.minute);
13746
- if (o.c.millisecond !== 0 || o.c.second !== 0 || !suppressSeconds) {
13747
- c += ":";
13748
- }
13749
- } else {
13750
- c += padStart(o.c.minute);
13751
- }
13752
-
13753
- if (o.c.millisecond !== 0 || o.c.second !== 0 || !suppressSeconds) {
13754
- c += padStart(o.c.second);
13755
-
13756
- if (o.c.millisecond !== 0 || !suppressMilliseconds) {
13757
- c += ".";
13758
- c += padStart(o.c.millisecond, 3);
13759
- }
13811
+ let showSeconds = !suppressSeconds || o.c.millisecond !== 0 || o.c.second !== 0,
13812
+ c = "";
13813
+ switch (precision) {
13814
+ case "day":
13815
+ case "month":
13816
+ case "year":
13817
+ break;
13818
+ default:
13819
+ c += padStart(o.c.hour);
13820
+ if (precision === "hour") break;
13821
+ if (extended) {
13822
+ c += ":";
13823
+ c += padStart(o.c.minute);
13824
+ if (precision === "minute") break;
13825
+ if (showSeconds) {
13826
+ c += ":";
13827
+ c += padStart(o.c.second);
13828
+ }
13829
+ } else {
13830
+ c += padStart(o.c.minute);
13831
+ if (precision === "minute") break;
13832
+ if (showSeconds) {
13833
+ c += padStart(o.c.second);
13834
+ }
13835
+ }
13836
+ if (precision === "second") break;
13837
+ if (showSeconds && (!suppressMilliseconds || o.c.millisecond !== 0)) {
13838
+ c += ".";
13839
+ c += padStart(o.c.millisecond, 3);
13840
+ }
13760
13841
  }
13761
13842
 
13762
13843
  if (includeOffset) {
@@ -13948,8 +14029,9 @@ function quickDT(obj, opts) {
13948
14029
 
13949
14030
  function diffRelative(start, end, opts) {
13950
14031
  const round = isUndefined(opts.round) ? true : opts.round,
14032
+ rounding = isUndefined(opts.rounding) ? "trunc" : opts.rounding,
13951
14033
  format = (c, unit) => {
13952
- c = roundTo(c, round || opts.calendary ? 0 : 2, true);
14034
+ c = roundTo(c, round || opts.calendary ? 0 : 2, opts.calendary ? "round" : rounding);
13953
14035
  const formatter = end.loc.clone(opts).relFormatter(opts);
13954
14036
  return formatter.format(c, unit);
13955
14037
  },
@@ -15328,10 +15410,13 @@ class DateTime {
15328
15410
  * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'
15329
15411
  * @param {boolean} [opts.extendedZone=false] - add the time zone format extension
15330
15412
  * @param {string} [opts.format='extended'] - choose between the basic and extended format
15413
+ * @param {string} [opts.precision='milliseconds'] - truncate output to desired presicion: 'years', 'months', 'days', 'hours', 'minutes', 'seconds' or 'milliseconds'. When precision and suppressSeconds or suppressMilliseconds are used together, precision sets the maximum unit shown in the output, however seconds or milliseconds will still be suppressed if they are 0.
15331
15414
  * @example DateTime.utc(1983, 5, 25).toISO() //=> '1982-05-25T00:00:00.000Z'
15332
15415
  * @example DateTime.now().toISO() //=> '2017-04-22T20:47:05.335-04:00'
15333
15416
  * @example DateTime.now().toISO({ includeOffset: false }) //=> '2017-04-22T20:47:05.335'
15334
15417
  * @example DateTime.now().toISO({ format: 'basic' }) //=> '20170422T204705.335-0400'
15418
+ * @example DateTime.now().toISO({ precision: 'day' }) //=> '2017-04-22Z'
15419
+ * @example DateTime.now().toISO({ precision: 'minute' }) //=> '2017-04-22T20:47Z'
15335
15420
  * @return {string|null}
15336
15421
  */
15337
15422
  toISO({
@@ -15340,16 +15425,26 @@ class DateTime {
15340
15425
  suppressMilliseconds = false,
15341
15426
  includeOffset = true,
15342
15427
  extendedZone = false,
15428
+ precision = "milliseconds",
15343
15429
  } = {}) {
15344
15430
  if (!this.isValid) {
15345
15431
  return null;
15346
15432
  }
15347
15433
 
15434
+ precision = normalizeUnit(precision);
15348
15435
  const ext = format === "extended";
15349
15436
 
15350
- let c = toISODate(this, ext);
15351
- c += "T";
15352
- c += toISOTime(this, ext, suppressSeconds, suppressMilliseconds, includeOffset, extendedZone);
15437
+ let c = toISODate(this, ext, precision);
15438
+ if (orderedUnits.indexOf(precision) >= 3) c += "T";
15439
+ c += toISOTime(
15440
+ this,
15441
+ ext,
15442
+ suppressSeconds,
15443
+ suppressMilliseconds,
15444
+ includeOffset,
15445
+ extendedZone,
15446
+ precision
15447
+ );
15353
15448
  return c;
15354
15449
  }
15355
15450
 
@@ -15357,16 +15452,17 @@ class DateTime {
15357
15452
  * Returns an ISO 8601-compliant string representation of this DateTime's date component
15358
15453
  * @param {Object} opts - options
15359
15454
  * @param {string} [opts.format='extended'] - choose between the basic and extended format
15455
+ * @param {string} [opts.precision='day'] - truncate output to desired precision: 'years', 'months', or 'days'.
15360
15456
  * @example DateTime.utc(1982, 5, 25).toISODate() //=> '1982-05-25'
15361
15457
  * @example DateTime.utc(1982, 5, 25).toISODate({ format: 'basic' }) //=> '19820525'
15458
+ * @example DateTime.utc(1982, 5, 25).toISODate({ precision: 'month' }) //=> '1982-05'
15362
15459
  * @return {string|null}
15363
15460
  */
15364
- toISODate({ format = "extended" } = {}) {
15461
+ toISODate({ format = "extended", precision = "day" } = {}) {
15365
15462
  if (!this.isValid) {
15366
15463
  return null;
15367
15464
  }
15368
-
15369
- return toISODate(this, format === "extended");
15465
+ return toISODate(this, format === "extended", normalizeUnit(precision));
15370
15466
  }
15371
15467
 
15372
15468
  /**
@@ -15387,10 +15483,12 @@ class DateTime {
15387
15483
  * @param {boolean} [opts.extendedZone=true] - add the time zone format extension
15388
15484
  * @param {boolean} [opts.includePrefix=false] - include the `T` prefix
15389
15485
  * @param {string} [opts.format='extended'] - choose between the basic and extended format
15486
+ * @param {string} [opts.precision='milliseconds'] - truncate output to desired presicion: 'hours', 'minutes', 'seconds' or 'milliseconds'. When precision and suppressSeconds or suppressMilliseconds are used together, precision sets the maximum unit shown in the output, however seconds or milliseconds will still be suppressed if they are 0.
15390
15487
  * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime() //=> '07:34:19.361Z'
15391
15488
  * @example DateTime.utc().set({ hour: 7, minute: 34, seconds: 0, milliseconds: 0 }).toISOTime({ suppressSeconds: true }) //=> '07:34Z'
15392
15489
  * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime({ format: 'basic' }) //=> '073419.361Z'
15393
15490
  * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime({ includePrefix: true }) //=> 'T07:34:19.361Z'
15491
+ * @example DateTime.utc().set({ hour: 7, minute: 34, second: 56 }).toISOTime({ precision: 'minute' }) //=> '07:34Z'
15394
15492
  * @return {string}
15395
15493
  */
15396
15494
  toISOTime({
@@ -15400,12 +15498,14 @@ class DateTime {
15400
15498
  includePrefix = false,
15401
15499
  extendedZone = false,
15402
15500
  format = "extended",
15501
+ precision = "milliseconds",
15403
15502
  } = {}) {
15404
15503
  if (!this.isValid) {
15405
15504
  return null;
15406
15505
  }
15407
15506
 
15408
- let c = includePrefix ? "T" : "";
15507
+ precision = normalizeUnit(precision);
15508
+ let c = includePrefix && orderedUnits.indexOf(precision) >= 3 ? "T" : "";
15409
15509
  return (
15410
15510
  c +
15411
15511
  toISOTime(
@@ -15414,7 +15514,8 @@ class DateTime {
15414
15514
  suppressSeconds,
15415
15515
  suppressMilliseconds,
15416
15516
  includeOffset,
15417
- extendedZone
15517
+ extendedZone,
15518
+ precision
15418
15519
  )
15419
15520
  );
15420
15521
  }
@@ -15692,12 +15793,13 @@ class DateTime {
15692
15793
 
15693
15794
  /**
15694
15795
  * Returns a string representation of a this time relative to now, such as "in two days". Can only internationalize if your
15695
- * platform supports Intl.RelativeTimeFormat. Rounds down by default.
15796
+ * platform supports Intl.RelativeTimeFormat. Rounds towards zero by default.
15696
15797
  * @param {Object} options - options that affect the output
15697
15798
  * @param {DateTime} [options.base=DateTime.now()] - the DateTime to use as the basis to which this time is compared. Defaults to now.
15698
15799
  * @param {string} [options.style="long"] - the style of units, must be "long", "short", or "narrow"
15699
15800
  * @param {string|string[]} options.unit - use a specific unit or array of units; if omitted, or an array, the method will pick the best unit. Use an array or one of "years", "quarters", "months", "weeks", "days", "hours", "minutes", or "seconds"
15700
15801
  * @param {boolean} [options.round=true] - whether to round the numbers in the output.
15802
+ * @param {string} [options.rounding="trunc"] - rounding method to use when rounding the numbers in the output. Can be "trunc" (toward zero), "expand" (away from zero), "round", "floor", or "ceil".
15701
15803
  * @param {number} [options.padding=0] - padding in milliseconds. This allows you to round up the result if it fits inside the threshold. Don't use in combination with {round: false} because the decimal output will include the padding.
15702
15804
  * @param {string} options.locale - override the locale of this DateTime
15703
15805
  * @param {string} options.numberingSystem - override the numberingSystem of this DateTime. The Intl system may choose not to honor this
@@ -37378,493 +37480,8 @@ const Header$1 = ({
37378
37480
  });
37379
37481
  };
37380
37482
 
37381
- var dist = {};
37382
-
37383
- var hasRequiredDist;
37384
-
37385
- function requireDist () {
37386
- if (hasRequiredDist) return dist;
37387
- hasRequiredDist = 1;
37388
- Object.defineProperty(dist, "__esModule", { value: true });
37389
- dist.parse = parse;
37390
- dist.serialize = serialize;
37391
- /**
37392
- * RegExp to match cookie-name in RFC 6265 sec 4.1.1
37393
- * This refers out to the obsoleted definition of token in RFC 2616 sec 2.2
37394
- * which has been replaced by the token definition in RFC 7230 appendix B.
37395
- *
37396
- * cookie-name = token
37397
- * token = 1*tchar
37398
- * tchar = "!" / "#" / "$" / "%" / "&" / "'" /
37399
- * "*" / "+" / "-" / "." / "^" / "_" /
37400
- * "`" / "|" / "~" / DIGIT / ALPHA
37401
- *
37402
- * Note: Allowing more characters - https://github.com/jshttp/cookie/issues/191
37403
- * Allow same range as cookie value, except `=`, which delimits end of name.
37404
- */
37405
- const cookieNameRegExp = /^[\u0021-\u003A\u003C\u003E-\u007E]+$/;
37406
- /**
37407
- * RegExp to match cookie-value in RFC 6265 sec 4.1.1
37408
- *
37409
- * cookie-value = *cookie-octet / ( DQUOTE *cookie-octet DQUOTE )
37410
- * cookie-octet = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E
37411
- * ; US-ASCII characters excluding CTLs,
37412
- * ; whitespace DQUOTE, comma, semicolon,
37413
- * ; and backslash
37414
- *
37415
- * Allowing more characters: https://github.com/jshttp/cookie/issues/191
37416
- * Comma, backslash, and DQUOTE are not part of the parsing algorithm.
37417
- */
37418
- const cookieValueRegExp = /^[\u0021-\u003A\u003C-\u007E]*$/;
37419
- /**
37420
- * RegExp to match domain-value in RFC 6265 sec 4.1.1
37421
- *
37422
- * domain-value = <subdomain>
37423
- * ; defined in [RFC1034], Section 3.5, as
37424
- * ; enhanced by [RFC1123], Section 2.1
37425
- * <subdomain> = <label> | <subdomain> "." <label>
37426
- * <label> = <let-dig> [ [ <ldh-str> ] <let-dig> ]
37427
- * Labels must be 63 characters or less.
37428
- * 'let-dig' not 'letter' in the first char, per RFC1123
37429
- * <ldh-str> = <let-dig-hyp> | <let-dig-hyp> <ldh-str>
37430
- * <let-dig-hyp> = <let-dig> | "-"
37431
- * <let-dig> = <letter> | <digit>
37432
- * <letter> = any one of the 52 alphabetic characters A through Z in
37433
- * upper case and a through z in lower case
37434
- * <digit> = any one of the ten digits 0 through 9
37435
- *
37436
- * Keep support for leading dot: https://github.com/jshttp/cookie/issues/173
37437
- *
37438
- * > (Note that a leading %x2E ("."), if present, is ignored even though that
37439
- * character is not permitted, but a trailing %x2E ("."), if present, will
37440
- * cause the user agent to ignore the attribute.)
37441
- */
37442
- const domainValueRegExp = /^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i;
37443
- /**
37444
- * RegExp to match path-value in RFC 6265 sec 4.1.1
37445
- *
37446
- * path-value = <any CHAR except CTLs or ";">
37447
- * CHAR = %x01-7F
37448
- * ; defined in RFC 5234 appendix B.1
37449
- */
37450
- const pathValueRegExp = /^[\u0020-\u003A\u003D-\u007E]*$/;
37451
- const __toString = Object.prototype.toString;
37452
- const NullObject = /* @__PURE__ */ (() => {
37453
- const C = function () { };
37454
- C.prototype = Object.create(null);
37455
- return C;
37456
- })();
37457
- /**
37458
- * Parse a cookie header.
37459
- *
37460
- * Parse the given cookie header string into an object
37461
- * The object has the various cookies as keys(names) => values
37462
- */
37463
- function parse(str, options) {
37464
- const obj = new NullObject();
37465
- const len = str.length;
37466
- // RFC 6265 sec 4.1.1, RFC 2616 2.2 defines a cookie name consists of one char minimum, plus '='.
37467
- if (len < 2)
37468
- return obj;
37469
- const dec = options?.decode || decode;
37470
- let index = 0;
37471
- do {
37472
- const eqIdx = str.indexOf("=", index);
37473
- if (eqIdx === -1)
37474
- break; // No more cookie pairs.
37475
- const colonIdx = str.indexOf(";", index);
37476
- const endIdx = colonIdx === -1 ? len : colonIdx;
37477
- if (eqIdx > endIdx) {
37478
- // backtrack on prior semicolon
37479
- index = str.lastIndexOf(";", eqIdx - 1) + 1;
37480
- continue;
37481
- }
37482
- const keyStartIdx = startIndex(str, index, eqIdx);
37483
- const keyEndIdx = endIndex(str, eqIdx, keyStartIdx);
37484
- const key = str.slice(keyStartIdx, keyEndIdx);
37485
- // only assign once
37486
- if (obj[key] === undefined) {
37487
- let valStartIdx = startIndex(str, eqIdx + 1, endIdx);
37488
- let valEndIdx = endIndex(str, endIdx, valStartIdx);
37489
- const value = dec(str.slice(valStartIdx, valEndIdx));
37490
- obj[key] = value;
37491
- }
37492
- index = endIdx + 1;
37493
- } while (index < len);
37494
- return obj;
37495
- }
37496
- function startIndex(str, index, max) {
37497
- do {
37498
- const code = str.charCodeAt(index);
37499
- if (code !== 0x20 /* */ && code !== 0x09 /* \t */)
37500
- return index;
37501
- } while (++index < max);
37502
- return max;
37503
- }
37504
- function endIndex(str, index, min) {
37505
- while (index > min) {
37506
- const code = str.charCodeAt(--index);
37507
- if (code !== 0x20 /* */ && code !== 0x09 /* \t */)
37508
- return index + 1;
37509
- }
37510
- return min;
37511
- }
37512
- /**
37513
- * Serialize data into a cookie header.
37514
- *
37515
- * Serialize a name value pair into a cookie string suitable for
37516
- * http headers. An optional options object specifies cookie parameters.
37517
- *
37518
- * serialize('foo', 'bar', { httpOnly: true })
37519
- * => "foo=bar; httpOnly"
37520
- */
37521
- function serialize(name, val, options) {
37522
- const enc = options?.encode || encodeURIComponent;
37523
- if (!cookieNameRegExp.test(name)) {
37524
- throw new TypeError(`argument name is invalid: ${name}`);
37525
- }
37526
- const value = enc(val);
37527
- if (!cookieValueRegExp.test(value)) {
37528
- throw new TypeError(`argument val is invalid: ${val}`);
37529
- }
37530
- let str = name + "=" + value;
37531
- if (!options)
37532
- return str;
37533
- if (options.maxAge !== undefined) {
37534
- if (!Number.isInteger(options.maxAge)) {
37535
- throw new TypeError(`option maxAge is invalid: ${options.maxAge}`);
37536
- }
37537
- str += "; Max-Age=" + options.maxAge;
37538
- }
37539
- if (options.domain) {
37540
- if (!domainValueRegExp.test(options.domain)) {
37541
- throw new TypeError(`option domain is invalid: ${options.domain}`);
37542
- }
37543
- str += "; Domain=" + options.domain;
37544
- }
37545
- if (options.path) {
37546
- if (!pathValueRegExp.test(options.path)) {
37547
- throw new TypeError(`option path is invalid: ${options.path}`);
37548
- }
37549
- str += "; Path=" + options.path;
37550
- }
37551
- if (options.expires) {
37552
- if (!isDate(options.expires) ||
37553
- !Number.isFinite(options.expires.valueOf())) {
37554
- throw new TypeError(`option expires is invalid: ${options.expires}`);
37555
- }
37556
- str += "; Expires=" + options.expires.toUTCString();
37557
- }
37558
- if (options.httpOnly) {
37559
- str += "; HttpOnly";
37560
- }
37561
- if (options.secure) {
37562
- str += "; Secure";
37563
- }
37564
- if (options.partitioned) {
37565
- str += "; Partitioned";
37566
- }
37567
- if (options.priority) {
37568
- const priority = typeof options.priority === "string"
37569
- ? options.priority.toLowerCase()
37570
- : undefined;
37571
- switch (priority) {
37572
- case "low":
37573
- str += "; Priority=Low";
37574
- break;
37575
- case "medium":
37576
- str += "; Priority=Medium";
37577
- break;
37578
- case "high":
37579
- str += "; Priority=High";
37580
- break;
37581
- default:
37582
- throw new TypeError(`option priority is invalid: ${options.priority}`);
37583
- }
37584
- }
37585
- if (options.sameSite) {
37586
- const sameSite = typeof options.sameSite === "string"
37587
- ? options.sameSite.toLowerCase()
37588
- : options.sameSite;
37589
- switch (sameSite) {
37590
- case true:
37591
- case "strict":
37592
- str += "; SameSite=Strict";
37593
- break;
37594
- case "lax":
37595
- str += "; SameSite=Lax";
37596
- break;
37597
- case "none":
37598
- str += "; SameSite=None";
37599
- break;
37600
- default:
37601
- throw new TypeError(`option sameSite is invalid: ${options.sameSite}`);
37602
- }
37603
- }
37604
- return str;
37605
- }
37606
- /**
37607
- * URL-decode string value. Optimized to skip native call when no %.
37608
- */
37609
- function decode(str) {
37610
- if (str.indexOf("%") === -1)
37611
- return str;
37612
- try {
37613
- return decodeURIComponent(str);
37614
- }
37615
- catch (e) {
37616
- return str;
37617
- }
37618
- }
37619
- /**
37620
- * Determine if value is a Date.
37621
- */
37622
- function isDate(val) {
37623
- return __toString.call(val) === "[object Date]";
37624
- }
37625
-
37626
- return dist;
37627
- }
37628
-
37629
- requireDist();
37630
-
37631
- var setCookie = {exports: {}};
37632
-
37633
- var hasRequiredSetCookie;
37634
-
37635
- function requireSetCookie () {
37636
- if (hasRequiredSetCookie) return setCookie.exports;
37637
- hasRequiredSetCookie = 1;
37638
-
37639
- var defaultParseOptions = {
37640
- decodeValues: true,
37641
- map: false,
37642
- silent: false,
37643
- };
37644
-
37645
- function isNonEmptyString(str) {
37646
- return typeof str === "string" && !!str.trim();
37647
- }
37648
-
37649
- function parseString(setCookieValue, options) {
37650
- var parts = setCookieValue.split(";").filter(isNonEmptyString);
37651
-
37652
- var nameValuePairStr = parts.shift();
37653
- var parsed = parseNameValuePair(nameValuePairStr);
37654
- var name = parsed.name;
37655
- var value = parsed.value;
37656
-
37657
- options = options
37658
- ? Object.assign({}, defaultParseOptions, options)
37659
- : defaultParseOptions;
37660
-
37661
- try {
37662
- value = options.decodeValues ? decodeURIComponent(value) : value; // decode cookie value
37663
- } catch (e) {
37664
- console.error(
37665
- "set-cookie-parser encountered an error while decoding a cookie with value '" +
37666
- value +
37667
- "'. Set options.decodeValues to false to disable this feature.",
37668
- e
37669
- );
37670
- }
37671
-
37672
- var cookie = {
37673
- name: name,
37674
- value: value,
37675
- };
37676
-
37677
- parts.forEach(function (part) {
37678
- var sides = part.split("=");
37679
- var key = sides.shift().trimLeft().toLowerCase();
37680
- var value = sides.join("=");
37681
- if (key === "expires") {
37682
- cookie.expires = new Date(value);
37683
- } else if (key === "max-age") {
37684
- cookie.maxAge = parseInt(value, 10);
37685
- } else if (key === "secure") {
37686
- cookie.secure = true;
37687
- } else if (key === "httponly") {
37688
- cookie.httpOnly = true;
37689
- } else if (key === "samesite") {
37690
- cookie.sameSite = value;
37691
- } else if (key === "partitioned") {
37692
- cookie.partitioned = true;
37693
- } else {
37694
- cookie[key] = value;
37695
- }
37696
- });
37697
-
37698
- return cookie;
37699
- }
37700
-
37701
- function parseNameValuePair(nameValuePairStr) {
37702
- // Parses name-value-pair according to rfc6265bis draft
37703
-
37704
- var name = "";
37705
- var value = "";
37706
- var nameValueArr = nameValuePairStr.split("=");
37707
- if (nameValueArr.length > 1) {
37708
- name = nameValueArr.shift();
37709
- value = nameValueArr.join("="); // everything after the first =, joined by a "=" if there was more than one part
37710
- } else {
37711
- value = nameValuePairStr;
37712
- }
37713
-
37714
- return { name: name, value: value };
37715
- }
37716
-
37717
- function parse(input, options) {
37718
- options = options
37719
- ? Object.assign({}, defaultParseOptions, options)
37720
- : defaultParseOptions;
37721
-
37722
- if (!input) {
37723
- if (!options.map) {
37724
- return [];
37725
- } else {
37726
- return {};
37727
- }
37728
- }
37729
-
37730
- if (input.headers) {
37731
- if (typeof input.headers.getSetCookie === "function") {
37732
- // for fetch responses - they combine headers of the same type in the headers array,
37733
- // but getSetCookie returns an uncombined array
37734
- input = input.headers.getSetCookie();
37735
- } else if (input.headers["set-cookie"]) {
37736
- // fast-path for node.js (which automatically normalizes header names to lower-case
37737
- input = input.headers["set-cookie"];
37738
- } else {
37739
- // slow-path for other environments - see #25
37740
- var sch =
37741
- input.headers[
37742
- Object.keys(input.headers).find(function (key) {
37743
- return key.toLowerCase() === "set-cookie";
37744
- })
37745
- ];
37746
- // warn if called on a request-like object with a cookie header rather than a set-cookie header - see #34, 36
37747
- if (!sch && input.headers.cookie && !options.silent) {
37748
- console.warn(
37749
- "Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning."
37750
- );
37751
- }
37752
- input = sch;
37753
- }
37754
- }
37755
- if (!Array.isArray(input)) {
37756
- input = [input];
37757
- }
37758
-
37759
- if (!options.map) {
37760
- return input.filter(isNonEmptyString).map(function (str) {
37761
- return parseString(str, options);
37762
- });
37763
- } else {
37764
- var cookies = {};
37765
- return input.filter(isNonEmptyString).reduce(function (cookies, str) {
37766
- var cookie = parseString(str, options);
37767
- cookies[cookie.name] = cookie;
37768
- return cookies;
37769
- }, cookies);
37770
- }
37771
- }
37772
-
37773
- /*
37774
- Set-Cookie header field-values are sometimes comma joined in one string. This splits them without choking on commas
37775
- that are within a single set-cookie field-value, such as in the Expires portion.
37776
-
37777
- This is uncommon, but explicitly allowed - see https://tools.ietf.org/html/rfc2616#section-4.2
37778
- Node.js does this for every header *except* set-cookie - see https://github.com/nodejs/node/blob/d5e363b77ebaf1caf67cd7528224b651c86815c1/lib/_http_incoming.js#L128
37779
- React Native's fetch does this for *every* header, including set-cookie.
37780
-
37781
- Based on: https://github.com/google/j2objc/commit/16820fdbc8f76ca0c33472810ce0cb03d20efe25
37782
- Credits to: https://github.com/tomball for original and https://github.com/chrusart for JavaScript implementation
37783
- */
37784
- function splitCookiesString(cookiesString) {
37785
- if (Array.isArray(cookiesString)) {
37786
- return cookiesString;
37787
- }
37788
- if (typeof cookiesString !== "string") {
37789
- return [];
37790
- }
37791
-
37792
- var cookiesStrings = [];
37793
- var pos = 0;
37794
- var start;
37795
- var ch;
37796
- var lastComma;
37797
- var nextStart;
37798
- var cookiesSeparatorFound;
37799
-
37800
- function skipWhitespace() {
37801
- while (pos < cookiesString.length && /\s/.test(cookiesString.charAt(pos))) {
37802
- pos += 1;
37803
- }
37804
- return pos < cookiesString.length;
37805
- }
37806
-
37807
- function notSpecialChar() {
37808
- ch = cookiesString.charAt(pos);
37809
-
37810
- return ch !== "=" && ch !== ";" && ch !== ",";
37811
- }
37812
-
37813
- while (pos < cookiesString.length) {
37814
- start = pos;
37815
- cookiesSeparatorFound = false;
37816
-
37817
- while (skipWhitespace()) {
37818
- ch = cookiesString.charAt(pos);
37819
- if (ch === ",") {
37820
- // ',' is a cookie separator if we have later first '=', not ';' or ','
37821
- lastComma = pos;
37822
- pos += 1;
37823
-
37824
- skipWhitespace();
37825
- nextStart = pos;
37826
-
37827
- while (pos < cookiesString.length && notSpecialChar()) {
37828
- pos += 1;
37829
- }
37830
-
37831
- // currently special character
37832
- if (pos < cookiesString.length && cookiesString.charAt(pos) === "=") {
37833
- // we found cookies separator
37834
- cookiesSeparatorFound = true;
37835
- // pos is inside the next cookie, so back up and return it.
37836
- pos = nextStart;
37837
- cookiesStrings.push(cookiesString.substring(start, lastComma));
37838
- start = pos;
37839
- } else {
37840
- // in param ',' or param separator ';',
37841
- // we continue from that comma
37842
- pos = lastComma + 1;
37843
- }
37844
- } else {
37845
- pos += 1;
37846
- }
37847
- }
37848
-
37849
- if (!cookiesSeparatorFound || pos >= cookiesString.length) {
37850
- cookiesStrings.push(cookiesString.substring(start, cookiesString.length));
37851
- }
37852
- }
37853
-
37854
- return cookiesStrings;
37855
- }
37856
-
37857
- setCookie.exports = parse;
37858
- setCookie.exports.parse = parse;
37859
- setCookie.exports.parseString = parseString;
37860
- setCookie.exports.splitCookiesString = splitCookiesString;
37861
- return setCookie.exports;
37862
- }
37863
-
37864
- requireSetCookie();
37865
-
37866
37483
  /**
37867
- * react-router v7.6.2
37484
+ * react-router v7.8.1
37868
37485
  *
37869
37486
  * Copyright (c) Remix Software Inc.
37870
37487
  *
@@ -38063,12 +37680,12 @@ function createBrowserURLImpl(to, isAbsolute = false) {
38063
37680
  base = window.location.origin !== "null" ? window.location.origin : window.location.href;
38064
37681
  }
38065
37682
  invariant(base, "No window.location.(origin|href) available to create URL");
38066
- let href2 = typeof to === "string" ? to : createPath(to);
38067
- href2 = href2.replace(/ $/, "%20");
38068
- if (!isAbsolute && href2.startsWith("//")) {
38069
- href2 = base + href2;
37683
+ let href = typeof to === "string" ? to : createPath(to);
37684
+ href = href.replace(/ $/, "%20");
37685
+ if (!isAbsolute && href.startsWith("//")) {
37686
+ href = base + href;
38070
37687
  }
38071
- return new URL(href2, base);
37688
+ return new URL(href, base);
38072
37689
  }
38073
37690
  function matchRoutes(routes, locationArg, basename = "/") {
38074
37691
  return matchRoutesImpl(routes, locationArg, basename, false);
@@ -38092,8 +37709,8 @@ function matchRoutesImpl(routes, locationArg, basename, allowPartial) {
38092
37709
  }
38093
37710
  return matches;
38094
37711
  }
38095
- function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "") {
38096
- let flattenRoute = (route, index, relativePath) => {
37712
+ function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "", _hasParentOptionalSegments = false) {
37713
+ let flattenRoute = (route, index, hasParentOptionalSegments = _hasParentOptionalSegments, relativePath) => {
38097
37714
  let meta = {
38098
37715
  relativePath: relativePath === void 0 ? route.path || "" : relativePath,
38099
37716
  caseSensitive: route.caseSensitive === true,
@@ -38101,6 +37718,9 @@ function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "")
38101
37718
  route
38102
37719
  };
38103
37720
  if (meta.relativePath.startsWith("/")) {
37721
+ if (!meta.relativePath.startsWith(parentPath) && hasParentOptionalSegments) {
37722
+ return;
37723
+ }
38104
37724
  invariant(
38105
37725
  meta.relativePath.startsWith(parentPath),
38106
37726
  `Absolute route path "${meta.relativePath}" nested under path "${parentPath}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`
@@ -38116,7 +37736,13 @@ function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "")
38116
37736
  route.index !== true,
38117
37737
  `Index routes must not have child routes. Please remove all child routes from route path "${path}".`
38118
37738
  );
38119
- flattenRoutes(route.children, branches, routesMeta, path);
37739
+ flattenRoutes(
37740
+ route.children,
37741
+ branches,
37742
+ routesMeta,
37743
+ path,
37744
+ hasParentOptionalSegments
37745
+ );
38120
37746
  }
38121
37747
  if (route.path == null && !route.index) {
38122
37748
  return;
@@ -38132,7 +37758,7 @@ function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "")
38132
37758
  flattenRoute(route, index);
38133
37759
  } else {
38134
37760
  for (let exploded of explodeOptionalSegments(route.path)) {
38135
- flattenRoute(route, index, exploded);
37761
+ flattenRoute(route, index, true, exploded);
38136
37762
  }
38137
37763
  }
38138
37764
  });
@@ -38296,7 +37922,7 @@ function compilePath(path, caseSensitive = false, end = true) {
38296
37922
  params.push({ paramName, isOptional: isOptional != null });
38297
37923
  return isOptional ? "/?([^\\/]+)?" : "/([^\\/]+)";
38298
37924
  }
38299
- );
37925
+ ).replace(/\/([\w-]+)\?(\/|$)/g, "(/$1)?$2");
38300
37926
  if (path.endsWith("*")) {
38301
37927
  params.push({ paramName: "*" });
38302
37928
  regexpSource += path === "*" || path === "/*" ? "(.*)$" : "(?:\\/(.+)|\\/*)$";
@@ -38443,6 +38069,7 @@ var DataRouterContext = React2.createContext(null);
38443
38069
  DataRouterContext.displayName = "DataRouter";
38444
38070
  var DataRouterStateContext = React2.createContext(null);
38445
38071
  DataRouterStateContext.displayName = "DataRouterState";
38072
+ React2.createContext(false);
38446
38073
  var ViewTransitionContext = React2.createContext({
38447
38074
  isTransitioning: false
38448
38075
  });
@@ -38761,68 +38388,71 @@ function _renderMatches(matches, parentMatches = [], dataRouterState = null, fut
38761
38388
  }
38762
38389
  }
38763
38390
  }
38764
- return renderedMatches.reduceRight((outlet, match, index) => {
38765
- let error;
38766
- let shouldRenderHydrateFallback = false;
38767
- let errorElement = null;
38768
- let hydrateFallbackElement = null;
38769
- if (dataRouterState) {
38770
- error = errors && match.route.id ? errors[match.route.id] : void 0;
38771
- errorElement = match.route.errorElement || defaultErrorElement;
38772
- if (renderFallback) {
38773
- if (fallbackIndex < 0 && index === 0) {
38774
- warningOnce(
38775
- "route-fallback",
38776
- false,
38777
- "No `HydrateFallback` element provided to render during initial hydration"
38778
- );
38779
- shouldRenderHydrateFallback = true;
38780
- hydrateFallbackElement = null;
38781
- } else if (fallbackIndex === index) {
38782
- shouldRenderHydrateFallback = true;
38783
- hydrateFallbackElement = match.route.hydrateFallbackElement || null;
38391
+ return renderedMatches.reduceRight(
38392
+ (outlet, match, index) => {
38393
+ let error;
38394
+ let shouldRenderHydrateFallback = false;
38395
+ let errorElement = null;
38396
+ let hydrateFallbackElement = null;
38397
+ if (dataRouterState) {
38398
+ error = errors && match.route.id ? errors[match.route.id] : void 0;
38399
+ errorElement = match.route.errorElement || defaultErrorElement;
38400
+ if (renderFallback) {
38401
+ if (fallbackIndex < 0 && index === 0) {
38402
+ warningOnce(
38403
+ "route-fallback",
38404
+ false,
38405
+ "No `HydrateFallback` element provided to render during initial hydration"
38406
+ );
38407
+ shouldRenderHydrateFallback = true;
38408
+ hydrateFallbackElement = null;
38409
+ } else if (fallbackIndex === index) {
38410
+ shouldRenderHydrateFallback = true;
38411
+ hydrateFallbackElement = match.route.hydrateFallbackElement || null;
38412
+ }
38784
38413
  }
38785
38414
  }
38786
- }
38787
- let matches2 = parentMatches.concat(renderedMatches.slice(0, index + 1));
38788
- let getChildren = () => {
38789
- let children;
38790
- if (error) {
38791
- children = errorElement;
38792
- } else if (shouldRenderHydrateFallback) {
38793
- children = hydrateFallbackElement;
38794
- } else if (match.route.Component) {
38795
- children = /* @__PURE__ */ React2.createElement(match.route.Component, null);
38796
- } else if (match.route.element) {
38797
- children = match.route.element;
38798
- } else {
38799
- children = outlet;
38800
- }
38801
- return /* @__PURE__ */ React2.createElement(
38802
- RenderedRoute,
38415
+ let matches2 = parentMatches.concat(renderedMatches.slice(0, index + 1));
38416
+ let getChildren = () => {
38417
+ let children;
38418
+ if (error) {
38419
+ children = errorElement;
38420
+ } else if (shouldRenderHydrateFallback) {
38421
+ children = hydrateFallbackElement;
38422
+ } else if (match.route.Component) {
38423
+ children = /* @__PURE__ */ React2.createElement(match.route.Component, null);
38424
+ } else if (match.route.element) {
38425
+ children = match.route.element;
38426
+ } else {
38427
+ children = outlet;
38428
+ }
38429
+ return /* @__PURE__ */ React2.createElement(
38430
+ RenderedRoute,
38431
+ {
38432
+ match,
38433
+ routeContext: {
38434
+ outlet,
38435
+ matches: matches2,
38436
+ isDataRoute: dataRouterState != null
38437
+ },
38438
+ children
38439
+ }
38440
+ );
38441
+ };
38442
+ return dataRouterState && (match.route.ErrorBoundary || match.route.errorElement || index === 0) ? /* @__PURE__ */ React2.createElement(
38443
+ RenderErrorBoundary,
38803
38444
  {
38804
- match,
38805
- routeContext: {
38806
- outlet,
38807
- matches: matches2,
38808
- isDataRoute: dataRouterState != null
38809
- },
38810
- children
38445
+ location: dataRouterState.location,
38446
+ revalidation: dataRouterState.revalidation,
38447
+ component: errorElement,
38448
+ error,
38449
+ children: getChildren(),
38450
+ routeContext: { outlet: null, matches: matches2, isDataRoute: true }
38811
38451
  }
38812
- );
38813
- };
38814
- return dataRouterState && (match.route.ErrorBoundary || match.route.errorElement || index === 0) ? /* @__PURE__ */ React2.createElement(
38815
- RenderErrorBoundary,
38816
- {
38817
- location: dataRouterState.location,
38818
- revalidation: dataRouterState.revalidation,
38819
- component: errorElement,
38820
- error,
38821
- children: getChildren(),
38822
- routeContext: { outlet: null, matches: matches2, isDataRoute: true }
38823
- }
38824
- ) : getChildren();
38825
- }, null);
38452
+ ) : getChildren();
38453
+ },
38454
+ null
38455
+ );
38826
38456
  }
38827
38457
  function getDataRouterConsoleError(hookName) {
38828
38458
  return `${hookName} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
@@ -39061,6 +38691,7 @@ function getFormSubmissionInfo(target, basename) {
39061
38691
  }
39062
38692
  return { action, method: method.toLowerCase(), encType, formData, body };
39063
38693
  }
38694
+ Object.getOwnPropertyNames(Object.prototype).sort().join("\0");
39064
38695
 
39065
38696
  // lib/dom/ssr/invariant.ts
39066
38697
  function invariant2(value, message) {
@@ -39068,6 +38699,22 @@ function invariant2(value, message) {
39068
38699
  throw new Error(message);
39069
38700
  }
39070
38701
  }
38702
+ function singleFetchUrl(reqUrl, basename, extension) {
38703
+ let url = typeof reqUrl === "string" ? new URL(
38704
+ reqUrl,
38705
+ // This can be called during the SSR flow via PrefetchPageLinksImpl so
38706
+ // don't assume window is available
38707
+ typeof window === "undefined" ? "server://singlefetch/" : window.location.origin
38708
+ ) : reqUrl;
38709
+ if (url.pathname === "/") {
38710
+ url.pathname = `_root.${extension}`;
38711
+ } else if (basename && stripBasename(url.pathname, basename) === "/") {
38712
+ url.pathname = `${basename.replace(/\/$/, "")}/_root.${extension}`;
38713
+ } else {
38714
+ url.pathname = `${url.pathname.replace(/\/$/, "")}.${extension}`;
38715
+ }
38716
+ return url;
38717
+ }
39071
38718
 
39072
38719
  // lib/dom/ssr/routeModules.ts
39073
38720
  async function loadRouteModule(route, routeModulesCache) {
@@ -39214,24 +38861,6 @@ function dedupeLinkDescriptors(descriptors, preloads) {
39214
38861
  return deduped;
39215
38862
  }, []);
39216
38863
  }
39217
- Object.getOwnPropertyNames(Object.prototype).sort().join("\0");
39218
- var NO_BODY_STATUS_CODES = /* @__PURE__ */ new Set([100, 101, 204, 205]);
39219
- function singleFetchUrl(reqUrl, basename) {
39220
- let url = typeof reqUrl === "string" ? new URL(
39221
- reqUrl,
39222
- // This can be called during the SSR flow via PrefetchPageLinksImpl so
39223
- // don't assume window is available
39224
- typeof window === "undefined" ? "server://singlefetch/" : window.location.origin
39225
- ) : reqUrl;
39226
- if (url.pathname === "/") {
39227
- url.pathname = "_root.data";
39228
- } else if (basename && stripBasename(url.pathname, basename) === "/") {
39229
- url.pathname = `${basename.replace(/\/$/, "")}/_root.data`;
39230
- } else {
39231
- url.pathname = `${url.pathname.replace(/\/$/, "")}.data`;
39232
- }
39233
- return url;
39234
- }
39235
38864
 
39236
38865
  // lib/dom/ssr/components.tsx
39237
38866
  function useDataRouterContext2() {
@@ -39326,10 +38955,7 @@ function composeEventHandlers(theirHandler, ourHandler) {
39326
38955
  }
39327
38956
  };
39328
38957
  }
39329
- function PrefetchPageLinks({
39330
- page,
39331
- ...dataLinkProps
39332
- }) {
38958
+ function PrefetchPageLinks({ page, ...linkProps }) {
39333
38959
  let { router } = useDataRouterContext2();
39334
38960
  let matches = React2.useMemo(
39335
38961
  () => matchRoutes(router.routes, page, router.basename),
@@ -39338,7 +38964,7 @@ function PrefetchPageLinks({
39338
38964
  if (!matches) {
39339
38965
  return null;
39340
38966
  }
39341
- return /* @__PURE__ */ React2.createElement(PrefetchPageLinksImpl, { page, matches, ...dataLinkProps });
38967
+ return /* @__PURE__ */ React2.createElement(PrefetchPageLinksImpl, { page, matches, ...linkProps });
39342
38968
  }
39343
38969
  function useKeyedPrefetchLinks(matches) {
39344
38970
  let { manifest, routeModules } = useFrameworkContext();
@@ -39411,7 +39037,7 @@ function PrefetchPageLinksImpl({
39411
39037
  if (routesParams.size === 0) {
39412
39038
  return [];
39413
39039
  }
39414
- let url = singleFetchUrl(page, basename);
39040
+ let url = singleFetchUrl(page, basename, "data");
39415
39041
  if (foundOptOutRoute && routesParams.size > 0) {
39416
39042
  url.searchParams.set(
39417
39043
  "_routes",
@@ -39434,10 +39060,10 @@ function PrefetchPageLinksImpl({
39434
39060
  [newMatchesForAssets, manifest]
39435
39061
  );
39436
39062
  let keyedPrefetchLinks = useKeyedPrefetchLinks(newMatchesForAssets);
39437
- return /* @__PURE__ */ React2.createElement(React2.Fragment, null, dataHrefs.map((href2) => /* @__PURE__ */ React2.createElement("link", { key: href2, rel: "prefetch", as: "fetch", href: href2, ...linkProps })), moduleHrefs.map((href2) => /* @__PURE__ */ React2.createElement("link", { key: href2, rel: "modulepreload", href: href2, ...linkProps })), keyedPrefetchLinks.map(({ key, link }) => (
39063
+ return /* @__PURE__ */ React2.createElement(React2.Fragment, null, dataHrefs.map((href) => /* @__PURE__ */ React2.createElement("link", { key: href, rel: "prefetch", as: "fetch", href, ...linkProps })), moduleHrefs.map((href) => /* @__PURE__ */ React2.createElement("link", { key: href, rel: "modulepreload", href, ...linkProps })), keyedPrefetchLinks.map(({ key, link }) => (
39438
39064
  // these don't spread `linkProps` because they are full link descriptors
39439
39065
  // already with their own props
39440
- /* @__PURE__ */ React2.createElement("link", { key, ...link })
39066
+ /* @__PURE__ */ React2.createElement("link", { key, nonce: linkProps.nonce, ...link })
39441
39067
  )));
39442
39068
  }
39443
39069
  function mergeRefs(...refs) {
@@ -39451,12 +39077,11 @@ function mergeRefs(...refs) {
39451
39077
  });
39452
39078
  };
39453
39079
  }
39454
-
39455
- // lib/dom/lib.tsx
39456
39080
  var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
39457
39081
  try {
39458
39082
  if (isBrowser) {
39459
- window.__reactRouterVersion = "7.6.2";
39083
+ window.__reactRouterVersion = // @ts-expect-error
39084
+ "7.8.1";
39460
39085
  }
39461
39086
  } catch (e) {
39462
39087
  }
@@ -39532,7 +39157,7 @@ var Link$1 = React2.forwardRef(
39532
39157
  }
39533
39158
  }
39534
39159
  }
39535
- let href2 = useHref(to, { relative });
39160
+ let href = useHref(to, { relative });
39536
39161
  let [shouldPrefetch, prefetchRef, prefetchHandlers] = usePrefetchBehavior(
39537
39162
  prefetch,
39538
39163
  rest
@@ -39558,7 +39183,7 @@ var Link$1 = React2.forwardRef(
39558
39183
  {
39559
39184
  ...rest,
39560
39185
  ...prefetchHandlers,
39561
- href: absoluteHref || href2,
39186
+ href: absoluteHref || href,
39562
39187
  onClick: isExternal || reloadDocument ? onClick : handleClick,
39563
39188
  ref: mergeRefs(forwardedRef, prefetchRef),
39564
39189
  target,
@@ -39566,7 +39191,7 @@ var Link$1 = React2.forwardRef(
39566
39191
  }
39567
39192
  )
39568
39193
  );
39569
- return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React2.createElement(React2.Fragment, null, link, /* @__PURE__ */ React2.createElement(PrefetchPageLinks, { page: href2 })) : link;
39194
+ return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React2.createElement(React2.Fragment, null, link, /* @__PURE__ */ React2.createElement(PrefetchPageLinks, { page: href })) : link;
39570
39195
  }
39571
39196
  );
39572
39197
  Link$1.displayName = "Link";
@@ -39802,7 +39427,7 @@ function useFormAction(action, { relative } = {}) {
39802
39427
  }
39803
39428
  return createPath(path);
39804
39429
  }
39805
- function useViewTransitionState(to, opts = {}) {
39430
+ function useViewTransitionState(to, { relative } = {}) {
39806
39431
  let vtContext = React2.useContext(ViewTransitionContext);
39807
39432
  invariant(
39808
39433
  vtContext != null,
@@ -39811,7 +39436,7 @@ function useViewTransitionState(to, opts = {}) {
39811
39436
  let { basename } = useDataRouterContext3(
39812
39437
  "useViewTransitionState" /* useViewTransitionState */
39813
39438
  );
39814
- let path = useResolvedPath(to, { relative: opts.relative });
39439
+ let path = useResolvedPath(to, { relative });
39815
39440
  if (!vtContext.isTransitioning) {
39816
39441
  return false;
39817
39442
  }
@@ -39820,12 +39445,6 @@ function useViewTransitionState(to, opts = {}) {
39820
39445
  return matchPath(path.pathname, nextPath) != null || matchPath(path.pathname, currentPath) != null;
39821
39446
  }
39822
39447
 
39823
- // lib/server-runtime/single-fetch.ts
39824
- /* @__PURE__ */ new Set([
39825
- ...NO_BODY_STATUS_CODES,
39826
- 304
39827
- ]);
39828
-
39829
39448
  const Section = ({
39830
39449
  items,
39831
39450
  title,