forked from swc-project/swc
-
Notifications
You must be signed in to change notification settings - Fork 4
/
moment.js
1851 lines (1851 loc) · 111 KB
/
moment.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
!function(global, factory) {
'object' == typeof exports && 'undefined' != typeof module ? module.exports = factory() : 'function' == typeof define && define.amd ? define(factory) : global.moment = factory();
}(this, function() {
'use strict';
function hooks() {
return hookCallback.apply(null, arguments);
}
function isArray(input) {
return input instanceof Array || '[object Array]' === Object.prototype.toString.call(input);
}
function isObject(input) {
return null != input && '[object Object]' === Object.prototype.toString.call(input);
}
function hasOwnProp(a, b) {
return Object.prototype.hasOwnProperty.call(a, b);
}
function isObjectEmpty(obj) {
var k;
if (Object.getOwnPropertyNames) return 0 === Object.getOwnPropertyNames(obj).length;
for(k in obj)if (hasOwnProp(obj, k)) return !1;
return !0;
}
function isUndefined(input) {
return void 0 === input;
}
function isNumber(input) {
return 'number' == typeof input || '[object Number]' === Object.prototype.toString.call(input);
}
function isDate(input) {
return input instanceof Date || '[object Date]' === Object.prototype.toString.call(input);
}
function map(arr, fn) {
var i, res = [];
for(i = 0; i < arr.length; ++i)res.push(fn(arr[i], i));
return res;
}
function extend(a, b) {
for(var i in b)hasOwnProp(b, i) && (a[i] = b[i]);
return hasOwnProp(b, 'toString') && (a.toString = b.toString), hasOwnProp(b, 'valueOf') && (a.valueOf = b.valueOf), a;
}
function createUTC(input, format, locale, strict) {
return createLocalOrUTC(input, format, locale, strict, !0).utc();
}
function getParsingFlags(m) {
return null == m._pf && (m._pf = {
empty: !1,
unusedTokens: [],
unusedInput: [],
overflow: -2,
charsLeftOver: 0,
nullInput: !1,
invalidEra: null,
invalidMonth: null,
invalidFormat: !1,
userInvalidated: !1,
iso: !1,
parsedDateParts: [],
era: null,
meridiem: null,
rfc2822: !1,
weekdayMismatch: !1
}), m._pf;
}
function isValid(m) {
if (null == m._isValid) {
var flags = getParsingFlags(m), parsedParts = some.call(flags.parsedDateParts, function(i) {
return null != i;
}), isNowValid = !isNaN(m._d.getTime()) && flags.overflow < 0 && !flags.empty && !flags.invalidEra && !flags.invalidMonth && !flags.invalidWeekday && !flags.weekdayMismatch && !flags.nullInput && !flags.invalidFormat && !flags.userInvalidated && (!flags.meridiem || flags.meridiem && parsedParts);
if (m._strict && (isNowValid = isNowValid && 0 === flags.charsLeftOver && 0 === flags.unusedTokens.length && void 0 === flags.bigHour), null != Object.isFrozen && Object.isFrozen(m)) return isNowValid;
m._isValid = isNowValid;
}
return m._isValid;
}
function createInvalid(flags) {
var m = createUTC(NaN);
return null != flags ? extend(getParsingFlags(m), flags) : getParsingFlags(m).userInvalidated = !0, m;
}
some = Array.prototype.some ? Array.prototype.some : function(fun) {
var i, t = Object(this), len = t.length >>> 0;
for(i = 0; i < len; i++)if (i in t && fun.call(this, t[i], i, t)) return !0;
return !1;
};
var token, getSetMillisecond, momentProperties = hooks.momentProperties = [], updateInProgress = !1;
function copyConfig(to, from) {
var i, prop, val;
if (isUndefined(from._isAMomentObject) || (to._isAMomentObject = from._isAMomentObject), isUndefined(from._i) || (to._i = from._i), isUndefined(from._f) || (to._f = from._f), isUndefined(from._l) || (to._l = from._l), isUndefined(from._strict) || (to._strict = from._strict), isUndefined(from._tzm) || (to._tzm = from._tzm), isUndefined(from._isUTC) || (to._isUTC = from._isUTC), isUndefined(from._offset) || (to._offset = from._offset), isUndefined(from._pf) || (to._pf = getParsingFlags(from)), isUndefined(from._locale) || (to._locale = from._locale), momentProperties.length > 0) for(i = 0; i < momentProperties.length; i++)isUndefined(val = from[prop = momentProperties[i]]) || (to[prop] = val);
return to;
}
function Moment(config) {
copyConfig(this, config), this._d = new Date(null != config._d ? config._d.getTime() : NaN), this.isValid() || (this._d = new Date(NaN)), !1 === updateInProgress && (updateInProgress = !0, hooks.updateOffset(this), updateInProgress = !1);
}
function isMoment(obj) {
return obj instanceof Moment || null != obj && null != obj._isAMomentObject;
}
function warn(msg) {
!1 === hooks.suppressDeprecationWarnings && 'undefined' != typeof console && console.warn && console.warn('Deprecation warning: ' + msg);
}
function deprecate(msg, fn) {
var firstTime = !0;
return extend(function() {
if (null != hooks.deprecationHandler && hooks.deprecationHandler(null, msg), firstTime) {
var arg, i, key, args = [];
for(i = 0; i < arguments.length; i++){
if (arg = '', 'object' == typeof arguments[i]) {
for(key in arg += '\n[' + i + '] ', arguments[0])hasOwnProp(arguments[0], key) && (arg += key + ': ' + arguments[0][key] + ', ');
arg = arg.slice(0, -2);
} else arg = arguments[i];
args.push(arg);
}
warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + Error().stack), firstTime = !1;
}
return fn.apply(this, arguments);
}, fn);
}
var deprecations = {};
function deprecateSimple(name, msg) {
null != hooks.deprecationHandler && hooks.deprecationHandler(name, msg), deprecations[name] || (warn(msg), deprecations[name] = !0);
}
function isFunction(input) {
return 'undefined' != typeof Function && input instanceof Function || '[object Function]' === Object.prototype.toString.call(input);
}
function mergeConfigs(parentConfig, childConfig) {
var prop, res = extend({}, parentConfig);
for(prop in childConfig)hasOwnProp(childConfig, prop) && (isObject(parentConfig[prop]) && isObject(childConfig[prop]) ? (res[prop] = {}, extend(res[prop], parentConfig[prop]), extend(res[prop], childConfig[prop])) : null != childConfig[prop] ? res[prop] = childConfig[prop] : delete res[prop]);
for(prop in parentConfig)hasOwnProp(parentConfig, prop) && !hasOwnProp(childConfig, prop) && isObject(parentConfig[prop]) && (res[prop] = extend({}, res[prop]));
return res;
}
function Locale(config) {
null != config && this.set(config);
}
function zeroFill(number, targetLength, forceSign) {
var absNumber = '' + Math.abs(number), zerosToFill = targetLength - absNumber.length;
return (number >= 0 ? forceSign ? '+' : '' : '-') + Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber;
}
hooks.suppressDeprecationWarnings = !1, hooks.deprecationHandler = null, keys = Object.keys ? Object.keys : function(obj) {
var i, res = [];
for(i in obj)hasOwnProp(obj, i) && res.push(i);
return res;
};
var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g, localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g, formatFunctions = {}, formatTokenFunctions = {};
function addFormatToken(token, padded, ordinal, callback) {
var func = callback;
'string' == typeof callback && (func = function() {
return this[callback]();
}), token && (formatTokenFunctions[token] = func), padded && (formatTokenFunctions[padded[0]] = function() {
return zeroFill(func.apply(this, arguments), padded[1], padded[2]);
}), ordinal && (formatTokenFunctions[ordinal] = function() {
return this.localeData().ordinal(func.apply(this, arguments), token);
});
}
function formatMoment(m, format) {
return m.isValid() ? (formatFunctions[format = expandFormat(format, m.localeData())] = formatFunctions[format] || function(format) {
var input, i, length, array = format.match(formattingTokens);
for(i = 0, length = array.length; i < length; i++)formatTokenFunctions[array[i]] ? array[i] = formatTokenFunctions[array[i]] : array[i] = (input = array[i]).match(/\[[\s\S]/) ? input.replace(/^\[|\]$/g, '') : input.replace(/\\/g, '');
return function(mom) {
var i, output = '';
for(i = 0; i < length; i++)output += isFunction(array[i]) ? array[i].call(mom, format) : array[i];
return output;
};
}(format), formatFunctions[format](m)) : m.localeData().invalidDate();
}
function expandFormat(format, locale) {
var i = 5;
function replaceLongDateFormatTokens(input) {
return locale.longDateFormat(input) || input;
}
for(localFormattingTokens.lastIndex = 0; i >= 0 && localFormattingTokens.test(format);)format = format.replace(localFormattingTokens, replaceLongDateFormatTokens), localFormattingTokens.lastIndex = 0, i -= 1;
return format;
}
var aliases = {};
function addUnitAlias(unit, shorthand) {
var lowerCase = unit.toLowerCase();
aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit;
}
function normalizeUnits(units) {
return 'string' == typeof units ? aliases[units] || aliases[units.toLowerCase()] : void 0;
}
function normalizeObjectUnits(inputObject) {
var normalizedProp, prop, normalizedInput = {};
for(prop in inputObject)hasOwnProp(inputObject, prop) && (normalizedProp = normalizeUnits(prop)) && (normalizedInput[normalizedProp] = inputObject[prop]);
return normalizedInput;
}
var priorities = {};
function isLeapYear(year) {
return year % 4 == 0 && year % 100 != 0 || year % 400 == 0;
}
function absFloor(number) {
return number < 0 ? Math.ceil(number) || 0 : Math.floor(number);
}
function toInt(argumentForCoercion) {
var coercedNumber = +argumentForCoercion, value = 0;
return 0 !== coercedNumber && isFinite(coercedNumber) && (value = absFloor(coercedNumber)), value;
}
function makeGetSet(unit, keepTime) {
return function(value) {
return null != value ? (set$1(this, unit, value), hooks.updateOffset(this, keepTime), this) : get(this, unit);
};
}
function get(mom, unit) {
return mom.isValid() ? mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]() : NaN;
}
function set$1(mom, unit, value) {
mom.isValid() && !isNaN(value) && ('FullYear' === unit && isLeapYear(mom.year()) && 1 === mom.month() && 29 === mom.date() ? (value = toInt(value), mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value, mom.month(), daysInMonth(value, mom.month()))) : mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value));
}
var hookCallback, some, keys, regexes, match1 = /\d/, match2 = /\d\d/, match3 = /\d{3}/, match4 = /\d{4}/, match6 = /[+-]?\d{6}/, match1to2 = /\d\d?/, match3to4 = /\d\d\d\d?/, match5to6 = /\d\d\d\d\d\d?/, match1to3 = /\d{1,3}/, match1to4 = /\d{1,4}/, match1to6 = /[+-]?\d{1,6}/, matchUnsigned = /\d+/, matchSigned = /[+-]?\d+/, matchOffset = /Z|[+-]\d\d:?\d\d/gi, matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi, matchWord = /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i;
function addRegexToken(token, regex, strictRegex) {
regexes[token] = isFunction(regex) ? regex : function(isStrict, localeData) {
return isStrict && strictRegex ? strictRegex : regex;
};
}
function regexEscape(s) {
return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
}
regexes = {};
var tokens = {};
function addParseToken(token, callback) {
var i, func = callback;
for('string' == typeof token && (token = [
token
]), isNumber(callback) && (func = function(input, array) {
array[callback] = toInt(input);
}), i = 0; i < token.length; i++)tokens[token[i]] = func;
}
function addWeekParseToken(token, callback) {
addParseToken(token, function(input, array, config, token) {
config._w = config._w || {}, callback(input, config._w, config, token);
});
}
function daysInMonth(year, month) {
if (isNaN(year) || isNaN(month)) return NaN;
var modMonth = (month % 12 + 12) % 12;
return year += (month - modMonth) / 12, 1 === modMonth ? isLeapYear(year) ? 29 : 28 : 31 - modMonth % 7 % 2;
}
indexOf = Array.prototype.indexOf ? Array.prototype.indexOf : function(o) {
var i;
for(i = 0; i < this.length; ++i)if (this[i] === o) return i;
return -1;
}, addFormatToken('M', [
'MM',
2
], 'Mo', function() {
return this.month() + 1;
}), addFormatToken('MMM', 0, 0, function(format) {
return this.localeData().monthsShort(this, format);
}), addFormatToken('MMMM', 0, 0, function(format) {
return this.localeData().months(this, format);
}), addUnitAlias('month', 'M'), priorities.month = 8, addRegexToken('M', match1to2), addRegexToken('MM', match1to2, match2), addRegexToken('MMM', function(isStrict, locale) {
return locale.monthsShortRegex(isStrict);
}), addRegexToken('MMMM', function(isStrict, locale) {
return locale.monthsRegex(isStrict);
}), addParseToken([
'M',
'MM'
], function(input, array) {
array[1] = toInt(input) - 1;
}), addParseToken([
'MMM',
'MMMM'
], function(input, array, config, token) {
var month = config._locale.monthsParse(input, token, config._strict);
null != month ? array[1] = month : getParsingFlags(config).invalidMonth = input;
});
var defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/;
function handleStrictParse(monthName, format, strict) {
var i, ii, mom, llc = monthName.toLocaleLowerCase();
if (!this._monthsParse) for(i = 0, this._monthsParse = [], this._longMonthsParse = [], this._shortMonthsParse = []; i < 12; ++i)mom = createUTC([
2000,
i
]), this._shortMonthsParse[i] = this.monthsShort(mom, '').toLocaleLowerCase(), this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase();
return strict ? 'MMM' === format ? -1 !== (ii = indexOf.call(this._shortMonthsParse, llc)) ? ii : null : -1 !== (ii = indexOf.call(this._longMonthsParse, llc)) ? ii : null : 'MMM' === format ? -1 !== (ii = indexOf.call(this._shortMonthsParse, llc)) ? ii : -1 !== (ii = indexOf.call(this._longMonthsParse, llc)) ? ii : null : -1 !== (ii = indexOf.call(this._longMonthsParse, llc)) ? ii : -1 !== (ii = indexOf.call(this._shortMonthsParse, llc)) ? ii : null;
}
function setMonth(mom, value) {
var dayOfMonth;
if (!mom.isValid()) return mom;
if ('string' == typeof value) {
if (/^\d+$/.test(value)) value = toInt(value);
else if (!isNumber(value = mom.localeData().monthsParse(value))) return mom;
}
return dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value)), mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth), mom;
}
function getSetMonth(value) {
return null != value ? (setMonth(this, value), hooks.updateOffset(this, !0), this) : get(this, 'Month');
}
function computeMonthsParse() {
function cmpLenRev(a, b) {
return b.length - a.length;
}
var i, mom, shortPieces = [], longPieces = [], mixedPieces = [];
for(i = 0; i < 12; i++)mom = createUTC([
2000,
i
]), shortPieces.push(this.monthsShort(mom, '')), longPieces.push(this.months(mom, '')), mixedPieces.push(this.months(mom, '')), mixedPieces.push(this.monthsShort(mom, ''));
for(shortPieces.sort(cmpLenRev), longPieces.sort(cmpLenRev), mixedPieces.sort(cmpLenRev), i = 0; i < 12; i++)shortPieces[i] = regexEscape(shortPieces[i]), longPieces[i] = regexEscape(longPieces[i]);
for(i = 0; i < 24; i++)mixedPieces[i] = regexEscape(mixedPieces[i]);
this._monthsRegex = RegExp('^(' + mixedPieces.join('|') + ')', 'i'), this._monthsShortRegex = this._monthsRegex, this._monthsStrictRegex = RegExp('^(' + longPieces.join('|') + ')', 'i'), this._monthsShortStrictRegex = RegExp('^(' + shortPieces.join('|') + ')', 'i');
}
function daysInYear(year) {
return isLeapYear(year) ? 366 : 365;
}
addFormatToken('Y', 0, 0, function() {
var y = this.year();
return y <= 9999 ? zeroFill(y, 4) : '+' + y;
}), addFormatToken(0, [
'YY',
2
], 0, function() {
return this.year() % 100;
}), addFormatToken(0, [
'YYYY',
4
], 0, 'year'), addFormatToken(0, [
'YYYYY',
5
], 0, 'year'), addFormatToken(0, [
'YYYYYY',
6,
!0
], 0, 'year'), addUnitAlias('year', 'y'), priorities.year = 1, addRegexToken('Y', matchSigned), addRegexToken('YY', match1to2, match2), addRegexToken('YYYY', match1to4, match4), addRegexToken('YYYYY', match1to6, match6), addRegexToken('YYYYYY', match1to6, match6), addParseToken([
'YYYYY',
'YYYYYY'
], 0), addParseToken('YYYY', function(input, array) {
array[0] = 2 === input.length ? hooks.parseTwoDigitYear(input) : toInt(input);
}), addParseToken('YY', function(input, array) {
array[0] = hooks.parseTwoDigitYear(input);
}), addParseToken('Y', function(input, array) {
array[0] = parseInt(input, 10);
}), hooks.parseTwoDigitYear = function(input) {
return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);
};
var getSetYear = makeGetSet('FullYear', !0);
function createDate(y, m, d, h, M, s, ms) {
var date;
return y < 100 && y >= 0 ? isFinite((date = new Date(y + 400, m, d, h, M, s, ms)).getFullYear()) && date.setFullYear(y) : date = new Date(y, m, d, h, M, s, ms), date;
}
function createUTCDate(y) {
var date, args;
return y < 100 && y >= 0 ? (args = Array.prototype.slice.call(arguments), args[0] = y + 400, isFinite((date = new Date(Date.UTC.apply(null, args))).getUTCFullYear()) && date.setUTCFullYear(y)) : date = new Date(Date.UTC.apply(null, arguments)), date;
}
function firstWeekOffset(year, dow, doy) {
var fwd = 7 + dow - doy;
return -((7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7) + fwd - 1;
}
function dayOfYearFromWeeks(year, week, weekday, dow, doy) {
var resYear, resDayOfYear, weekOffset = firstWeekOffset(year, dow, doy), dayOfYear = 1 + 7 * (week - 1) + (7 + weekday - dow) % 7 + weekOffset;
return dayOfYear <= 0 ? resDayOfYear = daysInYear(resYear = year - 1) + dayOfYear : dayOfYear > daysInYear(year) ? (resYear = year + 1, resDayOfYear = dayOfYear - daysInYear(year)) : (resYear = year, resDayOfYear = dayOfYear), {
year: resYear,
dayOfYear: resDayOfYear
};
}
function weekOfYear(mom, dow, doy) {
var resWeek, resYear, weekOffset = firstWeekOffset(mom.year(), dow, doy), week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1;
return week < 1 ? resWeek = week + weeksInYear(resYear = mom.year() - 1, dow, doy) : week > weeksInYear(mom.year(), dow, doy) ? (resWeek = week - weeksInYear(mom.year(), dow, doy), resYear = mom.year() + 1) : (resYear = mom.year(), resWeek = week), {
week: resWeek,
year: resYear
};
}
function weeksInYear(year, dow, doy) {
var weekOffset = firstWeekOffset(year, dow, doy), weekOffsetNext = firstWeekOffset(year + 1, dow, doy);
return (daysInYear(year) - weekOffset + weekOffsetNext) / 7;
}
function shiftWeekdays(ws, n) {
return ws.slice(n, 7).concat(ws.slice(0, n));
}
addFormatToken('w', [
'ww',
2
], 'wo', 'week'), addFormatToken('W', [
'WW',
2
], 'Wo', 'isoWeek'), addUnitAlias('week', 'w'), addUnitAlias('isoWeek', 'W'), priorities.week = 5, priorities.isoWeek = 5, addRegexToken('w', match1to2), addRegexToken('ww', match1to2, match2), addRegexToken('W', match1to2), addRegexToken('WW', match1to2, match2), addWeekParseToken([
'w',
'ww',
'W',
'WW'
], function(input, week, config, token) {
week[token.substr(0, 1)] = toInt(input);
}), addFormatToken('d', 0, 'do', 'day'), addFormatToken('dd', 0, 0, function(format) {
return this.localeData().weekdaysMin(this, format);
}), addFormatToken('ddd', 0, 0, function(format) {
return this.localeData().weekdaysShort(this, format);
}), addFormatToken('dddd', 0, 0, function(format) {
return this.localeData().weekdays(this, format);
}), addFormatToken('e', 0, 0, 'weekday'), addFormatToken('E', 0, 0, 'isoWeekday'), addUnitAlias('day', 'd'), addUnitAlias('weekday', 'e'), addUnitAlias('isoWeekday', 'E'), priorities.day = 11, priorities.weekday = 11, priorities.isoWeekday = 11, addRegexToken('d', match1to2), addRegexToken('e', match1to2), addRegexToken('E', match1to2), addRegexToken('dd', function(isStrict, locale) {
return locale.weekdaysMinRegex(isStrict);
}), addRegexToken('ddd', function(isStrict, locale) {
return locale.weekdaysShortRegex(isStrict);
}), addRegexToken('dddd', function(isStrict, locale) {
return locale.weekdaysRegex(isStrict);
}), addWeekParseToken([
'dd',
'ddd',
'dddd'
], function(input, week, config, token) {
var weekday = config._locale.weekdaysParse(input, token, config._strict);
null != weekday ? week.d = weekday : getParsingFlags(config).invalidWeekday = input;
}), addWeekParseToken([
'd',
'e',
'E'
], function(input, week, config, token) {
week[token] = toInt(input);
});
var defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_');
function handleStrictParse$1(weekdayName, format, strict) {
var i, ii, mom, llc = weekdayName.toLocaleLowerCase();
if (!this._weekdaysParse) for(i = 0, this._weekdaysParse = [], this._shortWeekdaysParse = [], this._minWeekdaysParse = []; i < 7; ++i)mom = createUTC([
2000,
1
]).day(i), this._minWeekdaysParse[i] = this.weekdaysMin(mom, '').toLocaleLowerCase(), this._shortWeekdaysParse[i] = this.weekdaysShort(mom, '').toLocaleLowerCase(), this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase();
return strict ? 'dddd' === format ? -1 !== (ii = indexOf.call(this._weekdaysParse, llc)) ? ii : null : 'ddd' === format ? -1 !== (ii = indexOf.call(this._shortWeekdaysParse, llc)) ? ii : null : -1 !== (ii = indexOf.call(this._minWeekdaysParse, llc)) ? ii : null : 'dddd' === format ? -1 !== (ii = indexOf.call(this._weekdaysParse, llc)) || -1 !== (ii = indexOf.call(this._shortWeekdaysParse, llc)) ? ii : -1 !== (ii = indexOf.call(this._minWeekdaysParse, llc)) ? ii : null : 'ddd' === format ? -1 !== (ii = indexOf.call(this._shortWeekdaysParse, llc)) || -1 !== (ii = indexOf.call(this._weekdaysParse, llc)) ? ii : -1 !== (ii = indexOf.call(this._minWeekdaysParse, llc)) ? ii : null : -1 !== (ii = indexOf.call(this._minWeekdaysParse, llc)) || -1 !== (ii = indexOf.call(this._weekdaysParse, llc)) ? ii : -1 !== (ii = indexOf.call(this._shortWeekdaysParse, llc)) ? ii : null;
}
function computeWeekdaysParse() {
function cmpLenRev(a, b) {
return b.length - a.length;
}
var i, mom, minp, shortp, longp, minPieces = [], shortPieces = [], longPieces = [], mixedPieces = [];
for(i = 0; i < 7; i++)mom = createUTC([
2000,
1
]).day(i), minp = regexEscape(this.weekdaysMin(mom, '')), shortp = regexEscape(this.weekdaysShort(mom, '')), longp = regexEscape(this.weekdays(mom, '')), minPieces.push(minp), shortPieces.push(shortp), longPieces.push(longp), mixedPieces.push(minp), mixedPieces.push(shortp), mixedPieces.push(longp);
minPieces.sort(cmpLenRev), shortPieces.sort(cmpLenRev), longPieces.sort(cmpLenRev), mixedPieces.sort(cmpLenRev), this._weekdaysRegex = RegExp('^(' + mixedPieces.join('|') + ')', 'i'), this._weekdaysShortRegex = this._weekdaysRegex, this._weekdaysMinRegex = this._weekdaysRegex, this._weekdaysStrictRegex = RegExp('^(' + longPieces.join('|') + ')', 'i'), this._weekdaysShortStrictRegex = RegExp('^(' + shortPieces.join('|') + ')', 'i'), this._weekdaysMinStrictRegex = RegExp('^(' + minPieces.join('|') + ')', 'i');
}
function hFormat() {
return this.hours() % 12 || 12;
}
function meridiem(token, lowercase) {
addFormatToken(token, 0, 0, function() {
return this.localeData().meridiem(this.hours(), this.minutes(), lowercase);
});
}
function matchMeridiem(isStrict, locale) {
return locale._meridiemParse;
}
addFormatToken('H', [
'HH',
2
], 0, 'hour'), addFormatToken('h', [
'hh',
2
], 0, hFormat), addFormatToken('k', [
'kk',
2
], 0, function() {
return this.hours() || 24;
}), addFormatToken('hmm', 0, 0, function() {
return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2);
}), addFormatToken('hmmss', 0, 0, function() {
return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2) + zeroFill(this.seconds(), 2);
}), addFormatToken('Hmm', 0, 0, function() {
return '' + this.hours() + zeroFill(this.minutes(), 2);
}), addFormatToken('Hmmss', 0, 0, function() {
return '' + this.hours() + zeroFill(this.minutes(), 2) + zeroFill(this.seconds(), 2);
}), meridiem('a', !0), meridiem('A', !1), addUnitAlias('hour', 'h'), priorities.hour = 13, addRegexToken('a', matchMeridiem), addRegexToken('A', matchMeridiem), addRegexToken('H', match1to2), addRegexToken('h', match1to2), addRegexToken('k', match1to2), addRegexToken('HH', match1to2, match2), addRegexToken('hh', match1to2, match2), addRegexToken('kk', match1to2, match2), addRegexToken('hmm', match3to4), addRegexToken('hmmss', match5to6), addRegexToken('Hmm', match3to4), addRegexToken('Hmmss', match5to6), addParseToken([
'H',
'HH'
], 3), addParseToken([
'k',
'kk'
], function(input, array, config) {
var kInput = toInt(input);
array[3] = 24 === kInput ? 0 : kInput;
}), addParseToken([
'a',
'A'
], function(input, array, config) {
config._isPm = config._locale.isPM(input), config._meridiem = input;
}), addParseToken([
'h',
'hh'
], function(input, array, config) {
array[3] = toInt(input), getParsingFlags(config).bigHour = !0;
}), addParseToken('hmm', function(input, array, config) {
var pos = input.length - 2;
array[3] = toInt(input.substr(0, pos)), array[4] = toInt(input.substr(pos)), getParsingFlags(config).bigHour = !0;
}), addParseToken('hmmss', function(input, array, config) {
var pos1 = input.length - 4, pos2 = input.length - 2;
array[3] = toInt(input.substr(0, pos1)), array[4] = toInt(input.substr(pos1, 2)), array[5] = toInt(input.substr(pos2)), getParsingFlags(config).bigHour = !0;
}), addParseToken('Hmm', function(input, array, config) {
var pos = input.length - 2;
array[3] = toInt(input.substr(0, pos)), array[4] = toInt(input.substr(pos));
}), addParseToken('Hmmss', function(input, array, config) {
var pos1 = input.length - 4, pos2 = input.length - 2;
array[3] = toInt(input.substr(0, pos1)), array[4] = toInt(input.substr(pos1, 2)), array[5] = toInt(input.substr(pos2));
});
var indexOf, globalLocale, getSetHour = makeGetSet('Hours', !0), baseConfig = {
calendar: {
sameDay: '[Today at] LT',
nextDay: '[Tomorrow at] LT',
nextWeek: 'dddd [at] LT',
lastDay: '[Yesterday at] LT',
lastWeek: '[Last] dddd [at] LT',
sameElse: 'L'
},
longDateFormat: {
LTS: 'h:mm:ss A',
LT: 'h:mm A',
L: 'MM/DD/YYYY',
LL: 'MMMM D, YYYY',
LLL: 'MMMM D, YYYY h:mm A',
LLLL: 'dddd, MMMM D, YYYY h:mm A'
},
invalidDate: 'Invalid date',
ordinal: '%d',
dayOfMonthOrdinalParse: /\d{1,2}/,
relativeTime: {
future: 'in %s',
past: '%s ago',
s: 'a few seconds',
ss: '%d seconds',
m: 'a minute',
mm: '%d minutes',
h: 'an hour',
hh: '%d hours',
d: 'a day',
dd: '%d days',
w: 'a week',
ww: '%d weeks',
M: 'a month',
MM: '%d months',
y: 'a year',
yy: '%d years'
},
months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'),
monthsShort: defaultLocaleMonthsShort,
week: {
dow: 0,
doy: 6
},
weekdays: 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'),
weekdaysMin: 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),
weekdaysShort: defaultLocaleWeekdaysShort,
meridiemParse: /[ap]\.?m?\.?/i
}, locales = {}, localeFamilies = {};
function normalizeLocale(key) {
return key ? key.toLowerCase().replace('_', '-') : key;
}
function loadLocale(name) {
var oldLocale = null;
if (void 0 === locales[name] && 'undefined' != typeof module && module && module.exports) try {
oldLocale = globalLocale._abbr, require('./locale/' + name), getSetGlobalLocale(oldLocale);
} catch (e) {
locales[name] = null;
}
return locales[name];
}
function getSetGlobalLocale(key, values) {
var data;
return key && ((data = isUndefined(values) ? getLocale(key) : defineLocale(key, values)) ? globalLocale = data : 'undefined' != typeof console && console.warn && console.warn('Locale ' + key + ' not found. Did you forget to load it?')), globalLocale._abbr;
}
function defineLocale(name, config) {
if (null === config) return delete locales[name], null;
var locale, parentConfig = baseConfig;
if (config.abbr = name, null != locales[name]) deprecateSimple('defineLocaleOverride', "use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."), parentConfig = locales[name]._config;
else if (null != config.parentLocale) {
if (null != locales[config.parentLocale]) parentConfig = locales[config.parentLocale]._config;
else {
if (null == (locale = loadLocale(config.parentLocale))) return localeFamilies[config.parentLocale] || (localeFamilies[config.parentLocale] = []), localeFamilies[config.parentLocale].push({
name: name,
config: config
}), null;
parentConfig = locale._config;
}
}
return locales[name] = new Locale(mergeConfigs(parentConfig, config)), localeFamilies[name] && localeFamilies[name].forEach(function(x) {
defineLocale(x.name, x.config);
}), getSetGlobalLocale(name), locales[name];
}
function getLocale(key) {
var locale;
if (key && key._locale && key._locale._abbr && (key = key._locale._abbr), !key) return globalLocale;
if (!isArray(key)) {
if (locale = loadLocale(key)) return locale;
key = [
key
];
}
return function(names) {
for(var j, next, locale, split, i = 0; i < names.length;){
for(j = (split = normalizeLocale(names[i]).split('-')).length, next = (next = normalizeLocale(names[i + 1])) ? next.split('-') : null; j > 0;){
if (locale = loadLocale(split.slice(0, j).join('-'))) return locale;
if (next && next.length >= j && function(arr1, arr2) {
var i, minl = Math.min(arr1.length, arr2.length);
for(i = 0; i < minl; i += 1)if (arr1[i] !== arr2[i]) return i;
return minl;
}(split, next) >= j - 1) break;
j--;
}
i++;
}
return globalLocale;
}(key);
}
function checkOverflow(m) {
var overflow, a = m._a;
return a && -2 === getParsingFlags(m).overflow && (overflow = a[1] < 0 || a[1] > 11 ? 1 : a[2] < 1 || a[2] > daysInMonth(a[0], a[1]) ? 2 : a[3] < 0 || a[3] > 24 || 24 === a[3] && (0 !== a[4] || 0 !== a[5] || 0 !== a[6]) ? 3 : a[4] < 0 || a[4] > 59 ? 4 : a[5] < 0 || a[5] > 59 ? 5 : a[6] < 0 || a[6] > 999 ? 6 : -1, getParsingFlags(m)._overflowDayOfYear && (overflow < 0 || overflow > 2) && (overflow = 2), getParsingFlags(m)._overflowWeeks && -1 === overflow && (overflow = 7), getParsingFlags(m)._overflowWeekday && -1 === overflow && (overflow = 8), getParsingFlags(m).overflow = overflow), m;
}
var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/, basicIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/, tzRegex = /Z|[+-]\d\d(?::?\d\d)?/, isoDates = [
[
'YYYYYY-MM-DD',
/[+-]\d{6}-\d\d-\d\d/
],
[
'YYYY-MM-DD',
/\d{4}-\d\d-\d\d/
],
[
'GGGG-[W]WW-E',
/\d{4}-W\d\d-\d/
],
[
'GGGG-[W]WW',
/\d{4}-W\d\d/,
!1
],
[
'YYYY-DDD',
/\d{4}-\d{3}/
],
[
'YYYY-MM',
/\d{4}-\d\d/,
!1
],
[
'YYYYYYMMDD',
/[+-]\d{10}/
],
[
'YYYYMMDD',
/\d{8}/
],
[
'GGGG[W]WWE',
/\d{4}W\d{3}/
],
[
'GGGG[W]WW',
/\d{4}W\d{2}/,
!1
],
[
'YYYYDDD',
/\d{7}/
],
[
'YYYYMM',
/\d{6}/,
!1
],
[
'YYYY',
/\d{4}/,
!1
]
], isoTimes = [
[
'HH:mm:ss.SSSS',
/\d\d:\d\d:\d\d\.\d+/
],
[
'HH:mm:ss,SSSS',
/\d\d:\d\d:\d\d,\d+/
],
[
'HH:mm:ss',
/\d\d:\d\d:\d\d/
],
[
'HH:mm',
/\d\d:\d\d/
],
[
'HHmmss.SSSS',
/\d\d\d\d\d\d\.\d+/
],
[
'HHmmss,SSSS',
/\d\d\d\d\d\d,\d+/
],
[
'HHmmss',
/\d\d\d\d\d\d/
],
[
'HHmm',
/\d\d\d\d/
],
[
'HH',
/\d\d/
]
], aspNetJsonRegex = /^\/?Date\((-?\d+)/i, 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{4}))$/, obsOffsets = {
UT: 0,
GMT: 0,
EDT: -240,
EST: -300,
CDT: -300,
CST: -360,
MDT: -360,
MST: -420,
PDT: -420,
PST: -480
};
function configFromISO(config) {
var i, l, allowTime, dateFormat, timeFormat, tzFormat, string = config._i, match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string);
if (match) {
for(i = 0, getParsingFlags(config).iso = !0, l = isoDates.length; i < l; i++)if (isoDates[i][1].exec(match[1])) {
dateFormat = isoDates[i][0], allowTime = !1 !== isoDates[i][2];
break;
}
if (null == dateFormat) {
config._isValid = !1;
return;
}
if (match[3]) {
for(i = 0, l = isoTimes.length; i < l; i++)if (isoTimes[i][1].exec(match[3])) {
timeFormat = (match[2] || ' ') + isoTimes[i][0];
break;
}
if (null == timeFormat) {
config._isValid = !1;
return;
}
}
if (!allowTime && null != timeFormat) {
config._isValid = !1;
return;
}
if (match[4]) {
if (tzRegex.exec(match[4])) tzFormat = 'Z';
else {
config._isValid = !1;
return;
}
}
config._f = dateFormat + (timeFormat || '') + (tzFormat || ''), configFromStringAndFormat(config);
} else config._isValid = !1;
}
function configFromRFC2822(config) {
var year, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr, result, weekdayStr, config1, match = rfc2822.exec(config._i.replace(/\([^)]*\)|[\n\t]/g, ' ').replace(/(\s\s+)/g, ' ').replace(/^\s\s*/, '').replace(/\s\s*$/, ''));
if (match) {
if (yearStr = match[4], monthStr = match[3], dayStr = match[2], hourStr = match[5], minuteStr = match[6], secondStr = match[7], result = [
(year = parseInt(yearStr, 10)) <= 49 ? 2000 + year : year <= 999 ? 1900 + year : year,
defaultLocaleMonthsShort.indexOf(monthStr),
parseInt(dayStr, 10),
parseInt(hourStr, 10),
parseInt(minuteStr, 10)
], secondStr && result.push(parseInt(secondStr, 10)), weekdayStr = match[1], config1 = config, weekdayStr && defaultLocaleWeekdaysShort.indexOf(weekdayStr) !== new Date(result[0], result[1], result[2]).getDay() && (getParsingFlags(config1).weekdayMismatch = !0, config1._isValid = !1, 1)) return;
config._a = result, config._tzm = function(obsOffset, militaryOffset, numOffset) {
if (obsOffset) return obsOffsets[obsOffset];
if (militaryOffset) return 0;
var hm = parseInt(numOffset, 10), m = hm % 100;
return 60 * ((hm - m) / 100) + m;
}(match[8], match[9], match[10]), config._d = createUTCDate.apply(null, config._a), config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm), getParsingFlags(config).rfc2822 = !0;
} else config._isValid = !1;
}
function defaults(a, b, c) {
return null != a ? a : null != b ? b : c;
}
function configFromArray(config) {
var config1, w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow, curWeek, nowValue, i, date, currentDate, expectedWeekday, yearToUse, input = [];
if (!config._d) {
for(nowValue = new Date(hooks.now()), currentDate = config._useUTC ? [
nowValue.getUTCFullYear(),
nowValue.getUTCMonth(),
nowValue.getUTCDate()
] : [
nowValue.getFullYear(),
nowValue.getMonth(),
nowValue.getDate()
], config._w && null == config._a[2] && null == config._a[1] && (null != (w = (config1 = config)._w).GG || null != w.W || null != w.E ? (dow = 1, doy = 4, weekYear = defaults(w.GG, config1._a[0], weekOfYear(createLocal(), 1, 4).year), week = defaults(w.W, 1), ((weekday = defaults(w.E, 1)) < 1 || weekday > 7) && (weekdayOverflow = !0)) : (dow = config1._locale._week.dow, doy = config1._locale._week.doy, curWeek = weekOfYear(createLocal(), dow, doy), weekYear = defaults(w.gg, config1._a[0], curWeek.year), week = defaults(w.w, curWeek.week), null != w.d ? ((weekday = w.d) < 0 || weekday > 6) && (weekdayOverflow = !0) : null != w.e ? (weekday = w.e + dow, (w.e < 0 || w.e > 6) && (weekdayOverflow = !0)) : weekday = dow), week < 1 || week > weeksInYear(weekYear, dow, doy) ? getParsingFlags(config1)._overflowWeeks = !0 : null != weekdayOverflow ? getParsingFlags(config1)._overflowWeekday = !0 : (temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy), config1._a[0] = temp.year, config1._dayOfYear = temp.dayOfYear)), null != config._dayOfYear && (yearToUse = defaults(config._a[0], currentDate[0]), (config._dayOfYear > daysInYear(yearToUse) || 0 === config._dayOfYear) && (getParsingFlags(config)._overflowDayOfYear = !0), date = createUTCDate(yearToUse, 0, config._dayOfYear), config._a[1] = date.getUTCMonth(), config._a[2] = date.getUTCDate()), i = 0; i < 3 && null == config._a[i]; ++i)config._a[i] = input[i] = currentDate[i];
for(; i < 7; i++)config._a[i] = input[i] = null == config._a[i] ? 2 === i ? 1 : 0 : config._a[i];
24 === config._a[3] && 0 === config._a[4] && 0 === config._a[5] && 0 === config._a[6] && (config._nextDay = !0, config._a[3] = 0), config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input), expectedWeekday = config._useUTC ? config._d.getUTCDay() : config._d.getDay(), null != config._tzm && config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm), config._nextDay && (config._a[3] = 24), config._w && void 0 !== config._w.d && config._w.d !== expectedWeekday && (getParsingFlags(config).weekdayMismatch = !0);
}
}
function configFromStringAndFormat(config) {
if (config._f === hooks.ISO_8601) {
configFromISO(config);
return;
}
if (config._f === hooks.RFC_2822) {
configFromRFC2822(config);
return;
}
config._a = [], getParsingFlags(config).empty = !0;
var locale, hour, meridiem, isPm, i, parsedInput, tokens1, token, skipped, era, string = '' + config._i, stringLength = string.length, totalParsedInputLength = 0;
for(i = 0, tokens1 = expandFormat(config._f, config._locale).match(formattingTokens) || []; i < tokens1.length; i++)(token = tokens1[i], (parsedInput = (string.match(hasOwnProp(regexes, token) ? regexes[token](config._strict, config._locale) : RegExp(regexEscape(token.replace('\\', '').replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function(matched, p1, p2, p3, p4) {
return p1 || p2 || p3 || p4;
})))) || [])[0]) && ((skipped = string.substr(0, string.indexOf(parsedInput))).length > 0 && getParsingFlags(config).unusedInput.push(skipped), string = string.slice(string.indexOf(parsedInput) + parsedInput.length), totalParsedInputLength += parsedInput.length), formatTokenFunctions[token]) ? (parsedInput ? getParsingFlags(config).empty = !1 : getParsingFlags(config).unusedTokens.push(token), null != parsedInput && hasOwnProp(tokens, token) && tokens[token](parsedInput, config._a, config, token)) : config._strict && !parsedInput && getParsingFlags(config).unusedTokens.push(token);
getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength, string.length > 0 && getParsingFlags(config).unusedInput.push(string), config._a[3] <= 12 && !0 === getParsingFlags(config).bigHour && config._a[3] > 0 && (getParsingFlags(config).bigHour = void 0), getParsingFlags(config).parsedDateParts = config._a.slice(0), getParsingFlags(config).meridiem = config._meridiem, config._a[3] = (locale = config._locale, hour = config._a[3], null == (meridiem = config._meridiem) ? hour : null != locale.meridiemHour ? locale.meridiemHour(hour, meridiem) : (null != locale.isPM && ((isPm = locale.isPM(meridiem)) && hour < 12 && (hour += 12), isPm || 12 !== hour || (hour = 0)), hour)), null !== (era = getParsingFlags(config).era) && (config._a[0] = config._locale.erasConvertYear(era, config._a[0])), configFromArray(config), checkOverflow(config);
}
function prepareConfig(config) {
var config1, input, input1 = config._i, format = config._f;
return (config._locale = config._locale || getLocale(config._l), null === input1 || void 0 === format && '' === input1) ? createInvalid({
nullInput: !0
}) : ('string' == typeof input1 && (config._i = input1 = config._locale.preparse(input1)), isMoment(input1)) ? new Moment(checkOverflow(input1)) : (isDate(input1) ? config._d = input1 : isArray(format) ? function(config) {
var tempConfig, bestMoment, scoreToBeat, i, currentScore, validFormatFound, bestFormatIsValid = !1;
if (0 === config._f.length) {
getParsingFlags(config).invalidFormat = !0, config._d = new Date(NaN);
return;
}
for(i = 0; i < config._f.length; i++)currentScore = 0, validFormatFound = !1, tempConfig = copyConfig({}, config), null != config._useUTC && (tempConfig._useUTC = config._useUTC), tempConfig._f = config._f[i], configFromStringAndFormat(tempConfig), isValid(tempConfig) && (validFormatFound = !0), currentScore = getParsingFlags(tempConfig).charsLeftOver + 10 * getParsingFlags(tempConfig).unusedTokens.length, getParsingFlags(tempConfig).score = currentScore, bestFormatIsValid ? currentScore < scoreToBeat && (scoreToBeat = currentScore, bestMoment = tempConfig) : (null == scoreToBeat || currentScore < scoreToBeat || validFormatFound) && (scoreToBeat = currentScore, bestMoment = tempConfig, validFormatFound && (bestFormatIsValid = !0));
extend(config, bestMoment || tempConfig);
}(config) : format ? configFromStringAndFormat(config) : isUndefined(input = (config1 = config)._i) ? config1._d = new Date(hooks.now()) : isDate(input) ? config1._d = new Date(input.valueOf()) : 'string' == typeof input ? function(config) {
var matched = aspNetJsonRegex.exec(config._i);
if (null !== matched) {
config._d = new Date(+matched[1]);
return;
}
configFromISO(config), !1 === config._isValid && (delete config._isValid, configFromRFC2822(config), !1 === config._isValid && (delete config._isValid, config._strict ? config._isValid = !1 : hooks.createFromInputFallback(config)));
}(config1) : isArray(input) ? (config1._a = map(input.slice(0), function(obj) {
return parseInt(obj, 10);
}), configFromArray(config1)) : isObject(input) ? function(config) {
if (!config._d) {
var i = normalizeObjectUnits(config._i), dayOrDate = void 0 === i.day ? i.date : i.day;
config._a = map([
i.year,
i.month,
dayOrDate,
i.hour,
i.minute,
i.second,
i.millisecond
], function(obj) {
return obj && parseInt(obj, 10);
}), configFromArray(config);
}
}(config1) : isNumber(input) ? config1._d = new Date(input) : hooks.createFromInputFallback(config1), isValid(config) || (config._d = null), config);
}
function createLocalOrUTC(input, format, locale, strict, isUTC) {
var res, c = {};
return (!0 === format || !1 === format) && (strict = format, format = void 0), (!0 === locale || !1 === locale) && (strict = locale, locale = void 0), (isObject(input) && isObjectEmpty(input) || isArray(input) && 0 === input.length) && (input = void 0), c._isAMomentObject = !0, c._useUTC = c._isUTC = isUTC, c._l = locale, c._i = input, c._f = format, c._strict = strict, (res = new Moment(checkOverflow(prepareConfig(c))))._nextDay && (res.add(1, 'd'), res._nextDay = void 0), res;
}
function createLocal(input, format, locale, strict) {
return createLocalOrUTC(input, format, locale, strict, !1);
}
hooks.createFromInputFallback = deprecate("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.", function(config) {
config._d = new Date(config._i + (config._useUTC ? ' UTC' : ''));
}), hooks.ISO_8601 = function() {}, hooks.RFC_2822 = function() {};
var prototypeMin = deprecate('moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/', function() {
var other = createLocal.apply(null, arguments);
return this.isValid() && other.isValid() ? other < this ? this : other : createInvalid();
}), prototypeMax = deprecate('moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/', function() {
var other = createLocal.apply(null, arguments);
return this.isValid() && other.isValid() ? other > this ? this : other : createInvalid();
});
function pickBy(fn, moments) {
var res, i;
if (1 === moments.length && isArray(moments[0]) && (moments = moments[0]), !moments.length) return createLocal();
for(i = 1, res = moments[0]; i < moments.length; ++i)(!moments[i].isValid() || moments[i][fn](res)) && (res = moments[i]);
return res;
}
var ordering = [
'year',
'quarter',
'month',
'week',
'day',
'hour',
'minute',
'second',
'millisecond'
];
function Duration(duration) {
var normalizedInput = normalizeObjectUnits(duration), years = normalizedInput.year || 0, quarters = normalizedInput.quarter || 0, months = normalizedInput.month || 0, weeks = normalizedInput.week || normalizedInput.isoWeek || 0, days = normalizedInput.day || 0, hours = normalizedInput.hour || 0, minutes = normalizedInput.minute || 0, seconds = normalizedInput.second || 0, milliseconds = normalizedInput.millisecond || 0;
this._isValid = function(m) {
var key, i, unitHasDecimal = !1;
for(key in m)if (hasOwnProp(m, key) && !(-1 !== indexOf.call(ordering, key) && (null == m[key] || !isNaN(m[key])))) return !1;
for(i = 0; i < ordering.length; ++i)if (m[ordering[i]]) {
if (unitHasDecimal) return !1;
parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]]) && (unitHasDecimal = !0);
}
return !0;
}(normalizedInput), this._milliseconds = +milliseconds + 1e3 * seconds + 6e4 * minutes + 3600000 * hours, this._days = +days + 7 * weeks, this._months = +months + 3 * quarters + 12 * years, this._data = {}, this._locale = getLocale(), this._bubble();
}
function isDuration(obj) {
return obj instanceof Duration;
}
function absRound(number) {
return number < 0 ? -1 * Math.round(-1 * number) : Math.round(number);
}
function offset(token, separator) {
addFormatToken(token, 0, 0, function() {
var offset = this.utcOffset(), sign = '+';
return offset < 0 && (offset = -offset, sign = '-'), sign + zeroFill(~~(offset / 60), 2) + separator + zeroFill(~~offset % 60, 2);
});
}
offset('Z', ':'), offset('ZZ', ''), addRegexToken('Z', matchShortOffset), addRegexToken('ZZ', matchShortOffset), addParseToken([
'Z',
'ZZ'
], function(input, array, config) {
config._useUTC = !0, config._tzm = offsetFromString(matchShortOffset, input);
});
var chunkOffset = /([\+\-]|\d\d)/gi;
function offsetFromString(matcher, string) {
var parts, minutes, matches = (string || '').match(matcher);
return null === matches ? null : 0 === (minutes = +(60 * (parts = ((matches[matches.length - 1] || []) + '').match(chunkOffset) || [
'-',
0,
0
])[1]) + toInt(parts[2])) ? 0 : '+' === parts[0] ? minutes : -minutes;
}
function cloneWithOffset(input, model) {
var res, diff;
return model._isUTC ? (res = model.clone(), diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf(), res._d.setTime(res._d.valueOf() + diff), hooks.updateOffset(res, !1), res) : createLocal(input).local();
}
function getDateOffset(m) {
return -Math.round(m._d.getTimezoneOffset());
}
function isUtc() {
return !!this.isValid() && this._isUTC && 0 === this._offset;
}
hooks.updateOffset = function() {};
var aspNetRegex = /^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/, isoRegex = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;
function createDuration(input, key) {
var base, other, res, sign, ret, diffRes, duration = input, match = null;
return isDuration(input) ? duration = {
ms: input._milliseconds,
d: input._days,
M: input._months
} : isNumber(input) || !isNaN(+input) ? (duration = {}, key ? duration[key] = +input : duration.milliseconds = +input) : (match = aspNetRegex.exec(input)) ? (sign = '-' === match[1] ? -1 : 1, duration = {
y: 0,
d: toInt(match[2]) * sign,
h: toInt(match[3]) * sign,
m: toInt(match[4]) * sign,
s: toInt(match[5]) * sign,
ms: toInt(absRound(1000 * match[6])) * sign
}) : (match = isoRegex.exec(input)) ? (sign = '-' === match[1] ? -1 : 1, duration = {
y: parseIso(match[2], sign),
M: parseIso(match[3], sign),
w: parseIso(match[4], sign),
d: parseIso(match[5], sign),
h: parseIso(match[6], sign),
m: parseIso(match[7], sign),
s: parseIso(match[8], sign)
}) : null == duration ? duration = {} : 'object' == typeof duration && ('from' in duration || 'to' in duration) && (base = createLocal(duration.from), other = createLocal(duration.to), diffRes = base.isValid() && other.isValid() ? (other = cloneWithOffset(other, base), base.isBefore(other) ? res = positiveMomentsDifference(base, other) : ((res = positiveMomentsDifference(other, base)).milliseconds = -res.milliseconds, res.months = -res.months), res) : {
milliseconds: 0,
months: 0
}, (duration = {}).ms = diffRes.milliseconds, duration.M = diffRes.months), ret = new Duration(duration), isDuration(input) && hasOwnProp(input, '_locale') && (ret._locale = input._locale), isDuration(input) && hasOwnProp(input, '_isValid') && (ret._isValid = input._isValid), ret;
}
function parseIso(inp, sign) {
var res = inp && parseFloat(inp.replace(',', '.'));
return (isNaN(res) ? 0 : res) * sign;
}
function positiveMomentsDifference(base, other) {
var res = {};
return res.months = other.month() - base.month() + (other.year() - base.year()) * 12, base.clone().add(res.months, 'M').isAfter(other) && --res.months, res.milliseconds = +other - +base.clone().add(res.months, 'M'), res;
}
function createAdder(direction, name) {
return function(val, period) {
var tmp;
return null === period || isNaN(+period) || (deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + "(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."), tmp = val, val = period, period = tmp), addSubtract(this, createDuration(val, period), direction), this;
};
}
function addSubtract(mom, duration, isAdding, updateOffset) {
var milliseconds = duration._milliseconds, days = absRound(duration._days), months = absRound(duration._months);
mom.isValid() && (updateOffset = null == updateOffset || updateOffset, months && setMonth(mom, get(mom, 'Month') + months * isAdding), days && set$1(mom, 'Date', get(mom, 'Date') + days * isAdding), milliseconds && mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding), updateOffset && hooks.updateOffset(mom, days || months));
}
createDuration.fn = Duration.prototype, createDuration.invalid = function() {
return createDuration(NaN);
};
var add = createAdder(1, 'add'), subtract = createAdder(-1, 'subtract');
function isString(input) {
return 'string' == typeof input || input instanceof String;
}
function monthDiff(a, b) {
if (a.date() < b.date()) return -monthDiff(b, a);
var adjust, wholeMonthDiff = (b.year() - a.year()) * 12 + (b.month() - a.month()), anchor = a.clone().add(wholeMonthDiff, 'months');
return adjust = b - anchor < 0 ? (b - anchor) / (anchor - a.clone().add(wholeMonthDiff - 1, 'months')) : (b - anchor) / (a.clone().add(wholeMonthDiff + 1, 'months') - anchor), -(wholeMonthDiff + adjust) || 0;
}
function locale(key) {
var newLocaleData;
return void 0 === key ? this._locale._abbr : (null != (newLocaleData = getLocale(key)) && (this._locale = newLocaleData), this);
}
hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ', hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]';
var lang = deprecate('moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.', function(key) {
return void 0 === key ? this.localeData() : this.locale(key);
});
function localeData() {
return this._locale;
}
function localStartOfDate(y, m, d) {
return y < 100 && y >= 0 ? new Date(y + 400, m, d) - 12622780800000 : new Date(y, m, d).valueOf();
}
function utcStartOfDate(y, m, d) {
return y < 100 && y >= 0 ? Date.UTC(y + 400, m, d) - 12622780800000 : Date.UTC(y, m, d);
}
function matchEraAbbr(isStrict, locale) {
return locale.erasAbbrRegex(isStrict);
}
function computeErasParse() {
var i, l, abbrPieces = [], namePieces = [], narrowPieces = [], mixedPieces = [], eras = this.eras();
for(i = 0, l = eras.length; i < l; ++i)namePieces.push(regexEscape(eras[i].name)), abbrPieces.push(regexEscape(eras[i].abbr)), narrowPieces.push(regexEscape(eras[i].narrow)), mixedPieces.push(regexEscape(eras[i].name)), mixedPieces.push(regexEscape(eras[i].abbr)), mixedPieces.push(regexEscape(eras[i].narrow));
this._erasRegex = RegExp('^(' + mixedPieces.join('|') + ')', 'i'), this._erasNameRegex = RegExp('^(' + namePieces.join('|') + ')', 'i'), this._erasAbbrRegex = RegExp('^(' + abbrPieces.join('|') + ')', 'i'), this._erasNarrowRegex = RegExp('^(' + narrowPieces.join('|') + ')', 'i');
}
function addWeekYearFormatToken(token, getter) {
addFormatToken(0, [
token,
token.length
], 0, getter);