PageSourceSearch

https://phototo.co.kr/data/skin/front/on_commonMotif_p_phototo/js/moment/moment.js

js phototo.co.kr collected 2026-09-24 15:05:31 UTC 104,409 bytes, 3,195 lines download raw bytes

1//! moment.js
2//! version : 2.10.6
3//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
4//! license : MIT
5//! momentjs.com
6
7(function (global, factory) {
8    typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
9    typeof define === 'function' && define.amd ? define(factory) :
10    global.moment = factory()
11}(this, function () { 'use strict';
12
13    var hookCallback;
14
15    function utils_hooks__hooks () {
16        return hookCallback.apply(null, arguments);
17    }
18
19    // This is done to register the method called with moment()
20    // without creating circular dependencies.
21    function setHookCallback (callback) {
22        hookCallback = callback;
23    }
24
25    function isArray(input) {
26        return Object.prototype.toString.call(input) === '[object Array]';
27    }
28
29    function isDate(input) {
30        return input instanceof Date || Object.prototype.toString.call(input) === '[object Date]';
31    }
32
33    function map(arr, fn) {
34        var res = [], i;
35        for (i = 0; i < arr.length; ++i) {
36            res.push(fn(arr[i], i));
37        }
38        return res;
39    }
40
41    function hasOwnProp(a, b) {
42        return Object.prototype.hasOwnProperty.call(a, b);
43    }
44
45    function extend(a, b) {
46        for (var i in b) {
47            if (hasOwnProp(b, i)) {
48                a[i] = b[i];
49            }
50        }
51
52        if (hasOwnProp(b, 'toString')) {
53            a.toString = b.toString;
54        }
55
56        if (hasOwnProp(b, 'valueOf')) {
57            a.valueOf = b.valueOf;
58        }
59
60        return a;
61    }
62
63    function create_utc__createUTC (input, format, locale, strict) {
64        return createLocalOrUTC(input, format, locale, strict, true).utc();
65    }
66
67    function defaultParsingFlags() {
68        // We need to deep clone this object.
69        return {
70            empty           : false,
71            unusedTokens    : [],
72            unusedInput     : [],
73            overflow        : -2,
74            charsLeftOver   : 0,
75            nullInput       : false,
76            invalidMonth    : null,
77            invalidFormat   : false,
78            userInvalidated : false,
79            iso             : false
80        };
81    }
82
83    function getParsingFlags(m) {
84        if (m._pf == null) {
85            m._pf = defaultParsingFlags();
86        }
87        return m._pf;
88    }
89
90    function valid__isValid(m) {
91        if (m._isValid == null) {
92            var flags = getParsingFlags(m);
93            m._isValid = !isNaN(m._d.getTime()) &&
94                flags.overflow < 0 &&
95                !flags.empty &&
96                !flags.invalidMonth &&
97                !flags.invalidWeekday &&
98                !flags.nullInput &&
99                !flags.invalidFormat &&
100                !flags.userInvalidated;
101
102            if (m._strict) {
103                m._isValid = m._isValid &&
104                    flags.charsLeftOver === 0 &&
105                    flags.unusedTokens.length === 0 &&
106                    flags.bigHour === undefined;
107            }
108        }
109        return m._isValid;
110    }
111
112    function valid__createInvalid (flags) {
113        var m = create_utc__createUTC(NaN);
114        if (flags != null) {
115            extend(getParsingFlags(m), flags);
116        }
117        else {
118            getParsingFlags(m).userInvalidated = true;
119        }
120
121        return m;
122    }
123
124    var momentProperties = utils_hooks__hooks.momentProperties = [];
125
126    function copyConfig(to, from) {
127        var i, prop, val;
128
129        if (typeof from._isAMomentObject !== 'undefined') {
130            to._isAMomentObject = from._isAMomentObject;
131        }
132        if (typeof from._i !== 'undefined') {
133            to._i = from._i;
134        }
135        if (typeof from._f !== 'undefined') {
136            to._f = from._f;
137        }
138        if (typeof from._l !== 'undefined') {
139            to._l = from._l;
140        }
141        if (typeof from._strict !== 'undefined') {
142            to._strict = from._strict;
143        }
144        if (typeof from._tzm !== 'undefined') {
145            to._tzm = from._tzm;
146        }
147        if (typeof from._isUTC !== 'undefined') {
148            to._isUTC = from._isUTC;
149        }
150        if (typeof from._offset !== 'undefined') {
151            to._offset = from._offset;
152        }
153        if (typeof from._pf !== 'undefined') {
154            to._pf = getParsingFlags(from);
155        }
156        if (typeof from._locale !== 'undefined') {
157            to._locale = from._locale;
158        }
159
160        if (momentProperties.length > 0) {
161            for (i in momentProperties) {
162                prop = momentProperties[i];
163                val = from[prop];
164                if (typeof val !== 'undefined') {
165                    to[prop] = val;
166                }
167            }
168        }
169
170        return to;
171    }
172
173    var updateInProgress = false;
174
175    // Moment prototype object
176    function Moment(config) {
177        copyConfig(this, config);
178        this._d = new Date(config._d != null ? config._d.getTime() : NaN);
179        // Prevent infinite loop in case updateOffset creates new moment
180        // objects.
181        if (updateInProgress === false) {
182            updateInProgress = true;
183            utils_hooks__hooks.updateOffset(this);
184            updateInProgress = false;
185        }
186    }
187
188    function isMoment (obj) {
189        return obj instanceof Moment || (obj != null && obj._isAMomentObject != null);
190    }
191
192    function absFloor (number) {
193        if (number < 0) {
194            return Math.ceil(number);
195        } else {
196            return Math.floor(number);
197        }
198    }
199
200    function toInt(argumentForCoercion) {
201        var coercedNumber = +argumentForCoercion,
202            value = 0;
203
204        if (coercedNumber !== 0 && isFinite(coercedNumber)) {
205            value = absFloor(coercedNumber);
206        }
207
208        return value;
209    }
210
211    function compareArrays(array1, array2, dontConvert) {
212        var len = Math.min(array1.length, array2.length),
213            lengthDiff = Math.abs(array1.length - array2.length),
214            diffs = 0,
215            i;
216        for (i = 0; i < len; i++) {
217            if ((dontConvert && array1[i] !== array2[i]) ||
218                (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {
219                diffs++;
220            }
221        }
222        return diffs + lengthDiff;
223    }
224
225    function Locale() {
226    }
227
228    var locales = {};
229    var globalLocale;
230
231    function normalizeLocale(key) {
232        return key ? key.toLowerCase().replace('_', '-') : key;
233    }
234
235    // pick the locale from the array
236    // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each
237    // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root
238    function chooseLocale(names) {
239        var i = 0, j, next, locale, split;
240
241        while (i < names.length) {
242            split = normalizeLocale(names[i]).split('-');
243            j = split.length;
244            next = normalizeLocale(names[i + 1]);
245            next = next ? next.split('-') : null;
246            while (j > 0) {
247                locale = loadLocale(split.slice(0, j).join('-'));
248                if (locale) {
249                    return locale;
250                }
251                if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {
252                    //the next array item is better than a shallower substring of this one
253                    break;
254                }
255                j--;
256            }
257            i++;
258        }
259        return null;
260    }
261
262    function loadLocale(name) {
263        var oldLocale = null;
264        // TODO: Find a better way to register and load all the locales in Node
265        if (!locales[name] && typeof module !== 'undefined' &&
266                module && module.exports) {
267            try {
268                oldLocale = globalLocale._abbr;
269                require('./locale/' + name);
270                // because defineLocale currently also sets the global locale, we
271                // want to undo that for lazy loaded locales
272                locale_locales__getSetGlobalLocale(oldLocale);
273            } catch (e) { }
274        }
275        return locales[name];
276    }
277
278    // This function will load locale and then set the global locale.  If
279    // no arguments are passed in, it will simply return the current global
280    // locale key.
281    function locale_locales__getSetGlobalLocale (key, values) {
282        var data;
283        if (key) {
284            if (typeof values === 'undefined') {
285                data = locale_locales__getLocale(key);
286            }
287            else {
288                data = defineLocale(key, values);
289            }
290
291            if (data) {
292                // moment.duration._locale = moment._locale = data;
293                globalLocale = data;
294            }
295        }
296
297        return globalLocale._abbr;
298    }
299
300    function defineLocale (name, values) {
301        if (values !== null) {
302            values.abbr = name;
303            locales[name] = locales[name] || new Locale();
304            locales[name].set(values);
305
306            // backwards compat for now: also set the locale
307            locale_locales__getSetGlobalLocale(name);
308
309            return locales[name];
310        } else {
311            // useful for testing
312            delete locales[name];
313            return null;
314        }
315    }
316
317    // returns locale data
318    function locale_locales__getLocale (key) {
319        var locale;
320
321        if (key && key._locale && key._locale._abbr) {
322            key = key._locale._abbr;
323        }
324
325        if (!key) {
326            return globalLocale;
327        }
328
329        if (!isArray(key)) {
330            //short-circuit everything else
331            locale = loadLocale(key);
332            if (locale) {
333                return locale;
334            }
335            key = [key];
336        }
337
338        return chooseLocale(key);
339    }
340
341    var aliases = {};
342
343    function addUnitAlias (unit, shorthand) {
344        var lowerCase = unit.toLowerCase();
345        aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit;
346    }
347
348    function normalizeUnits(units) {
349        return typeof units === 'string' ? aliases[units] || aliases[units.toLowerCase()] : undefined;
350    }
351
vendor: 12,976 bytes, lines 352-747
352    function normalizeObjectUnits(inputObject) {
353        var normalizedInput = {},
354            normalizedProp,
355            prop;
356
357        for (prop in inputObject) {
358            if (hasOwnProp(inputObject, prop)) {
359                normalizedProp = normalizeUnits(prop);
360                if (normalizedProp) {
361                    normalizedInput[normalizedProp] = inputObject[prop];
362                }
363            }
364        }
365
366        return normalizedInput;
367    }
368
369    function makeGetSet (unit, keepTime) {
370        return function (value) {
371            if (value != null) {
372                get_set__set(this, unit, value);
373                utils_hooks__hooks.updateOffset(this, keepTime);
374                return this;
375            } else {
376                return get_set__get(this, unit);
377            }
378        };
379    }
380
381    function get_set__get (mom, unit) {
382        return mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]();
383    }
384
385    function get_set__set (mom, unit, value) {
386        return mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value);
387    }
388
389    // MOMENTS
390
391    function getSet (units, value) {
392        var unit;
393        if (typeof units === 'object') {
394            for (unit in units) {
395                this.set(unit, units[unit]);
396            }
397        } else {
398            units = normalizeUnits(units);
399            if (typeof this[units] === 'function') {
400                return this[units](value);
401            }
402        }
403        return this;
404    }
405
406    function zeroFill(number, targetLength, forceSign) {
407        var absNumber = '' + Math.abs(number),
408            zerosToFill = targetLength - absNumber.length,
409            sign = number >= 0;
410        return (sign ? (forceSign ? '+' : '') : '-') +
411            Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber;
412    }
413
414    var formattingTokens = /(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Q|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g;
415
416    var localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g;
417
418    var formatFunctions = {};
419
420    var formatTokenFunctions = {};
421
422    // token:    'M'
423    // padded:   ['MM', 2]
424    // ordinal:  'Mo'
425    // callback: function () { this.month() + 1 }
426    function addFormatToken (token, padded, ordinal, callback) {
427        var func = callback;
428        if (typeof callback === 'string') {
429            func = function () {
430                return this[callback]();
431            };
432        }
433        if (token) {
434            formatTokenFunctions[token] = func;
435        }
436        if (padded) {
437            formatTokenFunctions[padded[0]] = function () {
438                return zeroFill(func.apply(this, arguments), padded[1], padded[2]);
439            };
440        }
441        if (ordinal) {
442            formatTokenFunctions[ordinal] = function () {
443                return this.localeData().ordinal(func.apply(this, arguments), token);
444            };
445        }
446    }
447
448    function removeFormattingTokens(input) {
449        if (input.match(/\[[\s\S]/)) {
450            return input.replace(/^\[|\]$/g, '');
451        }
452        return input.replace(/\\/g, '');
453    }
454
455    function makeFormatFunction(format) {
456        var array = format.match(formattingTokens), i, length;
457
458        for (i = 0, length = array.length; i < length; i++) {
459            if (formatTokenFunctions[array[i]]) {
460                array[i] = formatTokenFunctions[array[i]];
461            } else {
462                array[i] = removeFormattingTokens(array[i]);
463            }
464        }
465
466        return function (mom) {
467            var output = '';
468            for (i = 0; i < length; i++) {
469                output += array[i] instanceof Function ? array[i].call(mom, format) : array[i];
470            }
471            return output;
472        };
473    }
474
475    // format date using native date object
476    function formatMoment(m, format) {
477        if (!m.isValid()) {
478            return m.localeData().invalidDate();
479        }
480
481        format = expandFormat(format, m.localeData());
482        formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format);
483
484        return formatFunctions[format](m);
485    }
486
487    function expandFormat(format, locale) {
488        var i = 5;
489
490        function replaceLongDateFormatTokens(input) {
491            return locale.longDateFormat(input) || input;
492        }
493
494        localFormattingTokens.lastIndex = 0;
495        while (i >= 0 && localFormattingTokens.test(format)) {
496            format = format.replace(localFormattingTokens, replaceLongDateFormatTokens);
497            localFormattingTokens.lastIndex = 0;
498            i -= 1;
499        }
500
501        return format;
502    }
503
504    var match1         = /\d/;            //       0 - 9
505    var match2         = /\d\d/;          //      00 - 99
506    var match3         = /\d{3}/;         //     000 - 999
507    var match4         = /\d{4}/;         //    0000 - 9999
508    var match6         = /[+-]?\d{6}/;    // -999999 - 999999
509    var match1to2      = /\d\d?/;         //       0 - 99
510    var match1to3      = /\d{1,3}/;       //       0 - 999
511    var match1to4      = /\d{1,4}/;       //       0 - 9999
512    var match1to6      = /[+-]?\d{1,6}/;  // -999999 - 999999
513
514    var matchUnsigned  = /\d+/;           //       0 - inf
515    var matchSigned    = /[+-]?\d+/;      //    -inf - inf
516
517    var matchOffset    = /Z|[+-]\d\d:?\d\d/gi; // +00:00 -00:00 +0000 -0000 or Z
518
519    var matchTimestamp = /[+-]?\d+(\.\d{1,3})?/; // 123456789 123456789.123
520
521    // any word (or two) characters or numbers including two/three word month in arabic.
522    var matchWord = /[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i;
523
524    var regexes = {};
525
526    function isFunction (sth) {
527        // https://github.com/moment/moment/issues/2325
528        return typeof sth === 'function' &&
529            Object.prototype.toString.call(sth) === '[object Function]';
530    }
531
532
533    function addRegexToken (token, regex, strictRegex) {
534        regexes[token] = isFunction(regex) ? regex : function (isStrict) {
535            return (isStrict && strictRegex) ? strictRegex : regex;
536        };
537    }
538
539    function getParseRegexForToken (token, config) {
540        if (!hasOwnProp(regexes, token)) {
541            return new RegExp(unescapeFormat(token));
542        }
543
544        return regexes[token](config._strict, config._locale);
545    }
546
547    // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript
548    function unescapeFormat(s) {
549        return s.replace('\\', '').replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) {
550            return p1 || p2 || p3 || p4;
551        }).replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
552    }
553
554    var tokens = {};
555
556    function addParseToken (token, callback) {
557        var i, func = callback;
558        if (typeof token === 'string') {
559            token = [token];
560        }
561        if (typeof callback === 'number') {
562            func = function (input, array) {
563                array[callback] = toInt(input);
564            };
565        }
566        for (i = 0; i < token.length; i++) {
567            tokens[token[i]] = func;
568        }
569    }
570
571    function addWeekParseToken (token, callback) {
572        addParseToken(token, function (input, array, config, token) {
573            config._w = config._w || {};
574            callback(input, config._w, config, token);
575        });
576    }
577
578    function addTimeToArrayFromToken(token, input, config) {
579        if (input != null && hasOwnProp(tokens, token)) {
580            tokens[token](input, config._a, config, token);
581        }
582    }
583
584    var YEAR = 0;
585    var MONTH = 1;
586    var DATE = 2;
587    var HOUR = 3;
588    var MINUTE = 4;
589    var SECOND = 5;
590    var MILLISECOND = 6;
591
592    function daysInMonth(year, month) {
593        return new Date(Date.UTC(year, month + 1, 0)).getUTCDate();
594    }
595
596    // FORMATTING
597
598    addFormatToken('M', ['MM', 2], 'Mo', function () {
599        return this.month() + 1;
600    });
601
602    addFormatToken('MMM', 0, 0, function (format) {
603        return this.localeData().monthsShort(this, format);
604    });
605
606    addFormatToken('MMMM', 0, 0, function (format) {
607        return this.localeData().months(this, format);
608    });
609
610    // ALIASES
611
612    addUnitAlias('month', 'M');
613
614    // PARSING
615
616    addRegexToken('M',    match1to2);
617    addRegexToken('MM',   match1to2, match2);
618    addRegexToken('MMM',  matchWord);
619    addRegexToken('MMMM', matchWord);
620
621    addParseToken(['M', 'MM'], function (input, array) {
622        array[MONTH] = toInt(input) - 1;
623    });
624
625    addParseToken(['MMM', 'MMMM'], function (input, array, config, token) {
626        var month = config._locale.monthsParse(input, token, config._strict);
627        // if we didn't find a month name, mark the date as invalid.
628        if (month != null) {
629            array[MONTH] = month;
630        } else {
631            getParsingFlags(config).invalidMonth = input;
632        }
633    });
634
635    // LOCALES
636
637    var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_');
638    function localeMonths (m) {
639        return this._months[m.month()];
640    }
641
642    var defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_');
643    function localeMonthsShort (m) {
644        return this._monthsShort[m.month()];
645    }
646
647    function localeMonthsParse (monthName, format, strict) {
648        var i, mom, regex;
649
650        if (!this._monthsParse) {
651            this._monthsParse = [];
652            this._longMonthsParse = [];
653            this._shortMonthsParse = [];
654        }
655
656        for (i = 0; i < 12; i++) {
657            // make the regex if we don't have it already
658            mom = create_utc__createUTC([2000, i]);
659            if (strict && !this._longMonthsParse[i]) {
660                this._longMonthsParse[i] = new RegExp('^' + this.months(mom, '').replace('.', '') + '$', 'i');
661                this._shortMonthsParse[i] = new RegExp('^' + this.monthsShort(mom, '').replace('.', '') + '$', 'i');
662            }
663            if (!strict && !this._monthsParse[i]) {
664                regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, '');
665                this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');
666            }
667            // test the regex
668            if (strict && format === 'MMMM' && this._longMonthsParse[i].test(monthName)) {
669                return i;
670            } else if (strict && format === 'MMM' && this._shortMonthsParse[i].test(monthName)) {
671                return i;
672            } else if (!strict && this._monthsParse[i].test(monthName)) {
673                return i;
674            }
675        }
676    }
677
678    // MOMENTS
679
680    function setMonth (mom, value) {
681        var dayOfMonth;
682
683        // TODO: Move this out of here!
684        if (typeof value === 'string') {
685            value = mom.localeData().monthsParse(value);
686            // TODO: Another silent failure?
687            if (typeof value !== 'number') {
688                return mom;
689            }
690        }
691
692        dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value));
693        mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth);
694        return mom;
695    }
696
697    function getSetMonth (value) {
698        if (value != null) {
699            setMonth(this, value);
700            utils_hooks__hooks.updateOffset(this, true);
701            return this;
702        } else {
703            return get_set__get(this, 'Month');
704        }
705    }
706
707    function getDaysInMonth () {
708        return daysInMonth(this.year(), this.month());
709    }
710
711    function checkOverflow (m) {
712        var overflow;
713        var a = m._a;
714
715        if (a && getParsingFlags(m).overflow === -2) {
716            overflow =
717                a[MONTH]       < 0 || a[MONTH]       > 11  ? MONTH :
718                a[DATE]        < 1 || a[DATE]        > daysInMonth(a[YEAR], a[MONTH]) ? DATE :
719                a[HOUR]        < 0 || a[HOUR]        > 24 || (a[HOUR] === 24 && (a[MINUTE] !== 0 || a[SECOND] !== 0 || a[MILLISECOND] !== 0)) ? HOUR :
720                a[MINUTE]      < 0 || a[MINUTE]      > 59  ? MINUTE :
721                a[SECOND]      < 0 || a[SECOND]      > 59  ? SECOND :
722                a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND :
723                -1;
724
725            if (getParsingFlags(m)._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) {
726                overflow = DATE;
727            }
728
729            getParsingFlags(m).overflow = overflow;
730        }
731
732        return m;
733    }
734
735    function warn(msg) {
736        if (utils_hooks__hooks.suppressDeprecationWarnings === false && typeof console !== 'undefined' && console.warn) {
737            console.warn('Deprecation warning: ' + msg);
738        }
739    }
740
741    function deprecate(msg, fn) {
742        var firstTime = true;
743
744        return extend(function () {
745            if (firstTime) {
746                warn(msg + '\n' + (new Error()).stack);
747                firstTime = false;
748            }
749            return fn.apply(this, arguments);
750        }, fn);
751    }
752
753    var deprecations = {};
754
755    function deprecateSimple(name, msg) {
756        if (!deprecations[name]) {
757            warn(msg);
758            deprecations[name] = true;
759        }
760    }
761
762    utils_hooks__hooks.suppressDeprecationWarnings = false;
763
764    var from_string__isoRegex = /^\s*(?:[+-]\d{6}|\d{4})-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/;
765
766    var isoDates = [
767        ['YYYYYY-MM-DD', /[+-]\d{6}-\d{2}-\d{2}/],
768        ['YYYY-MM-DD', /\d{4}-\d{2}-\d{2}/],
769        ['GGGG-[W]WW-E', /\d{4}-W\d{2}-\d/],
770        ['GGGG-[W]WW', /\d{4}-W\d{2}/],
771        ['YYYY-DDD', /\d{4}-\d{3}/]
772    ];
773
774    // iso time formats and regexes
775    var isoTimes = [
776        ['HH:mm:ss.SSSS', /(T| )\d\d:\d\d:\d\d\.\d+/],
777        ['HH:mm:ss', /(T| )\d\d:\d\d:\d\d/],
778        ['HH:mm', /(T| )\d\d:\d\d/],
779        ['HH', /(T| )\d\d/]
780    ];
781
782    var aspNetJsonRegex = /^\/?Date\((\-?\d+)/i;
783
784    // date from iso format
785    function configFromISO(config) {
786        var i, l,
787            string = config._i,
788            match = from_string__isoRegex.exec(string);
789
790        if (match) {
791            getParsingFlags(config).iso = true;
792            for (i = 0, l = isoDates.length; i < l; i++) {
793                if (isoDates[i][1].exec(string)) {
794                    config._f = isoDates[i][0];
795                    break;
796                }
797            }
798            for (i = 0, l = isoTimes.length; i < l; i++) {
799                if (isoTimes[i][1].exec(string)) {
800                    // match[6] should be 'T' or space
801                    config._f += (match[6] || ' ') + isoTimes[i][0];
802                    break;
803                }
804            }
805            if (string.match(matchOffset)) {
806                config._f += 'Z';
807            }
808            configFromStringAndFormat(config);
809        } else {
810            config._isValid = false;
811        }
812    }
813
814    // date from iso format or fallback
815    function configFromString(config) {
816        var matched = aspNetJsonRegex.exec(config._i);
817
818        if (matched !== null) {
819            config._d = new Date(+matched[1]);
820            return;
821        }
822
823        configFromISO(config);
824        if (config._isValid === false) {
825            delete config._isValid;
826            utils_hooks__hooks.createFromInputFallback(config);
827        }
828    }
829
830    utils_hooks__hooks.createFromInputFallback = deprecate(
831        'moment construction falls back to js Date. This is ' +
832        'discouraged and will be removed in upcoming major ' +
833        'release. Please refer to ' +
834        'https://github.com/moment/moment/issues/1407 for more info.',
835        function (config) {
836            config._d = new Date(config._i + (config._useUTC ? ' UTC' : ''));
837        }
838    );
839
840    function createDate (y, m, d, h, M, s, ms) {
841        //can't just apply() to create a date:
842        //http://stackoverflow.com/questions/181348/instantiating-a-javascript-object-by-calling-prototype-constructor-apply
843        var date = new Date(y, m, d, h, M, s, ms);
844
845        //the date constructor doesn't accept years < 1970
846        if (y < 1970) {
847            date.setFullYear(y);
848        }
849        return date;
850    }
851
852    function createUTCDate (y) {
853        var date = new Date(Date.UTC.apply(null, arguments));
854        if (y < 1970) {
855            date.setUTCFullYear(y);
856        }
857        return date;
858    }
859
860    addFormatToken(0, ['YY', 2], 0, function () {
861        return this.year() % 100;
862    });
863
864    addFormatToken(0, ['YYYY',   4],       0, 'year');
865    addFormatToken(0, ['YYYYY',  5],       0, 'year');
866    addFormatToken(0, ['YYYYYY', 6, true], 0, 'year');
867
868    // ALIASES
869
870    addUnitAlias('year', 'y');
871
872    // PARSING
873
874    addRegexToken('Y',      matchSigned);
875    addRegexToken('YY',     match1to2, match2);
876    addRegexToken('YYYY',   match1to4, match4);
877    addRegexToken('YYYYY',  match1to6, match6);
878    addRegexToken('YYYYYY', match1to6, match6);
879
880    addParseToken(['YYYYY', 'YYYYYY'], YEAR);
881    addParseToken('YYYY', function (input, array) {
882        array[YEAR] = input.length === 2 ? utils_hooks__hooks.parseTwoDigitYear(input) : toInt(input);
883    });
884    addParseToken('YY', function (input, array) {
885        array[YEAR] = utils_hooks__hooks.parseTwoDigitYear(input);
886    });
887
888    // HELPERS
889
890    function daysInYear(year) {
891        return isLeapYear(year) ? 366 : 365;
892    }
893
894    function isLeapYear(year) {
895        return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
896    }
897
898    // HOOKS
899
900    utils_hooks__hooks.parseTwoDigitYear = function (input) {
901        return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);
902    };
903
904    // MOMENTS
905
906    var getSetYear = makeGetSet('FullYear', false);
907
908    function getIsLeapYear () {
909        return isLeapYear(this.year());
910    }
911
912    addFormatToken('w', ['ww', 2], 'wo', 'week');
913    addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek');
914
915    // ALIASES
916
917    addUnitAlias('week', 'w');
918    addUnitAlias('isoWeek', 'W');
919
920    // PARSING
921
922    addRegexToken('w',  match1to2);
923    addRegexToken('ww', match1to2, match2);
924    addRegexToken('W',  match1to2);
925    addRegexToken('WW', match1to2, match2);
926
927    addWeekParseToken(['w', 'ww', 'W', 'WW'], function (input, week, config, token) {
928        week[token.substr(0, 1)] = toInt(input);
929    });
930
931    // HELPERS
932
933    // firstDayOfWeek       0 = sun, 6 = sat
934    //                      the day of the week that starts the week
935    //                      (usually sunday or monday)
936    // firstDayOfWeekOfYear 0 = sun, 6 = sat
937    //                      the first week is the week that contains the first
938    //                      of this day of the week
939    //                      (eg. ISO weeks use thursday (4))
940    function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {
941        var end = firstDayOfWeekOfYear - firstDayOfWeek,
942            daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),
943            adjustedMoment;
944
945
946        if (daysToDayOfWeek > end) {
947            daysToDayOfWeek -= 7;
948        }
949
950        if (daysToDayOfWeek < end - 7) {
951            daysToDayOfWeek += 7;
952        }
953
954        adjustedMoment = local__createLocal(mom).add(daysToDayOfWeek, 'd');
955        return {
956            week: Math.ceil(adjustedMoment.dayOfYear() / 7),
957            year: adjustedMoment.year()
958        };
959    }
960
961    // LOCALES
962
963    function localeWeek (mom) {
964        return weekOfYear(mom, this._week.dow, this._week.doy).week;
965    }
966
967    var defaultLocaleWeek = {
968        dow : 0, // Sunday is the first day of the week.
969        doy : 6  // The week that contains Jan 1st is the first week of the year.
970    };
971
972    function localeFirstDayOfWeek () {
973        return this._week.dow;
974    }
975
976    function localeFirstDayOfYear () {
977        return this._week.doy;
978    }
979
980    // MOMENTS
981
982    function getSetWeek (input) {
983        var week = this.localeData().week(this);
984        return input == null ? week : this.add((input - week) * 7, 'd');
985    }
986
987    function getSetISOWeek (input) {
988        var week = weekOfYear(this, 1, 4).week;
989        return input == null ? week : this.add((input - week) * 7, 'd');
990    }
991
992    addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear');
993
994    // ALIASES
995
996    addUnitAlias('dayOfYear', 'DDD');
997
998    // PARSING
999
1000    addRegexToken('DDD',  match1to3);
1001    addRegexToken('DDDD', match3);
1002    addParseToken(['DDD', 'DDDD'], function (input, array, config) {
1003        config._dayOfYear = toInt(input);
1004    });
1005
1006    // HELPERS
1007
1008    //http://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday
1009    function dayOfYearFromWeeks(year, week, weekday, firstDayOfWeekOfYear, firstDayOfWeek) {
1010        var week1Jan = 6 + firstDayOfWeek - firstDayOfWeekOfYear, janX = createUTCDate(year, 0, 1 + week1Jan), d = janX.getUTCDay(), dayOfYear;
1011        if (d < firstDayOfWeek) {
1012            d += 7;
1013        }
1014
1015        weekday = weekday != null ? 1 * weekday : firstDayOfWeek;
1016
1017        dayOfYear = 1 + week1Jan + 7 * (week - 1) - d + weekday;
1018
1019        return {
1020            year: dayOfYear > 0 ? year : year - 1,
1021            dayOfYear: dayOfYear > 0 ?  dayOfYear : daysInYear(year - 1) + dayOfYear
1022        };
1023    }
1024
1025    // MOMENTS
1026
1027    function getSetDayOfYear (input) {
1028        var dayOfYear = Math.round((this.clone().startOf('day') - this.clone().startOf('year')) / 864e5) + 1;
1029        return input == null ? dayOfYear : this.add((input - dayOfYear), 'd');
1030    }
1031
1032    // Pick the first defined of two or three arguments.
1033    function defaults(a, b, c) {
1034        if (a != null) {
1035            return a;
1036        }
1037        if (b != null) {
1038            return b;
1039        }
1040        return c;
1041    }
1042
1043    function currentDateArray(config) {
1044        var now = new Date();
1045        if (config._useUTC) {
1046            return [now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate()];
1047        }
1048        return [now.getFullYear(), now.getMonth(), now.getDate()];
1049    }
1050
1051    // convert an array to a date.
1052    // the array should mirror the parameters below
1053    // note: all values past the year are optional and will default to the lowest possible value.
1054    // [year, month, day , hour, minute, second, millisecond]
1055    function configFromArray (config) {
1056        var i, date, input = [], currentDate, yearToUse;
1057
1058        if (config._d) {
1059            return;
1060        }
1061
1062        currentDate = currentDateArray(config);
1063
1064        //compute day of the year from weeks and weekdays
1065        if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {
1066            dayOfYearFromWeekInfo(config);
1067        }
1068
1069        //if the day of the year is set, figure out what it is
1070        if (config._dayOfYear) {
1071            yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);
1072
1073            if (config._dayOfYear > daysInYear(yearToUse)) {
1074                getParsingFlags(config)._overflowDayOfYear = true;
1075            }
1076
1077            date = createUTCDate(yearToUse, 0, config._dayOfYear);
1078            config._a[MONTH] = date.getUTCMonth();
1079            config._a[DATE] = date.getUTCDate();
1080        }
1081
1082        // Default to current date.
1083        // * if no year, month, day of month are given, default to today
1084        // * if day of month is given, default month and year
1085        // * if month is given, default only year
1086        // * if year is given, don't default anything
1087        for (i = 0; i < 3 && config._a[i] == null; ++i) {
vendor: 9,446 bytes, lines 1088-1372
1088            config._a[i] = input[i] = currentDate[i];
1089        }
1090
1091        // Zero out whatever was not defaulted, including time
1092        for (; i < 7; i++) {
1093            config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];
1094        }
1095
1096        // Check for 24:00:00.000
1097        if (config._a[HOUR] === 24 &&
1098                config._a[MINUTE] === 0 &&
1099                config._a[SECOND] === 0 &&
1100                config._a[MILLISECOND] === 0) {
1101            config._nextDay = true;
1102            config._a[HOUR] = 0;
1103        }
1104
1105        config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);
1106        // Apply timezone offset from input. The actual utcOffset can be changed
1107        // with parseZone.
1108        if (config._tzm != null) {
1109            config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
1110        }
1111
1112        if (config._nextDay) {
1113            config._a[HOUR] = 24;
1114        }
1115    }
1116
1117    function dayOfYearFromWeekInfo(config) {
1118        var w, weekYear, week, weekday, dow, doy, temp;
1119
1120        w = config._w;
1121        if (w.GG != null || w.W != null || w.E != null) {
1122            dow = 1;
1123            doy = 4;
1124
1125            // TODO: We need to take the current isoWeekYear, but that depends on
1126            // how we interpret now (local, utc, fixed offset). So create
1127            // a now version of current config (take local/utc/offset flags, and
1128            // create now).
1129            weekYear = defaults(w.GG, config._a[YEAR], weekOfYear(local__createLocal(), 1, 4).year);
1130            week = defaults(w.W, 1);
1131            weekday = defaults(w.E, 1);
1132        } else {
1133            dow = config._locale._week.dow;
1134            doy = config._locale._week.doy;
1135
1136            weekYear = defaults(w.gg, config._a[YEAR], weekOfYear(local__createLocal(), dow, doy).year);
1137            week = defaults(w.w, 1);
1138
1139            if (w.d != null) {
1140                // weekday -- low day numbers are considered next week
1141                weekday = w.d;
1142                if (weekday < dow) {
1143                    ++week;
1144                }
1145            } else if (w.e != null) {
1146                // local weekday -- counting starts from begining of week
1147                weekday = w.e + dow;
1148            } else {
1149                // default to begining of week
1150                weekday = dow;
1151            }
1152        }
1153        temp = dayOfYearFromWeeks(weekYear, week, weekday, doy, dow);
1154
1155        config._a[YEAR] = temp.year;
1156        config._dayOfYear = temp.dayOfYear;
1157    }
1158
1159    utils_hooks__hooks.ISO_8601 = function () {};
1160
1161    // date from string and format string
1162    function configFromStringAndFormat(config) {
1163        // TODO: Move this to another part of the creation flow to prevent circular deps
1164        if (config._f === utils_hooks__hooks.ISO_8601) {
1165            configFromISO(config);
1166            return;
1167        }
1168
1169        config._a = [];
1170        getParsingFlags(config).empty = true;
1171
1172        // This array is used to make a Date, either with `new Date` or `Date.UTC`
1173        var string = '' + config._i,
1174            i, parsedInput, tokens, token, skipped,
1175            stringLength = string.length,
1176            totalParsedInputLength = 0;
1177
1178        tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];
1179
1180        for (i = 0; i < tokens.length; i++) {
1181            token = tokens[i];
1182            parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];
1183            if (parsedInput) {
1184                skipped = string.substr(0, string.indexOf(parsedInput));
1185                if (skipped.length > 0) {
1186                    getParsingFlags(config).unusedInput.push(skipped);
1187                }
1188                string = string.slice(string.indexOf(parsedInput) + parsedInput.length);
1189                totalParsedInputLength += parsedInput.length;
1190            }
1191            // don't parse if it's not a known token
1192            if (formatTokenFunctions[token]) {
1193                if (parsedInput) {
1194                    getParsingFlags(config).empty = false;
1195                }
1196                else {
1197                    getParsingFlags(config).unusedTokens.push(token);
1198                }
1199                addTimeToArrayFromToken(token, parsedInput, config);
1200            }
1201            else if (config._strict && !parsedInput) {
1202                getParsingFlags(config).unusedTokens.push(token);
1203            }
1204        }
1205
1206        // add remaining unparsed input length to the string
1207        getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength;
1208        if (string.length > 0) {
1209            getParsingFlags(config).unusedInput.push(string);
1210        }
1211
1212        // clear _12h flag if hour is <= 12
1213        if (getParsingFlags(config).bigHour === true &&
1214                config._a[HOUR] <= 12 &&
1215                config._a[HOUR] > 0) {
1216            getParsingFlags(config).bigHour = undefined;
1217        }
1218        // handle meridiem
1219        config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem);
1220
1221        configFromArray(config);
1222        checkOverflow(config);
1223    }
1224
1225
1226    function meridiemFixWrap (locale, hour, meridiem) {
1227        var isPm;
1228
1229        if (meridiem == null) {
1230            // nothing to do
1231            return hour;
1232        }
1233        if (locale.meridiemHour != null) {
1234            return locale.meridiemHour(hour, meridiem);
1235        } else if (locale.isPM != null) {
1236            // Fallback
1237            isPm = locale.isPM(meridiem);
1238            if (isPm && hour < 12) {
1239                hour += 12;
1240            }
1241            if (!isPm && hour === 12) {
1242                hour = 0;
1243            }
1244            return hour;
1245        } else {
1246            // this is not supposed to happen
1247            return hour;
1248        }
1249    }
1250
1251    function configFromStringAndArray(config) {
1252        var tempConfig,
1253            bestMoment,
1254
1255            scoreToBeat,
1256            i,
1257            currentScore;
1258
1259        if (config._f.length === 0) {
1260            getParsingFlags(config).invalidFormat = true;
1261            config._d = new Date(NaN);
1262            return;
1263        }
1264
1265        for (i = 0; i < config._f.length; i++) {
1266            currentScore = 0;
1267            tempConfig = copyConfig({}, config);
1268            if (config._useUTC != null) {
1269                tempConfig._useUTC = config._useUTC;
1270            }
1271            tempConfig._f = config._f[i];
1272            configFromStringAndFormat(tempConfig);
1273
1274            if (!valid__isValid(tempConfig)) {
1275                continue;
1276            }
1277
1278            // if there is any input that was not parsed add a penalty for that format
1279            currentScore += getParsingFlags(tempConfig).charsLeftOver;
1280
1281            //or tokens
1282            currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10;
1283
1284            getParsingFlags(tempConfig).score = currentScore;
1285
1286            if (scoreToBeat == null || currentScore < scoreToBeat) {
1287                scoreToBeat = currentScore;
1288                bestMoment = tempConfig;
1289            }
1290        }
1291
1292        extend(config, bestMoment || tempConfig);
1293    }
1294
1295    function configFromObject(config) {
1296        if (config._d) {
1297            return;
1298        }
1299
1300        var i = normalizeObjectUnits(config._i);
1301        config._a = [i.year, i.month, i.day || i.date, i.hour, i.minute, i.second, i.millisecond];
1302
1303        configFromArray(config);
1304    }
1305
1306    function createFromConfig (config) {
1307        var res = new Moment(checkOverflow(prepareConfig(config)));
1308        if (res._nextDay) {
1309            // Adding is smart enough around DST
1310            res.add(1, 'd');
1311            res._nextDay = undefined;
1312        }
1313
1314        return res;
1315    }
1316
1317    function prepareConfig (config) {
1318        var input = config._i,
1319            format = config._f;
1320
1321        config._locale = config._locale || locale_locales__getLocale(config._l);
1322
1323        if (input === null || (format === undefined && input === '')) {
1324            return valid__createInvalid({nullInput: true});
1325        }
1326
1327        if (typeof input === 'string') {
1328            config._i = input = config._locale.preparse(input);
1329        }
1330
1331        if (isMoment(input)) {
1332            return new Moment(checkOverflow(input));
1333        } else if (isArray(format)) {
1334            configFromStringAndArray(config);
1335        } else if (format) {
1336            configFromStringAndFormat(config);
1337        } else if (isDate(input)) {
1338            config._d = input;
1339        } else {
1340            configFromInput(config);
1341        }
1342
1343        return config;
1344    }
1345
1346    function configFromInput(config) {
1347        var input = config._i;
1348        if (input === undefined) {
1349            config._d = new Date();
1350        } else if (isDate(input)) {
1351            config._d = new Date(+input);
1352        } else if (typeof input === 'string') {
1353            configFromString(config);
1354        } else if (isArray(input)) {
1355            config._a = map(input.slice(0), function (obj) {
1356                return parseInt(obj, 10);
1357            });
1358            configFromArray(config);
1359        } else if (typeof(input) === 'object') {
1360            configFromObject(config);
1361        } else if (typeof(input) === 'number') {
1362            // from milliseconds
1363            config._d = new Date(input);
1364        } else {
1365            utils_hooks__hooks.createFromInputFallback(config);
1366        }
1367    }
1368
1369    function createLocalOrUTC (input, format, locale, strict, isUTC) {
1370        var c = {};
1371
1372        if (typeof(locale) === 'boolean') {
1373            strict = locale;
1374            locale = undefined;
1375        }
1376        // object construction must be done this way.
1377        // https://github.com/moment/moment/issues/1423
1378        c._isAMomentObject = true;
1379        c._useUTC = c._isUTC = isUTC;
1380        c._l = locale;
1381        c._i = input;
1382        c._f = format;
1383        c._strict = strict;
1384
1385        return createFromConfig(c);
1386    }
1387
1388    function local__createLocal (input, format, locale, strict) {
1389        return createLocalOrUTC(input, format, locale, strict, false);
1390    }
1391
1392    var prototypeMin = deprecate(
1393         'moment().min is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548',
1394         function () {
1395             var other = local__createLocal.apply(null, arguments);
1396             return other < this ? this : other;
1397         }
1398     );
1399
1400    var prototypeMax = deprecate(
1401        'moment().max is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548',
1402        function () {
1403            var other = local__createLocal.apply(null, arguments);
1404            return other > this ? this : other;
1405        }
1406    );
1407
1408    // Pick a moment m from moments so that m[fn](other) is true for all
1409    // other. This relies on the function fn to be transitive.
1410    //
1411    // moments should either be an array of moment objects or an array, whose
1412    // first element is an array of moment objects.
1413    function pickBy(fn, moments) {
1414        var res, i;
1415        if (moments.length === 1 && isArray(moments[0])) {
1416            moments = moments[0];
1417        }
1418        if (!moments.length) {
1419            return local__createLocal();
1420        }
1421        res = moments[0];
1422        for (i = 1; i < moments.length; ++i) {
1423            if (!moments[i].isValid() || moments[i][fn](res)) {
1424                res = moments[i];
1425            }
1426        }
1427        return res;
1428    }
1429
1430    // TODO: Use [].sort instead?
1431    function min () {
1432        var args = [].slice.call(arguments, 0);
1433
1434        return pickBy('isBefore', args);
1435    }
1436
1437    function max () {
1438        var args = [].slice.call(arguments, 0);
1439
1440        return pickBy('isAfter', args);
1441    }
1442
1443    function Duration (duration) {
1444        var normalizedInput = normalizeObjectUnits(duration),
1445            years = normalizedInput.year || 0,
1446            quarters = normalizedInput.quarter || 0,
1447            months = normalizedInput.month || 0,
1448            weeks = normalizedInput.week || 0,
1449            days = normalizedInput.day || 0,
1450            hours = normalizedInput.hour || 0,
1451            minutes = normalizedInput.minute || 0,
1452            seconds = normalizedInput.second || 0,
1453            milliseconds = normalizedInput.millisecond || 0;
1454
1455        // representation for dateAddRemove
1456        this._milliseconds = +milliseconds +
1457            seconds * 1e3 + // 1000
1458            minutes * 6e4 + // 1000 * 60
1459            hours * 36e5; // 1000 * 60 * 60
1460        // Because of dateAddRemove treats 24 hours as different from a
1461        // day when working around DST, we need to store them separately
1462        this._days = +days +
1463            weeks * 7;
1464        // It is impossible translate months into days without knowing
1465        // which months you are are talking about, so we have to store
1466        // it separately.
1467        this._months = +months +
1468            quarters * 3 +
1469            years * 12;
1470
1471        this._data = {};
1472
1473        this._locale = locale_locales__getLocale();
1474
1475        this._bubble();
1476    }
1477
1478    function isDuration (obj) {
1479        return obj instanceof Duration;
1480    }
1481
1482    function offset (token, separator) {
1483        addFormatToken(token, 0, 0, function () {
1484            var offset = this.utcOffset();
1485            var sign = '+';
1486            if (offset < 0) {
1487                offset = -offset;
1488                sign = '-';
1489            }
1490            return sign + zeroFill(~~(offset / 60), 2) + separator + zeroFill(~~(offset) % 60, 2);
1491        });
1492    }
1493
1494    offset('Z', ':');
1495    offset('ZZ', '');
1496
1497    // PARSING
1498
1499    addRegexToken('Z',  matchOffset);
1500    addRegexToken('ZZ', matchOffset);
1501    addParseToken(['Z', 'ZZ'], function (input, array, config) {
1502        config._useUTC = true;
1503        config._tzm = offsetFromString(input);
1504    });
1505
1506    // HELPERS
1507
1508    // timezone chunker
1509    // '+10:00' > ['10',  '00']
1510    // '-1530'  > ['-15', '30']
1511    var chunkOffset = /([\+\-]|\d\d)/gi;
1512
1513    function offsetFromString(string) {
1514        var matches = ((string || '').match(matchOffset) || []);
1515        var chunk   = matches[matches.length - 1] || [];
1516        var parts   = (chunk + '').match(chunkOffset) || ['-', 0, 0];
1517        var minutes = +(parts[1] * 60) + toInt(parts[2]);
1518
1519        return parts[0] === '+' ? minutes : -minutes;
1520    }
1521
1522    // Return a moment from input, that is local/utc/zone equivalent to model.
1523    function cloneWithOffset(input, model) {
1524        var res, diff;
1525        if (model._isUTC) {
1526            res = model.clone();
1527            diff = (isMoment(input) || isDate(input) ? +input : +local__createLocal(input)) - (+res);
1528            // Use low-level api, because this fn is low-level api.
1529            res._d.setTime(+res._d + diff);
1530            utils_hooks__hooks.updateOffset(res, false);
1531            return res;
1532        } else {
1533            return local__createLocal(input).local();
1534        }
1535    }
1536
1537    function getDateOffset (m) {
1538        // On Firefox.24 Date#getTimezoneOffset returns a floating point.
1539        // https://github.com/moment/moment/pull/1871
1540        return -Math.round(m._d.getTimezoneOffset() / 15) * 15;
1541    }
1542
1543    // HOOKS
1544
1545    // This function will be called whenever a moment is mutated.
1546    // It is intended to keep the offset in sync with the timezone.
1547    utils_hooks__hooks.updateOffset = function () {};
1548
1549    // MOMENTS
1550
1551    // keepLocalTime = true means only change the timezone, without
1552    // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]-->
1553    // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset
1554    // +0200, so we adjust the time as needed, to be valid.
1555    //
1556    // Keeping the time actually adds/subtracts (one hour)
1557    // from the actual represented time. That is why we call updateOffset
1558    // a second time. In case it wants us to change the offset again
1559    // _changeInProgress == true case, then we have to adjust, because
1560    // there is no such time in the given timezone.
1561    function getSetOffset (input, keepLocalTime) {
1562        var offset = this._offset || 0,
1563            localAdjust;
1564        if (input != null) {
1565            if (typeof input === 'string') {
1566                input = offsetFromString(input);
1567            }
1568            if (Math.abs(input) < 16) {
1569                input = input * 60;
1570            }
1571            if (!this._isUTC && keepLocalTime) {
1572                localAdjust = getDateOffset(this);
1573            }
1574            this._offset = input;
1575            this._isUTC = true;
1576            if (localAdjust != null) {
1577                this.add(localAdjust, 'm');
1578            }
1579            if (offset !== input) {
1580                if (!keepLocalTime || this._changeInProgress) {
1581                    add_subtract__addSubtract(this, create__createDuration(input - offset, 'm'), 1, false);
1582                } else if (!this._changeInProgress) {
1583                    this._changeInProgress = true;
1584                    utils_hooks__hooks.updateOffset(this, true);
1585                    this._changeInProgress = null;
1586                }
1587            }
1588            return this;
1589        } else {
1590            return this._isUTC ? offset : getDateOffset(this);
1591        }
1592    }
1593
1594    function getSetZone (input, keepLocalTime) {
1595        if (input != null) {
1596            if (typeof input !== 'string') {
1597                input = -input;
1598            }
1599
1600            this.utcOffset(input, keepLocalTime);
1601
1602            return this;
1603        } else {
1604            return -this.utcOffset();
1605        }
1606    }
1607
1608    function setOffsetToUTC (keepLocalTime) {
1609        return this.utcOffset(0, keepLocalTime);
1610    }
1611
1612    function setOffsetToLocal (keepLocalTime) {
1613        if (this._isUTC) {
1614            this.utcOffset(0, keepLocalTime);
1615            this._isUTC = false;
1616
1617            if (keepLocalTime) {
1618                this.subtract(getDateOffset(this), 'm');
1619            }
1620        }
1621        return this;
1622    }
1623
1624    function setOffsetToParsedOffset () {
1625        if (this._tzm) {
1626            this.utcOffset(this._tzm);
1627        } else if (typeof this._i === 'string') {
1628            this.utcOffset(offsetFromString(this._i));
1629        }
1630        return this;
1631    }
1632
1633    function hasAlignedHourOffset (input) {
1634        input = input ? local__createLocal(input).utcOffset() : 0;
1635
1636        return (this.utcOffset() - input) % 60 === 0;
1637    }
1638
1639    function isDaylightSavingTime () {
1640        return (
1641            this.utcOffset() > this.clone().month(0).utcOffset() ||
1642            this.utcOffset() > this.clone().month(5).utcOffset()
1643        );
1644    }
1645
1646    function isDaylightSavingTimeShifted () {
1647        if (typeof this._isDSTShifted !== 'undefined') {
1648            return this._isDSTShifted;
1649        }
1650
1651        var c = {};
1652
1653        copyConfig(c, this);
1654        c = prepareConfig(c);
1655
1656        if (c._a) {
1657            var other = c._isUTC ? create_utc__createUTC(c._a) : local__createLocal(c._a);
1658            this._isDSTShifted = this.isValid() &&
1659                compareArrays(c._a, other.toArray()) > 0;
1660        } else {
1661            this._isDSTShifted = false;
1662        }
1663
1664        return this._isDSTShifted;
1665    }
1666
1667    function isLocal () {
1668        return !this._isUTC;
1669    }
1670
1671    function isUtcOffset () {
1672        return this._isUTC;
1673    }
1674
1675    function isUtc () {
1676        return this._isUTC && this._offset === 0;
1677    }
1678
1679    var aspNetRegex = /(\-)?(?:(\d*)\.)?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/;
1680
1681    // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html
1682    // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere
1683    var create__isoRegex = /^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/;
1684
1685    function create__createDuration (input, key) {
1686        var duration = input,
1687            // matching against regexp is expensive, do it on demand
1688            match = null,
1689            sign,
1690            ret,
1691            diffRes;
1692
1693        if (isDuration(input)) {
1694            duration = {
1695                ms : input._milliseconds,
1696                d  : input._days,
1697                M  : input._months
1698            };
1699        } else if (typeof input === 'number') {
1700            duration = {};
1701            if (key) {
1702                duration[key] = input;
1703            } else {
1704                duration.milliseconds = input;
1705            }
1706        } else if (!!(match = aspNetRegex.exec(input))) {
1707            sign = (match[1] === '-') ? -1 : 1;
1708            duration = {
1709                y  : 0,
1710                d  : toInt(match[DATE])        * sign,
1711                h  : toInt(match[HOUR])        * sign,
1712                m  : toInt(match[MINUTE])      * sign,
1713                s  : toInt(match[SECOND])      * sign,
1714                ms : toInt(match[MILLISECOND]) * sign
1715            };
1716        } else if (!!(match = create__isoRegex.exec(input))) {
1717            sign = (match[1] === '-') ? -1 : 1;
1718            duration = {
1719                y : parseIso(match[2], sign),
1720                M : parseIso(match[3], sign),
1721                d : parseIso(match[4], sign),
1722                h : parseIso(match[5], sign),
1723                m : parseIso(match[6], sign),
1724                s : parseIso(match[7], sign),
1725                w : parseIso(match[8], sign)
1726            };
1727        } else if (duration == null) {// checks for null or undefined
1728            duration = {};
1729        } else if (typeof duration === 'object' && ('from' in duration || 'to' in duration)) {
1730            diffRes = momentsDifference(local__createLocal(duration.from), local__createLocal(duration.to));
1731
1732            duration = {};
1733            duration.ms = diffRes.milliseconds;
1734            duration.M = diffRes.months;
1735        }
1736
1737        ret = new Duration(duration);
1738
1739        if (isDuration(input) && hasOwnProp(input, '_locale')) {
1740            ret._locale = input._locale;
1741        }
1742
1743        return ret;
1744    }
1745
1746    create__createDuration.fn = Duration.prototype;
1747
1748    function parseIso (inp, sign) {
1749        // We'd normally use ~~inp for this, but unfortunately it also
1750        // converts floats to ints.
1751        // inp may be undefined, so careful calling replace on it.
1752        var res = inp && parseFloat(inp.replace(',', '.'));
1753        // apply sign while we're at it
1754        return (isNaN(res) ? 0 : res) * sign;
1755    }
1756
1757    function positiveMomentsDifference(base, other) {
1758        var res = {milliseconds: 0, months: 0};
1759
1760        res.months = other.month() - base.month() +
1761            (other.year() - base.year()) * 12;
1762        if (base.clone().add(res.months, 'M').isAfter(other)) {
1763            --res.months;
1764        }
1765
1766        res.milliseconds = +other - +(base.clone().add(res.months, 'M'));
1767
1768        return res;
1769    }
1770
1771    function momentsDifference(base, other) {
1772        var res;
1773        other = cloneWithOffset(other, base);
1774        if (base.isBefore(other)) {
1775            res = positiveMomentsDifference(base, other);
1776        } else {
1777            res = positiveMomentsDifference(other, base);
1778            res.milliseconds = -res.milliseconds;
1779            res.months = -res.months;
1780        }
1781
1782        return res;
1783    }
1784
1785    function createAdder(direction, name) {
1786        return function (val, period) {
1787            var dur, tmp;
1788            //invert the arguments, but complain about it
1789            if (period !== null && !isNaN(+period)) {
1790                deprecateSimple(name, 'moment().' + name  + '(period, number) is deprecated. Please use moment().' + name + '(number, period).');
1791                tmp = val; val = period; period = tmp;
1792            }
1793
1794            val = typeof val === 'string' ? +val : val;
1795            dur = create__createDuration(val, period);
1796            add_subtract__addSubtract(this, dur, direction);
1797            return this;
1798        };
1799    }
1800
1801    function add_subtract__addSubtract (mom, duration, isAdding, updateOffset) {
1802        var milliseconds = duration._milliseconds,
1803            days = duration._days,
1804            months = duration._months;
1805        updateOffset = updateOffset == null ? true : updateOffset;
1806
1807        if (milliseconds) {
1808            mom._d.setTime(+mom._d + milliseconds * isAdding);
1809        }
1810        if (days) {
1811            get_set__set(mom, 'Date', get_set__get(mom, 'Date') + days * isAdding);
1812        }
1813        if (months) {
1814            setMonth(mom, get_set__get(mom, 'Month') + months * isAdding);
1815        }
1816        if (updateOffset) {
1817            utils_hooks__hooks.updateOffset(mom, days || months);
1818        }
1819    }
1820
1821    var add_subtract__add      = createAdder(1, 'add');
1822    var add_subtract__subtract = createAdder(-1, 'subtract');
1823
1824    function moment_calendar__calendar (time, formats) {
1825        // We want to compare the start of today, vs this.
1826        // Getting start-of-today depends on whether we're local/utc/offset or not.
1827        var now = time || local__createLocal(),
1828            sod = cloneWithOffset(now, this).startOf('day'),
1829            diff = this.diff(sod, 'days', true),
1830            format = diff < -6 ? 'sameElse' :
1831                diff < -1 ? 'lastWeek' :
1832                diff < 0 ? 'lastDay' :
1833                diff < 1 ? 'sameDay' :
1834                diff < 2 ? 'nextDay' :
1835                diff < 7 ? 'nextWeek' : 'sameElse';
1836        return this.format(formats && formats[format] || this.localeData().calendar(format, this, local__createLocal(now)));
1837    }
1838
1839    function clone () {
1840        return new Moment(this);
1841    }
1842
1843    function isAfter (input, units) {
1844        var inputMs;
1845        units = normalizeUnits(typeof units !== 'undefined' ? units : 'millisecond');
1846        if (units === 'millisecond') {
1847            input = isMoment(input) ? input : local__createLocal(input);
1848            return +this > +input;
1849        } else {
1850            inputMs = isMoment(input) ? +input : +local__createLocal(input);
1851            return inputMs < +this.clone().startOf(units);
1852        }
1853    }
1854
1855    function isBefore (input, units) {
1856        var inputMs;
1857        units = normalizeUnits(typeof units !== 'undefined' ? units : 'millisecond');
1858        if (units === 'millisecond') {
1859            input = isMoment(input) ? input : local__createLocal(input);
1860            return +this < +input;
1861        } else {
1862            inputMs = isMoment(input) ? +input : +local__createLocal(input);
1863            return +this.clone().endOf(units) < inputMs;
1864        }
1865    }
1866
1867    function isBetween (from, to, units) {
1868        return this.isAfter(from, units) && this.isBefore(to, units);
1869    }
1870
1871    function isSame (input, units) {
1872        var inputMs;
1873        units = normalizeUnits(units || 'millisecond');
1874        if (units === 'millisecond') {
1875            input = isMoment(input) ? input : local__createLocal(input);
1876            return +this === +input;
1877        } else {
1878            inputMs = +local__createLocal(input);
1879            return +(this.clone().startOf(units)) <= inputMs && inputMs <= +(this.clone().endOf(units));
1880        }
1881    }
1882
1883    function diff (input, units, asFloat) {
1884        var that = cloneWithOffset(input, this),
1885            zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4,
1886            delta, output;
1887
1888        units = normalizeUnits(units);
1889
1890        if (units === 'year' || units === 'month' || units === 'quarter') {
1891            output = monthDiff(this, that);
1892            if (units === 'quarter') {
1893                output = output / 3;
1894            } else if (units === 'year') {
1895                output = output / 12;
1896            }
1897        } else {
1898            delta = this - that;
1899            output = units === 'second' ? delta / 1e3 : // 1000
1900                units === 'minute' ? delta / 6e4 : // 1000 * 60
1901                units === 'hour' ? delta / 36e5 : // 1000 * 60 * 60
1902                units === 'day' ? (delta - zoneDelta) / 864e5 : // 1000 * 60 * 60 * 24, negate dst
1903                units === 'week' ? (delta - zoneDelta) / 6048e5 : // 1000 * 60 * 60 * 24 * 7, negate dst
1904                delta;
1905        }
1906        return asFloat ? output : absFloor(output);
1907    }
1908
1909    function monthDiff (a, b) {
1910        // difference in months
1911        var wholeMonthDiff = ((b.year() - a.year()) * 12) + (b.month() - a.month()),
1912            // b is in (anchor - 1 month, anchor + 1 month)
1913            anchor = a.clone().add(wholeMonthDiff, 'months'),
1914            anchor2, adjust;
1915
1916        if (b - anchor < 0) {
1917            anchor2 = a.clone().add(wholeMonthDiff - 1, 'months');
1918            // linear across the month
1919            adjust = (b - anchor) / (anchor - anchor2);
1920        } else {
1921            anchor2 = a.clone().add(wholeMonthDiff + 1, 'months');
1922            // linear across the month
1923            adjust = (b - anchor) / (anchor2 - anchor);
1924        }
1925
1926        return -(wholeMonthDiff + adjust);
1927    }
1928
1929    utils_hooks__hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ';
1930
1931    function toString () {
1932        return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ');
1933    }
1934
1935    function moment_format__toISOString () {
1936        var m = this.clone().utc();
1937        if (0 < m.year() && m.year() <= 9999) {
1938            if ('function' === typeof Date.prototype.toISOString) {
1939                // native implementation is ~50x faster, use it when we can
1940                return this.toDate().toISOString();
1941            } else {
1942                return formatMoment(m, 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]');
1943            }
1944        } else {
1945            return formatMoment(m, 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]');
1946        }
1947    }
1948
1949    function format (inputString) {
1950        var output = formatMoment(this, inputString || utils_hooks__hooks.defaultFormat);
1951        return this.localeData().postformat(output);
1952    }
1953
1954    function from (time, withoutSuffix) {
1955        if (!this.isValid()) {
1956            return this.localeData().invalidDate();
1957        }
1958        return create__createDuration({to: this, from: time}).locale(this.locale()).humanize(!withoutSuffix);
1959    }
1960
1961    function fromNow (withoutSuffix) {
1962        return this.from(local__createLocal(), withoutSuffix);
1963    }
1964
1965    function to (time, withoutSuffix) {
1966        if (!this.isValid()) {
1967            return this.localeData().invalidDate();
1968        }
1969        return create__createDuration({from: this, to: time}).locale(this.locale()).humanize(!withoutSuffix);
1970    }
1971
1972    function toNow (withoutSuffix) {
1973        return this.to(local__createLocal(), withoutSuffix);
1974    }
1975
1976    function locale (key) {
1977        var newLocaleData;
1978
1979        if (key === undefined) {
1980            return this._locale._abbr;
1981        } else {
1982            newLocaleData = locale_locales__getLocale(key);
1983            if (newLocaleData != null) {
1984                this._locale = newLocaleData;
1985            }
1986            return this;
1987        }
1988    }
1989
1990    var lang = deprecate(
1991        'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.',
1992        function (key) {
1993            if (key === undefined) {
1994                return this.localeData();
1995            } else {
1996                return this.locale(key);
1997            }
1998        }
1999    );
2000
2001    function localeData () {
2002        return this._locale;
2003    }
2004
2005    function startOf (units) {
2006        units = normalizeUnits(units);
2007        // the following switch intentionally omits break keywords
2008        // to utilize falling through the cases.
2009        switch (units) {
2010        case 'year':
2011            this.month(0);
2012            /* falls through */
2013        case 'quarter':
2014        case 'month':
2015            this.date(1);
2016            /* falls through */
2017        case 'week':
2018        case 'isoWeek':
2019        case 'day':
2020            this.hours(0);
2021            /* falls through */
2022        case 'hour':
2023            this.minutes(0);
2024            /* falls through */
2025        case 'minute':
2026            this.seconds(0);
2027            /* falls through */
2028        case 'second':
2029            this.milliseconds(0);
2030        }
2031
2032        // weeks are a special case
2033        if (units === 'week') {
2034            this.weekday(0);
2035        }
2036        if (units === 'isoWeek') {
2037            this.isoWeekday(1);
2038        }
2039
2040        // quarters are also special
2041        if (units === 'quarter') {
2042            this.month(Math.floor(this.month() / 3) * 3);
2043        }
2044
2045        return this;
2046    }
2047
2048    function endOf (units) {
2049        units = normalizeUnits(units);
2050        if (units === undefined || units === 'millisecond') {
2051            return this;
2052        }
2053        return this.startOf(units).add(1, (units === 'isoWeek' ? 'week' : units)).subtract(1, 'ms');
2054    }
2055
2056    function to_type__valueOf () {
2057        return +this._d - ((this._offset || 0) * 60000);
2058    }
2059
2060    function unix () {
2061        return Math.floor(+this / 1000);
2062    }
2063
2064    function toDate () {
2065        return this._offset ? new Date(+this) : this._d;
2066    }
2067
2068    function toArray () {
2069        var m = this;
2070        return [m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond()];
2071    }
2072
2073    function toObject () {
2074        var m = this;
2075        return {
2076            years: m.year(),
2077            months: m.month(),
2078            date: m.date(),
2079            hours: m.hours(),
2080            minutes: m.minutes(),
2081            seconds: m.seconds(),
2082            milliseconds: m.milliseconds()
2083        };
2084    }
2085
2086    function moment_valid__isValid () {
2087        return valid__isValid(this);
2088    }
2089
2090    function parsingFlags () {
2091        return extend({}, getParsingFlags(this));
2092    }
2093
2094    function invalidAt () {
2095        return getParsingFlags(this).overflow;
2096    }
2097
2098    addFormatToken(0, ['gg', 2], 0, function () {
2099        return this.weekYear() % 100;
2100    });
2101
2102    addFormatToken(0, ['GG', 2], 0, function () {
2103        return this.isoWeekYear() % 100;
2104    });
2105
2106    function addWeekYearFormatToken (token, getter) {
2107        addFormatToken(0, [token, token.length], 0, getter);
2108    }
2109
2110    addWeekYearFormatToken('gggg',     'weekYear');
2111    addWeekYearFormatToken('ggggg',    'weekYear');
2112    addWeekYearFormatToken('GGGG',  'isoWeekYear');
2113    addWeekYearFormatToken('GGGGG', 'isoWeekYear');
2114
2115    // ALIASES
2116
2117    addUnitAlias('weekYear', 'gg');
2118    addUnitAlias('isoWeekYear', 'GG');
2119
2120    // PARSING
2121
2122    addRegexToken('G',      matchSigned);
2123    addRegexToken('g',      matchSigned);
2124    addRegexToken('GG',     match1to2, match2);
2125    addRegexToken('gg',     match1to2, match2);
2126    addRegexToken('GGGG',   match1to4, match4);
2127    addRegexToken('gggg',   match1to4, match4);
2128    addRegexToken('GGGGG',  match1to6, match6);
2129    addRegexToken('ggggg',  match1to6, match6);
2130
2131    addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (input, week, config, token) {
2132        week[token.substr(0, 2)] = toInt(input);
2133    });
2134
2135    addWeekParseToken(['gg', 'GG'], function (input, week, config, token) {
2136        week[token] = utils_hooks__hooks.parseTwoDigitYear(input);
2137    });
2138
2139    // HELPERS
2140
2141    function weeksInYear(year, dow, doy) {
2142        return weekOfYear(local__createLocal([year, 11, 31 + dow - doy]), dow, doy).week;
2143    }
2144
2145    // MOMENTS
2146
2147    function getSetWeekYear (input) {
2148        var year = weekOfYear(this, this.localeData()._week.dow, this.localeData()._week.doy).year;
2149        return input == null ? year : this.add((input - year), 'y');
2150    }
2151
2152    function getSetISOWeekYear (input) {
2153        var year = weekOfYear(this, 1, 4).year;
2154        return input == null ? year : this.add((input - year), 'y');
2155    }
2156
2157    function getISOWeeksInYear () {
2158        return weeksInYear(this.year(), 1, 4);
2159    }
2160
2161    function getWeeksInYear () {
2162        var weekInfo = this.localeData()._week;
2163        return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);
2164    }
2165
2166    addFormatToken('Q', 0, 0, 'quarter');
2167
2168    // ALIASES
2169
2170    addUnitAlias('quarter', 'Q');
2171
2172    // PARSING
2173
2174    addRegexToken('Q', match1);
2175    addParseToken('Q', function (input, array) {
2176        array[MONTH] = (toInt(input) - 1) * 3;
2177    });
2178
2179    // MOMENTS
2180
2181    function getSetQuarter (input) {
2182        return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3);
2183    }
2184
2185    addFormatToken('D', ['DD', 2], 'Do', 'date');
2186
2187    // ALIASES
2188
2189    addUnitAlias('date', 'D');
2190
2191    // PARSING
2192
2193    addRegexToken('D',  match1to2);
2194    addRegexToken('DD', match1to2, match2);
2195    addRegexToken('Do', function (isStrict, locale) {
2196        return isStrict ? locale._ordinalParse : locale._ordinalParseLenient;
2197    });
2198
2199    addParseToken(['D', 'DD'], DATE);
2200    addParseToken('Do', function (input, array) {
2201        array[DATE] = toInt(input.match(match1to2)[0], 10);
2202    });
2203
2204    // MOMENTS
2205
2206    var getSetDayOfMonth = makeGetSet('Date', true);
2207
2208    addFormatToken('d', 0, 'do', 'day');
2209
2210    addFormatToken('dd', 0, 0, function (format) {
2211        return this.localeData().weekdaysMin(this, format);
2212    });
2213
2214    addFormatToken('ddd', 0, 0, function (format) {
2215        return this.localeData().weekdaysShort(this, format);
2216    });
2217
2218    addFormatToken('dddd', 0, 0, function (format) {
2219        return this.localeData().weekdays(this, format);
2220    });
2221
2222    addFormatToken('e', 0, 0, 'weekday');
2223    addFormatToken('E', 0, 0, 'isoWeekday');
2224
2225    // ALIASES
2226
2227    addUnitAlias('day', 'd');
2228    addUnitAlias('weekday', 'e');
2229    addUnitAlias('isoWeekday', 'E');
2230
2231    // PARSING
2232
2233    addRegexToken('d',    match1to2);
2234    addRegexToken('e',    match1to2);
2235    addRegexToken('E',    match1to2);
2236    addRegexToken('dd',   matchWord);
2237    addRegexToken('ddd',  matchWord);
2238    addRegexToken('dddd', matchWord);
2239
2240    addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config) {
2241        var weekday = config._locale.weekdaysParse(input);
2242        // if we didn't get a weekday name, mark the date as invali
vendor: 13,354 bytes, lines 2242-2649
2242d
2243        if (weekday != null) {
2244            week.d = weekday;
2245        } else {
2246            getParsingFlags(config).invalidWeekday = input;
2247        }
2248    });
2249
2250    addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) {
2251        week[token] = toInt(input);
2252    });
2253
2254    // HELPERS
2255
2256    function parseWeekday(input, locale) {
2257        if (typeof input !== 'string') {
2258            return input;
2259        }
2260
2261        if (!isNaN(input)) {
2262            return parseInt(input, 10);
2263        }
2264
2265        input = locale.weekdaysParse(input);
2266        if (typeof input === 'number') {
2267            return input;
2268        }
2269
2270        return null;
2271    }
2272
2273    // LOCALES
2274
2275    var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_');
2276    function localeWeekdays (m) {
2277        return this._weekdays[m.day()];
2278    }
2279
2280    var defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_');
2281    function localeWeekdaysShort (m) {
2282        return this._weekdaysShort[m.day()];
2283    }
2284
2285    var defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_');
2286    function localeWeekdaysMin (m) {
2287        return this._weekdaysMin[m.day()];
2288    }
2289
2290    function localeWeekdaysParse (weekdayName) {
2291        var i, mom, regex;
2292
2293        this._weekdaysParse = this._weekdaysParse || [];
2294
2295        for (i = 0; i < 7; i++) {
2296            // make the regex if we don't have it already
2297            if (!this._weekdaysParse[i]) {
2298                mom = local__createLocal([2000, 1]).day(i);
2299                regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, '');
2300                this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i');
2301            }
2302            // test the regex
2303            if (this._weekdaysParse[i].test(weekdayName)) {
2304                return i;
2305            }
2306        }
2307    }
2308
2309    // MOMENTS
2310
2311    function getSetDayOfWeek (input) {
2312        var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay();
2313        if (input != null) {
2314            input = parseWeekday(input, this.localeData());
2315            return this.add(input - day, 'd');
2316        } else {
2317            return day;
2318        }
2319    }
2320
2321    function getSetLocaleDayOfWeek (input) {
2322        var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7;
2323        return input == null ? weekday : this.add(input - weekday, 'd');
2324    }
2325
2326    function getSetISODayOfWeek (input) {
2327        // behaves the same as moment#day except
2328        // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6)
2329        // as a setter, sunday should belong to the previous week.
2330        return input == null ? this.day() || 7 : this.day(this.day() % 7 ? input : input - 7);
2331    }
2332
2333    addFormatToken('H', ['HH', 2], 0, 'hour');
2334    addFormatToken('h', ['hh', 2], 0, function () {
2335        return this.hours() % 12 || 12;
2336    });
2337
2338    function meridiem (token, lowercase) {
2339        addFormatToken(token, 0, 0, function () {
2340            return this.localeData().meridiem(this.hours(), this.minutes(), lowercase);
2341        });
2342    }
2343
2344    meridiem('a', true);
2345    meridiem('A', false);
2346
2347    // ALIASES
2348
2349    addUnitAlias('hour', 'h');
2350
2351    // PARSING
2352
2353    function matchMeridiem (isStrict, locale) {
2354        return locale._meridiemParse;
2355    }
2356
2357    addRegexToken('a',  matchMeridiem);
2358    addRegexToken('A',  matchMeridiem);
2359    addRegexToken('H',  match1to2);
2360    addRegexToken('h',  match1to2);
2361    addRegexToken('HH', match1to2, match2);
2362    addRegexToken('hh', match1to2, match2);
2363
2364    addParseToken(['H', 'HH'], HOUR);
2365    addParseToken(['a', 'A'], function (input, array, config) {
2366        config._isPm = config._locale.isPM(input);
2367        config._meridiem = input;
2368    });
2369    addParseToken(['h', 'hh'], function (input, array, config) {
2370        array[HOUR] = toInt(input);
2371        getParsingFlags(config).bigHour = true;
2372    });
2373
2374    // LOCALES
2375
2376    function localeIsPM (input) {
2377        // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays
2378        // Using charAt should be more compatible.
2379        return ((input + '').toLowerCase().charAt(0) === 'p');
2380    }
2381
2382    var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i;
2383    function localeMeridiem (hours, minutes, isLower) {
2384        if (hours > 11) {
2385            return isLower ? 'pm' : 'PM';
2386        } else {
2387            return isLower ? 'am' : 'AM';
2388        }
2389    }
2390
2391
2392    // MOMENTS
2393
2394    // Setting the hour should keep the time, because the user explicitly
2395    // specified which hour he wants. So trying to maintain the same hour (in
2396    // a new timezone) makes sense. Adding/subtracting hours does not follow
2397    // this rule.
2398    var getSetHour = makeGetSet('Hours', true);
2399
2400    addFormatToken('m', ['mm', 2], 0, 'minute');
2401
2402    // ALIASES
2403
2404    addUnitAlias('minute', 'm');
2405
2406    // PARSING
2407
2408    addRegexToken('m',  match1to2);
2409    addRegexToken('mm', match1to2, match2);
2410    addParseToken(['m', 'mm'], MINUTE);
2411
2412    // MOMENTS
2413
2414    var getSetMinute = makeGetSet('Minutes', false);
2415
2416    addFormatToken('s', ['ss', 2], 0, 'second');
2417
2418    // ALIASES
2419
2420    addUnitAlias('second', 's');
2421
2422    // PARSING
2423
2424    addRegexToken('s',  match1to2);
2425    addRegexToken('ss', match1to2, match2);
2426    addParseToken(['s', 'ss'], SECOND);
2427
2428    // MOMENTS
2429
2430    var getSetSecond = makeGetSet('Seconds', false);
2431
2432    addFormatToken('S', 0, 0, function () {
2433        return ~~(this.millisecond() / 100);
2434    });
2435
2436    addFormatToken(0, ['SS', 2], 0, function () {
2437        return ~~(this.millisecond() / 10);
2438    });
2439
2440    addFormatToken(0, ['SSS', 3], 0, 'millisecond');
2441    addFormatToken(0, ['SSSS', 4], 0, function () {
2442        return this.millisecond() * 10;
2443    });
2444    addFormatToken(0, ['SSSSS', 5], 0, function () {
2445        return this.millisecond() * 100;
2446    });
2447    addFormatToken(0, ['SSSSSS', 6], 0, function () {
2448        return this.millisecond() * 1000;
2449    });
2450    addFormatToken(0, ['SSSSSSS', 7], 0, function () {
2451        return this.millisecond() * 10000;
2452    });
2453    addFormatToken(0, ['SSSSSSSS', 8], 0, function () {
2454        return this.millisecond() * 100000;
2455    });
2456    addFormatToken(0, ['SSSSSSSSS', 9], 0, function () {
2457        return this.millisecond() * 1000000;
2458    });
2459
2460
2461    // ALIASES
2462
2463    addUnitAlias('millisecond', 'ms');
2464
2465    // PARSING
2466
2467    addRegexToken('S',    match1to3, match1);
2468    addRegexToken('SS',   match1to3, match2);
2469    addRegexToken('SSS',  match1to3, match3);
2470
2471    var token;
2472    for (token = 'SSSS'; token.length <= 9; token += 'S') {
2473        addRegexToken(token, matchUnsigned);
2474    }
2475
2476    function parseMs(input, array) {
2477        array[MILLISECOND] = toInt(('0.' + input) * 1000);
2478    }
2479
2480    for (token = 'S'; token.length <= 9; token += 'S') {
2481        addParseToken(token, parseMs);
2482    }
2483    // MOMENTS
2484
2485    var getSetMillisecond = makeGetSet('Milliseconds', false);
2486
2487    addFormatToken('z',  0, 0, 'zoneAbbr');
2488    addFormatToken('zz', 0, 0, 'zoneName');
2489
2490    // MOMENTS
2491
2492    function getZoneAbbr () {
2493        return this._isUTC ? 'UTC' : '';
2494    }
2495
2496    function getZoneName () {
2497        return this._isUTC ? 'Coordinated Universal Time' : '';
2498    }
2499
2500    var momentPrototype__proto = Moment.prototype;
2501
2502    momentPrototype__proto.add          = add_subtract__add;
2503    momentPrototype__proto.calendar     = moment_calendar__calendar;
2504    momentPrototype__proto.clone        = clone;
2505    momentPrototype__proto.diff         = diff;
2506    momentPrototype__proto.endOf        = endOf;
2507    momentPrototype__proto.format       = format;
2508    momentPrototype__proto.from         = from;
2509    momentPrototype__proto.fromNow      = fromNow;
2510    momentPrototype__proto.to           = to;
2511    momentPrototype__proto.toNow        = toNow;
2512    momentPrototype__proto.get          = getSet;
2513    momentPrototype__proto.invalidAt    = invalidAt;
2514    momentPrototype__proto.isAfter      = isAfter;
2515    momentPrototype__proto.isBefore     = isBefore;
2516    momentPrototype__proto.isBetween    = isBetween;
2517    momentPrototype__proto.isSame       = isSame;
2518    momentPrototype__proto.isValid      = moment_valid__isValid;
2519    momentPrototype__proto.lang         = lang;
2520    momentPrototype__proto.locale       = locale;
2521    momentPrototype__proto.localeData   = localeData;
2522    momentPrototype__proto.max          = prototypeMax;
2523    momentPrototype__proto.min          = prototypeMin;
2524    momentPrototype__proto.parsingFlags = parsingFlags;
2525    momentPrototype__proto.set          = getSet;
2526    momentPrototype__proto.startOf      = startOf;
2527    momentPrototype__proto.subtract     = add_subtract__subtract;
2528    momentPrototype__proto.toArray      = toArray;
2529    momentPrototype__proto.toObject     = toObject;
2530    momentPrototype__proto.toDate       = toDate;
2531    momentPrototype__proto.toISOString  = moment_format__toISOString;
2532    momentPrototype__proto.toJSON       = moment_format__toISOString;
2533    momentPrototype__proto.toString     = toString;
2534    momentPrototype__proto.unix         = unix;
2535    momentPrototype__proto.valueOf      = to_type__valueOf;
2536
2537    // Year
2538    momentPrototype__proto.year       = getSetYear;
2539    momentPrototype__proto.isLeapYear = getIsLeapYear;
2540
2541    // Week Year
2542    momentPrototype__proto.weekYear    = getSetWeekYear;
2543    momentPrototype__proto.isoWeekYear = getSetISOWeekYear;
2544
2545    // Quarter
2546    momentPrototype__proto.quarter = momentPrototype__proto.quarters = getSetQuarter;
2547
2548    // Month
2549    momentPrototype__proto.month       = getSetMonth;
2550    momentPrototype__proto.daysInMonth = getDaysInMonth;
2551
2552    // Week
2553    momentPrototype__proto.week           = momentPrototype__proto.weeks        = getSetWeek;
2554    momentPrototype__proto.isoWeek        = momentPrototype__proto.isoWeeks     = getSetISOWeek;
2555    momentPrototype__proto.weeksInYear    = getWeeksInYear;
2556    momentPrototype__proto.isoWeeksInYear = getISOWeeksInYear;
2557
2558    // Day
2559    momentPrototype__proto.date       = getSetDayOfMonth;
2560    momentPrototype__proto.day        = momentPrototype__proto.days             = getSetDayOfWeek;
2561    momentPrototype__proto.weekday    = getSetLocaleDayOfWeek;
2562    momentPrototype__proto.isoWeekday = getSetISODayOfWeek;
2563    momentPrototype__proto.dayOfYear  = getSetDayOfYear;
2564
2565    // Hour
2566    momentPrototype__proto.hour = momentPrototype__proto.hours = getSetHour;
2567
2568    // Minute
2569    momentPrototype__proto.minute = momentPrototype__proto.minutes = getSetMinute;
2570
2571    // Second
2572    momentPrototype__proto.second = momentPrototype__proto.seconds = getSetSecond;
2573
2574    // Millisecond
2575    momentPrototype__proto.millisecond = momentPrototype__proto.milliseconds = getSetMillisecond;
2576
2577    // Offset
2578    momentPrototype__proto.utcOffset            = getSetOffset;
2579    momentPrototype__proto.utc                  = setOffsetToUTC;
2580    momentPrototype__proto.local                = setOffsetToLocal;
2581    momentPrototype__proto.parseZone            = setOffsetToParsedOffset;
2582    momentPrototype__proto.hasAlignedHourOffset = hasAlignedHourOffset;
2583    momentPrototype__proto.isDST                = isDaylightSavingTime;
2584    momentPrototype__proto.isDSTShifted         = isDaylightSavingTimeShifted;
2585    momentPrototype__proto.isLocal              = isLocal;
2586    momentPrototype__proto.isUtcOffset          = isUtcOffset;
2587    momentPrototype__proto.isUtc                = isUtc;
2588    momentPrototype__proto.isUTC                = isUtc;
2589
2590    // Timezone
2591    momentPrototype__proto.zoneAbbr = getZoneAbbr;
2592    momentPrototype__proto.zoneName = getZoneName;
2593
2594    // Deprecations
2595    momentPrototype__proto.dates  = deprecate('dates accessor is deprecated. Use date instead.', getSetDayOfMonth);
2596    momentPrototype__proto.months = deprecate('months accessor is deprecated. Use month instead', getSetMonth);
2597    momentPrototype__proto.years  = deprecate('years accessor is deprecated. Use year instead', getSetYear);
2598    momentPrototype__proto.zone   = deprecate('moment().zone is deprecated, use moment().utcOffset instead. https://github.com/moment/moment/issues/1779', getSetZone);
2599
2600    var momentPrototype = momentPrototype__proto;
2601
2602    function moment__createUnix (input) {
2603        return local__createLocal(input * 1000);
2604    }
2605
2606    function moment__createInZone () {
2607        return local__createLocal.apply(null, arguments).parseZone();
2608    }
2609
2610    var defaultCalendar = {
2611        sameDay : '[Today at] LT',
2612        nextDay : '[Tomorrow at] LT',
2613        nextWeek : 'dddd [at] LT',
2614        lastDay : '[Yesterday at] LT',
2615        lastWeek : '[Last] dddd [at] LT',
2616        sameElse : 'L'
2617    };
2618
2619    function locale_calendar__calendar (key, mom, now) {
2620        var output = this._calendar[key];
2621        return typeof output === 'function' ? output.call(mom, now) : output;
2622    }
2623
2624    var defaultLongDateFormat = {
2625        LTS  : 'h:mm:ss A',
2626        LT   : 'h:mm A',
2627        L    : 'MM/DD/YYYY',
2628        LL   : 'MMMM D, YYYY',
2629        LLL  : 'MMMM D, YYYY h:mm A',
2630        LLLL : 'dddd, MMMM D, YYYY h:mm A'
2631    };
2632
2633    function longDateFormat (key) {
2634        var format = this._longDateFormat[key],
2635            formatUpper = this._longDateFormat[key.toUpperCase()];
2636
2637        if (format || !formatUpper) {
2638            return format;
2639        }
2640
2641        this._longDateFormat[key] = formatUpper.replace(/MMMM|MM|DD|dddd/g, function (val) {
2642            return val.slice(1);
2643        });
2644
2645        return this._longDateFormat[key];
2646    }
2647
2648    var defaultInvalidDate = 'Invalid date';
2649
2650    function invalidDate () {
2651        return this._invalidDate;
2652    }
2653
2654    var defaultOrdinal = '%d';
2655    var defaultOrdinalParse = /\d{1,2}/;
2656
2657    function ordinal (number) {
2658        return this._ordinal.replace('%d', number);
2659    }
2660
2661    function preParsePostFormat (string) {
2662        return string;
2663    }
2664
2665    var defaultRelativeTime = {
2666        future : 'in %s',
2667        past   : '%s ago',
2668        s  : 'a few seconds',
2669        m  : 'a minute',
2670        mm : '%d minutes',
2671        h  : 'an hour',
2672        hh : '%d hours',
2673        d  : 'a day',
2674        dd : '%d days',
2675        M  : 'a month',
2676        MM : '%d months',
2677        y  : 'a year',
2678        yy : '%d years'
2679    };
2680
2681    function relative__relativeTime (number, withoutSuffix, string, isFuture) {
2682        var output = this._relativeTime[string];
2683        return (typeof output === 'function') ?
2684            output(number, withoutSuffix, string, isFuture) :
2685            output.replace(/%d/i, number);
2686    }
2687
2688    function pastFuture (diff, output) {
2689        var format = this._relativeTime[diff > 0 ? 'future' : 'past'];
2690        return typeof format === 'function' ? format(output) : format.replace(/%s/i, output);
2691    }
2692
2693    function locale_set__set (config) {
2694        var prop, i;
2695        for (i in config) {
2696            prop = config[i];
2697            if (typeof prop === 'function') {
2698                this[i] = prop;
2699            } else {
2700                this['_' + i] = prop;
2701            }
2702        }
2703        // Lenient ordinal parsing accepts just a number in addition to
2704        // number + (possibly) stuff coming from _ordinalParseLenient.
2705        this._ordinalParseLenient = new RegExp(this._ordinalParse.source + '|' + (/\d{1,2}/).source);
2706    }
2707
2708    var prototype__proto = Locale.prototype;
2709
2710    prototype__proto._calendar       = defaultCalendar;
2711    prototype__proto.calendar        = locale_calendar__calendar;
2712    prototype__proto._longDateFormat = defaultLongDateFormat;
2713    prototype__proto.longDateFormat  = longDateFormat;
2714    prototype__proto._invalidDate    = defaultInvalidDate;
2715    prototype__proto.invalidDate     = invalidDate;
2716    prototype__proto._ordinal        = defaultOrdinal;
2717    prototype__proto.ordinal         = ordinal;
2718    prototype__proto._ordinalParse   = defaultOrdinalParse;
2719    prototype__proto.preparse        = preParsePostFormat;
2720    prototype__proto.postformat      = preParsePostFormat;
2721    prototype__proto._relativeTime   = defaultRelativeTime;
2722    prototype__proto.relativeTime    = relative__relativeTime;
2723    prototype__proto.pastFuture      = pastFuture;
2724    prototype__proto.set             = locale_set__set;
2725
2726    // Month
2727    prototype__proto.months       =        localeMonths;
2728    prototype__proto._months      = defaultLocaleMonths;
2729    prototype__proto.monthsShort  =        localeMonthsShort;
2730    prototype__proto._monthsShort = defaultLocaleMonthsShort;
2731    prototype__proto.monthsParse  =        localeMonthsParse;
2732
2733    // Week
2734    prototype__proto.week = localeWeek;
2735    prototype__proto._week = defaultLocaleWeek;
2736    prototype__proto.firstDayOfYear = localeFirstDayOfYear;
2737    prototype__proto.firstDayOfWeek = localeFirstDayOfWeek;
2738
2739    // Day of Week
2740    prototype__proto.weekdays       =        localeWeekdays;
2741    prototype__proto._weekdays      = defaultLocaleWeekdays;
2742    prototype__proto.weekdaysMin    =        localeWeekdaysMin;
2743    prototype__proto._weekdaysMin   = defaultLocaleWeekdaysMin;
2744    prototype__proto.weekdaysShort  =        localeWeekdaysShort;
2745    prototype__proto._weekdaysShort = defaultLocaleWeekdaysShort;
2746    prototype__proto.weekdaysParse  =        localeWeekdaysParse;
2747
2748    // Hours
2749    prototype__proto.isPM = localeIsPM;
2750    prototype__proto._meridiemParse = defaultLocaleMeridiemParse;
2751    prototype__proto.meridiem = localeMeridiem;
2752
2753    function lists__get (format, index, field, setter) {
2754        var locale = locale_locales__getLocale();
2755        var utc = create_utc__createUTC().set(setter, index);
2756        return locale[field](utc, format);
2757    }
2758
2759    function list (format, index, field, count, setter) {
2760        if (typeof format === 'number') {
2761            index = format;
2762            format = undefined;
2763        }
2764
2765        format = format || '';
2766
2767        if (index != null) {
2768            return lists__get(format, index, field, setter);
2769        }
2770
2771        var i;
2772        var out = [];
2773        for (i = 0; i < count; i++) {
2774            out[i] = lists__get(format, i, field, setter);
2775        }
2776        return out;
2777    }
2778
2779    function lists__listMonths (format, index) {
2780        return list(format, index, 'months', 12, 'month');
2781    }
2782
2783    function lists__listMonthsShort (format, index) {
2784        return list(format, index, 'monthsShort', 12, 'month');
2785    }
2786
2787    function lists__listWeekdays (format, index) {
2788        return list(format, index, 'weekdays', 7, 'day');
2789    }
2790
2791    function lists__listWeekdaysShort (format, index) {
2792        return list(format, index, 'weekdaysShort', 7, 'day');
2793    }
2794
2795    function lists__listWeekdaysMin (format, index) {
2796        return list(format, index, 'weekdaysMin', 7, 'day');
2797    }
2798
2799    locale_locales__getSetGlobalLocale('en', {
2800        ordinalParse: /\d{1,2}(th|st|nd|rd)/,
2801        ordinal : function (number) {
2802            var b = number % 10,
2803                output = (toInt(number % 100 / 10) === 1) ? 'th' :
2804                (b === 1) ? 'st' :
2805                (b === 2) ? 'nd' :
2806                (b === 3) ? 'rd' : 'th';
2807            return number + output;
2808        }
2809    });
2810
2811    // Side effect imports
2812    utils_hooks__hooks.lang = deprecate('moment.lang is deprecated. Use moment.locale instead.', locale_locales__getSetGlobalLocale);
2813    utils_hooks__hooks.langData = deprecate('moment.langData is deprecated. Use moment.localeData instead.', locale_locales__getLocale);
2814
2815    var mathAbs = Math.abs;
2816
2817    function duration_abs__abs () {
2818        var data           = this._data;
2819
2820        this._milliseconds = mathAbs(this._milliseconds);
2821        this._days         = mathAbs(this._days);
2822        this._months       = mathAbs(this._months);
2823
2824        data.milliseconds  = mathAbs(data.milliseconds);
2825        data.seconds       = mathAbs(data.seconds);
2826        data.minutes       = mathAbs(data.minutes);
2827        data.hours         = mathAbs(data.hours);
2828        data.months        = mathAbs(data.months);
2829        data.years         = mathAbs(data.years);
2830
2831        return this;
2832    }
2833
2834    function duration_add_subtract__addSubtract (duration, input, value, direction) {
2835        var other = create__createDuration(input, value);
2836
2837        duration._milliseconds += direction * other._milliseconds;
2838        duration._days         += direction * other._days;
vendor: 7,025 bytes, lines 2839-3038
2839        duration._months       += direction * other._months;
2840
2841        return duration._bubble();
2842    }
2843
2844    // supports only 2.0-style add(1, 's') or add(duration)
2845    function duration_add_subtract__add (input, value) {
2846        return duration_add_subtract__addSubtract(this, input, value, 1);
2847    }
2848
2849    // supports only 2.0-style subtract(1, 's') or subtract(duration)
2850    function duration_add_subtract__subtract (input, value) {
2851        return duration_add_subtract__addSubtract(this, input, value, -1);
2852    }
2853
2854    function absCeil (number) {
2855        if (number < 0) {
2856            return Math.floor(number);
2857        } else {
2858            return Math.ceil(number);
2859        }
2860    }
2861
2862    function bubble () {
2863        var milliseconds = this._milliseconds;
2864        var days         = this._days;
2865        var months       = this._months;
2866        var data         = this._data;
2867        var seconds, minutes, hours, years, monthsFromDays;
2868
2869        // if we have a mix of positive and negative values, bubble down first
2870        // check: https://github.com/moment/moment/issues/2166
2871        if (!((milliseconds >= 0 && days >= 0 && months >= 0) ||
2872                (milliseconds <= 0 && days <= 0 && months <= 0))) {
2873            milliseconds += absCeil(monthsToDays(months) + days) * 864e5;
2874            days = 0;
2875            months = 0;
2876        }
2877
2878        // The following code bubbles up values, see the tests for
2879        // examples of what that means.
2880        data.milliseconds = milliseconds % 1000;
2881
2882        seconds           = absFloor(milliseconds / 1000);
2883        data.seconds      = seconds % 60;
2884
2885        minutes           = absFloor(seconds / 60);
2886        data.minutes      = minutes % 60;
2887
2888        hours             = absFloor(minutes / 60);
2889        data.hours        = hours % 24;
2890
2891        days += absFloor(hours / 24);
2892
2893        // convert days to months
2894        monthsFromDays = absFloor(daysToMonths(days));
2895        months += monthsFromDays;
2896        days -= absCeil(monthsToDays(monthsFromDays));
2897
2898        // 12 months -> 1 year
2899        years = absFloor(months / 12);
2900        months %= 12;
2901
2902        data.days   = days;
2903        data.months = months;
2904        data.years  = years;
2905
2906        return this;
2907    }
2908
2909    function daysToMonths (days) {
2910        // 400 years have 146097 days (taking into account leap year rules)
2911        // 400 years have 12 months === 4800
2912        return days * 4800 / 146097;
2913    }
2914
2915    function monthsToDays (months) {
2916        // the reverse of daysToMonths
2917        return months * 146097 / 4800;
2918    }
2919
2920    function as (units) {
2921        var days;
2922        var months;
2923        var milliseconds = this._milliseconds;
2924
2925        units = normalizeUnits(units);
2926
2927        if (units === 'month' || units === 'year') {
2928            days   = this._days   + milliseconds / 864e5;
2929            months = this._months + daysToMonths(days);
2930            return units === 'month' ? months : months / 12;
2931        } else {
2932            // handle milliseconds separately because of floating point math errors (issue #1867)
2933            days = this._days + Math.round(monthsToDays(this._months));
2934            switch (units) {
2935                case 'week'   : return days / 7     + milliseconds / 6048e5;
2936                case 'day'    : return days         + milliseconds / 864e5;
2937                case 'hour'   : return days * 24    + milliseconds / 36e5;
2938                case 'minute' : return days * 1440  + milliseconds / 6e4;
2939                case 'second' : return days * 86400 + milliseconds / 1000;
2940                // Math.floor prevents floating point math errors here
2941                case 'millisecond': return Math.floor(days * 864e5) + milliseconds;
2942                default: throw new Error('Unknown unit ' + units);
2943            }
2944        }
2945    }
2946
2947    // TODO: Use this.as('ms')?
2948    function duration_as__valueOf () {
2949        return (
2950            this._milliseconds +
2951            this._days * 864e5 +
2952            (this._months % 12) * 2592e6 +
2953            toInt(this._months / 12) * 31536e6
2954        );
2955    }
2956
2957    function makeAs (alias) {
2958        return function () {
2959            return this.as(alias);
2960        };
2961    }
2962
2963    var asMilliseconds = makeAs('ms');
2964    var asSeconds      = makeAs('s');
2965    var asMinutes      = makeAs('m');
2966    var asHours        = makeAs('h');
2967    var asDays         = makeAs('d');
2968    var asWeeks        = makeAs('w');
2969    var asMonths       = makeAs('M');
2970    var asYears        = makeAs('y');
2971
2972    function duration_get__get (units) {
2973        units = normalizeUnits(units);
2974        return this[units + 's']();
2975    }
2976
2977    function makeGetter(name) {
2978        return function () {
2979            return this._data[name];
2980        };
2981    }
2982
2983    var milliseconds = makeGetter('milliseconds');
2984    var seconds      = makeGetter('seconds');
2985    var minutes      = makeGetter('minutes');
2986    var hours        = makeGetter('hours');
2987    var days         = makeGetter('days');
2988    var months       = makeGetter('months');
2989    var years        = makeGetter('years');
2990
2991    function weeks () {
2992        return absFloor(this.days() / 7);
2993    }
2994
2995    var round = Math.round;
2996    var thresholds = {
2997        s: 45,  // seconds to minute
2998        m: 45,  // minutes to hour
2999        h: 22,  // hours to day
3000        d: 26,  // days to month
3001        M: 11   // months to year
3002    };
3003
3004    // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize
3005    function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) {
3006        return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
3007    }
3008
3009    function duration_humanize__relativeTime (posNegDuration, withoutSuffix, locale) {
3010        var duration = create__createDuration(posNegDuration).abs();
3011        var seconds  = round(duration.as('s'));
3012        var minutes  = round(duration.as('m'));
3013        var hours    = round(duration.as('h'));
3014        var days     = round(duration.as('d'));
3015        var months   = round(duration.as('M'));
3016        var years    = round(duration.as('y'));
3017
3018        var a = seconds < thresholds.s && ['s', seconds]  ||
3019                minutes === 1          && ['m']           ||
3020                minutes < thresholds.m && ['mm', minutes] ||
3021                hours   === 1          && ['h']           ||
3022                hours   < thresholds.h && ['hh', hours]   ||
3023                days    === 1          && ['d']           ||
3024                days    < thresholds.d && ['dd', days]    ||
3025                months  === 1          && ['M']           ||
3026                months  < thresholds.M && ['MM', months]  ||
3027                years   === 1          && ['y']           || ['yy', years];
3028
3029        a[2] = withoutSuffix;
3030        a[3] = +posNegDuration > 0;
3031        a[4] = locale;
3032        return substituteTimeAgo.apply(null, a);
3033    }
3034
3035    // This function allows you to set a threshold for relative time strings
3036    function duration_humanize__getSetRelativeTimeThreshold (threshold, limit) {
3037        if (thresholds[threshold] === undefined) {
3038            return false;
3039        }
3040        if (limit === undefined) {
3041            return thresholds[threshold];
3042        }
3043        thresholds[threshold] = limit;
3044        return true;
3045    }
3046
3047    function humanize (withSuffix) {
3048        var locale = this.localeData();
3049        var output = duration_humanize__relativeTime(this, !withSuffix, locale);
3050
3051        if (withSuffix) {
3052            output = locale.pastFuture(+this, output);
3053        }
3054
3055        return locale.postformat(output);
3056    }
3057
3058    var iso_string__abs = Math.abs;
3059
3060    function iso_string__toISOString() {
3061        // for ISO strings we do not use the normal bubbling rules:
3062        //  * milliseconds bubble up until they become hours
3063        //  * days do not bubble at all
3064        //  * months bubble up until they become years
3065        // This is because there is no context-free conversion between hours and days
3066        // (think of clock changes)
3067        // and also not between days and months (28-31 days per month)
3068        var seconds = iso_string__abs(this._milliseconds) / 1000;
3069        var days         = iso_string__abs(this._days);
3070        var months       = iso_string__abs(this._months);
3071        var minutes, hours, years;
3072
3073        // 3600 seconds -> 60 minutes -> 1 hour
3074        minutes           = absFloor(seconds / 60);
3075        hours             = absFloor(minutes / 60);
3076        seconds %= 60;
3077        minutes %= 60;
3078
3079        // 12 months -> 1 year
3080        years  = absFloor(months / 12);
3081        months %= 12;
3082
3083
3084        // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js
3085        var Y = years;
3086        var M = months;
3087        var D = days;
3088        var h = hours;
3089        var m = minutes;
3090        var s = seconds;
3091        var total = this.asSeconds();
3092
3093        if (!total) {
3094            // this is the same as C#'s (Noda) and python (isodate)...
3095            // but not other JS (goog.date)
3096            return 'P0D';
3097        }
3098
3099        return (total < 0 ? '-' : '') +
3100            'P' +
3101            (Y ? Y + 'Y' : '') +
3102            (M ? M + 'M' : '') +
3103            (D ? D + 'D' : '') +
3104            ((h || m || s) ? 'T' : '') +
3105            (h ? h + 'H' : '') +
3106            (m ? m + 'M' : '') +
3107            (s ? s + 'S' : '');
3108    }
3109
3110    var duration_prototype__proto = Duration.prototype;
3111
3112    duration_prototype__proto.abs            = duration_abs__abs;
3113    duration_prototype__proto.add            = duration_add_subtract__add;
3114    duration_prototype__proto.subtract       = duration_add_subtract__subtract;
3115    duration_prototype__proto.as             = as;
3116    duration_prototype__proto.asMilliseconds = asMilliseconds;
3117    duration_prototype__proto.asSeconds      = asSeconds;
3118    duration_prototype__proto.asMinutes      = asMinutes;
3119    duration_prototype__proto.asHours        = asHours;
3120    duration_prototype__proto.asDays         = asDays;
3121    duration_prototype__proto.asWeeks        = asWeeks;
3122    duration_prototype__proto.asMonths       = asMonths;
3123    duration_prototype__proto.asYears        = asYears;
3124    duration_prototype__proto.valueOf        = duration_as__valueOf;
3125    duration_prototype__proto._bubble        = bubble;
3126    duration_prototype__proto.get            = duration_get__get;
3127    duration_prototype__proto.milliseconds   = milliseconds;
3128    duration_prototype__proto.seconds        = seconds;
3129    duration_prototype__proto.minutes        = minutes;
3130    duration_prototype__proto.hours          = hours;
3131    duration_prototype__proto.days           = days;
3132    duration_prototype__proto.weeks          = weeks;
3133    duration_prototype__proto.months         = months;
3134    duration_prototype__proto.years          = years;
3135    duration_prototype__proto.humanize       = humanize;
3136    duration_prototype__proto.toISOString    = iso_string__toISOString;
3137    duration_prototype__proto.toString       = iso_string__toISOString;
3138    duration_prototype__proto.toJSON         = iso_string__toISOString;
3139    duration_prototype__proto.locale         = locale;
3140    duration_prototype__proto.localeData     = localeData;
3141
3142    // Deprecations
3143    duration_prototype__proto.toIsoString = deprecate('toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', iso_string__toISOString);
3144    duration_prototype__proto.lang = lang;
3145
3146    // Side effect imports
3147
3148    addFormatToken('X', 0, 0, 'unix');
3149    addFormatToken('x', 0, 0, 'valueOf');
3150
3151    // PARSING
3152
3153    addRegexToken('x', matchSigned);
3154    addRegexToken('X', matchTimestamp);
3155    addParseToken('X', function (input, array, config) {
3156        config._d = new Date(parseFloat(input, 10) * 1000);
3157    });
3158    addParseToken('x', function (input, array, config) {
3159        config._d = new Date(toInt(input));
3160    });
3161
3162    // Side effect imports
3163
3164
3165    utils_hooks__hooks.version = '2.10.6';
3166
3167    setHookCallback(local__createLocal);
3168
3169    utils_hooks__hooks.fn                    = momentPrototype;
3170    utils_hooks__hooks.min                   = min;
3171    utils_hooks__hooks.max                   = max;
3172    utils_hooks__hooks.utc                   = create_utc__createUTC;
3173    utils_hooks__hooks.unix                  = moment__createUnix;
3174    utils_hooks__hooks.months                = lists__listMonths;
3175    utils_hooks__hooks.isDate                = isDate;
3176    utils_hooks__hooks.locale                = locale_locales__getSetGlobalLocale;
3177    utils_hooks__hooks.invalid               = valid__createInvalid;
3178    utils_hooks__hooks.duration              = create__createDuration;
3179    utils_hooks__hooks.isMoment              = isMoment;
3180    utils_hooks__hooks.weekdays              = lists__listWeekdays;
3181    utils_hooks__hooks.parseZone             = moment__createInZone;
3182    utils_hooks__hooks.localeData            = locale_locales__getLocale;
3183    utils_hooks__hooks.isDuration            = isDuration;
3184    utils_hooks__hooks.monthsShort           = lists__listMonthsShort;
3185    utils_hooks__hooks.weekdaysMin           = lists__listWeekdaysMin;
3186    utils_hooks__hooks.defineLocale          = defineLocale;
3187    utils_hooks__hooks.weekdaysShort         = lists__listWeekdaysShort;
3188    utils_hooks__hooks.normalizeUnits        = normalizeUnits;
3189    utils_hooks__hooks.relativeTimeThreshold = duration_humanize__getSetRelativeTimeThreshold;
3190
3191    var _moment = utils_hooks__hooks;
3192
3193    return _moment;
3194
3195}));

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.