formagic 0.1.0

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