@dan-uni/dan-any 1.2.2 → 1.2.5

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.
Files changed (47) hide show
  1. package/README.md +1 -0
  2. package/dist/browser/17.min.js +2 -5
  3. package/dist/browser/705.min.js +77 -0
  4. package/dist/browser/plugins/bili.min.js +1 -0
  5. package/dist/browser/plugins/index.min.js +1 -1
  6. package/dist/browser/src/index.d.ts +1 -4
  7. package/dist/browser/src/plugins/bili/history-danmaku-fast-forward.d.ts +18 -0
  8. package/dist/browser/src/plugins/bili/index.d.ts +2 -0
  9. package/dist/browser/src/plugins/index.d.ts +1 -1
  10. package/dist/node/17.js +2 -5
  11. package/dist/node/705.js +77 -0
  12. package/dist/node/plugins/bili.js +1 -0
  13. package/dist/node/plugins/index.js +1 -1
  14. package/dist/node/src/index.d.ts +1 -4
  15. package/dist/node/src/plugins/bili/history-danmaku-fast-forward.d.ts +18 -0
  16. package/dist/node/src/plugins/bili/index.d.ts +2 -0
  17. package/dist/node/src/plugins/index.d.ts +1 -1
  18. package/dist/umd/index.umd.min.js +9 -7
  19. package/dist/umd/plugins/{bili-dedupe.umd.min.js → bili.umd.min.js} +4623 -12
  20. package/dist/umd/plugins/index.umd.min.js +4625 -14
  21. package/dist/umd/src/index.d.ts +1 -4
  22. package/dist/umd/src/plugins/bili/history-danmaku-fast-forward.d.ts +18 -0
  23. package/dist/umd/src/plugins/bili/index.d.ts +2 -0
  24. package/dist/umd/src/plugins/index.d.ts +1 -1
  25. package/package.json +4 -2
  26. package/rslib.config.ts +1 -1
  27. package/src/index.ts +1 -11
  28. package/src/plugins/bili/README.md +87 -0
  29. package/src/plugins/bili/history-danmaku-fast-forward.ts +86 -0
  30. package/src/plugins/bili/index.test.ts +129 -0
  31. package/src/plugins/bili/index.ts +2 -0
  32. package/src/plugins/index.ts +1 -1
  33. package/src/plugins/stats/README.md +44 -0
  34. package/src/plugins/stats/index.test.ts +1 -1
  35. package/dist/browser/157.min.js +0 -30
  36. package/dist/browser/plugins/bili-dedupe.min.js +0 -1
  37. package/dist/node/157.js +0 -30
  38. package/dist/node/plugins/bili-dedupe.js +0 -1
  39. package/src/plugins/bili-dedupe/index.test.ts +0 -43
  40. /package/dist/browser/src/plugins/{bili-dedupe/index.d.ts → bili/dedupe.d.ts} +0 -0
  41. /package/dist/browser/src/plugins/{bili-dedupe → bili}/index.test.d.ts +0 -0
  42. /package/dist/node/src/plugins/{bili-dedupe/index.d.ts → bili/dedupe.d.ts} +0 -0
  43. /package/dist/node/src/plugins/{bili-dedupe → bili}/index.test.d.ts +0 -0
  44. /package/dist/umd/plugins/{bili-dedupe.umd.min.js.LICENSE.txt → bili.umd.min.js.LICENSE.txt} +0 -0
  45. /package/dist/umd/src/plugins/{bili-dedupe/index.d.ts → bili/dedupe.d.ts} +0 -0
  46. /package/dist/umd/src/plugins/{bili-dedupe → bili}/index.test.d.ts +0 -0
  47. /package/src/plugins/{bili-dedupe/index.ts → bili/dedupe.ts} +0 -0
@@ -14398,11 +14398,11 @@
14398
14398
  },
14399
14399
  num_dec: {
14400
14400
  regex: /&#([0-9]{1,7});/g,
14401
- val: (_, str)=>String.fromCodePoint(Number.parseInt(str, 10))
14401
+ val: (_, str)=>fromCodePoint(str, 10, "&#")
14402
14402
  },
14403
14403
  num_hex: {
14404
14404
  regex: /&#x([0-9a-fA-F]{1,6});/g,
14405
- val: (_, str)=>String.fromCodePoint(Number.parseInt(str, 16))
14405
+ val: (_, str)=>fromCodePoint(str, 16, "&#x")
14406
14406
  }
14407
14407
  };
14408
14408
  this.addExternalEntities = addExternalEntities;
@@ -14778,6 +14778,11 @@
14778
14778
  if (isExist(val)) return val;
14779
14779
  return '';
14780
14780
  }
14781
+ function fromCodePoint(str, base, prefix) {
14782
+ const codePoint = Number.parseInt(str, base);
14783
+ if (codePoint >= 0 && codePoint <= 0x10FFFF) return String.fromCodePoint(codePoint);
14784
+ return prefix + str + ";";
14785
+ }
14781
14786
  const node2json_METADATA_SYMBOL = XmlNode.getMetaDataSymbol();
14782
14787
  function prettify(node, options) {
14783
14788
  return node2json_compress(node, options);
@@ -20334,7 +20339,7 @@
20334
20339
  function timestamp_timestampMs(timestamp) {
20335
20340
  return 1000 * Number(timestamp.seconds) + Math.round(timestamp.nanos / 1000000);
20336
20341
  }
20337
- var package_namespaceObject = JSON.parse('{"UU":"@dan-uni/dan-any","rE":"1.2.2","TB":"https://github.com/ani-uni/danuni/tree/master/packages/dan-any#readme"}');
20342
+ var package_namespaceObject = JSON.parse('{"UU":"@dan-uni/dan-any","rE":"1.2.5","TB":"https://github.com/ani-uni/danuni/tree/master/packages/dan-any#readme"}');
20338
20343
  const color_pad = (s)=>s.length < 2 ? `0${s}` : s;
20339
20344
  const decimalToHex = (n)=>color_pad(n.toString(16));
20340
20345
  const isDarkColor = ({ r, g, b })=>0.299 * r + 0.587 * g + 0.114 * b < 0x30;
@@ -23763,10 +23768,7 @@
23763
23768
  if (false !== options.dedupe) options.dedupe = true;
23764
23769
  if (this.options.dedupe) this.dedupe();
23765
23770
  }
23766
- async pipe(fn) {
23767
- return fn(this);
23768
- }
23769
- pipeSync(fn) {
23771
+ pipe(fn) {
23770
23772
  return fn(this);
23771
23773
  }
23772
23774
  get shared() {
@@ -24311,18 +24313,24 @@
24311
24313
  }
24312
24314
  }
24313
24315
  },
24314
- "./src/plugins/bili-dedupe/index.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
24316
+ "./src/plugins/bili/index.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
24315
24317
  "use strict";
24316
24318
  __webpack_require__.r(__webpack_exports__);
24317
24319
  __webpack_require__.d(__webpack_exports__, {
24320
+ bili_dedupe: ()=>dedupe_namespaceObject,
24321
+ bili_history_fast_forward: ()=>bili_history_fast_forward
24322
+ });
24323
+ var dedupe_namespaceObject = {};
24324
+ __webpack_require__.r(dedupe_namespaceObject);
24325
+ __webpack_require__.d(dedupe_namespaceObject, {
24318
24326
  bili_dedupe: ()=>bili_dedupe,
24319
24327
  to_bili_deduped: ()=>to_bili_deduped
24320
24328
  });
24321
- var ___rspack_import_0 = __webpack_require__("./src/index.ts");
24322
- var _utils_platform__rspack_import_1 = __webpack_require__("./src/utils/platform.ts");
24329
+ var src = __webpack_require__("./src/index.ts");
24330
+ var platform = __webpack_require__("./src/utils/platform.ts");
24323
24331
  function main(that) {
24324
24332
  that.dans.forEach((d)=>{
24325
- if (d.platform !== _utils_platform__rspack_import_1.PlatformVideoSource.Bilibili) throw new Error('bili-dedupe: 仅支持B站(主站)的弹幕');
24333
+ if (d.platform !== platform.PlatformVideoSource.Bilibili) throw new Error('bili-dedupe: 仅支持B站(主站)的弹幕');
24326
24334
  if (!d.extra.bili?.dmid) throw new Error('bili-dedupe: 弹幕缺少bili extra dmid字段');
24327
24335
  });
24328
24336
  const map = new Map();
@@ -24331,7 +24339,7 @@
24331
24339
  }
24332
24340
  function to_bili_deduped(that) {
24333
24341
  const map = main(that);
24334
- return new ___rspack_import_0.UniPool([
24342
+ return new src.UniPool([
24335
24343
  ...map.values()
24336
24344
  ], that.options, that.info);
24337
24345
  }
@@ -24341,6 +24349,4609 @@
24341
24349
  ...map.values()
24342
24350
  ];
24343
24351
  }
