@dan-uni/dan-any 1.2.2 → 1.2.7

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