PageSourceSearch

https://resmigazete.gov.tr/assets/js/moment-with-locales-2_30_1.js

js resmigazete.gov.tr collected 2026-09-25 08:34:02 UTC 185,256 bytes, 5,787 lines download raw bytes

vendor: 6,868 bytes, lines 1-243
1; (function (global, factory) {
2    typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
3        typeof define === 'function' && define.amd ? define(factory) :
4            global.moment = factory()
5}(this, (function () {
6    'use strict';
7
8    var hookCallback;
9
10    function hooks() {
11        return hookCallback.apply(null, arguments);
12    }
13
14    // This is done to register the method called with moment()
15    // without creating circular dependencies.
16    function setHookCallback(callback) {
17        hookCallback = callback;
18    }
19
20    function isArray(input) {
21        return (
22            input instanceof Array ||
23            Object.prototype.toString.call(input) === '[object Array]'
24        );
25    }
26
27    function isObject(input) {
28        // IE8 will treat undefined and null as object if it wasn't for
29        // input != null
30        return (
31            input != null &&
32            Object.prototype.toString.call(input) === '[object Object]'
33        );
34    }
35
36    function hasOwnProp(a, b) {
37        return Object.prototype.hasOwnProperty.call(a, b);
38    }
39
40    function isObjectEmpty(obj) {
41        if (Object.getOwnPropertyNames) {
42            return Object.getOwnPropertyNames(obj).length === 0;
43        } else {
44            var k;
45            for (k in obj) {
46                if (hasOwnProp(obj, k)) {
47                    return false;
48                }
49            }
50            return true;
51        }
52    }
53
54    function isUndefined(input) {
55        return input === void 0;
56    }
57
58    function isNumber(input) {
59        return (
60            typeof input === 'number' ||
61            Object.prototype.toString.call(input) === '[object Number]'
62        );
63    }
64
65    function isDate(input) {
66        return (
67            input instanceof Date ||
68            Object.prototype.toString.call(input) === '[object Date]'
69        );
70    }
71
72    function map(arr, fn) {
73        var res = [],
74            i,
75            arrLen = arr.length;
76        for (i = 0; i < arrLen; ++i) {
77            res.push(fn(arr[i], i));
78        }
79        return res;
80    }
81
82    function extend(a, b) {
83        for (var i in b) {
84            if (hasOwnProp(b, i)) {
85                a[i] = b[i];
86            }
87        }
88
89        if (hasOwnProp(b, 'toString')) {
90            a.toString = b.toString;
91        }
92
93        if (hasOwnProp(b, 'valueOf')) {
94            a.valueOf = b.valueOf;
95        }
96
97        return a;
98    }
99
100    function createUTC(input, format, locale, strict) {
101        return createLocalOrUTC(input, format, locale, strict, true).utc();
102    }
103
104    function defaultParsingFlags() {
105        // We need to deep clone this object.
106        return {
107            empty: false,
108            unusedTokens: [],
109            unusedInput: [],
110            overflow: -2,
111            charsLeftOver: 0,
112            nullInput: false,
113            invalidEra: null,
114            invalidMonth: null,
115            invalidFormat: false,
116            userInvalidated: false,
117            iso: false,
118            parsedDateParts: [],
119            era: null,
120            meridiem: null,
121            rfc2822: false,
122            weekdayMismatch: false,
123        };
124    }
125
126    function getParsingFlags(m) {
127        if (m._pf == null) {
128            m._pf = defaultParsingFlags();
129        }
130        return m._pf;
131    }
132
133    var some;
134    if (Array.prototype.some) {
135        some = Array.prototype.some;
136    } else {
137        some = function (fun) {
138            var t = Object(this),
139                len = t.length >>> 0,
140                i;
141
142            for (i = 0; i < len; i++) {
143                if (i in t && fun.call(this, t[i], i, t)) {
144                    return true;
145                }
146            }
147
148            return false;
149        };
150    }
151
152    function isValid(m) {
153        var flags = null,
154            parsedParts = false,
155            isNowValid = m._d && !isNaN(m._d.getTime());
156        if (isNowValid) {
157            flags = getParsingFlags(m);
158            parsedParts = some.call(flags.parsedDateParts, function (i) {
159                return i != null;
160            });
161            isNowValid =
162                flags.overflow < 0 &&
163                !flags.empty &&
164                !flags.invalidEra &&
165                !flags.invalidMonth &&
166                !flags.invalidWeekday &&
167                !flags.weekdayMismatch &&
168                !flags.nullInput &&
169                !flags.invalidFormat &&
170                !flags.userInvalidated &&
171                (!flags.meridiem || (flags.meridiem && parsedParts));
172            if (m._strict) {
173                isNowValid =
174                    isNowValid &&
175                    flags.charsLeftOver === 0 &&
176                    flags.unusedTokens.length === 0 &&
177                    flags.bigHour === undefined;
178            }
179        }
180        if (Object.isFrozen == null || !Object.isFrozen(m)) {
181            m._isValid = isNowValid;
182        } else {
183            return isNowValid;
184        }
185        return m._isValid;
186    }
187
188    function createInvalid(flags) {
189        var m = createUTC(NaN);
190        if (flags != null) {
191            extend(getParsingFlags(m), flags);
192        } else {
193            getParsingFlags(m).userInvalidated = true;
194        }
195
196        return m;
197    }
198
199    // Plugins that add properties should also add the key here (null value),
200    // so we can properly clone ourselves.
201    var momentProperties = (hooks.momentProperties = []),
202        updateInProgress = false;
203
204    function copyConfig(to, from) {
205        var i,
206            prop,
207            val,
208            momentPropertiesLen = momentProperties.length;
209
210        if (!isUndefined(from._isAMomentObject)) {
211            to._isAMomentObject = from._isAMomentObject;
212        }
213        if (!isUndefined(from._i)) {
214            to._i = from._i;
215        }
216        if (!isUndefined(from._f)) {
217            to._f = from._f;
218        }
219        if (!isUndefined(from._l)) {
220            to._l = from._l;
221        }
222        if (!isUndefined(from._strict)) {
223            to._strict = from._strict;
224        }
225        if (!isUndefined(from._tzm)) {
226            to._tzm = from._tzm;
227        }
228        if (!isUndefined(from._isUTC)) {
229            to._isUTC = from._isUTC;
230        }
231        if (!isUndefined(from._offset)) {
232            to._offset = from._offset;
233        }
234        if (!isUndefined(from._pf)) {
235            to._pf = getParsingFlags(from);
236        }
237        if (!isUndefined(from._locale)) {
238            to._locale = from._locale;
239        }
240
241        if (momentPropertiesLen > 0) {
242            for (i = 0; i < momentPropertiesLen; i++) {
243                prop = momentProperties[i];
vendor: 10,601 bytes, lines 244-585
244                val = from[prop];
245                if (!isUndefined(val)) {
246                    to[prop] = val;
247                }
248            }
249        }
250
251        return to;
252    }
253
254    // Moment prototype object
255    function Moment(config) {
256        copyConfig(this, config);
257        this._d = new Date(config._d != null ? config._d.getTime() : NaN);
258        if (!this.isValid()) {
259            this._d = new Date(NaN);
260        }
261        // Prevent infinite loop in case updateOffset creates new moment
262        // objects.
263        if (updateInProgress === false) {
264            updateInProgress = true;
265            hooks.updateOffset(this);
266            updateInProgress = false;
267        }
268    }
269
270    function isMoment(obj) {
271        return (
272            obj instanceof Moment || (obj != null && obj._isAMomentObject != null)
273        );
274    }
275
276    function warn(msg) {
277        if (
278            hooks.suppressDeprecationWarnings === false &&
279            typeof console !== 'undefined' &&
280            console.warn
281        ) {
282            console.warn('Deprecation warning: ' + msg);
283        }
284    }
285
286    function deprecate(msg, fn) {
287        var firstTime = true;
288
289        return extend(function () {
290            if (hooks.deprecationHandler != null) {
291                hooks.deprecationHandler(null, msg);
292            }
293            if (firstTime) {
294                var args = [],
295                    arg,
296                    i,
297                    key,
298                    argLen = arguments.length;
299                for (i = 0; i < argLen; i++) {
300                    arg = '';
301                    if (typeof arguments[i] === 'object') {
302                        arg += '\n[' + i + '] ';
303                        for (key in arguments[0]) {
304                            if (hasOwnProp(arguments[0], key)) {
305                                arg += key + ': ' + arguments[0][key] + ', ';
306                            }
307                        }
308                        arg = arg.slice(0, -2); // Remove trailing comma and space
309                    } else {
310                        arg = arguments[i];
311                    }
312                    args.push(arg);
313                }
314                warn(
315                    msg +
316                    '\nArguments: ' +
317                    Array.prototype.slice.call(args).join('') +
318                    '\n' +
319                    new Error().stack
320                );
321                firstTime = false;
322            }
323            return fn.apply(this, arguments);
324        }, fn);
325    }
326
327    var deprecations = {};
328
329    function deprecateSimple(name, msg) {
330        if (hooks.deprecationHandler != null) {
331            hooks.deprecationHandler(name, msg);
332        }
333        if (!deprecations[name]) {
334            warn(msg);
335            deprecations[name] = true;
336        }
337    }
338
339    hooks.suppressDeprecationWarnings = false;
340    hooks.deprecationHandler = null;
341
342    function isFunction(input) {
343        return (
344            (typeof Function !== 'undefined' && input instanceof Function) ||
345            Object.prototype.toString.call(input) === '[object Function]'
346        );
347    }
348
349    function set(config) {
350        var prop, i;
351        for (i in config) {
352            if (hasOwnProp(config, i)) {
353                prop = config[i];
354                if (isFunction(prop)) {
355                    this[i] = prop;
356                } else {
357                    this['_' + i] = prop;
358                }
359            }
360        }
361        this._config = config;
362        // Lenient ordinal parsing accepts just a number in addition to
363        // number + (possibly) stuff coming from _dayOfMonthOrdinalParse.
364        // TODO: Remove "ordinalParse" fallback in next major release.
365        this._dayOfMonthOrdinalParseLenient = new RegExp(
366            (this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) +
367            '|' +
368            /\d{1,2}/.source
369        );
370    }
371
372    function mergeConfigs(parentConfig, childConfig) {
373        var res = extend({}, parentConfig),
374            prop;
375        for (prop in childConfig) {
376            if (hasOwnProp(childConfig, prop)) {
377                if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) {
378                    res[prop] = {};
379                    extend(res[prop], parentConfig[prop]);
380                    extend(res[prop], childConfig[prop]);
381                } else if (childConfig[prop] != null) {
382                    res[prop] = childConfig[prop];
383                } else {
384                    delete res[prop];
385                }
386            }
387        }
388        for (prop in parentConfig) {
389            if (
390                hasOwnProp(parentConfig, prop) &&
391                !hasOwnProp(childConfig, prop) &&
392                isObject(parentConfig[prop])
393            ) {
394                // make sure changes to properties don't modify parent config
395                res[prop] = extend({}, res[prop]);
396            }
397        }
398        return res;
399    }
400
401    function Locale(config) {
402        if (config != null) {
403            this.set(config);
404        }
405    }
406
407    var keys;
408
409    if (Object.keys) {
410        keys = Object.keys;
411    } else {
412        keys = function (obj) {
413            var i,
414                res = [];
415            for (i in obj) {
416                if (hasOwnProp(obj, i)) {
417                    res.push(i);
418                }
419            }
420            return res;
421        };
422    }
423
424    var defaultCalendar = {
425        sameDay: '[Today at] LT',
426        nextDay: '[Tomorrow at] LT',
427        nextWeek: 'dddd [at] LT',
428        lastDay: '[Yesterday at] LT',
429        lastWeek: '[Last] dddd [at] LT',
430        sameElse: 'L',
431    };
432
433    function calendar(key, mom, now) {
434        var output = this._calendar[key] || this._calendar['sameElse'];
435        return isFunction(output) ? output.call(mom, now) : output;
436    }
437
438    function zeroFill(number, targetLength, forceSign) {
439        var absNumber = '' + Math.abs(number),
440            zerosToFill = targetLength - absNumber.length,
441            sign = number >= 0;
442        return (
443            (sign ? (forceSign ? '+' : '') : '-') +
444            Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) +
445            absNumber
446        );
447    }
448
449    var formattingTokens =
450        /(\[[^\[]*\])|(\\)?([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,
451        localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,
452        formatFunctions = {},
453        formatTokenFunctions = {};
454
455    // token:    'M'
456    // padded:   ['MM', 2]
457    // ordinal:  'Mo'
458    // callback: function () { this.month() + 1 }
459    function addFormatToken(token, padded, ordinal, callback) {
460        var func = callback;
461        if (typeof callback === 'string') {
462            func = function () {
463                return this[callback]();
464            };
465        }
466        if (token) {
467            formatTokenFunctions[token] = func;
468        }
469        if (padded) {
470            formatTokenFunctions[padded[0]] = function () {
471                return zeroFill(func.apply(this, arguments), padded[1], padded[2]);
472            };
473        }
474        if (ordinal) {
475            formatTokenFunctions[ordinal] = function () {
476                return this.localeData().ordinal(
477                    func.apply(this, arguments),
478                    token
479                );
480            };
481        }
482    }
483
484    function removeFormattingTokens(input) {
485        if (input.match(/\[[\s\S]/)) {
486            return input.replace(/^\[|\]$/g, '');
487        }
488        return input.replace(/\\/g, '');
489    }
490
491    function makeFormatFunction(format) {
492        var array = format.match(formattingTokens),
493            i,
494            length;
495
496        for (i = 0, length = array.length; i < length; i++) {
497            if (formatTokenFunctions[array[i]]) {
498                array[i] = formatTokenFunctions[array[i]];
499            } else {
500                array[i] = removeFormattingTokens(array[i]);
501            }
502        }
503
504        return function (mom) {
505            var output = '',
506                i;
507            for (i = 0; i < length; i++) {
508                output += isFunction(array[i])
509                    ? array[i].call(mom, format)
510                    : array[i];
511            }
512            return output;
513        };
514    }
515
516    // format date using native date object
517    function formatMoment(m, format) {
518        if (!m.isValid()) {
519            return m.localeData().invalidDate();
520        }
521
522        format = expandFormat(format, m.localeData());
523        formatFunctions[format] =
524            formatFunctions[format] || makeFormatFunction(format);
525
526        return formatFunctions[format](m);
527    }
528
529    function expandFormat(format, locale) {
530        var i = 5;
531
532        function replaceLongDateFormatTokens(input) {
533            return locale.longDateFormat(input) || input;
534        }
535
536        localFormattingTokens.lastIndex = 0;
537        while (i >= 0 && localFormattingTokens.test(format)) {
538            format = format.replace(
539                localFormattingTokens,
540                replaceLongDateFormatTokens
541            );
542            localFormattingTokens.lastIndex = 0;
543            i -= 1;
544        }
545
546        return format;
547    }
548
549    var defaultLongDateFormat = {
550        LTS: 'h:mm:ss A',
551        LT: 'h:mm A',
552        L: 'MM/DD/YYYY',
553        LL: 'MMMM D, YYYY',
554        LLL: 'MMMM D, YYYY h:mm A',
555        LLLL: 'dddd, MMMM D, YYYY h:mm A',
556    };
557
558    function longDateFormat(key) {
559        var format = this._longDateFormat[key],
560            formatUpper = this._longDateFormat[key.toUpperCase()];
561
562        if (format || !formatUpper) {
563            return format;
564        }
565
566        this._longDateFormat[key] = formatUpper
567            .match(formattingTokens)
568            .map(function (tok) {
569                if (
570                    tok === 'MMMM' ||
571                    tok === 'MM' ||
572                    tok === 'DD' ||
573                    tok === 'dddd'
574                ) {
575                    return tok.slice(1);
576                }
577                return tok;
578            })
579            .join('');
580
581        return this._longDateFormat[key];
582    }
583
584    var defaultInvalidDate = 'Invalid date';
585
vendor: 8,296 bytes, lines 586-867
586    function invalidDate() {
587        return this._invalidDate;
588    }
589
590    var defaultOrdinal = '%d',
591        defaultDayOfMonthOrdinalParse = /\d{1,2}/;
592
593    function ordinal(number) {
594        return this._ordinal.replace('%d', number);
595    }
596
597    var defaultRelativeTime = {
598        future: 'in %s',
599        past: '%s ago',
600        s: 'a few seconds',
601        ss: '%d seconds',
602        m: 'a minute',
603        mm: '%d minutes',
604        h: 'an hour',
605        hh: '%d hours',
606        d: 'a day',
607        dd: '%d days',
608        w: 'a week',
609        ww: '%d weeks',
610        M: 'a month',
611        MM: '%d months',
612        y: 'a year',
613        yy: '%d years',
614    };
615
616    function relativeTime(number, withoutSuffix, string, isFuture) {
617        var output = this._relativeTime[string];
618        return isFunction(output)
619            ? output(number, withoutSuffix, string, isFuture)
620            : output.replace(/%d/i, number);
621    }
622
623    function pastFuture(diff, output) {
624        var format = this._relativeTime[diff > 0 ? 'future' : 'past'];
625        return isFunction(format) ? format(output) : format.replace(/%s/i, output);
626    }
627
628    var aliases = {
629        D: 'date',
630        dates: 'date',
631        date: 'date',
632        d: 'day',
633        days: 'day',
634        day: 'day',
635        e: 'weekday',
636        weekdays: 'weekday',
637        weekday: 'weekday',
638        E: 'isoWeekday',
639        isoweekdays: 'isoWeekday',
640        isoweekday: 'isoWeekday',
641        DDD: 'dayOfYear',
642        dayofyears: 'dayOfYear',
643        dayofyear: 'dayOfYear',
644        h: 'hour',
645        hours: 'hour',
646        hour: 'hour',
647        ms: 'millisecond',
648        milliseconds: 'millisecond',
649        millisecond: 'millisecond',
650        m: 'minute',
651        minutes: 'minute',
652        minute: 'minute',
653        M: 'month',
654        months: 'month',
655        month: 'month',
656        Q: 'quarter',
657        quarters: 'quarter',
658        quarter: 'quarter',
659        s: 'second',
660        seconds: 'second',
661        second: 'second',
662        gg: 'weekYear',
663        weekyears: 'weekYear',
664        weekyear: 'weekYear',
665        GG: 'isoWeekYear',
666        isoweekyears: 'isoWeekYear',
667        isoweekyear: 'isoWeekYear',
668        w: 'week',
669        weeks: 'week',
670        week: 'week',
671        W: 'isoWeek',
672        isoweeks: 'isoWeek',
673        isoweek: 'isoWeek',
674        y: 'year',
675        years: 'year',
676        year: 'year',
677    };
678
679    function normalizeUnits(units) {
680        return typeof units === 'string'
681            ? aliases[units] || aliases[units.toLowerCase()]
682            : undefined;
683    }
684
685    function normalizeObjectUnits(inputObject) {
686        var normalizedInput = {},
687            normalizedProp,
688            prop;
689
690        for (prop in inputObject) {
691            if (hasOwnProp(inputObject, prop)) {
692                normalizedProp = normalizeUnits(prop);
693                if (normalizedProp) {
694                    normalizedInput[normalizedProp] = inputObject[prop];
695                }
696            }
697        }
698
699        return normalizedInput;
700    }
701
702    var priorities = {
703        date: 9,
704        day: 11,
705        weekday: 11,
706        isoWeekday: 11,
707        dayOfYear: 4,
708        hour: 13,
709        millisecond: 16,
710        minute: 14,
711        month: 8,
712        quarter: 7,
713        second: 15,
714        weekYear: 1,
715        isoWeekYear: 1,
716        week: 5,
717        isoWeek: 5,
718        year: 1,
719    };
720
721    function getPrioritizedUnits(unitsObj) {
722        var units = [],
723            u;
724        for (u in unitsObj) {
725            if (hasOwnProp(unitsObj, u)) {
726                units.push({ unit: u, priority: priorities[u] });
727            }
728        }
729        units.sort(function (a, b) {
730            return a.priority - b.priority;
731        });
732        return units;
733    }
734
735    var match1 = /\d/, //       0 - 9
736        match2 = /\d\d/, //      00 - 99
737        match3 = /\d{3}/, //     000 - 999
738        match4 = /\d{4}/, //    0000 - 9999
739        match6 = /[+-]?\d{6}/, // -999999 - 999999
740        match1to2 = /\d\d?/, //       0 - 99
741        match3to4 = /\d\d\d\d?/, //     999 - 9999
742        match5to6 = /\d\d\d\d\d\d?/, //   99999 - 999999
743        match1to3 = /\d{1,3}/, //       0 - 999
744        match1to4 = /\d{1,4}/, //       0 - 9999
745        match1to6 = /[+-]?\d{1,6}/, // -999999 - 999999
746        matchUnsigned = /\d+/, //       0 - inf
747        matchSigned = /[+-]?\d+/, //    -inf - inf
748        matchOffset = /Z|[+-]\d\d:?\d\d/gi, // +00:00 -00:00 +0000 -0000 or Z
749        matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi, // +00 -00 +00:00 -00:00 +0000 -0000 or Z
750        matchTimestamp = /[+-]?\d+(\.\d{1,3})?/, // 123456789 123456789.123
751        // any word (or two) characters or numbers including two/three word month in arabic.
752        // includes scottish gaelic two word and hyphenated months
753        matchWord =
754            /[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,
755        match1to2NoLeadingZero = /^[1-9]\d?/, //         1-99
756        match1to2HasZero = /^([1-9]\d|\d)/, //           0-99
757        regexes;
758
759    regexes = {};
760
761    function addRegexToken(token, regex, strictRegex) {
762        regexes[token] = isFunction(regex)
763            ? regex
764            : function (isStrict, localeData) {
765                return isStrict && strictRegex ? strictRegex : regex;
766            };
767    }
768
769    function getParseRegexForToken(token, config) {
770        if (!hasOwnProp(regexes, token)) {
771            return new RegExp(unescapeFormat(token));
772        }
773
774        return regexes[token](config._strict, config._locale);
775    }
776
777    // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript
778    function unescapeFormat(s) {
779        return regexEscape(
780            s
781                .replace('\\', '')
782                .replace(
783                    /\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,
784                    function (matched, p1, p2, p3, p4) {
785                        return p1 || p2 || p3 || p4;
786                    }
787                )
788        );
789    }
790
791    function regexEscape(s) {
792        return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
793    }
794
795    function absFloor(number) {
796        if (number < 0) {
797            // -0 -> 0
798            return Math.ceil(number) || 0;
799        } else {
800            return Math.floor(number);
801        }
802    }
803
804    function toInt(argumentForCoercion) {
805        var coercedNumber = +argumentForCoercion,
806            value = 0;
807
808        if (coercedNumber !== 0 && isFinite(coercedNumber)) {
809            value = absFloor(coercedNumber);
810        }
811
812        return value;
813    }
814
815    var tokens = {};
816
817    function addParseToken(token, callback) {
818        var i,
819            func = callback,
820            tokenLen;
821        if (typeof token === 'string') {
822            token = [token];
823        }
824        if (isNumber(callback)) {
825            func = function (input, array) {
826                array[callback] = toInt(input);
827            };
828        }
829        tokenLen = token.length;
830        for (i = 0; i < tokenLen; i++) {
831            tokens[token[i]] = func;
832        }
833    }
834
835    function addWeekParseToken(token, callback) {
836        addParseToken(token, function (input, array, config, token) {
837            config._w = config._w || {};
838            callback(input, config._w, config, token);
839        });
840    }
841
842    function addTimeToArrayFromToken(token, input, config) {
843        if (input != null && hasOwnProp(tokens, token)) {
844            tokens[token](input, config._a, config, token);
845        }
846    }
847
848    function isLeapYear(year) {
849        return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
850    }
851
852    var YEAR = 0,
853        MONTH = 1,
854        DATE = 2,
855        HOUR = 3,
856        MINUTE = 4,
857        SECOND = 5,
858        MILLISECOND = 6,
859        WEEK = 7,
860        WEEKDAY = 8;
861
862    // FORMATTING
863
864    addFormatToken('Y', 0, 0, function () {
865        var y = this.year();
866        return y <= 9999 ? zeroFill(y, 4) : '+' + y;
867    });
vendor: 4,071 bytes, lines 868-994
868
869    addFormatToken(0, ['YY', 2], 0, function () {
870        return this.year() % 100;
871    });
872
873    addFormatToken(0, ['YYYY', 4], 0, 'year');
874    addFormatToken(0, ['YYYYY', 5], 0, 'year');
875    addFormatToken(0, ['YYYYYY', 6, true], 0, 'year');
876
877    // PARSING
878
879    addRegexToken('Y', matchSigned);
880    addRegexToken('YY', match1to2, match2);
881    addRegexToken('YYYY', match1to4, match4);
882    addRegexToken('YYYYY', match1to6, match6);
883    addRegexToken('YYYYYY', match1to6, match6);
884
885    addParseToken(['YYYYY', 'YYYYYY'], YEAR);
886    addParseToken('YYYY', function (input, array) {
887        array[YEAR] =
888            input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input);
889    });
890    addParseToken('YY', function (input, array) {
891        array[YEAR] = hooks.parseTwoDigitYear(input);
892    });
893    addParseToken('Y', function (input, array) {
894        array[YEAR] = parseInt(input, 10);
895    });
896
897    // HELPERS
898
899    function daysInYear(year) {
900        return isLeapYear(year) ? 366 : 365;
901    }
902
903    // HOOKS
904
905    hooks.parseTwoDigitYear = function (input) {
906        return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);
907    };
908
909    // MOMENTS
910
911    var getSetYear = makeGetSet('FullYear', true);
912
913    function getIsLeapYear() {
914        return isLeapYear(this.year());
915    }
916
917    function makeGetSet(unit, keepTime) {
918        return function (value) {
919            if (value != null) {
920                set$1(this, unit, value);
921                hooks.updateOffset(this, keepTime);
922                return this;
923            } else {
924                return get(this, unit);
925            }
926        };
927    }
928
929    function get(mom, unit) {
930        if (!mom.isValid()) {
931            return NaN;
932        }
933
934        var d = mom._d,
935            isUTC = mom._isUTC;
936
937        switch (unit) {
938            case 'Milliseconds':
939                return isUTC ? d.getUTCMilliseconds() : d.getMilliseconds();
940            case 'Seconds':
941                return isUTC ? d.getUTCSeconds() : d.getSeconds();
942            case 'Minutes':
943                return isUTC ? d.getUTCMinutes() : d.getMinutes();
944            case 'Hours':
945                return isUTC ? d.getUTCHours() : d.getHours();
946            case 'Date':
947                return isUTC ? d.getUTCDate() : d.getDate();
948            case 'Day':
949                return isUTC ? d.getUTCDay() : d.getDay();
950            case 'Month':
951                return isUTC ? d.getUTCMonth() : d.getMonth();
952            case 'FullYear':
953                return isUTC ? d.getUTCFullYear() : d.getFullYear();
954            default:
955                return NaN; // Just in case
956        }
957    }
958
959    function set$1(mom, unit, value) {
960        var d, isUTC, year, month, date;
961
962        if (!mom.isValid() || isNaN(value)) {
963            return;
964        }
965
966        d = mom._d;
967        isUTC = mom._isUTC;
968
969        switch (unit) {
970            case 'Milliseconds':
971                return void (isUTC
972                    ? d.setUTCMilliseconds(value)
973                    : d.setMilliseconds(value));
974            case 'Seconds':
975                return void (isUTC ? d.setUTCSeconds(value) : d.setSeconds(value));
976            case 'Minutes':
977                return void (isUTC ? d.setUTCMinutes(value) : d.setMinutes(value));
978            case 'Hours':
979                return void (isUTC ? d.setUTCHours(value) : d.setHours(value));
980            case 'Date':
981                return void (isUTC ? d.setUTCDate(value) : d.setDate(value));
982            // case 'Day': // Not real
983            //    return void (isUTC ? d.setUTCDay(value) : d.setDay(value));
984            // case 'Month': // Not used because we need to pass two variables
985            //     return void (isUTC ? d.setUTCMonth(value) : d.setMonth(value));
986            case 'FullYear':
987                break; // See below ...
988            default:
989                return; // Just in case
990        }
991
992        year = value;
993        month = mom.month();
994        date = mom.date();
vendor: 4,402 bytes, lines 995-1139
995        date = date === 29 && month === 1 && !isLeapYear(year) ? 28 : date;
996        void (isUTC
997            ? d.setUTCFullYear(year, month, date)
998            : d.setFullYear(year, month, date));
999    }
1000
1001    // MOMENTS
1002
1003    function stringGet(units) {
1004        units = normalizeUnits(units);
1005        if (isFunction(this[units])) {
1006            return this[units]();
1007        }
1008        return this;
1009    }
1010
1011    function stringSet(units, value) {
1012        if (typeof units === 'object') {
1013            units = normalizeObjectUnits(units);
1014            var prioritized = getPrioritizedUnits(units),
1015                i,
1016                prioritizedLen = prioritized.length;
1017            for (i = 0; i < prioritizedLen; i++) {
1018                this[prioritized[i].unit](units[prioritized[i].unit]);
1019            }
1020        } else {
1021            units = normalizeUnits(units);
1022            if (isFunction(this[units])) {
1023                return this[units](value);
1024            }
1025        }
1026        return this;
1027    }
1028
1029    function mod(n, x) {
1030        return ((n % x) + x) % x;
1031    }
1032
1033    var indexOf;
1034
1035    if (Array.prototype.indexOf) {
1036        indexOf = Array.prototype.indexOf;
1037    } else {
1038        indexOf = function (o) {
1039            // I know
1040            var i;
1041            for (i = 0; i < this.length; ++i) {
1042                if (this[i] === o) {
1043                    return i;
1044                }
1045            }
1046            return -1;
1047        };
1048    }
1049
1050    function daysInMonth(year, month) {
1051        if (isNaN(year) || isNaN(month)) {
1052            return NaN;
1053        }
1054        var modMonth = mod(month, 12);
1055        year += (month - modMonth) / 12;
1056        return modMonth === 1
1057            ? isLeapYear(year)
1058                ? 29
1059                : 28
1060            : 31 - ((modMonth % 7) % 2);
1061    }
1062
1063    // FORMATTING
1064
1065    addFormatToken('M', ['MM', 2], 'Mo', function () {
1066        return this.month() + 1;
1067    });
1068
1069    addFormatToken('MMM', 0, 0, function (format) {
1070        return this.localeData().monthsShort(this, format);
1071    });
1072
1073    addFormatToken('MMMM', 0, 0, function (format) {
1074        return this.localeData().months(this, format);
1075    });
1076
1077    // PARSING
1078
1079    addRegexToken('M', match1to2, match1to2NoLeadingZero);
1080    addRegexToken('MM', match1to2, match2);
1081    addRegexToken('MMM', function (isStrict, locale) {
1082        return locale.monthsShortRegex(isStrict);
1083    });
1084    addRegexToken('MMMM', function (isStrict, locale) {
1085        return locale.monthsRegex(isStrict);
1086    });
1087
1088    addParseToken(['M', 'MM'], function (input, array) {
1089        array[MONTH] = toInt(input) - 1;
1090    });
1091
1092    addParseToken(['MMM', 'MMMM'], function (input, array, config, token) {
1093        var month = config._locale.monthsParse(input, token, config._strict);
1094        // if we didn't find a month name, mark the date as invalid.
1095        if (month != null) {
1096            array[MONTH] = month;
1097        } else {
1098            getParsingFlags(config).invalidMonth = input;
1099        }
1100    });
1101
1102    // LOCALES
1103
1104    var defaultLocaleMonths =
1105        'January_February_March_April_May_June_July_August_September_October_November_December'.split(
1106            '_'
1107        ),
1108        defaultLocaleMonthsShort =
1109            'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'),
1110        MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,
1111        defaultMonthsShortRegex = matchWord,
1112        defaultMonthsRegex = matchWord;
1113
1114    function localeMonths(m, format) {
1115        if (!m) {
1116            return isArray(this._months)
1117                ? this._months
1118                : this._months['standalone'];
1119        }
1120        return isArray(this._months)
1121            ? this._months[m.month()]
1122            : this._months[
1123            (this._months.isFormat || MONTHS_IN_FORMAT).test(format)
1124                ? 'format'
1125                : 'standalone'
1126            ][m.month()];
1127    }
1128
1129    function localeMonthsShort(m, format) {
1130        if (!m) {
1131            return isArray(this._monthsShort)
1132                ? this._monthsShort
1133                : this._monthsShort['standalone'];
1134        }
1135        return isArray(this._monthsShort)
1136            ? this._monthsShort[m.month()]
1137            : this._monthsShort[
1138            MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'
1139            ][m.month()];
vendor: 4,090 bytes, lines 1140-1261
1140    }
1141
1142    function handleStrictParse(monthName, format, strict) {
1143        var i,
1144            ii,
1145            mom,
1146            llc = monthName.toLocaleLowerCase();
1147        if (!this._monthsParse) {
1148            // this is not used
1149            this._monthsParse = [];
1150            this._longMonthsParse = [];
1151            this._shortMonthsParse = [];
1152            for (i = 0; i < 12; ++i) {
1153                mom = createUTC([2000, i]);
1154                this._shortMonthsParse[i] = this.monthsShort(
1155                    mom,
1156                    ''
1157                ).toLocaleLowerCase();
1158                this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase();
1159            }
1160        }
1161
1162        if (strict) {
1163            if (format === 'MMM') {
1164                ii = indexOf.call(this._shortMonthsParse, llc);
1165                return ii !== -1 ? ii : null;
1166            } else {
1167                ii = indexOf.call(this._longMonthsParse, llc);
1168                return ii !== -1 ? ii : null;
1169            }
1170        } else {
1171            if (format === 'MMM') {
1172                ii = indexOf.call(this._shortMonthsParse, llc);
1173                if (ii !== -1) {
1174                    return ii;
1175                }
1176                ii = indexOf.call(this._longMonthsParse, llc);
1177                return ii !== -1 ? ii : null;
1178            } else {
1179                ii = indexOf.call(this._longMonthsParse, llc);
1180                if (ii !== -1) {
1181                    return ii;
1182                }
1183                ii = indexOf.call(this._shortMonthsParse, llc);
1184                return ii !== -1 ? ii : null;
1185            }
1186        }
1187    }
1188
1189    function localeMonthsParse(monthName, format, strict) {
1190        var i, mom, regex;
1191
1192        if (this._monthsParseExact) {
1193            return handleStrictParse.call(this, monthName, format, strict);
1194        }
1195
1196        if (!this._monthsParse) {
1197            this._monthsParse = [];
1198            this._longMonthsParse = [];
1199            this._shortMonthsParse = [];
1200        }
1201
1202        // TODO: add sorting
1203        // Sorting makes sure if one month (or abbr) is a prefix of another
1204        // see sorting in computeMonthsParse
1205        for (i = 0; i < 12; i++) {
1206            // make the regex if we don't have it already
1207            mom = createUTC([2000, i]);
1208            if (strict && !this._longMonthsParse[i]) {
1209                this._longMonthsParse[i] = new RegExp(
1210                    '^' + this.months(mom, '').replace('.', '') + '$',
1211                    'i'
1212                );
1213                this._shortMonthsParse[i] = new RegExp(
1214                    '^' + this.monthsShort(mom, '').replace('.', '') + '$',
1215                    'i'
1216                );
1217            }
1218            if (!strict && !this._monthsParse[i]) {
1219                regex =
1220                    '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, '');
1221                this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');
1222            }
1223            // test the regex
1224            if (
1225                strict &&
1226                format === 'MMMM' &&
1227                this._longMonthsParse[i].test(monthName)
1228            ) {
1229                return i;
1230            } else if (
1231                strict &&
1232                format === 'MMM' &&
1233                this._shortMonthsParse[i].test(monthName)
1234            ) {
1235                return i;
1236            } else if (!strict && this._monthsParse[i].test(monthName)) {
1237                return i;
1238            }
1239        }
1240    }
1241
1242    // MOMENTS
1243
1244    function setMonth(mom, value) {
1245        if (!mom.isValid()) {
1246            // No op
1247            return mom;
1248        }
1249
1250        if (typeof value === 'string') {
1251            if (/^\d+$/.test(value)) {
1252                value = toInt(value);
1253            } else {
1254                value = mom.localeData().monthsParse(value);
1255                // TODO: Another silent failure?
1256                if (!isNumber(value)) {
1257                    return mom;
1258                }
1259            }
1260        }
1261
vendor: 4,275 bytes, lines 1262-1390
1262        var month = value,
1263            date = mom.date();
1264
1265        date = date < 29 ? date : Math.min(date, daysInMonth(mom.year(), month));
1266        void (mom._isUTC
1267            ? mom._d.setUTCMonth(month, date)
1268            : mom._d.setMonth(month, date));
1269        return mom;
1270    }
1271
1272    function getSetMonth(value) {
1273        if (value != null) {
1274            setMonth(this, value);
1275            hooks.updateOffset(this, true);
1276            return this;
1277        } else {
1278            return get(this, 'Month');
1279        }
1280    }
1281
1282    function getDaysInMonth() {
1283        return daysInMonth(this.year(), this.month());
1284    }
1285
1286    function monthsShortRegex(isStrict) {
1287        if (this._monthsParseExact) {
1288            if (!hasOwnProp(this, '_monthsRegex')) {
1289                computeMonthsParse.call(this);
1290            }
1291            if (isStrict) {
1292                return this._monthsShortStrictRegex;
1293            } else {
1294                return this._monthsShortRegex;
1295            }
1296        } else {
1297            if (!hasOwnProp(this, '_monthsShortRegex')) {
1298                this._monthsShortRegex = defaultMonthsShortRegex;
1299            }
1300            return this._monthsShortStrictRegex && isStrict
1301                ? this._monthsShortStrictRegex
1302                : this._monthsShortRegex;
1303        }
1304    }
1305
1306    function monthsRegex(isStrict) {
1307        if (this._monthsParseExact) {
1308            if (!hasOwnProp(this, '_monthsRegex')) {
1309                computeMonthsParse.call(this);
1310            }
1311            if (isStrict) {
1312                return this._monthsStrictRegex;
1313            } else {
1314                return this._monthsRegex;
1315            }
1316        } else {
1317            if (!hasOwnProp(this, '_monthsRegex')) {
1318                this._monthsRegex = defaultMonthsRegex;
1319            }
1320            return this._monthsStrictRegex && isStrict
1321                ? this._monthsStrictRegex
1322                : this._monthsRegex;
1323        }
1324    }
1325
1326    function computeMonthsParse() {
1327        function cmpLenRev(a, b) {
1328            return b.length - a.length;
1329        }
1330
1331        var shortPieces = [],
1332            longPieces = [],
1333            mixedPieces = [],
1334            i,
1335            mom,
1336            shortP,
1337            longP;
1338        for (i = 0; i < 12; i++) {
1339            // make the regex if we don't have it already
1340            mom = createUTC([2000, i]);
1341            shortP = regexEscape(this.monthsShort(mom, ''));
1342            longP = regexEscape(this.months(mom, ''));
1343            shortPieces.push(shortP);
1344            longPieces.push(longP);
1345            mixedPieces.push(longP);
1346            mixedPieces.push(shortP);
1347        }
1348        // Sorting makes sure if one month (or abbr) is a prefix of another it
1349        // will match the longer piece.
1350        shortPieces.sort(cmpLenRev);
1351        longPieces.sort(cmpLenRev);
1352        mixedPieces.sort(cmpLenRev);
1353
1354        this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
1355        this._monthsShortRegex = this._monthsRegex;
1356        this._monthsStrictRegex = new RegExp(
1357            '^(' + longPieces.join('|') + ')',
1358            'i'
1359        );
1360        this._monthsShortStrictRegex = new RegExp(
1361            '^(' + shortPieces.join('|') + ')',
1362            'i'
1363        );
1364    }
1365
1366    function createDate(y, m, d, h, M, s, ms) {
1367        // can't just apply() to create a date:
1368        // https://stackoverflow.com/q/181348
1369        var date;
1370        // the date constructor remaps years 0-99 to 1900-1999
1371        if (y < 100 && y >= 0) {
1372            // preserve leap years using a full 400 year cycle, then reset
1373            date = new Date(y + 400, m, d, h, M, s, ms);
1374            if (isFinite(date.getFullYear())) {
1375                date.setFullYear(y);
1376            }
1377        } else {
1378            date = new Date(y, m, d, h, M, s, ms);
1379        }
1380
1381        return date;
1382    }
1383
1384    function createUTCDate(y) {
1385        var date, args;
1386        // the Date.UTC function remaps years 0-99 to 1900-1999
1387        if (y < 100 && y >= 0) {
1388            args = Array.prototype.slice.call(arguments);
1389            // preserve leap years using a full 400 year cycle, then reset
1390            args[0] = y + 400;
vendor: 10,860 bytes, lines 1391-1726
1391            date = new Date(Date.UTC.apply(null, args));
1392            if (isFinite(date.getUTCFullYear())) {
1393                date.setUTCFullYear(y);
1394            }
1395        } else {
1396            date = new Date(Date.UTC.apply(null, arguments));
1397        }
1398
1399        return date;
1400    }
1401
1402    // start-of-first-week - start-of-year
1403    function firstWeekOffset(year, dow, doy) {
1404        var // first-week day -- which january is always in the first week (4 for iso, 1 for other)
1405            fwd = 7 + dow - doy,
1406            // first-week day local weekday -- which local weekday is fwd
1407            fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7;
1408
1409        return -fwdlw + fwd - 1;
1410    }
1411
1412    // https://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday
1413    function dayOfYearFromWeeks(year, week, weekday, dow, doy) {
1414        var localWeekday = (7 + weekday - dow) % 7,
1415            weekOffset = firstWeekOffset(year, dow, doy),
1416            dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset,
1417            resYear,
1418            resDayOfYear;
1419
1420        if (dayOfYear <= 0) {
1421            resYear = year - 1;
1422            resDayOfYear = daysInYear(resYear) + dayOfYear;
1423        } else if (dayOfYear > daysInYear(year)) {
1424            resYear = year + 1;
1425            resDayOfYear = dayOfYear - daysInYear(year);
1426        } else {
1427            resYear = year;
1428            resDayOfYear = dayOfYear;
1429        }
1430
1431        return {
1432            year: resYear,
1433            dayOfYear: resDayOfYear,
1434        };
1435    }
1436
1437    function weekOfYear(mom, dow, doy) {
1438        var weekOffset = firstWeekOffset(mom.year(), dow, doy),
1439            week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1,
1440            resWeek,
1441            resYear;
1442
1443        if (week < 1) {
1444            resYear = mom.year() - 1;
1445            resWeek = week + weeksInYear(resYear, dow, doy);
1446        } else if (week > weeksInYear(mom.year(), dow, doy)) {
1447            resWeek = week - weeksInYear(mom.year(), dow, doy);
1448            resYear = mom.year() + 1;
1449        } else {
1450            resYear = mom.year();
1451            resWeek = week;
1452        }
1453
1454        return {
1455            week: resWeek,
1456            year: resYear,
1457        };
1458    }
1459
1460    function weeksInYear(year, dow, doy) {
1461        var weekOffset = firstWeekOffset(year, dow, doy),
1462            weekOffsetNext = firstWeekOffset(year + 1, dow, doy);
1463        return (daysInYear(year) - weekOffset + weekOffsetNext) / 7;
1464    }
1465
1466    // FORMATTING
1467
1468    addFormatToken('w', ['ww', 2], 'wo', 'week');
1469    addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek');
1470
1471    // PARSING
1472
1473    addRegexToken('w', match1to2, match1to2NoLeadingZero);
1474    addRegexToken('ww', match1to2, match2);
1475    addRegexToken('W', match1to2, match1to2NoLeadingZero);
1476    addRegexToken('WW', match1to2, match2);
1477
1478    addWeekParseToken(
1479        ['w', 'ww', 'W', 'WW'],
1480        function (input, week, config, token) {
1481            week[token.substr(0, 1)] = toInt(input);
1482        }
1483    );
1484
1485    // HELPERS
1486
1487    // LOCALES
1488
1489    function localeWeek(mom) {
1490        return weekOfYear(mom, this._week.dow, this._week.doy).week;
1491    }
1492
1493    var defaultLocaleWeek = {
1494        dow: 0, // Sunday is the first day of the week.
1495        doy: 6, // The week that contains Jan 6th is the first week of the year.
1496    };
1497
1498    function localeFirstDayOfWeek() {
1499        return this._week.dow;
1500    }
1501
1502    function localeFirstDayOfYear() {
1503        return this._week.doy;
1504    }
1505
1506    // MOMENTS
1507
1508    function getSetWeek(input) {
1509        var week = this.localeData().week(this);
1510        return input == null ? week : this.add((input - week) * 7, 'd');
1511    }
1512
1513    function getSetISOWeek(input) {
1514        var week = weekOfYear(this, 1, 4).week;
1515        return input == null ? week : this.add((input - week) * 7, 'd');
1516    }
1517
1518    // FORMATTING
1519
1520    addFormatToken('d', 0, 'do', 'day');
1521
1522    addFormatToken('dd', 0, 0, function (format) {
1523        return this.localeData().weekdaysMin(this, format);
1524    });
1525
1526    addFormatToken('ddd', 0, 0, function (format) {
1527        return this.localeData().weekdaysShort(this, format);
1528    });
1529
1530    addFormatToken('dddd', 0, 0, function (format) {
1531        return this.localeData().weekdays(this, format);
1532    });
1533
1534    addFormatToken('e', 0, 0, 'weekday');
1535    addFormatToken('E', 0, 0, 'isoWeekday');
1536
1537    // PARSING
1538
1539    addRegexToken('d', match1to2);
1540    addRegexToken('e', match1to2);
1541    addRegexToken('E', match1to2);
1542    addRegexToken('dd', function (isStrict, locale) {
1543        return locale.weekdaysMinRegex(isStrict);
1544    });
1545    addRegexToken('ddd', function (isStrict, locale) {
1546        return locale.weekdaysShortRegex(isStrict);
1547    });
1548    addRegexToken('dddd', function (isStrict, locale) {
1549        return locale.weekdaysRegex(isStrict);
1550    });
1551
1552    addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) {
1553        var weekday = config._locale.weekdaysParse(input, token, config._strict);
1554        // if we didn't get a weekday name, mark the date as invalid
1555        if (weekday != null) {
1556            week.d = weekday;
1557        } else {
1558            getParsingFlags(config).invalidWeekday = input;
1559        }
1560    });
1561
1562    addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) {
1563        week[token] = toInt(input);
1564    });
1565
1566    // HELPERS
1567
1568    function parseWeekday(input, locale) {
1569        if (typeof input !== 'string') {
1570            return input;
1571        }
1572
1573        if (!isNaN(input)) {
1574            return parseInt(input, 10);
1575        }
1576
1577        input = locale.weekdaysParse(input);
1578        if (typeof input === 'number') {
1579            return input;
1580        }
1581
1582        return null;
1583    }
1584
1585    function parseIsoWeekday(input, locale) {
1586        if (typeof input === 'string') {
1587            return locale.weekdaysParse(input) % 7 || 7;
1588        }
1589        return isNaN(input) ? null : input;
1590    }
1591
1592    // LOCALES
1593    function shiftWeekdays(ws, n) {
1594        return ws.slice(n, 7).concat(ws.slice(0, n));
1595    }
1596
1597    var defaultLocaleWeekdays =
1598        'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'),
1599        defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),
1600        defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),
1601        defaultWeekdaysRegex = matchWord,
1602        defaultWeekdaysShortRegex = matchWord,
1603        defaultWeekdaysMinRegex = matchWord;
1604
1605    function localeWeekdays(m, format) {
1606        var weekdays = isArray(this._weekdays)
1607            ? this._weekdays
1608            : this._weekdays[
1609            m && m !== true && this._weekdays.isFormat.test(format)
1610                ? 'format'
1611                : 'standalone'
1612            ];
1613        return m === true
1614            ? shiftWeekdays(weekdays, this._week.dow)
1615            : m
1616                ? weekdays[m.day()]
1617                : weekdays;
1618    }
1619
1620    function localeWeekdaysShort(m) {
1621        return m === true
1622            ? shiftWeekdays(this._weekdaysShort, this._week.dow)
1623            : m
1624                ? this._weekdaysShort[m.day()]
1625                : this._weekdaysShort;
1626    }
1627
1628    function localeWeekdaysMin(m) {
1629        return m === true
1630            ? shiftWeekdays(this._weekdaysMin, this._week.dow)
1631            : m
1632                ? this._weekdaysMin[m.day()]
1633                : this._weekdaysMin;
1634    }
1635
1636    function handleStrictParse$1(weekdayName, format, strict) {
1637        var i,
1638            ii,
1639            mom,
1640            llc = weekdayName.toLocaleLowerCase();
1641        if (!this._weekdaysParse) {
1642            this._weekdaysParse = [];
1643            this._shortWeekdaysParse = [];
1644            this._minWeekdaysParse = [];
1645
1646            for (i = 0; i < 7; ++i) {
1647                mom = createUTC([2000, 1]).day(i);
1648                this._minWeekdaysParse[i] = this.weekdaysMin(
1649                    mom,
1650                    ''
1651                ).toLocaleLowerCase();
1652                this._shortWeekdaysParse[i] = this.weekdaysShort(
1653                    mom,
1654                    ''
1655                ).toLocaleLowerCase();
1656                this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase();
1657            }
1658        }
1659
1660        if (strict) {
1661            if (format === 'dddd') {
1662                ii = indexOf.call(this._weekdaysParse, llc);
1663                return ii !== -1 ? ii : null;
1664            } else if (format === 'ddd') {
1665                ii = indexOf.call(this._shortWeekdaysParse, llc);
1666                return ii !== -1 ? ii : null;
1667            } else {
1668                ii = indexOf.call(this._minWeekdaysParse, llc);
1669                return ii !== -1 ? ii : null;
1670            }
1671        } else {
1672            if (format === 'dddd') {
1673                ii = indexOf.call(this._weekdaysParse, llc);
1674                if (ii !== -1) {
1675                    return ii;
1676                }
1677                ii = indexOf.call(this._shortWeekdaysParse, llc);
1678                if (ii !== -1) {
1679                    return ii;
1680                }
1681                ii = indexOf.call(this._minWeekdaysParse, llc);
1682                return ii !== -1 ? ii : null;
1683            } else if (format === 'ddd') {
1684                ii = indexOf.call(this._shortWeekdaysParse, llc);
1685                if (ii !== -1) {
1686                    return ii;
1687                }
1688                ii = indexOf.call(this._weekdaysParse, llc);
1689                if (ii !== -1) {
1690                    return ii;
1691                }
1692                ii = indexOf.call(this._minWeekdaysParse, llc);
1693                return ii !== -1 ? ii : null;
1694            } else {
1695                ii = indexOf.call(this._minWeekdaysParse, llc);
1696                if (ii !== -1) {
1697                    return ii;
1698                }
1699                ii = indexOf.call(this._weekdaysParse, llc);
1700                if (ii !== -1) {
1701                    return ii;
1702                }
1703                ii = indexOf.call(this._shortWeekdaysParse, llc);
1704                return ii !== -1 ? ii : null;
1705            }
1706        }
1707    }
1708
1709    function localeWeekdaysParse(weekdayName, format, strict) {
1710        var i, mom, regex;
1711
1712        if (this._weekdaysParseExact) {
1713            return handleStrictParse$1.call(this, weekdayName, format, strict);
1714        }
1715
1716        if (!this._weekdaysParse) {
1717            this._weekdaysParse = [];
1718            this._minWeekdaysParse = [];
1719            this._shortWeekdaysParse = [];
1720            this._fullWeekdaysParse = [];
1721        }
1722
1723        for (i = 0; i < 7; i++) {
1724            // make the regex if we don't have it already
1725
1726            mom = createUTC([2000, 1]).day(i);
vendor: 10,043 bytes, lines 1727-2028
1727            if (strict && !this._fullWeekdaysParse[i]) {
1728                this._fullWeekdaysParse[i] = new RegExp(
1729                    '^' + this.weekdays(mom, '').replace('.', '\\.?') + '$',
1730                    'i'
1731                );
1732                this._shortWeekdaysParse[i] = new RegExp(
1733                    '^' + this.weekdaysShort(mom, '').replace('.', '\\.?') + '$',
1734                    'i'
1735                );
1736                this._minWeekdaysParse[i] = new RegExp(
1737                    '^' + this.weekdaysMin(mom, '').replace('.', '\\.?') + '$',
1738                    'i'
1739                );
1740            }
1741            if (!this._weekdaysParse[i]) {
1742                regex =
1743                    '^' +
1744                    this.weekdays(mom, '') +
1745                    '|^' +
1746                    this.weekdaysShort(mom, '') +
1747                    '|^' +
1748                    this.weekdaysMin(mom, '');
1749                this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i');
1750            }
1751            // test the regex
1752            if (
1753                strict &&
1754                format === 'dddd' &&
1755                this._fullWeekdaysParse[i].test(weekdayName)
1756            ) {
1757                return i;
1758            } else if (
1759                strict &&
1760                format === 'ddd' &&
1761                this._shortWeekdaysParse[i].test(weekdayName)
1762            ) {
1763                return i;
1764            } else if (
1765                strict &&
1766                format === 'dd' &&
1767                this._minWeekdaysParse[i].test(weekdayName)
1768            ) {
1769                return i;
1770            } else if (!strict && this._weekdaysParse[i].test(weekdayName)) {
1771                return i;
1772            }
1773        }
1774    }
1775
1776    // MOMENTS
1777
1778    function getSetDayOfWeek(input) {
1779        if (!this.isValid()) {
1780            return input != null ? this : NaN;
1781        }
1782
1783        var day = get(this, 'Day');
1784        if (input != null) {
1785            input = parseWeekday(input, this.localeData());
1786            return this.add(input - day, 'd');
1787        } else {
1788            return day;
1789        }
1790    }
1791
1792    function getSetLocaleDayOfWeek(input) {
1793        if (!this.isValid()) {
1794            return input != null ? this : NaN;
1795        }
1796        var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7;
1797        return input == null ? weekday : this.add(input - weekday, 'd');
1798    }
1799
1800    function getSetISODayOfWeek(input) {
1801        if (!this.isValid()) {
1802            return input != null ? this : NaN;
1803        }
1804
1805        // behaves the same as moment#day except
1806        // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6)
1807        // as a setter, sunday should belong to the previous week.
1808
1809        if (input != null) {
1810            var weekday = parseIsoWeekday(input, this.localeData());
1811            return this.day(this.day() % 7 ? weekday : weekday - 7);
1812        } else {
1813            return this.day() || 7;
1814        }
1815    }
1816
1817    function weekdaysRegex(isStrict) {
1818        if (this._weekdaysParseExact) {
1819            if (!hasOwnProp(this, '_weekdaysRegex')) {
1820                computeWeekdaysParse.call(this);
1821            }
1822            if (isStrict) {
1823                return this._weekdaysStrictRegex;
1824            } else {
1825                return this._weekdaysRegex;
1826            }
1827        } else {
1828            if (!hasOwnProp(this, '_weekdaysRegex')) {
1829                this._weekdaysRegex = defaultWeekdaysRegex;
1830            }
1831            return this._weekdaysStrictRegex && isStrict
1832                ? this._weekdaysStrictRegex
1833                : this._weekdaysRegex;
1834        }
1835    }
1836
1837    function weekdaysShortRegex(isStrict) {
1838        if (this._weekdaysParseExact) {
1839            if (!hasOwnProp(this, '_weekdaysRegex')) {
1840                computeWeekdaysParse.call(this);
1841            }
1842            if (isStrict) {
1843                return this._weekdaysShortStrictRegex;
1844            } else {
1845                return this._weekdaysShortRegex;
1846            }
1847        } else {
1848            if (!hasOwnProp(this, '_weekdaysShortRegex')) {
1849                this._weekdaysShortRegex = defaultWeekdaysShortRegex;
1850            }
1851            return this._weekdaysShortStrictRegex && isStrict
1852                ? this._weekdaysShortStrictRegex
1853                : this._weekdaysShortRegex;
1854        }
1855    }
1856
1857    function weekdaysMinRegex(isStrict) {
1858        if (this._weekdaysParseExact) {
1859            if (!hasOwnProp(this, '_weekdaysRegex')) {
1860                computeWeekdaysParse.call(this);
1861            }
1862            if (isStrict) {
1863                return this._weekdaysMinStrictRegex;
1864            } else {
1865                return this._weekdaysMinRegex;
1866            }
1867        } else {
1868            if (!hasOwnProp(this, '_weekdaysMinRegex')) {
1869                this._weekdaysMinRegex = defaultWeekdaysMinRegex;
1870            }
1871            return this._weekdaysMinStrictRegex && isStrict
1872                ? this._weekdaysMinStrictRegex
1873                : this._weekdaysMinRegex;
1874        }
1875    }
1876
1877    function computeWeekdaysParse() {
1878        function cmpLenRev(a, b) {
1879            return b.length - a.length;
1880        }
1881
1882        var minPieces = [],
1883            shortPieces = [],
1884            longPieces = [],
1885            mixedPieces = [],
1886            i,
1887            mom,
1888            minp,
1889            shortp,
1890            longp;
1891        for (i = 0; i < 7; i++) {
1892            // make the regex if we don't have it already
1893            mom = createUTC([2000, 1]).day(i);
1894            minp = regexEscape(this.weekdaysMin(mom, ''));
1895            shortp = regexEscape(this.weekdaysShort(mom, ''));
1896            longp = regexEscape(this.weekdays(mom, ''));
1897            minPieces.push(minp);
1898            shortPieces.push(shortp);
1899            longPieces.push(longp);
1900            mixedPieces.push(minp);
1901            mixedPieces.push(shortp);
1902            mixedPieces.push(longp);
1903        }
1904        // Sorting makes sure if one weekday (or abbr) is a prefix of another it
1905        // will match the longer piece.
1906        minPieces.sort(cmpLenRev);
1907        shortPieces.sort(cmpLenRev);
1908        longPieces.sort(cmpLenRev);
1909        mixedPieces.sort(cmpLenRev);
1910
1911        this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
1912        this._weekdaysShortRegex = this._weekdaysRegex;
1913        this._weekdaysMinRegex = this._weekdaysRegex;
1914
1915        this._weekdaysStrictRegex = new RegExp(
1916            '^(' + longPieces.join('|') + ')',
1917            'i'
1918        );
1919        this._weekdaysShortStrictRegex = new RegExp(
1920            '^(' + shortPieces.join('|') + ')',
1921            'i'
1922        );
1923        this._weekdaysMinStrictRegex = new RegExp(
1924            '^(' + minPieces.join('|') + ')',
1925            'i'
1926        );
1927    }
1928
1929    // FORMATTING
1930
1931    function hFormat() {
1932        return this.hours() % 12 || 12;
1933    }
1934
1935    function kFormat() {
1936        return this.hours() || 24;
1937    }
1938
1939    addFormatToken('H', ['HH', 2], 0, 'hour');
1940    addFormatToken('h', ['hh', 2], 0, hFormat);
1941    addFormatToken('k', ['kk', 2], 0, kFormat);
1942
1943    addFormatToken('hmm', 0, 0, function () {
1944        return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2);
1945    });
1946
1947    addFormatToken('hmmss', 0, 0, function () {
1948        return (
1949            '' +
1950            hFormat.apply(this) +
1951            zeroFill(this.minutes(), 2) +
1952            zeroFill(this.seconds(), 2)
1953        );
1954    });
1955
1956    addFormatToken('Hmm', 0, 0, function () {
1957        return '' + this.hours() + zeroFill(this.minutes(), 2);
1958    });
1959
1960    addFormatToken('Hmmss', 0, 0, function () {
1961        return (
1962            '' +
1963            this.hours() +
1964            zeroFill(this.minutes(), 2) +
1965            zeroFill(this.seconds(), 2)
1966        );
1967    });
1968
1969    function meridiem(token, lowercase) {
1970        addFormatToken(token, 0, 0, function () {
1971            return this.localeData().meridiem(
1972                this.hours(),
1973                this.minutes(),
1974                lowercase
1975            );
1976        });
1977    }
1978
1979    meridiem('a', true);
1980    meridiem('A', false);
1981
1982    // PARSING
1983
1984    function matchMeridiem(isStrict, locale) {
1985        return locale._meridiemParse;
1986    }
1987
1988    addRegexToken('a', matchMeridiem);
1989    addRegexToken('A', matchMeridiem);
1990    addRegexToken('H', match1to2, match1to2HasZero);
1991    addRegexToken('h', match1to2, match1to2NoLeadingZero);
1992    addRegexToken('k', match1to2, match1to2NoLeadingZero);
1993    addRegexToken('HH', match1to2, match2);
1994    addRegexToken('hh', match1to2, match2);
1995    addRegexToken('kk', match1to2, match2);
1996
1997    addRegexToken('hmm', match3to4);
1998    addRegexToken('hmmss', match5to6);
1999    addRegexToken('Hmm', match3to4);
2000    addRegexToken('Hmmss', match5to6);
2001
2002    addParseToken(['H', 'HH'], HOUR);
2003    addParseToken(['k', 'kk'], function (input, array, config) {
2004        var kInput = toInt(input);
2005        array[HOUR] = kInput === 24 ? 0 : kInput;
2006    });
2007    addParseToken(['a', 'A'], function (input, array, config) {
2008        config._isPm = config._locale.isPM(input);
2009        config._meridiem = input;
2010    });
2011    addParseToken(['h', 'hh'], function (input, array, config) {
2012        array[HOUR] = toInt(input);
2013        getParsingFlags(config).bigHour = true;
2014    });
2015    addParseToken('hmm', function (input, array, config) {
2016        var pos = input.length - 2;
2017        array[HOUR] = toInt(input.substr(0, pos));
2018        array[MINUTE] = toInt(input.substr(pos));
2019        getParsingFlags(config).bigHour = true;
2020    });
2021    addParseToken('hmmss', function (input, array, config) {
2022        var pos1 = input.length - 4,
2023            pos2 = input.length - 2;
2024        array[HOUR] = toInt(input.substr(0, pos1));
2025        array[MINUTE] = toInt(input.substr(pos1, 2));
2026        array[SECOND] = toInt(input.substr(pos2));
2027        getParsingFlags(config).bigHour = true;
2028    });
vendor: 14,289 bytes, lines 2029-2412
2029    addParseToken('Hmm', function (input, array, config) {
2030        var pos = input.length - 2;
2031        array[HOUR] = toInt(input.substr(0, pos));
2032        array[MINUTE] = toInt(input.substr(pos));
2033    });
2034    addParseToken('Hmmss', function (input, array, config) {
2035        var pos1 = input.length - 4,
2036            pos2 = input.length - 2;
2037        array[HOUR] = toInt(input.substr(0, pos1));
2038        array[MINUTE] = toInt(input.substr(pos1, 2));
2039        array[SECOND] = toInt(input.substr(pos2));
2040    });
2041
2042    // LOCALES
2043
2044    function localeIsPM(input) {
2045        // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays
2046        // Using charAt should be more compatible.
2047        return (input + '').toLowerCase().charAt(0) === 'p';
2048    }
2049
2050    var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i,
2051        // Setting the hour should keep the time, because the user explicitly
2052        // specified which hour they want. So trying to maintain the same hour (in
2053        // a new timezone) makes sense. Adding/subtracting hours does not follow
2054        // this rule.
2055        getSetHour = makeGetSet('Hours', true);
2056
2057    function localeMeridiem(hours, minutes, isLower) {
2058        if (hours > 11) {
2059            return isLower ? 'pm' : 'PM';
2060        } else {
2061            return isLower ? 'am' : 'AM';
2062        }
2063    }
2064
2065    var baseConfig = {
2066        calendar: defaultCalendar,
2067        longDateFormat: defaultLongDateFormat,
2068        invalidDate: defaultInvalidDate,
2069        ordinal: defaultOrdinal,
2070        dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse,
2071        relativeTime: defaultRelativeTime,
2072
2073        months: defaultLocaleMonths,
2074        monthsShort: defaultLocaleMonthsShort,
2075
2076        week: defaultLocaleWeek,
2077
2078        weekdays: defaultLocaleWeekdays,
2079        weekdaysMin: defaultLocaleWeekdaysMin,
2080        weekdaysShort: defaultLocaleWeekdaysShort,
2081
2082        meridiemParse: defaultLocaleMeridiemParse,
2083    };
2084
2085    // internal storage for locale config files
2086    var locales = {},
2087        localeFamilies = {},
2088        globalLocale;
2089
2090    function commonPrefix(arr1, arr2) {
2091        var i,
2092            minl = Math.min(arr1.length, arr2.length);
2093        for (i = 0; i < minl; i += 1) {
2094            if (arr1[i] !== arr2[i]) {
2095                return i;
2096            }
2097        }
2098        return minl;
2099    }
2100
2101    function normalizeLocale(key) {
2102        return key ? key.toLowerCase().replace('_', '-') : key;
2103    }
2104
2105    // pick the locale from the array
2106    // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each
2107    // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root
2108    function chooseLocale(names) {
2109        var i = 0,
2110            j,
2111            next,
2112            locale,
2113            split;
2114
2115        while (i < names.length) {
2116            split = normalizeLocale(names[i]).split('-');
2117            j = split.length;
2118            next = normalizeLocale(names[i + 1]);
2119            next = next ? next.split('-') : null;
2120            while (j > 0) {
2121                locale = loadLocale(split.slice(0, j).join('-'));
2122                if (locale) {
2123                    return locale;
2124                }
2125                if (
2126                    next &&
2127                    next.length >= j &&
2128                    commonPrefix(split, next) >= j - 1
2129                ) {
2130                    //the next array item is better than a shallower substring of this one
2131                    break;
2132                }
2133                j--;
2134            }
2135            i++;
2136        }
2137        return globalLocale;
2138    }
2139
2140    function isLocaleNameSane(name) {
2141        // Prevent names that look like filesystem paths, i.e contain '/' or '\'
2142        // Ensure name is available and function returns boolean
2143        return !!(name && name.match('^[^/\\\\]*$'));
2144    }
2145
2146    function loadLocale(name) {
2147        var oldLocale = null,
2148            aliasedRequire;
2149        // TODO: Find a better way to register and load all the locales in Node
2150        if (
2151            locales[name] === undefined &&
2152            typeof module !== 'undefined' &&
2153            module &&
2154            module.exports &&
2155            isLocaleNameSane(name)
2156        ) {
2157            try {
2158                oldLocale = globalLocale._abbr;
2159                aliasedRequire = require;
2160                aliasedRequire('./locale/' + name);
2161                getSetGlobalLocale(oldLocale);
2162            } catch (e) {
2163                // mark as not found to avoid repeating expensive file require call causing high CPU
2164                // when trying to find en-US, en_US, en-us for every format call
2165                locales[name] = null; // null means not found
2166            }
2167        }
2168        return locales[name];
2169    }
2170
2171    // This function will load locale and then set the global locale.  If
2172    // no arguments are passed in, it will simply return the current global
2173    // locale key.
2174    function getSetGlobalLocale(key, values) {
2175        var data;
2176        if (key) {
2177            if (isUndefined(values)) {
2178                data = getLocale(key);
2179            } else {
2180                data = defineLocale(key, values);
2181            }
2182
2183            if (data) {
2184                // moment.duration._locale = moment._locale = data;
2185                globalLocale = data;
2186            } else {
2187                if (typeof console !== 'undefined' && console.warn) {
2188                    //warn user if arguments are passed but the locale could not be set
2189                    console.warn(
2190                        'Locale ' + key + ' not found. Did you forget to load it?'
2191                    );
2192                }
2193            }
2194        }
2195
2196        return globalLocale._abbr;
2197    }
2198
2199    function defineLocale(name, config) {
2200        if (config !== null) {
2201            var locale,
2202                parentConfig = baseConfig;
2203            config.abbr = name;
2204            if (locales[name] != null) {
2205                deprecateSimple(
2206                    'defineLocaleOverride',
2207                    'use moment.updateLocale(localeName, config) to change ' +
2208                    'an existing locale. moment.defineLocale(localeName, ' +
2209                    'config) should only be used for creating a new locale ' +
2210                    'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.'
2211                );
2212                parentConfig = locales[name]._config;
2213            } else if (config.parentLocale != null) {
2214                if (locales[config.parentLocale] != null) {
2215                    parentConfig = locales[config.parentLocale]._config;
2216                } else {
2217                    locale = loadLocale(config.parentLocale);
2218                    if (locale != null) {
2219                        parentConfig = locale._config;
2220                    } else {
2221                        if (!localeFamilies[config.parentLocale]) {
2222                            localeFamilies[config.parentLocale] = [];
2223                        }
2224                        localeFamilies[config.parentLocale].push({
2225                            name: name,
2226                            config: config,
2227                        });
2228                        return null;
2229                    }
2230                }
2231            }
2232            locales[name] = new Locale(mergeConfigs(parentConfig, config));
2233
2234            if (localeFamilies[name]) {
2235                localeFamilies[name].forEach(function (x) {
2236                    defineLocale(x.name, x.config);
2237                });
2238            }
2239
2240            // backwards compat for now: also set the locale
2241            // make sure we set the locale AFTER all child locales have been
2242            // created, so we won't end up with the child locale set.
2243            getSetGlobalLocale(name);
2244
2245            return locales[name];
2246        } else {
2247            // useful for testing
2248            delete locales[name];
2249            return null;
2250        }
2251    }
2252
2253    function updateLocale(name, config) {
2254        if (config != null) {
2255            var locale,
2256                tmpLocale,
2257                parentConfig = baseConfig;
2258
2259            if (locales[name] != null && locales[name].parentLocale != null) {
2260                // Update existing child locale in-place to avoid memory-leaks
2261                locales[name].set(mergeConfigs(locales[name]._config, config));
2262            } else {
2263                // MERGE
2264                tmpLocale = loadLocale(name);
2265                if (tmpLocale != null) {
2266                    parentConfig = tmpLocale._config;
2267                }
2268                config = mergeConfigs(parentConfig, config);
2269                if (tmpLocale == null) {
2270                    // updateLocale is called for creating a new locale
2271                    // Set abbr so it will have a name (getters return
2272                    // undefined otherwise).
2273                    config.abbr = name;
2274                }
2275                locale = new Locale(config);
2276                locale.parentLocale = locales[name];
2277                locales[name] = locale;
2278            }
2279
2280            // backwards compat for now: also set the locale
2281            getSetGlobalLocale(name);
2282        } else {
2283            // pass null for config to unupdate, useful for tests
2284            if (locales[name] != null) {
2285                if (locales[name].parentLocale != null) {
2286                    locales[name] = locales[name].parentLocale;
2287                    if (name === getSetGlobalLocale()) {
2288                        getSetGlobalLocale(name);
2289                    }
2290                } else if (locales[name] != null) {
2291                    delete locales[name];
2292                }
2293            }
2294        }
2295        return locales[name];
2296    }
2297
2298    // returns locale data
2299    function getLocale(key) {
2300        var locale;
2301
2302        if (key && key._locale && key._locale._abbr) {
2303            key = key._locale._abbr;
2304        }
2305
2306        if (!key) {
2307            return globalLocale;
2308        }
2309
2310        if (!isArray(key)) {
2311            //short-circuit everything else
2312            locale = loadLocale(key);
2313            if (locale) {
2314                return locale;
2315            }
2316            key = [key];
2317        }
2318
2319        return chooseLocale(key);
2320    }
2321
2322    function listLocales() {
2323        return keys(locales);
2324    }
2325
2326    function checkOverflow(m) {
2327        var overflow,
2328            a = m._a;
2329
2330        if (a && getParsingFlags(m).overflow === -2) {
2331            overflow =
2332                a[MONTH] < 0 || a[MONTH] > 11
2333                    ? MONTH
2334                    : a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH])
2335                        ? DATE
2336                        : a[HOUR] < 0 ||
2337                            a[HOUR] > 24 ||
2338                            (a[HOUR] === 24 &&
2339                                (a[MINUTE] !== 0 ||
2340                                    a[SECOND] !== 0 ||
2341                                    a[MILLISECOND] !== 0))
2342                            ? HOUR
2343                            : a[MINUTE] < 0 || a[MINUTE] > 59
2344                                ? MINUTE
2345                                : a[SECOND] < 0 || a[SECOND] > 59
2346                                    ? SECOND
2347                                    : a[MILLISECOND] < 0 || a[MILLISECOND] > 999
2348                                        ? MILLISECOND
2349                                        : -1;
2350
2351            if (
2352                getParsingFlags(m)._overflowDayOfYear &&
2353                (overflow < YEAR || overflow > DATE)
2354            ) {
2355                overflow = DATE;
2356            }
2357            if (getParsingFlags(m)._overflowWeeks && overflow === -1) {
2358                overflow = WEEK;
2359            }
2360            if (getParsingFlags(m)._overflowWeekday && overflow === -1) {
2361                overflow = WEEKDAY;
2362            }
2363
2364            getParsingFlags(m).overflow = overflow;
2365        }
2366
2367        return m;
2368    }
2369
2370    // iso 8601 regex
2371    // 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00)
2372    var extendedIsoRegex =
2373        /^\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)?)?$/,
2374        basicIsoRegex =
2375            /^\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)?)?$/,
2376        tzRegex = /Z|[+-]\d\d(?::?\d\d)?/,
2377        isoDates = [
2378            ['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/],
2379            ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/],
2380            ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/],
2381            ['GGGG-[W]WW', /\d{4}-W\d\d/, false],
2382            ['YYYY-DDD', /\d{4}-\d{3}/],
2383            ['YYYY-MM', /\d{4}-\d\d/, false],
2384            ['YYYYYYMMDD', /[+-]\d{10}/],
2385            ['YYYYMMDD', /\d{8}/],
2386            ['GGGG[W]WWE', /\d{4}W\d{3}/],
2387            ['GGGG[W]WW', /\d{4}W\d{2}/, false],
2388            ['YYYYDDD', /\d{7}/],
2389            ['YYYYMM', /\d{6}/, false],
2390            ['YYYY', /\d{4}/, false],
2391        ],
2392        // iso time formats and regexes
2393        isoTimes = [
2394            ['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/],
2395            ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/],
2396            ['HH:mm:ss', /\d\d:\d\d:\d\d/],
2397            ['HH:mm', /\d\d:\d\d/],
2398            ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/],
2399            ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/],
2400            ['HHmmss', /\d\d\d\d\d\d/],
2401            ['HHmm', /\d\d\d\d/],
2402            ['HH', /\d\d/],
2403        ],
2404        aspNetJsonRegex = /^\/?Date\((-?\d+)/i,
2405        // RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3
2406        rfc2822 =
2407            /^(?:(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}))$/,
2408        obsOffsets = {
2409            UT: 0,
2410            GMT: 0,
2411            EDT: -4 * 60,
2412            EST: -5 * 60,
vendor: 70,613 bytes, lines 2413-4608
2413            CDT: -5 * 60,
2414            CST: -6 * 60,
2415            MDT: -6 * 60,
2416            MST: -7 * 60,
2417            PDT: -7 * 60,
2418            PST: -8 * 60,
2419        };
2420
2421    // date from iso format
2422    function configFromISO(config) {
2423        var i,
2424            l,
2425            string = config._i,
2426            match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string),
2427            allowTime,
2428            dateFormat,
2429            timeFormat,
2430            tzFormat,
2431            isoDatesLen = isoDates.length,
2432            isoTimesLen = isoTimes.length;
2433
2434        if (match) {
2435            getParsingFlags(config).iso = true;
2436            for (i = 0, l = isoDatesLen; i < l; i++) {
2437                if (isoDates[i][1].exec(match[1])) {
2438                    dateFormat = isoDates[i][0];
2439                    allowTime = isoDates[i][2] !== false;
2440                    break;
2441                }
2442            }
2443            if (dateFormat == null) {
2444                config._isValid = false;
2445                return;
2446            }
2447            if (match[3]) {
2448                for (i = 0, l = isoTimesLen; i < l; i++) {
2449                    if (isoTimes[i][1].exec(match[3])) {
2450                        // match[2] should be 'T' or space
2451                        timeFormat = (match[2] || ' ') + isoTimes[i][0];
2452                        break;
2453                    }
2454                }
2455                if (timeFormat == null) {
2456                    config._isValid = false;
2457                    return;
2458                }
2459            }
2460            if (!allowTime && timeFormat != null) {
2461                config._isValid = false;
2462                return;
2463            }
2464            if (match[4]) {
2465                if (tzRegex.exec(match[4])) {
2466                    tzFormat = 'Z';
2467                } else {
2468                    config._isValid = false;
2469                    return;
2470                }
2471            }
2472            config._f = dateFormat + (timeFormat || '') + (tzFormat || '');
2473            configFromStringAndFormat(config);
2474        } else {
2475            config._isValid = false;
2476        }
2477    }
2478
2479    function extractFromRFC2822Strings(
2480        yearStr,
2481        monthStr,
2482        dayStr,
2483        hourStr,
2484        minuteStr,
2485        secondStr
2486    ) {
2487        var result = [
2488            untruncateYear(yearStr),
2489            defaultLocaleMonthsShort.indexOf(monthStr),
2490            parseInt(dayStr, 10),
2491            parseInt(hourStr, 10),
2492            parseInt(minuteStr, 10),
2493        ];
2494
2495        if (secondStr) {
2496            result.push(parseInt(secondStr, 10));
2497        }
2498
2499        return result;
2500    }
2501
2502    function untruncateYear(yearStr) {
2503        var year = parseInt(yearStr, 10);
2504        if (year <= 49) {
2505            return 2000 + year;
2506        } else if (year <= 999) {
2507            return 1900 + year;
2508        }
2509        return year;
2510    }
2511
2512    function preprocessRFC2822(s) {
2513        // Remove comments and folding whitespace and replace multiple-spaces with a single space
2514        return s
2515            .replace(/\([^()]*\)|[\n\t]/g, ' ')
2516            .replace(/(\s\s+)/g, ' ')
2517            .replace(/^\s\s*/, '')
2518            .replace(/\s\s*$/, '');
2519    }
2520
2521    function checkWeekday(weekdayStr, parsedInput, config) {
2522        if (weekdayStr) {
2523            // TODO: Replace the vanilla JS Date object with an independent day-of-week check.
2524            var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr),
2525                weekdayActual = new Date(
2526                    parsedInput[0],
2527                    parsedInput[1],
2528                    parsedInput[2]
2529                ).getDay();
2530            if (weekdayProvided !== weekdayActual) {
2531                getParsingFlags(config).weekdayMismatch = true;
2532                config._isValid = false;
2533                return false;
2534            }
2535        }
2536        return true;
2537    }
2538
2539    function calculateOffset(obsOffset, militaryOffset, numOffset) {
2540        if (obsOffset) {
2541            return obsOffsets[obsOffset];
2542        } else if (militaryOffset) {
2543            // the only allowed military tz is Z
2544            return 0;
2545        } else {
2546            var hm = parseInt(numOffset, 10),
2547                m = hm % 100,
2548                h = (hm - m) / 100;
2549            return h * 60 + m;
2550        }
2551    }
2552
2553    // date and time from ref 2822 format
2554    function configFromRFC2822(config) {
2555        var match = rfc2822.exec(preprocessRFC2822(config._i)),
2556            parsedArray;
2557        if (match) {
2558            parsedArray = extractFromRFC2822Strings(
2559                match[4],
2560                match[3],
2561                match[2],
2562                match[5],
2563                match[6],
2564                match[7]
2565            );
2566            if (!checkWeekday(match[1], parsedArray, config)) {
2567                return;
2568            }
2569
2570            config._a = parsedArray;
2571            config._tzm = calculateOffset(match[8], match[9], match[10]);
2572
2573            config._d = createUTCDate.apply(null, config._a);
2574            config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
2575
2576            getParsingFlags(config).rfc2822 = true;
2577        } else {
2578            config._isValid = false;
2579        }
2580    }
2581
2582    // date from 1) ASP.NET, 2) ISO, 3) RFC 2822 formats, or 4) optional fallback if parsing isn't strict
2583    function configFromString(config) {
2584        var matched = aspNetJsonRegex.exec(config._i);
2585        if (matched !== null) {
2586            config._d = new Date(+matched[1]);
2587            return;
2588        }
2589
2590        configFromISO(config);
2591        if (config._isValid === false) {
2592            delete config._isValid;
2593        } else {
2594            return;
2595        }
2596
2597        configFromRFC2822(config);
2598        if (config._isValid === false) {
2599            delete config._isValid;
2600        } else {
2601            return;
2602        }
2603
2604        if (config._strict) {
2605            config._isValid = false;
2606        } else {
2607            // Final attempt, use Input Fallback
2608            hooks.createFromInputFallback(config);
2609        }
2610    }
2611
2612    hooks.createFromInputFallback = deprecate(
2613        'value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' +
2614        'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' +
2615        'discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.',
2616        function (config) {
2617            config._d = new Date(config._i + (config._useUTC ? ' UTC' : ''));
2618        }
2619    );
2620
2621    // Pick the first defined of two or three arguments.
2622    function defaults(a, b, c) {
2623        if (a != null) {
2624            return a;
2625        }
2626        if (b != null) {
2627            return b;
2628        }
2629        return c;
2630    }
2631
2632    function currentDateArray(config) {
2633        // hooks is actually the exported moment object
2634        var nowValue = new Date(hooks.now());
2635        if (config._useUTC) {
2636            return [
2637                nowValue.getUTCFullYear(),
2638                nowValue.getUTCMonth(),
2639                nowValue.getUTCDate(),
2640            ];
2641        }
2642        return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()];
2643    }
2644
2645    // convert an array to a date.
2646    // the array should mirror the parameters below
2647    // note: all values past the year are optional and will default to the lowest possible value.
2648    // [year, month, day , hour, minute, second, millisecond]
2649    function configFromArray(config) {
2650        var i,
2651            date,
2652            input = [],
2653            currentDate,
2654            expectedWeekday,
2655            yearToUse;
2656
2657        if (config._d) {
2658            return;
2659        }
2660
2661        currentDate = currentDateArray(config);
2662
2663        //compute day of the year from weeks and weekdays
2664        if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {
2665            dayOfYearFromWeekInfo(config);
2666        }
2667
2668        //if the day of the year is set, figure out what it is
2669        if (config._dayOfYear != null) {
2670            yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);
2671
2672            if (
2673                config._dayOfYear > daysInYear(yearToUse) ||
2674                config._dayOfYear === 0
2675            ) {
2676                getParsingFlags(config)._overflowDayOfYear = true;
2677            }
2678
2679            date = createUTCDate(yearToUse, 0, config._dayOfYear);
2680            config._a[MONTH] = date.getUTCMonth();
2681            config._a[DATE] = date.getUTCDate();
2682        }
2683
2684        // Default to current date.
2685        // * if no year, month, day of month are given, default to today
2686        // * if day of month is given, default month and year
2687        // * if month is given, default only year
2688        // * if year is given, don't default anything
2689        for (i = 0; i < 3 && config._a[i] == null; ++i) {
2690            config._a[i] = input[i] = currentDate[i];
2691        }
2692
2693        // Zero out whatever was not defaulted, including time
2694        for (; i < 7; i++) {
2695            config._a[i] = input[i] =
2696                config._a[i] == null ? (i === 2 ? 1 : 0) : config._a[i];
2697        }
2698
2699        // Check for 24:00:00.000
2700        if (
2701            config._a[HOUR] === 24 &&
2702            config._a[MINUTE] === 0 &&
2703            config._a[SECOND] === 0 &&
2704            config._a[MILLISECOND] === 0
2705        ) {
2706            config._nextDay = true;
2707            config._a[HOUR] = 0;
2708        }
2709
2710        config._d = (config._useUTC ? createUTCDate : createDate).apply(
2711            null,
2712            input
2713        );
2714        expectedWeekday = config._useUTC
2715            ? config._d.getUTCDay()
2716            : config._d.getDay();
2717
2718        // Apply timezone offset from input. The actual utcOffset can be changed
2719        // with parseZone.
2720        if (config._tzm != null) {
2721            config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
2722        }
2723
2724        if (config._nextDay) {
2725            config._a[HOUR] = 24;
2726        }
2727
2728        // check for mismatching day of week
2729        if (
2730            config._w &&
2731            typeof config._w.d !== 'undefined' &&
2732            config._w.d !== expectedWeekday
2733        ) {
2734            getParsingFlags(config).weekdayMismatch = true;
2735        }
2736    }
2737
2738    function dayOfYearFromWeekInfo(config) {
2739        var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow, curWeek;
2740
2741        w = config._w;
2742        if (w.GG != null || w.W != null || w.E != null) {
2743            dow = 1;
2744            doy = 4;
2745
2746            // TODO: We need to take the current isoWeekYear, but that depends on
2747            // how we interpret now (local, utc, fixed offset). So create
2748            // a now version of current config (take local/utc/offset flags, and
2749            // create now).
2750            weekYear = defaults(
2751                w.GG,
2752                config._a[YEAR],
2753                weekOfYear(createLocal(), 1, 4).year
2754            );
2755            week = defaults(w.W, 1);
2756            weekday = defaults(w.E, 1);
2757            if (weekday < 1 || weekday > 7) {
2758                weekdayOverflow = true;
2759            }
2760        } else {
2761            dow = config._locale._week.dow;
2762            doy = config._locale._week.doy;
2763
2764            curWeek = weekOfYear(createLocal(), dow, doy);
2765
2766            weekYear = defaults(w.gg, config._a[YEAR], curWeek.year);
2767
2768            // Default to current week.
2769            week = defaults(w.w, curWeek.week);
2770
2771            if (w.d != null) {
2772                // weekday -- low day numbers are considered next week
2773                weekday = w.d;
2774                if (weekday < 0 || weekday > 6) {
2775                    weekdayOverflow = true;
2776                }
2777            } else if (w.e != null) {
2778                // local weekday -- counting starts from beginning of week
2779                weekday = w.e + dow;
2780                if (w.e < 0 || w.e > 6) {
2781                    weekdayOverflow = true;
2782                }
2783            } else {
2784                // default to beginning of week
2785                weekday = dow;
2786            }
2787        }
2788        if (week < 1 || week > weeksInYear(weekYear, dow, doy)) {
2789            getParsingFlags(config)._overflowWeeks = true;
2790        } else if (weekdayOverflow != null) {
2791            getParsingFlags(config)._overflowWeekday = true;
2792        } else {
2793            temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy);
2794            config._a[YEAR] = temp.year;
2795            config._dayOfYear = temp.dayOfYear;
2796        }
2797    }
2798
2799    // constant that refers to the ISO standard
2800    hooks.ISO_8601 = function () { };
2801
2802    // constant that refers to the RFC 2822 form
2803    hooks.RFC_2822 = function () { };
2804
2805    // date from string and format string
2806    function configFromStringAndFormat(config) {
2807        // TODO: Move this to another part of the creation flow to prevent circular deps
2808        if (config._f === hooks.ISO_8601) {
2809            configFromISO(config);
2810            return;
2811        }
2812        if (config._f === hooks.RFC_2822) {
2813            configFromRFC2822(config);
2814            return;
2815        }
2816        config._a = [];
2817        getParsingFlags(config).empty = true;
2818
2819        // This array is used to make a Date, either with `new Date` or `Date.UTC`
2820        var string = '' + config._i,
2821            i,
2822            parsedInput,
2823            tokens,
2824            token,
2825            skipped,
2826            stringLength = string.length,
2827            totalParsedInputLength = 0,
2828            era,
2829            tokenLen;
2830
2831        tokens =
2832            expandFormat(config._f, config._locale).match(formattingTokens) || [];
2833        tokenLen = tokens.length;
2834        for (i = 0; i < tokenLen; i++) {
2835            token = tokens[i];
2836            parsedInput = (string.match(getParseRegexForToken(token, config)) ||
2837                [])[0];
2838            if (parsedInput) {
2839                skipped = string.substr(0, string.indexOf(parsedInput));
2840                if (skipped.length > 0) {
2841                    getParsingFlags(config).unusedInput.push(skipped);
2842                }
2843                string = string.slice(
2844                    string.indexOf(parsedInput) + parsedInput.length
2845                );
2846                totalParsedInputLength += parsedInput.length;
2847            }
2848            // don't parse if it's not a known token
2849            if (formatTokenFunctions[token]) {
2850                if (parsedInput) {
2851                    getParsingFlags(config).empty = false;
2852                } else {
2853                    getParsingFlags(config).unusedTokens.push(token);
2854                }
2855                addTimeToArrayFromToken(token, parsedInput, config);
2856            } else if (config._strict && !parsedInput) {
2857                getParsingFlags(config).unusedTokens.push(token);
2858            }
2859        }
2860
2861        // add remaining unparsed input length to the string
2862        getParsingFlags(config).charsLeftOver =
2863            stringLength - totalParsedInputLength;
2864        if (string.length > 0) {
2865            getParsingFlags(config).unusedInput.push(string);
2866        }
2867
2868        // clear _12h flag if hour is <= 12
2869        if (
2870            config._a[HOUR] <= 12 &&
2871            getParsingFlags(config).bigHour === true &&
2872            config._a[HOUR] > 0
2873        ) {
2874            getParsingFlags(config).bigHour = undefined;
2875        }
2876
2877        getParsingFlags(config).parsedDateParts = config._a.slice(0);
2878        getParsingFlags(config).meridiem = config._meridiem;
2879        // handle meridiem
2880        config._a[HOUR] = meridiemFixWrap(
2881            config._locale,
2882            config._a[HOUR],
2883            config._meridiem
2884        );
2885
2886        // handle era
2887        era = getParsingFlags(config).era;
2888        if (era !== null) {
2889            config._a[YEAR] = config._locale.erasConvertYear(era, config._a[YEAR]);
2890        }
2891
2892        configFromArray(config);
2893        checkOverflow(config);
2894    }
2895
2896    function meridiemFixWrap(locale, hour, meridiem) {
2897        var isPm;
2898
2899        if (meridiem == null) {
2900            // nothing to do
2901            return hour;
2902        }
2903        if (locale.meridiemHour != null) {
2904            return locale.meridiemHour(hour, meridiem);
2905        } else if (locale.isPM != null) {
2906            // Fallback
2907            isPm = locale.isPM(meridiem);
2908            if (isPm && hour < 12) {
2909                hour += 12;
2910            }
2911            if (!isPm && hour === 12) {
2912                hour = 0;
2913            }
2914            return hour;
2915        } else {
2916            // this is not supposed to happen
2917            return hour;
2918        }
2919    }
2920
2921    // date from string and array of format strings
2922    function configFromStringAndArray(config) {
2923        var tempConfig,
2924            bestMoment,
2925            scoreToBeat,
2926            i,
2927            currentScore,
2928            validFormatFound,
2929            bestFormatIsValid = false,
2930            configfLen = config._f.length;
2931
2932        if (configfLen === 0) {
2933            getParsingFlags(config).invalidFormat = true;
2934            config._d = new Date(NaN);
2935            return;
2936        }
2937
2938        for (i = 0; i < configfLen; i++) {
2939            currentScore = 0;
2940            validFormatFound = false;
2941            tempConfig = copyConfig({}, config);
2942            if (config._useUTC != null) {
2943                tempConfig._useUTC = config._useUTC;
2944            }
2945            tempConfig._f = config._f[i];
2946            configFromStringAndFormat(tempConfig);
2947
2948            if (isValid(tempConfig)) {
2949                validFormatFound = true;
2950            }
2951
2952            // if there is any input that was not parsed add a penalty for that format
2953            currentScore += getParsingFlags(tempConfig).charsLeftOver;
2954
2955            //or tokens
2956            currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10;
2957
2958            getParsingFlags(tempConfig).score = currentScore;
2959
2960            if (!bestFormatIsValid) {
2961                if (
2962                    scoreToBeat == null ||
2963                    currentScore < scoreToBeat ||
2964                    validFormatFound
2965                ) {
2966                    scoreToBeat = currentScore;
2967                    bestMoment = tempConfig;
2968                    if (validFormatFound) {
2969                        bestFormatIsValid = true;
2970                    }
2971                }
2972            } else {
2973                if (currentScore < scoreToBeat) {
2974                    scoreToBeat = currentScore;
2975                    bestMoment = tempConfig;
2976                }
2977            }
2978        }
2979
2980        extend(config, bestMoment || tempConfig);
2981    }
2982
2983    function configFromObject(config) {
2984        if (config._d) {
2985            return;
2986        }
2987
2988        var i = normalizeObjectUnits(config._i),
2989            dayOrDate = i.day === undefined ? i.date : i.day;
2990        config._a = map(
2991            [i.year, i.month, dayOrDate, i.hour, i.minute, i.second, i.millisecond],
2992            function (obj) {
2993                return obj && parseInt(obj, 10);
2994            }
2995        );
2996
2997        configFromArray(config);
2998    }
2999
3000    function createFromConfig(config) {
3001        var res = new Moment(checkOverflow(prepareConfig(config)));
3002        if (res._nextDay) {
3003            // Adding is smart enough around DST
3004            res.add(1, 'd');
3005            res._nextDay = undefined;
3006        }
3007
3008        return res;
3009    }
3010
3011    function prepareConfig(config) {
3012        var input = config._i,
3013            format = config._f;
3014
3015        config._locale = config._locale || getLocale(config._l);
3016
3017        if (input === null || (format === undefined && input === '')) {
3018            return createInvalid({ nullInput: true });
3019        }
3020
3021        if (typeof input === 'string') {
3022            config._i = input = config._locale.preparse(input);
3023        }
3024
3025        if (isMoment(input)) {
3026            return new Moment(checkOverflow(input));
3027        } else if (isDate(input)) {
3028            config._d = input;
3029        } else if (isArray(format)) {
3030            configFromStringAndArray(config);
3031        } else if (format) {
3032            configFromStringAndFormat(config);
3033        } else {
3034            configFromInput(config);
3035        }
3036
3037        if (!isValid(config)) {
3038            config._d = null;
3039        }
3040
3041        return config;
3042    }
3043
3044    function configFromInput(config) {
3045        var input = config._i;
3046        if (isUndefined(input)) {
3047            config._d = new Date(hooks.now());
3048        } else if (isDate(input)) {
3049            config._d = new Date(input.valueOf());
3050        } else if (typeof input === 'string') {
3051            configFromString(config);
3052        } else if (isArray(input)) {
3053            config._a = map(input.slice(0), function (obj) {
3054                return parseInt(obj, 10);
3055            });
3056            configFromArray(config);
3057        } else if (isObject(input)) {
3058            configFromObject(config);
3059        } else if (isNumber(input)) {
3060            // from milliseconds
3061            config._d = new Date(input);
3062        } else {
3063            hooks.createFromInputFallback(config);
3064        }
3065    }
3066
3067    function createLocalOrUTC(input, format, locale, strict, isUTC) {
3068        var c = {};
3069
3070        if (format === true || format === false) {
3071            strict = format;
3072            format = undefined;
3073        }
3074
3075        if (locale === true || locale === false) {
3076            strict = locale;
3077            locale = undefined;
3078        }
3079
3080        if (
3081            (isObject(input) && isObjectEmpty(input)) ||
3082            (isArray(input) && input.length === 0)
3083        ) {
3084            input = undefined;
3085        }
3086        // object construction must be done this way.
3087        // https://github.com/moment/moment/issues/1423
3088        c._isAMomentObject = true;
3089        c._useUTC = c._isUTC = isUTC;
3090        c._l = locale;
3091        c._i = input;
3092        c._f = format;
3093        c._strict = strict;
3094
3095        return createFromConfig(c);
3096    }
3097
3098    function createLocal(input, format, locale, strict) {
3099        return createLocalOrUTC(input, format, locale, strict, false);
3100    }
3101
3102    var prototypeMin = deprecate(
3103        'moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/',
3104        function () {
3105            var other = createLocal.apply(null, arguments);
3106            if (this.isValid() && other.isValid()) {
3107                return other < this ? this : other;
3108            } else {
3109                return createInvalid();
3110            }
3111        }
3112    ),
3113        prototypeMax = deprecate(
3114            'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/',
3115            function () {
3116                var other = createLocal.apply(null, arguments);
3117                if (this.isValid() && other.isValid()) {
3118                    return other > this ? this : other;
3119                } else {
3120                    return createInvalid();
3121                }
3122            }
3123        );
3124
3125    // Pick a moment m from moments so that m[fn](other) is true for all
3126    // other. This relies on the function fn to be transitive.
3127    //
3128    // moments should either be an array of moment objects or an array, whose
3129    // first element is an array of moment objects.
3130    function pickBy(fn, moments) {
3131        var res, i;
3132        if (moments.length === 1 && isArray(moments[0])) {
3133            moments = moments[0];
3134        }
3135        if (!moments.length) {
3136            return createLocal();
3137        }
3138        res = moments[0];
3139        for (i = 1; i < moments.length; ++i) {
3140            if (!moments[i].isValid() || moments[i][fn](res)) {
3141                res = moments[i];
3142            }
3143        }
3144        return res;
3145    }
3146
3147    // TODO: Use [].sort instead?
3148    function min() {
3149        var args = [].slice.call(arguments, 0);
3150
3151        return pickBy('isBefore', args);
3152    }
3153
3154    function max() {
3155        var args = [].slice.call(arguments, 0);
3156
3157        return pickBy('isAfter', args);
3158    }
3159
3160    var now = function () {
3161        return Date.now ? Date.now() : +new Date();
3162    };
3163
3164    var ordering = [
3165        'year',
3166        'quarter',
3167        'month',
3168        'week',
3169        'day',
3170        'hour',
3171        'minute',
3172        'second',
3173        'millisecond',
3174    ];
3175
3176    function isDurationValid(m) {
3177        var key,
3178            unitHasDecimal = false,
3179            i,
3180            orderLen = ordering.length;
3181        for (key in m) {
3182            if (
3183                hasOwnProp(m, key) &&
3184                !(
3185                    indexOf.call(ordering, key) !== -1 &&
3186                    (m[key] == null || !isNaN(m[key]))
3187                )
3188            ) {
3189                return false;
3190            }
3191        }
3192
3193        for (i = 0; i < orderLen; ++i) {
3194            if (m[ordering[i]]) {
3195                if (unitHasDecimal) {
3196                    return false; // only allow non-integers for smallest unit
3197                }
3198                if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) {
3199                    unitHasDecimal = true;
3200                }
3201            }
3202        }
3203
3204        return true;
3205    }
3206
3207    function isValid$1() {
3208        return this._isValid;
3209    }
3210
3211    function createInvalid$1() {
3212        return createDuration(NaN);
3213    }
3214
3215    function Duration(duration) {
3216        var normalizedInput = normalizeObjectUnits(duration),
3217            years = normalizedInput.year || 0,
3218            quarters = normalizedInput.quarter || 0,
3219            months = normalizedInput.month || 0,
3220            weeks = normalizedInput.week || normalizedInput.isoWeek || 0,
3221            days = normalizedInput.day || 0,
3222            hours = normalizedInput.hour || 0,
3223            minutes = normalizedInput.minute || 0,
3224            seconds = normalizedInput.second || 0,
3225            milliseconds = normalizedInput.millisecond || 0;
3226
3227        this._isValid = isDurationValid(normalizedInput);
3228
3229        // representation for dateAddRemove
3230        this._milliseconds =
3231            +milliseconds +
3232            seconds * 1e3 + // 1000
3233            minutes * 6e4 + // 1000 * 60
3234            hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978
3235        // Because of dateAddRemove treats 24 hours as different from a
3236        // day when working around DST, we need to store them separately
3237        this._days = +days + weeks * 7;
3238        // It is impossible to translate months into days without knowing
3239        // which months you are are talking about, so we have to store
3240        // it separately.
3241        this._months = +months + quarters * 3 + years * 12;
3242
3243        this._data = {};
3244
3245        this._locale = getLocale();
3246
3247        this._bubble();
3248    }
3249
3250    function isDuration(obj) {
3251        return obj instanceof Duration;
3252    }
3253
3254    function absRound(number) {
3255        if (number < 0) {
3256            return Math.round(-1 * number) * -1;
3257        } else {
3258            return Math.round(number);
3259        }
3260    }
3261
3262    // compare two arrays, return the number of differences
3263    function compareArrays(array1, array2, dontConvert) {
3264        var len = Math.min(array1.length, array2.length),
3265            lengthDiff = Math.abs(array1.length - array2.length),
3266            diffs = 0,
3267            i;
3268        for (i = 0; i < len; i++) {
3269            if (
3270                (dontConvert && array1[i] !== array2[i]) ||
3271                (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))
3272            ) {
3273                diffs++;
3274            }
3275        }
3276        return diffs + lengthDiff;
3277    }
3278
3279    // FORMATTING
3280
3281    function offset(token, separator) {
3282        addFormatToken(token, 0, 0, function () {
3283            var offset = this.utcOffset(),
3284                sign = '+';
3285            if (offset < 0) {
3286                offset = -offset;
3287                sign = '-';
3288            }
3289            return (
3290                sign +
3291                zeroFill(~~(offset / 60), 2) +
3292                separator +
3293                zeroFill(~~offset % 60, 2)
3294            );
3295        });
3296    }
3297
3298    offset('Z', ':');
3299    offset('ZZ', '');
3300
3301    // PARSING
3302
3303    addRegexToken('Z', matchShortOffset);
3304    addRegexToken('ZZ', matchShortOffset);
3305    addParseToken(['Z', 'ZZ'], function (input, array, config) {
3306        config._useUTC = true;
3307        config._tzm = offsetFromString(matchShortOffset, input);
3308    });
3309
3310    // HELPERS
3311
3312    // timezone chunker
3313    // '+10:00' > ['10',  '00']
3314    // '-1530'  > ['-15', '30']
3315    var chunkOffset = /([\+\-]|\d\d)/gi;
3316
3317    function offsetFromString(matcher, string) {
3318        var matches = (string || '').match(matcher),
3319            chunk,
3320            parts,
3321            minutes;
3322
3323        if (matches === null) {
3324            return null;
3325        }
3326
3327        chunk = matches[matches.length - 1] || [];
3328        parts = (chunk + '').match(chunkOffset) || ['-', 0, 0];
3329        minutes = +(parts[1] * 60) + toInt(parts[2]);
3330
3331        return minutes === 0 ? 0 : parts[0] === '+' ? minutes : -minutes;
3332    }
3333
3334    // Return a moment from input, that is local/utc/zone equivalent to model.
3335    function cloneWithOffset(input, model) {
3336        var res, diff;
3337        if (model._isUTC) {
3338            res = model.clone();
3339            diff =
3340                (isMoment(input) || isDate(input)
3341                    ? input.valueOf()
3342                    : createLocal(input).valueOf()) - res.valueOf();
3343            // Use low-level api, because this fn is low-level api.
3344            res._d.setTime(res._d.valueOf() + diff);
3345            hooks.updateOffset(res, false);
3346            return res;
3347        } else {
3348            return createLocal(input).local();
3349        }
3350    }
3351
3352    function getDateOffset(m) {
3353        // On Firefox.24 Date#getTimezoneOffset returns a floating point.
3354        // https://github.com/moment/moment/pull/1871
3355        return -Math.round(m._d.getTimezoneOffset());
3356    }
3357
3358    // HOOKS
3359
3360    // This function will be called whenever a moment is mutated.
3361    // It is intended to keep the offset in sync with the timezone.
3362    hooks.updateOffset = function () { };
3363
3364    // MOMENTS
3365
3366    // keepLocalTime = true means only change the timezone, without
3367    // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]-->
3368    // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset
3369    // +0200, so we adjust the time as needed, to be valid.
3370    //
3371    // Keeping the time actually adds/subtracts (one hour)
3372    // from the actual represented time. That is why we call updateOffset
3373    // a second time. In case it wants us to change the offset again
3374    // _changeInProgress == true case, then we have to adjust, because
3375    // there is no such time in the given timezone.
3376    function getSetOffset(input, keepLocalTime, keepMinutes) {
3377        var offset = this._offset || 0,
3378            localAdjust;
3379        if (!this.isValid()) {
3380            return input != null ? this : NaN;
3381        }
3382        if (input != null) {
3383            if (typeof input === 'string') {
3384                input = offsetFromString(matchShortOffset, input);
3385                if (input === null) {
3386                    return this;
3387                }
3388            } else if (Math.abs(input) < 16 && !keepMinutes) {
3389                input = input * 60;
3390            }
3391            if (!this._isUTC && keepLocalTime) {
3392                localAdjust = getDateOffset(this);
3393            }
3394            this._offset = input;
3395            this._isUTC = true;
3396            if (localAdjust != null) {
3397                this.add(localAdjust, 'm');
3398            }
3399            if (offset !== input) {
3400                if (!keepLocalTime || this._changeInProgress) {
3401                    addSubtract(
3402                        this,
3403                        createDuration(input - offset, 'm'),
3404                        1,
3405                        false
3406                    );
3407                } else if (!this._changeInProgress) {
3408                    this._changeInProgress = true;
3409                    hooks.updateOffset(this, true);
3410                    this._changeInProgress = null;
3411                }
3412            }
3413            return this;
3414        } else {
3415            return this._isUTC ? offset : getDateOffset(this);
3416        }
3417    }
3418
3419    function getSetZone(input, keepLocalTime) {
3420        if (input != null) {
3421            if (typeof input !== 'string') {
3422                input = -input;
3423            }
3424
3425            this.utcOffset(input, keepLocalTime);
3426
3427            return this;
3428        } else {
3429            return -this.utcOffset();
3430        }
3431    }
3432
3433    function setOffsetToUTC(keepLocalTime) {
3434        return this.utcOffset(0, keepLocalTime);
3435    }
3436
3437    function setOffsetToLocal(keepLocalTime) {
3438        if (this._isUTC) {
3439            this.utcOffset(0, keepLocalTime);
3440            this._isUTC = false;
3441
3442            if (keepLocalTime) {
3443                this.subtract(getDateOffset(this), 'm');
3444            }
3445        }
3446        return this;
3447    }
3448
3449    function setOffsetToParsedOffset() {
3450        if (this._tzm != null) {
3451            this.utcOffset(this._tzm, false, true);
3452        } else if (typeof this._i === 'string') {
3453            var tZone = offsetFromString(matchOffset, this._i);
3454            if (tZone != null) {
3455                this.utcOffset(tZone);
3456            } else {
3457                this.utcOffset(0, true);
3458            }
3459        }
3460        return this;
3461    }
3462
3463    function hasAlignedHourOffset(input) {
3464        if (!this.isValid()) {
3465            return false;
3466        }
3467        input = input ? createLocal(input).utcOffset() : 0;
3468
3469        return (this.utcOffset() - input) % 60 === 0;
3470    }
3471
3472    function isDaylightSavingTime() {
3473        return (
3474            this.utcOffset() > this.clone().month(0).utcOffset() ||
3475            this.utcOffset() > this.clone().month(5).utcOffset()
3476        );
3477    }
3478
3479    function isDaylightSavingTimeShifted() {
3480        if (!isUndefined(this._isDSTShifted)) {
3481            return this._isDSTShifted;
3482        }
3483
3484        var c = {},
3485            other;
3486
3487        copyConfig(c, this);
3488        c = prepareConfig(c);
3489
3490        if (c._a) {
3491            other = c._isUTC ? createUTC(c._a) : createLocal(c._a);
3492            this._isDSTShifted =
3493                this.isValid() && compareArrays(c._a, other.toArray()) > 0;
3494        } else {
3495            this._isDSTShifted = false;
3496        }
3497
3498        return this._isDSTShifted;
3499    }
3500
3501    function isLocal() {
3502        return this.isValid() ? !this._isUTC : false;
3503    }
3504
3505    function isUtcOffset() {
3506        return this.isValid() ? this._isUTC : false;
3507    }
3508
3509    function isUtc() {
3510        return this.isValid() ? this._isUTC && this._offset === 0 : false;
3511    }
3512
3513    // ASP.NET json date format regex
3514    var aspNetRegex = /^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,
3515        // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html
3516        // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere
3517        // and further modified to allow for strings containing both week and day
3518        isoRegex =
3519            /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;
3520
3521    function createDuration(input, key) {
3522        var duration = input,
3523            // matching against regexp is expensive, do it on demand
3524            match = null,
3525            sign,
3526            ret,
3527            diffRes;
3528
3529        if (isDuration(input)) {
3530            duration = {
3531                ms: input._milliseconds,
3532                d: input._days,
3533                M: input._months,
3534            };
3535        } else if (isNumber(input) || !isNaN(+input)) {
3536            duration = {};
3537            if (key) {
3538                duration[key] = +input;
3539            } else {
3540                duration.milliseconds = +input;
3541            }
3542        } else if ((match = aspNetRegex.exec(input))) {
3543            sign = match[1] === '-' ? -1 : 1;
3544            duration = {
3545                y: 0,
3546                d: toInt(match[DATE]) * sign,
3547                h: toInt(match[HOUR]) * sign,
3548                m: toInt(match[MINUTE]) * sign,
3549                s: toInt(match[SECOND]) * sign,
3550                ms: toInt(absRound(match[MILLISECOND] * 1000)) * sign, // the millisecond decimal point is included in the match
3551            };
3552        } else if ((match = isoRegex.exec(input))) {
3553            sign = match[1] === '-' ? -1 : 1;
3554            duration = {
3555                y: parseIso(match[2], sign),
3556                M: parseIso(match[3], sign),
3557                w: parseIso(match[4], sign),
3558                d: parseIso(match[5], sign),
3559                h: parseIso(match[6], sign),
3560                m: parseIso(match[7], sign),
3561                s: parseIso(match[8], sign),
3562            };
3563        } else if (duration == null) {
3564            // checks for null or undefined
3565            duration = {};
3566        } else if (
3567            typeof duration === 'object' &&
3568            ('from' in duration || 'to' in duration)
3569        ) {
3570            diffRes = momentsDifference(
3571                createLocal(duration.from),
3572                createLocal(duration.to)
3573            );
3574
3575            duration = {};
3576            duration.ms = diffRes.milliseconds;
3577            duration.M = diffRes.months;
3578        }
3579
3580        ret = new Duration(duration);
3581
3582        if (isDuration(input) && hasOwnProp(input, '_locale')) {
3583            ret._locale = input._locale;
3584        }
3585
3586        if (isDuration(input) && hasOwnProp(input, '_isValid')) {
3587            ret._isValid = input._isValid;
3588        }
3589
3590        return ret;
3591    }
3592
3593    createDuration.fn = Duration.prototype;
3594    createDuration.invalid = createInvalid$1;
3595
3596    function parseIso(inp, sign) {
3597        // We'd normally use ~~inp for this, but unfortunately it also
3598        // converts floats to ints.
3599        // inp may be undefined, so careful calling replace on it.
3600        var res = inp && parseFloat(inp.replace(',', '.'));
3601        // apply sign while we're at it
3602        return (isNaN(res) ? 0 : res) * sign;
3603    }
3604
3605    function positiveMomentsDifference(base, other) {
3606        var res = {};
3607
3608        res.months =
3609            other.month() - base.month() + (other.year() - base.year()) * 12;
3610        if (base.clone().add(res.months, 'M').isAfter(other)) {
3611            --res.months;
3612        }
3613
3614        res.milliseconds = +other - +base.clone().add(res.months, 'M');
3615
3616        return res;
3617    }
3618
3619    function momentsDifference(base, other) {
3620        var res;
3621        if (!(base.isValid() && other.isValid())) {
3622            return { milliseconds: 0, months: 0 };
3623        }
3624
3625        other = cloneWithOffset(other, base);
3626        if (base.isBefore(other)) {
3627            res = positiveMomentsDifference(base, other);
3628        } else {
3629            res = positiveMomentsDifference(other, base);
3630            res.milliseconds = -res.milliseconds;
3631            res.months = -res.months;
3632        }
3633
3634        return res;
3635    }
3636
3637    // TODO: remove 'name' arg after deprecation is removed
3638    function createAdder(direction, name) {
3639        return function (val, period) {
3640            var dur, tmp;
3641            //invert the arguments, but complain about it
3642            if (period !== null && !isNaN(+period)) {
3643                deprecateSimple(
3644                    name,
3645                    'moment().' +
3646                    name +
3647                    '(period, number) is deprecated. Please use moment().' +
3648                    name +
3649                    '(number, period). ' +
3650                    'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.'
3651                );
3652                tmp = val;
3653                val = period;
3654                period = tmp;
3655            }
3656
3657            dur = createDuration(val, period);
3658            addSubtract(this, dur, direction);
3659            return this;
3660        };
3661    }
3662
3663    function addSubtract(mom, duration, isAdding, updateOffset) {
3664        var milliseconds = duration._milliseconds,
3665            days = absRound(duration._days),
3666            months = absRound(duration._months);
3667
3668        if (!mom.isValid()) {
3669            // No op
3670            return;
3671        }
3672
3673        updateOffset = updateOffset == null ? true : updateOffset;
3674
3675        if (months) {
3676            setMonth(mom, get(mom, 'Month') + months * isAdding);
3677        }
3678        if (days) {
3679            set$1(mom, 'Date', get(mom, 'Date') + days * isAdding);
3680        }
3681        if (milliseconds) {
3682            mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding);
3683        }
3684        if (updateOffset) {
3685            hooks.updateOffset(mom, days || months);
3686        }
3687    }
3688
3689    var add = createAdder(1, 'add'),
3690        subtract = createAdder(-1, 'subtract');
3691
3692    function isString(input) {
3693        return typeof input === 'string' || input instanceof String;
3694    }
3695
3696    // type MomentInput = Moment | Date | string | number | (number | string)[] | MomentInputObject | void; // null | undefined
3697    function isMomentInput(input) {
3698        return (
3699            isMoment(input) ||
3700            isDate(input) ||
3701            isString(input) ||
3702            isNumber(input) ||
3703            isNumberOrStringArray(input) ||
3704            isMomentInputObject(input) ||
3705            input === null ||
3706            input === undefined
3707        );
3708    }
3709
3710    function isMomentInputObject(input) {
3711        var objectTest = isObject(input) && !isObjectEmpty(input),
3712            propertyTest = false,
3713            properties = [
3714                'years',
3715                'year',
3716                'y',
3717                'months',
3718                'month',
3719                'M',
3720                'days',
3721                'day',
3722                'd',
3723                'dates',
3724                'date',
3725                'D',
3726                'hours',
3727                'hour',
3728                'h',
3729                'minutes',
3730                'minute',
3731                'm',
3732                'seconds',
3733                'second',
3734                's',
3735                'milliseconds',
3736                'millisecond',
3737                'ms',
3738            ],
3739            i,
3740            property,
3741            propertyLen = properties.length;
3742
3743        for (i = 0; i < propertyLen; i += 1) {
3744            property = properties[i];
3745            propertyTest = propertyTest || hasOwnProp(input, property);
3746        }
3747
3748        return objectTest && propertyTest;
3749    }
3750
3751    function isNumberOrStringArray(input) {
3752        var arrayTest = isArray(input),
3753            dataTypeTest = false;
3754        if (arrayTest) {
3755            dataTypeTest =
3756                input.filter(function (item) {
3757                    return !isNumber(item) && isString(input);
3758                }).length === 0;
3759        }
3760        return arrayTest && dataTypeTest;
3761    }
3762
3763    function isCalendarSpec(input) {
3764        var objectTest = isObject(input) && !isObjectEmpty(input),
3765            propertyTest = false,
3766            properties = [
3767                'sameDay',
3768                'nextDay',
3769                'lastDay',
3770                'nextWeek',
3771                'lastWeek',
3772                'sameElse',
3773            ],
3774            i,
3775            property;
3776
3777        for (i = 0; i < properties.length; i += 1) {
3778            property = properties[i];
3779            propertyTest = propertyTest || hasOwnProp(input, property);
3780        }
3781
3782        return objectTest && propertyTest;
3783    }
3784
3785    function getCalendarFormat(myMoment, now) {
3786        var diff = myMoment.diff(now, 'days', true);
3787        return diff < -6
3788            ? 'sameElse'
3789            : diff < -1
3790                ? 'lastWeek'
3791                : diff < 0
3792                    ? 'lastDay'
3793                    : diff < 1
3794                        ? 'sameDay'
3795                        : diff < 2
3796                            ? 'nextDay'
3797                            : diff < 7
3798                                ? 'nextWeek'
3799                                : 'sameElse';
3800    }
3801
3802    function calendar$1(time, formats) {
3803        // Support for single parameter, formats only overload to the calendar function
3804        if (arguments.length === 1) {
3805            if (!arguments[0]) {
3806                time = undefined;
3807                formats = undefined;
3808            } else if (isMomentInput(arguments[0])) {
3809                time = arguments[0];
3810                formats = undefined;
3811            } else if (isCalendarSpec(arguments[0])) {
3812                formats = arguments[0];
3813                time = undefined;
3814            }
3815        }
3816        // We want to compare the start of today, vs this.
3817        // Getting start-of-today depends on whether we're local/utc/offset or not.
3818        var now = time || createLocal(),
3819            sod = cloneWithOffset(now, this).startOf('day'),
3820            format = hooks.calendarFormat(this, sod) || 'sameElse',
3821            output =
3822                formats &&
3823                (isFunction(formats[format])
3824                    ? formats[format].call(this, now)
3825                    : formats[format]);
3826
3827        return this.format(
3828            output || this.localeData().calendar(format, this, createLocal(now))
3829        );
3830    }
3831
3832    function clone() {
3833        return new Moment(this);
3834    }
3835
3836    function isAfter(input, units) {
3837        var localInput = isMoment(input) ? input : createLocal(input);
3838        if (!(this.isValid() && localInput.isValid())) {
3839            return false;
3840        }
3841        units = normalizeUnits(units) || 'millisecond';
3842        if (units === 'millisecond') {
3843            return this.valueOf() > localInput.valueOf();
3844        } else {
3845            return localInput.valueOf() < this.clone().startOf(units).valueOf();
3846        }
3847    }
3848
3849    function isBefore(input, units) {
3850        var localInput = isMoment(input) ? input : createLocal(input);
3851        if (!(this.isValid() && localInput.isValid())) {
3852            return false;
3853        }
3854        units = normalizeUnits(units) || 'millisecond';
3855        if (units === 'millisecond') {
3856            return this.valueOf() < localInput.valueOf();
3857        } else {
3858            return this.clone().endOf(units).valueOf() < localInput.valueOf();
3859        }
3860    }
3861
3862    function isBetween(from, to, units, inclusivity) {
3863        var localFrom = isMoment(from) ? from : createLocal(from),
3864            localTo = isMoment(to) ? to : createLocal(to);
3865        if (!(this.isValid() && localFrom.isValid() && localTo.isValid())) {
3866            return false;
3867        }
3868        inclusivity = inclusivity || '()';
3869        return (
3870            (inclusivity[0] === '('
3871                ? this.isAfter(localFrom, units)
3872                : !this.isBefore(localFrom, units)) &&
3873            (inclusivity[1] === ')'
3874                ? this.isBefore(localTo, units)
3875                : !this.isAfter(localTo, units))
3876        );
3877    }
3878
3879    function isSame(input, units) {
3880        var localInput = isMoment(input) ? input : createLocal(input),
3881            inputMs;
3882        if (!(this.isValid() && localInput.isValid())) {
3883            return false;
3884        }
3885        units = normalizeUnits(units) || 'millisecond';
3886        if (units === 'millisecond') {
3887            return this.valueOf() === localInput.valueOf();
3888        } else {
3889            inputMs = localInput.valueOf();
3890            return (
3891                this.clone().startOf(units).valueOf() <= inputMs &&
3892                inputMs <= this.clone().endOf(units).valueOf()
3893            );
3894        }
3895    }
3896
3897    function isSameOrAfter(input, units) {
3898        return this.isSame(input, units) || this.isAfter(input, units);
3899    }
3900
3901    function isSameOrBefore(input, units) {
3902        return this.isSame(input, units) || this.isBefore(input, units);
3903    }
3904
3905    function diff(input, units, asFloat) {
3906        var that, zoneDelta, output;
3907
3908        if (!this.isValid()) {
3909            return NaN;
3910        }
3911
3912        that = cloneWithOffset(input, this);
3913
3914        if (!that.isValid()) {
3915            return NaN;
3916        }
3917
3918        zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4;
3919
3920        units = normalizeUnits(units);
3921
3922        switch (units) {
3923            case 'year':
3924                output = monthDiff(this, that) / 12;
3925                break;
3926            case 'month':
3927                output = monthDiff(this, that);
3928                break;
3929            case 'quarter':
3930                output = monthDiff(this, that) / 3;
3931                break;
3932            case 'second':
3933                output = (this - that) / 1e3;
3934                break; // 1000
3935            case 'minute':
3936                output = (this - that) / 6e4;
3937                break; // 1000 * 60
3938            case 'hour':
3939                output = (this - that) / 36e5;
3940                break; // 1000 * 60 * 60
3941            case 'day':
3942                output = (this - that - zoneDelta) / 864e5;
3943                break; // 1000 * 60 * 60 * 24, negate dst
3944            case 'week':
3945                output = (this - that - zoneDelta) / 6048e5;
3946                break; // 1000 * 60 * 60 * 24 * 7, negate dst
3947            default:
3948                output = this - that;
3949        }
3950
3951        return asFloat ? output : absFloor(output);
3952    }
3953
3954    function monthDiff(a, b) {
3955        if (a.date() < b.date()) {
3956            // end-of-month calculations work correct when the start month has more
3957            // days than the end month.
3958            return -monthDiff(b, a);
3959        }
3960        // difference in months
3961        var wholeMonthDiff = (b.year() - a.year()) * 12 + (b.month() - a.month()),
3962            // b is in (anchor - 1 month, anchor + 1 month)
3963            anchor = a.clone().add(wholeMonthDiff, 'months'),
3964            anchor2,
3965            adjust;
3966
3967        if (b - anchor < 0) {
3968            anchor2 = a.clone().add(wholeMonthDiff - 1, 'months');
3969            // linear across the month
3970            adjust = (b - anchor) / (anchor - anchor2);
3971        } else {
3972            anchor2 = a.clone().add(wholeMonthDiff + 1, 'months');
3973            // linear across the month
3974            adjust = (b - anchor) / (anchor2 - anchor);
3975        }
3976
3977        //check for negative zero, return zero if negative zero
3978        return -(wholeMonthDiff + adjust) || 0;
3979    }
3980
3981    hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ';
3982    hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]';
3983
3984    function toString() {
3985        return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ');
3986    }
3987
3988    function toISOString(keepOffset) {
3989        if (!this.isValid()) {
3990            return null;
3991        }
3992        var utc = keepOffset !== true,
3993            m = utc ? this.clone().utc() : this;
3994        if (m.year() < 0 || m.year() > 9999) {
3995            return formatMoment(
3996                m,
3997                utc
3998                    ? 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]'
3999                    : 'YYYYYY-MM-DD[T]HH:mm:ss.SSSZ'
4000            );
4001        }
4002        if (isFunction(Date.prototype.toISOString)) {
4003            // native implementation is ~50x faster, use it when we can
4004            if (utc) {
4005                return this.toDate().toISOString();
4006            } else {
4007                return new Date(this.valueOf() + this.utcOffset() * 60 * 1000)
4008                    .toISOString()
4009                    .replace('Z', formatMoment(m, 'Z'));
4010            }
4011        }
4012        return formatMoment(
4013            m,
4014            utc ? 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYY-MM-DD[T]HH:mm:ss.SSSZ'
4015        );
4016    }
4017
4018    /**
4019     * Return a human readable representation of a moment that can
4020     * also be evaluated to get a new moment which is the same
4021     *
4022     * @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects
4023     */
4024    function inspect() {
4025        if (!this.isValid()) {
4026            return 'moment.invalid(/* ' + this._i + ' */)';
4027        }
4028        var func = 'moment',
4029            zone = '',
4030            prefix,
4031            year,
4032            datetime,
4033            suffix;
4034        if (!this.isLocal()) {
4035            func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';
4036            zone = 'Z';
4037        }
4038        prefix = '[' + func + '("]';
4039        year = 0 <= this.year() && this.year() <= 9999 ? 'YYYY' : 'YYYYYY';
4040        datetime = '-MM-DD[T]HH:mm:ss.SSS';
4041        suffix = zone + '[")]';
4042
4043        return this.format(prefix + year + datetime + suffix);
4044    }
4045
4046    function format(inputString) {
4047        if (!inputString) {
4048            inputString = this.isUtc()
4049                ? hooks.defaultFormatUtc
4050                : hooks.defaultFormat;
4051        }
4052        var output = formatMoment(this, inputString);
4053        return this.localeData().postformat(output);
4054    }
4055
4056    function from(time, withoutSuffix) {
4057        if (
4058            this.isValid() &&
4059            ((isMoment(time) && time.isValid()) || createLocal(time).isValid())
4060        ) {
4061            return createDuration({ to: this, from: time })
4062                .locale(this.locale())
4063                .humanize(!withoutSuffix);
4064        } else {
4065            return this.localeData().invalidDate();
4066        }
4067    }
4068
4069    function fromNow(withoutSuffix) {
4070        return this.from(createLocal(), withoutSuffix);
4071    }
4072
4073    function to(time, withoutSuffix) {
4074        if (
4075            this.isValid() &&
4076            ((isMoment(time) && time.isValid()) || createLocal(time).isValid())
4077        ) {
4078            return createDuration({ from: this, to: time })
4079                .locale(this.locale())
4080                .humanize(!withoutSuffix);
4081        } else {
4082            return this.localeData().invalidDate();
4083        }
4084    }
4085
4086    function toNow(withoutSuffix) {
4087        return this.to(createLocal(), withoutSuffix);
4088    }
4089
4090    // If passed a locale key, it will set the locale for this
4091    // instance.  Otherwise, it will return the locale configuration
4092    // variables for this instance.
4093    function locale(key) {
4094        var newLocaleData;
4095
4096        if (key === undefined) {
4097            return this._locale._abbr;
4098        } else {
4099            newLocaleData = getLocale(key);
4100            if (newLocaleData != null) {
4101                this._locale = newLocaleData;
4102            }
4103            return this;
4104        }
4105    }
4106
4107    var lang = deprecate(
4108        'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.',
4109        function (key) {
4110            if (key === undefined) {
4111                return this.localeData();
4112            } else {
4113                return this.locale(key);
4114            }
4115        }
4116    );
4117
4118    function localeData() {
4119        return this._locale;
4120    }
4121
4122    var MS_PER_SECOND = 1000,
4123        MS_PER_MINUTE = 60 * MS_PER_SECOND,
4124        MS_PER_HOUR = 60 * MS_PER_MINUTE,
4125        MS_PER_400_YEARS = (365 * 400 + 97) * 24 * MS_PER_HOUR;
4126
4127    // actual modulo - handles negative numbers (for dates before 1970):
4128    function mod$1(dividend, divisor) {
4129        return ((dividend % divisor) + divisor) % divisor;
4130    }
4131
4132    function localStartOfDate(y, m, d) {
4133        // the date constructor remaps years 0-99 to 1900-1999
4134        if (y < 100 && y >= 0) {
4135            // preserve leap years using a full 400 year cycle, then reset
4136            return new Date(y + 400, m, d) - MS_PER_400_YEARS;
4137        } else {
4138            return new Date(y, m, d).valueOf();
4139        }
4140    }
4141
4142    function utcStartOfDate(y, m, d) {
4143        // Date.UTC remaps years 0-99 to 1900-1999
4144        if (y < 100 && y >= 0) {
4145            // preserve leap years using a full 400 year cycle, then reset
4146            return Date.UTC(y + 400, m, d) - MS_PER_400_YEARS;
4147        } else {
4148            return Date.UTC(y, m, d);
4149        }
4150    }
4151
4152    function startOf(units) {
4153        var time, startOfDate;
4154        units = normalizeUnits(units);
4155        if (units === undefined || units === 'millisecond' || !this.isValid()) {
4156            return this;
4157        }
4158
4159        startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
4160
4161        switch (units) {
4162            case 'year':
4163                time = startOfDate(this.year(), 0, 1);
4164                break;
4165            case 'quarter':
4166                time = startOfDate(
4167                    this.year(),
4168                    this.month() - (this.month() % 3),
4169                    1
4170                );
4171                break;
4172            case 'month':
4173                time = startOfDate(this.year(), this.month(), 1);
4174                break;
4175            case 'week':
4176                time = startOfDate(
4177                    this.year(),
4178                    this.month(),
4179                    this.date() - this.weekday()
4180                );
4181                break;
4182            case 'isoWeek':
4183                time = startOfDate(
4184                    this.year(),
4185                    this.month(),
4186                    this.date() - (this.isoWeekday() - 1)
4187                );
4188                break;
4189            case 'day':
4190            case 'date':
4191                time = startOfDate(this.year(), this.month(), this.date());
4192                break;
4193            case 'hour':
4194                time = this._d.valueOf();
4195                time -= mod$1(
4196                    time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE),
4197                    MS_PER_HOUR
4198                );
4199                break;
4200            case 'minute':
4201                time = this._d.valueOf();
4202                time -= mod$1(time, MS_PER_MINUTE);
4203                break;
4204            case 'second':
4205                time = this._d.valueOf();
4206                time -= mod$1(time, MS_PER_SECOND);
4207                break;
4208        }
4209
4210        this._d.setTime(time);
4211        hooks.updateOffset(this, true);
4212        return this;
4213    }
4214
4215    function endOf(units) {
4216        var time, startOfDate;
4217        units = normalizeUnits(units);
4218        if (units === undefined || units === 'millisecond' || !this.isValid()) {
4219            return this;
4220        }
4221
4222        startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
4223
4224        switch (units) {
4225            case 'year':
4226                time = startOfDate(this.year() + 1, 0, 1) - 1;
4227                break;
4228            case 'quarter':
4229                time =
4230                    startOfDate(
4231                        this.year(),
4232                        this.month() - (this.month() % 3) + 3,
4233                        1
4234                    ) - 1;
4235                break;
4236            case 'month':
4237                time = startOfDate(this.year(), this.month() + 1, 1) - 1;
4238                break;
4239            case 'week':
4240                time =
4241                    startOfDate(
4242                        this.year(),
4243                        this.month(),
4244                        this.date() - this.weekday() + 7
4245                    ) - 1;
4246                break;
4247            case 'isoWeek':
4248                time =
4249                    startOfDate(
4250                        this.year(),
4251                        this.month(),
4252                        this.date() - (this.isoWeekday() - 1) + 7
4253                    ) - 1;
4254                break;
4255            case 'day':
4256            case 'date':
4257                time = startOfDate(this.year(), this.month(), this.date() + 1) - 1;
4258                break;
4259            case 'hour':
4260                time = this._d.valueOf();
4261                time +=
4262                    MS_PER_HOUR -
4263                    mod$1(
4264                        time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE),
4265                        MS_PER_HOUR
4266                    ) -
4267                    1;
4268                break;
4269            case 'minute':
4270                time = this._d.valueOf();
4271                time += MS_PER_MINUTE - mod$1(time, MS_PER_MINUTE) - 1;
4272                break;
4273            case 'second':
4274                time = this._d.valueOf();
4275                time += MS_PER_SECOND - mod$1(time, MS_PER_SECOND) - 1;
4276                break;
4277        }
4278
4279        this._d.setTime(time);
4280        hooks.updateOffset(this, true);
4281        return this;
4282    }
4283
4284    function valueOf() {
4285        return this._d.valueOf() - (this._offset || 0) * 60000;
4286    }
4287
4288    function unix() {
4289        return Math.floor(this.valueOf() / 1000);
4290    }
4291
4292    function toDate() {
4293        return new Date(this.valueOf());
4294    }
4295
4296    function toArray() {
4297        var m = this;
4298        return [
4299            m.year(),
4300            m.month(),
4301            m.date(),
4302            m.hour(),
4303            m.minute(),
4304            m.second(),
4305            m.millisecond(),
4306        ];
4307    }
4308
4309    function toObject() {
4310        var m = this;
4311        return {
4312            years: m.year(),
4313            months: m.month(),
4314            date: m.date(),
4315            hours: m.hours(),
4316            minutes: m.minutes(),
4317            seconds: m.seconds(),
4318            milliseconds: m.milliseconds(),
4319        };
4320    }
4321
4322    function toJSON() {
4323        // new Date(NaN).toJSON() === null
4324        return this.isValid() ? this.toISOString() : null;
4325    }
4326
4327    function isValid$2() {
4328        return isValid(this);
4329    }
4330
4331    function parsingFlags() {
4332        return extend({}, getParsingFlags(this));
4333    }
4334
4335    function invalidAt() {
4336        return getParsingFlags(this).overflow;
4337    }
4338
4339    function creationData() {
4340        return {
4341            input: this._i,
4342            format: this._f,
4343            locale: this._locale,
4344            isUTC: this._isUTC,
4345            strict: this._strict,
4346        };
4347    }
4348
4349    addFormatToken('N', 0, 0, 'eraAbbr');
4350    addFormatToken('NN', 0, 0, 'eraAbbr');
4351    addFormatToken('NNN', 0, 0, 'eraAbbr');
4352    addFormatToken('NNNN', 0, 0, 'eraName');
4353    addFormatToken('NNNNN', 0, 0, 'eraNarrow');
4354
4355    addFormatToken('y', ['y', 1], 'yo', 'eraYear');
4356    addFormatToken('y', ['yy', 2], 0, 'eraYear');
4357    addFormatToken('y', ['yyy', 3], 0, 'eraYear');
4358    addFormatToken('y', ['yyyy', 4], 0, 'eraYear');
4359
4360    addRegexToken('N', matchEraAbbr);
4361    addRegexToken('NN', matchEraAbbr);
4362    addRegexToken('NNN', matchEraAbbr);
4363    addRegexToken('NNNN', matchEraName);
4364    addRegexToken('NNNNN', matchEraNarrow);
4365
4366    addParseToken(
4367        ['N', 'NN', 'NNN', 'NNNN', 'NNNNN'],
4368        function (input, array, config, token) {
4369            var era = config._locale.erasParse(input, token, config._strict);
4370            if (era) {
4371                getParsingFlags(config).era = era;
4372            } else {
4373                getParsingFlags(config).invalidEra = input;
4374            }
4375        }
4376    );
4377
4378    addRegexToken('y', matchUnsigned);
4379    addRegexToken('yy', matchUnsigned);
4380    addRegexToken('yyy', matchUnsigned);
4381    addRegexToken('yyyy', matchUnsigned);
4382    addRegexToken('yo', matchEraYearOrdinal);
4383
4384    addParseToken(['y', 'yy', 'yyy', 'yyyy'], YEAR);
4385    addParseToken(['yo'], function (input, array, config, token) {
4386        var match;
4387        if (config._locale._eraYearOrdinalRegex) {
4388            match = input.match(config._locale._eraYearOrdinalRegex);
4389        }
4390
4391        if (config._locale.eraYearOrdinalParse) {
4392            array[YEAR] = config._locale.eraYearOrdinalParse(input, match);
4393        } else {
4394            array[YEAR] = parseInt(input, 10);
4395        }
4396    });
4397
4398    function localeEras(m, format) {
4399        var i,
4400            l,
4401            date,
4402            eras = this._eras || getLocale('en')._eras;
4403        for (i = 0, l = eras.length; i < l; ++i) {
4404            switch (typeof eras[i].since) {
4405                case 'string':
4406                    // truncate time
4407                    date = hooks(eras[i].since).startOf('day');
4408                    eras[i].since = date.valueOf();
4409                    break;
4410            }
4411
4412            switch (typeof eras[i].until) {
4413                case 'undefined':
4414                    eras[i].until = +Infinity;
4415                    break;
4416                case 'string':
4417                    // truncate time
4418                    date = hooks(eras[i].until).startOf('day').valueOf();
4419                    eras[i].until = date.valueOf();
4420                    break;
4421            }
4422        }
4423        return eras;
4424    }
4425
4426    function localeErasParse(eraName, format, strict) {
4427        var i,
4428            l,
4429            eras = this.eras(),
4430            name,
4431            abbr,
4432            narrow;
4433        eraName = eraName.toUpperCase();
4434
4435        for (i = 0, l = eras.length; i < l; ++i) {
4436            name = eras[i].name.toUpperCase();
4437            abbr = eras[i].abbr.toUpperCase();
4438            narrow = eras[i].narrow.toUpperCase();
4439
4440            if (strict) {
4441                switch (format) {
4442                    case 'N':
4443                    case 'NN':
4444                    case 'NNN':
4445                        if (abbr === eraName) {
4446                            return eras[i];
4447                        }
4448                        break;
4449
4450                    case 'NNNN':
4451                        if (name === eraName) {
4452                            return eras[i];
4453                        }
4454                        break;
4455
4456                    case 'NNNNN':
4457                        if (narrow === eraName) {
4458                            return eras[i];
4459                        }
4460                        break;
4461                }
4462            } else if ([name, abbr, narrow].indexOf(eraName) >= 0) {
4463                return eras[i];
4464            }
4465        }
4466    }
4467
4468    function localeErasConvertYear(era, year) {
4469        var dir = era.since <= era.until ? +1 : -1;
4470        if (year === undefined) {
4471            return hooks(era.since).year();
4472        } else {
4473            return hooks(era.since).year() + (year - era.offset) * dir;
4474        }
4475    }
4476
4477    function getEraName() {
4478        var i,
4479            l,
4480            val,
4481            eras = this.localeData().eras();
4482        for (i = 0, l = eras.length; i < l; ++i) {
4483            // truncate time
4484            val = this.clone().startOf('day').valueOf();
4485
4486            if (eras[i].since <= val && val <= eras[i].until) {
4487                return eras[i].name;
4488            }
4489            if (eras[i].until <= val && val <= eras[i].since) {
4490                return eras[i].name;
4491            }
4492        }
4493
4494        return '';
4495    }
4496
4497    function getEraNarrow() {
4498        var i,
4499            l,
4500            val,
4501            eras = this.localeData().eras();
4502        for (i = 0, l = eras.length; i < l; ++i) {
4503            // truncate time
4504            val = this.clone().startOf('day').valueOf();
4505
4506            if (eras[i].since <= val && val <= eras[i].until) {
4507                return eras[i].narrow;
4508            }
4509            if (eras[i].until <= val && val <= eras[i].since) {
4510                return eras[i].narrow;
4511            }
4512        }
4513
4514        return '';
4515    }
4516
4517    function getEraAbbr() {
4518        var i,
4519            l,
4520            val,
4521            eras = this.localeData().eras();
4522        for (i = 0, l = eras.length; i < l; ++i) {
4523            // truncate time
4524            val = this.clone().startOf('day').valueOf();
4525
4526            if (eras[i].since <= val && val <= eras[i].until) {
4527                return eras[i].abbr;
4528            }
4529            if (eras[i].until <= val && val <= eras[i].since) {
4530                return eras[i].abbr;
4531            }
4532        }
4533
4534        return '';
4535    }
4536
4537    function getEraYear() {
4538        var i,
4539            l,
4540            dir,
4541            val,
4542            eras = this.localeData().eras();
4543        for (i = 0, l = eras.length; i < l; ++i) {
4544            dir = eras[i].since <= eras[i].until ? +1 : -1;
4545
4546            // truncate time
4547            val = this.clone().startOf('day').valueOf();
4548
4549            if (
4550                (eras[i].since <= val && val <= eras[i].until) ||
4551                (eras[i].until <= val && val <= eras[i].since)
4552            ) {
4553                return (
4554                    (this.year() - hooks(eras[i].since).year()) * dir +
4555                    eras[i].offset
4556                );
4557            }
4558        }
4559
4560        return this.year();
4561    }
4562
4563    function erasNameRegex(isStrict) {
4564        if (!hasOwnProp(this, '_erasNameRegex')) {
4565            computeErasParse.call(this);
4566        }
4567        return isStrict ? this._erasNameRegex : this._erasRegex;
4568    }
4569
4570    function erasAbbrRegex(isStrict) {
4571        if (!hasOwnProp(this, '_erasAbbrRegex')) {
4572            computeErasParse.call(this);
4573        }
4574        return isStrict ? this._erasAbbrRegex : this._erasRegex;
4575    }
4576
4577    function erasNarrowRegex(isStrict) {
4578        if (!hasOwnProp(this, '_erasNarrowRegex')) {
4579            computeErasParse.call(this);
4580        }
4581        return isStrict ? this._erasNarrowRegex : this._erasRegex;
4582    }
4583
4584    function matchEraAbbr(isStrict, locale) {
4585        return locale.erasAbbrRegex(isStrict);
4586    }
4587
4588    function matchEraName(isStrict, locale) {
4589        return locale.erasNameRegex(isStrict);
4590    }
4591
4592    function matchEraNarrow(isStrict, locale) {
4593        return locale.erasNarrowRegex(isStrict);
4594    }
4595
4596    function matchEraYearOrdinal(isStrict, locale) {
4597        return locale._eraYearOrdinalRegex || matchUnsigned;
4598    }
4599
4600    function computeErasParse() {
4601        var abbrPieces = [],
4602            namePieces = [],
4603            narrowPieces = [],
4604            mixedPieces = [],
4605            i,
4606            l,
4607            erasName,
4608            erasAbbr,
vendor: 9,768 bytes, lines 4609-4948
4609            erasNarrow,
4610            eras = this.eras();
4611
4612        for (i = 0, l = eras.length; i < l; ++i) {
4613            erasName = regexEscape(eras[i].name);
4614            erasAbbr = regexEscape(eras[i].abbr);
4615            erasNarrow = regexEscape(eras[i].narrow);
4616
4617            namePieces.push(erasName);
4618            abbrPieces.push(erasAbbr);
4619            narrowPieces.push(erasNarrow);
4620            mixedPieces.push(erasName);
4621            mixedPieces.push(erasAbbr);
4622            mixedPieces.push(erasNarrow);
4623        }
4624
4625        this._erasRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
4626        this._erasNameRegex = new RegExp('^(' + namePieces.join('|') + ')', 'i');
4627        this._erasAbbrRegex = new RegExp('^(' + abbrPieces.join('|') + ')', 'i');
4628        this._erasNarrowRegex = new RegExp(
4629            '^(' + narrowPieces.join('|') + ')',
4630            'i'
4631        );
4632    }
4633
4634    // FORMATTING
4635
4636    addFormatToken(0, ['gg', 2], 0, function () {
4637        return this.weekYear() % 100;
4638    });
4639
4640    addFormatToken(0, ['GG', 2], 0, function () {
4641        return this.isoWeekYear() % 100;
4642    });
4643
4644    function addWeekYearFormatToken(token, getter) {
4645        addFormatToken(0, [token, token.length], 0, getter);
4646    }
4647
4648    addWeekYearFormatToken('gggg', 'weekYear');
4649    addWeekYearFormatToken('ggggg', 'weekYear');
4650    addWeekYearFormatToken('GGGG', 'isoWeekYear');
4651    addWeekYearFormatToken('GGGGG', 'isoWeekYear');
4652
4653    // ALIASES
4654
4655    // PARSING
4656
4657    addRegexToken('G', matchSigned);
4658    addRegexToken('g', matchSigned);
4659    addRegexToken('GG', match1to2, match2);
4660    addRegexToken('gg', match1to2, match2);
4661    addRegexToken('GGGG', match1to4, match4);
4662    addRegexToken('gggg', match1to4, match4);
4663    addRegexToken('GGGGG', match1to6, match6);
4664    addRegexToken('ggggg', match1to6, match6);
4665
4666    addWeekParseToken(
4667        ['gggg', 'ggggg', 'GGGG', 'GGGGG'],
4668        function (input, week, config, token) {
4669            week[token.substr(0, 2)] = toInt(input);
4670        }
4671    );
4672
4673    addWeekParseToken(['gg', 'GG'], function (input, week, config, token) {
4674        week[token] = hooks.parseTwoDigitYear(input);
4675    });
4676
4677    // MOMENTS
4678
4679    function getSetWeekYear(input) {
4680        return getSetWeekYearHelper.call(
4681            this,
4682            input,
4683            this.week(),
4684            this.weekday() + this.localeData()._week.dow,
4685            this.localeData()._week.dow,
4686            this.localeData()._week.doy
4687        );
4688    }
4689
4690    function getSetISOWeekYear(input) {
4691        return getSetWeekYearHelper.call(
4692            this,
4693            input,
4694            this.isoWeek(),
4695            this.isoWeekday(),
4696            1,
4697            4
4698        );
4699    }
4700
4701    function getISOWeeksInYear() {
4702        return weeksInYear(this.year(), 1, 4);
4703    }
4704
4705    function getISOWeeksInISOWeekYear() {
4706        return weeksInYear(this.isoWeekYear(), 1, 4);
4707    }
4708
4709    function getWeeksInYear() {
4710        var weekInfo = this.localeData()._week;
4711        return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);
4712    }
4713
4714    function getWeeksInWeekYear() {
4715        var weekInfo = this.localeData()._week;
4716        return weeksInYear(this.weekYear(), weekInfo.dow, weekInfo.doy);
4717    }
4718
4719    function getSetWeekYearHelper(input, week, weekday, dow, doy) {
4720        var weeksTarget;
4721        if (input == null) {
4722            return weekOfYear(this, dow, doy).year;
4723        } else {
4724            weeksTarget = weeksInYear(input, dow, doy);
4725            if (week > weeksTarget) {
4726                week = weeksTarget;
4727            }
4728            return setWeekAll.call(this, input, week, weekday, dow, doy);
4729        }
4730    }
4731
4732    function setWeekAll(weekYear, week, weekday, dow, doy) {
4733        var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy),
4734            date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear);
4735
4736        this.year(date.getUTCFullYear());
4737        this.month(date.getUTCMonth());
4738        this.date(date.getUTCDate());
4739        return this;
4740    }
4741
4742    // FORMATTING
4743
4744    addFormatToken('Q', 0, 'Qo', 'quarter');
4745
4746    // PARSING
4747
4748    addRegexToken('Q', match1);
4749    addParseToken('Q', function (input, array) {
4750        array[MONTH] = (toInt(input) - 1) * 3;
4751    });
4752
4753    // MOMENTS
4754
4755    function getSetQuarter(input) {
4756        return input == null
4757            ? Math.ceil((this.month() + 1) / 3)
4758            : this.month((input - 1) * 3 + (this.month() % 3));
4759    }
4760
4761    // FORMATTING
4762
4763    addFormatToken('D', ['DD', 2], 'Do', 'date');
4764
4765    // PARSING
4766
4767    addRegexToken('D', match1to2, match1to2NoLeadingZero);
4768    addRegexToken('DD', match1to2, match2);
4769    addRegexToken('Do', function (isStrict, locale) {
4770        // TODO: Remove "ordinalParse" fallback in next major release.
4771        return isStrict
4772            ? locale._dayOfMonthOrdinalParse || locale._ordinalParse
4773            : locale._dayOfMonthOrdinalParseLenient;
4774    });
4775
4776    addParseToken(['D', 'DD'], DATE);
4777    addParseToken('Do', function (input, array) {
4778        array[DATE] = toInt(input.match(match1to2)[0]);
4779    });
4780
4781    // MOMENTS
4782
4783    var getSetDayOfMonth = makeGetSet('Date', true);
4784
4785    // FORMATTING
4786
4787    addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear');
4788
4789    // PARSING
4790
4791    addRegexToken('DDD', match1to3);
4792    addRegexToken('DDDD', match3);
4793    addParseToken(['DDD', 'DDDD'], function (input, array, config) {
4794        config._dayOfYear = toInt(input);
4795    });
4796
4797    // HELPERS
4798
4799    // MOMENTS
4800
4801    function getSetDayOfYear(input) {
4802        var dayOfYear =
4803            Math.round(
4804                (this.clone().startOf('day') - this.clone().startOf('year')) / 864e5
4805            ) + 1;
4806        return input == null ? dayOfYear : this.add(input - dayOfYear, 'd');
4807    }
4808
4809    // FORMATTING
4810
4811    addFormatToken('m', ['mm', 2], 0, 'minute');
4812
4813    // PARSING
4814
4815    addRegexToken('m', match1to2, match1to2HasZero);
4816    addRegexToken('mm', match1to2, match2);
4817    addParseToken(['m', 'mm'], MINUTE);
4818
4819    // MOMENTS
4820
4821    var getSetMinute = makeGetSet('Minutes', false);
4822
4823    // FORMATTING
4824
4825    addFormatToken('s', ['ss', 2], 0, 'second');
4826
4827    // PARSING
4828
4829    addRegexToken('s', match1to2, match1to2HasZero);
4830    addRegexToken('ss', match1to2, match2);
4831    addParseToken(['s', 'ss'], SECOND);
4832
4833    // MOMENTS
4834
4835    var getSetSecond = makeGetSet('Seconds', false);
4836
4837    // FORMATTING
4838
4839    addFormatToken('S', 0, 0, function () {
4840        return ~~(this.millisecond() / 100);
4841    });
4842
4843    addFormatToken(0, ['SS', 2], 0, function () {
4844        return ~~(this.millisecond() / 10);
4845    });
4846
4847    addFormatToken(0, ['SSS', 3], 0, 'millisecond');
4848    addFormatToken(0, ['SSSS', 4], 0, function () {
4849        return this.millisecond() * 10;
4850    });
4851    addFormatToken(0, ['SSSSS', 5], 0, function () {
4852        return this.millisecond() * 100;
4853    });
4854    addFormatToken(0, ['SSSSSS', 6], 0, function () {
4855        return this.millisecond() * 1000;
4856    });
4857    addFormatToken(0, ['SSSSSSS', 7], 0, function () {
4858        return this.millisecond() * 10000;
4859    });
4860    addFormatToken(0, ['SSSSSSSS', 8], 0, function () {
4861        return this.millisecond() * 100000;
4862    });
4863    addFormatToken(0, ['SSSSSSSSS', 9], 0, function () {
4864        return this.millisecond() * 1000000;
4865    });
4866
4867    // PARSING
4868
4869    addRegexToken('S', match1to3, match1);
4870    addRegexToken('SS', match1to3, match2);
4871    addRegexToken('SSS', match1to3, match3);
4872
4873    var token, getSetMillisecond;
4874    for (token = 'SSSS'; token.length <= 9; token += 'S') {
4875        addRegexToken(token, matchUnsigned);
4876    }
4877
4878    function parseMs(input, array) {
4879        array[MILLISECOND] = toInt(('0.' + input) * 1000);
4880    }
4881
4882    for (token = 'S'; token.length <= 9; token += 'S') {
4883        addParseToken(token, parseMs);
4884    }
4885
4886    getSetMillisecond = makeGetSet('Milliseconds', false);
4887
4888    // FORMATTING
4889
4890    addFormatToken('z', 0, 0, 'zoneAbbr');
4891    addFormatToken('zz', 0, 0, 'zoneName');
4892
4893    // MOMENTS
4894
4895    function getZoneAbbr() {
4896        return this._isUTC ? 'UTC' : '';
4897    }
4898
4899    function getZoneName() {
4900        return this._isUTC ? 'Coordinated Universal Time' : '';
4901    }
4902
4903    var proto = Moment.prototype;
4904
4905    proto.add = add;
4906    proto.calendar = calendar$1;
4907    proto.clone = clone;
4908    proto.diff = diff;
4909    proto.endOf = endOf;
4910    proto.format = format;
4911    proto.from = from;
4912    proto.fromNow = fromNow;
4913    proto.to = to;
4914    proto.toNow = toNow;
4915    proto.get = stringGet;
4916    proto.invalidAt = invalidAt;
4917    proto.isAfter = isAfter;
4918    proto.isBefore = isBefore;
4919    proto.isBetween = isBetween;
4920    proto.isSame = isSame;
4921    proto.isSameOrAfter = isSameOrAfter;
4922    proto.isSameOrBefore = isSameOrBefore;
4923    proto.isValid = isValid$2;
4924    proto.lang = lang;
4925    proto.locale = locale;
4926    proto.localeData = localeData;
4927    proto.max = prototypeMax;
4928    proto.min = prototypeMin;
4929    proto.parsingFlags = parsingFlags;
4930    proto.set = stringSet;
4931    proto.startOf = startOf;
4932    proto.subtract = subtract;
4933    proto.toArray = toArray;
4934    proto.toObject = toObject;
4935    proto.toDate = toDate;
4936    proto.toISOString = toISOString;
4937    proto.inspect = inspect;
4938    if (typeof Symbol !== 'undefined' && Symbol.for != null) {
4939        proto[Symbol.for('nodejs.util.inspect.custom')] = function () {
4940            return 'Moment<' + this.format() + '>';
4941        };
4942    }
4943    proto.toJSON = toJSON;
4944    proto.toString = toString;
4945    proto.unix = unix;
4946    proto.valueOf = valueOf;
4947    proto.creationData = creationData;
4948    proto.eraName = getEraName;
4949    proto.eraNarrow = getEraNarrow;
4950    proto.eraAbbr = getEraAbbr;
4951    proto.eraYear = getEraYear;
4952    proto.year = getSetYear;
4953    proto.isLeapYear = getIsLeapYear;
4954    proto.weekYear = getSetWeekYear;
4955    proto.isoWeekYear = getSetISOWeekYear;
4956    proto.quarter = proto.quarters = getSetQuarter;
4957    proto.month = getSetMonth;
4958    proto.daysInMonth = getDaysInMonth;
4959    proto.week = proto.weeks = getSetWeek;
4960    proto.isoWeek = proto.isoWeeks = getSetISOWeek;
4961    proto.weeksInYear = getWeeksInYear;
4962    proto.weeksInWeekYear = getWeeksInWeekYear;
4963    proto.isoWeeksInYear = getISOWeeksInYear;
4964    proto.isoWeeksInISOWeekYear = getISOWeeksInISOWeekYear;
4965    proto.date = getSetDayOfMonth;
4966    proto.day = proto.days = getSetDayOfWeek;
4967    proto.weekday = getSetLocaleDayOfWeek;
4968    proto.isoWeekday = getSetISODayOfWeek;
4969    proto.dayOfYear = getSetDayOfYear;
4970    proto.hour = proto.hours = getSetHour;
4971    proto.minute = proto.minutes = getSetMinute;
4972    proto.second = proto.seconds = getSetSecond;
4973    proto.millisecond = proto.milliseconds = getSetMillisecond;
4974    proto.utcOffset = getSetOffset;
4975    proto.utc = setOffsetToUTC;
4976    proto.local = setOffsetToLocal;
4977    proto.parseZone = setOffsetToParsedOffset;
4978    proto.hasAlignedHourOffset = hasAlignedHourOffset;
4979    proto.isDST = isDaylightSavingTime;
4980    proto.isLocal = isLocal;
4981    proto.isUtcOffset = isUtcOffset;
4982    proto.isUtc = isUtc;
4983    proto.isUTC = isUtc;
4984    proto.zoneAbbr = getZoneAbbr;
4985    proto.zoneName = getZoneName;
4986    proto.dates = deprecate(
4987        'dates accessor is deprecated. Use date instead.',
4988        getSetDayOfMonth
4989    );
4990    proto.months = deprecate(
4991        'months accessor is deprecated. Use month instead',
4992        getSetMonth
4993    );
4994    proto.years = deprecate(
4995        'years accessor is deprecated. Use year instead',
4996        getSetYear
4997    );
4998    proto.zone = deprecate(
4999        'moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/',
5000        getSetZone
5001    );
5002    proto.isDSTShifted = deprecate(
5003        'isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information',
5004        isDaylightSavingTimeShifted
5005    );
5006
5007    function createUnix(input) {
5008        return createLocal(input * 1000);
5009    }
5010
5011    function createInZone() {
5012        return createLocal.apply(null, arguments).parseZone();
5013    }
5014
5015    function preParsePostFormat(string) {
5016        return string;
5017    }
5018
5019    var proto$1 = Locale.prototype;
5020
5021    proto$1.calendar = calendar;
5022    proto$1.longDateFormat = longDateFormat;
5023    proto$1.invalidDate = invalidDate;
5024    proto$1.ordinal = ordinal;
5025    proto$1.preparse = preParsePostFormat;
5026    proto$1.postformat = preParsePostFormat;
5027    proto$1.relativeTime = relativeTime;
5028    proto$1.pastFuture = pastFuture;
5029    proto$1.set = set;
5030    proto$1.eras = localeEras;
5031    proto$1.erasParse = localeErasParse;
5032    proto$1.erasConvertYear = localeErasConvertYear;
5033    proto$1.erasAbbrRegex = erasAbbrRegex;
5034    proto$1.erasNameRegex = erasNameRegex;
5035    proto$1.erasNarrowRegex = erasNarrowRegex;
5036
5037    proto$1.months = localeMonths;
5038    proto$1.monthsShort = localeMonthsShort;
5039    proto$1.monthsParse = localeMonthsParse;
5040    proto$1.monthsRegex = monthsRegex;
5041    proto$1.monthsShortRegex = monthsShortRegex;
5042    proto$1.week = localeWeek;
5043    proto$1.firstDayOfYear = localeFirstDayOfYear;
5044    proto$1.firstDayOfWeek = localeFirstDayOfWeek;
5045
5046    proto$1.weekdays = localeWeekdays;
5047    proto$1.weekdaysMin = localeWeekdaysMin;
5048    proto$1.weekdaysShort = localeWeekdaysShort;
5049    proto$1.weekdaysParse = localeWeekdaysParse;
5050
5051    proto$1.weekdaysRegex = weekdaysRegex;
5052    proto$1.weekdaysShortRegex = weekdaysShortRegex;
5053    proto$1.weekdaysMinRegex = weekdaysMinRegex;
5054
5055    proto$1.isPM = localeIsPM;
5056    proto$1.meridiem = localeMeridiem;
5057
5058    function get$1(format, index, field, setter) {
5059        var locale = getLocale(),
5060            utc = createUTC().set(setter, index);
vendor: 11,845 bytes, lines 5061-5443
5061        return locale[field](utc, format);
5062    }
5063
5064    function listMonthsImpl(format, index, field) {
5065        if (isNumber(format)) {
5066            index = format;
5067            format = undefined;
5068        }
5069
5070        format = format || '';
5071
5072        if (index != null) {
5073            return get$1(format, index, field, 'month');
5074        }
5075
5076        var i,
5077            out = [];
5078        for (i = 0; i < 12; i++) {
5079            out[i] = get$1(format, i, field, 'month');
5080        }
5081        return out;
5082    }
5083
5084    // ()
5085    // (5)
5086    // (fmt, 5)
5087    // (fmt)
5088    // (true)
5089    // (true, 5)
5090    // (true, fmt, 5)
5091    // (true, fmt)
5092    function listWeekdaysImpl(localeSorted, format, index, field) {
5093        if (typeof localeSorted === 'boolean') {
5094            if (isNumber(format)) {
5095                index = format;
5096                format = undefined;
5097            }
5098
5099            format = format || '';
5100        } else {
5101            format = localeSorted;
5102            index = format;
5103            localeSorted = false;
5104
5105            if (isNumber(format)) {
5106                index = format;
5107                format = undefined;
5108            }
5109
5110            format = format || '';
5111        }
5112
5113        var locale = getLocale(),
5114            shift = localeSorted ? locale._week.dow : 0,
5115            i,
5116            out = [];
5117
5118        if (index != null) {
5119            return get$1(format, (index + shift) % 7, field, 'day');
5120        }
5121
5122        for (i = 0; i < 7; i++) {
5123            out[i] = get$1(format, (i + shift) % 7, field, 'day');
5124        }
5125        return out;
5126    }
5127
5128    function listMonths(format, index) {
5129        return listMonthsImpl(format, index, 'months');
5130    }
5131
5132    function listMonthsShort(format, index) {
5133        return listMonthsImpl(format, index, 'monthsShort');
5134    }
5135
5136    function listWeekdays(localeSorted, format, index) {
5137        return listWeekdaysImpl(localeSorted, format, index, 'weekdays');
5138    }
5139
5140    function listWeekdaysShort(localeSorted, format, index) {
5141        return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort');
5142    }
5143
5144    function listWeekdaysMin(localeSorted, format, index) {
5145        return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin');
5146    }
5147
5148    getSetGlobalLocale('en', {
5149        eras: [
5150            {
5151                since: '0001-01-01',
5152                until: +Infinity,
5153                offset: 1,
5154                name: 'Anno Domini',
5155                narrow: 'AD',
5156                abbr: 'AD',
5157            },
5158            {
5159                since: '0000-12-31',
5160                until: -Infinity,
5161                offset: 1,
5162                name: 'Before Christ',
5163                narrow: 'BC',
5164                abbr: 'BC',
5165            },
5166        ],
5167        dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/,
5168        ordinal: function (number) {
5169            var b = number % 10,
5170                output =
5171                    toInt((number % 100) / 10) === 1
5172                        ? 'th'
5173                        : b === 1
5174                            ? 'st'
5175                            : b === 2
5176                                ? 'nd'
5177                                : b === 3
5178                                    ? 'rd'
5179                                    : 'th';
5180            return number + output;
5181        },
5182    });
5183
5184    // Side effect imports
5185
5186    hooks.lang = deprecate(
5187        'moment.lang is deprecated. Use moment.locale instead.',
5188        getSetGlobalLocale
5189    );
5190    hooks.langData = deprecate(
5191        'moment.langData is deprecated. Use moment.localeData instead.',
5192        getLocale
5193    );
5194
5195    var mathAbs = Math.abs;
5196
5197    function abs() {
5198        var data = this._data;
5199
5200        this._milliseconds = mathAbs(this._milliseconds);
5201        this._days = mathAbs(this._days);
5202        this._months = mathAbs(this._months);
5203
5204        data.milliseconds = mathAbs(data.milliseconds);
5205        data.seconds = mathAbs(data.seconds);
5206        data.minutes = mathAbs(data.minutes);
5207        data.hours = mathAbs(data.hours);
5208        data.months = mathAbs(data.months);
5209        data.years = mathAbs(data.years);
5210
5211        return this;
5212    }
5213
5214    function addSubtract$1(duration, input, value, direction) {
5215        var other = createDuration(input, value);
5216
5217        duration._milliseconds += direction * other._milliseconds;
5218        duration._days += direction * other._days;
5219        duration._months += direction * other._months;
5220
5221        return duration._bubble();
5222    }
5223
5224    // supports only 2.0-style add(1, 's') or add(duration)
5225    function add$1(input, value) {
5226        return addSubtract$1(this, input, value, 1);
5227    }
5228
5229    // supports only 2.0-style subtract(1, 's') or subtract(duration)
5230    function subtract$1(input, value) {
5231        return addSubtract$1(this, input, value, -1);
5232    }
5233
5234    function absCeil(number) {
5235        if (number < 0) {
5236            return Math.floor(number);
5237        } else {
5238            return Math.ceil(number);
5239        }
5240    }
5241
5242    function bubble() {
5243        var milliseconds = this._milliseconds,
5244            days = this._days,
5245            months = this._months,
5246            data = this._data,
5247            seconds,
5248            minutes,
5249            hours,
5250            years,
5251            monthsFromDays;
5252
5253        // if we have a mix of positive and negative values, bubble down first
5254        // check: https://github.com/moment/moment/issues/2166
5255        if (
5256            !(
5257                (milliseconds >= 0 && days >= 0 && months >= 0) ||
5258                (milliseconds <= 0 && days <= 0 && months <= 0)
5259            )
5260        ) {
5261            milliseconds += absCeil(monthsToDays(months) + days) * 864e5;
5262            days = 0;
5263            months = 0;
5264        }
5265
5266        // The following code bubbles up values, see the tests for
5267        // examples of what that means.
5268        data.milliseconds = milliseconds % 1000;
5269
5270        seconds = absFloor(milliseconds / 1000);
5271        data.seconds = seconds % 60;
5272
5273        minutes = absFloor(seconds / 60);
5274        data.minutes = minutes % 60;
5275
5276        hours = absFloor(minutes / 60);
5277        data.hours = hours % 24;
5278
5279        days += absFloor(hours / 24);
5280
5281        // convert days to months
5282        monthsFromDays = absFloor(daysToMonths(days));
5283        months += monthsFromDays;
5284        days -= absCeil(monthsToDays(monthsFromDays));
5285
5286        // 12 months -> 1 year
5287        years = absFloor(months / 12);
5288        months %= 12;
5289
5290        data.days = days;
5291        data.months = months;
5292        data.years = years;
5293
5294        return this;
5295    }
5296
5297    function daysToMonths(days) {
5298        // 400 years have 146097 days (taking into account leap year rules)
5299        // 400 years have 12 months === 4800
5300        return (days * 4800) / 146097;
5301    }
5302
5303    function monthsToDays(months) {
5304        // the reverse of daysToMonths
5305        return (months * 146097) / 4800;
5306    }
5307
5308    function as(units) {
5309        if (!this.isValid()) {
5310            return NaN;
5311        }
5312        var days,
5313            months,
5314            milliseconds = this._milliseconds;
5315
5316        units = normalizeUnits(units);
5317
5318        if (units === 'month' || units === 'quarter' || units === 'year') {
5319            days = this._days + milliseconds / 864e5;
5320            months = this._months + daysToMonths(days);
5321            switch (units) {
5322                case 'month':
5323                    return months;
5324                case 'quarter':
5325                    return months / 3;
5326                case 'year':
5327                    return months / 12;
5328            }
5329        } else {
5330            // handle milliseconds separately because of floating point math errors (issue #1867)
5331            days = this._days + Math.round(monthsToDays(this._months));
5332            switch (units) {
5333                case 'week':
5334                    return days / 7 + milliseconds / 6048e5;
5335                case 'day':
5336                    return days + milliseconds / 864e5;
5337                case 'hour':
5338                    return days * 24 + milliseconds / 36e5;
5339                case 'minute':
5340                    return days * 1440 + milliseconds / 6e4;
5341                case 'second':
5342                    return days * 86400 + milliseconds / 1000;
5343                // Math.floor prevents floating point math errors here
5344                case 'millisecond':
5345                    return Math.floor(days * 864e5) + milliseconds;
5346                default:
5347                    throw new Error('Unknown unit ' + units);
5348            }
5349        }
5350    }
5351
5352    function makeAs(alias) {
5353        return function () {
5354            return this.as(alias);
5355        };
5356    }
5357
5358    var asMilliseconds = makeAs('ms'),
5359        asSeconds = makeAs('s'),
5360        asMinutes = makeAs('m'),
5361        asHours = makeAs('h'),
5362        asDays = makeAs('d'),
5363        asWeeks = makeAs('w'),
5364        asMonths = makeAs('M'),
5365        asQuarters = makeAs('Q'),
5366        asYears = makeAs('y'),
5367        valueOf$1 = asMilliseconds;
5368
5369    function clone$1() {
5370        return createDuration(this);
5371    }
5372
5373    function get$2(units) {
5374        units = normalizeUnits(units);
5375        return this.isValid() ? this[units + 's']() : NaN;
5376    }
5377
5378    function makeGetter(name) {
5379        return function () {
5380            return this.isValid() ? this._data[name] : NaN;
5381        };
5382    }
5383
5384    var milliseconds = makeGetter('milliseconds'),
5385        seconds = makeGetter('seconds'),
5386        minutes = makeGetter('minutes'),
5387        hours = makeGetter('hours'),
5388        days = makeGetter('days'),
5389        months = makeGetter('months'),
5390        years = makeGetter('years');
5391
5392    function weeks() {
5393        return absFloor(this.days() / 7);
5394    }
5395
5396    var round = Math.round,
5397        thresholds = {
5398            ss: 44, // a few seconds to seconds
5399            s: 45, // seconds to minute
5400            m: 45, // minutes to hour
5401            h: 22, // hours to day
5402            d: 26, // days to month/week
5403            w: null, // weeks to month
5404            M: 11, // months to year
5405        };
5406
5407    // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize
5408    function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) {
5409        return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
5410    }
5411
5412    function relativeTime$1(posNegDuration, withoutSuffix, thresholds, locale) {
5413        var duration = createDuration(posNegDuration).abs(),
5414            seconds = round(duration.as('s')),
5415            minutes = round(duration.as('m')),
5416            hours = round(duration.as('h')),
5417            days = round(duration.as('d')),
5418            months = round(duration.as('M')),
5419            weeks = round(duration.as('w')),
5420            years = round(duration.as('y')),
5421            a =
5422                (seconds <= thresholds.ss && ['s', seconds]) ||
5423                (seconds < thresholds.s && ['ss', seconds]) ||
5424                (minutes <= 1 && ['m']) ||
5425                (minutes < thresholds.m && ['mm', minutes]) ||
5426                (hours <= 1 && ['h']) ||
5427                (hours < thresholds.h && ['hh', hours]) ||
5428                (days <= 1 && ['d']) ||
5429                (days < thresholds.d && ['dd', days]);
5430
5431        if (thresholds.w != null) {
5432            a =
5433                a ||
5434                (weeks <= 1 && ['w']) ||
5435                (weeks < thresholds.w && ['ww', weeks]);
5436        }
5437        a = a ||
5438            (months <= 1 && ['M']) ||
5439            (months < thresholds.M && ['MM', months]) ||
5440            (years <= 1 && ['y']) || ['yy', years];
5441
5442        a[2] = withoutSuffix;
5443        a[3] = +posNegDuration > 0;
vendor: 5,754 bytes, lines 5444-5625
5444        a[4] = locale;
5445        return substituteTimeAgo.apply(null, a);
5446    }
5447
5448    // This function allows you to set the rounding function for relative time strings
5449    function getSetRelativeTimeRounding(roundingFunction) {
5450        if (roundingFunction === undefined) {
5451            return round;
5452        }
5453        if (typeof roundingFunction === 'function') {
5454            round = roundingFunction;
5455            return true;
5456        }
5457        return false;
5458    }
5459
5460    // This function allows you to set a threshold for relative time strings
5461    function getSetRelativeTimeThreshold(threshold, limit) {
5462        if (thresholds[threshold] === undefined) {
5463            return false;
5464        }
5465        if (limit === undefined) {
5466            return thresholds[threshold];
5467        }
5468        thresholds[threshold] = limit;
5469        if (threshold === 's') {
5470            thresholds.ss = limit - 1;
5471        }
5472        return true;
5473    }
5474
5475    function humanize(argWithSuffix, argThresholds) {
5476        if (!this.isValid()) {
5477            return this.localeData().invalidDate();
5478        }
5479
5480        var withSuffix = false,
5481            th = thresholds,
5482            locale,
5483            output;
5484
5485        if (typeof argWithSuffix === 'object') {
5486            argThresholds = argWithSuffix;
5487            argWithSuffix = false;
5488        }
5489        if (typeof argWithSuffix === 'boolean') {
5490            withSuffix = argWithSuffix;
5491        }
5492        if (typeof argThresholds === 'object') {
5493            th = Object.assign({}, thresholds, argThresholds);
5494            if (argThresholds.s != null && argThresholds.ss == null) {
5495                th.ss = argThresholds.s - 1;
5496            }
5497        }
5498
5499        locale = this.localeData();
5500        output = relativeTime$1(this, !withSuffix, th, locale);
5501
5502        if (withSuffix) {
5503            output = locale.pastFuture(+this, output);
5504        }
5505
5506        return locale.postformat(output);
5507    }
5508
5509    var abs$1 = Math.abs;
5510
5511    function sign(x) {
5512        return (x > 0) - (x < 0) || +x;
5513    }
5514
5515    function toISOString$1() {
5516        // for ISO strings we do not use the normal bubbling rules:
5517        //  * milliseconds bubble up until they become hours
5518        //  * days do not bubble at all
5519        //  * months bubble up until they become years
5520        // This is because there is no context-free conversion between hours and days
5521        // (think of clock changes)
5522        // and also not between days and months (28-31 days per month)
5523        if (!this.isValid()) {
5524            return this.localeData().invalidDate();
5525        }
5526
5527        var seconds = abs$1(this._milliseconds) / 1000,
5528            days = abs$1(this._days),
5529            months = abs$1(this._months),
5530            minutes,
5531            hours,
5532            years,
5533            s,
5534            total = this.asSeconds(),
5535            totalSign,
5536            ymSign,
5537            daysSign,
5538            hmsSign;
5539
5540        if (!total) {
5541            // this is the same as C#'s (Noda) and python (isodate)...
5542            // but not other JS (goog.date)
5543            return 'P0D';
5544        }
5545
5546        // 3600 seconds -> 60 minutes -> 1 hour
5547        minutes = absFloor(seconds / 60);
5548        hours = absFloor(minutes / 60);
5549        seconds %= 60;
5550        minutes %= 60;
5551
5552        // 12 months -> 1 year
5553        years = absFloor(months / 12);
5554        months %= 12;
5555
5556        // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js
5557        s = seconds ? seconds.toFixed(3).replace(/\.?0+$/, '') : '';
5558
5559        totalSign = total < 0 ? '-' : '';
5560        ymSign = sign(this._months) !== sign(total) ? '-' : '';
5561        daysSign = sign(this._days) !== sign(total) ? '-' : '';
5562        hmsSign = sign(this._milliseconds) !== sign(total) ? '-' : '';
5563
5564        return (
5565            totalSign +
5566            'P' +
5567            (years ? ymSign + years + 'Y' : '') +
5568            (months ? ymSign + months + 'M' : '') +
5569            (days ? daysSign + days + 'D' : '') +
5570            (hours || minutes || seconds ? 'T' : '') +
5571            (hours ? hmsSign + hours + 'H' : '') +
5572            (minutes ? hmsSign + minutes + 'M' : '') +
5573            (seconds ? hmsSign + s + 'S' : '')
5574        );
5575    }
5576
5577    var proto$2 = Duration.prototype;
5578
5579    proto$2.isValid = isValid$1;
5580    proto$2.abs = abs;
5581    proto$2.add = add$1;
5582    proto$2.subtract = subtract$1;
5583    proto$2.as = as;
5584    proto$2.asMilliseconds = asMilliseconds;
5585    proto$2.asSeconds = asSeconds;
5586    proto$2.asMinutes = asMinutes;
5587    proto$2.asHours = asHours;
5588    proto$2.asDays = asDays;
5589    proto$2.asWeeks = asWeeks;
5590    proto$2.asMonths = asMonths;
5591    proto$2.asQuarters = asQuarters;
5592    proto$2.asYears = asYears;
5593    proto$2.valueOf = valueOf$1;
5594    proto$2._bubble = bubble;
5595    proto$2.clone = clone$1;
5596    proto$2.get = get$2;
5597    proto$2.milliseconds = milliseconds;
5598    proto$2.seconds = seconds;
5599    proto$2.minutes = minutes;
5600    proto$2.hours = hours;
5601    proto$2.days = days;
5602    proto$2.weeks = weeks;
5603    proto$2.months = months;
5604    proto$2.years = years;
5605    proto$2.humanize = humanize;
5606    proto$2.toISOString = toISOString$1;
5607    proto$2.toString = toISOString$1;
5608    proto$2.toJSON = toISOString$1;
5609    proto$2.locale = locale;
5610    proto$2.localeData = localeData;
5611
5612    proto$2.toIsoString = deprecate(
5613        'toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)',
5614        toISOString$1
5615    );
5616    proto$2.lang = lang;
5617
5618    // FORMATTING
5619
5620    addFormatToken('X', 0, 0, 'unix');
5621    addFormatToken('x', 0, 0, 'valueOf');
5622
5623    // PARSING
5624
5625    addRegexToken('x', matchSigned);
vendor: 5,330 bytes, lines 5626-5781
5626    addRegexToken('X', matchTimestamp);
5627    addParseToken('X', function (input, array, config) {
5628        config._d = new Date(parseFloat(input) * 1000);
5629    });
5630    addParseToken('x', function (input, array, config) {
5631        config._d = new Date(toInt(input));
5632    });
5633
5634    //! moment.js
5635
5636    hooks.version = '2.30.1';
5637
5638    setHookCallback(createLocal);
5639
5640    hooks.fn = proto;
5641    hooks.min = min;
5642    hooks.max = max;
5643    hooks.now = now;
5644    hooks.utc = createUTC;
5645    hooks.unix = createUnix;
5646    hooks.months = listMonths;
5647    hooks.isDate = isDate;
5648    hooks.locale = getSetGlobalLocale;
5649    hooks.invalid = createInvalid;
5650    hooks.duration = createDuration;
5651    hooks.isMoment = isMoment;
5652    hooks.weekdays = listWeekdays;
5653    hooks.parseZone = createInZone;
5654    hooks.localeData = getLocale;
5655    hooks.isDuration = isDuration;
5656    hooks.monthsShort = listMonthsShort;
5657    hooks.weekdaysMin = listWeekdaysMin;
5658    hooks.defineLocale = defineLocale;
5659    hooks.updateLocale = updateLocale;
5660    hooks.locales = listLocales;
5661    hooks.weekdaysShort = listWeekdaysShort;
5662    hooks.normalizeUnits = normalizeUnits;
5663    hooks.relativeTimeRounding = getSetRelativeTimeRounding;
5664    hooks.relativeTimeThreshold = getSetRelativeTimeThreshold;
5665    hooks.calendarFormat = getCalendarFormat;
5666    hooks.prototype = proto;
5667
5668    // currently HTML5 input type only supports 24-hour formats
5669    hooks.HTML5_FMT = {
5670        DATETIME_LOCAL: 'YYYY-MM-DDTHH:mm', // <input type="datetime-local" />
5671        DATETIME_LOCAL_SECONDS: 'YYYY-MM-DDTHH:mm:ss', // <input type="datetime-local" step="1" />
5672        DATETIME_LOCAL_MS: 'YYYY-MM-DDTHH:mm:ss.SSS', // <input type="datetime-local" step="0.001" />
5673        DATE: 'YYYY-MM-DD', // <input type="date" />
5674        TIME: 'HH:mm', // <input type="time" />
5675        TIME_SECONDS: 'HH:mm:ss', // <input type="time" step="1" />
5676        TIME_MS: 'HH:mm:ss.SSS', // <input type="time" step="0.001" />
5677        WEEK: 'GGGG-[W]WW', // <input type="week" />
5678        MONTH: 'YYYY-MM', // <input type="month" />
5679    };
5680
5681    //! moment.js locale configuration
5682
5683    var suffixes$5 = {
5684        1: "'inci",
5685        5: "'inci",
5686        8: "'inci",
5687        70: "'inci",
5688        80: "'inci",
5689        2: "'nci",
5690        7: "'nci",
5691        20: "'nci",
5692        50: "'nci",
5693        3: "'üncü",
5694        4: "'üncü",
5695        100: "'üncü",
5696        6: "'ncı",
5697        9: "'uncu",
5698        10: "'uncu",
5699        30: "'uncu",
5700        60: "'ıncı",
5701        90: "'ıncı",
5702    };
5703
5704    hooks.defineLocale('tr', {
5705        months: 'Ocak_Şubat_Mart_Nisan_Mayıs_Haziran_Temmuz_Ağustos_Eylül_Ekim_Kasım_Aralık'.split(
5706            '_'
5707        ),
5708        monthsShort: 'Oca_Şub_Mar_Nis_May_Haz_Tem_Ağu_Eyl_Eki_Kas_Ara'.split('_'),
5709        weekdays: 'Pazar_Pazartesi_Salı_Çarşamba_Perşembe_Cuma_Cumartesi'.split(
5710            '_'
5711        ),
5712        weekdaysShort: 'Paz_Pzt_Sal_Çar_Per_Cum_Cmt'.split('_'),
5713        weekdaysMin: 'Pz_Pt_Sa_Ça_Pe_Cu_Ct'.split('_'),
5714        meridiem: function (hours, minutes, isLower) {
5715            if (hours < 12) {
5716                return isLower ? 'öö' : 'ÖÖ';
5717            } else {
5718                return isLower ? 'ös' : 'ÖS';
5719            }
5720        },
5721        meridiemParse: /öö|ÖÖ|ös|ÖS/,
5722        isPM: function (input) {
5723            return input === 'ös' || input === 'ÖS';
5724        },
5725        longDateFormat: {
5726            LT: 'HH:mm',
5727            LTS: 'HH:mm:ss',
5728            L: 'DD.MM.YYYY',
5729            LL: 'D MMMM YYYY',
5730            LLL: 'D MMMM YYYY HH:mm',
5731            LLLL: 'dddd, D MMMM YYYY HH:mm',
5732        },
5733        calendar: {
5734            sameDay: '[bugün saat] LT',
5735            nextDay: '[yarın saat] LT',
5736            nextWeek: '[gelecek] dddd [saat] LT',
5737            lastDay: '[dün] LT',
5738            lastWeek: '[geçen] dddd [saat] LT',
5739            sameElse: 'L',
5740        },
5741        relativeTime: {
5742            future: '%s sonra',
5743            past: '%s önce',
5744            s: 'birkaç saniye',
5745            ss: '%d saniye',
5746            m: 'bir dakika',
5747            mm: '%d dakika',
5748            h: 'bir saat',
5749            hh: '%d saat',
5750            d: 'bir gün',
5751            dd: '%d gün',
5752            w: 'bir hafta',
5753            ww: '%d hafta',
5754            M: 'bir ay',
5755            MM: '%d ay',
5756            y: 'bir yıl',
5757            yy: '%d yıl',
5758        },
5759        ordinal: function (number, period) {
5760            switch (period) {
5761                case 'd':
5762                case 'D':
5763                case 'Do':
5764                case 'DD':
5765                    return number;
5766                default:
5767                    if (number === 0) {
5768                        // special case for zero
5769                        return number + "'ıncı";
5770                    }
5771                    var a = number % 10,
5772                        b = (number % 100) - a,
5773                        c = number >= 100 ? 100 : null;
5774                    return number + (suffixes$5[a] || suffixes$5[b] || suffixes$5[c]);
5775            }
5776        },
5777        week: {
5778            dow: 1, // Monday is the first day of the week.
5779            doy: 7, // The week that contains Jan 7th is the first week of the year.
5780        },
5781    });
5782
5783    hooks.locale('tr');
5784
5785    return hooks;
5786
5787})));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.