24352
+ class LuxonError extends Error {
24353
+ }
24354
+ class InvalidDateTimeError extends LuxonError {
24355
+ constructor(reason){
24356
+ super(`Invalid DateTime: ${reason.toMessage()}`);
24357
+ }
24358
+ }
24359
+ class InvalidIntervalError extends LuxonError {
24360
+ constructor(reason){
24361
+ super(`Invalid Interval: ${reason.toMessage()}`);
24362
+ }
24363
+ }
24364
+ class InvalidDurationError extends LuxonError {
24365
+ constructor(reason){
24366
+ super(`Invalid Duration: ${reason.toMessage()}`);
24367
+ }
24368
+ }
24369
+ class ConflictingSpecificationError extends LuxonError {
24370
+ }
24371
+ class InvalidUnitError extends LuxonError {
24372
+ constructor(unit){
24373
+ super(`Invalid unit ${unit}`);
24374
+ }
24375
+ }
24376
+ class InvalidArgumentError extends LuxonError {
24377
+ }
24378
+ class ZoneIsAbstractError extends LuxonError {
24379
+ constructor(){
24380
+ super("Zone is an abstract class");
24381
+ }
24382
+ }
24383
+ const luxon_n = "numeric", luxon_s = "short", luxon_l = "long";
24384
+ const DATE_SHORT = {
24385
+ year: luxon_n,
24386
+ month: luxon_n,
24387
+ day: luxon_n
24388
+ };
24389
+ const DATE_MED = {
24390
+ year: luxon_n,
24391
+ month: luxon_s,
24392
+ day: luxon_n
24393
+ };
24394
+ const DATE_MED_WITH_WEEKDAY = {
24395
+ year: luxon_n,
24396
+ month: luxon_s,
24397
+ day: luxon_n,
24398
+ weekday: luxon_s
24399
+ };
24400
+ const DATE_FULL = {
24401
+ year: luxon_n,
24402
+ month: luxon_l,
24403
+ day: luxon_n
24404
+ };
24405
+ const DATE_HUGE = {
24406
+ year: luxon_n,
24407
+ month: luxon_l,
24408
+ day: luxon_n,
24409
+ weekday: luxon_l
24410
+ };
24411
+ const TIME_SIMPLE = {
24412
+ hour: luxon_n,
24413
+ minute: luxon_n
24414
+ };
24415
+ const TIME_WITH_SECONDS = {
24416
+ hour: luxon_n,
24417
+ minute: luxon_n,
24418
+ second: luxon_n
24419
+ };
24420
+ const TIME_WITH_SHORT_OFFSET = {
24421
+ hour: luxon_n,
24422
+ minute: luxon_n,
24423
+ second: luxon_n,
24424
+ timeZoneName: luxon_s
24425
+ };
24426
+ const TIME_WITH_LONG_OFFSET = {
24427
+ hour: luxon_n,
24428
+ minute: luxon_n,
24429
+ second: luxon_n,
24430
+ timeZoneName: luxon_l
24431
+ };
24432
+ const TIME_24_SIMPLE = {
24433
+ hour: luxon_n,
24434
+ minute: luxon_n,
24435
+ hourCycle: "h23"
24436
+ };
24437
+ const TIME_24_WITH_SECONDS = {
24438
+ hour: luxon_n,
24439
+ minute: luxon_n,
24440
+ second: luxon_n,
24441
+ hourCycle: "h23"
24442
+ };
24443
+ const TIME_24_WITH_SHORT_OFFSET = {
24444
+ hour: luxon_n,
24445
+ minute: luxon_n,
24446
+ second: luxon_n,
24447
+ hourCycle: "h23",
24448
+ timeZoneName: luxon_s
24449
+ };
24450
+ const TIME_24_WITH_LONG_OFFSET = {
24451
+ hour: luxon_n,
24452
+ minute: luxon_n,
24453
+ second: luxon_n,
24454
+ hourCycle: "h23",
24455
+ timeZoneName: luxon_l
24456
+ };
24457
+ const DATETIME_SHORT = {
24458
+ year: luxon_n,
24459
+ month: luxon_n,
24460
+ day: luxon_n,
24461
+ hour: luxon_n,
24462
+ minute: luxon_n
24463
+ };
24464
+ const DATETIME_SHORT_WITH_SECONDS = {
24465
+ year: luxon_n,
24466
+ month: luxon_n,
24467
+ day: luxon_n,
24468
+ hour: luxon_n,
24469
+ minute: luxon_n,
24470
+ second: luxon_n
24471
+ };
24472
+ const DATETIME_MED = {
24473
+ year: luxon_n,
24474
+ month: luxon_s,
24475
+ day: luxon_n,
24476
+ hour: luxon_n,
24477
+ minute: luxon_n
24478
+ };
24479
+ const DATETIME_MED_WITH_SECONDS = {
24480
+ year: luxon_n,
24481
+ month: luxon_s,
24482
+ day: luxon_n,
24483
+ hour: luxon_n,
24484
+ minute: luxon_n,
24485
+ second: luxon_n
24486
+ };
24487
+ const DATETIME_MED_WITH_WEEKDAY = {
24488
+ year: luxon_n,
24489
+ month: luxon_s,
24490
+ day: luxon_n,
24491
+ weekday: luxon_s,
24492
+ hour: luxon_n,
24493
+ minute: luxon_n
24494
+ };
24495
+ const DATETIME_FULL = {
24496
+ year: luxon_n,
24497
+ month: luxon_l,
24498
+ day: luxon_n,
24499
+ hour: luxon_n,
24500
+ minute: luxon_n,
24501
+ timeZoneName: luxon_s
24502
+ };
24503
+ const DATETIME_FULL_WITH_SECONDS = {
24504
+ year: luxon_n,
24505
+ month: luxon_l,
24506
+ day: luxon_n,
24507
+ hour: luxon_n,
24508
+ minute: luxon_n,
24509
+ second: luxon_n,
24510
+ timeZoneName: luxon_s
24511
+ };
24512
+ const DATETIME_HUGE = {
24513
+ year: luxon_n,
24514
+ month: luxon_l,
24515
+ day: luxon_n,
24516
+ weekday: luxon_l,
24517
+ hour: luxon_n,
24518
+ minute: luxon_n,
24519
+ timeZoneName: luxon_l
24520
+ };
24521
+ const DATETIME_HUGE_WITH_SECONDS = {
24522
+ year: luxon_n,
24523
+ month: luxon_l,
24524
+ day: luxon_n,
24525
+ weekday: luxon_l,
24526
+ hour: luxon_n,
24527
+ minute: luxon_n,
24528
+ second: luxon_n,
24529
+ timeZoneName: luxon_l
24530
+ };
24531
+ class Zone {
24532
+ get type() {
24533
+ throw new ZoneIsAbstractError();
24534
+ }
24535
+ get name() {
24536
+ throw new ZoneIsAbstractError();
24537
+ }
24538
+ get ianaName() {
24539
+ return this.name;
24540
+ }
24541
+ get isUniversal() {
24542
+ throw new ZoneIsAbstractError();
24543
+ }
24544
+ offsetName(ts, opts) {
24545
+ throw new ZoneIsAbstractError();
24546
+ }
24547
+ formatOffset(ts, format) {
24548
+ throw new ZoneIsAbstractError();
24549
+ }
24550
+ offset(ts) {
24551
+ throw new ZoneIsAbstractError();
24552
+ }
24553
+ equals(otherZone) {
24554
+ throw new ZoneIsAbstractError();
24555
+ }
24556
+ get isValid() {
24557
+ throw new ZoneIsAbstractError();
24558
+ }
24559
+ }
24560
+ let singleton$1 = null;
24561
+ class SystemZone extends Zone {
24562
+ static get instance() {
24563
+ if (null === singleton$1) singleton$1 = new SystemZone();
24564
+ return singleton$1;
24565
+ }
24566
+ get type() {
24567
+ return "system";
24568
+ }
24569
+ get name() {
24570
+ return new Intl.DateTimeFormat().resolvedOptions().timeZone;
24571
+ }
24572
+ get isUniversal() {
24573
+ return false;
24574
+ }
24575
+ offsetName(ts, { format, locale }) {
24576
+ return parseZoneInfo(ts, format, locale);
24577
+ }
24578
+ formatOffset(ts, format) {
24579
+ return luxon_formatOffset(this.offset(ts), format);
24580
+ }
24581
+ offset(ts) {
24582
+ return -new Date(ts).getTimezoneOffset();
24583
+ }
24584
+ equals(otherZone) {
24585
+ return "system" === otherZone.type;
24586
+ }
24587
+ get isValid() {
24588
+ return true;
24589
+ }
24590
+ }
24591
+ const dtfCache = new Map();
24592
+ function makeDTF(zoneName) {
24593
+ let dtf = dtfCache.get(zoneName);
24594
+ if (void 0 === dtf) {
24595
+ dtf = new Intl.DateTimeFormat("en-US", {
24596
+ hour12: false,
24597
+ timeZone: zoneName,
24598
+ year: "numeric",
24599
+ month: "2-digit",
24600
+ day: "2-digit",
24601
+ hour: "2-digit",
24602
+ minute: "2-digit",
24603
+ second: "2-digit",
24604
+ era: "short"
24605
+ });
24606
+ dtfCache.set(zoneName, dtf);
24607
+ }
24608
+ return dtf;
24609
+ }
24610
+ const typeToPos = {
24611
+ year: 0,
24612
+ month: 1,
24613
+ day: 2,
24614
+ era: 3,
24615
+ hour: 4,
24616
+ minute: 5,
24617
+ second: 6
24618
+ };
24619
+ function hackyOffset(dtf, date) {
24620
+ const formatted = dtf.format(date).replace(/\u200E/g, ""), parsed = /(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(formatted), [, fMonth, fDay, fYear, fadOrBc, fHour, fMinute, fSecond] = parsed;
24621
+ return [
24622
+ fYear,
24623
+ fMonth,
24624
+ fDay,
24625
+ fadOrBc,
24626
+ fHour,
24627
+ fMinute,
24628
+ fSecond
24629
+ ];
24630
+ }
24631
+ function partsOffset(dtf, date) {
24632
+ const formatted = dtf.formatToParts(date);
24633
+ const filled = [];
24634
+ for(let i = 0; i < formatted.length; i++){
24635
+ const { type, value } = formatted[i];
24636
+ const pos = typeToPos[type];
24637
+ if ("era" === type) filled[pos] = value;
24638
+ else if (!isUndefined(pos)) filled[pos] = parseInt(value, 10);
24639
+ }
24640
+ return filled;
24641
+ }
24642
+ const ianaZoneCache = new Map();
24643
+ class IANAZone extends Zone {
24644
+ static create(name) {
24645
+ let zone = ianaZoneCache.get(name);
24646
+ if (void 0 === zone) ianaZoneCache.set(name, zone = new IANAZone(name));
24647
+ return zone;
24648
+ }
24649
+ static resetCache() {
24650
+ ianaZoneCache.clear();
24651
+ dtfCache.clear();
24652
+ }
24653
+ static isValidSpecifier(s) {
24654
+ return this.isValidZone(s);
24655
+ }
24656
+ static isValidZone(zone) {
24657
+ if (!zone) return false;
24658
+ try {
24659
+ new Intl.DateTimeFormat("en-US", {
24660
+ timeZone: zone
24661
+ }).format();
24662
+ return true;
24663
+ } catch (e) {
24664
+ return false;
24665
+ }
24666
+ }
24667
+ constructor(name){
24668
+ super();
24669
+ this.zoneName = name;
24670
+ this.valid = IANAZone.isValidZone(name);
24671
+ }
24672
+ get type() {
24673
+ return "iana";
24674
+ }
24675
+ get name() {
24676
+ return this.zoneName;
24677
+ }
24678
+ get isUniversal() {
24679
+ return false;
24680
+ }
24681
+ offsetName(ts, { format, locale }) {
24682
+ return parseZoneInfo(ts, format, locale, this.name);
24683
+ }
24684
+ formatOffset(ts, format) {
24685
+ return luxon_formatOffset(this.offset(ts), format);
24686
+ }
24687
+ offset(ts) {
24688
+ if (!this.valid) return NaN;
24689
+ const date = new Date(ts);
24690
+ if (isNaN(date)) return NaN;
24691
+ const dtf = makeDTF(this.name);
24692
+ let [year, month, day, adOrBc, hour, minute, second] = dtf.formatToParts ? partsOffset(dtf, date) : hackyOffset(dtf, date);
24693
+ if ("BC" === adOrBc) year = -Math.abs(year) + 1;
24694
+ const adjustedHour = 24 === hour ? 0 : hour;
24695
+ const asUTC = objToLocalTS({
24696
+ year,
24697
+ month,
24698
+ day,
24699
+ hour: adjustedHour,
24700
+ minute,
24701
+ second,
24702
+ millisecond: 0
24703
+ });
24704
+ let asTS = +date;
24705
+ const over = asTS % 1000;
24706
+ asTS -= over >= 0 ? over : 1000 + over;
24707
+ return (asUTC - asTS) / 60000;
24708
+ }
24709
+ equals(otherZone) {
24710
+ return "iana" === otherZone.type && otherZone.name === this.name;
24711
+ }
24712
+ get isValid() {
24713
+ return this.valid;
24714
+ }
24715
+ }
24716
+ let intlLFCache = {};
24717
+ function getCachedLF(locString, opts = {}) {
24718
+ const key = JSON.stringify([
24719
+ locString,
24720
+ opts
24721
+ ]);
24722
+ let dtf = intlLFCache[key];
24723
+ if (!dtf) {
24724
+ dtf = new Intl.ListFormat(locString, opts);
24725
+ intlLFCache[key] = dtf;
24726
+ }
24727
+ return dtf;
24728
+ }
24729
+ const intlDTCache = new Map();
24730
+ function getCachedDTF(locString, opts = {}) {
24731
+ const key = JSON.stringify([
24732
+ locString,
24733
+ opts
24734
+ ]);
24735
+ let dtf = intlDTCache.get(key);
24736
+ if (void 0 === dtf) {
24737
+ dtf = new Intl.DateTimeFormat(locString, opts);
24738
+ intlDTCache.set(key, dtf);
24739
+ }
24740
+ return dtf;
24741
+ }
24742
+ const intlNumCache = new Map();
24743
+ function getCachedINF(locString, opts = {}) {
24744
+ const key = JSON.stringify([
24745
+ locString,
24746
+ opts
24747
+ ]);
24748
+ let inf = intlNumCache.get(key);
24749
+ if (void 0 === inf) {
24750
+ inf = new Intl.NumberFormat(locString, opts);
24751
+ intlNumCache.set(key, inf);
24752
+ }
24753
+ return inf;
24754
+ }
24755
+ const intlRelCache = new Map();
24756
+ function getCachedRTF(locString, opts = {}) {
24757
+ const { base, ...cacheKeyOpts } = opts;
24758
+ const key = JSON.stringify([
24759
+ locString,
24760
+ cacheKeyOpts
24761
+ ]);
24762
+ let inf = intlRelCache.get(key);
24763
+ if (void 0 === inf) {
24764
+ inf = new Intl.RelativeTimeFormat(locString, opts);
24765
+ intlRelCache.set(key, inf);
24766
+ }
24767
+ return inf;
24768
+ }
24769
+ let sysLocaleCache = null;
24770
+ function systemLocale() {
24771
+ if (sysLocaleCache) return sysLocaleCache;
24772
+ sysLocaleCache = new Intl.DateTimeFormat().resolvedOptions().locale;
24773
+ return sysLocaleCache;
24774
+ }
24775
+ const intlResolvedOptionsCache = new Map();
24776
+ function getCachedIntResolvedOptions(locString) {
24777
+ let opts = intlResolvedOptionsCache.get(locString);
24778
+ if (void 0 === opts) {
24779
+ opts = new Intl.DateTimeFormat(locString).resolvedOptions();
24780
+ intlResolvedOptionsCache.set(locString, opts);
24781
+ }
24782
+ return opts;
24783
+ }
24784
+ const weekInfoCache = new Map();
24785
+ function getCachedWeekInfo(locString) {
24786
+ let data = weekInfoCache.get(locString);
24787
+ if (!data) {
24788
+ const locale = new Intl.Locale(locString);
24789
+ data = "getWeekInfo" in locale ? locale.getWeekInfo() : locale.weekInfo;
24790
+ if (!("minimalDays" in data)) data = {
24791
+ ...fallbackWeekSettings,
24792
+ ...data
24793
+ };
24794
+ weekInfoCache.set(locString, data);
24795
+ }
24796
+ return data;
24797
+ }
24798
+ function parseLocaleString(localeStr) {
24799
+ const xIndex = localeStr.indexOf("-x-");
24800
+ if (-1 !== xIndex) localeStr = localeStr.substring(0, xIndex);
24801
+ const uIndex = localeStr.indexOf("-u-");
24802
+ if (-1 === uIndex) return [
24803
+ localeStr
24804
+ ];
24805
+ {
24806
+ let options;
24807
+ let selectedStr;
24808
+ try {
24809
+ options = getCachedDTF(localeStr).resolvedOptions();
24810
+ selectedStr = localeStr;
24811
+ } catch (e) {
24812
+ const smaller = localeStr.substring(0, uIndex);
24813
+ options = getCachedDTF(smaller).resolvedOptions();
24814
+ selectedStr = smaller;
24815
+ }
24816
+ const { numberingSystem, calendar } = options;
24817
+ return [
24818
+ selectedStr,
24819
+ numberingSystem,
24820
+ calendar
24821
+ ];
24822
+ }
24823
+ }
24824
+ function intlConfigString(localeStr, numberingSystem, outputCalendar) {
24825
+ if (!outputCalendar && !numberingSystem) return localeStr;
24826
+ if (!localeStr.includes("-u-")) localeStr += "-u";
24827
+ if (outputCalendar) localeStr += `-ca-${outputCalendar}`;
24828
+ if (numberingSystem) localeStr += `-nu-${numberingSystem}`;
24829
+ return localeStr;
24830
+ }
24831
+ function mapMonths(f) {
24832
+ const ms = [];
24833
+ for(let i = 1; i <= 12; i++){
24834
+ const dt = DateTime.utc(2009, i, 1);
24835
+ ms.push(f(dt));
24836
+ }
24837
+ return ms;
24838
+ }
24839
+ function mapWeekdays(f) {
24840
+ const ms = [];
24841
+ for(let i = 1; i <= 7; i++){
24842
+ const dt = DateTime.utc(2016, 11, 13 + i);
24843
+ ms.push(f(dt));
24844
+ }
24845
+ return ms;
24846
+ }
24847
+ function listStuff(loc, length, englishFn, intlFn) {
24848
+ const mode = loc.listingMode();
24849
+ if ("error" === mode) return null;
24850
+ if ("en" === mode) return englishFn(length);
24851
+ return intlFn(length);
24852
+ }
24853
+ function supportsFastNumbers(loc) {
24854
+ if (loc.numberingSystem && "latn" !== loc.numberingSystem) return false;
24855
+ return "latn" === loc.numberingSystem || !loc.locale || loc.locale.startsWith("en") || "latn" === getCachedIntResolvedOptions(loc.locale).numberingSystem;
24856
+ }
24857
+ class PolyNumberFormatter {
24858
+ constructor(intl, forceSimple, opts){
24859
+ this.padTo = opts.padTo || 0;
24860
+ this.floor = opts.floor || false;
24861
+ const { padTo, floor, ...otherOpts } = opts;
24862
+ if (!forceSimple || Object.keys(otherOpts).length > 0) {
24863
+ const intlOpts = {
24864
+ useGrouping: false,
24865
+ ...opts
24866
+ };
24867
+ if (opts.padTo > 0) intlOpts.minimumIntegerDigits = opts.padTo;
24868
+ this.inf = getCachedINF(intl, intlOpts);
24869
+ }
24870
+ }
24871
+ format(i) {
24872
+ if (this.inf) {
24873
+ const fixed = this.floor ? Math.floor(i) : i;
24874
+ return this.inf.format(fixed);
24875
+ }
24876
+ {
24877
+ const fixed = this.floor ? Math.floor(i) : roundTo(i, 3);
24878
+ return padStart(fixed, this.padTo);
24879
+ }
24880
+ }
24881
+ }
24882
+ class PolyDateFormatter {
24883
+ constructor(dt, intl, opts){
24884
+ this.opts = opts;
24885
+ this.originalZone = void 0;
24886
+ let z;
24887
+ if (this.opts.timeZone) this.dt = dt;
24888
+ else if ("fixed" === dt.zone.type) {
24889
+ const gmtOffset = -1 * (dt.offset / 60);
24890
+ const offsetZ = gmtOffset >= 0 ? `Etc/GMT+${gmtOffset}` : `Etc/GMT${gmtOffset}`;
24891
+ if (0 !== dt.offset && IANAZone.create(offsetZ).valid) {
24892
+ z = offsetZ;
24893
+ this.dt = dt;
24894
+ } else {
24895
+ z = "UTC";
24896
+ this.dt = 0 === dt.offset ? dt : dt.setZone("UTC").plus({
24897
+ minutes: dt.offset
24898
+ });
24899
+ this.originalZone = dt.zone;
24900
+ }
24901
+ } else if ("system" === dt.zone.type) this.dt = dt;
24902
+ else if ("iana" === dt.zone.type) {
24903
+ this.dt = dt;
24904
+ z = dt.zone.name;
24905
+ } else {
24906
+ z = "UTC";
24907
+ this.dt = dt.setZone("UTC").plus({
24908
+ minutes: dt.offset
24909
+ });
24910
+ this.originalZone = dt.zone;
24911
+ }
24912
+ const intlOpts = {
24913
+ ...this.opts
24914
+ };
24915
+ intlOpts.timeZone = intlOpts.timeZone || z;
24916
+ this.dtf = getCachedDTF(intl, intlOpts);
24917
+ }
24918
+ format() {
24919
+ if (this.originalZone) return this.formatToParts().map(({ value })=>value).join("");
24920
+ return this.dtf.format(this.dt.toJSDate());
24921
+ }
24922
+ formatToParts() {
24923
+ const parts = this.dtf.formatToParts(this.dt.toJSDate());
24924
+ if (this.originalZone) return parts.map((part)=>{
24925
+ if ("timeZoneName" !== part.type) return part;
24926
+ {
24927
+ const offsetName = this.originalZone.offsetName(this.dt.ts, {
24928
+ locale: this.dt.locale,
24929
+ format: this.opts.timeZoneName
24930
+ });
24931
+ return {
24932
+ ...part,
24933
+ value: offsetName
24934
+ };
24935
+ }
24936
+ });
24937
+ return parts;
24938
+ }
24939
+ resolvedOptions() {
24940
+ return this.dtf.resolvedOptions();
24941
+ }
24942
+ }
24943
+ class PolyRelFormatter {
24944
+ constructor(intl, isEnglish, opts){
24945
+ this.opts = {
24946
+ style: "long",
24947
+ ...opts
24948
+ };
24949
+ if (!isEnglish && hasRelative()) this.rtf = getCachedRTF(intl, opts);
24950
+ }
24951
+ format(count, unit) {
24952
+ if (this.rtf) return this.rtf.format(count, unit);
24953
+ return formatRelativeTime(unit, count, this.opts.numeric, "long" !== this.opts.style);
24954
+ }
24955
+ formatToParts(count, unit) {
24956
+ if (this.rtf) return this.rtf.formatToParts(count, unit);
24957
+ return [];
24958
+ }
24959
+ }
24960
+ const fallbackWeekSettings = {
24961
+ firstDay: 1,
24962
+ minimalDays: 4,
24963
+ weekend: [
24964
+ 6,
24965
+ 7
24966
+ ]
24967
+ };
24968
+ class Locale {
24969
+ static fromOpts(opts) {
24970
+ return Locale.create(opts.locale, opts.numberingSystem, opts.outputCalendar, opts.weekSettings, opts.defaultToEN);
24971
+ }
24972
+ static create(locale, numberingSystem, outputCalendar, weekSettings, defaultToEN = false) {
24973
+ const specifiedLocale = locale || Settings.defaultLocale;
24974
+ const localeR = specifiedLocale || (defaultToEN ? "en-US" : systemLocale());
24975
+ const numberingSystemR = numberingSystem || Settings.defaultNumberingSystem;
24976
+ const outputCalendarR = outputCalendar || Settings.defaultOutputCalendar;
24977
+ const weekSettingsR = validateWeekSettings(weekSettings) || Settings.defaultWeekSettings;
24978
+ return new Locale(localeR, numberingSystemR, outputCalendarR, weekSettingsR, specifiedLocale);
24979
+ }
24980
+ static resetCache() {
24981
+ sysLocaleCache = null;
24982
+ intlDTCache.clear();
24983
+ intlNumCache.clear();
24984
+ intlRelCache.clear();
24985
+ intlResolvedOptionsCache.clear();
24986
+ weekInfoCache.clear();
24987
+ }
24988
+ static fromObject({ locale, numberingSystem, outputCalendar, weekSettings } = {}) {
24989
+ return Locale.create(locale, numberingSystem, outputCalendar, weekSettings);
24990
+ }
24991
+ constructor(locale, numbering, outputCalendar, weekSettings, specifiedLocale){
24992
+ const [parsedLocale, parsedNumberingSystem, parsedOutputCalendar] = parseLocaleString(locale);
24993
+ this.locale = parsedLocale;
24994
+ this.numberingSystem = numbering || parsedNumberingSystem || null;
24995
+ this.outputCalendar = outputCalendar || parsedOutputCalendar || null;
24996
+ this.weekSettings = weekSettings;
24997
+ this.intl = intlConfigString(this.locale, this.numberingSystem, this.outputCalendar);
24998
+ this.weekdaysCache = {
24999
+ format: {},
25000
+ standalone: {}
25001
+ };
25002
+ this.monthsCache = {
25003
+ format: {},
25004
+ standalone: {}
25005
+ };
25006
+ this.meridiemCache = null;
25007
+ this.eraCache = {};
25008
+ this.specifiedLocale = specifiedLocale;
25009
+ this.fastNumbersCached = null;
25010
+ }
25011
+ get fastNumbers() {
25012
+ if (null == this.fastNumbersCached) this.fastNumbersCached = supportsFastNumbers(this);
25013
+ return this.fastNumbersCached;
25014
+ }
25015
+ listingMode() {
25016
+ const isActuallyEn = this.isEnglish();
25017
+ const hasNoWeirdness = (null === this.numberingSystem || "latn" === this.numberingSystem) && (null === this.outputCalendar || "gregory" === this.outputCalendar);
25018
+ return isActuallyEn && hasNoWeirdness ? "en" : "intl";
25019
+ }
25020
+ clone(alts) {
25021
+ if (!alts || 0 === Object.getOwnPropertyNames(alts).length) return this;
25022
+ return Locale.create(alts.locale || this.specifiedLocale, alts.numberingSystem || this.numberingSystem, alts.outputCalendar || this.outputCalendar, validateWeekSettings(alts.weekSettings) || this.weekSettings, alts.defaultToEN || false);
25023
+ }
25024
+ redefaultToEN(alts = {}) {
25025
+ return this.clone({
25026
+ ...alts,
25027
+ defaultToEN: true
25028
+ });
25029
+ }
25030
+ redefaultToSystem(alts = {}) {
25031
+ return this.clone({
25032
+ ...alts,
25033
+ defaultToEN: false
25034
+ });
25035
+ }
25036
+ months(length, format = false) {
25037
+ return listStuff(this, length, months, ()=>{
25038
+ const monthSpecialCase = "ja" === this.intl || this.intl.startsWith("ja-");
25039
+ format &= !monthSpecialCase;
25040
+ const intl = format ? {
25041
+ month: length,
25042
+ day: "numeric"
25043
+ } : {
25044
+ month: length
25045
+ }, formatStr = format ? "format" : "standalone";
25046
+ if (!this.monthsCache[formatStr][length]) {
25047
+ const mapper = monthSpecialCase ? (dt)=>this.dtFormatter(dt, intl).format() : (dt)=>this.extract(dt, intl, "month");
25048
+ this.monthsCache[formatStr][length] = mapMonths(mapper);
25049
+ }
25050
+ return this.monthsCache[formatStr][length];
25051
+ });
25052
+ }
25053
+ weekdays(length, format = false) {
25054
+ return listStuff(this, length, weekdays, ()=>{
25055
+ const intl = format ? {
25056
+ weekday: length,
25057
+ year: "numeric",
25058
+ month: "long",
25059
+ day: "numeric"
25060
+ } : {
25061
+ weekday: length
25062
+ }, formatStr = format ? "format" : "standalone";
25063
+ if (!this.weekdaysCache[formatStr][length]) this.weekdaysCache[formatStr][length] = mapWeekdays((dt)=>this.extract(dt, intl, "weekday"));
25064
+ return this.weekdaysCache[formatStr][length];
25065
+ });
25066
+ }
25067
+ meridiems() {
25068
+ return listStuff(this, void 0, ()=>meridiems, ()=>{
25069
+ if (!this.meridiemCache) {
25070
+ const intl = {
25071
+ hour: "numeric",
25072
+ hourCycle: "h12"
25073
+ };
25074
+ this.meridiemCache = [
25075
+ DateTime.utc(2016, 11, 13, 9),
25076
+ DateTime.utc(2016, 11, 13, 19)
25077
+ ].map((dt)=>this.extract(dt, intl, "dayperiod"));
25078
+ }
25079
+ return this.meridiemCache;
25080
+ });
25081
+ }
25082
+ eras(length) {
25083
+ return listStuff(this, length, eras, ()=>{
25084
+ const intl = {
25085
+ era: length
25086
+ };
25087
+ if (!this.eraCache[length]) this.eraCache[length] = [
25088
+ DateTime.utc(-40, 1, 1),
25089
+ DateTime.utc(2017, 1, 1)
25090
+ ].map((dt)=>this.extract(dt, intl, "era"));
25091
+ return this.eraCache[length];
25092
+ });
25093
+ }
25094
+ extract(dt, intlOpts, field) {
25095
+ const df = this.dtFormatter(dt, intlOpts), results = df.formatToParts(), matching = results.find((m)=>m.type.toLowerCase() === field);
25096
+ return matching ? matching.value : null;
25097
+ }
25098
+ numberFormatter(opts = {}) {
25099
+ return new PolyNumberFormatter(this.intl, opts.forceSimple || this.fastNumbers, opts);
25100
+ }
25101
+ dtFormatter(dt, intlOpts = {}) {
25102
+ return new PolyDateFormatter(dt, this.intl, intlOpts);
25103
+ }
25104
+ relFormatter(opts = {}) {
25105
+ return new PolyRelFormatter(this.intl, this.isEnglish(), opts);
25106
+ }
25107
+ listFormatter(opts = {}) {
25108
+ return getCachedLF(this.intl, opts);
25109
+ }
25110
+ isEnglish() {
25111
+ return "en" === this.locale || "en-us" === this.locale.toLowerCase() || getCachedIntResolvedOptions(this.intl).locale.startsWith("en-us");
25112
+ }
25113
+ getWeekSettings() {
25114
+ if (this.weekSettings) return this.weekSettings;
25115
+ if (!hasLocaleWeekInfo()) return fallbackWeekSettings;
25116
+ return getCachedWeekInfo(this.locale);
25117
+ }
25118
+ getStartOfWeek() {
25119
+ return this.getWeekSettings().firstDay;
25120
+ }
25121
+ getMinDaysInFirstWeek() {
25122
+ return this.getWeekSettings().minimalDays;
25123
+ }
25124
+ getWeekendDays() {
25125
+ return this.getWeekSettings().weekend;
25126
+ }
25127
+ equals(other) {
25128
+ return this.locale === other.locale && this.numberingSystem === other.numberingSystem && this.outputCalendar === other.outputCalendar;
25129
+ }
25130
+ toString() {
25131
+ return `Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`;
25132
+ }
25133
+ }
25134
+ let singleton = null;
25135
+ class FixedOffsetZone extends Zone {
25136
+ static get utcInstance() {
25137
+ if (null === singleton) singleton = new FixedOffsetZone(0);
25138
+ return singleton;
25139
+ }
25140
+ static instance(offset) {
25141
+ return 0 === offset ? FixedOffsetZone.utcInstance : new FixedOffsetZone(offset);
25142
+ }
25143
+ static parseSpecifier(s) {
25144
+ if (s) {
25145
+ const r = s.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);
25146
+ if (r) return new FixedOffsetZone(signedOffset(r[1], r[2]));
25147
+ }
25148
+ return null;
25149
+ }
25150
+ constructor(offset){
25151
+ super();
25152
+ this.fixed = offset;
25153
+ }
25154
+ get type() {
25155
+ return "fixed";
25156
+ }
25157
+ get name() {
25158
+ return 0 === this.fixed ? "UTC" : `UTC${luxon_formatOffset(this.fixed, "narrow")}`;
25159
+ }
25160
+ get ianaName() {
25161
+ if (0 === this.fixed) return "Etc/UTC";
25162
+ return `Etc/GMT${luxon_formatOffset(-this.fixed, "narrow")}`;
25163
+ }
25164
+ offsetName() {
25165
+ return this.name;
25166
+ }
25167
+ formatOffset(ts, format) {
25168
+ return luxon_formatOffset(this.fixed, format);
25169
+ }
25170
+ get isUniversal() {
25171
+ return true;
25172
+ }
25173
+ offset() {
25174
+ return this.fixed;
25175
+ }
25176
+ equals(otherZone) {
25177
+ return "fixed" === otherZone.type && otherZone.fixed === this.fixed;
25178
+ }
25179
+ get isValid() {
25180
+ return true;
25181
+ }
25182
+ }
25183
+ class InvalidZone extends Zone {
25184
+ constructor(zoneName){
25185
+ super();
25186
+ this.zoneName = zoneName;
25187
+ }
25188
+ get type() {
25189
+ return "invalid";
25190
+ }
25191
+ get name() {
25192
+ return this.zoneName;
25193
+ }
25194
+ get isUniversal() {
25195
+ return false;
25196
+ }
25197
+ offsetName() {
25198
+ return null;
25199
+ }
25200
+ formatOffset() {
25201
+ return "";
25202
+ }
25203
+ offset() {
25204
+ return NaN;
25205
+ }
25206
+ equals() {
25207
+ return false;
25208
+ }
25209
+ get isValid() {
25210
+ return false;
25211
+ }
25212
+ }
25213
+ function normalizeZone(input, defaultZone) {
25214
+ if (isUndefined(input) || null === input) return defaultZone;
25215
+ if (input instanceof Zone) return input;
25216
+ if (isString(input)) {
25217
+ const lowered = input.toLowerCase();
25218
+ if ("default" === lowered) return defaultZone;
25219
+ if ("local" === lowered || "system" === lowered) return SystemZone.instance;
25220
+ if ("utc" === lowered || "gmt" === lowered) return FixedOffsetZone.utcInstance;
25221
+ else return FixedOffsetZone.parseSpecifier(lowered) || IANAZone.create(input);
25222
+ }
25223
+ if (isNumber(input)) return FixedOffsetZone.instance(input);
25224
+ if ("object" == typeof input && "offset" in input && "function" == typeof input.offset) return input;
25225
+ else return new InvalidZone(input);
25226
+ }
25227
+ const numberingSystems = {
25228
+ arab: "[\u0660-\u0669]",
25229
+ arabext: "[\u06F0-\u06F9]",
25230
+ bali: "[\u1B50-\u1B59]",
25231
+ beng: "[\u09E6-\u09EF]",
25232
+ deva: "[\u0966-\u096F]",
25233
+ fullwide: "[\uFF10-\uFF19]",
25234
+ gujr: "[\u0AE6-\u0AEF]",
25235
+ hanidec: "[〇|一|二|三|四|五|六|七|八|九]",
25236
+ khmr: "[\u17E0-\u17E9]",
25237
+ knda: "[\u0CE6-\u0CEF]",
25238
+ laoo: "[\u0ED0-\u0ED9]",
25239
+ limb: "[\u1946-\u194F]",
25240
+ mlym: "[\u0D66-\u0D6F]",
25241
+ mong: "[\u1810-\u1819]",
25242
+ mymr: "[\u1040-\u1049]",
25243
+ orya: "[\u0B66-\u0B6F]",
25244
+ tamldec: "[\u0BE6-\u0BEF]",
25245
+ telu: "[\u0C66-\u0C6F]",
25246
+ thai: "[\u0E50-\u0E59]",
25247
+ tibt: "[\u0F20-\u0F29]",
25248
+ latn: "\\d"
25249
+ };
25250
+ const numberingSystemsUTF16 = {
25251
+ arab: [
25252
+ 1632,
25253
+ 1641
25254
+ ],
25255
+ arabext: [
25256
+ 1776,
25257
+ 1785
25258
+ ],
25259
+ bali: [
25260
+ 6992,
25261
+ 7001
25262
+ ],
25263
+ beng: [
25264
+ 2534,
25265
+ 2543
25266
+ ],
25267
+ deva: [
25268
+ 2406,
25269
+ 2415
25270
+ ],
25271
+ fullwide: [
25272
+ 65296,
25273
+ 65303
25274
+ ],
25275
+ gujr: [
25276
+ 2790,
25277
+ 2799
25278
+ ],
25279
+ khmr: [
25280
+ 6112,
25281
+ 6121
25282
+ ],
25283
+ knda: [
25284
+ 3302,
25285
+ 3311
25286
+ ],
25287
+ laoo: [
25288
+ 3792,
25289
+ 3801
25290
+ ],
25291
+ limb: [
25292
+ 6470,
25293
+ 6479
25294
+ ],
25295
+ mlym: [
25296
+ 3430,
25297
+ 3439
25298
+ ],
25299
+ mong: [
25300
+ 6160,
25301
+ 6169
25302
+ ],
25303
+ mymr: [
25304
+ 4160,
25305
+ 4169
25306
+ ],
25307
+ orya: [
25308
+ 2918,
25309
+ 2927
25310
+ ],
25311
+ tamldec: [
25312
+ 3046,
25313
+ 3055
25314
+ ],
25315
+ telu: [
25316
+ 3174,
25317
+ 3183
25318
+ ],
25319
+ thai: [
25320
+ 3664,
25321
+ 3673
25322
+ ],
25323
+ tibt: [
25324
+ 3872,
25325
+ 3881
25326
+ ]
25327
+ };
25328
+ const hanidecChars = numberingSystems.hanidec.replace(/[\[|\]]/g, "").split("");
25329
+ function parseDigits(str) {
25330
+ let value = parseInt(str, 10);
25331
+ if (!isNaN(value)) return value;
25332
+ value = "";
25333
+ for(let i = 0; i < str.length; i++){
25334
+ const code = str.charCodeAt(i);
25335
+ if (-1 !== str[i].search(numberingSystems.hanidec)) value += hanidecChars.indexOf(str[i]);
25336
+ else for(const key in numberingSystemsUTF16){
25337
+ const [min, max] = numberingSystemsUTF16[key];
25338
+ if (code >= min && code <= max) value += code - min;
25339
+ }
25340
+ }
25341
+ return parseInt(value, 10);
25342
+ }
25343
+ const digitRegexCache = new Map();
25344
+ function resetDigitRegexCache() {
25345
+ digitRegexCache.clear();
25346
+ }
25347
+ function digitRegex({ numberingSystem }, append = "") {
25348
+ const ns = numberingSystem || "latn";
25349
+ let appendCache = digitRegexCache.get(ns);
25350
+ if (void 0 === appendCache) {
25351
+ appendCache = new Map();
25352
+ digitRegexCache.set(ns, appendCache);
25353
+ }
25354
+ let regex = appendCache.get(append);
25355
+ if (void 0 === regex) {
25356
+ regex = new RegExp(`${numberingSystems[ns]}${append}`);
25357
+ appendCache.set(append, regex);
25358
+ }
25359
+ return regex;
25360
+ }
25361
+ let now = ()=>Date.now(), luxon_defaultZone = "system", defaultLocale = null, defaultNumberingSystem = null, defaultOutputCalendar = null, twoDigitCutoffYear = 60, throwOnInvalid, defaultWeekSettings = null;
25362
+ class Settings {
25363
+ static get now() {
25364
+ return now;
25365
+ }
25366
+ static set now(n) {
25367
+ now = n;
25368
+ }
25369
+ static set defaultZone(zone) {
25370
+ luxon_defaultZone = zone;
25371
+ }
25372
+ static get defaultZone() {
25373
+ return normalizeZone(luxon_defaultZone, SystemZone.instance);
25374
+ }
25375
+ static get defaultLocale() {
25376
+ return defaultLocale;
25377
+ }
25378
+ static set defaultLocale(locale) {
25379
+ defaultLocale = locale;
25380
+ }
25381
+ static get defaultNumberingSystem() {
25382
+ return defaultNumberingSystem;
25383
+ }
25384
+ static set defaultNumberingSystem(numberingSystem) {
25385
+ defaultNumberingSystem = numberingSystem;
25386
+ }
25387
+ static get defaultOutputCalendar() {
25388
+ return defaultOutputCalendar;
25389
+ }
25390
+ static set defaultOutputCalendar(outputCalendar) {
25391
+ defaultOutputCalendar = outputCalendar;
25392
+ }
25393
+ static get defaultWeekSettings() {
25394
+ return defaultWeekSettings;
25395
+ }
25396
+ static set defaultWeekSettings(weekSettings) {
25397
+ defaultWeekSettings = validateWeekSettings(weekSettings);
25398
+ }
25399
+ static get twoDigitCutoffYear() {
25400
+ return twoDigitCutoffYear;
25401
+ }
25402
+ static set twoDigitCutoffYear(cutoffYear) {
25403
+ twoDigitCutoffYear = cutoffYear % 100;
25404
+ }
25405
+ static get throwOnInvalid() {
25406
+ return throwOnInvalid;
25407
+ }
25408
+ static set throwOnInvalid(t) {
25409
+ throwOnInvalid = t;
25410
+ }
25411
+ static resetCaches() {
25412
+ Locale.resetCache();
25413
+ IANAZone.resetCache();
25414
+ DateTime.resetCache();
25415
+ resetDigitRegexCache();
25416
+ }
25417
+ }
25418
+ class Invalid {
25419
+ constructor(reason, explanation){
25420
+ this.reason = reason;
25421
+ this.explanation = explanation;
25422
+ }
25423
+ toMessage() {
25424
+ if (this.explanation) return `${this.reason}: ${this.explanation}`;
25425
+ return this.reason;
25426
+ }
25427
+ }
25428
+ const nonLeapLadder = [
25429
+ 0,
25430
+ 31,
25431
+ 59,
25432
+ 90,
25433
+ 120,
25434
+ 151,
25435
+ 181,
25436
+ 212,
25437
+ 243,
25438
+ 273,
25439
+ 304,
25440
+ 334
25441
+ ], leapLadder = [
25442
+ 0,
25443
+ 31,
25444
+ 60,
25445
+ 91,
25446
+ 121,
25447
+ 152,
25448
+ 182,
25449
+ 213,
25450
+ 244,
25451
+ 274,
25452
+ 305,
25453
+ 335
25454
+ ];
25455
+ function unitOutOfRange(unit, value) {
25456
+ return new Invalid("unit out of range", `you specified ${value} (of type ${typeof value}) as a ${unit}, which is invalid`);
25457
+ }
25458
+ function dayOfWeek(year, month, day) {
25459
+ const d = new Date(Date.UTC(year, month - 1, day));
25460
+ if (year < 100 && year >= 0) d.setUTCFullYear(d.getUTCFullYear() - 1900);
25461
+ const js = d.getUTCDay();
25462
+ return 0 === js ? 7 : js;
25463
+ }
25464
+ function computeOrdinal(year, month, day) {
25465
+ return day + (isLeapYear(year) ? leapLadder : nonLeapLadder)[month - 1];
25466
+ }
25467
+ function uncomputeOrdinal(year, ordinal) {
25468
+ const table = isLeapYear(year) ? leapLadder : nonLeapLadder, month0 = table.findIndex((i)=>i < ordinal), day = ordinal - table[month0];
25469
+ return {
25470
+ month: month0 + 1,
25471
+ day
25472
+ };
25473
+ }
25474
+ function isoWeekdayToLocal(isoWeekday, startOfWeek) {
25475
+ return (isoWeekday - startOfWeek + 7) % 7 + 1;
25476
+ }
25477
+ function gregorianToWeek(gregObj, minDaysInFirstWeek = 4, startOfWeek = 1) {
25478
+ const { year, month, day } = gregObj, ordinal = computeOrdinal(year, month, day), weekday = isoWeekdayToLocal(dayOfWeek(year, month, day), startOfWeek);
25479
+ let weekNumber = Math.floor((ordinal - weekday + 14 - minDaysInFirstWeek) / 7), weekYear;
25480
+ if (weekNumber < 1) {
25481
+ weekYear = year - 1;
25482
+ weekNumber = weeksInWeekYear(weekYear, minDaysInFirstWeek, startOfWeek);
25483
+ } else if (weekNumber > weeksInWeekYear(year, minDaysInFirstWeek, startOfWeek)) {
25484
+ weekYear = year + 1;
25485
+ weekNumber = 1;
25486
+ } else weekYear = year;
25487
+ return {
25488
+ weekYear,
25489
+ weekNumber,
25490
+ weekday,
25491
+ ...timeObject(gregObj)
25492
+ };
25493
+ }
25494
+ function weekToGregorian(weekData, minDaysInFirstWeek = 4, startOfWeek = 1) {
25495
+ const { weekYear, weekNumber, weekday } = weekData, weekdayOfJan4 = isoWeekdayToLocal(dayOfWeek(weekYear, 1, minDaysInFirstWeek), startOfWeek), yearInDays = daysInYear(weekYear);
25496
+ let ordinal = 7 * weekNumber + weekday - weekdayOfJan4 - 7 + minDaysInFirstWeek, year;
25497
+ if (ordinal < 1) {
25498
+ year = weekYear - 1;
25499
+ ordinal += daysInYear(year);
25500
+ } else if (ordinal > yearInDays) {
25501
+ year = weekYear + 1;
25502
+ ordinal -= daysInYear(weekYear);
25503
+ } else year = weekYear;
25504
+ const { month, day } = uncomputeOrdinal(year, ordinal);
25505
+ return {
25506
+ year,
25507
+ month,
25508
+ day,
25509
+ ...timeObject(weekData)
25510
+ };
25511
+ }
25512
+ function gregorianToOrdinal(gregData) {
25513
+ const { year, month, day } = gregData;
25514
+ const ordinal = computeOrdinal(year, month, day);
25515
+ return {
25516
+ year,
25517
+ ordinal,
25518
+ ...timeObject(gregData)
25519
+ };
25520
+ }
25521
+ function ordinalToGregorian(ordinalData) {
25522
+ const { year, ordinal } = ordinalData;
25523
+ const { month, day } = uncomputeOrdinal(year, ordinal);
25524
+ return {
25525
+ year,
25526
+ month,
25527
+ day,
25528
+ ...timeObject(ordinalData)
25529
+ };
25530
+ }
25531
+ function usesLocalWeekValues(obj, loc) {
25532
+ const hasLocaleWeekData = !isUndefined(obj.localWeekday) || !isUndefined(obj.localWeekNumber) || !isUndefined(obj.localWeekYear);
25533
+ if (!hasLocaleWeekData) return {
25534
+ minDaysInFirstWeek: 4,
25535
+ startOfWeek: 1
25536
+ };
25537
+ {
25538
+ const hasIsoWeekData = !isUndefined(obj.weekday) || !isUndefined(obj.weekNumber) || !isUndefined(obj.weekYear);
25539
+ if (hasIsoWeekData) throw new ConflictingSpecificationError("Cannot mix locale-based week fields with ISO-based week fields");
25540
+ if (!isUndefined(obj.localWeekday)) obj.weekday = obj.localWeekday;
25541
+ if (!isUndefined(obj.localWeekNumber)) obj.weekNumber = obj.localWeekNumber;
25542
+ if (!isUndefined(obj.localWeekYear)) obj.weekYear = obj.localWeekYear;
25543
+ delete obj.localWeekday;
25544
+ delete obj.localWeekNumber;
25545
+ delete obj.localWeekYear;
25546
+ return {
25547
+ minDaysInFirstWeek: loc.getMinDaysInFirstWeek(),
25548
+ startOfWeek: loc.getStartOfWeek()
25549
+ };
25550
+ }
25551
+ }
25552
+ function hasInvalidWeekData(obj, minDaysInFirstWeek = 4, startOfWeek = 1) {
25553
+ const validYear = isInteger(obj.weekYear), validWeek = integerBetween(obj.weekNumber, 1, weeksInWeekYear(obj.weekYear, minDaysInFirstWeek, startOfWeek)), validWeekday = integerBetween(obj.weekday, 1, 7);
25554
+ if (!validYear) return unitOutOfRange("weekYear", obj.weekYear);
25555
+ if (!validWeek) return unitOutOfRange("week", obj.weekNumber);
25556
+ if (!validWeekday) return unitOutOfRange("weekday", obj.weekday);
25557
+ return false;
25558
+ }
25559
+ function hasInvalidOrdinalData(obj) {
25560
+ const validYear = isInteger(obj.year), validOrdinal = integerBetween(obj.ordinal, 1, daysInYear(obj.year));
25561
+ if (!validYear) return unitOutOfRange("year", obj.year);
25562
+ if (!validOrdinal) return unitOutOfRange("ordinal", obj.ordinal);
25563
+ return false;
25564
+ }
25565
+ function hasInvalidGregorianData(obj) {
25566
+ const validYear = isInteger(obj.year), validMonth = integerBetween(obj.month, 1, 12), validDay = integerBetween(obj.day, 1, daysInMonth(obj.year, obj.month));
25567
+ if (!validYear) return unitOutOfRange("year", obj.year);
25568
+ if (!validMonth) return unitOutOfRange("month", obj.month);
25569
+ if (!validDay) return unitOutOfRange("day", obj.day);
25570
+ return false;
25571
+ }
25572
+ function hasInvalidTimeData(obj) {
25573
+ const { hour, minute, second, millisecond } = obj;
25574
+ const validHour = integerBetween(hour, 0, 23) || 24 === hour && 0 === minute && 0 === second && 0 === millisecond, validMinute = integerBetween(minute, 0, 59), validSecond = integerBetween(second, 0, 59), validMillisecond = integerBetween(millisecond, 0, 999);
25575
+ if (!validHour) return unitOutOfRange("hour", hour);
25576
+ if (!validMinute) return unitOutOfRange("minute", minute);
25577
+ if (!validSecond) return unitOutOfRange("second", second);
25578
+ if (!validMillisecond) return unitOutOfRange("millisecond", millisecond);
25579
+ return false;
25580
+ }
25581
+ function isUndefined(o) {
25582
+ return void 0 === o;
25583
+ }
25584
+ function isNumber(o) {
25585
+ return "number" == typeof o;
25586
+ }
25587
+ function isInteger(o) {
25588
+ return "number" == typeof o && o % 1 === 0;
25589
+ }
25590
+ function isString(o) {
25591
+ return "string" == typeof o;
25592
+ }
25593
+ function isDate(o) {
25594
+ return "[object Date]" === Object.prototype.toString.call(o);
25595
+ }
25596
+ function hasRelative() {
25597
+ try {
25598
+ return "u" > typeof Intl && !!Intl.RelativeTimeFormat;
25599
+ } catch (e) {
25600
+ return false;
25601
+ }
25602
+ }
25603
+ function hasLocaleWeekInfo() {
25604
+ try {
25605
+ return "u" > typeof Intl && !!Intl.Locale && ("weekInfo" in Intl.Locale.prototype || "getWeekInfo" in Intl.Locale.prototype);
25606
+ } catch (e) {
25607
+ return false;
25608
+ }
25609
+ }
25610
+ function maybeArray(thing) {
25611
+ return Array.isArray(thing) ? thing : [
25612
+ thing
25613
+ ];
25614
+ }
25615
+ function bestBy(arr, by, compare) {
25616
+ if (0 === arr.length) return;
25617
+ return arr.reduce((best, next)=>{
25618
+ const pair = [
25619
+ by(next),
25620
+ next
25621
+ ];
25622
+ if (!best) return pair;
25623
+ if (compare(best[0], pair[0]) === best[0]) return best;
25624
+ return pair;
25625
+ }, null)[1];
25626
+ }
25627
+ function pick(obj, keys) {
25628
+ return keys.reduce((a, k)=>{
25629
+ a[k] = obj[k];
25630
+ return a;
25631
+ }, {});
25632
+ }
25633
+ function luxon_hasOwnProperty(obj, prop) {
25634
+ return Object.prototype.hasOwnProperty.call(obj, prop);
25635
+ }
25636
+ function validateWeekSettings(settings) {
25637
+ if (null == settings) return null;
25638
+ if ("object" != typeof settings) throw new InvalidArgumentError("Week settings must be an object");
25639
+ if (!integerBetween(settings.firstDay, 1, 7) || !integerBetween(settings.minimalDays, 1, 7) || !Array.isArray(settings.weekend) || settings.weekend.some((v)=>!integerBetween(v, 1, 7))) throw new InvalidArgumentError("Invalid week settings");
25640
+ return {
25641
+ firstDay: settings.firstDay,
25642
+ minimalDays: settings.minimalDays,
25643
+ weekend: Array.from(settings.weekend)
25644
+ };
25645
+ }
25646
+ function integerBetween(thing, bottom, top) {
25647
+ return isInteger(thing) && thing >= bottom && thing <= top;
25648
+ }
25649
+ function floorMod(x, n) {
25650
+ return x - n * Math.floor(x / n);
25651
+ }
25652
+ function padStart(input, n = 2) {
25653
+ const isNeg = input < 0;
25654
+ let padded;
25655
+ padded = isNeg ? "-" + ("" + -input).padStart(n, "0") : ("" + input).padStart(n, "0");
25656
+ return padded;
25657
+ }
25658
+ function parseInteger(string) {
25659
+ if (isUndefined(string) || null === string || "" === string) return;
25660
+ return parseInt(string, 10);
25661
+ }
25662
+ function parseFloating(string) {
25663
+ if (isUndefined(string) || null === string || "" === string) return;
25664
+ return parseFloat(string);
25665
+ }
25666
+ function parseMillis(fraction) {
25667
+ if (isUndefined(fraction) || null === fraction || "" === fraction) return;
25668
+ {
25669
+ const f = 1000 * parseFloat("0." + fraction);
25670
+ return Math.floor(f);
25671
+ }
25672
+ }
25673
+ function roundTo(number, digits, rounding = "round") {
25674
+ const factor = 10 ** digits;
25675
+ switch(rounding){
25676
+ case "expand":
25677
+ return number > 0 ? Math.ceil(number * factor) / factor : Math.floor(number * factor) / factor;
25678
+ case "trunc":
25679
+ return Math.trunc(number * factor) / factor;
25680
+ case "round":
25681
+ return Math.round(number * factor) / factor;
25682
+ case "floor":
25683
+ return Math.floor(number * factor) / factor;
25684
+ case "ceil":
25685
+ return Math.ceil(number * factor) / factor;
25686
+ default:
25687
+ throw new RangeError(`Value rounding ${rounding} is out of range`);
25688
+ }
25689
+ }
25690
+ function isLeapYear(year) {
25691
+ return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
25692
+ }
25693
+ function daysInYear(year) {
25694
+ return isLeapYear(year) ? 366 : 365;
25695
+ }
25696
+ function daysInMonth(year, month) {
25697
+ const modMonth = floorMod(month - 1, 12) + 1, modYear = year + (month - modMonth) / 12;
25698
+ if (2 === modMonth) return isLeapYear(modYear) ? 29 : 28;
25699
+ return [
25700
+ 31,
25701
+ null,
25702
+ 31,
25703
+ 30,
25704
+ 31,
25705
+ 30,
25706
+ 31,
25707
+ 31,
25708
+ 30,
25709
+ 31,
25710
+ 30,
25711
+ 31
25712
+ ][modMonth - 1];
25713
+ }
25714
+ function objToLocalTS(obj) {
25715
+ let d = Date.UTC(obj.year, obj.month - 1, obj.day, obj.hour, obj.minute, obj.second, obj.millisecond);
25716
+ if (obj.year < 100 && obj.year >= 0) {
25717
+ d = new Date(d);
25718
+ d.setUTCFullYear(obj.year, obj.month - 1, obj.day);
25719
+ }
25720
+ return +d;
25721
+ }
25722
+ function firstWeekOffset(year, minDaysInFirstWeek, startOfWeek) {
25723
+ const fwdlw = isoWeekdayToLocal(dayOfWeek(year, 1, minDaysInFirstWeek), startOfWeek);
25724
+ return -fwdlw + minDaysInFirstWeek - 1;
25725
+ }
25726
+ function weeksInWeekYear(weekYear, minDaysInFirstWeek = 4, startOfWeek = 1) {
25727
+ const weekOffset = firstWeekOffset(weekYear, minDaysInFirstWeek, startOfWeek);
25728
+ const weekOffsetNext = firstWeekOffset(weekYear + 1, minDaysInFirstWeek, startOfWeek);
25729
+ return (daysInYear(weekYear) - weekOffset + weekOffsetNext) / 7;
25730
+ }
25731
+ function untruncateYear(year) {
25732
+ if (year > 99) return year;
25733
+ return year > Settings.twoDigitCutoffYear ? 1900 + year : 2000 + year;
25734
+ }
25735
+ function parseZoneInfo(ts, offsetFormat, locale, timeZone = null) {
25736
+ const date = new Date(ts), intlOpts = {
25737
+ hourCycle: "h23",
25738
+ year: "numeric",
25739
+ month: "2-digit",
25740
+ day: "2-digit",
25741
+ hour: "2-digit",
25742
+ minute: "2-digit"
25743
+ };
25744
+ if (timeZone) intlOpts.timeZone = timeZone;
25745
+ const modified = {
25746
+ timeZoneName: offsetFormat,
25747
+ ...intlOpts
25748
+ };
25749
+ const parsed = new Intl.DateTimeFormat(locale, modified).formatToParts(date).find((m)=>"timezonename" === m.type.toLowerCase());
25750
+ return parsed ? parsed.value : null;
25751
+ }
25752
+ function signedOffset(offHourStr, offMinuteStr) {
25753
+ let offHour = parseInt(offHourStr, 10);
25754
+ if (Number.isNaN(offHour)) offHour = 0;
25755
+ const offMin = parseInt(offMinuteStr, 10) || 0, offMinSigned = offHour < 0 || Object.is(offHour, -0) ? -offMin : offMin;
25756
+ return 60 * offHour + offMinSigned;
25757
+ }
25758
+ function asNumber(value) {
25759
+ const numericValue = Number(value);
25760
+ if ("boolean" == typeof value || "" === value || !Number.isFinite(numericValue)) throw new InvalidArgumentError(`Invalid unit value ${value}`);
25761
+ return numericValue;
25762
+ }
25763
+ function normalizeObject(obj, normalizer) {
25764
+ const normalized = {};
25765
+ for(const u in obj)if (luxon_hasOwnProperty(obj, u)) {
25766
+ const v = obj[u];
25767
+ if (null == v) continue;
25768
+ normalized[normalizer(u)] = asNumber(v);
25769
+ }
25770
+ return normalized;
25771
+ }
25772
+ function luxon_formatOffset(offset, format) {
25773
+ const hours = Math.trunc(Math.abs(offset / 60)), minutes = Math.trunc(Math.abs(offset % 60)), sign = offset >= 0 ? "+" : "-";
25774
+ switch(format){
25775
+ case "short":
25776
+ return `${sign}${padStart(hours, 2)}:${padStart(minutes, 2)}`;
25777
+ case "narrow":
25778
+ return `${sign}${hours}${minutes > 0 ? `:${minutes}` : ""}`;
25779
+ case "techie":
25780
+ return `${sign}${padStart(hours, 2)}${padStart(minutes, 2)}`;
25781
+ default:
25782
+ throw new RangeError(`Value format ${format} is out of range for property format`);
25783
+ }
25784
+ }
25785
+ function timeObject(obj) {
25786
+ return pick(obj, [
25787
+ "hour",
25788
+ "minute",
25789
+ "second",
25790
+ "millisecond"
25791
+ ]);
25792
+ }
25793
+ const monthsLong = [
25794
+ "January",
25795
+ "February",
25796
+ "March",
25797
+ "April",
25798
+ "May",
25799
+ "June",
25800
+ "July",
25801
+ "August",
25802
+ "September",
25803
+ "October",
25804
+ "November",
25805
+ "December"
25806
+ ];
25807
+ const monthsShort = [
25808
+ "Jan",
25809
+ "Feb",
25810
+ "Mar",
25811
+ "Apr",
25812
+ "May",
25813
+ "Jun",
25814
+ "Jul",
25815
+ "Aug",
25816
+ "Sep",
25817
+ "Oct",
25818
+ "Nov",
25819
+ "Dec"
25820
+ ];
25821
+ const monthsNarrow = [
25822
+ "J",
25823
+ "F",
25824
+ "M",
25825
+ "A",
25826
+ "M",
25827
+ "J",
25828
+ "J",
25829
+ "A",
25830
+ "S",
25831
+ "O",
25832
+ "N",
25833
+ "D"
25834
+ ];
25835
+ function months(length) {
25836
+ switch(length){
25837
+ case "narrow":
25838
+ return [
25839
+ ...monthsNarrow
25840
+ ];
25841
+ case "short":
25842
+ return [
25843
+ ...monthsShort
25844
+ ];
25845
+ case "long":
25846
+ return [
25847
+ ...monthsLong
25848
+ ];
25849
+ case "numeric":
25850
+ return [
25851
+ "1",
25852
+ "2",
25853
+ "3",
25854
+ "4",
25855
+ "5",
25856
+ "6",
25857
+ "7",
25858
+ "8",
25859
+ "9",
25860
+ "10",
25861
+ "11",
25862
+ "12"
25863
+ ];
25864
+ case "2-digit":
25865
+ return [
25866
+ "01",
25867
+ "02",
25868
+ "03",
25869
+ "04",
25870
+ "05",
25871
+ "06",
25872
+ "07",
25873
+ "08",
25874
+ "09",
25875
+ "10",
25876
+ "11",
25877
+ "12"
25878
+ ];
25879
+ default:
25880
+ return null;
25881
+ }
25882
+ }
25883
+ const weekdaysLong = [
25884
+ "Monday",
25885
+ "Tuesday",
25886
+ "Wednesday",
25887
+ "Thursday",
25888
+ "Friday",
25889
+ "Saturday",
25890
+ "Sunday"
25891
+ ];
25892
+ const weekdaysShort = [
25893
+ "Mon",
25894
+ "Tue",
25895
+ "Wed",
25896
+ "Thu",
25897
+ "Fri",
25898
+ "Sat",
25899
+ "Sun"
25900
+ ];
25901
+ const weekdaysNarrow = [
25902
+ "M",
25903
+ "T",
25904
+ "W",
25905
+ "T",
25906
+ "F",
25907
+ "S",
25908
+ "S"
25909
+ ];
25910
+ function weekdays(length) {
25911
+ switch(length){
25912
+ case "narrow":
25913
+ return [
25914
+ ...weekdaysNarrow
25915
+ ];
25916
+ case "short":
25917
+ return [
25918
+ ...weekdaysShort
25919
+ ];
25920
+ case "long":
25921
+ return [
25922
+ ...weekdaysLong
25923
+ ];
25924
+ case "numeric":
25925
+ return [
25926
+ "1",
25927
+ "2",
25928
+ "3",
25929
+ "4",
25930
+ "5",
25931
+ "6",
25932
+ "7"
25933
+ ];
25934
+ default:
25935
+ return null;
25936
+ }
25937
+ }
25938
+ const meridiems = [
25939
+ "AM",
25940
+ "PM"
25941
+ ];
25942
+ const erasLong = [
25943
+ "Before Christ",
25944
+ "Anno Domini"
25945
+ ];
25946
+ const erasShort = [
25947
+ "BC",
25948
+ "AD"
25949
+ ];
25950
+ const erasNarrow = [
25951
+ "B",
25952
+ "A"
25953
+ ];
25954
+ function eras(length) {
25955
+ switch(length){
25956
+ case "narrow":
25957
+ return [
25958
+ ...erasNarrow
25959
+ ];
25960
+ case "short":
25961
+ return [
25962
+ ...erasShort
25963
+ ];
25964
+ case "long":
25965
+ return [
25966
+ ...erasLong
25967
+ ];
25968
+ default:
25969
+ return null;
25970
+ }
25971
+ }
25972
+ function meridiemForDateTime(dt) {
25973
+ return meridiems[dt.hour < 12 ? 0 : 1];
25974
+ }
25975
+ function weekdayForDateTime(dt, length) {
25976
+ return weekdays(length)[dt.weekday - 1];
25977
+ }
25978
+ function monthForDateTime(dt, length) {
25979
+ return months(length)[dt.month - 1];
25980
+ }
25981
+ function eraForDateTime(dt, length) {
25982
+ return eras(length)[dt.year < 0 ? 0 : 1];
25983
+ }
25984
+ function formatRelativeTime(unit, count, numeric = "always", narrow = false) {
25985
+ const units = {
25986
+ years: [
25987
+ "year",
25988
+ "yr."
25989
+ ],
25990
+ quarters: [
25991
+ "quarter",
25992
+ "qtr."
25993
+ ],
25994
+ months: [
25995
+ "month",
25996
+ "mo."
25997
+ ],
25998
+ weeks: [
25999
+ "week",
26000
+ "wk."
26001
+ ],
26002
+ days: [
26003
+ "day",
26004
+ "day",
26005
+ "days"
26006
+ ],
26007
+ hours: [
26008
+ "hour",
26009
+ "hr."
26010
+ ],
26011
+ minutes: [
26012
+ "minute",
26013
+ "min."
26014
+ ],
26015
+ seconds: [
26016
+ "second",
26017
+ "sec."
26018
+ ]
26019
+ };
26020
+ const lastable = -1 === [
26021
+ "hours",
26022
+ "minutes",
26023
+ "seconds"
26024
+ ].indexOf(unit);
26025
+ if ("auto" === numeric && lastable) {
26026
+ const isDay = "days" === unit;
26027
+ switch(count){
26028
+ case 1:
26029
+ return isDay ? "tomorrow" : `next ${units[unit][0]}`;
26030
+ case -1:
26031
+ return isDay ? "yesterday" : `last ${units[unit][0]}`;
26032
+ case 0:
26033
+ return isDay ? "today" : `this ${units[unit][0]}`;
26034
+ }
26035
+ }
26036
+ const isInPast = Object.is(count, -0) || count < 0, fmtValue = Math.abs(count), singular = 1 === fmtValue, lilUnits = units[unit], fmtUnit = narrow ? singular ? lilUnits[1] : lilUnits[2] || lilUnits[1] : singular ? units[unit][0] : unit;
26037
+ return isInPast ? `${fmtValue} ${fmtUnit} ago` : `in ${fmtValue} ${fmtUnit}`;
26038
+ }
26039
+ function stringifyTokens(splits, tokenToString) {
26040
+ let s = "";
26041
+ for (const token of splits)if (token.literal) s += token.val;
26042
+ else s += tokenToString(token.val);
26043
+ return s;
26044
+ }
26045
+ const macroTokenToFormatOpts = {
26046
+ D: DATE_SHORT,
26047
+ DD: DATE_MED,
26048
+ DDD: DATE_FULL,
26049
+ DDDD: DATE_HUGE,
26050
+ t: TIME_SIMPLE,
26051
+ tt: TIME_WITH_SECONDS,
26052
+ ttt: TIME_WITH_SHORT_OFFSET,
26053
+ tttt: TIME_WITH_LONG_OFFSET,
26054
+ T: TIME_24_SIMPLE,
26055
+ TT: TIME_24_WITH_SECONDS,
26056
+ TTT: TIME_24_WITH_SHORT_OFFSET,
26057
+ TTTT: TIME_24_WITH_LONG_OFFSET,
26058
+ f: DATETIME_SHORT,
26059
+ ff: DATETIME_MED,
26060
+ fff: DATETIME_FULL,
26061
+ ffff: DATETIME_HUGE,
26062
+ F: DATETIME_SHORT_WITH_SECONDS,
26063
+ FF: DATETIME_MED_WITH_SECONDS,
26064
+ FFF: DATETIME_FULL_WITH_SECONDS,
26065
+ FFFF: DATETIME_HUGE_WITH_SECONDS
26066
+ };
26067
+ class Formatter {
26068
+ static create(locale, opts = {}) {
26069
+ return new Formatter(locale, opts);
26070
+ }
26071
+ static parseFormat(fmt) {
26072
+ let current = null, currentFull = "", bracketed = false;
26073
+ const splits = [];
26074
+ for(let i = 0; i < fmt.length; i++){
26075
+ const c = fmt.charAt(i);
26076
+ if ("'" === c) {
26077
+ if (currentFull.length > 0 || bracketed) splits.push({
26078
+ literal: bracketed || /^\s+$/.test(currentFull),
26079
+ val: "" === currentFull ? "'" : currentFull
26080
+ });
26081
+ current = null;
26082
+ currentFull = "";
26083
+ bracketed = !bracketed;
26084
+ } else if (bracketed) currentFull += c;
26085
+ else if (c === current) currentFull += c;
26086
+ else {
26087
+ if (currentFull.length > 0) splits.push({
26088
+ literal: /^\s+$/.test(currentFull),
26089
+ val: currentFull
26090
+ });
26091
+ currentFull = c;
26092
+ current = c;
26093
+ }
26094
+ }
26095
+ if (currentFull.length > 0) splits.push({
26096
+ literal: bracketed || /^\s+$/.test(currentFull),
26097
+ val: currentFull
26098
+ });
26099
+ return splits;
26100
+ }
26101
+ static macroTokenToFormatOpts(token) {
26102
+ return macroTokenToFormatOpts[token];
26103
+ }
26104
+ constructor(locale, formatOpts){
26105
+ this.opts = formatOpts;
26106
+ this.loc = locale;
26107
+ this.systemLoc = null;
26108
+ }
26109
+ formatWithSystemDefault(dt, opts) {
26110
+ if (null === this.systemLoc) this.systemLoc = this.loc.redefaultToSystem();
26111
+ const df = this.systemLoc.dtFormatter(dt, {
26112
+ ...this.opts,
26113
+ ...opts
26114
+ });
26115
+ return df.format();
26116
+ }
26117
+ dtFormatter(dt, opts = {}) {
26118
+ return this.loc.dtFormatter(dt, {
26119
+ ...this.opts,
26120
+ ...opts
26121
+ });
26122
+ }
26123
+ formatDateTime(dt, opts) {
26124
+ return this.dtFormatter(dt, opts).format();
26125
+ }
26126
+ formatDateTimeParts(dt, opts) {
26127
+ return this.dtFormatter(dt, opts).formatToParts();
26128
+ }
26129
+ formatInterval(interval, opts) {
26130
+ const df = this.dtFormatter(interval.start, opts);
26131
+ return df.dtf.formatRange(interval.start.toJSDate(), interval.end.toJSDate());
26132
+ }
26133
+ resolvedOptions(dt, opts) {
26134
+ return this.dtFormatter(dt, opts).resolvedOptions();
26135
+ }
26136
+ num(n, p = 0, signDisplay) {
26137
+ if (this.opts.forceSimple) return padStart(n, p);
26138
+ const opts = {
26139
+ ...this.opts
26140
+ };
26141
+ if (p > 0) opts.padTo = p;
26142
+ if (signDisplay) opts.signDisplay = signDisplay;
26143
+ return this.loc.numberFormatter(opts).format(n);
26144
+ }
26145
+ formatDateTimeFromString(dt, fmt) {
26146
+ const knownEnglish = "en" === this.loc.listingMode(), useDateTimeFormatter = this.loc.outputCalendar && "gregory" !== this.loc.outputCalendar, string = (opts, extract)=>this.loc.extract(dt, opts, extract), formatOffset = (opts)=>{
26147
+ if (dt.isOffsetFixed && 0 === dt.offset && opts.allowZ) return "Z";
26148
+ return dt.isValid ? dt.zone.formatOffset(dt.ts, opts.format) : "";
26149
+ }, meridiem = ()=>knownEnglish ? meridiemForDateTime(dt) : string({
26150
+ hour: "numeric",
26151
+ hourCycle: "h12"
26152
+ }, "dayperiod"), month = (length, standalone)=>knownEnglish ? monthForDateTime(dt, length) : string(standalone ? {
26153
+ month: length
26154
+ } : {
26155
+ month: length,
26156
+ day: "numeric"
26157
+ }, "month"), weekday = (length, standalone)=>knownEnglish ? weekdayForDateTime(dt, length) : string(standalone ? {
26158
+ weekday: length
26159
+ } : {
26160
+ weekday: length,
26161
+ month: "long",
26162
+ day: "numeric"
26163
+ }, "weekday"), maybeMacro = (token)=>{
26164
+ const formatOpts = Formatter.macroTokenToFormatOpts(token);
26165
+ if (formatOpts) return this.formatWithSystemDefault(dt, formatOpts);
26166
+ return token;
26167
+ }, era = (length)=>knownEnglish ? eraForDateTime(dt, length) : string({
26168
+ era: length
26169
+ }, "era"), tokenToString = (token)=>{
26170
+ switch(token){
26171
+ case "S":
26172
+ return this.num(dt.millisecond);
26173
+ case "u":
26174
+ case "SSS":
26175
+ return this.num(dt.millisecond, 3);
26176
+ case "s":
26177
+ return this.num(dt.second);
26178
+ case "ss":
26179
+ return this.num(dt.second, 2);
26180
+ case "uu":
26181
+ return this.num(Math.floor(dt.millisecond / 10), 2);
26182
+ case "uuu":
26183
+ return this.num(Math.floor(dt.millisecond / 100));
26184
+ case "m":
26185
+ return this.num(dt.minute);
26186
+ case "mm":
26187
+ return this.num(dt.minute, 2);
26188
+ case "h":
26189
+ return this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12);
26190
+ case "hh":
26191
+ return this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12, 2);
26192
+ case "H":
26193
+ return this.num(dt.hour);
26194
+ case "HH":
26195
+ return this.num(dt.hour, 2);
26196
+ case "Z":
26197
+ return formatOffset({
26198
+ format: "narrow",
26199
+ allowZ: this.opts.allowZ
26200
+ });
26201
+ case "ZZ":
26202
+ return formatOffset({
26203
+ format: "short",
26204
+ allowZ: this.opts.allowZ
26205
+ });
26206
+ case "ZZZ":
26207
+ return formatOffset({
26208
+ format: "techie",
26209
+ allowZ: this.opts.allowZ
26210
+ });
26211
+ case "ZZZZ":
26212
+ return dt.zone.offsetName(dt.ts, {
26213
+ format: "short",
26214
+ locale: this.loc.locale
26215
+ });
26216
+ case "ZZZZZ":
26217
+ return dt.zone.offsetName(dt.ts, {
26218
+ format: "long",
26219
+ locale: this.loc.locale
26220
+ });
26221
+ case "z":
26222
+ return dt.zoneName;
26223
+ case "a":
26224
+ return meridiem();
26225
+ case "d":
26226
+ return useDateTimeFormatter ? string({
26227
+ day: "numeric"
26228
+ }, "day") : this.num(dt.day);
26229
+ case "dd":
26230
+ return useDateTimeFormatter ? string({
26231
+ day: "2-digit"
26232
+ }, "day") : this.num(dt.day, 2);
26233
+ case "c":
26234
+ return this.num(dt.weekday);
26235
+ case "ccc":
26236
+ return weekday("short", true);
26237
+ case "cccc":
26238
+ return weekday("long", true);
26239
+ case "ccccc":
26240
+ return weekday("narrow", true);
26241
+ case "E":
26242
+ return this.num(dt.weekday);
26243
+ case "EEE":
26244
+ return weekday("short", false);
26245
+ case "EEEE":
26246
+ return weekday("long", false);
26247
+ case "EEEEE":
26248
+ return weekday("narrow", false);
26249
+ case "L":
26250
+ return useDateTimeFormatter ? string({
26251
+ month: "numeric",
26252
+ day: "numeric"
26253
+ }, "month") : this.num(dt.month);
26254
+ case "LL":
26255
+ return useDateTimeFormatter ? string({
26256
+ month: "2-digit",
26257
+ day: "numeric"
26258
+ }, "month") : this.num(dt.month, 2);
26259
+ case "LLL":
26260
+ return month("short", true);
26261
+ case "LLLL":
26262
+ return month("long", true);
26263
+ case "LLLLL":
26264
+ return month("narrow", true);
26265
+ case "M":
26266
+ return useDateTimeFormatter ? string({
26267
+ month: "numeric"
26268
+ }, "month") : this.num(dt.month);
26269
+ case "MM":
26270
+ return useDateTimeFormatter ? string({
26271
+ month: "2-digit"
26272
+ }, "month") : this.num(dt.month, 2);
26273
+ case "MMM":
26274
+ return month("short", false);
26275
+ case "MMMM":
26276
+ return month("long", false);
26277
+ case "MMMMM":
26278
+ return month("narrow", false);
26279
+ case "y":
26280
+ return useDateTimeFormatter ? string({
26281
+ year: "numeric"
26282
+ }, "year") : this.num(dt.year);
26283
+ case "yy":
26284
+ return useDateTimeFormatter ? string({
26285
+ year: "2-digit"
26286
+ }, "year") : this.num(dt.year.toString().slice(-2), 2);
26287
+ case "yyyy":
26288
+ return useDateTimeFormatter ? string({
26289
+ year: "numeric"
26290
+ }, "year") : this.num(dt.year, 4);
26291
+ case "yyyyyy":
26292
+ return useDateTimeFormatter ? string({
26293
+ year: "numeric"
26294
+ }, "year") : this.num(dt.year, 6);
26295
+ case "G":
26296
+ return era("short");
26297
+ case "GG":
26298
+ return era("long");
26299
+ case "GGGGG":
26300
+ return era("narrow");
26301
+ case "kk":
26302
+ return this.num(dt.weekYear.toString().slice(-2), 2);
26303
+ case "kkkk":
26304
+ return this.num(dt.weekYear, 4);
26305
+ case "W":
26306
+ return this.num(dt.weekNumber);
26307
+ case "WW":
26308
+ return this.num(dt.weekNumber, 2);
26309
+ case "n":
26310
+ return this.num(dt.localWeekNumber);
26311
+ case "nn":
26312
+ return this.num(dt.localWeekNumber, 2);
26313
+ case "ii":
26314
+ return this.num(dt.localWeekYear.toString().slice(-2), 2);
26315
+ case "iiii":
26316
+ return this.num(dt.localWeekYear, 4);
26317
+ case "o":
26318
+ return this.num(dt.ordinal);
26319
+ case "ooo":
26320
+ return this.num(dt.ordinal, 3);
26321
+ case "q":
26322
+ return this.num(dt.quarter);
26323
+ case "qq":
26324
+ return this.num(dt.quarter, 2);
26325
+ case "X":
26326
+ return this.num(Math.floor(dt.ts / 1000));
26327
+ case "x":
26328
+ return this.num(dt.ts);
26329
+ default:
26330
+ return maybeMacro(token);
26331
+ }
26332
+ };
26333
+ return stringifyTokens(Formatter.parseFormat(fmt), tokenToString);
26334
+ }
26335
+ formatDurationFromString(dur, fmt) {
26336
+ const invertLargest = "negativeLargestOnly" === this.opts.signMode ? -1 : 1;
26337
+ const tokenToField = (token)=>{
26338
+ switch(token[0]){
26339
+ case "S":
26340
+ return "milliseconds";
26341
+ case "s":
26342
+ return "seconds";
26343
+ case "m":
26344
+ return "minutes";
26345
+ case "h":
26346
+ return "hours";
26347
+ case "d":
26348
+ return "days";
26349
+ case "w":
26350
+ return "weeks";
26351
+ case "M":
26352
+ return "months";
26353
+ case "y":
26354
+ return "years";
26355
+ default:
26356
+ return null;
26357
+ }
26358
+ }, tokenToString = (lildur, info)=>(token)=>{
26359
+ const mapped = tokenToField(token);
26360
+ if (!mapped) return token;
26361
+ {
26362
+ const inversionFactor = info.isNegativeDuration && mapped !== info.largestUnit ? invertLargest : 1;
26363
+ let signDisplay;
26364
+ signDisplay = "negativeLargestOnly" === this.opts.signMode && mapped !== info.largestUnit ? "never" : "all" === this.opts.signMode ? "always" : "auto";
26365
+ return this.num(lildur.get(mapped) * inversionFactor, token.length, signDisplay);
26366
+ }
26367
+ }, tokens = Formatter.parseFormat(fmt), realTokens = tokens.reduce((found, { literal, val })=>literal ? found : found.concat(val), []), collapsed = dur.shiftTo(...realTokens.map(tokenToField).filter((t)=>t)), durationInfo = {
26368
+ isNegativeDuration: collapsed < 0,
26369
+ largestUnit: Object.keys(collapsed.values)[0]
26370
+ };
26371
+ return stringifyTokens(tokens, tokenToString(collapsed, durationInfo));
26372
+ }
26373
+ }
26374
+ const ianaRegex = /[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;
26375
+ function combineRegexes(...regexes) {
26376
+ const full = regexes.reduce((f, r)=>f + r.source, "");
26377
+ return RegExp(`^${full}$`);
26378
+ }
26379
+ function combineExtractors(...extractors) {
26380
+ return (m)=>extractors.reduce(([mergedVals, mergedZone, cursor], ex)=>{
26381
+ const [val, zone, next] = ex(m, cursor);
26382
+ return [
26383
+ {
26384
+ ...mergedVals,
26385
+ ...val
26386
+ },
26387
+ zone || mergedZone,
26388
+ next
26389
+ ];
26390
+ }, [
26391
+ {},
26392
+ null,
26393
+ 1
26394
+ ]).slice(0, 2);
26395
+ }
26396
+ function parse(s, ...patterns) {
26397
+ if (null == s) return [
26398
+ null,
26399
+ null
26400
+ ];
26401
+ for (const [regex, extractor] of patterns){
26402
+ const m = regex.exec(s);
26403
+ if (m) return extractor(m);
26404
+ }
26405
+ return [
26406
+ null,
26407
+ null
26408
+ ];
26409
+ }
26410
+ function simpleParse(...keys) {
26411
+ return (match, cursor)=>{
26412
+ const ret = {};
26413
+ let i;
26414
+ for(i = 0; i < keys.length; i++)ret[keys[i]] = parseInteger(match[cursor + i]);
26415
+ return [
26416
+ ret,
26417
+ null,
26418
+ cursor + i
26419
+ ];
26420
+ };
26421
+ }
26422
+ const offsetRegex = /(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/;
26423
+ const isoExtendedZone = `(?:${offsetRegex.source}?(?:\\[(${ianaRegex.source})\\])?)?`;
26424
+ const isoTimeBaseRegex = /(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/;
26425
+ const isoTimeRegex = RegExp(`${isoTimeBaseRegex.source}${isoExtendedZone}`);
26426
+ const isoTimeExtensionRegex = RegExp(`(?:[Tt]${isoTimeRegex.source})?`);
26427
+ const isoYmdRegex = /([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/;
26428
+ const isoWeekRegex = /(\d{4})-?W(\d\d)(?:-?(\d))?/;
26429
+ const isoOrdinalRegex = /(\d{4})-?(\d{3})/;
26430
+ const extractISOWeekData = simpleParse("weekYear", "weekNumber", "weekDay");
26431
+ const extractISOOrdinalData = simpleParse("year", "ordinal");
26432
+ const sqlYmdRegex = /(\d{4})-(\d\d)-(\d\d)/;
26433
+ const sqlTimeRegex = RegExp(`${isoTimeBaseRegex.source} ?(?:${offsetRegex.source}|(${ianaRegex.source}))?`);
26434
+ const sqlTimeExtensionRegex = RegExp(`(?: ${sqlTimeRegex.source})?`);
26435
+ function luxon_int(match, pos, fallback) {
26436
+ const m = match[pos];
26437
+ return isUndefined(m) ? fallback : parseInteger(m);
26438
+ }
26439
+ function extractISOYmd(match, cursor) {
26440
+ const item = {
26441
+ year: luxon_int(match, cursor),
26442
+ month: luxon_int(match, cursor + 1, 1),
26443
+ day: luxon_int(match, cursor + 2, 1)
26444
+ };
26445
+ return [
26446
+ item,
26447
+ null,
26448
+ cursor + 3
26449
+ ];
26450
+ }
26451
+ function extractISOTime(match, cursor) {
26452
+ const item = {
26453
+ hours: luxon_int(match, cursor, 0),
26454
+ minutes: luxon_int(match, cursor + 1, 0),
26455
+ seconds: luxon_int(match, cursor + 2, 0),
26456
+ milliseconds: parseMillis(match[cursor + 3])
26457
+ };
26458
+ return [
26459
+ item,
26460
+ null,
26461
+ cursor + 4
26462
+ ];
26463
+ }
26464
+ function extractISOOffset(match, cursor) {
26465
+ const local = !match[cursor] && !match[cursor + 1], fullOffset = signedOffset(match[cursor + 1], match[cursor + 2]), zone = local ? null : FixedOffsetZone.instance(fullOffset);
26466
+ return [
26467
+ {},
26468
+ zone,
26469
+ cursor + 3
26470
+ ];
26471
+ }
26472
+ function extractIANAZone(match, cursor) {
26473
+ const zone = match[cursor] ? IANAZone.create(match[cursor]) : null;
26474
+ return [
26475
+ {},
26476
+ zone,
26477
+ cursor + 1
26478
+ ];
26479
+ }
26480
+ const isoTimeOnly = RegExp(`^T?${isoTimeBaseRegex.source}$`);
26481
+ const isoDuration = /^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;
26482
+ function extractISODuration(match) {
26483
+ const [s, yearStr, monthStr, weekStr, dayStr, hourStr, minuteStr, secondStr, millisecondsStr] = match;
26484
+ const hasNegativePrefix = "-" === s[0];
26485
+ const negativeSeconds = secondStr && "-" === secondStr[0];
26486
+ const maybeNegate = (num, force = false)=>void 0 !== num && (force || num && hasNegativePrefix) ? -num : num;
26487
+ return [
26488
+ {
26489
+ years: maybeNegate(parseFloating(yearStr)),
26490
+ months: maybeNegate(parseFloating(monthStr)),
26491
+ weeks: maybeNegate(parseFloating(weekStr)),
26492
+ days: maybeNegate(parseFloating(dayStr)),
26493
+ hours: maybeNegate(parseFloating(hourStr)),
26494
+ minutes: maybeNegate(parseFloating(minuteStr)),
26495
+ seconds: maybeNegate(parseFloating(secondStr), "-0" === secondStr),
26496
+ milliseconds: maybeNegate(parseMillis(millisecondsStr), negativeSeconds)
26497
+ }
26498
+ ];
26499
+ }
26500
+ const obsOffsets = {
26501
+ GMT: 0,
26502
+ EDT: -240,
26503
+ EST: -300,
26504
+ CDT: -300,
26505
+ CST: -360,
26506
+ MDT: -360,
26507
+ MST: -420,
26508
+ PDT: -420,
26509
+ PST: -480
26510
+ };
26511
+ function fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) {
26512
+ const result = {
26513
+ year: 2 === yearStr.length ? untruncateYear(parseInteger(yearStr)) : parseInteger(yearStr),
26514
+ month: monthsShort.indexOf(monthStr) + 1,
26515
+ day: parseInteger(dayStr),
26516
+ hour: parseInteger(hourStr),
26517
+ minute: parseInteger(minuteStr)
26518
+ };
26519
+ if (secondStr) result.second = parseInteger(secondStr);
26520
+ if (weekdayStr) result.weekday = weekdayStr.length > 3 ? weekdaysLong.indexOf(weekdayStr) + 1 : weekdaysShort.indexOf(weekdayStr) + 1;
26521
+ return result;
26522
+ }
26523
+ const rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;
26524
+ function extractRFC2822(match) {
26525
+ const [, weekdayStr, dayStr, monthStr, yearStr, hourStr, minuteStr, secondStr, obsOffset, milOffset, offHourStr, offMinuteStr] = match, result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr);
26526
+ let offset;
26527
+ offset = obsOffset ? obsOffsets[obsOffset] : milOffset ? 0 : signedOffset(offHourStr, offMinuteStr);
26528
+ return [
26529
+ result,
26530
+ new FixedOffsetZone(offset)
26531
+ ];
26532
+ }
26533
+ function preprocessRFC2822(s) {
26534
+ return s.replace(/\([^()]*\)|[\n\t]/g, " ").replace(/(\s\s+)/g, " ").trim();
26535
+ }
26536
+ const rfc1123 = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/, rfc850 = /^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/, ascii = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;
26537
+ function extractRFC1123Or850(match) {
26538
+ const [, weekdayStr, dayStr, monthStr, yearStr, hourStr, minuteStr, secondStr] = match, result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr);
26539
+ return [
26540
+ result,
26541
+ FixedOffsetZone.utcInstance
26542
+ ];
26543
+ }
26544
+ function extractASCII(match) {
26545
+ const [, weekdayStr, monthStr, dayStr, hourStr, minuteStr, secondStr, yearStr] = match, result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr);
26546
+ return [
26547
+ result,
26548
+ FixedOffsetZone.utcInstance
26549
+ ];
26550
+ }
26551
+ const isoYmdWithTimeExtensionRegex = combineRegexes(isoYmdRegex, isoTimeExtensionRegex);
26552
+ const isoWeekWithTimeExtensionRegex = combineRegexes(isoWeekRegex, isoTimeExtensionRegex);
26553
+ const isoOrdinalWithTimeExtensionRegex = combineRegexes(isoOrdinalRegex, isoTimeExtensionRegex);
26554
+ const isoTimeCombinedRegex = combineRegexes(isoTimeRegex);
26555
+ const extractISOYmdTimeAndOffset = combineExtractors(extractISOYmd, extractISOTime, extractISOOffset, extractIANAZone);
26556
+ const extractISOWeekTimeAndOffset = combineExtractors(extractISOWeekData, extractISOTime, extractISOOffset, extractIANAZone);
26557
+ const extractISOOrdinalDateAndTime = combineExtractors(extractISOOrdinalData, extractISOTime, extractISOOffset, extractIANAZone);
26558
+ const extractISOTimeAndOffset = combineExtractors(extractISOTime, extractISOOffset, extractIANAZone);
26559
+ function parseISODate(s) {
26560
+ return parse(s, [
26561
+ isoYmdWithTimeExtensionRegex,
26562
+ extractISOYmdTimeAndOffset
26563
+ ], [
26564
+ isoWeekWithTimeExtensionRegex,
26565
+ extractISOWeekTimeAndOffset
26566
+ ], [
26567
+ isoOrdinalWithTimeExtensionRegex,
26568
+ extractISOOrdinalDateAndTime
26569
+ ], [
26570
+ isoTimeCombinedRegex,
26571
+ extractISOTimeAndOffset
26572
+ ]);
26573
+ }
26574
+ function parseRFC2822Date(s) {
26575
+ return parse(preprocessRFC2822(s), [
26576
+ rfc2822,
26577
+ extractRFC2822
26578
+ ]);
26579
+ }
26580
+ function parseHTTPDate(s) {
26581
+ return parse(s, [
26582
+ rfc1123,
26583
+ extractRFC1123Or850
26584
+ ], [
26585
+ rfc850,
26586
+ extractRFC1123Or850
26587
+ ], [
26588
+ ascii,
26589
+ extractASCII
26590
+ ]);
26591
+ }
26592
+ function parseISODuration(s) {
26593
+ return parse(s, [
26594
+ isoDuration,
26595
+ extractISODuration
26596
+ ]);
26597
+ }
26598
+ const extractISOTimeOnly = combineExtractors(extractISOTime);
26599
+ function parseISOTimeOnly(s) {
26600
+ return parse(s, [
26601
+ isoTimeOnly,
26602
+ extractISOTimeOnly
26603
+ ]);
26604
+ }
26605
+ const sqlYmdWithTimeExtensionRegex = combineRegexes(sqlYmdRegex, sqlTimeExtensionRegex);
26606
+ const sqlTimeCombinedRegex = combineRegexes(sqlTimeRegex);
26607
+ const extractISOTimeOffsetAndIANAZone = combineExtractors(extractISOTime, extractISOOffset, extractIANAZone);
26608
+ function parseSQL(s) {
26609
+ return parse(s, [
26610
+ sqlYmdWithTimeExtensionRegex,
26611
+ extractISOYmdTimeAndOffset
26612
+ ], [
26613
+ sqlTimeCombinedRegex,
26614
+ extractISOTimeOffsetAndIANAZone
26615
+ ]);
26616
+ }
26617
+ const INVALID$2 = "Invalid Duration";
26618
+ const lowOrderMatrix = {
26619
+ weeks: {
26620
+ days: 7,
26621
+ hours: 168,
26622
+ minutes: 10080,
26623
+ seconds: 604800,
26624
+ milliseconds: 604800000
26625
+ },
26626
+ days: {
26627
+ hours: 24,
26628
+ minutes: 1440,
26629
+ seconds: 86400,
26630
+ milliseconds: 86400000
26631
+ },
26632
+ hours: {
26633
+ minutes: 60,
26634
+ seconds: 3600,
26635
+ milliseconds: 3600000
26636
+ },
26637
+ minutes: {
26638
+ seconds: 60,
26639
+ milliseconds: 60000
26640
+ },
26641
+ seconds: {
26642
+ milliseconds: 1000
26643
+ }
26644
+ }, casualMatrix = {
26645
+ years: {
26646
+ quarters: 4,
26647
+ months: 12,
26648
+ weeks: 52,
26649
+ days: 365,
26650
+ hours: 8760,
26651
+ minutes: 525600,
26652
+ seconds: 31536000,
26653
+ milliseconds: 31536000000
26654
+ },
26655
+ quarters: {
26656
+ months: 3,
26657
+ weeks: 13,
26658
+ days: 91,
26659
+ hours: 2184,
26660
+ minutes: 131040,
26661
+ seconds: 7862400,
26662
+ milliseconds: 7862400000
26663
+ },
26664
+ months: {
26665
+ weeks: 4,
26666
+ days: 30,
26667
+ hours: 720,
26668
+ minutes: 43200,
26669
+ seconds: 2592000,
26670
+ milliseconds: 2592000000
26671
+ },
26672
+ ...lowOrderMatrix
26673
+ }, daysInYearAccurate = 365.2425, daysInMonthAccurate = 30.436875, accurateMatrix = {
26674
+ years: {
26675
+ quarters: 4,
26676
+ months: 12,
26677
+ weeks: daysInYearAccurate / 7,
26678
+ days: daysInYearAccurate,
26679
+ hours: 24 * daysInYearAccurate,
26680
+ minutes: 24 * daysInYearAccurate * 60,
26681
+ seconds: 24 * daysInYearAccurate * 3600,
26682
+ milliseconds: 24 * daysInYearAccurate * 3600000
26683
+ },
26684
+ quarters: {
26685
+ months: 3,
26686
+ weeks: daysInYearAccurate / 28,
26687
+ days: daysInYearAccurate / 4,
26688
+ hours: 24 * daysInYearAccurate / 4,
26689
+ minutes: 24 * daysInYearAccurate * 60 / 4,
26690
+ seconds: 24 * daysInYearAccurate * 3600 / 4,
26691
+ milliseconds: 24 * daysInYearAccurate * 3600000 / 4
26692
+ },
26693
+ months: {
26694
+ weeks: daysInMonthAccurate / 7,
26695
+ days: daysInMonthAccurate,
26696
+ hours: 24 * daysInMonthAccurate,
26697
+ minutes: 24 * daysInMonthAccurate * 60,
26698
+ seconds: 24 * daysInMonthAccurate * 3600,
26699
+ milliseconds: 24 * daysInMonthAccurate * 3600000
26700
+ },
26701
+ ...lowOrderMatrix
26702
+ };
26703
+ const orderedUnits$1 = [
26704
+ "years",
26705
+ "quarters",
26706
+ "months",
26707
+ "weeks",
26708
+ "days",
26709
+ "hours",
26710
+ "minutes",
26711
+ "seconds",
26712
+ "milliseconds"
26713
+ ];
26714
+ const reverseUnits = orderedUnits$1.slice(0).reverse();
26715
+ function clone$1(dur, alts, clear = false) {
26716
+ const conf = {
26717
+ values: clear ? alts.values : {
26718
+ ...dur.values,
26719
+ ...alts.values || {}
26720
+ },
26721
+ loc: dur.loc.clone(alts.loc),
26722
+ conversionAccuracy: alts.conversionAccuracy || dur.conversionAccuracy,
26723
+ matrix: alts.matrix || dur.matrix
26724
+ };
26725
+ return new Duration(conf);
26726
+ }
26727
+ function durationToMillis(matrix, vals) {
26728
+ let sum = vals.milliseconds ?? 0;
26729
+ for (const unit of reverseUnits.slice(1))if (vals[unit]) sum += vals[unit] * matrix[unit]["milliseconds"];
26730
+ return sum;
26731
+ }
26732
+ function normalizeValues(matrix, vals) {
26733
+ const factor = durationToMillis(matrix, vals) < 0 ? -1 : 1;
26734
+ orderedUnits$1.reduceRight((previous, current)=>{
26735
+ if (isUndefined(vals[current])) return previous;
26736
+ if (previous) {
26737
+ const previousVal = vals[previous] * factor;
26738
+ const conv = matrix[current][previous];
26739
+ const rollUp = Math.floor(previousVal / conv);
26740
+ vals[current] += rollUp * factor;
26741
+ vals[previous] -= rollUp * conv * factor;
26742
+ }
26743
+ return current;
26744
+ }, null);
26745
+ orderedUnits$1.reduce((previous, current)=>{
26746
+ if (isUndefined(vals[current])) return previous;
26747
+ if (previous) {
26748
+ const fraction = vals[previous] % 1;
26749
+ vals[previous] -= fraction;
26750
+ vals[current] += fraction * matrix[previous][current];
26751
+ }
26752
+ return current;
26753
+ }, null);
26754
+ }
26755
+ function removeZeroes(vals) {
26756
+ const newVals = {};
26757
+ for (const [key, value] of Object.entries(vals))if (0 !== value) newVals[key] = value;
26758
+ return newVals;
26759
+ }
26760
+ class Duration {
26761
+ constructor(config){
26762
+ const accurate = "longterm" === config.conversionAccuracy || false;
26763
+ let matrix = accurate ? accurateMatrix : casualMatrix;
26764
+ if (config.matrix) matrix = config.matrix;
26765
+ this.values = config.values;
26766
+ this.loc = config.loc || Locale.create();
26767
+ this.conversionAccuracy = accurate ? "longterm" : "casual";
26768
+ this.invalid = config.invalid || null;
26769
+ this.matrix = matrix;
26770
+ this.isLuxonDuration = true;
26771
+ }
26772
+ static fromMillis(count, opts) {
26773
+ return Duration.fromObject({
26774
+ milliseconds: count
26775
+ }, opts);
26776
+ }
26777
+ static fromObject(obj, opts = {}) {
26778
+ if (null == obj || "object" != typeof obj) throw new InvalidArgumentError(`Duration.fromObject: argument expected to be an object, got ${null === obj ? "null" : typeof obj}`);
26779
+ return new Duration({
26780
+ values: normalizeObject(obj, Duration.normalizeUnit),
26781
+ loc: Locale.fromObject(opts),
26782
+ conversionAccuracy: opts.conversionAccuracy,
26783
+ matrix: opts.matrix
26784
+ });
26785
+ }
26786
+ static fromDurationLike(durationLike) {
26787
+ if (isNumber(durationLike)) return Duration.fromMillis(durationLike);
26788
+ if (Duration.isDuration(durationLike)) return durationLike;
26789
+ if ("object" == typeof durationLike) return Duration.fromObject(durationLike);
26790
+ throw new InvalidArgumentError(`Unknown duration argument ${durationLike} of type ${typeof durationLike}`);
26791
+ }
26792
+ static fromISO(text, opts) {
26793
+ const [parsed] = parseISODuration(text);
26794
+ if (parsed) return Duration.fromObject(parsed, opts);
26795
+ return Duration.invalid("unparsable", `the input "${text}" can't be parsed as ISO 8601`);
26796
+ }
26797
+ static fromISOTime(text, opts) {
26798
+ const [parsed] = parseISOTimeOnly(text);
26799
+ if (parsed) return Duration.fromObject(parsed, opts);
26800
+ return Duration.invalid("unparsable", `the input "${text}" can't be parsed as ISO 8601`);
26801
+ }
26802
+ static invalid(reason, explanation = null) {
26803
+ if (!reason) throw new InvalidArgumentError("need to specify a reason the Duration is invalid");
26804
+ const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation);
26805
+ if (!Settings.throwOnInvalid) return new Duration({
26806
+ invalid
26807
+ });
26808
+ throw new InvalidDurationError(invalid);
26809
+ }
26810
+ static normalizeUnit(unit) {
26811
+ const normalized = {
26812
+ year: "years",
26813
+ years: "years",
26814
+ quarter: "quarters",
26815
+ quarters: "quarters",
26816
+ month: "months",
26817
+ months: "months",
26818
+ week: "weeks",
26819
+ weeks: "weeks",
26820
+ day: "days",
26821
+ days: "days",
26822
+ hour: "hours",
26823
+ hours: "hours",
26824
+ minute: "minutes",
26825
+ minutes: "minutes",
26826
+ second: "seconds",
26827
+ seconds: "seconds",
26828
+ millisecond: "milliseconds",
26829
+ milliseconds: "milliseconds"
26830
+ }[unit ? unit.toLowerCase() : unit];
26831
+ if (!normalized) throw new InvalidUnitError(unit);
26832
+ return normalized;
26833
+ }
26834
+ static isDuration(o) {
26835
+ return o && o.isLuxonDuration || false;
26836
+ }
26837
+ get locale() {
26838
+ return this.isValid ? this.loc.locale : null;
26839
+ }
26840
+ get numberingSystem() {
26841
+ return this.isValid ? this.loc.numberingSystem : null;
26842
+ }
26843
+ toFormat(fmt, opts = {}) {
26844
+ const fmtOpts = {
26845
+ ...opts,
26846
+ floor: false !== opts.round && false !== opts.floor
26847
+ };
26848
+ return this.isValid ? Formatter.create(this.loc, fmtOpts).formatDurationFromString(this, fmt) : INVALID$2;
26849
+ }
26850
+ toHuman(opts = {}) {
26851
+ if (!this.isValid) return INVALID$2;
26852
+ const showZeros = false !== opts.showZeros;
26853
+ const l = orderedUnits$1.map((unit)=>{
26854
+ const val = this.values[unit];
26855
+ if (isUndefined(val) || 0 === val && !showZeros) return null;
26856
+ return this.loc.numberFormatter({
26857
+ style: "unit",
26858
+ unitDisplay: "long",
26859
+ ...opts,
26860
+ unit: unit.slice(0, -1)
26861
+ }).format(val);
26862
+ }).filter((n)=>n);
26863
+ return this.loc.listFormatter({
26864
+ type: "conjunction",
26865
+ style: opts.listStyle || "narrow",
26866
+ ...opts
26867
+ }).format(l);
26868
+ }
26869
+ toObject() {
26870
+ if (!this.isValid) return {};
26871
+ return {
26872
+ ...this.values
26873
+ };
26874
+ }
26875
+ toISO() {
26876
+ if (!this.isValid) return null;
26877
+ let s = "P";
26878
+ if (0 !== this.years) s += this.years + "Y";
26879
+ if (0 !== this.months || 0 !== this.quarters) s += this.months + 3 * this.quarters + "M";
26880
+ if (0 !== this.weeks) s += this.weeks + "W";
26881
+ if (0 !== this.days) s += this.days + "D";
26882
+ if (0 !== this.hours || 0 !== this.minutes || 0 !== this.seconds || 0 !== this.milliseconds) s += "T";
26883
+ if (0 !== this.hours) s += this.hours + "H";
26884
+ if (0 !== this.minutes) s += this.minutes + "M";
26885
+ if (0 !== this.seconds || 0 !== this.milliseconds) s += roundTo(this.seconds + this.milliseconds / 1000, 3) + "S";
26886
+ if ("P" === s) s += "T0S";
26887
+ return s;
26888
+ }
26889
+ toISOTime(opts = {}) {
26890
+ if (!this.isValid) return null;
26891
+ const millis = this.toMillis();
26892
+ if (millis < 0 || millis >= 86400000) return null;
26893
+ opts = {
26894
+ suppressMilliseconds: false,
26895
+ suppressSeconds: false,
26896
+ includePrefix: false,
26897
+ format: "extended",
26898
+ ...opts,
26899
+ includeOffset: false
26900
+ };
26901
+ const dateTime = DateTime.fromMillis(millis, {
26902
+ zone: "UTC"
26903
+ });
26904
+ return dateTime.toISOTime(opts);
26905
+ }
26906
+ toJSON() {
26907
+ return this.toISO();
26908
+ }
26909
+ toString() {
26910
+ return this.toISO();
26911
+ }
26912
+ [Symbol.for("nodejs.util.inspect.custom")]() {
26913
+ if (this.isValid) return `Duration { values: ${JSON.stringify(this.values)} }`;
26914
+ return `Duration { Invalid, reason: ${this.invalidReason} }`;
26915
+ }
26916
+ toMillis() {
26917
+ if (!this.isValid) return NaN;
26918
+ return durationToMillis(this.matrix, this.values);
26919
+ }
26920
+ valueOf() {
26921
+ return this.toMillis();
26922
+ }
26923
+ plus(duration) {
26924
+ if (!this.isValid) return this;
26925
+ const dur = Duration.fromDurationLike(duration), result = {};
26926
+ for (const k of orderedUnits$1)if (luxon_hasOwnProperty(dur.values, k) || luxon_hasOwnProperty(this.values, k)) result[k] = dur.get(k) + this.get(k);
26927
+ return clone$1(this, {
26928
+ values: result
26929
+ }, true);
26930
+ }
26931
+ minus(duration) {
26932
+ if (!this.isValid) return this;
26933
+ const dur = Duration.fromDurationLike(duration);
26934
+ return this.plus(dur.negate());
26935
+ }
26936
+ mapUnits(fn) {
26937
+ if (!this.isValid) return this;
26938
+ const result = {};
26939
+ for (const k of Object.keys(this.values))result[k] = asNumber(fn(this.values[k], k));
26940
+ return clone$1(this, {
26941
+ values: result
26942
+ }, true);
26943
+ }
26944
+ get(unit) {
26945
+ return this[Duration.normalizeUnit(unit)];
26946
+ }
26947
+ set(values) {
26948
+ if (!this.isValid) return this;
26949
+ const mixed = {
26950
+ ...this.values,
26951
+ ...normalizeObject(values, Duration.normalizeUnit)
26952
+ };
26953
+ return clone$1(this, {
26954
+ values: mixed
26955
+ });
26956
+ }
26957
+ reconfigure({ locale, numberingSystem, conversionAccuracy, matrix } = {}) {
26958
+ const loc = this.loc.clone({
26959
+ locale,
26960
+ numberingSystem
26961
+ });
26962
+ const opts = {
26963
+ loc,
26964
+ matrix,
26965
+ conversionAccuracy
26966
+ };
26967
+ return clone$1(this, opts);
26968
+ }
26969
+ as(unit) {
26970
+ return this.isValid ? this.shiftTo(unit).get(unit) : NaN;
26971
+ }
26972
+ normalize() {
26973
+ if (!this.isValid) return this;
26974
+ const vals = this.toObject();
26975
+ normalizeValues(this.matrix, vals);
26976
+ return clone$1(this, {
26977
+ values: vals
26978
+ }, true);
26979
+ }
26980
+ rescale() {
26981
+ if (!this.isValid) return this;
26982
+ const vals = removeZeroes(this.normalize().shiftToAll().toObject());
26983
+ return clone$1(this, {
26984
+ values: vals
26985
+ }, true);
26986
+ }
26987
+ shiftTo(...units) {
26988
+ if (!this.isValid) return this;
26989
+ if (0 === units.length) return this;
26990
+ units = units.map((u)=>Duration.normalizeUnit(u));
26991
+ const built = {}, accumulated = {}, vals = this.toObject();
26992
+ let lastUnit;
26993
+ for (const k of orderedUnits$1)if (units.indexOf(k) >= 0) {
26994
+ lastUnit = k;
26995
+ let own = 0;
26996
+ for(const ak in accumulated){
26997
+ own += this.matrix[ak][k] * accumulated[ak];
26998
+ accumulated[ak] = 0;
26999
+ }
27000
+ if (isNumber(vals[k])) own += vals[k];
27001
+ const i = Math.trunc(own);
27002
+ built[k] = i;
27003
+ accumulated[k] = (1000 * own - 1000 * i) / 1000;
27004
+ } else if (isNumber(vals[k])) accumulated[k] = vals[k];
27005
+ for(const key in accumulated)if (0 !== accumulated[key]) built[lastUnit] += key === lastUnit ? accumulated[key] : accumulated[key] / this.matrix[lastUnit][key];
27006
+ normalizeValues(this.matrix, built);
27007
+ return clone$1(this, {
27008
+ values: built
27009
+ }, true);
27010
+ }
27011
+ shiftToAll() {
27012
+ if (!this.isValid) return this;
27013
+ return this.shiftTo("years", "months", "weeks", "days", "hours", "minutes", "seconds", "milliseconds");
27014
+ }
27015
+ negate() {
27016
+ if (!this.isValid) return this;
27017
+ const negated = {};
27018
+ for (const k of Object.keys(this.values))negated[k] = 0 === this.values[k] ? 0 : -this.values[k];
27019
+ return clone$1(this, {
27020
+ values: negated
27021
+ }, true);
27022
+ }
27023
+ removeZeros() {
27024
+ if (!this.isValid) return this;
27025
+ const vals = removeZeroes(this.values);
27026
+ return clone$1(this, {
27027
+ values: vals
27028
+ }, true);
27029
+ }
27030
+ get years() {
27031
+ return this.isValid ? this.values.years || 0 : NaN;
27032
+ }
27033
+ get quarters() {
27034
+ return this.isValid ? this.values.quarters || 0 : NaN;
27035
+ }
27036
+ get months() {
27037
+ return this.isValid ? this.values.months || 0 : NaN;
27038
+ }
27039
+ get weeks() {
27040
+ return this.isValid ? this.values.weeks || 0 : NaN;
27041
+ }
27042
+ get days() {
27043
+ return this.isValid ? this.values.days || 0 : NaN;
27044
+ }
27045
+ get hours() {
27046
+ return this.isValid ? this.values.hours || 0 : NaN;
27047
+ }
27048
+ get minutes() {
27049
+ return this.isValid ? this.values.minutes || 0 : NaN;
27050
+ }
27051
+ get seconds() {
27052
+ return this.isValid ? this.values.seconds || 0 : NaN;
27053
+ }
27054
+ get milliseconds() {
27055
+ return this.isValid ? this.values.milliseconds || 0 : NaN;
27056
+ }
27057
+ get isValid() {
27058
+ return null === this.invalid;
27059
+ }
27060
+ get invalidReason() {
27061
+ return this.invalid ? this.invalid.reason : null;
27062
+ }
27063
+ get invalidExplanation() {
27064
+ return this.invalid ? this.invalid.explanation : null;
27065
+ }
27066
+ equals(other) {
27067
+ if (!this.isValid || !other.isValid) return false;
27068
+ if (!this.loc.equals(other.loc)) return false;
27069
+ function eq(v1, v2) {
27070
+ if (void 0 === v1 || 0 === v1) return void 0 === v2 || 0 === v2;
27071
+ return v1 === v2;
27072
+ }
27073
+ for (const u of orderedUnits$1)if (!eq(this.values[u], other.values[u])) return false;
27074
+ return true;
27075
+ }
27076
+ }
27077
+ const INVALID$1 = "Invalid Interval";
27078
+ function validateStartEnd(start, end) {
27079
+ if (!start || !start.isValid) return Interval.invalid("missing or invalid start");
27080
+ if (!end || !end.isValid) return Interval.invalid("missing or invalid end");
27081
+ if (end < start) return Interval.invalid("end before start", `The end of an interval must be after its start, but you had start=${start.toISO()} and end=${end.toISO()}`);
27082
+ return null;
27083
+ }
27084
+ class Interval {
27085
+ constructor(config){
27086
+ this.s = config.start;
27087
+ this.e = config.end;
27088
+ this.invalid = config.invalid || null;
27089
+ this.isLuxonInterval = true;
27090
+ }
27091
+ static invalid(reason, explanation = null) {
27092
+ if (!reason) throw new InvalidArgumentError("need to specify a reason the Interval is invalid");
27093
+ const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation);
27094
+ if (!Settings.throwOnInvalid) return new Interval({
27095
+ invalid
27096
+ });
27097
+ throw new InvalidIntervalError(invalid);
27098
+ }
27099
+ static fromDateTimes(start, end) {
27100
+ const builtStart = friendlyDateTime(start), builtEnd = friendlyDateTime(end);
27101
+ const validateError = validateStartEnd(builtStart, builtEnd);
27102
+ if (null == validateError) return new Interval({
27103
+ start: builtStart,
27104
+ end: builtEnd
27105
+ });
27106
+ return validateError;
27107
+ }
27108
+ static after(start, duration) {
27109
+ const dur = Duration.fromDurationLike(duration), dt = friendlyDateTime(start);
27110
+ return Interval.fromDateTimes(dt, dt.plus(dur));
27111
+ }
27112
+ static before(end, duration) {
27113
+ const dur = Duration.fromDurationLike(duration), dt = friendlyDateTime(end);
27114
+ return Interval.fromDateTimes(dt.minus(dur), dt);
27115
+ }
27116
+ static fromISO(text, opts) {
27117
+ const [s, e] = (text || "").split("/", 2);
27118
+ if (s && e) {
27119
+ let start, startIsValid;
27120
+ try {
27121
+ start = DateTime.fromISO(s, opts);
27122
+ startIsValid = start.isValid;
27123
+ } catch (e) {
27124
+ startIsValid = false;
27125
+ }
27126
+ let end, endIsValid;
27127
+ try {
27128
+ end = DateTime.fromISO(e, opts);
27129
+ endIsValid = end.isValid;
27130
+ } catch (e) {
27131
+ endIsValid = false;
27132
+ }
27133
+ if (startIsValid && endIsValid) return Interval.fromDateTimes(start, end);
27134
+ if (startIsValid) {
27135
+ const dur = Duration.fromISO(e, opts);
27136
+ if (dur.isValid) return Interval.after(start, dur);
27137
+ } else if (endIsValid) {
27138
+ const dur = Duration.fromISO(s, opts);
27139
+ if (dur.isValid) return Interval.before(end, dur);
27140
+ }
27141
+ }
27142
+ return Interval.invalid("unparsable", `the input "${text}" can't be parsed as ISO 8601`);
27143
+ }
27144
+ static isInterval(o) {
27145
+ return o && o.isLuxonInterval || false;
27146
+ }
27147
+ get start() {
27148
+ return this.isValid ? this.s : null;
27149
+ }
27150
+ get end() {
27151
+ return this.isValid ? this.e : null;
27152
+ }
27153
+ get lastDateTime() {
27154
+ return this.isValid ? this.e ? this.e.minus(1) : null : null;
27155
+ }
27156
+ get isValid() {
27157
+ return null === this.invalidReason;
27158
+ }
27159
+ get invalidReason() {
27160
+ return this.invalid ? this.invalid.reason : null;
27161
+ }
27162
+ get invalidExplanation() {
27163
+ return this.invalid ? this.invalid.explanation : null;
27164
+ }
27165
+ length(unit = "milliseconds") {
27166
+ return this.isValid ? this.toDuration(unit).get(unit) : NaN;
27167
+ }
27168
+ count(unit = "milliseconds", opts) {
27169
+ if (!this.isValid) return NaN;
27170
+ const start = this.start.startOf(unit, opts);
27171
+ let end;
27172
+ end = opts?.useLocaleWeeks ? this.end.reconfigure({
27173
+ locale: start.locale
27174
+ }) : this.end;
27175
+ end = end.startOf(unit, opts);
27176
+ return Math.floor(end.diff(start, unit).get(unit)) + (end.valueOf() !== this.end.valueOf());
27177
+ }
27178
+ hasSame(unit) {
27179
+ return this.isValid ? this.isEmpty() || this.e.minus(1).hasSame(this.s, unit) : false;
27180
+ }
27181
+ isEmpty() {
27182
+ return this.s.valueOf() === this.e.valueOf();
27183
+ }
27184
+ isAfter(dateTime) {
27185
+ if (!this.isValid) return false;
27186
+ return this.s > dateTime;
27187
+ }
27188
+ isBefore(dateTime) {
27189
+ if (!this.isValid) return false;
27190
+ return this.e <= dateTime;
27191
+ }
27192
+ contains(dateTime) {
27193
+ if (!this.isValid) return false;
27194
+ return this.s <= dateTime && this.e > dateTime;
27195
+ }
27196
+ set({ start, end } = {}) {
27197
+ if (!this.isValid) return this;
27198
+ return Interval.fromDateTimes(start || this.s, end || this.e);
27199
+ }
27200
+ splitAt(...dateTimes) {
27201
+ if (!this.isValid) return [];
27202
+ const sorted = dateTimes.map(friendlyDateTime).filter((d)=>this.contains(d)).sort((a, b)=>a.toMillis() - b.toMillis()), results = [];
27203
+ let { s } = this, i = 0;
27204
+ while(s < this.e){
27205
+ const added = sorted[i] || this.e, next = +added > +this.e ? this.e : added;
27206
+ results.push(Interval.fromDateTimes(s, next));
27207
+ s = next;
27208
+ i += 1;
27209
+ }
27210
+ return results;
27211
+ }
27212
+ splitBy(duration) {
27213
+ const dur = Duration.fromDurationLike(duration);
27214
+ if (!this.isValid || !dur.isValid || 0 === dur.as("milliseconds")) return [];
27215
+ let { s } = this, idx = 1, next;
27216
+ const results = [];
27217
+ while(s < this.e){
27218
+ const added = this.start.plus(dur.mapUnits((x)=>x * idx));
27219
+ next = +added > +this.e ? this.e : added;
27220
+ results.push(Interval.fromDateTimes(s, next));
27221
+ s = next;
27222
+ idx += 1;
27223
+ }
27224
+ return results;
27225
+ }
27226
+ divideEqually(numberOfParts) {
27227
+ if (!this.isValid) return [];
27228
+ return this.splitBy(this.length() / numberOfParts).slice(0, numberOfParts);
27229
+ }
27230
+ overlaps(other) {
27231
+ return this.e > other.s && this.s < other.e;
27232
+ }
27233
+ abutsStart(other) {
27234
+ if (!this.isValid) return false;
27235
+ return +this.e === +other.s;
27236
+ }
27237
+ abutsEnd(other) {
27238
+ if (!this.isValid) return false;
27239
+ return +other.e === +this.s;
27240
+ }
27241
+ engulfs(other) {
27242
+ if (!this.isValid) return false;
27243
+ return this.s <= other.s && this.e >= other.e;
27244
+ }
27245
+ equals(other) {
27246
+ if (!this.isValid || !other.isValid) return false;
27247
+ return this.s.equals(other.s) && this.e.equals(other.e);
27248
+ }
27249
+ intersection(other) {
27250
+ if (!this.isValid) return this;
27251
+ const s = this.s > other.s ? this.s : other.s, e = this.e < other.e ? this.e : other.e;
27252
+ if (s >= e) return null;
27253
+ return Interval.fromDateTimes(s, e);
27254
+ }
27255
+ union(other) {
27256
+ if (!this.isValid) return this;
27257
+ const s = this.s < other.s ? this.s : other.s, e = this.e > other.e ? this.e : other.e;
27258
+ return Interval.fromDateTimes(s, e);
27259
+ }
27260
+ static merge(intervals) {
27261
+ const [found, final] = intervals.sort((a, b)=>a.s - b.s).reduce(([sofar, current], item)=>{
27262
+ if (!current) return [
27263
+ sofar,
27264
+ item
27265
+ ];
27266
+ if (current.overlaps(item) || current.abutsStart(item)) return [
27267
+ sofar,
27268
+ current.union(item)
27269
+ ];
27270
+ return [
27271
+ sofar.concat([
27272
+ current
27273
+ ]),
27274
+ item
27275
+ ];
27276
+ }, [
27277
+ [],
27278
+ null
27279
+ ]);
27280
+ if (final) found.push(final);
27281
+ return found;
27282
+ }
27283
+ static xor(intervals) {
27284
+ let start = null, currentCount = 0;
27285
+ const results = [], ends = intervals.map((i)=>[
27286
+ {
27287
+ time: i.s,
27288
+ type: "s"
27289
+ },
27290
+ {
27291
+ time: i.e,
27292
+ type: "e"
27293
+ }
27294
+ ]), flattened = Array.prototype.concat(...ends), arr = flattened.sort((a, b)=>a.time - b.time);
27295
+ for (const i of arr){
27296
+ currentCount += "s" === i.type ? 1 : -1;
27297
+ if (1 === currentCount) start = i.time;
27298
+ else {
27299
+ if (start && +start !== +i.time) results.push(Interval.fromDateTimes(start, i.time));
27300
+ start = null;
27301
+ }
27302
+ }
27303
+ return Interval.merge(results);
27304
+ }
27305
+ difference(...intervals) {
27306
+ return Interval.xor([
27307
+ this
27308
+ ].concat(intervals)).map((i)=>this.intersection(i)).filter((i)=>i && !i.isEmpty());
27309
+ }
27310
+ toString() {
27311
+ if (!this.isValid) return INVALID$1;
27312
+ return `[${this.s.toISO()} – ${this.e.toISO()})`;
27313
+ }
27314
+ [Symbol.for("nodejs.util.inspect.custom")]() {
27315
+ if (this.isValid) return `Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`;
27316
+ return `Interval { Invalid, reason: ${this.invalidReason} }`;
27317
+ }
27318
+ toLocaleString(formatOpts = DATE_SHORT, opts = {}) {
27319
+ return this.isValid ? Formatter.create(this.s.loc.clone(opts), formatOpts).formatInterval(this) : INVALID$1;
27320
+ }
27321
+ toISO(opts) {
27322
+ if (!this.isValid) return INVALID$1;
27323
+ return `${this.s.toISO(opts)}/${this.e.toISO(opts)}`;
27324
+ }
27325
+ toISODate() {
27326
+ if (!this.isValid) return INVALID$1;
27327
+ return `${this.s.toISODate()}/${this.e.toISODate()}`;
27328
+ }
27329
+ toISOTime(opts) {
27330
+ if (!this.isValid) return INVALID$1;
27331
+ return `${this.s.toISOTime(opts)}/${this.e.toISOTime(opts)}`;
27332
+ }
27333
+ toFormat(dateFormat, { separator = " – " } = {}) {
27334
+ if (!this.isValid) return INVALID$1;
27335
+ return `${this.s.toFormat(dateFormat)}${separator}${this.e.toFormat(dateFormat)}`;
27336
+ }
27337
+ toDuration(unit, opts) {
27338
+ if (!this.isValid) return Duration.invalid(this.invalidReason);
27339
+ return this.e.diff(this.s, unit, opts);
27340
+ }
27341
+ mapEndpoints(mapFn) {
27342
+ return Interval.fromDateTimes(mapFn(this.s), mapFn(this.e));
27343
+ }
27344
+ }
27345
+ class Info {
27346
+ static hasDST(zone = Settings.defaultZone) {
27347
+ const proto = DateTime.now().setZone(zone).set({
27348
+ month: 12
27349
+ });
27350
+ return !zone.isUniversal && proto.offset !== proto.set({
27351
+ month: 6
27352
+ }).offset;
27353
+ }
27354
+ static isValidIANAZone(zone) {
27355
+ return IANAZone.isValidZone(zone);
27356
+ }
27357
+ static normalizeZone(input) {
27358
+ return normalizeZone(input, Settings.defaultZone);
27359
+ }
27360
+ static getStartOfWeek({ locale = null, locObj = null } = {}) {
27361
+ return (locObj || Locale.create(locale)).getStartOfWeek();
27362
+ }
27363
+ static getMinimumDaysInFirstWeek({ locale = null, locObj = null } = {}) {
27364
+ return (locObj || Locale.create(locale)).getMinDaysInFirstWeek();
27365
+ }
27366
+ static getWeekendWeekdays({ locale = null, locObj = null } = {}) {
27367
+ return (locObj || Locale.create(locale)).getWeekendDays().slice();
27368
+ }
27369
+ static months(length = "long", { locale = null, numberingSystem = null, locObj = null, outputCalendar = "gregory" } = {}) {
27370
+ return (locObj || Locale.create(locale, numberingSystem, outputCalendar)).months(length);
27371
+ }
27372
+ static monthsFormat(length = "long", { locale = null, numberingSystem = null, locObj = null, outputCalendar = "gregory" } = {}) {
27373
+ return (locObj || Locale.create(locale, numberingSystem, outputCalendar)).months(length, true);
27374
+ }
27375
+ static weekdays(length = "long", { locale = null, numberingSystem = null, locObj = null } = {}) {
27376
+ return (locObj || Locale.create(locale, numberingSystem, null)).weekdays(length);
27377
+ }
27378
+ static weekdaysFormat(length = "long", { locale = null, numberingSystem = null, locObj = null } = {}) {
27379
+ return (locObj || Locale.create(locale, numberingSystem, null)).weekdays(length, true);
27380
+ }
27381
+ static meridiems({ locale = null } = {}) {
27382
+ return Locale.create(locale).meridiems();
27383
+ }
27384
+ static eras(length = "short", { locale = null } = {}) {
27385
+ return Locale.create(locale, null, "gregory").eras(length);
27386
+ }
27387
+ static features() {
27388
+ return {
27389
+ relative: hasRelative(),
27390
+ localeWeek: hasLocaleWeekInfo()
27391
+ };
27392
+ }
27393
+ }
27394
+ function dayDiff(earlier, later) {
27395
+ const utcDayStart = (dt)=>dt.toUTC(0, {
27396
+ keepLocalTime: true
27397
+ }).startOf("day").valueOf(), ms = utcDayStart(later) - utcDayStart(earlier);
27398
+ return Math.floor(Duration.fromMillis(ms).as("days"));
27399
+ }
27400
+ function highOrderDiffs(cursor, later, units) {
27401
+ const differs = [
27402
+ [
27403
+ "years",
27404
+ (a, b)=>b.year - a.year
27405
+ ],
27406
+ [
27407
+ "quarters",
27408
+ (a, b)=>b.quarter - a.quarter + (b.year - a.year) * 4
27409
+ ],
27410
+ [
27411
+ "months",
27412
+ (a, b)=>b.month - a.month + (b.year - a.year) * 12
27413
+ ],
27414
+ [
27415
+ "weeks",
27416
+ (a, b)=>{
27417
+ const days = dayDiff(a, b);
27418
+ return (days - days % 7) / 7;
27419
+ }
27420
+ ],
27421
+ [
27422
+ "days",
27423
+ dayDiff
27424
+ ]
27425
+ ];
27426
+ const results = {};
27427
+ const earlier = cursor;
27428
+ let lowestOrder, highWater;
27429
+ for (const [unit, differ] of differs)if (units.indexOf(unit) >= 0) {
27430
+ lowestOrder = unit;
27431
+ results[unit] = differ(cursor, later);
27432
+ highWater = earlier.plus(results);
27433
+ if (highWater > later) {
27434
+ results[unit]--;
27435
+ cursor = earlier.plus(results);
27436
+ if (cursor > later) {
27437
+ highWater = cursor;
27438
+ results[unit]--;
27439
+ cursor = earlier.plus(results);
27440
+ }
27441
+ } else cursor = highWater;
27442
+ }
27443
+ return [
27444
+ cursor,
27445
+ results,
27446
+ highWater,
27447
+ lowestOrder
27448
+ ];
27449
+ }
27450
+ function diff(earlier, later, units, opts) {
27451
+ let [cursor, results, highWater, lowestOrder] = highOrderDiffs(earlier, later, units);
27452
+ const remainingMillis = later - cursor;
27453
+ const lowerOrderUnits = units.filter((u)=>[
27454
+ "hours",
27455
+ "minutes",
27456
+ "seconds",
27457
+ "milliseconds"
27458
+ ].indexOf(u) >= 0);
27459
+ if (0 === lowerOrderUnits.length) {
27460
+ if (highWater < later) highWater = cursor.plus({
27461
+ [lowestOrder]: 1
27462
+ });
27463
+ if (highWater !== cursor) results[lowestOrder] = (results[lowestOrder] || 0) + remainingMillis / (highWater - cursor);
27464
+ }
27465
+ const duration = Duration.fromObject(results, opts);
27466
+ if (lowerOrderUnits.length > 0) return Duration.fromMillis(remainingMillis, opts).shiftTo(...lowerOrderUnits).plus(duration);
27467
+ return duration;
27468
+ }
27469
+ const MISSING_FTP = "missing Intl.DateTimeFormat.formatToParts support";
27470
+ function intUnit(regex, post = (i)=>i) {
27471
+ return {
27472
+ regex,
27473
+ deser: ([s])=>post(parseDigits(s))
27474
+ };
27475
+ }
27476
+ const NBSP = String.fromCharCode(160);
27477
+ const spaceOrNBSP = `[ ${NBSP}]`;
27478
+ const spaceOrNBSPRegExp = new RegExp(spaceOrNBSP, "g");
27479
+ function fixListRegex(s) {
27480
+ return s.replace(/\./g, "\\.?").replace(spaceOrNBSPRegExp, spaceOrNBSP);
27481
+ }
27482
+ function stripInsensitivities(s) {
27483
+ return s.replace(/\./g, "").replace(spaceOrNBSPRegExp, " ").toLowerCase();
27484
+ }
27485
+ function oneOf(strings, startIndex) {
27486
+ if (null === strings) return null;
27487
+ return {
27488
+ regex: RegExp(strings.map(fixListRegex).join("|")),
27489
+ deser: ([s])=>strings.findIndex((i)=>stripInsensitivities(s) === stripInsensitivities(i)) + startIndex
27490
+ };
27491
+ }
27492
+ function luxon_offset(regex, groups) {
27493
+ return {
27494
+ regex,
27495
+ deser: ([, h, m])=>signedOffset(h, m),
27496
+ groups
27497
+ };
27498
+ }
27499
+ function simple(regex) {
27500
+ return {
27501
+ regex,
27502
+ deser: ([s])=>s
27503
+ };
27504
+ }
27505
+ function escapeToken(value) {
27506
+ return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
27507
+ }
27508
+ function unitForToken(token, loc) {
27509
+ const one = digitRegex(loc), two = digitRegex(loc, "{2}"), three = digitRegex(loc, "{3}"), four = digitRegex(loc, "{4}"), six = digitRegex(loc, "{6}"), oneOrTwo = digitRegex(loc, "{1,2}"), oneToThree = digitRegex(loc, "{1,3}"), oneToSix = digitRegex(loc, "{1,6}"), oneToNine = digitRegex(loc, "{1,9}"), twoToFour = digitRegex(loc, "{2,4}"), fourToSix = digitRegex(loc, "{4,6}"), literal = (t)=>({
27510
+ regex: RegExp(escapeToken(t.val)),
27511
+ deser: ([s])=>s,
27512
+ literal: true
27513
+ }), unitate = (t)=>{
27514
+ if (token.literal) return literal(t);
27515
+ switch(t.val){
27516
+ case "G":
27517
+ return oneOf(loc.eras("short"), 0);
27518
+ case "GG":
27519
+ return oneOf(loc.eras("long"), 0);
27520
+ case "y":
27521
+ return intUnit(oneToSix);
27522
+ case "yy":
27523
+ return intUnit(twoToFour, untruncateYear);
27524
+ case "yyyy":
27525
+ return intUnit(four);
27526
+ case "yyyyy":
27527
+ return intUnit(fourToSix);
27528
+ case "yyyyyy":
27529
+ return intUnit(six);
27530
+ case "M":
27531
+ return intUnit(oneOrTwo);
27532
+ case "MM":
27533
+ return intUnit(two);
27534
+ case "MMM":
27535
+ return oneOf(loc.months("short", true), 1);
27536
+ case "MMMM":
27537
+ return oneOf(loc.months("long", true), 1);
27538
+ case "L":
27539
+ return intUnit(oneOrTwo);
27540
+ case "LL":
27541
+ return intUnit(two);
27542
+ case "LLL":
27543
+ return oneOf(loc.months("short", false), 1);
27544
+ case "LLLL":
27545
+ return oneOf(loc.months("long", false), 1);
27546
+ case "d":
27547
+ return intUnit(oneOrTwo);
27548
+ case "dd":
27549
+ return intUnit(two);
27550
+ case "o":
27551
+ return intUnit(oneToThree);
27552
+ case "ooo":
27553
+ return intUnit(three);
27554
+ case "HH":
27555
+ return intUnit(two);
27556
+ case "H":
27557
+ return intUnit(oneOrTwo);
27558
+ case "hh":
27559
+ return intUnit(two);
27560
+ case "h":
27561
+ return intUnit(oneOrTwo);
27562
+ case "mm":
27563
+ return intUnit(two);
27564
+ case "m":
27565
+ return intUnit(oneOrTwo);
27566
+ case "q":
27567
+ return intUnit(oneOrTwo);
27568
+ case "qq":
27569
+ return intUnit(two);
27570
+ case "s":
27571
+ return intUnit(oneOrTwo);
27572
+ case "ss":
27573
+ return intUnit(two);
27574
+ case "S":
27575
+ return intUnit(oneToThree);
27576
+ case "SSS":
27577
+ return intUnit(three);
27578
+ case "u":
27579
+ return simple(oneToNine);
27580
+ case "uu":
27581
+ return simple(oneOrTwo);
27582
+ case "uuu":
27583
+ return intUnit(one);
27584
+ case "a":
27585
+ return oneOf(loc.meridiems(), 0);
27586
+ case "kkkk":
27587
+ return intUnit(four);
27588
+ case "kk":
27589
+ return intUnit(twoToFour, untruncateYear);
27590
+ case "W":
27591
+ return intUnit(oneOrTwo);
27592
+ case "WW":
27593
+ return intUnit(two);
27594
+ case "E":
27595
+ case "c":
27596
+ return intUnit(one);
27597
+ case "EEE":
27598
+ return oneOf(loc.weekdays("short", false), 1);
27599
+ case "EEEE":
27600
+ return oneOf(loc.weekdays("long", false), 1);
27601
+ case "ccc":
27602
+ return oneOf(loc.weekdays("short", true), 1);
27603
+ case "cccc":
27604
+ return oneOf(loc.weekdays("long", true), 1);
27605
+ case "Z":
27606
+ case "ZZ":
27607
+ return luxon_offset(new RegExp(`([+-]${oneOrTwo.source})(?::(${two.source}))?`), 2);
27608
+ case "ZZZ":
27609
+ return luxon_offset(new RegExp(`([+-]${oneOrTwo.source})(${two.source})?`), 2);
27610
+ case "z":
27611
+ return simple(/[a-z_+-/]{1,256}?/i);
27612
+ case " ":
27613
+ return simple(/[^\S\n\r]/);
27614
+ default:
27615
+ return literal(t);
27616
+ }
27617
+ };
27618
+ const unit = unitate(token) || {
27619
+ invalidReason: MISSING_FTP
27620
+ };
27621
+ unit.token = token;
27622
+ return unit;
27623
+ }
27624
+ const partTypeStyleToTokenVal = {
27625
+ year: {
27626
+ "2-digit": "yy",
27627
+ numeric: "yyyyy"
27628
+ },
27629
+ month: {
27630
+ numeric: "M",
27631
+ "2-digit": "MM",
27632
+ short: "MMM",
27633
+ long: "MMMM"
27634
+ },
27635
+ day: {
27636
+ numeric: "d",
27637
+ "2-digit": "dd"
27638
+ },
27639
+ weekday: {
27640
+ short: "EEE",
27641
+ long: "EEEE"
27642
+ },
27643
+ dayperiod: "a",
27644
+ dayPeriod: "a",
27645
+ hour12: {
27646
+ numeric: "h",
27647
+ "2-digit": "hh"
27648
+ },
27649
+ hour24: {
27650
+ numeric: "H",
27651
+ "2-digit": "HH"
27652
+ },
27653
+ minute: {
27654
+ numeric: "m",
27655
+ "2-digit": "mm"
27656
+ },
27657
+ second: {
27658
+ numeric: "s",
27659
+ "2-digit": "ss"
27660
+ },
27661
+ timeZoneName: {
27662
+ long: "ZZZZZ",
27663
+ short: "ZZZ"
27664
+ }
27665
+ };
27666
+ function tokenForPart(part, formatOpts, resolvedOpts) {
27667
+ const { type, value } = part;
27668
+ if ("literal" === type) {
27669
+ const isSpace = /^\s+$/.test(value);
27670
+ return {
27671
+ literal: !isSpace,
27672
+ val: isSpace ? " " : value
27673
+ };
27674
+ }
27675
+ const style = formatOpts[type];
27676
+ let actualType = type;
27677
+ if ("hour" === type) actualType = null != formatOpts.hour12 ? formatOpts.hour12 ? "hour12" : "hour24" : null != formatOpts.hourCycle ? "h11" === formatOpts.hourCycle || "h12" === formatOpts.hourCycle ? "hour12" : "hour24" : resolvedOpts.hour12 ? "hour12" : "hour24";
27678
+ let val = partTypeStyleToTokenVal[actualType];
27679
+ if ("object" == typeof val) val = val[style];
27680
+ if (val) return {
27681
+ literal: false,
27682
+ val
27683
+ };
27684
+ }
27685
+ function buildRegex(units) {
27686
+ const re = units.map((u)=>u.regex).reduce((f, r)=>`${f}(${r.source})`, "");
27687
+ return [
27688
+ `^${re}$`,
27689
+ units
27690
+ ];
27691
+ }
27692
+ function luxon_match(input, regex, handlers) {
27693
+ const matches = input.match(regex);
27694
+ if (!matches) return [
27695
+ matches,
27696
+ {}
27697
+ ];
27698
+ {
27699
+ const all = {};
27700
+ let matchIndex = 1;
27701
+ for(const i in handlers)if (luxon_hasOwnProperty(handlers, i)) {
27702
+ const h = handlers[i], groups = h.groups ? h.groups + 1 : 1;
27703
+ if (!h.literal && h.token) all[h.token.val[0]] = h.deser(matches.slice(matchIndex, matchIndex + groups));
27704
+ matchIndex += groups;
27705
+ }
27706
+ return [
27707
+ matches,
27708
+ all
27709
+ ];
27710
+ }
27711
+ }
27712
+ function dateTimeFromMatches(matches) {
27713
+ const toField = (token)=>{
27714
+ switch(token){
27715
+ case "S":
27716
+ return "millisecond";
27717
+ case "s":
27718
+ return "second";
27719
+ case "m":
27720
+ return "minute";
27721
+ case "h":
27722
+ case "H":
27723
+ return "hour";
27724
+ case "d":
27725
+ return "day";
27726
+ case "o":
27727
+ return "ordinal";
27728
+ case "L":
27729
+ case "M":
27730
+ return "month";
27731
+ case "y":
27732
+ return "year";
27733
+ case "E":
27734
+ case "c":
27735
+ return "weekday";
27736
+ case "W":
27737
+ return "weekNumber";
27738
+ case "k":
27739
+ return "weekYear";
27740
+ case "q":
27741
+ return "quarter";
27742
+ default:
27743
+ return null;
27744
+ }
27745
+ };
27746
+ let zone = null;
27747
+ let specificOffset;
27748
+ if (!isUndefined(matches.z)) zone = IANAZone.create(matches.z);
27749
+ if (!isUndefined(matches.Z)) {
27750
+ if (!zone) zone = new FixedOffsetZone(matches.Z);
27751
+ specificOffset = matches.Z;
27752
+ }
27753
+ if (!isUndefined(matches.q)) matches.M = (matches.q - 1) * 3 + 1;
27754
+ if (!isUndefined(matches.h)) {
27755
+ if (matches.h < 12 && 1 === matches.a) matches.h += 12;
27756
+ else if (12 === matches.h && 0 === matches.a) matches.h = 0;
27757
+ }
27758
+ if (0 === matches.G && matches.y) matches.y = -matches.y;
27759
+ if (!isUndefined(matches.u)) matches.S = parseMillis(matches.u);
27760
+ const vals = Object.keys(matches).reduce((r, k)=>{
27761
+ const f = toField(k);
27762
+ if (f) r[f] = matches[k];
27763
+ return r;
27764
+ }, {});
27765
+ return [
27766
+ vals,
27767
+ zone,
27768
+ specificOffset
27769
+ ];
27770
+ }
27771
+ let dummyDateTimeCache = null;
27772
+ function getDummyDateTime() {
27773
+ if (!dummyDateTimeCache) dummyDateTimeCache = DateTime.fromMillis(1555555555555);
27774
+ return dummyDateTimeCache;
27775
+ }
27776
+ function maybeExpandMacroToken(token, locale) {
27777
+ if (token.literal) return token;
27778
+ const formatOpts = Formatter.macroTokenToFormatOpts(token.val);
27779
+ const tokens = formatOptsToTokens(formatOpts, locale);
27780
+ if (null == tokens || tokens.includes(void 0)) return token;
27781
+ return tokens;
27782
+ }
27783
+ function expandMacroTokens(tokens, locale) {
27784
+ return Array.prototype.concat(...tokens.map((t)=>maybeExpandMacroToken(t, locale)));
27785
+ }
27786
+ class TokenParser {
27787
+ constructor(locale, format){
27788
+ this.locale = locale;
27789
+ this.format = format;
27790
+ this.tokens = expandMacroTokens(Formatter.parseFormat(format), locale);
27791
+ this.units = this.tokens.map((t)=>unitForToken(t, locale));
27792
+ this.disqualifyingUnit = this.units.find((t)=>t.invalidReason);
27793
+ if (!this.disqualifyingUnit) {
27794
+ const [regexString, handlers] = buildRegex(this.units);
27795
+ this.regex = RegExp(regexString, "i");
27796
+ this.handlers = handlers;
27797
+ }
27798
+ }
27799
+ explainFromTokens(input) {
27800
+ if (!this.isValid) return {
27801
+ input,
27802
+ tokens: this.tokens,
27803
+ invalidReason: this.invalidReason
27804
+ };
27805
+ {
27806
+ const [rawMatches, matches] = luxon_match(input, this.regex, this.handlers), [result, zone, specificOffset] = matches ? dateTimeFromMatches(matches) : [
27807
+ null,
27808
+ null,
27809
+ void 0
27810
+ ];
27811
+ if (luxon_hasOwnProperty(matches, "a") && luxon_hasOwnProperty(matches, "H")) throw new ConflictingSpecificationError("Can't include meridiem when specifying 24-hour format");
27812
+ return {
27813
+ input,
27814
+ tokens: this.tokens,
27815
+ regex: this.regex,
27816
+ rawMatches,
27817
+ matches,
27818
+ result,
27819
+ zone,
27820
+ specificOffset
27821
+ };
27822
+ }
27823
+ }
27824
+ get isValid() {
27825
+ return !this.disqualifyingUnit;
27826
+ }
27827
+ get invalidReason() {
27828
+ return this.disqualifyingUnit ? this.disqualifyingUnit.invalidReason : null;
27829
+ }
27830
+ }
27831
+ function explainFromTokens(locale, input, format) {
27832
+ const parser = new TokenParser(locale, format);
27833
+ return parser.explainFromTokens(input);
27834
+ }
27835
+ function parseFromTokens(locale, input, format) {
27836
+ const { result, zone, specificOffset, invalidReason } = explainFromTokens(locale, input, format);
27837
+ return [
27838
+ result,
27839
+ zone,
27840
+ specificOffset,
27841
+ invalidReason
27842
+ ];
27843
+ }
27844
+ function formatOptsToTokens(formatOpts, locale) {
27845
+ if (!formatOpts) return null;
27846
+ const formatter = Formatter.create(locale, formatOpts);
27847
+ const df = formatter.dtFormatter(getDummyDateTime());
27848
+ const parts = df.formatToParts();
27849
+ const resolvedOpts = df.resolvedOptions();
27850
+ return parts.map((p)=>tokenForPart(p, formatOpts, resolvedOpts));
27851
+ }
27852
+ const INVALID = "Invalid DateTime";
27853
+ const MAX_DATE = 8.64e15;
27854
+ function unsupportedZone(zone) {
27855
+ return new Invalid("unsupported zone", `the zone "${zone.name}" is not supported`);
27856
+ }
27857
+ function possiblyCachedWeekData(dt) {
27858
+ if (null === dt.weekData) dt.weekData = gregorianToWeek(dt.c);
27859
+ return dt.weekData;
27860
+ }
27861
+ function possiblyCachedLocalWeekData(dt) {
27862
+ if (null === dt.localWeekData) dt.localWeekData = gregorianToWeek(dt.c, dt.loc.getMinDaysInFirstWeek(), dt.loc.getStartOfWeek());
27863
+ return dt.localWeekData;
27864
+ }
27865
+ function clone(inst, alts) {
27866
+ const current = {
27867
+ ts: inst.ts,
27868
+ zone: inst.zone,
27869
+ c: inst.c,
27870
+ o: inst.o,
27871
+ loc: inst.loc,
27872
+ invalid: inst.invalid
27873
+ };
27874
+ return new DateTime({
27875
+ ...current,
27876
+ ...alts,
27877
+ old: current
27878
+ });
27879
+ }
27880
+ function fixOffset(localTS, o, tz) {
27881
+ let utcGuess = localTS - 60 * o * 1000;
27882
+ const o2 = tz.offset(utcGuess);
27883
+ if (o === o2) return [
27884
+ utcGuess,
27885
+ o
27886
+ ];
27887
+ utcGuess -= (o2 - o) * 60000;
27888
+ const o3 = tz.offset(utcGuess);
27889
+ if (o2 === o3) return [
27890
+ utcGuess,
27891
+ o2
27892
+ ];
27893
+ return [
27894
+ localTS - 60 * Math.min(o2, o3) * 1000,
27895
+ Math.max(o2, o3)
27896
+ ];
27897
+ }
27898
+ function tsToObj(ts, offset) {
27899
+ ts += 60 * offset * 1000;
27900
+ const d = new Date(ts);
27901
+ return {
27902
+ year: d.getUTCFullYear(),
27903
+ month: d.getUTCMonth() + 1,
27904
+ day: d.getUTCDate(),
27905
+ hour: d.getUTCHours(),
27906
+ minute: d.getUTCMinutes(),
27907
+ second: d.getUTCSeconds(),
27908
+ millisecond: d.getUTCMilliseconds()
27909
+ };
27910
+ }
27911
+ function objToTS(obj, offset, zone) {
27912
+ return fixOffset(objToLocalTS(obj), offset, zone);
27913
+ }
27914
+ function adjustTime(inst, dur) {
27915
+ const oPre = inst.o, year = inst.c.year + Math.trunc(dur.years), month = inst.c.month + Math.trunc(dur.months) + 3 * Math.trunc(dur.quarters), c = {
27916
+ ...inst.c,
27917
+ year,
27918
+ month,
27919
+ day: Math.min(inst.c.day, daysInMonth(year, month)) + Math.trunc(dur.days) + 7 * Math.trunc(dur.weeks)
27920
+ }, millisToAdd = Duration.fromObject({
27921
+ years: dur.years - Math.trunc(dur.years),
27922
+ quarters: dur.quarters - Math.trunc(dur.quarters),
27923
+ months: dur.months - Math.trunc(dur.months),
27924
+ weeks: dur.weeks - Math.trunc(dur.weeks),
27925
+ days: dur.days - Math.trunc(dur.days),
27926
+ hours: dur.hours,
27927
+ minutes: dur.minutes,
27928
+ seconds: dur.seconds,
27929
+ milliseconds: dur.milliseconds
27930
+ }).as("milliseconds"), localTS = objToLocalTS(c);
27931
+ let [ts, o] = fixOffset(localTS, oPre, inst.zone);
27932
+ if (0 !== millisToAdd) {
27933
+ ts += millisToAdd;
27934
+ o = inst.zone.offset(ts);
27935
+ }
27936
+ return {
27937
+ ts,
27938
+ o
27939
+ };
27940
+ }
27941
+ function parseDataToDateTime(parsed, parsedZone, opts, format, text, specificOffset) {
27942
+ const { setZone, zone } = opts;
27943
+ if ((!parsed || 0 === Object.keys(parsed).length) && !parsedZone) return DateTime.invalid(new Invalid("unparsable", `the input "${text}" can't be parsed as ${format}`));
27944
+ {
27945
+ const interpretationZone = parsedZone || zone, inst = DateTime.fromObject(parsed, {
27946
+ ...opts,
27947
+ zone: interpretationZone,
27948
+ specificOffset
27949
+ });
27950
+ return setZone ? inst : inst.setZone(zone);
27951
+ }
27952
+ }
27953
+ function toTechFormat(dt, format, allowZ = true) {
27954
+ return dt.isValid ? Formatter.create(Locale.create("en-US"), {
27955
+ allowZ,
27956
+ forceSimple: true
27957
+ }).formatDateTimeFromString(dt, format) : null;
27958
+ }
27959
+ function toISODate(o, extended, precision) {
27960
+ const longFormat = o.c.year > 9999 || o.c.year < 0;
27961
+ let c = "";
27962
+ if (longFormat && o.c.year >= 0) c += "+";
27963
+ c += padStart(o.c.year, longFormat ? 6 : 4);
27964
+ if ("year" === precision) return c;
27965
+ if (extended) {
27966
+ c += "-";
27967
+ c += padStart(o.c.month);
27968
+ if ("month" === precision) return c;
27969
+ c += "-";
27970
+ } else {
27971
+ c += padStart(o.c.month);
27972
+ if ("month" === precision) return c;
27973
+ }
27974
+ c += padStart(o.c.day);
27975
+ return c;
27976
+ }
27977
+ function toISOTime(o, extended, suppressSeconds, suppressMilliseconds, includeOffset, extendedZone, precision) {
27978
+ let showSeconds = !suppressSeconds || 0 !== o.c.millisecond || 0 !== o.c.second, c = "";
27979
+ switch(precision){
27980
+ case "day":
27981
+ case "month":
27982
+ case "year":
27983
+ break;
27984
+ default:
27985
+ c += padStart(o.c.hour);
27986
+ if ("hour" === precision) break;
27987
+ if (extended) {
27988
+ c += ":";
27989
+ c += padStart(o.c.minute);
27990
+ if ("minute" === precision) break;
27991
+ if (showSeconds) {
27992
+ c += ":";
27993
+ c += padStart(o.c.second);
27994
+ }
27995
+ } else {
27996
+ c += padStart(o.c.minute);
27997
+ if ("minute" === precision) break;
27998
+ if (showSeconds) c += padStart(o.c.second);
27999
+ }
28000
+ if ("second" === precision) break;
28001
+ if (showSeconds && (!suppressMilliseconds || 0 !== o.c.millisecond)) {
28002
+ c += ".";
28003
+ c += padStart(o.c.millisecond, 3);
28004
+ }
28005
+ }
28006
+ if (includeOffset) if (o.isOffsetFixed && 0 === o.offset && !extendedZone) c += "Z";
28007
+ else if (o.o < 0) {
28008
+ c += "-";
28009
+ c += padStart(Math.trunc(-o.o / 60));
28010
+ c += ":";
28011
+ c += padStart(Math.trunc(-o.o % 60));
28012
+ } else {
28013
+ c += "+";
28014
+ c += padStart(Math.trunc(o.o / 60));
28015
+ c += ":";
28016
+ c += padStart(Math.trunc(o.o % 60));
28017
+ }
28018
+ if (extendedZone) c += "[" + o.zone.ianaName + "]";
28019
+ return c;
28020
+ }
28021
+ const defaultUnitValues = {
28022
+ month: 1,
28023
+ day: 1,
28024
+ hour: 0,
28025
+ minute: 0,
28026
+ second: 0,
28027
+ millisecond: 0
28028
+ }, defaultWeekUnitValues = {
28029
+ weekNumber: 1,
28030
+ weekday: 1,
28031
+ hour: 0,
28032
+ minute: 0,
28033
+ second: 0,
28034
+ millisecond: 0
28035
+ }, defaultOrdinalUnitValues = {
28036
+ ordinal: 1,
28037
+ hour: 0,
28038
+ minute: 0,
28039
+ second: 0,
28040
+ millisecond: 0
28041
+ };
28042
+ const orderedUnits = [
28043
+ "year",
28044
+ "month",
28045
+ "day",
28046
+ "hour",
28047
+ "minute",
28048
+ "second",
28049
+ "millisecond"
28050
+ ], orderedWeekUnits = [
28051
+ "weekYear",
28052
+ "weekNumber",
28053
+ "weekday",
28054
+ "hour",
28055
+ "minute",
28056
+ "second",
28057
+ "millisecond"
28058
+ ], orderedOrdinalUnits = [
28059
+ "year",
28060
+ "ordinal",
28061
+ "hour",
28062
+ "minute",
28063
+ "second",
28064
+ "millisecond"
28065
+ ];
28066
+ function normalizeUnit(unit) {
28067
+ const normalized = {
28068
+ year: "year",
28069
+ years: "year",
28070
+ month: "month",
28071
+ months: "month",
28072
+ day: "day",
28073
+ days: "day",
28074
+ hour: "hour",
28075
+ hours: "hour",
28076
+ minute: "minute",
28077
+ minutes: "minute",
28078
+ quarter: "quarter",
28079
+ quarters: "quarter",
28080
+ second: "second",
28081
+ seconds: "second",
28082
+ millisecond: "millisecond",
28083
+ milliseconds: "millisecond",
28084
+ weekday: "weekday",
28085
+ weekdays: "weekday",
28086
+ weeknumber: "weekNumber",
28087
+ weeksnumber: "weekNumber",
28088
+ weeknumbers: "weekNumber",
28089
+ weekyear: "weekYear",
28090
+ weekyears: "weekYear",
28091
+ ordinal: "ordinal"
28092
+ }[unit.toLowerCase()];
28093
+ if (!normalized) throw new InvalidUnitError(unit);
28094
+ return normalized;
28095
+ }
28096
+ function normalizeUnitWithLocalWeeks(unit) {
28097
+ switch(unit.toLowerCase()){
28098
+ case "localweekday":
28099
+ case "localweekdays":
28100
+ return "localWeekday";
28101
+ case "localweeknumber":
28102
+ case "localweeknumbers":
28103
+ return "localWeekNumber";
28104
+ case "localweekyear":
28105
+ case "localweekyears":
28106
+ return "localWeekYear";
28107
+ default:
28108
+ return normalizeUnit(unit);
28109
+ }
28110
+ }
28111
+ function guessOffsetForZone(zone) {
28112
+ if (void 0 === zoneOffsetTs) zoneOffsetTs = Settings.now();
28113
+ if ("iana" !== zone.type) return zone.offset(zoneOffsetTs);
28114
+ const zoneName = zone.name;
28115
+ let offsetGuess = zoneOffsetGuessCache.get(zoneName);
28116
+ if (void 0 === offsetGuess) {
28117
+ offsetGuess = zone.offset(zoneOffsetTs);
28118
+ zoneOffsetGuessCache.set(zoneName, offsetGuess);
28119
+ }
28120
+ return offsetGuess;
28121
+ }
28122
+ function quickDT(obj, opts) {
28123
+ const zone = normalizeZone(opts.zone, Settings.defaultZone);
28124
+ if (!zone.isValid) return DateTime.invalid(unsupportedZone(zone));
28125
+ const loc = Locale.fromObject(opts);
28126
+ let ts, o;
28127
+ if (isUndefined(obj.year)) ts = Settings.now();
28128
+ else {
28129
+ for (const u of orderedUnits)if (isUndefined(obj[u])) obj[u] = defaultUnitValues[u];
28130
+ const invalid = hasInvalidGregorianData(obj) || hasInvalidTimeData(obj);
28131
+ if (invalid) return DateTime.invalid(invalid);
28132
+ const offsetProvis = guessOffsetForZone(zone);
28133
+ [ts, o] = objToTS(obj, offsetProvis, zone);
28134
+ }
28135
+ return new DateTime({
28136
+ ts,
28137
+ zone,
28138
+ loc,
28139
+ o
28140
+ });
28141
+ }
28142
+ function diffRelative(start, end, opts) {
28143
+ const round = isUndefined(opts.round) ? true : opts.round, rounding = isUndefined(opts.rounding) ? "trunc" : opts.rounding, format = (c, unit)=>{
28144
+ c = roundTo(c, round || opts.calendary ? 0 : 2, opts.calendary ? "round" : rounding);
28145
+ const formatter = end.loc.clone(opts).relFormatter(opts);
28146
+ return formatter.format(c, unit);
28147
+ }, differ = (unit)=>{
28148
+ if (!opts.calendary) return end.diff(start, unit).get(unit);
28149
+ if (!end.hasSame(start, unit)) return end.startOf(unit).diff(start.startOf(unit), unit).get(unit);
28150
+ return 0;
28151
+ };
28152
+ if (opts.unit) return format(differ(opts.unit), opts.unit);
28153
+ for (const unit of opts.units){
28154
+ const count = differ(unit);
28155
+ if (Math.abs(count) >= 1) return format(count, unit);
28156
+ }
28157
+ return format(start > end ? -0 : 0, opts.units[opts.units.length - 1]);
28158
+ }
28159
+ function lastOpts(argList) {
28160
+ let opts = {}, args;
28161
+ if (argList.length > 0 && "object" == typeof argList[argList.length - 1]) {
28162
+ opts = argList[argList.length - 1];
28163
+ args = Array.from(argList).slice(0, argList.length - 1);
28164
+ } else args = Array.from(argList);
28165
+ return [
28166
+ opts,
28167
+ args
28168
+ ];
28169
+ }
28170
+ let zoneOffsetTs;
28171
+ const zoneOffsetGuessCache = new Map();
28172
+ class DateTime {
28173
+ constructor(config){
28174
+ const zone = config.zone || Settings.defaultZone;
28175
+ let invalid = config.invalid || (Number.isNaN(config.ts) ? new Invalid("invalid input") : null) || (zone.isValid ? null : unsupportedZone(zone));
28176
+ this.ts = isUndefined(config.ts) ? Settings.now() : config.ts;
28177
+ let c = null, o = null;
28178
+ if (!invalid) {
28179
+ const unchanged = config.old && config.old.ts === this.ts && config.old.zone.equals(zone);
28180
+ if (unchanged) [c, o] = [
28181
+ config.old.c,
28182
+ config.old.o
28183
+ ];
28184
+ else {
28185
+ const ot = isNumber(config.o) && !config.old ? config.o : zone.offset(this.ts);
28186
+ c = tsToObj(this.ts, ot);
28187
+ invalid = Number.isNaN(c.year) ? new Invalid("invalid input") : null;
28188
+ c = invalid ? null : c;
28189
+ o = invalid ? null : ot;
28190
+ }
28191
+ }
28192
+ this._zone = zone;
28193
+ this.loc = config.loc || Locale.create();
28194
+ this.invalid = invalid;
28195
+ this.weekData = null;
28196
+ this.localWeekData = null;
28197
+ this.c = c;
28198
+ this.o = o;
28199
+ this.isLuxonDateTime = true;
28200
+ }
28201
+ static now() {
28202
+ return new DateTime({});
28203
+ }
28204
+ static local() {
28205
+ const [opts, args] = lastOpts(arguments), [year, month, day, hour, minute, second, millisecond] = args;
28206
+ return quickDT({
28207
+ year,
28208
+ month,
28209
+ day,
28210
+ hour,
28211
+ minute,
28212
+ second,
28213
+ millisecond
28214
+ }, opts);
28215
+ }
28216
+ static utc() {
28217
+ const [opts, args] = lastOpts(arguments), [year, month, day, hour, minute, second, millisecond] = args;
28218
+ opts.zone = FixedOffsetZone.utcInstance;
28219
+ return quickDT({
28220
+ year,
28221
+ month,
28222
+ day,
28223
+ hour,
28224
+ minute,
28225
+ second,
28226
+ millisecond
28227
+ }, opts);
28228
+ }
28229
+ static fromJSDate(date, options = {}) {
28230
+ const ts = isDate(date) ? date.valueOf() : NaN;
28231
+ if (Number.isNaN(ts)) return DateTime.invalid("invalid input");
28232
+ const zoneToUse = normalizeZone(options.zone, Settings.defaultZone);
28233
+ if (!zoneToUse.isValid) return DateTime.invalid(unsupportedZone(zoneToUse));
28234
+ return new DateTime({
28235
+ ts: ts,
28236
+ zone: zoneToUse,
28237
+ loc: Locale.fromObject(options)
28238
+ });
28239
+ }
28240
+ static fromMillis(milliseconds, options = {}) {
28241
+ if (isNumber(milliseconds)) if (milliseconds < -MAX_DATE || milliseconds > MAX_DATE) return DateTime.invalid("Timestamp out of range");
28242
+ else return new DateTime({
28243
+ ts: milliseconds,
28244
+ zone: normalizeZone(options.zone, Settings.defaultZone),
28245
+ loc: Locale.fromObject(options)
28246
+ });
28247
+ throw new InvalidArgumentError(`fromMillis requires a numerical input, but received a ${typeof milliseconds} with value ${milliseconds}`);
28248
+ }
28249
+ static fromSeconds(seconds, options = {}) {
28250
+ if (isNumber(seconds)) return new DateTime({
28251
+ ts: 1000 * seconds,
28252
+ zone: normalizeZone(options.zone, Settings.defaultZone),
28253
+ loc: Locale.fromObject(options)
28254
+ });
28255
+ throw new InvalidArgumentError("fromSeconds requires a numerical input");
28256
+ }
28257
+ static fromObject(obj, opts = {}) {
28258
+ obj = obj || {};
28259
+ const zoneToUse = normalizeZone(opts.zone, Settings.defaultZone);
28260
+ if (!zoneToUse.isValid) return DateTime.invalid(unsupportedZone(zoneToUse));
28261
+ const loc = Locale.fromObject(opts);
28262
+ const normalized = normalizeObject(obj, normalizeUnitWithLocalWeeks);
28263
+ const { minDaysInFirstWeek, startOfWeek } = usesLocalWeekValues(normalized, loc);
28264
+ const tsNow = Settings.now(), offsetProvis = isUndefined(opts.specificOffset) ? zoneToUse.offset(tsNow) : opts.specificOffset, containsOrdinal = !isUndefined(normalized.ordinal), containsGregorYear = !isUndefined(normalized.year), containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day), containsGregor = containsGregorYear || containsGregorMD, definiteWeekDef = normalized.weekYear || normalized.weekNumber;
28265
+ if ((containsGregor || containsOrdinal) && definiteWeekDef) throw new ConflictingSpecificationError("Can't mix weekYear/weekNumber units with year/month/day or ordinals");
28266
+ if (containsGregorMD && containsOrdinal) throw new ConflictingSpecificationError("Can't mix ordinal dates with month/day");
28267
+ const useWeekData = definiteWeekDef || normalized.weekday && !containsGregor;
28268
+ let units, defaultValues, objNow = tsToObj(tsNow, offsetProvis);
28269
+ if (useWeekData) {
28270
+ units = orderedWeekUnits;
28271
+ defaultValues = defaultWeekUnitValues;
28272
+ objNow = gregorianToWeek(objNow, minDaysInFirstWeek, startOfWeek);
28273
+ } else if (containsOrdinal) {
28274
+ units = orderedOrdinalUnits;
28275
+ defaultValues = defaultOrdinalUnitValues;
28276
+ objNow = gregorianToOrdinal(objNow);
28277
+ } else {
28278
+ units = orderedUnits;
28279
+ defaultValues = defaultUnitValues;
28280
+ }
28281
+ let foundFirst = false;
28282
+ for (const u of units){
28283
+ const v = normalized[u];
28284
+ if (isUndefined(v)) if (foundFirst) normalized[u] = defaultValues[u];
28285
+ else normalized[u] = objNow[u];
28286
+ else foundFirst = true;
28287
+ }
28288
+ const higherOrderInvalid = useWeekData ? hasInvalidWeekData(normalized, minDaysInFirstWeek, startOfWeek) : containsOrdinal ? hasInvalidOrdinalData(normalized) : hasInvalidGregorianData(normalized), invalid = higherOrderInvalid || hasInvalidTimeData(normalized);
28289
+ if (invalid) return DateTime.invalid(invalid);
28290
+ const gregorian = useWeekData ? weekToGregorian(normalized, minDaysInFirstWeek, startOfWeek) : containsOrdinal ? ordinalToGregorian(normalized) : normalized, [tsFinal, offsetFinal] = objToTS(gregorian, offsetProvis, zoneToUse), inst = new DateTime({
28291
+ ts: tsFinal,
28292
+ zone: zoneToUse,
28293
+ o: offsetFinal,
28294
+ loc
28295
+ });
28296
+ if (normalized.weekday && containsGregor && obj.weekday !== inst.weekday) return DateTime.invalid("mismatched weekday", `you can't specify both a weekday of ${normalized.weekday} and a date of ${inst.toISO()}`);
28297
+ if (!inst.isValid) return DateTime.invalid(inst.invalid);
28298
+ return inst;
28299
+ }
28300
+ static fromISO(text, opts = {}) {
28301
+ const [vals, parsedZone] = parseISODate(text);
28302
+ return parseDataToDateTime(vals, parsedZone, opts, "ISO 8601", text);
28303
+ }
28304
+ static fromRFC2822(text, opts = {}) {
28305
+ const [vals, parsedZone] = parseRFC2822Date(text);
28306
+ return parseDataToDateTime(vals, parsedZone, opts, "RFC 2822", text);
28307
+ }
28308
+ static fromHTTP(text, opts = {}) {
28309
+ const [vals, parsedZone] = parseHTTPDate(text);
28310
+ return parseDataToDateTime(vals, parsedZone, opts, "HTTP", opts);
28311
+ }
28312
+ static fromFormat(text, fmt, opts = {}) {
28313
+ if (isUndefined(text) || isUndefined(fmt)) throw new InvalidArgumentError("fromFormat requires an input string and a format");
28314
+ const { locale = null, numberingSystem = null } = opts, localeToUse = Locale.fromOpts({
28315
+ locale,
28316
+ numberingSystem,
28317
+ defaultToEN: true
28318
+ }), [vals, parsedZone, specificOffset, invalid] = parseFromTokens(localeToUse, text, fmt);
28319
+ if (invalid) return DateTime.invalid(invalid);
28320
+ return parseDataToDateTime(vals, parsedZone, opts, `format ${fmt}`, text, specificOffset);
28321
+ }
28322
+ static fromString(text, fmt, opts = {}) {
28323
+ return DateTime.fromFormat(text, fmt, opts);
28324
+ }
28325
+ static fromSQL(text, opts = {}) {
28326
+ const [vals, parsedZone] = parseSQL(text);
28327
+ return parseDataToDateTime(vals, parsedZone, opts, "SQL", text);
28328
+ }
28329
+ static invalid(reason, explanation = null) {
28330
+ if (!reason) throw new InvalidArgumentError("need to specify a reason the DateTime is invalid");
28331
+ const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation);
28332
+ if (!Settings.throwOnInvalid) return new DateTime({
28333
+ invalid
28334
+ });
28335
+ throw new InvalidDateTimeError(invalid);
28336
+ }
28337
+ static isDateTime(o) {
28338
+ return o && o.isLuxonDateTime || false;
28339
+ }
28340
+ static parseFormatForOpts(formatOpts, localeOpts = {}) {
28341
+ const tokenList = formatOptsToTokens(formatOpts, Locale.fromObject(localeOpts));
28342
+ return tokenList ? tokenList.map((t)=>t ? t.val : null).join("") : null;
28343
+ }
28344
+ static expandFormat(fmt, localeOpts = {}) {
28345
+ const expanded = expandMacroTokens(Formatter.parseFormat(fmt), Locale.fromObject(localeOpts));
28346
+ return expanded.map((t)=>t.val).join("");
28347
+ }
28348
+ static resetCache() {
28349
+ zoneOffsetTs = void 0;
28350
+ zoneOffsetGuessCache.clear();
28351
+ }
28352
+ get(unit) {
28353
+ return this[unit];
28354
+ }
28355
+ get isValid() {
28356
+ return null === this.invalid;
28357
+ }
28358
+ get invalidReason() {
28359
+ return this.invalid ? this.invalid.reason : null;
28360
+ }
28361
+ get invalidExplanation() {
28362
+ return this.invalid ? this.invalid.explanation : null;
28363
+ }
28364
+ get locale() {
28365
+ return this.isValid ? this.loc.locale : null;
28366
+ }
28367
+ get numberingSystem() {
28368
+ return this.isValid ? this.loc.numberingSystem : null;
28369
+ }
28370
+ get outputCalendar() {
28371
+ return this.isValid ? this.loc.outputCalendar : null;
28372
+ }
28373
+ get zone() {
28374
+ return this._zone;
28375
+ }
28376
+ get zoneName() {
28377
+ return this.isValid ? this.zone.name : null;
28378
+ }
28379
+ get year() {
28380
+ return this.isValid ? this.c.year : NaN;
28381
+ }
28382
+ get quarter() {
28383
+ return this.isValid ? Math.ceil(this.c.month / 3) : NaN;
28384
+ }
28385
+ get month() {
28386
+ return this.isValid ? this.c.month : NaN;
28387
+ }
28388
+ get day() {
28389
+ return this.isValid ? this.c.day : NaN;
28390
+ }
28391
+ get hour() {
28392
+ return this.isValid ? this.c.hour : NaN;
28393
+ }
28394
+ get minute() {
28395
+ return this.isValid ? this.c.minute : NaN;
28396
+ }
28397
+ get second() {
28398
+ return this.isValid ? this.c.second : NaN;
28399
+ }
28400
+ get millisecond() {
28401
+ return this.isValid ? this.c.millisecond : NaN;
28402
+ }
28403
+ get weekYear() {
28404
+ return this.isValid ? possiblyCachedWeekData(this).weekYear : NaN;
28405
+ }
28406
+ get weekNumber() {
28407
+ return this.isValid ? possiblyCachedWeekData(this).weekNumber : NaN;
28408
+ }
28409
+ get weekday() {
28410
+ return this.isValid ? possiblyCachedWeekData(this).weekday : NaN;
28411
+ }
28412
+ get isWeekend() {
28413
+ return this.isValid && this.loc.getWeekendDays().includes(this.weekday);
28414
+ }
28415
+ get localWeekday() {
28416
+ return this.isValid ? possiblyCachedLocalWeekData(this).weekday : NaN;
28417
+ }
28418
+ get localWeekNumber() {
28419
+ return this.isValid ? possiblyCachedLocalWeekData(this).weekNumber : NaN;
28420
+ }
28421
+ get localWeekYear() {
28422
+ return this.isValid ? possiblyCachedLocalWeekData(this).weekYear : NaN;
28423
+ }
28424
+ get ordinal() {
28425
+ return this.isValid ? gregorianToOrdinal(this.c).ordinal : NaN;
28426
+ }
28427
+ get monthShort() {
28428
+ return this.isValid ? Info.months("short", {
28429
+ locObj: this.loc
28430
+ })[this.month - 1] : null;
28431
+ }
28432
+ get monthLong() {
28433
+ return this.isValid ? Info.months("long", {
28434
+ locObj: this.loc
28435
+ })[this.month - 1] : null;
28436
+ }
28437
+ get weekdayShort() {
28438
+ return this.isValid ? Info.weekdays("short", {
28439
+ locObj: this.loc
28440
+ })[this.weekday - 1] : null;
28441
+ }
28442
+ get weekdayLong() {
28443
+ return this.isValid ? Info.weekdays("long", {
28444
+ locObj: this.loc
28445
+ })[this.weekday - 1] : null;
28446
+ }
28447
+ get offset() {
28448
+ return this.isValid ? +this.o : NaN;
28449
+ }
28450
+ get offsetNameShort() {
28451
+ if (this.isValid) return this.zone.offsetName(this.ts, {
28452
+ format: "short",
28453
+ locale: this.locale
28454
+ });
28455
+ return null;
28456
+ }
28457
+ get offsetNameLong() {
28458
+ if (this.isValid) return this.zone.offsetName(this.ts, {
28459
+ format: "long",
28460
+ locale: this.locale
28461
+ });
28462
+ return null;
28463
+ }
28464
+ get isOffsetFixed() {
28465
+ return this.isValid ? this.zone.isUniversal : null;
28466
+ }
28467
+ get isInDST() {
28468
+ if (this.isOffsetFixed) return false;
28469
+ return this.offset > this.set({
28470
+ month: 1,
28471
+ day: 1
28472
+ }).offset || this.offset > this.set({
28473
+ month: 5
28474
+ }).offset;
28475
+ }
28476
+ getPossibleOffsets() {
28477
+ if (!this.isValid || this.isOffsetFixed) return [
28478
+ this
28479
+ ];
28480
+ const dayMs = 86400000;
28481
+ const minuteMs = 60000;
28482
+ const localTS = objToLocalTS(this.c);
28483
+ const oEarlier = this.zone.offset(localTS - dayMs);
28484
+ const oLater = this.zone.offset(localTS + dayMs);
28485
+ const o1 = this.zone.offset(localTS - oEarlier * minuteMs);
28486
+ const o2 = this.zone.offset(localTS - oLater * minuteMs);
28487
+ if (o1 === o2) return [
28488
+ this
28489
+ ];
28490
+ const ts1 = localTS - o1 * minuteMs;
28491
+ const ts2 = localTS - o2 * minuteMs;
28492
+ const c1 = tsToObj(ts1, o1);
28493
+ const c2 = tsToObj(ts2, o2);
28494
+ if (c1.hour === c2.hour && c1.minute === c2.minute && c1.second === c2.second && c1.millisecond === c2.millisecond) return [
28495
+ clone(this, {
28496
+ ts: ts1
28497
+ }),
28498
+ clone(this, {
28499
+ ts: ts2
28500
+ })
28501
+ ];
28502
+ return [
28503
+ this
28504
+ ];
28505
+ }
28506
+ get isInLeapYear() {
28507
+ return isLeapYear(this.year);
28508
+ }
28509
+ get daysInMonth() {
28510
+ return daysInMonth(this.year, this.month);
28511
+ }
28512
+ get daysInYear() {
28513
+ return this.isValid ? daysInYear(this.year) : NaN;
28514
+ }
28515
+ get weeksInWeekYear() {
28516
+ return this.isValid ? weeksInWeekYear(this.weekYear) : NaN;
28517
+ }
28518
+ get weeksInLocalWeekYear() {
28519
+ return this.isValid ? weeksInWeekYear(this.localWeekYear, this.loc.getMinDaysInFirstWeek(), this.loc.getStartOfWeek()) : NaN;
28520
+ }
28521
+ resolvedLocaleOptions(opts = {}) {
28522
+ const { locale, numberingSystem, calendar } = Formatter.create(this.loc.clone(opts), opts).resolvedOptions(this);
28523
+ return {
28524
+ locale,
28525
+ numberingSystem,
28526
+ outputCalendar: calendar
28527
+ };
28528
+ }
28529
+ toUTC(offset = 0, opts = {}) {
28530
+ return this.setZone(FixedOffsetZone.instance(offset), opts);
28531
+ }
28532
+ toLocal() {
28533
+ return this.setZone(Settings.defaultZone);
28534
+ }
28535
+ setZone(zone, { keepLocalTime = false, keepCalendarTime = false } = {}) {
28536
+ zone = normalizeZone(zone, Settings.defaultZone);
28537
+ if (zone.equals(this.zone)) return this;
28538
+ {
28539
+ if (!zone.isValid) return DateTime.invalid(unsupportedZone(zone));
28540
+ let newTS = this.ts;
28541
+ if (keepLocalTime || keepCalendarTime) {
28542
+ const offsetGuess = zone.offset(this.ts);
28543
+ const asObj = this.toObject();
28544
+ [newTS] = objToTS(asObj, offsetGuess, zone);
28545
+ }
28546
+ return clone(this, {
28547
+ ts: newTS,
28548
+ zone
28549
+ });
28550
+ }
28551
+ }
28552
+ reconfigure({ locale, numberingSystem, outputCalendar } = {}) {
28553
+ const loc = this.loc.clone({
28554
+ locale,
28555
+ numberingSystem,
28556
+ outputCalendar
28557
+ });
28558
+ return clone(this, {
28559
+ loc
28560
+ });
28561
+ }
28562
+ setLocale(locale) {
28563
+ return this.reconfigure({
28564
+ locale
28565
+ });
28566
+ }
28567
+ set(values) {
28568
+ if (!this.isValid) return this;
28569
+ const normalized = normalizeObject(values, normalizeUnitWithLocalWeeks);
28570
+ const { minDaysInFirstWeek, startOfWeek } = usesLocalWeekValues(normalized, this.loc);
28571
+ const settingWeekStuff = !isUndefined(normalized.weekYear) || !isUndefined(normalized.weekNumber) || !isUndefined(normalized.weekday), containsOrdinal = !isUndefined(normalized.ordinal), containsGregorYear = !isUndefined(normalized.year), containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day), containsGregor = containsGregorYear || containsGregorMD, definiteWeekDef = normalized.weekYear || normalized.weekNumber;
28572
+ if ((containsGregor || containsOrdinal) && definiteWeekDef) throw new ConflictingSpecificationError("Can't mix weekYear/weekNumber units with year/month/day or ordinals");
28573
+ if (containsGregorMD && containsOrdinal) throw new ConflictingSpecificationError("Can't mix ordinal dates with month/day");
28574
+ let mixed;
28575
+ if (settingWeekStuff) mixed = weekToGregorian({
28576
+ ...gregorianToWeek(this.c, minDaysInFirstWeek, startOfWeek),
28577
+ ...normalized
28578
+ }, minDaysInFirstWeek, startOfWeek);
28579
+ else if (isUndefined(normalized.ordinal)) {
28580
+ mixed = {
28581
+ ...this.toObject(),
28582
+ ...normalized
28583
+ };
28584
+ if (isUndefined(normalized.day)) mixed.day = Math.min(daysInMonth(mixed.year, mixed.month), mixed.day);
28585
+ } else mixed = ordinalToGregorian({
28586
+ ...gregorianToOrdinal(this.c),
28587
+ ...normalized
28588
+ });
28589
+ const [ts, o] = objToTS(mixed, this.o, this.zone);
28590
+ return clone(this, {
28591
+ ts,
28592
+ o
28593
+ });
28594
+ }
28595
+ plus(duration) {
28596
+ if (!this.isValid) return this;
28597
+ const dur = Duration.fromDurationLike(duration);
28598
+ return clone(this, adjustTime(this, dur));
28599
+ }
28600
+ minus(duration) {
28601
+ if (!this.isValid) return this;
28602
+ const dur = Duration.fromDurationLike(duration).negate();
28603
+ return clone(this, adjustTime(this, dur));
28604
+ }
28605
+ startOf(unit, { useLocaleWeeks = false } = {}) {
28606
+ if (!this.isValid) return this;
28607
+ const o = {}, normalizedUnit = Duration.normalizeUnit(unit);
28608
+ switch(normalizedUnit){
28609
+ case "years":
28610
+ o.month = 1;
28611
+ case "quarters":
28612
+ case "months":
28613
+ o.day = 1;
28614
+ case "weeks":
28615
+ case "days":
28616
+ o.hour = 0;
28617
+ case "hours":
28618
+ o.minute = 0;
28619
+ case "minutes":
28620
+ o.second = 0;
28621
+ case "seconds":
28622
+ o.millisecond = 0;
28623
+ break;
28624
+ }
28625
+ if ("weeks" === normalizedUnit) if (useLocaleWeeks) {
28626
+ const startOfWeek = this.loc.getStartOfWeek();
28627
+ const { weekday } = this;
28628
+ if (weekday < startOfWeek) o.weekNumber = this.weekNumber - 1;
28629
+ o.weekday = startOfWeek;
28630
+ } else o.weekday = 1;
28631
+ if ("quarters" === normalizedUnit) {
28632
+ const q = Math.ceil(this.month / 3);
28633
+ o.month = (q - 1) * 3 + 1;
28634
+ }
28635
+ return this.set(o);
28636
+ }
28637
+ endOf(unit, opts) {
28638
+ return this.isValid ? this.plus({
28639
+ [unit]: 1
28640
+ }).startOf(unit, opts).minus(1) : this;
28641
+ }
28642
+ toFormat(fmt, opts = {}) {
28643
+ return this.isValid ? Formatter.create(this.loc.redefaultToEN(opts)).formatDateTimeFromString(this, fmt) : INVALID;
28644
+ }
28645
+ toLocaleString(formatOpts = DATE_SHORT, opts = {}) {
28646
+ return this.isValid ? Formatter.create(this.loc.clone(opts), formatOpts).formatDateTime(this) : INVALID;
28647
+ }
28648
+ toLocaleParts(opts = {}) {
28649
+ return this.isValid ? Formatter.create(this.loc.clone(opts), opts).formatDateTimeParts(this) : [];
28650
+ }
28651
+ toISO({ format = "extended", suppressSeconds = false, suppressMilliseconds = false, includeOffset = true, extendedZone = false, precision = "milliseconds" } = {}) {
28652
+ if (!this.isValid) return null;
28653
+ precision = normalizeUnit(precision);
28654
+ const ext = "extended" === format;
28655
+ let c = toISODate(this, ext, precision);
28656
+ if (orderedUnits.indexOf(precision) >= 3) c += "T";
28657
+ c += toISOTime(this, ext, suppressSeconds, suppressMilliseconds, includeOffset, extendedZone, precision);
28658
+ return c;
28659
+ }
28660
+ toISODate({ format = "extended", precision = "day" } = {}) {
28661
+ if (!this.isValid) return null;
28662
+ return toISODate(this, "extended" === format, normalizeUnit(precision));
28663
+ }
28664
+ toISOWeekDate() {
28665
+ return toTechFormat(this, "kkkk-'W'WW-c");
28666
+ }
28667
+ toISOTime({ suppressMilliseconds = false, suppressSeconds = false, includeOffset = true, includePrefix = false, extendedZone = false, format = "extended", precision = "milliseconds" } = {}) {
28668
+ if (!this.isValid) return null;
28669
+ precision = normalizeUnit(precision);
28670
+ let c = includePrefix && orderedUnits.indexOf(precision) >= 3 ? "T" : "";
28671
+ return c + toISOTime(this, "extended" === format, suppressSeconds, suppressMilliseconds, includeOffset, extendedZone, precision);
28672
+ }
28673
+ toRFC2822() {
28674
+ return toTechFormat(this, "EEE, dd LLL yyyy HH:mm:ss ZZZ", false);
28675
+ }
28676
+ toHTTP() {
28677
+ return toTechFormat(this.toUTC(), "EEE, dd LLL yyyy HH:mm:ss 'GMT'");
28678
+ }
28679
+ toSQLDate() {
28680
+ if (!this.isValid) return null;
28681
+ return toISODate(this, true);
28682
+ }
28683
+ toSQLTime({ includeOffset = true, includeZone = false, includeOffsetSpace = true } = {}) {
28684
+ let fmt = "HH:mm:ss.SSS";
28685
+ if (includeZone || includeOffset) {
28686
+ if (includeOffsetSpace) fmt += " ";
28687
+ if (includeZone) fmt += "z";
28688
+ else if (includeOffset) fmt += "ZZ";
28689
+ }
28690
+ return toTechFormat(this, fmt, true);
28691
+ }
28692
+ toSQL(opts = {}) {
28693
+ if (!this.isValid) return null;
28694
+ return `${this.toSQLDate()} ${this.toSQLTime(opts)}`;
28695
+ }
28696
+ toString() {
28697
+ return this.isValid ? this.toISO() : INVALID;
28698
+ }
28699
+ [Symbol.for("nodejs.util.inspect.custom")]() {
28700
+ if (this.isValid) return `DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`;
28701
+ return `DateTime { Invalid, reason: ${this.invalidReason} }`;
28702
+ }
28703
+ valueOf() {
28704
+ return this.toMillis();
28705
+ }
28706
+ toMillis() {
28707
+ return this.isValid ? this.ts : NaN;
28708
+ }
28709
+ toSeconds() {
28710
+ return this.isValid ? this.ts / 1000 : NaN;
28711
+ }
28712
+ toUnixInteger() {
28713
+ return this.isValid ? Math.floor(this.ts / 1000) : NaN;
28714
+ }
28715
+ toJSON() {
28716
+ return this.toISO();
28717
+ }
28718
+ toBSON() {
28719
+ return this.toJSDate();
28720
+ }
28721
+ toObject(opts = {}) {
28722
+ if (!this.isValid) return {};
28723
+ const base = {
28724
+ ...this.c
28725
+ };
28726
+ if (opts.includeConfig) {
28727
+ base.outputCalendar = this.outputCalendar;
28728
+ base.numberingSystem = this.loc.numberingSystem;
28729
+ base.locale = this.loc.locale;
28730
+ }
28731
+ return base;
28732
+ }
28733
+ toJSDate() {
28734
+ return new Date(this.isValid ? this.ts : NaN);
28735
+ }
28736
+ diff(otherDateTime, unit = "milliseconds", opts = {}) {
28737
+ if (!this.isValid || !otherDateTime.isValid) return Duration.invalid("created by diffing an invalid DateTime");
28738
+ const durOpts = {
28739
+ locale: this.locale,
28740
+ numberingSystem: this.numberingSystem,
28741
+ ...opts
28742
+ };
28743
+ const units = maybeArray(unit).map(Duration.normalizeUnit), otherIsLater = otherDateTime.valueOf() > this.valueOf(), earlier = otherIsLater ? this : otherDateTime, later = otherIsLater ? otherDateTime : this, diffed = diff(earlier, later, units, durOpts);
28744
+ return otherIsLater ? diffed.negate() : diffed;
28745
+ }
28746
+ diffNow(unit = "milliseconds", opts = {}) {
28747
+ return this.diff(DateTime.now(), unit, opts);
28748
+ }
28749
+ until(otherDateTime) {
28750
+ return this.isValid ? Interval.fromDateTimes(this, otherDateTime) : this;
28751
+ }
28752
+ hasSame(otherDateTime, unit, opts) {
28753
+ if (!this.isValid) return false;
28754
+ const inputMs = otherDateTime.valueOf();
28755
+ const adjustedToZone = this.setZone(otherDateTime.zone, {
28756
+ keepLocalTime: true
28757
+ });
28758
+ return adjustedToZone.startOf(unit, opts) <= inputMs && inputMs <= adjustedToZone.endOf(unit, opts);
28759
+ }
28760
+ equals(other) {
28761
+ return this.isValid && other.isValid && this.valueOf() === other.valueOf() && this.zone.equals(other.zone) && this.loc.equals(other.loc);
28762
+ }
28763
+ toRelative(options = {}) {
28764
+ if (!this.isValid) return null;
28765
+ const base = options.base || DateTime.fromObject({}, {
28766
+ zone: this.zone
28767
+ }), padding = options.padding ? this < base ? -options.padding : options.padding : 0;
28768
+ let units = [
28769
+ "years",
28770
+ "months",
28771
+ "days",
28772
+ "hours",
28773
+ "minutes",
28774
+ "seconds"
28775
+ ];
28776
+ let unit = options.unit;
28777
+ if (Array.isArray(options.unit)) {
28778
+ units = options.unit;
28779
+ unit = void 0;
28780
+ }
28781
+ return diffRelative(base, this.plus(padding), {
28782
+ ...options,
28783
+ numeric: "always",
28784
+ units,
28785
+ unit
28786
+ });
28787
+ }
28788
+ toRelativeCalendar(options = {}) {
28789
+ if (!this.isValid) return null;
28790
+ return diffRelative(options.base || DateTime.fromObject({}, {
28791
+ zone: this.zone
28792
+ }), this, {
28793
+ ...options,
28794
+ numeric: "auto",
28795
+ units: [
28796
+ "years",
28797
+ "months",
28798
+ "days"
28799
+ ],
28800
+ calendary: true
28801
+ });
28802
+ }
28803
+ static min(...dateTimes) {
28804
+ if (!dateTimes.every(DateTime.isDateTime)) throw new InvalidArgumentError("min requires all arguments be DateTimes");
28805
+ return bestBy(dateTimes, (i)=>i.valueOf(), Math.min);
28806
+ }
28807
+ static max(...dateTimes) {
28808
+ if (!dateTimes.every(DateTime.isDateTime)) throw new InvalidArgumentError("max requires all arguments be DateTimes");
28809
+ return bestBy(dateTimes, (i)=>i.valueOf(), Math.max);
28810
+ }
28811
+ static fromFormatExplain(text, fmt, options = {}) {
28812
+ const { locale = null, numberingSystem = null } = options, localeToUse = Locale.fromOpts({
28813
+ locale,
28814
+ numberingSystem,
28815
+ defaultToEN: true
28816
+ });
28817
+ return explainFromTokens(localeToUse, text, fmt);
28818
+ }
28819
+ static fromStringExplain(text, fmt, options = {}) {
28820
+ return DateTime.fromFormatExplain(text, fmt, options);
28821
+ }
28822
+ static buildFormatParser(fmt, options = {}) {
28823
+ const { locale = null, numberingSystem = null } = options, localeToUse = Locale.fromOpts({
28824
+ locale,
28825
+ numberingSystem,
28826
+ defaultToEN: true
28827
+ });
28828
+ return new TokenParser(localeToUse, fmt);
28829
+ }
28830
+ static fromFormatParser(text, formatParser, opts = {}) {
28831
+ if (isUndefined(text) || isUndefined(formatParser)) throw new InvalidArgumentError("fromFormatParser requires an input string and a format parser");
28832
+ const { locale = null, numberingSystem = null } = opts, localeToUse = Locale.fromOpts({
28833
+ locale,
28834
+ numberingSystem,
28835
+ defaultToEN: true
28836
+ });
28837
+ if (!localeToUse.equals(formatParser.locale)) throw new InvalidArgumentError(`fromFormatParser called with a locale of ${localeToUse}, but the format parser was created for ${formatParser.locale}`);
28838
+ const { result, zone, specificOffset, invalidReason } = formatParser.explainFromTokens(text);
28839
+ if (invalidReason) return DateTime.invalid(invalidReason);
28840
+ return parseDataToDateTime(result, zone, opts, `format ${formatParser.format}`, text, specificOffset);
28841
+ }
28842
+ static get DATE_SHORT() {
28843
+ return DATE_SHORT;
28844
+ }
28845
+ static get DATE_MED() {
28846
+ return DATE_MED;
28847
+ }
28848
+ static get DATE_MED_WITH_WEEKDAY() {
28849
+ return DATE_MED_WITH_WEEKDAY;
28850
+ }
28851
+ static get DATE_FULL() {
28852
+ return DATE_FULL;
28853
+ }
28854
+ static get DATE_HUGE() {
28855
+ return DATE_HUGE;
28856
+ }
28857
+ static get TIME_SIMPLE() {
28858
+ return TIME_SIMPLE;
28859
+ }
28860
+ static get TIME_WITH_SECONDS() {
28861
+ return TIME_WITH_SECONDS;
28862
+ }
28863
+ static get TIME_WITH_SHORT_OFFSET() {
28864
+ return TIME_WITH_SHORT_OFFSET;
28865
+ }
28866
+ static get TIME_WITH_LONG_OFFSET() {
28867
+ return TIME_WITH_LONG_OFFSET;
28868
+ }
28869
+ static get TIME_24_SIMPLE() {
28870
+ return TIME_24_SIMPLE;
28871
+ }
28872
+ static get TIME_24_WITH_SECONDS() {
28873
+ return TIME_24_WITH_SECONDS;
28874
+ }
28875
+ static get TIME_24_WITH_SHORT_OFFSET() {
28876
+ return TIME_24_WITH_SHORT_OFFSET;
28877
+ }
28878
+ static get TIME_24_WITH_LONG_OFFSET() {
28879
+ return TIME_24_WITH_LONG_OFFSET;
28880
+ }
28881
+ static get DATETIME_SHORT() {
28882
+ return DATETIME_SHORT;
28883
+ }
28884
+ static get DATETIME_SHORT_WITH_SECONDS() {
28885
+ return DATETIME_SHORT_WITH_SECONDS;
28886
+ }
28887
+ static get DATETIME_MED() {
28888
+ return DATETIME_MED;
28889
+ }
28890
+ static get DATETIME_MED_WITH_SECONDS() {
28891
+ return DATETIME_MED_WITH_SECONDS;
28892
+ }
28893
+ static get DATETIME_MED_WITH_WEEKDAY() {
28894
+ return DATETIME_MED_WITH_WEEKDAY;
28895
+ }
28896
+ static get DATETIME_FULL() {
28897
+ return DATETIME_FULL;
28898
+ }
28899
+ static get DATETIME_FULL_WITH_SECONDS() {
28900
+ return DATETIME_FULL_WITH_SECONDS;
28901
+ }
28902
+ static get DATETIME_HUGE() {
28903
+ return DATETIME_HUGE;
28904
+ }
28905
+ static get DATETIME_HUGE_WITH_SECONDS() {
28906
+ return DATETIME_HUGE_WITH_SECONDS;
28907
+ }
28908
+ }
28909
+ function friendlyDateTime(dateTimeish) {
28910
+ if (DateTime.isDateTime(dateTimeish)) return dateTimeish;
28911
+ if (dateTimeish && dateTimeish.valueOf && isNumber(dateTimeish.valueOf())) return DateTime.fromJSDate(dateTimeish);
28912
+ if (dateTimeish && "object" == typeof dateTimeish) return DateTime.fromObject(dateTimeish);
28913
+ throw new InvalidArgumentError(`Unknown datetime argument: ${dateTimeish}, of type ${typeof dateTimeish}`);
28914
+ }
28915
+ function history_danmaku_fast_forward_main(that, query_history_date) {
28916
+ const qhd = DateTime.fromFormat(query_history_date, 'yyyy-MM-dd', {
28917
+ zone: 'Asia/Shanghai'
28918
+ }).setZone('Asia/Shanghai');
28919
+ if (!qhd.isValid) throw new Error('Invalid query_history_date');
28920
+ const s = qhd.startOf('day');
28921
+ const before = that.dans.filter((d)=>d.ctime < s.toJSDate());
28922
+ if (0 === before.length) return {
28923
+ earliest: null,
28924
+ FastForward: [],
28925
+ skip: [],
28926
+ SpecificDate: qhd.toFormat('yyyy-MM-dd')
28927
+ };
28928
+ const earliestCtime = before.toSorted((a, b)=>a.ctime.getTime() - b.ctime.getTime())[0].ctime;
28929
+ const earliestDate = DateTime.fromJSDate(earliestCtime).setZone('Asia/Shanghai').startOf('day');
28930
+ const datesWithDanmaku = new Set();
28931
+ for (const dan of before){
28932
+ const dateStr = DateTime.fromJSDate(dan.ctime).setZone('Asia/Shanghai').toFormat('yyyy-MM-dd');
28933
+ datesWithDanmaku.add(dateStr);
28934
+ }
28935
+ let current = earliestDate;
28936
+ const allDates = [];
28937
+ while(current < s){
28938
+ allDates.push(current.toFormat('yyyy-MM-dd'));
28939
+ current = current.plus({
28940
+ days: 1
28941
+ });
28942
+ }
28943
+ const FastForward = allDates.filter((d)=>datesWithDanmaku.has(d));
28944
+ const skip = allDates.filter((d)=>!datesWithDanmaku.has(d));
28945
+ return {
28946
+ earliest: earliestDate.toFormat('yyyy-MM-dd'),
28947
+ FastForward,
28948
+ skip,
28949
+ SpecificDate: qhd.toFormat('yyyy-MM-dd')
28950
+ };
28951
+ }
28952
+ function bili_history_fast_forward(query_history_date) {
28953
+ return (that)=>history_danmaku_fast_forward_main(that, query_history_date);
28954
+ }
24344
28955
  },
24345
28956
  "./src/plugins/stats/index.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
24346
28957
  "use strict";
@@ -25038,10 +29649,10 @@ and limitations under the License.
25038
29649
  "use strict";
25039
29650
  __webpack_require__.r(__webpack_exports__);
25040
29651
  __webpack_require__.d(__webpack_exports__, {
25041
- bili_dedupe: ()=>_bili_dedupe__rspack_import_0,
29652
+ bili: ()=>_bili__rspack_import_0,
25042
29653
  stats: ()=>_stats__rspack_import_1
25043
29654
  });
25044
- var _bili_dedupe__rspack_import_0 = __webpack_require__("./src/plugins/bili-dedupe/index.ts");
29655
+ var _bili__rspack_import_0 = __webpack_require__("./src/plugins/bili/index.ts");
25045
29656
  var _stats__rspack_import_1 = __webpack_require__("./src/plugins/stats/index.ts");
25046
29657
  })();
25047
29658
  return __webpack_exports__;