Browse code

Created repository.

DoubleBastionAdmin authored on 26/01/2022 20:32:42
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,18930 @@
1
+/**
2
+ *  Copyright (C) 2021  Double Bastion LLC
3
+ *
4
+ *  This file is part of Roundpin, which is licensed under the
5
+ *  GNU Affero General Public License Version 3.0. The license terms
6
+ *  are detailed in the "LICENSE.txt" file located in the root directory.
7
+ *
8
+ *  The file content from below is identical with that of the
9
+ *  original file "Chart.bundle-2.7.2.js". The copyright notice 
10
+ *  for the original content follows:
11
+
12
+/*!
13
+ * Chart.js
14
+ * http://chartjs.org/
15
+ * Version: 2.7.2
16
+ *
17
+ * Copyright 2018 Chart.js Contributors
18
+ * Released under the MIT license
19
+ * https://github.com/chartjs/Chart.js/blob/master/LICENSE.md
20
+ */
21
+(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Chart = f()}})(function(){var define,module,exports;return (function(){function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}return e})()({1:[function(require,module,exports){
22
+/* MIT license */
23
+var colorNames = require(5);
24
+
25
+module.exports = {
26
+   getRgba: getRgba,
27
+   getHsla: getHsla,
28
+   getRgb: getRgb,
29
+   getHsl: getHsl,
30
+   getHwb: getHwb,
31
+   getAlpha: getAlpha,
32
+
33
+   hexString: hexString,
34
+   rgbString: rgbString,
35
+   rgbaString: rgbaString,
36
+   percentString: percentString,
37
+   percentaString: percentaString,
38
+   hslString: hslString,
39
+   hslaString: hslaString,
40
+   hwbString: hwbString,
41
+   keyword: keyword
42
+}
43
+
44
+function getRgba(string) {
45
+   if (!string) {
46
+      return;
47
+   }
48
+   var abbr =  /^#([a-fA-F0-9]{3})$/i,
49
+       hex =  /^#([a-fA-F0-9]{6})$/i,
50
+       rgba = /^rgba?\(\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/i,
51
+       per = /^rgba?\(\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/i,
52
+       keyword = /(\w+)/;
53
+
54
+   var rgb = [0, 0, 0],
55
+       a = 1,
56
+       match = string.match(abbr);
57
+   if (match) {
58
+      match = match[1];
59
+      for (var i = 0; i < rgb.length; i++) {
60
+         rgb[i] = parseInt(match[i] + match[i], 16);
61
+      }
62
+   }
63
+   else if (match = string.match(hex)) {
64
+      match = match[1];
65
+      for (var i = 0; i < rgb.length; i++) {
66
+         rgb[i] = parseInt(match.slice(i * 2, i * 2 + 2), 16);
67
+      }
68
+   }
69
+   else if (match = string.match(rgba)) {
70
+      for (var i = 0; i < rgb.length; i++) {
71
+         rgb[i] = parseInt(match[i + 1]);
72
+      }
73
+      a = parseFloat(match[4]);
74
+   }
75
+   else if (match = string.match(per)) {
76
+      for (var i = 0; i < rgb.length; i++) {
77
+         rgb[i] = Math.round(parseFloat(match[i + 1]) * 2.55);
78
+      }
79
+      a = parseFloat(match[4]);
80
+   }
81
+   else if (match = string.match(keyword)) {
82
+      if (match[1] == "transparent") {
83
+         return [0, 0, 0, 0];
84
+      }
85
+      rgb = colorNames[match[1]];
86
+      if (!rgb) {
87
+         return;
88
+      }
89
+   }
90
+
91
+   for (var i = 0; i < rgb.length; i++) {
92
+      rgb[i] = scale(rgb[i], 0, 255);
93
+   }
94
+   if (!a && a != 0) {
95
+      a = 1;
96
+   }
97
+   else {
98
+      a = scale(a, 0, 1);
99
+   }
100
+   rgb[3] = a;
101
+   return rgb;
102
+}
103
+
104
+function getHsla(string) {
105
+   if (!string) {
106
+      return;
107
+   }
108
+   var hsl = /^hsla?\(\s*([+-]?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)/;
109
+   var match = string.match(hsl);
110
+   if (match) {
111
+      var alpha = parseFloat(match[4]);
112
+      var h = scale(parseInt(match[1]), 0, 360),
113
+          s = scale(parseFloat(match[2]), 0, 100),
114
+          l = scale(parseFloat(match[3]), 0, 100),
115
+          a = scale(isNaN(alpha) ? 1 : alpha, 0, 1);
116
+      return [h, s, l, a];
117
+   }
118
+}
119
+
120
+function getHwb(string) {
121
+   if (!string) {
122
+      return;
123
+   }
124
+   var hwb = /^hwb\(\s*([+-]?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)/;
125
+   var match = string.match(hwb);
126
+   if (match) {
127
+    var alpha = parseFloat(match[4]);
128
+      var h = scale(parseInt(match[1]), 0, 360),
129
+          w = scale(parseFloat(match[2]), 0, 100),
130
+          b = scale(parseFloat(match[3]), 0, 100),
131
+          a = scale(isNaN(alpha) ? 1 : alpha, 0, 1);
132
+      return [h, w, b, a];
133
+   }
134
+}
135
+
136
+function getRgb(string) {
137
+   var rgba = getRgba(string);
138
+   return rgba && rgba.slice(0, 3);
139
+}
140
+
141
+function getHsl(string) {
142
+  var hsla = getHsla(string);
143
+  return hsla && hsla.slice(0, 3);
144
+}
145
+
146
+function getAlpha(string) {
147
+   var vals = getRgba(string);
148
+   if (vals) {
149
+      return vals[3];
150
+   }
151
+   else if (vals = getHsla(string)) {
152
+      return vals[3];
153
+   }
154
+   else if (vals = getHwb(string)) {
155
+      return vals[3];
156
+   }
157
+}
158
+
159
+// generators
160
+function hexString(rgb) {
161
+   return "#" + hexDouble(rgb[0]) + hexDouble(rgb[1])
162
+              + hexDouble(rgb[2]);
163
+}
164
+
165
+function rgbString(rgba, alpha) {
166
+   if (alpha < 1 || (rgba[3] && rgba[3] < 1)) {
167
+      return rgbaString(rgba, alpha);
168
+   }
169
+   return "rgb(" + rgba[0] + ", " + rgba[1] + ", " + rgba[2] + ")";
170
+}
171
+
172
+function rgbaString(rgba, alpha) {
173
+   if (alpha === undefined) {
174
+      alpha = (rgba[3] !== undefined ? rgba[3] : 1);
175
+   }
176
+   return "rgba(" + rgba[0] + ", " + rgba[1] + ", " + rgba[2]
177
+           + ", " + alpha + ")";
178
+}
179
+
180
+function percentString(rgba, alpha) {
181
+   if (alpha < 1 || (rgba[3] && rgba[3] < 1)) {
182
+      return percentaString(rgba, alpha);
183
+   }
184
+   var r = Math.round(rgba[0]/255 * 100),
185
+       g = Math.round(rgba[1]/255 * 100),
186
+       b = Math.round(rgba[2]/255 * 100);
187
+
188
+   return "rgb(" + r + "%, " + g + "%, " + b + "%)";
189
+}
190
+
191
+function percentaString(rgba, alpha) {
192
+   var r = Math.round(rgba[0]/255 * 100),
193
+       g = Math.round(rgba[1]/255 * 100),
194
+       b = Math.round(rgba[2]/255 * 100);
195
+   return "rgba(" + r + "%, " + g + "%, " + b + "%, " + (alpha || rgba[3] || 1) + ")";
196
+}
197
+
198
+function hslString(hsla, alpha) {
199
+   if (alpha < 1 || (hsla[3] && hsla[3] < 1)) {
200
+      return hslaString(hsla, alpha);
201
+   }
202
+   return "hsl(" + hsla[0] + ", " + hsla[1] + "%, " + hsla[2] + "%)";
203
+}
204
+
205
+function hslaString(hsla, alpha) {
206
+   if (alpha === undefined) {
207
+      alpha = (hsla[3] !== undefined ? hsla[3] : 1);
208
+   }
209
+   return "hsla(" + hsla[0] + ", " + hsla[1] + "%, " + hsla[2] + "%, "
210
+           + alpha + ")";
211
+}
212
+
213
+// hwb is a bit different than rgb(a) & hsl(a) since there is no alpha specific syntax
214
+// (hwb have alpha optional & 1 is default value)
215
+function hwbString(hwb, alpha) {
216
+   if (alpha === undefined) {
217
+      alpha = (hwb[3] !== undefined ? hwb[3] : 1);
218
+   }
219
+   return "hwb(" + hwb[0] + ", " + hwb[1] + "%, " + hwb[2] + "%"
220
+           + (alpha !== undefined && alpha !== 1 ? ", " + alpha : "") + ")";
221
+}
222
+
223
+function keyword(rgb) {
224
+  return reverseNames[rgb.slice(0, 3)];
225
+}
226
+
227
+// helpers
228
+function scale(num, min, max) {
229
+   return Math.min(Math.max(min, num), max);
230
+}
231
+
232
+function hexDouble(num) {
233
+  var str = num.toString(16).toUpperCase();
234
+  return (str.length < 2) ? "0" + str : str;
235
+}
236
+
237
+
238
+//create a list of reverse color names
239
+var reverseNames = {};
240
+for (var name in colorNames) {
241
+   reverseNames[colorNames[name]] = name;
242
+}
243
+
244
+},{"5":5}],2:[function(require,module,exports){
245
+/* MIT license */
246
+var convert = require(4);
247
+var string = require(1);
248
+
249
+var Color = function (obj) {
250
+	if (obj instanceof Color) {
251
+		return obj;
252
+	}
253
+	if (!(this instanceof Color)) {
254
+		return new Color(obj);
255
+	}
256
+
257
+	this.valid = false;
258
+	this.values = {
259
+		rgb: [0, 0, 0],
260
+		hsl: [0, 0, 0],
261
+		hsv: [0, 0, 0],
262
+		hwb: [0, 0, 0],
263
+		cmyk: [0, 0, 0, 0],
264
+		alpha: 1
265
+	};
266
+
267
+	// parse Color() argument
268
+	var vals;
269
+	if (typeof obj === 'string') {
270
+		vals = string.getRgba(obj);
271
+		if (vals) {
272
+			this.setValues('rgb', vals);
273
+		} else if (vals = string.getHsla(obj)) {
274
+			this.setValues('hsl', vals);
275
+		} else if (vals = string.getHwb(obj)) {
276
+			this.setValues('hwb', vals);
277
+		}
278
+	} else if (typeof obj === 'object') {
279
+		vals = obj;
280
+		if (vals.r !== undefined || vals.red !== undefined) {
281
+			this.setValues('rgb', vals);
282
+		} else if (vals.l !== undefined || vals.lightness !== undefined) {
283
+			this.setValues('hsl', vals);
284
+		} else if (vals.v !== undefined || vals.value !== undefined) {
285
+			this.setValues('hsv', vals);
286
+		} else if (vals.w !== undefined || vals.whiteness !== undefined) {
287
+			this.setValues('hwb', vals);
288
+		} else if (vals.c !== undefined || vals.cyan !== undefined) {
289
+			this.setValues('cmyk', vals);
290
+		}
291
+	}
292
+};
293
+
294
+Color.prototype = {
295
+	isValid: function () {
296
+		return this.valid;
297
+	},
298
+	rgb: function () {
299
+		return this.setSpace('rgb', arguments);
300
+	},
301
+	hsl: function () {
302
+		return this.setSpace('hsl', arguments);
303
+	},
304
+	hsv: function () {
305
+		return this.setSpace('hsv', arguments);
306
+	},
307
+	hwb: function () {
308
+		return this.setSpace('hwb', arguments);
309
+	},
310
+	cmyk: function () {
311
+		return this.setSpace('cmyk', arguments);
312
+	},
313
+
314
+	rgbArray: function () {
315
+		return this.values.rgb;
316
+	},
317
+	hslArray: function () {
318
+		return this.values.hsl;
319
+	},
320
+	hsvArray: function () {
321
+		return this.values.hsv;
322
+	},
323
+	hwbArray: function () {
324
+		var values = this.values;
325
+		if (values.alpha !== 1) {
326
+			return values.hwb.concat([values.alpha]);
327
+		}
328
+		return values.hwb;
329
+	},
330
+	cmykArray: function () {
331
+		return this.values.cmyk;
332
+	},
333
+	rgbaArray: function () {
334
+		var values = this.values;
335
+		return values.rgb.concat([values.alpha]);
336
+	},
337
+	hslaArray: function () {
338
+		var values = this.values;
339
+		return values.hsl.concat([values.alpha]);
340
+	},
341
+	alpha: function (val) {
342
+		if (val === undefined) {
343
+			return this.values.alpha;
344
+		}
345
+		this.setValues('alpha', val);
346
+		return this;
347
+	},
348
+
349
+	red: function (val) {
350
+		return this.setChannel('rgb', 0, val);
351
+	},
352
+	green: function (val) {
353
+		return this.setChannel('rgb', 1, val);
354
+	},
355
+	blue: function (val) {
356
+		return this.setChannel('rgb', 2, val);
357
+	},
358
+	hue: function (val) {
359
+		if (val) {
360
+			val %= 360;
361
+			val = val < 0 ? 360 + val : val;
362
+		}
363
+		return this.setChannel('hsl', 0, val);
364
+	},
365
+	saturation: function (val) {
366
+		return this.setChannel('hsl', 1, val);
367
+	},
368
+	lightness: function (val) {
369
+		return this.setChannel('hsl', 2, val);
370
+	},
371
+	saturationv: function (val) {
372
+		return this.setChannel('hsv', 1, val);
373
+	},
374
+	whiteness: function (val) {
375
+		return this.setChannel('hwb', 1, val);
376
+	},
377
+	blackness: function (val) {
378
+		return this.setChannel('hwb', 2, val);
379
+	},
380
+	value: function (val) {
381
+		return this.setChannel('hsv', 2, val);
382
+	},
383
+	cyan: function (val) {
384
+		return this.setChannel('cmyk', 0, val);
385
+	},
386
+	magenta: function (val) {
387
+		return this.setChannel('cmyk', 1, val);
388
+	},
389
+	yellow: function (val) {
390
+		return this.setChannel('cmyk', 2, val);
391
+	},
392
+	black: function (val) {
393
+		return this.setChannel('cmyk', 3, val);
394
+	},
395
+
396
+	hexString: function () {
397
+		return string.hexString(this.values.rgb);
398
+	},
399
+	rgbString: function () {
400
+		return string.rgbString(this.values.rgb, this.values.alpha);
401
+	},
402
+	rgbaString: function () {
403
+		return string.rgbaString(this.values.rgb, this.values.alpha);
404
+	},
405
+	percentString: function () {
406
+		return string.percentString(this.values.rgb, this.values.alpha);
407
+	},
408
+	hslString: function () {
409
+		return string.hslString(this.values.hsl, this.values.alpha);
410
+	},
411
+	hslaString: function () {
412
+		return string.hslaString(this.values.hsl, this.values.alpha);
413
+	},
414
+	hwbString: function () {
415
+		return string.hwbString(this.values.hwb, this.values.alpha);
416
+	},
417
+	keyword: function () {
418
+		return string.keyword(this.values.rgb, this.values.alpha);
419
+	},
420
+
421
+	rgbNumber: function () {
422
+		var rgb = this.values.rgb;
423
+		return (rgb[0] << 16) | (rgb[1] << 8) | rgb[2];
424
+	},
425
+
426
+	luminosity: function () {
427
+		// http://www.w3.org/TR/WCAG20/#relativeluminancedef
428
+		var rgb = this.values.rgb;
429
+		var lum = [];
430
+		for (var i = 0; i < rgb.length; i++) {
431
+			var chan = rgb[i] / 255;
432
+			lum[i] = (chan <= 0.03928) ? chan / 12.92 : Math.pow(((chan + 0.055) / 1.055), 2.4);
433
+		}
434
+		return 0.2126 * lum[0] + 0.7152 * lum[1] + 0.0722 * lum[2];
435
+	},
436
+
437
+	contrast: function (color2) {
438
+		// http://www.w3.org/TR/WCAG20/#contrast-ratiodef
439
+		var lum1 = this.luminosity();
440
+		var lum2 = color2.luminosity();
441
+		if (lum1 > lum2) {
442
+			return (lum1 + 0.05) / (lum2 + 0.05);
443
+		}
444
+		return (lum2 + 0.05) / (lum1 + 0.05);
445
+	},
446
+
447
+	level: function (color2) {
448
+		var contrastRatio = this.contrast(color2);
449
+		if (contrastRatio >= 7.1) {
450
+			return 'AAA';
451
+		}
452
+
453
+		return (contrastRatio >= 4.5) ? 'AA' : '';
454
+	},
455
+
456
+	dark: function () {
457
+		// YIQ equation from http://24ways.org/2010/calculating-color-contrast
458
+		var rgb = this.values.rgb;
459
+		var yiq = (rgb[0] * 299 + rgb[1] * 587 + rgb[2] * 114) / 1000;
460
+		return yiq < 128;
461
+	},
462
+
463
+	light: function () {
464
+		return !this.dark();
465
+	},
466
+
467
+	negate: function () {
468
+		var rgb = [];
469
+		for (var i = 0; i < 3; i++) {
470
+			rgb[i] = 255 - this.values.rgb[i];
471
+		}
472
+		this.setValues('rgb', rgb);
473
+		return this;
474
+	},
475
+
476
+	lighten: function (ratio) {
477
+		var hsl = this.values.hsl;
478
+		hsl[2] += hsl[2] * ratio;
479
+		this.setValues('hsl', hsl);
480
+		return this;
481
+	},
482
+
483
+	darken: function (ratio) {
484
+		var hsl = this.values.hsl;
485
+		hsl[2] -= hsl[2] * ratio;
486
+		this.setValues('hsl', hsl);
487
+		return this;
488
+	},
489
+
490
+	saturate: function (ratio) {
491
+		var hsl = this.values.hsl;
492
+		hsl[1] += hsl[1] * ratio;
493
+		this.setValues('hsl', hsl);
494
+		return this;
495
+	},
496
+
497
+	desaturate: function (ratio) {
498
+		var hsl = this.values.hsl;
499
+		hsl[1] -= hsl[1] * ratio;
500
+		this.setValues('hsl', hsl);
501
+		return this;
502
+	},
503
+
504
+	whiten: function (ratio) {
505
+		var hwb = this.values.hwb;
506
+		hwb[1] += hwb[1] * ratio;
507
+		this.setValues('hwb', hwb);
508
+		return this;
509
+	},
510
+
511
+	blacken: function (ratio) {
512
+		var hwb = this.values.hwb;
513
+		hwb[2] += hwb[2] * ratio;
514
+		this.setValues('hwb', hwb);
515
+		return this;
516
+	},
517
+
518
+	greyscale: function () {
519
+		var rgb = this.values.rgb;
520
+		// http://en.wikipedia.org/wiki/Grayscale#Converting_color_to_grayscale
521
+		var val = rgb[0] * 0.3 + rgb[1] * 0.59 + rgb[2] * 0.11;
522
+		this.setValues('rgb', [val, val, val]);
523
+		return this;
524
+	},
525
+
526
+	clearer: function (ratio) {
527
+		var alpha = this.values.alpha;
528
+		this.setValues('alpha', alpha - (alpha * ratio));
529
+		return this;
530
+	},
531
+
532
+	opaquer: function (ratio) {
533
+		var alpha = this.values.alpha;
534
+		this.setValues('alpha', alpha + (alpha * ratio));
535
+		return this;
536
+	},
537
+
538
+	rotate: function (degrees) {
539
+		var hsl = this.values.hsl;
540
+		var hue = (hsl[0] + degrees) % 360;
541
+		hsl[0] = hue < 0 ? 360 + hue : hue;
542
+		this.setValues('hsl', hsl);
543
+		return this;
544
+	},
545
+
546
+	/**
547
+	 * Ported from sass implementation in C
548
+	 * https://github.com/sass/libsass/blob/0e6b4a2850092356aa3ece07c6b249f0221caced/functions.cpp#L209
549
+	 */
550
+	mix: function (mixinColor, weight) {
551
+		var color1 = this;
552
+		var color2 = mixinColor;
553
+		var p = weight === undefined ? 0.5 : weight;
554
+
555
+		var w = 2 * p - 1;
556
+		var a = color1.alpha() - color2.alpha();
557
+
558
+		var w1 = (((w * a === -1) ? w : (w + a) / (1 + w * a)) + 1) / 2.0;
559
+		var w2 = 1 - w1;
560
+
561
+		return this
562
+			.rgb(
563
+				w1 * color1.red() + w2 * color2.red(),
564
+				w1 * color1.green() + w2 * color2.green(),
565
+				w1 * color1.blue() + w2 * color2.blue()
566
+			)
567
+			.alpha(color1.alpha() * p + color2.alpha() * (1 - p));
568
+	},
569
+
570
+	toJSON: function () {
571
+		return this.rgb();
572
+	},
573
+
574
+	clone: function () {
575
+		// NOTE(SB): using node-clone creates a dependency to Buffer when using browserify,
576
+		// making the final build way to big to embed in Chart.js. So let's do it manually,
577
+		// assuming that values to clone are 1 dimension arrays containing only numbers,
578
+		// except 'alpha' which is a number.
579
+		var result = new Color();
580
+		var source = this.values;
581
+		var target = result.values;
582
+		var value, type;
583
+
584
+		for (var prop in source) {
585
+			if (source.hasOwnProperty(prop)) {
586
+				value = source[prop];
587
+				type = ({}).toString.call(value);
588
+				if (type === '[object Array]') {
589
+					target[prop] = value.slice(0);
590
+				} else if (type === '[object Number]') {
591
+					target[prop] = value;
592
+				} else {
593
+					console.error('unexpected color value:', value);
594
+				}
595
+			}
596
+		}
597
+
598
+		return result;
599
+	}
600
+};
601
+
602
+Color.prototype.spaces = {
603
+	rgb: ['red', 'green', 'blue'],
604
+	hsl: ['hue', 'saturation', 'lightness'],
605
+	hsv: ['hue', 'saturation', 'value'],
606
+	hwb: ['hue', 'whiteness', 'blackness'],
607
+	cmyk: ['cyan', 'magenta', 'yellow', 'black']
608
+};
609
+
610
+Color.prototype.maxes = {
611
+	rgb: [255, 255, 255],
612
+	hsl: [360, 100, 100],
613
+	hsv: [360, 100, 100],
614
+	hwb: [360, 100, 100],
615
+	cmyk: [100, 100, 100, 100]
616
+};
617
+
618
+Color.prototype.getValues = function (space) {
619
+	var values = this.values;
620
+	var vals = {};
621
+
622
+	for (var i = 0; i < space.length; i++) {
623
+		vals[space.charAt(i)] = values[space][i];
624
+	}
625
+
626
+	if (values.alpha !== 1) {
627
+		vals.a = values.alpha;
628
+	}
629
+
630
+	// {r: 255, g: 255, b: 255, a: 0.4}
631
+	return vals;
632
+};
633
+
634
+Color.prototype.setValues = function (space, vals) {
635
+	var values = this.values;
636
+	var spaces = this.spaces;
637
+	var maxes = this.maxes;
638
+	var alpha = 1;
639
+	var i;
640
+
641
+	this.valid = true;
642
+
643
+	if (space === 'alpha') {
644
+		alpha = vals;
645
+	} else if (vals.length) {
646
+		// [10, 10, 10]
647
+		values[space] = vals.slice(0, space.length);
648
+		alpha = vals[space.length];
649
+	} else if (vals[space.charAt(0)] !== undefined) {
650
+		// {r: 10, g: 10, b: 10}
651
+		for (i = 0; i < space.length; i++) {
652
+			values[space][i] = vals[space.charAt(i)];
653
+		}
654
+
655
+		alpha = vals.a;
656
+	} else if (vals[spaces[space][0]] !== undefined) {
657
+		// {red: 10, green: 10, blue: 10}
658
+		var chans = spaces[space];
659
+
660
+		for (i = 0; i < space.length; i++) {
661
+			values[space][i] = vals[chans[i]];
662
+		}
663
+
664
+		alpha = vals.alpha;
665
+	}
666
+
667
+	values.alpha = Math.max(0, Math.min(1, (alpha === undefined ? values.alpha : alpha)));
668
+
669
+	if (space === 'alpha') {
670
+		return false;
671
+	}
672
+
673
+	var capped;
674
+
675
+	// cap values of the space prior converting all values
676
+	for (i = 0; i < space.length; i++) {
677
+		capped = Math.max(0, Math.min(maxes[space][i], values[space][i]));
678
+		values[space][i] = Math.round(capped);
679
+	}
680
+
681
+	// convert to all the other color spaces
682
+	for (var sname in spaces) {
683
+		if (sname !== space) {
684
+			values[sname] = convert[space][sname](values[space]);
685
+		}
686
+	}
687
+
688
+	return true;
689
+};
690
+
691
+Color.prototype.setSpace = function (space, args) {
692
+	var vals = args[0];
693
+
694
+	if (vals === undefined) {
695
+		// color.rgb()
696
+		return this.getValues(space);
697
+	}
698
+
699
+	// color.rgb(10, 10, 10)
700
+	if (typeof vals === 'number') {
701
+		vals = Array.prototype.slice.call(args);
702
+	}
703
+
704
+	this.setValues(space, vals);
705
+	return this;
706
+};
707
+
708
+Color.prototype.setChannel = function (space, index, val) {
709
+	var svalues = this.values[space];
710
+	if (val === undefined) {
711
+		// color.red()
712
+		return svalues[index];
713
+	} else if (val === svalues[index]) {
714
+		// color.red(color.red())
715
+		return this;
716
+	}
717
+
718
+	// color.red(100)
719
+	svalues[index] = val;
720
+	this.setValues(space, svalues);
721
+
722
+	return this;
723
+};
724
+
725
+if (typeof window !== 'undefined') {
726
+	window.Color = Color;
727
+}
728
+
729
+module.exports = Color;
730
+
731
+},{"1":1,"4":4}],3:[function(require,module,exports){
732
+/* MIT license */
733
+
734
+module.exports = {
735
+  rgb2hsl: rgb2hsl,
736
+  rgb2hsv: rgb2hsv,
737
+  rgb2hwb: rgb2hwb,
738
+  rgb2cmyk: rgb2cmyk,
739
+  rgb2keyword: rgb2keyword,
740
+  rgb2xyz: rgb2xyz,
741
+  rgb2lab: rgb2lab,
742
+  rgb2lch: rgb2lch,
743
+
744
+  hsl2rgb: hsl2rgb,
745
+  hsl2hsv: hsl2hsv,
746
+  hsl2hwb: hsl2hwb,
747
+  hsl2cmyk: hsl2cmyk,
748
+  hsl2keyword: hsl2keyword,
749
+
750
+  hsv2rgb: hsv2rgb,
751
+  hsv2hsl: hsv2hsl,
752
+  hsv2hwb: hsv2hwb,
753
+  hsv2cmyk: hsv2cmyk,
754
+  hsv2keyword: hsv2keyword,
755
+
756
+  hwb2rgb: hwb2rgb,
757
+  hwb2hsl: hwb2hsl,
758
+  hwb2hsv: hwb2hsv,
759
+  hwb2cmyk: hwb2cmyk,
760
+  hwb2keyword: hwb2keyword,
761
+
762
+  cmyk2rgb: cmyk2rgb,
763
+  cmyk2hsl: cmyk2hsl,
764
+  cmyk2hsv: cmyk2hsv,
765
+  cmyk2hwb: cmyk2hwb,
766
+  cmyk2keyword: cmyk2keyword,
767
+
768
+  keyword2rgb: keyword2rgb,
769
+  keyword2hsl: keyword2hsl,
770
+  keyword2hsv: keyword2hsv,
771
+  keyword2hwb: keyword2hwb,
772
+  keyword2cmyk: keyword2cmyk,
773
+  keyword2lab: keyword2lab,
774
+  keyword2xyz: keyword2xyz,
775
+
776
+  xyz2rgb: xyz2rgb,
777
+  xyz2lab: xyz2lab,
778
+  xyz2lch: xyz2lch,
779
+
780
+  lab2xyz: lab2xyz,
781
+  lab2rgb: lab2rgb,
782
+  lab2lch: lab2lch,
783
+
784
+  lch2lab: lch2lab,
785
+  lch2xyz: lch2xyz,
786
+  lch2rgb: lch2rgb
787
+}
788
+
789
+
790
+function rgb2hsl(rgb) {
791
+  var r = rgb[0]/255,
792
+      g = rgb[1]/255,
793
+      b = rgb[2]/255,
794
+      min = Math.min(r, g, b),
795
+      max = Math.max(r, g, b),
796
+      delta = max - min,
797
+      h, s, l;
798
+
799
+  if (max == min)
800
+    h = 0;
801
+  else if (r == max)
802
+    h = (g - b) / delta;
803
+  else if (g == max)
804
+    h = 2 + (b - r) / delta;
805
+  else if (b == max)
806
+    h = 4 + (r - g)/ delta;
807
+
808
+  h = Math.min(h * 60, 360);
809
+
810
+  if (h < 0)
811
+    h += 360;
812
+
813
+  l = (min + max) / 2;
814
+
815
+  if (max == min)
816
+    s = 0;
817
+  else if (l <= 0.5)
818
+    s = delta / (max + min);
819
+  else
820
+    s = delta / (2 - max - min);
821
+
822
+  return [h, s * 100, l * 100];
823
+}
824
+
825
+function rgb2hsv(rgb) {
826
+  var r = rgb[0],
827
+      g = rgb[1],
828
+      b = rgb[2],
829
+      min = Math.min(r, g, b),
830
+      max = Math.max(r, g, b),
831
+      delta = max - min,
832
+      h, s, v;
833
+
834
+  if (max == 0)
835
+    s = 0;
836
+  else
837
+    s = (delta/max * 1000)/10;
838
+
839
+  if (max == min)
840
+    h = 0;
841
+  else if (r == max)
842
+    h = (g - b) / delta;
843
+  else if (g == max)
844
+    h = 2 + (b - r) / delta;
845
+  else if (b == max)
846
+    h = 4 + (r - g) / delta;
847
+
848
+  h = Math.min(h * 60, 360);
849
+
850
+  if (h < 0)
851
+    h += 360;
852
+
853
+  v = ((max / 255) * 1000) / 10;
854
+
855
+  return [h, s, v];
856
+}
857
+
858
+function rgb2hwb(rgb) {
859
+  var r = rgb[0],
860
+      g = rgb[1],
861
+      b = rgb[2],
862
+      h = rgb2hsl(rgb)[0],
863
+      w = 1/255 * Math.min(r, Math.min(g, b)),
864
+      b = 1 - 1/255 * Math.max(r, Math.max(g, b));
865
+
866
+  return [h, w * 100, b * 100];
867
+}
868
+
869
+function rgb2cmyk(rgb) {
870
+  var r = rgb[0] / 255,
871
+      g = rgb[1] / 255,
872
+      b = rgb[2] / 255,
873
+      c, m, y, k;
874
+
875
+  k = Math.min(1 - r, 1 - g, 1 - b);
876
+  c = (1 - r - k) / (1 - k) || 0;
877
+  m = (1 - g - k) / (1 - k) || 0;
878
+  y = (1 - b - k) / (1 - k) || 0;
879
+  return [c * 100, m * 100, y * 100, k * 100];
880
+}
881
+
882
+function rgb2keyword(rgb) {
883
+  return reverseKeywords[JSON.stringify(rgb)];
884
+}
885
+
886
+function rgb2xyz(rgb) {
887
+  var r = rgb[0] / 255,
888
+      g = rgb[1] / 255,
889
+      b = rgb[2] / 255;
890
+
891
+  // assume sRGB
892
+  r = r > 0.04045 ? Math.pow(((r + 0.055) / 1.055), 2.4) : (r / 12.92);
893
+  g = g > 0.04045 ? Math.pow(((g + 0.055) / 1.055), 2.4) : (g / 12.92);
894
+  b = b > 0.04045 ? Math.pow(((b + 0.055) / 1.055), 2.4) : (b / 12.92);
895
+
896
+  var x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);
897
+  var y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);
898
+  var z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);
899
+
900
+  return [x * 100, y *100, z * 100];
901
+}
902
+
903
+function rgb2lab(rgb) {
904
+  var xyz = rgb2xyz(rgb),
905
+        x = xyz[0],
906
+        y = xyz[1],
907
+        z = xyz[2],
908
+        l, a, b;
909
+
910
+  x /= 95.047;
911
+  y /= 100;
912
+  z /= 108.883;
913
+
914
+  x = x > 0.008856 ? Math.pow(x, 1/3) : (7.787 * x) + (16 / 116);
915
+  y = y > 0.008856 ? Math.pow(y, 1/3) : (7.787 * y) + (16 / 116);
916
+  z = z > 0.008856 ? Math.pow(z, 1/3) : (7.787 * z) + (16 / 116);
917
+
918
+  l = (116 * y) - 16;
919
+  a = 500 * (x - y);
920
+  b = 200 * (y - z);
921
+
922
+  return [l, a, b];
923
+}
924
+
925
+function rgb2lch(args) {
926
+  return lab2lch(rgb2lab(args));
927
+}
928
+
929
+function hsl2rgb(hsl) {
930
+  var h = hsl[0] / 360,
931
+      s = hsl[1] / 100,
932
+      l = hsl[2] / 100,
933
+      t1, t2, t3, rgb, val;
934
+
935
+  if (s == 0) {
936
+    val = l * 255;
937
+    return [val, val, val];
938
+  }
939
+
940
+  if (l < 0.5)
941
+    t2 = l * (1 + s);
942
+  else
943
+    t2 = l + s - l * s;
944
+  t1 = 2 * l - t2;
945
+
946
+  rgb = [0, 0, 0];
947
+  for (var i = 0; i < 3; i++) {
948
+    t3 = h + 1 / 3 * - (i - 1);
949
+    t3 < 0 && t3++;
950
+    t3 > 1 && t3--;
951
+
952
+    if (6 * t3 < 1)
953
+      val = t1 + (t2 - t1) * 6 * t3;
954
+    else if (2 * t3 < 1)
955
+      val = t2;
956
+    else if (3 * t3 < 2)
957
+      val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
958
+    else
959
+      val = t1;
960
+
961
+    rgb[i] = val * 255;
962
+  }
963
+
964
+  return rgb;
965
+}
966
+
967
+function hsl2hsv(hsl) {
968
+  var h = hsl[0],
969
+      s = hsl[1] / 100,
970
+      l = hsl[2] / 100,
971
+      sv, v;
972
+
973
+  if(l === 0) {
974
+      // no need to do calc on black
975
+      // also avoids divide by 0 error
976
+      return [0, 0, 0];
977
+  }
978
+
979
+  l *= 2;
980
+  s *= (l <= 1) ? l : 2 - l;
981
+  v = (l + s) / 2;
982
+  sv = (2 * s) / (l + s);
983
+  return [h, sv * 100, v * 100];
984
+}
985
+
986
+function hsl2hwb(args) {
987
+  return rgb2hwb(hsl2rgb(args));
988
+}
989
+
990
+function hsl2cmyk(args) {
991
+  return rgb2cmyk(hsl2rgb(args));
992
+}
993
+
994
+function hsl2keyword(args) {
995
+  return rgb2keyword(hsl2rgb(args));
996
+}
997
+
998
+
999
+function hsv2rgb(hsv) {
1000
+  var h = hsv[0] / 60,
1001
+      s = hsv[1] / 100,
1002
+      v = hsv[2] / 100,
1003
+      hi = Math.floor(h) % 6;
1004
+
1005
+  var f = h - Math.floor(h),
1006
+      p = 255 * v * (1 - s),
1007
+      q = 255 * v * (1 - (s * f)),
1008
+      t = 255 * v * (1 - (s * (1 - f))),
1009
+      v = 255 * v;
1010
+
1011
+  switch(hi) {
1012
+    case 0:
1013
+      return [v, t, p];
1014
+    case 1:
1015
+      return [q, v, p];
1016
+    case 2:
1017
+      return [p, v, t];
1018
+    case 3:
1019
+      return [p, q, v];
1020
+    case 4:
1021
+      return [t, p, v];
1022
+    case 5:
1023
+      return [v, p, q];
1024
+  }
1025
+}
1026
+
1027
+function hsv2hsl(hsv) {
1028
+  var h = hsv[0],
1029
+      s = hsv[1] / 100,
1030
+      v = hsv[2] / 100,
1031
+      sl, l;
1032
+
1033
+  l = (2 - s) * v;
1034
+  sl = s * v;
1035
+  sl /= (l <= 1) ? l : 2 - l;
1036
+  sl = sl || 0;
1037
+  l /= 2;
1038
+  return [h, sl * 100, l * 100];
1039
+}
1040
+
1041
+function hsv2hwb(args) {
1042
+  return rgb2hwb(hsv2rgb(args))
1043
+}
1044
+
1045
+function hsv2cmyk(args) {
1046
+  return rgb2cmyk(hsv2rgb(args));
1047
+}
1048
+
1049
+function hsv2keyword(args) {
1050
+  return rgb2keyword(hsv2rgb(args));
1051
+}
1052
+
1053
+// http://dev.w3.org/csswg/css-color/#hwb-to-rgb
1054
+function hwb2rgb(hwb) {
1055
+  var h = hwb[0] / 360,
1056
+      wh = hwb[1] / 100,
1057
+      bl = hwb[2] / 100,
1058
+      ratio = wh + bl,
1059
+      i, v, f, n;
1060
+
1061
+  // wh + bl cant be > 1
1062
+  if (ratio > 1) {
1063
+    wh /= ratio;
1064
+    bl /= ratio;
1065
+  }
1066
+
1067
+  i = Math.floor(6 * h);
1068
+  v = 1 - bl;
1069
+  f = 6 * h - i;
1070
+  if ((i & 0x01) != 0) {
1071
+    f = 1 - f;
1072
+  }
1073
+  n = wh + f * (v - wh);  // linear interpolation
1074
+
1075
+  switch (i) {
1076
+    default:
1077
+    case 6:
1078
+    case 0: r = v; g = n; b = wh; break;
1079
+    case 1: r = n; g = v; b = wh; break;
1080
+    case 2: r = wh; g = v; b = n; break;
1081
+    case 3: r = wh; g = n; b = v; break;
1082
+    case 4: r = n; g = wh; b = v; break;
1083
+    case 5: r = v; g = wh; b = n; break;
1084
+  }
1085
+
1086
+  return [r * 255, g * 255, b * 255];
1087
+}
1088
+
1089
+function hwb2hsl(args) {
1090
+  return rgb2hsl(hwb2rgb(args));
1091
+}
1092
+
1093
+function hwb2hsv(args) {
1094
+  return rgb2hsv(hwb2rgb(args));
1095
+}
1096
+
1097
+function hwb2cmyk(args) {
1098
+  return rgb2cmyk(hwb2rgb(args));
1099
+}
1100
+
1101
+function hwb2keyword(args) {
1102
+  return rgb2keyword(hwb2rgb(args));
1103
+}
1104
+
1105
+function cmyk2rgb(cmyk) {
1106
+  var c = cmyk[0] / 100,
1107
+      m = cmyk[1] / 100,
1108
+      y = cmyk[2] / 100,
1109
+      k = cmyk[3] / 100,
1110
+      r, g, b;
1111
+
1112
+  r = 1 - Math.min(1, c * (1 - k) + k);
1113
+  g = 1 - Math.min(1, m * (1 - k) + k);
1114
+  b = 1 - Math.min(1, y * (1 - k) + k);
1115
+  return [r * 255, g * 255, b * 255];
1116
+}
1117
+
1118
+function cmyk2hsl(args) {
1119
+  return rgb2hsl(cmyk2rgb(args));
1120
+}
1121
+
1122
+function cmyk2hsv(args) {
1123
+  return rgb2hsv(cmyk2rgb(args));
1124
+}
1125
+
1126
+function cmyk2hwb(args) {
1127
+  return rgb2hwb(cmyk2rgb(args));
1128
+}
1129
+
1130
+function cmyk2keyword(args) {
1131
+  return rgb2keyword(cmyk2rgb(args));
1132
+}
1133
+
1134
+
1135
+function xyz2rgb(xyz) {
1136
+  var x = xyz[0] / 100,
1137
+      y = xyz[1] / 100,
1138
+      z = xyz[2] / 100,
1139
+      r, g, b;
1140
+
1141
+  r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);
1142
+  g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);
1143
+  b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570);
1144
+
1145
+  // assume sRGB
1146
+  r = r > 0.0031308 ? ((1.055 * Math.pow(r, 1.0 / 2.4)) - 0.055)
1147
+    : r = (r * 12.92);
1148
+
1149
+  g = g > 0.0031308 ? ((1.055 * Math.pow(g, 1.0 / 2.4)) - 0.055)
1150
+    : g = (g * 12.92);
1151
+
1152
+  b = b > 0.0031308 ? ((1.055 * Math.pow(b, 1.0 / 2.4)) - 0.055)
1153
+    : b = (b * 12.92);
1154
+
1155
+  r = Math.min(Math.max(0, r), 1);
1156
+  g = Math.min(Math.max(0, g), 1);
1157
+  b = Math.min(Math.max(0, b), 1);
1158
+
1159
+  return [r * 255, g * 255, b * 255];
1160
+}
1161
+
1162
+function xyz2lab(xyz) {
1163
+  var x = xyz[0],
1164
+      y = xyz[1],
1165
+      z = xyz[2],
1166
+      l, a, b;
1167
+
1168
+  x /= 95.047;
1169
+  y /= 100;
1170
+  z /= 108.883;
1171
+
1172
+  x = x > 0.008856 ? Math.pow(x, 1/3) : (7.787 * x) + (16 / 116);
1173
+  y = y > 0.008856 ? Math.pow(y, 1/3) : (7.787 * y) + (16 / 116);
1174
+  z = z > 0.008856 ? Math.pow(z, 1/3) : (7.787 * z) + (16 / 116);
1175
+
1176
+  l = (116 * y) - 16;
1177
+  a = 500 * (x - y);
1178
+  b = 200 * (y - z);
1179
+
1180
+  return [l, a, b];
1181
+}
1182
+
1183
+function xyz2lch(args) {
1184
+  return lab2lch(xyz2lab(args));
1185
+}
1186
+
1187
+function lab2xyz(lab) {
1188
+  var l = lab[0],
1189
+      a = lab[1],
1190
+      b = lab[2],
1191
+      x, y, z, y2;
1192
+
1193
+  if (l <= 8) {
1194
+    y = (l * 100) / 903.3;
1195
+    y2 = (7.787 * (y / 100)) + (16 / 116);
1196
+  } else {
1197
+    y = 100 * Math.pow((l + 16) / 116, 3);
1198
+    y2 = Math.pow(y / 100, 1/3);
1199
+  }
1200
+
1201
+  x = x / 95.047 <= 0.008856 ? x = (95.047 * ((a / 500) + y2 - (16 / 116))) / 7.787 : 95.047 * Math.pow((a / 500) + y2, 3);
1202
+
1203
+  z = z / 108.883 <= 0.008859 ? z = (108.883 * (y2 - (b / 200) - (16 / 116))) / 7.787 : 108.883 * Math.pow(y2 - (b / 200), 3);
1204
+
1205
+  return [x, y, z];
1206
+}
1207
+
1208
+function lab2lch(lab) {
1209
+  var l = lab[0],
1210
+      a = lab[1],
1211
+      b = lab[2],
1212
+      hr, h, c;
1213
+
1214
+  hr = Math.atan2(b, a);
1215
+  h = hr * 360 / 2 / Math.PI;
1216
+  if (h < 0) {
1217
+    h += 360;
1218
+  }
1219
+  c = Math.sqrt(a * a + b * b);
1220
+  return [l, c, h];
1221
+}
1222
+
1223
+function lab2rgb(args) {
1224
+  return xyz2rgb(lab2xyz(args));
1225
+}
1226
+
1227
+function lch2lab(lch) {
1228
+  var l = lch[0],
1229
+      c = lch[1],
1230
+      h = lch[2],
1231
+      a, b, hr;
1232
+
1233
+  hr = h / 360 * 2 * Math.PI;
1234
+  a = c * Math.cos(hr);
1235
+  b = c * Math.sin(hr);
1236
+  return [l, a, b];
1237
+}
1238
+
1239
+function lch2xyz(args) {
1240
+  return lab2xyz(lch2lab(args));
1241
+}
1242
+
1243
+function lch2rgb(args) {
1244
+  return lab2rgb(lch2lab(args));
1245
+}
1246
+
1247
+function keyword2rgb(keyword) {
1248
+  return cssKeywords[keyword];
1249
+}
1250
+
1251
+function keyword2hsl(args) {
1252
+  return rgb2hsl(keyword2rgb(args));
1253
+}
1254
+
1255
+function keyword2hsv(args) {
1256
+  return rgb2hsv(keyword2rgb(args));
1257
+}
1258
+
1259
+function keyword2hwb(args) {
1260
+  return rgb2hwb(keyword2rgb(args));
1261
+}
1262
+
1263
+function keyword2cmyk(args) {
1264
+  return rgb2cmyk(keyword2rgb(args));
1265
+}
1266
+
1267
+function keyword2lab(args) {
1268
+  return rgb2lab(keyword2rgb(args));
1269
+}
1270
+
1271
+function keyword2xyz(args) {
1272
+  return rgb2xyz(keyword2rgb(args));
1273
+}
1274
+
1275
+var cssKeywords = {
1276
+  aliceblue:  [240,248,255],
1277
+  antiquewhite: [250,235,215],
1278
+  aqua: [0,255,255],
1279
+  aquamarine: [127,255,212],
1280
+  azure:  [240,255,255],
1281
+  beige:  [245,245,220],
1282
+  bisque: [255,228,196],
1283
+  black:  [0,0,0],
1284
+  blanchedalmond: [255,235,205],
1285
+  blue: [0,0,255],
1286
+  blueviolet: [138,43,226],
1287
+  brown:  [165,42,42],
1288
+  burlywood:  [222,184,135],
1289
+  cadetblue:  [95,158,160],
1290
+  chartreuse: [127,255,0],
1291
+  chocolate:  [210,105,30],
1292
+  coral:  [255,127,80],
1293
+  cornflowerblue: [100,149,237],
1294
+  cornsilk: [255,248,220],
1295
+  crimson:  [220,20,60],
1296
+  cyan: [0,255,255],
1297
+  darkblue: [0,0,139],
1298
+  darkcyan: [0,139,139],
1299
+  darkgoldenrod:  [184,134,11],
1300
+  darkgray: [169,169,169],
1301
+  darkgreen:  [0,100,0],
1302
+  darkgrey: [169,169,169],
1303
+  darkkhaki:  [189,183,107],
1304
+  darkmagenta:  [139,0,139],
1305
+  darkolivegreen: [85,107,47],
1306
+  darkorange: [255,140,0],
1307
+  darkorchid: [153,50,204],
1308
+  darkred:  [139,0,0],
1309
+  darksalmon: [233,150,122],
1310
+  darkseagreen: [143,188,143],
1311
+  darkslateblue:  [72,61,139],
1312
+  darkslategray:  [47,79,79],
1313
+  darkslategrey:  [47,79,79],
1314
+  darkturquoise:  [0,206,209],
1315
+  darkviolet: [148,0,211],
1316
+  deeppink: [255,20,147],
1317
+  deepskyblue:  [0,191,255],
1318
+  dimgray:  [105,105,105],
1319
+  dimgrey:  [105,105,105],
1320
+  dodgerblue: [30,144,255],
1321
+  firebrick:  [178,34,34],
1322
+  floralwhite:  [255,250,240],
1323
+  forestgreen:  [34,139,34],
1324
+  fuchsia:  [255,0,255],
1325
+  gainsboro:  [220,220,220],
1326
+  ghostwhite: [248,248,255],
1327
+  gold: [255,215,0],
1328
+  goldenrod:  [218,165,32],
1329
+  gray: [128,128,128],
1330
+  green:  [0,128,0],
1331
+  greenyellow:  [173,255,47],
1332
+  grey: [128,128,128],
1333
+  honeydew: [240,255,240],
1334
+  hotpink:  [255,105,180],
1335
+  indianred:  [205,92,92],
1336
+  indigo: [75,0,130],
1337
+  ivory:  [255,255,240],
1338
+  khaki:  [240,230,140],
1339
+  lavender: [230,230,250],
1340
+  lavenderblush:  [255,240,245],
1341
+  lawngreen:  [124,252,0],
1342
+  lemonchiffon: [255,250,205],
1343
+  lightblue:  [173,216,230],
1344
+  lightcoral: [240,128,128],
1345
+  lightcyan:  [224,255,255],
1346
+  lightgoldenrodyellow: [250,250,210],
1347
+  lightgray:  [211,211,211],
1348
+  lightgreen: [144,238,144],
1349
+  lightgrey:  [211,211,211],
1350
+  lightpink:  [255,182,193],
1351
+  lightsalmon:  [255,160,122],
1352
+  lightseagreen:  [32,178,170],
1353
+  lightskyblue: [135,206,250],
1354
+  lightslategray: [119,136,153],
1355
+  lightslategrey: [119,136,153],
1356
+  lightsteelblue: [176,196,222],
1357
+  lightyellow:  [255,255,224],
1358
+  lime: [0,255,0],
1359
+  limegreen:  [50,205,50],
1360
+  linen:  [250,240,230],
1361
+  magenta:  [255,0,255],
1362
+  maroon: [128,0,0],
1363
+  mediumaquamarine: [102,205,170],
1364
+  mediumblue: [0,0,205],
1365
+  mediumorchid: [186,85,211],
1366
+  mediumpurple: [147,112,219],
1367
+  mediumseagreen: [60,179,113],
1368
+  mediumslateblue:  [123,104,238],
1369
+  mediumspringgreen:  [0,250,154],
1370
+  mediumturquoise:  [72,209,204],
1371
+  mediumvioletred:  [199,21,133],
1372
+  midnightblue: [25,25,112],
1373
+  mintcream:  [245,255,250],
1374
+  mistyrose:  [255,228,225],
1375
+  moccasin: [255,228,181],
1376
+  navajowhite:  [255,222,173],
1377
+  navy: [0,0,128],
1378
+  oldlace:  [253,245,230],
1379
+  olive:  [128,128,0],
1380
+  olivedrab:  [107,142,35],
1381
+  orange: [255,165,0],
1382
+  orangered:  [255,69,0],
1383
+  orchid: [218,112,214],
1384
+  palegoldenrod:  [238,232,170],
1385
+  palegreen:  [152,251,152],
1386
+  paleturquoise:  [175,238,238],
1387
+  palevioletred:  [219,112,147],
1388
+  papayawhip: [255,239,213],
1389
+  peachpuff:  [255,218,185],
1390
+  peru: [205,133,63],
1391
+  pink: [255,192,203],
1392
+  plum: [221,160,221],
1393
+  powderblue: [176,224,230],
1394
+  purple: [128,0,128],
1395
+  rebeccapurple: [102, 51, 153],
1396
+  red:  [255,0,0],
1397
+  rosybrown:  [188,143,143],
1398
+  royalblue:  [65,105,225],
1399
+  saddlebrown:  [139,69,19],
1400
+  salmon: [250,128,114],
1401
+  sandybrown: [244,164,96],
1402
+  seagreen: [46,139,87],
1403
+  seashell: [255,245,238],
1404
+  sienna: [160,82,45],
1405
+  silver: [192,192,192],
1406
+  skyblue:  [135,206,235],
1407
+  slateblue:  [106,90,205],
1408
+  slategray:  [112,128,144],
1409
+  slategrey:  [112,128,144],
1410
+  snow: [255,250,250],
1411
+  springgreen:  [0,255,127],
1412
+  steelblue:  [70,130,180],
1413
+  tan:  [210,180,140],
1414
+  teal: [0,128,128],
1415
+  thistle:  [216,191,216],
1416
+  tomato: [255,99,71],
1417
+  turquoise:  [64,224,208],
1418
+  violet: [238,130,238],
1419
+  wheat:  [245,222,179],
1420
+  white:  [255,255,255],
1421
+  whitesmoke: [245,245,245],
1422
+  yellow: [255,255,0],
1423
+  yellowgreen:  [154,205,50]
1424
+};
1425
+
1426
+var reverseKeywords = {};
1427
+for (var key in cssKeywords) {
1428
+  reverseKeywords[JSON.stringify(cssKeywords[key])] = key;
1429
+}
1430
+
1431
+},{}],4:[function(require,module,exports){
1432
+var conversions = require(3);
1433
+
1434
+var convert = function() {
1435
+   return new Converter();
1436
+}
1437
+
1438
+for (var func in conversions) {
1439
+  // export Raw versions
1440
+  convert[func + "Raw"] =  (function(func) {
1441
+    // accept array or plain args
1442
+    return function(arg) {
1443
+      if (typeof arg == "number")
1444
+        arg = Array.prototype.slice.call(arguments);
1445
+      return conversions[func](arg);
1446
+    }
1447
+  })(func);
1448
+
1449
+  var pair = /(\w+)2(\w+)/.exec(func),
1450
+      from = pair[1],
1451
+      to = pair[2];
1452
+
1453
+  // export rgb2hsl and ["rgb"]["hsl"]
1454
+  convert[from] = convert[from] || {};
1455
+
1456
+  convert[from][to] = convert[func] = (function(func) { 
1457
+    return function(arg) {
1458
+      if (typeof arg == "number")
1459
+        arg = Array.prototype.slice.call(arguments);
1460
+      
1461
+      var val = conversions[func](arg);
1462
+      if (typeof val == "string" || val === undefined)
1463
+        return val; // keyword
1464
+
1465
+      for (var i = 0; i < val.length; i++)
1466
+        val[i] = Math.round(val[i]);
1467
+      return val;
1468
+    }
1469
+  })(func);
1470
+}
1471
+
1472
+
1473
+/* Converter does lazy conversion and caching */
1474
+var Converter = function() {
1475
+   this.convs = {};
1476
+};
1477
+
1478
+/* Either get the values for a space or
1479
+  set the values for a space, depending on args */
1480
+Converter.prototype.routeSpace = function(space, args) {
1481
+   var values = args[0];
1482
+   if (values === undefined) {
1483
+      // color.rgb()
1484
+      return this.getValues(space);
1485
+   }
1486
+   // color.rgb(10, 10, 10)
1487
+   if (typeof values == "number") {
1488
+      values = Array.prototype.slice.call(args);        
1489
+   }
1490
+
1491
+   return this.setValues(space, values);
1492
+};
1493
+  
1494
+/* Set the values for a space, invalidating cache */
1495
+Converter.prototype.setValues = function(space, values) {
1496
+   this.space = space;
1497
+   this.convs = {};
1498
+   this.convs[space] = values;
1499
+   return this;
1500
+};
1501
+
1502
+/* Get the values for a space. If there's already
1503
+  a conversion for the space, fetch it, otherwise
1504
+  compute it */
1505
+Converter.prototype.getValues = function(space) {
1506
+   var vals = this.convs[space];
1507
+   if (!vals) {
1508
+      var fspace = this.space,
1509
+          from = this.convs[fspace];
1510
+      vals = convert[fspace][space](from);
1511
+
1512
+      this.convs[space] = vals;
1513
+   }
1514
+  return vals;
1515
+};
1516
+
1517
+["rgb", "hsl", "hsv", "cmyk", "keyword"].forEach(function(space) {
1518
+   Converter.prototype[space] = function(vals) {
1519
+      return this.routeSpace(space, arguments);
1520
+   }
1521
+});
1522
+
1523
+module.exports = convert;
1524
+},{"3":3}],5:[function(require,module,exports){
1525
+'use strict'
1526
+
1527
+module.exports = {
1528
+	"aliceblue": [240, 248, 255],
1529
+	"antiquewhite": [250, 235, 215],
1530
+	"aqua": [0, 255, 255],
1531
+	"aquamarine": [127, 255, 212],
1532
+	"azure": [240, 255, 255],
1533
+	"beige": [245, 245, 220],
1534
+	"bisque": [255, 228, 196],
1535
+	"black": [0, 0, 0],
1536
+	"blanchedalmond": [255, 235, 205],
1537
+	"blue": [0, 0, 255],
1538
+	"blueviolet": [138, 43, 226],
1539
+	"brown": [165, 42, 42],
1540
+	"burlywood": [222, 184, 135],
1541
+	"cadetblue": [95, 158, 160],
1542
+	"chartreuse": [127, 255, 0],
1543
+	"chocolate": [210, 105, 30],
1544
+	"coral": [255, 127, 80],
1545
+	"cornflowerblue": [100, 149, 237],
1546
+	"cornsilk": [255, 248, 220],
1547
+	"crimson": [220, 20, 60],
1548
+	"cyan": [0, 255, 255],
1549
+	"darkblue": [0, 0, 139],
1550
+	"darkcyan": [0, 139, 139],
1551
+	"darkgoldenrod": [184, 134, 11],
1552
+	"darkgray": [169, 169, 169],
1553
+	"darkgreen": [0, 100, 0],
1554
+	"darkgrey": [169, 169, 169],
1555
+	"darkkhaki": [189, 183, 107],
1556
+	"darkmagenta": [139, 0, 139],
1557
+	"darkolivegreen": [85, 107, 47],
1558
+	"darkorange": [255, 140, 0],
1559
+	"darkorchid": [153, 50, 204],
1560
+	"darkred": [139, 0, 0],
1561
+	"darksalmon": [233, 150, 122],
1562
+	"darkseagreen": [143, 188, 143],
1563
+	"darkslateblue": [72, 61, 139],
1564
+	"darkslategray": [47, 79, 79],
1565
+	"darkslategrey": [47, 79, 79],
1566
+	"darkturquoise": [0, 206, 209],
1567
+	"darkviolet": [148, 0, 211],
1568
+	"deeppink": [255, 20, 147],
1569
+	"deepskyblue": [0, 191, 255],
1570
+	"dimgray": [105, 105, 105],
1571
+	"dimgrey": [105, 105, 105],
1572
+	"dodgerblue": [30, 144, 255],
1573
+	"firebrick": [178, 34, 34],
1574
+	"floralwhite": [255, 250, 240],
1575
+	"forestgreen": [34, 139, 34],
1576
+	"fuchsia": [255, 0, 255],
1577
+	"gainsboro": [220, 220, 220],
1578
+	"ghostwhite": [248, 248, 255],
1579
+	"gold": [255, 215, 0],
1580
+	"goldenrod": [218, 165, 32],
1581
+	"gray": [128, 128, 128],
1582
+	"green": [0, 128, 0],
1583
+	"greenyellow": [173, 255, 47],
1584
+	"grey": [128, 128, 128],
1585
+	"honeydew": [240, 255, 240],
1586
+	"hotpink": [255, 105, 180],
1587
+	"indianred": [205, 92, 92],
1588
+	"indigo": [75, 0, 130],
1589
+	"ivory": [255, 255, 240],
1590
+	"khaki": [240, 230, 140],
1591
+	"lavender": [230, 230, 250],
1592
+	"lavenderblush": [255, 240, 245],
1593
+	"lawngreen": [124, 252, 0],
1594
+	"lemonchiffon": [255, 250, 205],
1595
+	"lightblue": [173, 216, 230],
1596
+	"lightcoral": [240, 128, 128],
1597
+	"lightcyan": [224, 255, 255],
1598
+	"lightgoldenrodyellow": [250, 250, 210],
1599
+	"lightgray": [211, 211, 211],
1600
+	"lightgreen": [144, 238, 144],
1601
+	"lightgrey": [211, 211, 211],
1602
+	"lightpink": [255, 182, 193],
1603
+	"lightsalmon": [255, 160, 122],
1604
+	"lightseagreen": [32, 178, 170],
1605
+	"lightskyblue": [135, 206, 250],
1606
+	"lightslategray": [119, 136, 153],
1607
+	"lightslategrey": [119, 136, 153],
1608
+	"lightsteelblue": [176, 196, 222],
1609
+	"lightyellow": [255, 255, 224],
1610
+	"lime": [0, 255, 0],
1611
+	"limegreen": [50, 205, 50],
1612
+	"linen": [250, 240, 230],
1613
+	"magenta": [255, 0, 255],
1614
+	"maroon": [128, 0, 0],
1615
+	"mediumaquamarine": [102, 205, 170],
1616
+	"mediumblue": [0, 0, 205],
1617
+	"mediumorchid": [186, 85, 211],
1618
+	"mediumpurple": [147, 112, 219],
1619
+	"mediumseagreen": [60, 179, 113],
1620
+	"mediumslateblue": [123, 104, 238],
1621
+	"mediumspringgreen": [0, 250, 154],
1622
+	"mediumturquoise": [72, 209, 204],
1623
+	"mediumvioletred": [199, 21, 133],
1624
+	"midnightblue": [25, 25, 112],
1625
+	"mintcream": [245, 255, 250],
1626
+	"mistyrose": [255, 228, 225],
1627
+	"moccasin": [255, 228, 181],
1628
+	"navajowhite": [255, 222, 173],
1629
+	"navy": [0, 0, 128],
1630
+	"oldlace": [253, 245, 230],
1631
+	"olive": [128, 128, 0],
1632
+	"olivedrab": [107, 142, 35],
1633
+	"orange": [255, 165, 0],
1634
+	"orangered": [255, 69, 0],
1635
+	"orchid": [218, 112, 214],
1636
+	"palegoldenrod": [238, 232, 170],
1637
+	"palegreen": [152, 251, 152],
1638
+	"paleturquoise": [175, 238, 238],
1639
+	"palevioletred": [219, 112, 147],
1640
+	"papayawhip": [255, 239, 213],
1641
+	"peachpuff": [255, 218, 185],
1642
+	"peru": [205, 133, 63],
1643
+	"pink": [255, 192, 203],
1644
+	"plum": [221, 160, 221],
1645
+	"powderblue": [176, 224, 230],
1646
+	"purple": [128, 0, 128],
1647
+	"rebeccapurple": [102, 51, 153],
1648
+	"red": [255, 0, 0],
1649
+	"rosybrown": [188, 143, 143],
1650
+	"royalblue": [65, 105, 225],
1651
+	"saddlebrown": [139, 69, 19],
1652
+	"salmon": [250, 128, 114],
1653
+	"sandybrown": [244, 164, 96],
1654
+	"seagreen": [46, 139, 87],
1655
+	"seashell": [255, 245, 238],
1656
+	"sienna": [160, 82, 45],
1657
+	"silver": [192, 192, 192],
1658
+	"skyblue": [135, 206, 235],
1659
+	"slateblue": [106, 90, 205],
1660
+	"slategray": [112, 128, 144],
1661
+	"slategrey": [112, 128, 144],
1662
+	"snow": [255, 250, 250],
1663
+	"springgreen": [0, 255, 127],
1664
+	"steelblue": [70, 130, 180],
1665
+	"tan": [210, 180, 140],
1666
+	"teal": [0, 128, 128],
1667
+	"thistle": [216, 191, 216],
1668
+	"tomato": [255, 99, 71],
1669
+	"turquoise": [64, 224, 208],
1670
+	"violet": [238, 130, 238],
1671
+	"wheat": [245, 222, 179],
1672
+	"white": [255, 255, 255],
1673
+	"whitesmoke": [245, 245, 245],
1674
+	"yellow": [255, 255, 0],
1675
+	"yellowgreen": [154, 205, 50]
1676
+};
1677
+
1678
+},{}],6:[function(require,module,exports){
1679
+//! moment.js
1680
+//! version : 2.20.1
1681
+//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
1682
+//! license : MIT
1683
+//! momentjs.com
1684
+
1685
+;(function (global, factory) {
1686
+    typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
1687
+    typeof define === 'function' && define.amd ? define(factory) :
1688
+    global.moment = factory()
1689
+}(this, (function () { 'use strict';
1690
+
1691
+var hookCallback;
1692
+
1693
+function hooks () {
1694
+    return hookCallback.apply(null, arguments);
1695
+}
1696
+
1697
+// This is done to register the method called with moment()
1698
+// without creating circular dependencies.
1699
+function setHookCallback (callback) {
1700
+    hookCallback = callback;
1701
+}
1702
+
1703
+function isArray(input) {
1704
+    return input instanceof Array || Object.prototype.toString.call(input) === '[object Array]';
1705
+}
1706
+
1707
+function isObject(input) {
1708
+    // IE8 will treat undefined and null as object if it wasn't for
1709
+    // input != null
1710
+    return input != null && Object.prototype.toString.call(input) === '[object Object]';
1711
+}
1712
+
1713
+function isObjectEmpty(obj) {
1714
+    if (Object.getOwnPropertyNames) {
1715
+        return (Object.getOwnPropertyNames(obj).length === 0);
1716
+    } else {
1717
+        var k;
1718
+        for (k in obj) {
1719
+            if (obj.hasOwnProperty(k)) {
1720
+                return false;
1721
+            }
1722
+        }
1723
+        return true;
1724
+    }
1725
+}
1726
+
1727
+function isUndefined(input) {
1728
+    return input === void 0;
1729
+}
1730
+
1731
+function isNumber(input) {
1732
+    return typeof input === 'number' || Object.prototype.toString.call(input) === '[object Number]';
1733
+}
1734
+
1735
+function isDate(input) {
1736
+    return input instanceof Date || Object.prototype.toString.call(input) === '[object Date]';
1737
+}
1738
+
1739
+function map(arr, fn) {
1740
+    var res = [], i;
1741
+    for (i = 0; i < arr.length; ++i) {
1742
+        res.push(fn(arr[i], i));
1743
+    }
1744
+    return res;
1745
+}
1746
+
1747
+function hasOwnProp(a, b) {
1748
+    return Object.prototype.hasOwnProperty.call(a, b);
1749
+}
1750
+
1751
+function extend(a, b) {
1752
+    for (var i in b) {
1753
+        if (hasOwnProp(b, i)) {
1754
+            a[i] = b[i];
1755
+        }
1756
+    }
1757
+
1758
+    if (hasOwnProp(b, 'toString')) {
1759
+        a.toString = b.toString;
1760
+    }
1761
+
1762
+    if (hasOwnProp(b, 'valueOf')) {
1763
+        a.valueOf = b.valueOf;
1764
+    }
1765
+
1766
+    return a;
1767
+}
1768
+
1769
+function createUTC (input, format, locale, strict) {
1770
+    return createLocalOrUTC(input, format, locale, strict, true).utc();
1771
+}
1772
+
1773
+function defaultParsingFlags() {
1774
+    // We need to deep clone this object.
1775
+    return {
1776
+        empty           : false,
1777
+        unusedTokens    : [],
1778
+        unusedInput     : [],
1779
+        overflow        : -2,
1780
+        charsLeftOver   : 0,
1781
+        nullInput       : false,
1782
+        invalidMonth    : null,
1783
+        invalidFormat   : false,
1784
+        userInvalidated : false,
1785
+        iso             : false,
1786
+        parsedDateParts : [],
1787
+        meridiem        : null,
1788
+        rfc2822         : false,
1789
+        weekdayMismatch : false
1790
+    };
1791
+}
1792
+
1793
+function getParsingFlags(m) {
1794
+    if (m._pf == null) {
1795
+        m._pf = defaultParsingFlags();
1796
+    }
1797
+    return m._pf;
1798
+}
1799
+
1800
+var some;
1801
+if (Array.prototype.some) {
1802
+    some = Array.prototype.some;
1803
+} else {
1804
+    some = function (fun) {
1805
+        var t = Object(this);
1806
+        var len = t.length >>> 0;
1807
+
1808
+        for (var i = 0; i < len; i++) {
1809
+            if (i in t && fun.call(this, t[i], i, t)) {
1810
+                return true;
1811
+            }
1812
+        }
1813
+
1814
+        return false;
1815
+    };
1816
+}
1817
+
1818
+function isValid(m) {
1819
+    if (m._isValid == null) {
1820
+        var flags = getParsingFlags(m);
1821
+        var parsedParts = some.call(flags.parsedDateParts, function (i) {
1822
+            return i != null;
1823
+        });
1824
+        var isNowValid = !isNaN(m._d.getTime()) &&
1825
+            flags.overflow < 0 &&
1826
+            !flags.empty &&
1827
+            !flags.invalidMonth &&
1828
+            !flags.invalidWeekday &&
1829
+            !flags.weekdayMismatch &&
1830
+            !flags.nullInput &&
1831
+            !flags.invalidFormat &&
1832
+            !flags.userInvalidated &&
1833
+            (!flags.meridiem || (flags.meridiem && parsedParts));
1834
+
1835
+        if (m._strict) {
1836
+            isNowValid = isNowValid &&
1837
+                flags.charsLeftOver === 0 &&
1838
+                flags.unusedTokens.length === 0 &&
1839
+                flags.bigHour === undefined;
1840
+        }
1841
+
1842
+        if (Object.isFrozen == null || !Object.isFrozen(m)) {
1843
+            m._isValid = isNowValid;
1844
+        }
1845
+        else {
1846
+            return isNowValid;
1847
+        }
1848
+    }
1849
+    return m._isValid;
1850
+}
1851
+
1852
+function createInvalid (flags) {
1853
+    var m = createUTC(NaN);
1854
+    if (flags != null) {
1855
+        extend(getParsingFlags(m), flags);
1856
+    }
1857
+    else {
1858
+        getParsingFlags(m).userInvalidated = true;
1859
+    }
1860
+
1861
+    return m;
1862
+}
1863
+
1864
+// Plugins that add properties should also add the key here (null value),
1865
+// so we can properly clone ourselves.
1866
+var momentProperties = hooks.momentProperties = [];
1867
+
1868
+function copyConfig(to, from) {
1869
+    var i, prop, val;
1870
+
1871
+    if (!isUndefined(from._isAMomentObject)) {
1872
+        to._isAMomentObject = from._isAMomentObject;
1873
+    }
1874
+    if (!isUndefined(from._i)) {
1875
+        to._i = from._i;
1876
+    }
1877
+    if (!isUndefined(from._f)) {
1878
+        to._f = from._f;
1879
+    }
1880
+    if (!isUndefined(from._l)) {
1881
+        to._l = from._l;
1882
+    }
1883
+    if (!isUndefined(from._strict)) {
1884
+        to._strict = from._strict;
1885
+    }
1886
+    if (!isUndefined(from._tzm)) {
1887
+        to._tzm = from._tzm;
1888
+    }
1889
+    if (!isUndefined(from._isUTC)) {
1890
+        to._isUTC = from._isUTC;
1891
+    }
1892
+    if (!isUndefined(from._offset)) {
1893
+        to._offset = from._offset;
1894
+    }
1895
+    if (!isUndefined(from._pf)) {
1896
+        to._pf = getParsingFlags(from);
1897
+    }
1898
+    if (!isUndefined(from._locale)) {
1899
+        to._locale = from._locale;
1900
+    }
1901
+
1902
+    if (momentProperties.length > 0) {
1903
+        for (i = 0; i < momentProperties.length; i++) {
1904
+            prop = momentProperties[i];
1905
+            val = from[prop];
1906
+            if (!isUndefined(val)) {
1907
+                to[prop] = val;
1908
+            }
1909
+        }
1910
+    }
1911
+
1912
+    return to;
1913
+}
1914
+
1915
+var updateInProgress = false;
1916
+
1917
+// Moment prototype object
1918
+function Moment(config) {
1919
+    copyConfig(this, config);
1920
+    this._d = new Date(config._d != null ? config._d.getTime() : NaN);
1921
+    if (!this.isValid()) {
1922
+        this._d = new Date(NaN);
1923
+    }
1924
+    // Prevent infinite loop in case updateOffset creates new moment
1925
+    // objects.
1926
+    if (updateInProgress === false) {
1927
+        updateInProgress = true;
1928
+        hooks.updateOffset(this);
1929
+        updateInProgress = false;
1930
+    }
1931
+}
1932
+
1933
+function isMoment (obj) {
1934
+    return obj instanceof Moment || (obj != null && obj._isAMomentObject != null);
1935
+}
1936
+
1937
+function absFloor (number) {
1938
+    if (number < 0) {
1939
+        // -0 -> 0
1940
+        return Math.ceil(number) || 0;
1941
+    } else {
1942
+        return Math.floor(number);
1943
+    }
1944
+}
1945
+
1946
+function toInt(argumentForCoercion) {
1947
+    var coercedNumber = +argumentForCoercion,
1948
+        value = 0;
1949
+
1950
+    if (coercedNumber !== 0 && isFinite(coercedNumber)) {
1951
+        value = absFloor(coercedNumber);
1952
+    }
1953
+
1954
+    return value;
1955
+}
1956
+
1957
+// compare two arrays, return the number of differences
1958
+function compareArrays(array1, array2, dontConvert) {
1959
+    var len = Math.min(array1.length, array2.length),
1960
+        lengthDiff = Math.abs(array1.length - array2.length),
1961
+        diffs = 0,
1962
+        i;
1963
+    for (i = 0; i < len; i++) {
1964
+        if ((dontConvert && array1[i] !== array2[i]) ||
1965
+            (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {
1966
+            diffs++;
1967
+        }
1968
+    }
1969
+    return diffs + lengthDiff;
1970
+}
1971
+
1972
+function warn(msg) {
1973
+    if (hooks.suppressDeprecationWarnings === false &&
1974
+            (typeof console !==  'undefined') && console.warn) {
1975
+        console.warn('Deprecation warning: ' + msg);
1976
+    }
1977
+}
1978
+
1979
+function deprecate(msg, fn) {
1980
+    var firstTime = true;
1981
+
1982
+    return extend(function () {
1983
+        if (hooks.deprecationHandler != null) {
1984
+            hooks.deprecationHandler(null, msg);
1985
+        }
1986
+        if (firstTime) {
1987
+            var args = [];
1988
+            var arg;
1989
+            for (var i = 0; i < arguments.length; i++) {
1990
+                arg = '';
1991
+                if (typeof arguments[i] === 'object') {
1992
+                    arg += '\n[' + i + '] ';
1993
+                    for (var key in arguments[0]) {
1994
+                        arg += key + ': ' + arguments[0][key] + ', ';
1995
+                    }
1996
+                    arg = arg.slice(0, -2); // Remove trailing comma and space
1997
+                } else {
1998
+                    arg = arguments[i];
1999
+                }
2000
+                args.push(arg);
2001
+            }
2002
+            warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + (new Error()).stack);
2003
+            firstTime = false;
2004
+        }
2005
+        return fn.apply(this, arguments);
2006
+    }, fn);
2007
+}
2008
+
2009
+var deprecations = {};
2010
+
2011
+function deprecateSimple(name, msg) {
2012
+    if (hooks.deprecationHandler != null) {
2013
+        hooks.deprecationHandler(name, msg);
2014
+    }
2015
+    if (!deprecations[name]) {
2016
+        warn(msg);
2017
+        deprecations[name] = true;
2018
+    }
2019
+}
2020
+
2021
+hooks.suppressDeprecationWarnings = false;
2022
+hooks.deprecationHandler = null;
2023
+
2024
+function isFunction(input) {
2025
+    return input instanceof Function || Object.prototype.toString.call(input) === '[object Function]';
2026
+}
2027
+
2028
+function set (config) {
2029
+    var prop, i;
2030
+    for (i in config) {
2031
+        prop = config[i];
2032
+        if (isFunction(prop)) {
2033
+            this[i] = prop;
2034
+        } else {
2035
+            this['_' + i] = prop;
2036
+        }
2037
+    }
2038
+    this._config = config;
2039
+    // Lenient ordinal parsing accepts just a number in addition to
2040
+    // number + (possibly) stuff coming from _dayOfMonthOrdinalParse.
2041
+    // TODO: Remove "ordinalParse" fallback in next major release.
2042
+    this._dayOfMonthOrdinalParseLenient = new RegExp(
2043
+        (this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) +
2044
+            '|' + (/\d{1,2}/).source);
2045
+}
2046
+
2047
+function mergeConfigs(parentConfig, childConfig) {
2048
+    var res = extend({}, parentConfig), prop;
2049
+    for (prop in childConfig) {
2050
+        if (hasOwnProp(childConfig, prop)) {
2051
+            if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) {
2052
+                res[prop] = {};
2053
+                extend(res[prop], parentConfig[prop]);
2054
+                extend(res[prop], childConfig[prop]);
2055
+            } else if (childConfig[prop] != null) {
2056
+                res[prop] = childConfig[prop];
2057
+            } else {
2058
+                delete res[prop];
2059
+            }
2060
+        }
2061
+    }
2062
+    for (prop in parentConfig) {
2063
+        if (hasOwnProp(parentConfig, prop) &&
2064
+                !hasOwnProp(childConfig, prop) &&
2065
+                isObject(parentConfig[prop])) {
2066
+            // make sure changes to properties don't modify parent config
2067
+            res[prop] = extend({}, res[prop]);
2068
+        }
2069
+    }
2070
+    return res;
2071
+}
2072
+
2073
+function Locale(config) {
2074
+    if (config != null) {
2075
+        this.set(config);
2076
+    }
2077
+}
2078
+
2079
+var keys;
2080
+
2081
+if (Object.keys) {
2082
+    keys = Object.keys;
2083
+} else {
2084
+    keys = function (obj) {
2085
+        var i, res = [];
2086
+        for (i in obj) {
2087
+            if (hasOwnProp(obj, i)) {
2088
+                res.push(i);
2089
+            }
2090
+        }
2091
+        return res;
2092
+    };
2093
+}
2094
+
2095
+var defaultCalendar = {
2096
+    sameDay : '[Today at] LT',
2097
+    nextDay : '[Tomorrow at] LT',
2098
+    nextWeek : 'dddd [at] LT',
2099
+    lastDay : '[Yesterday at] LT',
2100
+    lastWeek : '[Last] dddd [at] LT',
2101
+    sameElse : 'L'
2102
+};
2103
+
2104
+function calendar (key, mom, now) {
2105
+    var output = this._calendar[key] || this._calendar['sameElse'];
2106
+    return isFunction(output) ? output.call(mom, now) : output;
2107
+}
2108
+
2109
+var defaultLongDateFormat = {
2110
+    LTS  : 'h:mm:ss A',
2111
+    LT   : 'h:mm A',
2112
+    L    : 'MM/DD/YYYY',
2113
+    LL   : 'MMMM D, YYYY',
2114
+    LLL  : 'MMMM D, YYYY h:mm A',
2115
+    LLLL : 'dddd, MMMM D, YYYY h:mm A'
2116
+};
2117
+
2118
+function longDateFormat (key) {
2119
+    var format = this._longDateFormat[key],
2120
+        formatUpper = this._longDateFormat[key.toUpperCase()];
2121
+
2122
+    if (format || !formatUpper) {
2123
+        return format;
2124
+    }
2125
+
2126
+    this._longDateFormat[key] = formatUpper.replace(/MMMM|MM|DD|dddd/g, function (val) {
2127
+        return val.slice(1);
2128
+    });
2129
+
2130
+    return this._longDateFormat[key];
2131
+}
2132
+
2133
+var defaultInvalidDate = 'Invalid date';
2134
+
2135
+function invalidDate () {
2136
+    return this._invalidDate;
2137
+}
2138
+
2139
+var defaultOrdinal = '%d';
2140
+var defaultDayOfMonthOrdinalParse = /\d{1,2}/;
2141
+
2142
+function ordinal (number) {
2143
+    return this._ordinal.replace('%d', number);
2144
+}
2145
+
2146
+var defaultRelativeTime = {
2147
+    future : 'in %s',
2148
+    past   : '%s ago',
2149
+    s  : 'a few seconds',
2150
+    ss : '%d seconds',
2151
+    m  : 'a minute',
2152
+    mm : '%d minutes',
2153
+    h  : 'an hour',
2154
+    hh : '%d hours',
2155
+    d  : 'a day',
2156
+    dd : '%d days',
2157
+    M  : 'a month',
2158
+    MM : '%d months',
2159
+    y  : 'a year',
2160
+    yy : '%d years'
2161
+};
2162
+
2163
+function relativeTime (number, withoutSuffix, string, isFuture) {
2164
+    var output = this._relativeTime[string];
2165
+    return (isFunction(output)) ?
2166
+        output(number, withoutSuffix, string, isFuture) :
2167
+        output.replace(/%d/i, number);
2168
+}
2169
+
2170
+function pastFuture (diff, output) {
2171
+    var format = this._relativeTime[diff > 0 ? 'future' : 'past'];
2172
+    return isFunction(format) ? format(output) : format.replace(/%s/i, output);
2173
+}
2174
+
2175
+var aliases = {};
2176
+
2177
+function addUnitAlias (unit, shorthand) {
2178
+    var lowerCase = unit.toLowerCase();
2179
+    aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit;
2180
+}
2181
+
2182
+function normalizeUnits(units) {
2183
+    return typeof units === 'string' ? aliases[units] || aliases[units.toLowerCase()] : undefined;
2184
+}
2185
+
2186
+function normalizeObjectUnits(inputObject) {
2187
+    var normalizedInput = {},
2188
+        normalizedProp,
2189
+        prop;
2190
+
2191
+    for (prop in inputObject) {
2192
+        if (hasOwnProp(inputObject, prop)) {
2193
+            normalizedProp = normalizeUnits(prop);
2194
+            if (normalizedProp) {
2195
+                normalizedInput[normalizedProp] = inputObject[prop];
2196
+            }
2197
+        }
2198
+    }
2199
+
2200
+    return normalizedInput;
2201
+}
2202
+
2203
+var priorities = {};
2204
+
2205
+function addUnitPriority(unit, priority) {
2206
+    priorities[unit] = priority;
2207
+}
2208
+
2209
+function getPrioritizedUnits(unitsObj) {
2210
+    var units = [];
2211
+    for (var u in unitsObj) {
2212
+        units.push({unit: u, priority: priorities[u]});
2213
+    }
2214
+    units.sort(function (a, b) {
2215
+        return a.priority - b.priority;
2216
+    });
2217
+    return units;
2218
+}
2219
+
2220
+function zeroFill(number, targetLength, forceSign) {
2221
+    var absNumber = '' + Math.abs(number),
2222
+        zerosToFill = targetLength - absNumber.length,
2223
+        sign = number >= 0;
2224
+    return (sign ? (forceSign ? '+' : '') : '-') +
2225
+        Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber;
2226
+}
2227
+
2228
+var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g;
2229
+
2230
+var localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g;
2231
+
2232
+var formatFunctions = {};
2233
+
2234
+var formatTokenFunctions = {};
2235
+
2236
+// token:    'M'
2237
+// padded:   ['MM', 2]
2238
+// ordinal:  'Mo'
2239
+// callback: function () { this.month() + 1 }
2240
+function addFormatToken (token, padded, ordinal, callback) {
2241
+    var func = callback;
2242
+    if (typeof callback === 'string') {
2243
+        func = function () {
2244
+            return this[callback]();
2245
+        };
2246
+    }
2247
+    if (token) {
2248
+        formatTokenFunctions[token] = func;
2249
+    }
2250
+    if (padded) {
2251
+        formatTokenFunctions[padded[0]] = function () {
2252
+            return zeroFill(func.apply(this, arguments), padded[1], padded[2]);
2253
+        };
2254
+    }
2255
+    if (ordinal) {
2256
+        formatTokenFunctions[ordinal] = function () {
2257
+            return this.localeData().ordinal(func.apply(this, arguments), token);
2258
+        };
2259
+    }
2260
+}
2261
+
2262
+function removeFormattingTokens(input) {
2263
+    if (input.match(/\[[\s\S]/)) {
2264
+        return input.replace(/^\[|\]$/g, '');
2265
+    }
2266
+    return input.replace(/\\/g, '');
2267
+}
2268
+
2269
+function makeFormatFunction(format) {
2270
+    var array = format.match(formattingTokens), i, length;
2271
+
2272
+    for (i = 0, length = array.length; i < length; i++) {
2273
+        if (formatTokenFunctions[array[i]]) {
2274
+            array[i] = formatTokenFunctions[array[i]];
2275
+        } else {
2276
+            array[i] = removeFormattingTokens(array[i]);
2277
+        }
2278
+    }
2279
+
2280
+    return function (mom) {
2281
+        var output = '', i;
2282
+        for (i = 0; i < length; i++) {
2283
+            output += isFunction(array[i]) ? array[i].call(mom, format) : array[i];
2284
+        }
2285
+        return output;
2286
+    };
2287
+}
2288
+
2289
+// format date using native date object
2290
+function formatMoment(m, format) {
2291
+    if (!m.isValid()) {
2292
+        return m.localeData().invalidDate();
2293
+    }
2294
+
2295
+    format = expandFormat(format, m.localeData());
2296
+    formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format);
2297
+
2298
+    return formatFunctions[format](m);
2299
+}
2300
+
2301
+function expandFormat(format, locale) {
2302
+    var i = 5;
2303
+
2304
+    function replaceLongDateFormatTokens(input) {
2305
+        return locale.longDateFormat(input) || input;
2306
+    }
2307
+
2308
+    localFormattingTokens.lastIndex = 0;
2309
+    while (i >= 0 && localFormattingTokens.test(format)) {
2310
+        format = format.replace(localFormattingTokens, replaceLongDateFormatTokens);
2311
+        localFormattingTokens.lastIndex = 0;
2312
+        i -= 1;
2313
+    }
2314
+
2315
+    return format;
2316
+}
2317
+
2318
+var match1         = /\d/;            //       0 - 9
2319
+var match2         = /\d\d/;          //      00 - 99
2320
+var match3         = /\d{3}/;         //     000 - 999
2321
+var match4         = /\d{4}/;         //    0000 - 9999
2322
+var match6         = /[+-]?\d{6}/;    // -999999 - 999999
2323
+var match1to2      = /\d\d?/;         //       0 - 99
2324
+var match3to4      = /\d\d\d\d?/;     //     999 - 9999
2325
+var match5to6      = /\d\d\d\d\d\d?/; //   99999 - 999999
2326
+var match1to3      = /\d{1,3}/;       //       0 - 999
2327
+var match1to4      = /\d{1,4}/;       //       0 - 9999
2328
+var match1to6      = /[+-]?\d{1,6}/;  // -999999 - 999999
2329
+
2330
+var matchUnsigned  = /\d+/;           //       0 - inf
2331
+var matchSigned    = /[+-]?\d+/;      //    -inf - inf
2332
+
2333
+var matchOffset    = /Z|[+-]\d\d:?\d\d/gi; // +00:00 -00:00 +0000 -0000 or Z
2334
+var matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi; // +00 -00 +00:00 -00:00 +0000 -0000 or Z
2335
+
2336
+var matchTimestamp = /[+-]?\d+(\.\d{1,3})?/; // 123456789 123456789.123
2337
+
2338
+// any word (or two) characters or numbers including two/three word month in arabic.
2339
+// includes scottish gaelic two word and hyphenated months
2340
+var matchWord = /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i;
2341
+
2342
+
2343
+var regexes = {};
2344
+
2345
+function addRegexToken (token, regex, strictRegex) {
2346
+    regexes[token] = isFunction(regex) ? regex : function (isStrict, localeData) {
2347
+        return (isStrict && strictRegex) ? strictRegex : regex;
2348
+    };
2349
+}
2350
+
2351
+function getParseRegexForToken (token, config) {
2352
+    if (!hasOwnProp(regexes, token)) {
2353
+        return new RegExp(unescapeFormat(token));
2354
+    }
2355
+
2356
+    return regexes[token](config._strict, config._locale);
2357
+}
2358
+
2359
+// Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript
2360
+function unescapeFormat(s) {
2361
+    return regexEscape(s.replace('\\', '').replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) {
2362
+        return p1 || p2 || p3 || p4;
2363
+    }));
2364
+}
2365
+
2366
+function regexEscape(s) {
2367
+    return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
2368
+}
2369
+
2370
+var tokens = {};
2371
+
2372
+function addParseToken (token, callback) {
2373
+    var i, func = callback;
2374
+    if (typeof token === 'string') {
2375
+        token = [token];
2376
+    }
2377
+    if (isNumber(callback)) {
2378
+        func = function (input, array) {
2379
+            array[callback] = toInt(input);
2380
+        };
2381
+    }
2382
+    for (i = 0; i < token.length; i++) {
2383
+        tokens[token[i]] = func;
2384
+    }
2385
+}
2386
+
2387
+function addWeekParseToken (token, callback) {
2388
+    addParseToken(token, function (input, array, config, token) {
2389
+        config._w = config._w || {};
2390
+        callback(input, config._w, config, token);
2391
+    });
2392
+}
2393
+
2394
+function addTimeToArrayFromToken(token, input, config) {
2395
+    if (input != null && hasOwnProp(tokens, token)) {
2396
+        tokens[token](input, config._a, config, token);
2397
+    }
2398
+}
2399
+
2400
+var YEAR = 0;
2401
+var MONTH = 1;
2402
+var DATE = 2;
2403
+var HOUR = 3;
2404
+var MINUTE = 4;
2405
+var SECOND = 5;
2406
+var MILLISECOND = 6;
2407
+var WEEK = 7;
2408
+var WEEKDAY = 8;
2409
+
2410
+// FORMATTING
2411
+
2412
+addFormatToken('Y', 0, 0, function () {
2413
+    var y = this.year();
2414
+    return y <= 9999 ? '' + y : '+' + y;
2415
+});
2416
+
2417
+addFormatToken(0, ['YY', 2], 0, function () {
2418
+    return this.year() % 100;
2419
+});
2420
+
2421
+addFormatToken(0, ['YYYY',   4],       0, 'year');
2422
+addFormatToken(0, ['YYYYY',  5],       0, 'year');
2423
+addFormatToken(0, ['YYYYYY', 6, true], 0, 'year');
2424
+
2425
+// ALIASES
2426
+
2427
+addUnitAlias('year', 'y');
2428
+
2429
+// PRIORITIES
2430
+
2431
+addUnitPriority('year', 1);
2432
+
2433
+// PARSING
2434
+
2435
+addRegexToken('Y',      matchSigned);
2436
+addRegexToken('YY',     match1to2, match2);
2437
+addRegexToken('YYYY',   match1to4, match4);
2438
+addRegexToken('YYYYY',  match1to6, match6);
2439
+addRegexToken('YYYYYY', match1to6, match6);
2440
+
2441
+addParseToken(['YYYYY', 'YYYYYY'], YEAR);
2442
+addParseToken('YYYY', function (input, array) {
2443
+    array[YEAR] = input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input);
2444
+});
2445
+addParseToken('YY', function (input, array) {
2446
+    array[YEAR] = hooks.parseTwoDigitYear(input);
2447
+});
2448
+addParseToken('Y', function (input, array) {
2449
+    array[YEAR] = parseInt(input, 10);
2450
+});
2451
+
2452
+// HELPERS
2453
+
2454
+function daysInYear(year) {
2455
+    return isLeapYear(year) ? 366 : 365;
2456
+}
2457
+
2458
+function isLeapYear(year) {
2459
+    return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
2460
+}
2461
+
2462
+// HOOKS
2463
+
2464
+hooks.parseTwoDigitYear = function (input) {
2465
+    return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);
2466
+};
2467
+
2468
+// MOMENTS
2469
+
2470
+var getSetYear = makeGetSet('FullYear', true);
2471
+
2472
+function getIsLeapYear () {
2473
+    return isLeapYear(this.year());
2474
+}
2475
+
2476
+function makeGetSet (unit, keepTime) {
2477
+    return function (value) {
2478
+        if (value != null) {
2479
+            set$1(this, unit, value);
2480
+            hooks.updateOffset(this, keepTime);
2481
+            return this;
2482
+        } else {
2483
+            return get(this, unit);
2484
+        }
2485
+    };
2486
+}
2487
+
2488
+function get (mom, unit) {
2489
+    return mom.isValid() ?
2490
+        mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]() : NaN;
2491
+}
2492
+
2493
+function set$1 (mom, unit, value) {
2494
+    if (mom.isValid() && !isNaN(value)) {
2495
+        if (unit === 'FullYear' && isLeapYear(mom.year()) && mom.month() === 1 && mom.date() === 29) {
2496
+            mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value, mom.month(), daysInMonth(value, mom.month()));
2497
+        }
2498
+        else {
2499
+            mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value);
2500
+        }
2501
+    }
2502
+}
2503
+
2504
+// MOMENTS
2505
+
2506
+function stringGet (units) {
2507
+    units = normalizeUnits(units);
2508
+    if (isFunction(this[units])) {
2509
+        return this[units]();
2510
+    }
2511
+    return this;
2512
+}
2513
+
2514
+
2515
+function stringSet (units, value) {
2516
+    if (typeof units === 'object') {
2517
+        units = normalizeObjectUnits(units);
2518
+        var prioritized = getPrioritizedUnits(units);
2519
+        for (var i = 0; i < prioritized.length; i++) {
2520
+            this[prioritized[i].unit](units[prioritized[i].unit]);
2521
+        }
2522
+    } else {
2523
+        units = normalizeUnits(units);
2524
+        if (isFunction(this[units])) {
2525
+            return this[units](value);
2526
+        }
2527
+    }
2528
+    return this;
2529
+}
2530
+
2531
+function mod(n, x) {
2532
+    return ((n % x) + x) % x;
2533
+}
2534
+
2535
+var indexOf;
2536
+
2537
+if (Array.prototype.indexOf) {
2538
+    indexOf = Array.prototype.indexOf;
2539
+} else {
2540
+    indexOf = function (o) {
2541
+        // I know
2542
+        var i;
2543
+        for (i = 0; i < this.length; ++i) {
2544
+            if (this[i] === o) {
2545
+                return i;
2546
+            }
2547
+        }
2548
+        return -1;
2549
+    };
2550
+}
2551
+
2552
+function daysInMonth(year, month) {
2553
+    if (isNaN(year) || isNaN(month)) {
2554
+        return NaN;
2555
+    }
2556
+    var modMonth = mod(month, 12);
2557
+    year += (month - modMonth) / 12;
2558
+    return modMonth === 1 ? (isLeapYear(year) ? 29 : 28) : (31 - modMonth % 7 % 2);
2559
+}
2560
+
2561
+// FORMATTING
2562
+
2563
+addFormatToken('M', ['MM', 2], 'Mo', function () {
2564
+    return this.month() + 1;
2565
+});
2566
+
2567
+addFormatToken('MMM', 0, 0, function (format) {
2568
+    return this.localeData().monthsShort(this, format);
2569
+});
2570
+
2571
+addFormatToken('MMMM', 0, 0, function (format) {
2572
+    return this.localeData().months(this, format);
2573
+});
2574
+
2575
+// ALIASES
2576
+
2577
+addUnitAlias('month', 'M');
2578
+
2579
+// PRIORITY
2580
+
2581
+addUnitPriority('month', 8);
2582
+
2583
+// PARSING
2584
+
2585
+addRegexToken('M',    match1to2);
2586
+addRegexToken('MM',   match1to2, match2);
2587
+addRegexToken('MMM',  function (isStrict, locale) {
2588
+    return locale.monthsShortRegex(isStrict);
2589
+});
2590
+addRegexToken('MMMM', function (isStrict, locale) {
2591
+    return locale.monthsRegex(isStrict);
2592
+});
2593
+
2594
+addParseToken(['M', 'MM'], function (input, array) {
2595
+    array[MONTH] = toInt(input) - 1;
2596
+});
2597
+
2598
+addParseToken(['MMM', 'MMMM'], function (input, array, config, token) {
2599
+    var month = config._locale.monthsParse(input, token, config._strict);
2600
+    // if we didn't find a month name, mark the date as invalid.
2601
+    if (month != null) {
2602
+        array[MONTH] = month;
2603
+    } else {
2604
+        getParsingFlags(config).invalidMonth = input;
2605
+    }
2606
+});
2607
+
2608
+// LOCALES
2609
+
2610
+var MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/;
2611
+var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_');
2612
+function localeMonths (m, format) {
2613
+    if (!m) {
2614
+        return isArray(this._months) ? this._months :
2615
+            this._months['standalone'];
2616
+    }
2617
+    return isArray(this._months) ? this._months[m.month()] :
2618
+        this._months[(this._months.isFormat || MONTHS_IN_FORMAT).test(format) ? 'format' : 'standalone'][m.month()];
2619
+}
2620
+
2621
+var defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_');
2622
+function localeMonthsShort (m, format) {
2623
+    if (!m) {
2624
+        return isArray(this._monthsShort) ? this._monthsShort :
2625
+            this._monthsShort['standalone'];
2626
+    }
2627
+    return isArray(this._monthsShort) ? this._monthsShort[m.month()] :
2628
+        this._monthsShort[MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'][m.month()];
2629
+}
2630
+
2631
+function handleStrictParse(monthName, format, strict) {
2632
+    var i, ii, mom, llc = monthName.toLocaleLowerCase();
2633
+    if (!this._monthsParse) {
2634
+        // this is not used
2635
+        this._monthsParse = [];
2636
+        this._longMonthsParse = [];
2637
+        this._shortMonthsParse = [];
2638
+        for (i = 0; i < 12; ++i) {
2639
+            mom = createUTC([2000, i]);
2640
+            this._shortMonthsParse[i] = this.monthsShort(mom, '').toLocaleLowerCase();
2641
+            this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase();
2642
+        }
2643
+    }
2644
+
2645
+    if (strict) {
2646
+        if (format === 'MMM') {
2647
+            ii = indexOf.call(this._shortMonthsParse, llc);
2648
+            return ii !== -1 ? ii : null;
2649
+        } else {
2650
+            ii = indexOf.call(this._longMonthsParse, llc);
2651
+            return ii !== -1 ? ii : null;
2652
+        }
2653
+    } else {
2654
+        if (format === 'MMM') {
2655
+            ii = indexOf.call(this._shortMonthsParse, llc);
2656
+            if (ii !== -1) {
2657
+                return ii;
2658
+            }
2659
+            ii = indexOf.call(this._longMonthsParse, llc);
2660
+            return ii !== -1 ? ii : null;
2661
+        } else {
2662
+            ii = indexOf.call(this._longMonthsParse, llc);
2663
+            if (ii !== -1) {
2664
+                return ii;
2665
+            }
2666
+            ii = indexOf.call(this._shortMonthsParse, llc);
2667
+            return ii !== -1 ? ii : null;
2668
+        }
2669
+    }
2670
+}
2671
+
2672
+function localeMonthsParse (monthName, format, strict) {
2673
+    var i, mom, regex;
2674
+
2675
+    if (this._monthsParseExact) {
2676
+        return handleStrictParse.call(this, monthName, format, strict);
2677
+    }
2678
+
2679
+    if (!this._monthsParse) {
2680
+        this._monthsParse = [];
2681
+        this._longMonthsParse = [];
2682
+        this._shortMonthsParse = [];
2683
+    }
2684
+
2685
+    // TODO: add sorting
2686
+    // Sorting makes sure if one month (or abbr) is a prefix of another
2687
+    // see sorting in computeMonthsParse
2688
+    for (i = 0; i < 12; i++) {
2689
+        // make the regex if we don't have it already
2690
+        mom = createUTC([2000, i]);
2691
+        if (strict && !this._longMonthsParse[i]) {
2692
+            this._longMonthsParse[i] = new RegExp('^' + this.months(mom, '').replace('.', '') + '$', 'i');
2693
+            this._shortMonthsParse[i] = new RegExp('^' + this.monthsShort(mom, '').replace('.', '') + '$', 'i');
2694
+        }
2695
+        if (!strict && !this._monthsParse[i]) {
2696
+            regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, '');
2697
+            this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');
2698
+        }
2699
+        // test the regex
2700
+        if (strict && format === 'MMMM' && this._longMonthsParse[i].test(monthName)) {
2701
+            return i;
2702
+        } else if (strict && format === 'MMM' && this._shortMonthsParse[i].test(monthName)) {
2703
+            return i;
2704
+        } else if (!strict && this._monthsParse[i].test(monthName)) {
2705
+            return i;
2706
+        }
2707
+    }
2708
+}
2709
+
2710
+// MOMENTS
2711
+
2712
+function setMonth (mom, value) {
2713
+    var dayOfMonth;
2714
+
2715
+    if (!mom.isValid()) {
2716
+        // No op
2717
+        return mom;
2718
+    }
2719
+
2720
+    if (typeof value === 'string') {
2721
+        if (/^\d+$/.test(value)) {
2722
+            value = toInt(value);
2723
+        } else {
2724
+            value = mom.localeData().monthsParse(value);
2725
+            // TODO: Another silent failure?
2726
+            if (!isNumber(value)) {
2727
+                return mom;
2728
+            }
2729
+        }
2730
+    }
2731
+
2732
+    dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value));
2733
+    mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth);
2734
+    return mom;
2735
+}
2736
+
2737
+function getSetMonth (value) {
2738
+    if (value != null) {
2739
+        setMonth(this, value);
2740
+        hooks.updateOffset(this, true);
2741
+        return this;
2742
+    } else {
2743
+        return get(this, 'Month');
2744
+    }
2745
+}
2746
+
2747
+function getDaysInMonth () {
2748
+    return daysInMonth(this.year(), this.month());
2749
+}
2750
+
2751
+var defaultMonthsShortRegex = matchWord;
2752
+function monthsShortRegex (isStrict) {
2753
+    if (this._monthsParseExact) {
2754
+        if (!hasOwnProp(this, '_monthsRegex')) {
2755
+            computeMonthsParse.call(this);
2756
+        }
2757
+        if (isStrict) {
2758
+            return this._monthsShortStrictRegex;
2759
+        } else {
2760
+            return this._monthsShortRegex;
2761
+        }
2762
+    } else {
2763
+        if (!hasOwnProp(this, '_monthsShortRegex')) {
2764
+            this._monthsShortRegex = defaultMonthsShortRegex;
2765
+        }
2766
+        return this._monthsShortStrictRegex && isStrict ?
2767
+            this._monthsShortStrictRegex : this._monthsShortRegex;
2768
+    }
2769
+}
2770
+
2771
+var defaultMonthsRegex = matchWord;
2772
+function monthsRegex (isStrict) {
2773
+    if (this._monthsParseExact) {
2774
+        if (!hasOwnProp(this, '_monthsRegex')) {
2775
+            computeMonthsParse.call(this);
2776
+        }
2777
+        if (isStrict) {
2778
+            return this._monthsStrictRegex;
2779
+        } else {
2780
+            return this._monthsRegex;
2781
+        }
2782
+    } else {
2783
+        if (!hasOwnProp(this, '_monthsRegex')) {
2784
+            this._monthsRegex = defaultMonthsRegex;
2785
+        }
2786
+        return this._monthsStrictRegex && isStrict ?
2787
+            this._monthsStrictRegex : this._monthsRegex;
2788
+    }
2789
+}
2790
+
2791
+function computeMonthsParse () {
2792
+    function cmpLenRev(a, b) {
2793
+        return b.length - a.length;
2794
+    }
2795
+
2796
+    var shortPieces = [], longPieces = [], mixedPieces = [],
2797
+        i, mom;
2798
+    for (i = 0; i < 12; i++) {
2799
+        // make the regex if we don't have it already
2800
+        mom = createUTC([2000, i]);
2801
+        shortPieces.push(this.monthsShort(mom, ''));
2802
+        longPieces.push(this.months(mom, ''));
2803
+        mixedPieces.push(this.months(mom, ''));
2804
+        mixedPieces.push(this.monthsShort(mom, ''));
2805
+    }
2806
+    // Sorting makes sure if one month (or abbr) is a prefix of another it
2807
+    // will match the longer piece.
2808
+    shortPieces.sort(cmpLenRev);
2809
+    longPieces.sort(cmpLenRev);
2810
+    mixedPieces.sort(cmpLenRev);
2811
+    for (i = 0; i < 12; i++) {
2812
+        shortPieces[i] = regexEscape(shortPieces[i]);
2813
+        longPieces[i] = regexEscape(longPieces[i]);
2814
+    }
2815
+    for (i = 0; i < 24; i++) {
2816
+        mixedPieces[i] = regexEscape(mixedPieces[i]);
2817
+    }
2818
+
2819
+    this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
2820
+    this._monthsShortRegex = this._monthsRegex;
2821
+    this._monthsStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i');
2822
+    this._monthsShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i');
2823
+}
2824
+
2825
+function createDate (y, m, d, h, M, s, ms) {
2826
+    // can't just apply() to create a date:
2827
+    // https://stackoverflow.com/q/181348
2828
+    var date = new Date(y, m, d, h, M, s, ms);
2829
+
2830
+    // the date constructor remaps years 0-99 to 1900-1999
2831
+    if (y < 100 && y >= 0 && isFinite(date.getFullYear())) {
2832
+        date.setFullYear(y);
2833
+    }
2834
+    return date;
2835
+}
2836
+
2837
+function createUTCDate (y) {
2838
+    var date = new Date(Date.UTC.apply(null, arguments));
2839
+
2840
+    // the Date.UTC function remaps years 0-99 to 1900-1999
2841
+    if (y < 100 && y >= 0 && isFinite(date.getUTCFullYear())) {
2842
+        date.setUTCFullYear(y);
2843
+    }
2844
+    return date;
2845
+}
2846
+
2847
+// start-of-first-week - start-of-year
2848
+function firstWeekOffset(year, dow, doy) {
2849
+    var // first-week day -- which january is always in the first week (4 for iso, 1 for other)
2850
+        fwd = 7 + dow - doy,
2851
+        // first-week day local weekday -- which local weekday is fwd
2852
+        fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7;
2853
+
2854
+    return -fwdlw + fwd - 1;
2855
+}
2856
+
2857
+// https://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday
2858
+function dayOfYearFromWeeks(year, week, weekday, dow, doy) {
2859
+    var localWeekday = (7 + weekday - dow) % 7,
2860
+        weekOffset = firstWeekOffset(year, dow, doy),
2861
+        dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset,
2862
+        resYear, resDayOfYear;
2863
+
2864
+    if (dayOfYear <= 0) {
2865
+        resYear = year - 1;
2866
+        resDayOfYear = daysInYear(resYear) + dayOfYear;
2867
+    } else if (dayOfYear > daysInYear(year)) {
2868
+        resYear = year + 1;
2869
+        resDayOfYear = dayOfYear - daysInYear(year);
2870
+    } else {
2871
+        resYear = year;
2872
+        resDayOfYear = dayOfYear;
2873
+    }
2874
+
2875
+    return {
2876
+        year: resYear,
2877
+        dayOfYear: resDayOfYear
2878
+    };
2879
+}
2880
+
2881
+function weekOfYear(mom, dow, doy) {
2882
+    var weekOffset = firstWeekOffset(mom.year(), dow, doy),
2883
+        week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1,
2884
+        resWeek, resYear;
2885
+
2886
+    if (week < 1) {
2887
+        resYear = mom.year() - 1;
2888
+        resWeek = week + weeksInYear(resYear, dow, doy);
2889
+    } else if (week > weeksInYear(mom.year(), dow, doy)) {
2890
+        resWeek = week - weeksInYear(mom.year(), dow, doy);
2891
+        resYear = mom.year() + 1;
2892
+    } else {
2893
+        resYear = mom.year();
2894
+        resWeek = week;
2895
+    }
2896
+
2897
+    return {
2898
+        week: resWeek,
2899
+        year: resYear
2900
+    };
2901
+}
2902
+
2903
+function weeksInYear(year, dow, doy) {
2904
+    var weekOffset = firstWeekOffset(year, dow, doy),
2905
+        weekOffsetNext = firstWeekOffset(year + 1, dow, doy);
2906
+    return (daysInYear(year) - weekOffset + weekOffsetNext) / 7;
2907
+}
2908
+
2909
+// FORMATTING
2910
+
2911
+addFormatToken('w', ['ww', 2], 'wo', 'week');
2912
+addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek');
2913
+
2914
+// ALIASES
2915
+
2916
+addUnitAlias('week', 'w');
2917
+addUnitAlias('isoWeek', 'W');
2918
+
2919
+// PRIORITIES
2920
+
2921
+addUnitPriority('week', 5);
2922
+addUnitPriority('isoWeek', 5);
2923
+
2924
+// PARSING
2925
+
2926
+addRegexToken('w',  match1to2);
2927
+addRegexToken('ww', match1to2, match2);
2928
+addRegexToken('W',  match1to2);
2929
+addRegexToken('WW', match1to2, match2);
2930
+
2931
+addWeekParseToken(['w', 'ww', 'W', 'WW'], function (input, week, config, token) {
2932
+    week[token.substr(0, 1)] = toInt(input);
2933
+});
2934
+
2935
+// HELPERS
2936
+
2937
+// LOCALES
2938
+
2939
+function localeWeek (mom) {
2940
+    return weekOfYear(mom, this._week.dow, this._week.doy).week;
2941
+}
2942
+
2943
+var defaultLocaleWeek = {
2944
+    dow : 0, // Sunday is the first day of the week.
2945
+    doy : 6  // The week that contains Jan 1st is the first week of the year.
2946
+};
2947
+
2948
+function localeFirstDayOfWeek () {
2949
+    return this._week.dow;
2950
+}
2951
+
2952
+function localeFirstDayOfYear () {
2953
+    return this._week.doy;
2954
+}
2955
+
2956
+// MOMENTS
2957
+
2958
+function getSetWeek (input) {
2959
+    var week = this.localeData().week(this);
2960
+    return input == null ? week : this.add((input - week) * 7, 'd');
2961
+}
2962
+
2963
+function getSetISOWeek (input) {
2964
+    var week = weekOfYear(this, 1, 4).week;
2965
+    return input == null ? week : this.add((input - week) * 7, 'd');
2966
+}
2967
+
2968
+// FORMATTING
2969
+
2970
+addFormatToken('d', 0, 'do', 'day');
2971
+
2972
+addFormatToken('dd', 0, 0, function (format) {
2973
+    return this.localeData().weekdaysMin(this, format);
2974
+});
2975
+
2976
+addFormatToken('ddd', 0, 0, function (format) {
2977
+    return this.localeData().weekdaysShort(this, format);
2978
+});
2979
+
2980
+addFormatToken('dddd', 0, 0, function (format) {
2981
+    return this.localeData().weekdays(this, format);
2982
+});
2983
+
2984
+addFormatToken('e', 0, 0, 'weekday');
2985
+addFormatToken('E', 0, 0, 'isoWeekday');
2986
+
2987
+// ALIASES
2988
+
2989
+addUnitAlias('day', 'd');
2990
+addUnitAlias('weekday', 'e');
2991
+addUnitAlias('isoWeekday', 'E');
2992
+
2993
+// PRIORITY
2994
+addUnitPriority('day', 11);
2995
+addUnitPriority('weekday', 11);
2996
+addUnitPriority('isoWeekday', 11);
2997
+
2998
+// PARSING
2999
+
3000
+addRegexToken('d',    match1to2);
3001
+addRegexToken('e',    match1to2);
3002
+addRegexToken('E',    match1to2);
3003
+addRegexToken('dd',   function (isStrict, locale) {
3004
+    return locale.weekdaysMinRegex(isStrict);
3005
+});
3006
+addRegexToken('ddd',   function (isStrict, locale) {
3007
+    return locale.weekdaysShortRegex(isStrict);
3008
+});
3009
+addRegexToken('dddd',   function (isStrict, locale) {
3010
+    return locale.weekdaysRegex(isStrict);
3011
+});
3012
+
3013
+addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) {
3014
+    var weekday = config._locale.weekdaysParse(input, token, config._strict);
3015
+    // if we didn't get a weekday name, mark the date as invalid
3016
+    if (weekday != null) {
3017
+        week.d = weekday;
3018
+    } else {
3019
+        getParsingFlags(config).invalidWeekday = input;
3020
+    }
3021
+});
3022
+
3023
+addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) {
3024
+    week[token] = toInt(input);
3025
+});
3026
+
3027
+// HELPERS
3028
+
3029
+function parseWeekday(input, locale) {
3030
+    if (typeof input !== 'string') {
3031
+        return input;
3032
+    }
3033
+
3034
+    if (!isNaN(input)) {
3035
+        return parseInt(input, 10);
3036
+    }
3037
+
3038
+    input = locale.weekdaysParse(input);
3039
+    if (typeof input === 'number') {
3040
+        return input;
3041
+    }
3042
+
3043
+    return null;
3044
+}
3045
+
3046
+function parseIsoWeekday(input, locale) {
3047
+    if (typeof input === 'string') {
3048
+        return locale.weekdaysParse(input) % 7 || 7;
3049
+    }
3050
+    return isNaN(input) ? null : input;
3051
+}
3052
+
3053
+// LOCALES
3054
+
3055
+var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_');
3056
+function localeWeekdays (m, format) {
3057
+    if (!m) {
3058
+        return isArray(this._weekdays) ? this._weekdays :
3059
+            this._weekdays['standalone'];
3060
+    }
3061
+    return isArray(this._weekdays) ? this._weekdays[m.day()] :
3062
+        this._weekdays[this._weekdays.isFormat.test(format) ? 'format' : 'standalone'][m.day()];
3063
+}
3064
+
3065
+var defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_');
3066
+function localeWeekdaysShort (m) {
3067
+    return (m) ? this._weekdaysShort[m.day()] : this._weekdaysShort;
3068
+}
3069
+
3070
+var defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_');
3071
+function localeWeekdaysMin (m) {
3072
+    return (m) ? this._weekdaysMin[m.day()] : this._weekdaysMin;
3073
+}
3074
+
3075
+function handleStrictParse$1(weekdayName, format, strict) {
3076
+    var i, ii, mom, llc = weekdayName.toLocaleLowerCase();
3077
+    if (!this._weekdaysParse) {
3078
+        this._weekdaysParse = [];
3079
+        this._shortWeekdaysParse = [];
3080
+        this._minWeekdaysParse = [];
3081
+
3082
+        for (i = 0; i < 7; ++i) {
3083
+            mom = createUTC([2000, 1]).day(i);
3084
+            this._minWeekdaysParse[i] = this.weekdaysMin(mom, '').toLocaleLowerCase();
3085
+            this._shortWeekdaysParse[i] = this.weekdaysShort(mom, '').toLocaleLowerCase();
3086
+            this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase();
3087
+        }
3088
+    }
3089
+
3090
+    if (strict) {
3091
+        if (format === 'dddd') {
3092
+            ii = indexOf.call(this._weekdaysParse, llc);
3093
+            return ii !== -1 ? ii : null;
3094
+        } else if (format === 'ddd') {
3095
+            ii = indexOf.call(this._shortWeekdaysParse, llc);
3096
+            return ii !== -1 ? ii : null;
3097
+        } else {
3098
+            ii = indexOf.call(this._minWeekdaysParse, llc);
3099
+            return ii !== -1 ? ii : null;
3100
+        }
3101
+    } else {
3102
+        if (format === 'dddd') {
3103
+            ii = indexOf.call(this._weekdaysParse, llc);
3104
+            if (ii !== -1) {
3105
+                return ii;
3106
+            }
3107
+            ii = indexOf.call(this._shortWeekdaysParse, llc);
3108
+            if (ii !== -1) {
3109
+                return ii;
3110
+            }
3111
+            ii = indexOf.call(this._minWeekdaysParse, llc);
3112
+            return ii !== -1 ? ii : null;
3113
+        } else if (format === 'ddd') {
3114
+            ii = indexOf.call(this._shortWeekdaysParse, llc);
3115
+            if (ii !== -1) {
3116
+                return ii;
3117
+            }
3118
+            ii = indexOf.call(this._weekdaysParse, llc);
3119
+            if (ii !== -1) {
3120
+                return ii;
3121
+            }
3122
+            ii = indexOf.call(this._minWeekdaysParse, llc);
3123
+            return ii !== -1 ? ii : null;
3124
+        } else {
3125
+            ii = indexOf.call(this._minWeekdaysParse, llc);
3126
+            if (ii !== -1) {
3127
+                return ii;
3128
+            }
3129
+            ii = indexOf.call(this._weekdaysParse, llc);
3130
+            if (ii !== -1) {
3131
+                return ii;
3132
+            }
3133
+            ii = indexOf.call(this._shortWeekdaysParse, llc);
3134
+            return ii !== -1 ? ii : null;
3135
+        }
3136
+    }
3137
+}
3138
+
3139
+function localeWeekdaysParse (weekdayName, format, strict) {
3140
+    var i, mom, regex;
3141
+
3142
+    if (this._weekdaysParseExact) {
3143
+        return handleStrictParse$1.call(this, weekdayName, format, strict);
3144
+    }
3145
+
3146
+    if (!this._weekdaysParse) {
3147
+        this._weekdaysParse = [];
3148
+        this._minWeekdaysParse = [];
3149
+        this._shortWeekdaysParse = [];
3150
+        this._fullWeekdaysParse = [];
3151
+    }
3152
+
3153
+    for (i = 0; i < 7; i++) {
3154
+        // make the regex if we don't have it already
3155
+
3156
+        mom = createUTC([2000, 1]).day(i);
3157
+        if (strict && !this._fullWeekdaysParse[i]) {
3158
+            this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '\.?') + '$', 'i');
3159
+            this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '\.?') + '$', 'i');
3160
+            this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '\.?') + '$', 'i');
3161
+        }
3162
+        if (!this._weekdaysParse[i]) {
3163
+            regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, '');
3164
+            this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i');
3165
+        }
3166
+        // test the regex
3167
+        if (strict && format === 'dddd' && this._fullWeekdaysParse[i].test(weekdayName)) {
3168
+            return i;
3169
+        } else if (strict && format === 'ddd' && this._shortWeekdaysParse[i].test(weekdayName)) {
3170
+            return i;
3171
+        } else if (strict && format === 'dd' && this._minWeekdaysParse[i].test(weekdayName)) {
3172
+            return i;
3173
+        } else if (!strict && this._weekdaysParse[i].test(weekdayName)) {
3174
+            return i;
3175
+        }
3176
+    }
3177
+}
3178
+
3179
+// MOMENTS
3180
+
3181
+function getSetDayOfWeek (input) {
3182
+    if (!this.isValid()) {
3183
+        return input != null ? this : NaN;
3184
+    }
3185
+    var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay();
3186
+    if (input != null) {
3187
+        input = parseWeekday(input, this.localeData());
3188
+        return this.add(input - day, 'd');
3189
+    } else {
3190
+        return day;
3191
+    }
3192
+}
3193
+
3194
+function getSetLocaleDayOfWeek (input) {
3195
+    if (!this.isValid()) {
3196
+        return input != null ? this : NaN;
3197
+    }
3198
+    var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7;
3199
+    return input == null ? weekday : this.add(input - weekday, 'd');
3200
+}
3201
+
3202
+function getSetISODayOfWeek (input) {
3203
+    if (!this.isValid()) {
3204
+        return input != null ? this : NaN;
3205
+    }
3206
+
3207
+    // behaves the same as moment#day except
3208
+    // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6)
3209
+    // as a setter, sunday should belong to the previous week.
3210
+
3211
+    if (input != null) {
3212
+        var weekday = parseIsoWeekday(input, this.localeData());
3213
+        return this.day(this.day() % 7 ? weekday : weekday - 7);
3214
+    } else {
3215
+        return this.day() || 7;
3216
+    }
3217
+}
3218
+
3219
+var defaultWeekdaysRegex = matchWord;
3220
+function weekdaysRegex (isStrict) {
3221
+    if (this._weekdaysParseExact) {
3222
+        if (!hasOwnProp(this, '_weekdaysRegex')) {
3223
+            computeWeekdaysParse.call(this);
3224
+        }
3225
+        if (isStrict) {
3226
+            return this._weekdaysStrictRegex;
3227
+        } else {
3228
+            return this._weekdaysRegex;
3229
+        }
3230
+    } else {
3231
+        if (!hasOwnProp(this, '_weekdaysRegex')) {
3232
+            this._weekdaysRegex = defaultWeekdaysRegex;
3233
+        }
3234
+        return this._weekdaysStrictRegex && isStrict ?
3235
+            this._weekdaysStrictRegex : this._weekdaysRegex;
3236
+    }
3237
+}
3238
+
3239
+var defaultWeekdaysShortRegex = matchWord;
3240
+function weekdaysShortRegex (isStrict) {
3241
+    if (this._weekdaysParseExact) {
3242
+        if (!hasOwnProp(this, '_weekdaysRegex')) {
3243
+            computeWeekdaysParse.call(this);
3244
+        }
3245
+        if (isStrict) {
3246
+            return this._weekdaysShortStrictRegex;
3247
+        } else {
3248
+            return this._weekdaysShortRegex;
3249
+        }
3250
+    } else {
3251
+        if (!hasOwnProp(this, '_weekdaysShortRegex')) {
3252
+            this._weekdaysShortRegex = defaultWeekdaysShortRegex;
3253
+        }
3254
+        return this._weekdaysShortStrictRegex && isStrict ?
3255
+            this._weekdaysShortStrictRegex : this._weekdaysShortRegex;
3256
+    }
3257
+}
3258
+
3259
+var defaultWeekdaysMinRegex = matchWord;
3260
+function weekdaysMinRegex (isStrict) {
3261
+    if (this._weekdaysParseExact) {
3262
+        if (!hasOwnProp(this, '_weekdaysRegex')) {
3263
+            computeWeekdaysParse.call(this);
3264
+        }
3265
+        if (isStrict) {
3266
+            return this._weekdaysMinStrictRegex;
3267
+        } else {
3268
+            return this._weekdaysMinRegex;
3269
+        }
3270
+    } else {
3271
+        if (!hasOwnProp(this, '_weekdaysMinRegex')) {
3272
+            this._weekdaysMinRegex = defaultWeekdaysMinRegex;
3273
+        }
3274
+        return this._weekdaysMinStrictRegex && isStrict ?
3275
+            this._weekdaysMinStrictRegex : this._weekdaysMinRegex;
3276
+    }
3277
+}
3278
+
3279
+
3280
+function computeWeekdaysParse () {
3281
+    function cmpLenRev(a, b) {
3282
+        return b.length - a.length;
3283
+    }
3284
+
3285
+    var minPieces = [], shortPieces = [], longPieces = [], mixedPieces = [],
3286
+        i, mom, minp, shortp, longp;
3287
+    for (i = 0; i < 7; i++) {
3288
+        // make the regex if we don't have it already
3289
+        mom = createUTC([2000, 1]).day(i);
3290
+        minp = this.weekdaysMin(mom, '');
3291
+        shortp = this.weekdaysShort(mom, '');
3292
+        longp = this.weekdays(mom, '');
3293
+        minPieces.push(minp);
3294
+        shortPieces.push(shortp);
3295
+        longPieces.push(longp);
3296
+        mixedPieces.push(minp);
3297
+        mixedPieces.push(shortp);
3298
+        mixedPieces.push(longp);
3299
+    }
3300
+    // Sorting makes sure if one weekday (or abbr) is a prefix of another it
3301
+    // will match the longer piece.
3302
+    minPieces.sort(cmpLenRev);
3303
+    shortPieces.sort(cmpLenRev);
3304
+    longPieces.sort(cmpLenRev);
3305
+    mixedPieces.sort(cmpLenRev);
3306
+    for (i = 0; i < 7; i++) {
3307
+        shortPieces[i] = regexEscape(shortPieces[i]);
3308
+        longPieces[i] = regexEscape(longPieces[i]);
3309
+        mixedPieces[i] = regexEscape(mixedPieces[i]);
3310
+    }
3311
+
3312
+    this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
3313
+    this._weekdaysShortRegex = this._weekdaysRegex;
3314
+    this._weekdaysMinRegex = this._weekdaysRegex;
3315
+
3316
+    this._weekdaysStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i');
3317
+    this._weekdaysShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i');
3318
+    this._weekdaysMinStrictRegex = new RegExp('^(' + minPieces.join('|') + ')', 'i');
3319
+}
3320
+
3321
+// FORMATTING
3322
+
3323
+function hFormat() {
3324
+    return this.hours() % 12 || 12;
3325
+}
3326
+
3327
+function kFormat() {
3328
+    return this.hours() || 24;
3329
+}
3330
+
3331
+addFormatToken('H', ['HH', 2], 0, 'hour');
3332
+addFormatToken('h', ['hh', 2], 0, hFormat);
3333
+addFormatToken('k', ['kk', 2], 0, kFormat);
3334
+
3335
+addFormatToken('hmm', 0, 0, function () {
3336
+    return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2);
3337
+});
3338
+
3339
+addFormatToken('hmmss', 0, 0, function () {
3340
+    return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2) +
3341
+        zeroFill(this.seconds(), 2);
3342
+});
3343
+
3344
+addFormatToken('Hmm', 0, 0, function () {
3345
+    return '' + this.hours() + zeroFill(this.minutes(), 2);
3346
+});
3347
+
3348
+addFormatToken('Hmmss', 0, 0, function () {
3349
+    return '' + this.hours() + zeroFill(this.minutes(), 2) +
3350
+        zeroFill(this.seconds(), 2);
3351
+});
3352
+
3353
+function meridiem (token, lowercase) {
3354
+    addFormatToken(token, 0, 0, function () {
3355
+        return this.localeData().meridiem(this.hours(), this.minutes(), lowercase);
3356
+    });
3357
+}
3358
+
3359
+meridiem('a', true);
3360
+meridiem('A', false);
3361
+
3362
+// ALIASES
3363
+
3364
+addUnitAlias('hour', 'h');
3365
+
3366
+// PRIORITY
3367
+addUnitPriority('hour', 13);
3368
+
3369
+// PARSING
3370
+
3371
+function matchMeridiem (isStrict, locale) {
3372
+    return locale._meridiemParse;
3373
+}
3374
+
3375
+addRegexToken('a',  matchMeridiem);
3376
+addRegexToken('A',  matchMeridiem);
3377
+addRegexToken('H',  match1to2);
3378
+addRegexToken('h',  match1to2);
3379
+addRegexToken('k',  match1to2);
3380
+addRegexToken('HH', match1to2, match2);
3381
+addRegexToken('hh', match1to2, match2);
3382
+addRegexToken('kk', match1to2, match2);
3383
+
3384
+addRegexToken('hmm', match3to4);
3385
+addRegexToken('hmmss', match5to6);
3386
+addRegexToken('Hmm', match3to4);
3387
+addRegexToken('Hmmss', match5to6);
3388
+
3389
+addParseToken(['H', 'HH'], HOUR);
3390
+addParseToken(['k', 'kk'], function (input, array, config) {
3391
+    var kInput = toInt(input);
3392
+    array[HOUR] = kInput === 24 ? 0 : kInput;
3393
+});
3394
+addParseToken(['a', 'A'], function (input, array, config) {
3395
+    config._isPm = config._locale.isPM(input);
3396
+    config._meridiem = input;
3397
+});
3398
+addParseToken(['h', 'hh'], function (input, array, config) {
3399
+    array[HOUR] = toInt(input);
3400
+    getParsingFlags(config).bigHour = true;
3401
+});
3402
+addParseToken('hmm', function (input, array, config) {
3403
+    var pos = input.length - 2;
3404
+    array[HOUR] = toInt(input.substr(0, pos));
3405
+    array[MINUTE] = toInt(input.substr(pos));
3406
+    getParsingFlags(config).bigHour = true;
3407
+});
3408
+addParseToken('hmmss', function (input, array, config) {
3409
+    var pos1 = input.length - 4;
3410
+    var pos2 = input.length - 2;
3411
+    array[HOUR] = toInt(input.substr(0, pos1));
3412
+    array[MINUTE] = toInt(input.substr(pos1, 2));
3413
+    array[SECOND] = toInt(input.substr(pos2));
3414
+    getParsingFlags(config).bigHour = true;
3415
+});
3416
+addParseToken('Hmm', function (input, array, config) {
3417
+    var pos = input.length - 2;
3418
+    array[HOUR] = toInt(input.substr(0, pos));
3419
+    array[MINUTE] = toInt(input.substr(pos));
3420
+});
3421
+addParseToken('Hmmss', function (input, array, config) {
3422
+    var pos1 = input.length - 4;
3423
+    var pos2 = input.length - 2;
3424
+    array[HOUR] = toInt(input.substr(0, pos1));
3425
+    array[MINUTE] = toInt(input.substr(pos1, 2));
3426
+    array[SECOND] = toInt(input.substr(pos2));
3427
+});
3428
+
3429
+// LOCALES
3430
+
3431
+function localeIsPM (input) {
3432
+    // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays
3433
+    // Using charAt should be more compatible.
3434
+    return ((input + '').toLowerCase().charAt(0) === 'p');
3435
+}
3436
+
3437
+var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i;
3438
+function localeMeridiem (hours, minutes, isLower) {
3439
+    if (hours > 11) {
3440
+        return isLower ? 'pm' : 'PM';
3441
+    } else {
3442
+        return isLower ? 'am' : 'AM';
3443
+    }
3444
+}
3445
+
3446
+
3447
+// MOMENTS
3448
+
3449
+// Setting the hour should keep the time, because the user explicitly
3450
+// specified which hour he wants. So trying to maintain the same hour (in
3451
+// a new timezone) makes sense. Adding/subtracting hours does not follow
3452
+// this rule.
3453
+var getSetHour = makeGetSet('Hours', true);
3454
+
3455
+// months
3456
+// week
3457
+// weekdays
3458
+// meridiem
3459
+var baseConfig = {
3460
+    calendar: defaultCalendar,
3461
+    longDateFormat: defaultLongDateFormat,
3462
+    invalidDate: defaultInvalidDate,
3463
+    ordinal: defaultOrdinal,
3464
+    dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse,
3465
+    relativeTime: defaultRelativeTime,
3466
+
3467
+    months: defaultLocaleMonths,
3468
+    monthsShort: defaultLocaleMonthsShort,
3469
+
3470
+    week: defaultLocaleWeek,
3471
+
3472
+    weekdays: defaultLocaleWeekdays,
3473
+    weekdaysMin: defaultLocaleWeekdaysMin,
3474
+    weekdaysShort: defaultLocaleWeekdaysShort,
3475
+
3476
+    meridiemParse: defaultLocaleMeridiemParse
3477
+};
3478
+
3479
+// internal storage for locale config files
3480
+var locales = {};
3481
+var localeFamilies = {};
3482
+var globalLocale;
3483
+
3484
+function normalizeLocale(key) {
3485
+    return key ? key.toLowerCase().replace('_', '-') : key;
3486
+}
3487
+
3488
+// pick the locale from the array
3489
+// try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each
3490
+// substring from most specific to least, but move to the next array item if it's a more specific variant than the current root
3491
+function chooseLocale(names) {
3492
+    var i = 0, j, next, locale, split;
3493
+
3494
+    while (i < names.length) {
3495
+        split = normalizeLocale(names[i]).split('-');
3496
+        j = split.length;
3497
+        next = normalizeLocale(names[i + 1]);
3498
+        next = next ? next.split('-') : null;
3499
+        while (j > 0) {
3500
+            locale = loadLocale(split.slice(0, j).join('-'));
3501
+            if (locale) {
3502
+                return locale;
3503
+            }
3504
+            if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {
3505
+                //the next array item is better than a shallower substring of this one
3506
+                break;
3507
+            }
3508
+            j--;
3509
+        }
3510
+        i++;
3511
+    }
3512
+    return null;
3513
+}
3514
+
3515
+function loadLocale(name) {
3516
+    var oldLocale = null;
3517
+    // TODO: Find a better way to register and load all the locales in Node
3518
+    if (!locales[name] && (typeof module !== 'undefined') &&
3519
+            module && module.exports) {
3520
+        try {
3521
+            oldLocale = globalLocale._abbr;
3522
+            var aliasedRequire = require;
3523
+            aliasedRequire('./locale/' + name);
3524
+            getSetGlobalLocale(oldLocale);
3525
+        } catch (e) {}
3526
+    }
3527
+    return locales[name];
3528
+}
3529
+
3530
+// This function will load locale and then set the global locale.  If
3531
+// no arguments are passed in, it will simply return the current global
3532
+// locale key.
3533
+function getSetGlobalLocale (key, values) {
3534
+    var data;
3535
+    if (key) {
3536
+        if (isUndefined(values)) {
3537
+            data = getLocale(key);
3538
+        }
3539
+        else {
3540
+            data = defineLocale(key, values);
3541
+        }
3542
+
3543
+        if (data) {
3544
+            // moment.duration._locale = moment._locale = data;
3545
+            globalLocale = data;
3546
+        }
3547
+    }
3548
+
3549
+    return globalLocale._abbr;
3550
+}
3551
+
3552
+function defineLocale (name, config) {
3553
+    if (config !== null) {
3554
+        var parentConfig = baseConfig;
3555
+        config.abbr = name;
3556
+        if (locales[name] != null) {
3557
+            deprecateSimple('defineLocaleOverride',
3558
+                    'use moment.updateLocale(localeName, config) to change ' +
3559
+                    'an existing locale. moment.defineLocale(localeName, ' +
3560
+                    'config) should only be used for creating a new locale ' +
3561
+                    'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.');
3562
+            parentConfig = locales[name]._config;
3563
+        } else if (config.parentLocale != null) {
3564
+            if (locales[config.parentLocale] != null) {
3565
+                parentConfig = locales[config.parentLocale]._config;
3566
+            } else {
3567
+                if (!localeFamilies[config.parentLocale]) {
3568
+                    localeFamilies[config.parentLocale] = [];
3569
+                }
3570
+                localeFamilies[config.parentLocale].push({
3571
+                    name: name,
3572
+                    config: config
3573
+                });
3574
+                return null;
3575
+            }
3576
+        }
3577
+        locales[name] = new Locale(mergeConfigs(parentConfig, config));
3578
+
3579
+        if (localeFamilies[name]) {
3580
+            localeFamilies[name].forEach(function (x) {
3581
+                defineLocale(x.name, x.config);
3582
+            });
3583
+        }
3584
+
3585
+        // backwards compat for now: also set the locale
3586
+        // make sure we set the locale AFTER all child locales have been
3587
+        // created, so we won't end up with the child locale set.
3588
+        getSetGlobalLocale(name);
3589
+
3590
+
3591
+        return locales[name];
3592
+    } else {
3593
+        // useful for testing
3594
+        delete locales[name];
3595
+        return null;
3596
+    }
3597
+}
3598
+
3599
+function updateLocale(name, config) {
3600
+    if (config != null) {
3601
+        var locale, tmpLocale, parentConfig = baseConfig;
3602
+        // MERGE
3603
+        tmpLocale = loadLocale(name);
3604
+        if (tmpLocale != null) {
3605
+            parentConfig = tmpLocale._config;
3606
+        }
3607
+        config = mergeConfigs(parentConfig, config);
3608
+        locale = new Locale(config);
3609
+        locale.parentLocale = locales[name];
3610
+        locales[name] = locale;
3611
+
3612
+        // backwards compat for now: also set the locale
3613
+        getSetGlobalLocale(name);
3614
+    } else {
3615
+        // pass null for config to unupdate, useful for tests
3616
+        if (locales[name] != null) {
3617
+            if (locales[name].parentLocale != null) {
3618
+                locales[name] = locales[name].parentLocale;
3619
+            } else if (locales[name] != null) {
3620
+                delete locales[name];
3621
+            }
3622
+        }
3623
+    }
3624
+    return locales[name];
3625
+}
3626
+
3627
+// returns locale data
3628
+function getLocale (key) {
3629
+    var locale;
3630
+
3631
+    if (key && key._locale && key._locale._abbr) {
3632
+        key = key._locale._abbr;
3633
+    }
3634
+
3635
+    if (!key) {
3636
+        return globalLocale;
3637
+    }
3638
+
3639
+    if (!isArray(key)) {
3640
+        //short-circuit everything else
3641
+        locale = loadLocale(key);
3642
+        if (locale) {
3643
+            return locale;
3644
+        }
3645
+        key = [key];
3646
+    }
3647
+
3648
+    return chooseLocale(key);
3649
+}
3650
+
3651
+function listLocales() {
3652
+    return keys(locales);
3653
+}
3654
+
3655
+function checkOverflow (m) {
3656
+    var overflow;
3657
+    var a = m._a;
3658
+
3659
+    if (a && getParsingFlags(m).overflow === -2) {
3660
+        overflow =
3661
+            a[MONTH]       < 0 || a[MONTH]       > 11  ? MONTH :
3662
+            a[DATE]        < 1 || a[DATE]        > daysInMonth(a[YEAR], a[MONTH]) ? DATE :
3663
+            a[HOUR]        < 0 || a[HOUR]        > 24 || (a[HOUR] === 24 && (a[MINUTE] !== 0 || a[SECOND] !== 0 || a[MILLISECOND] !== 0)) ? HOUR :
3664
+            a[MINUTE]      < 0 || a[MINUTE]      > 59  ? MINUTE :
3665
+            a[SECOND]      < 0 || a[SECOND]      > 59  ? SECOND :
3666
+            a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND :
3667
+            -1;
3668
+
3669
+        if (getParsingFlags(m)._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) {
3670
+            overflow = DATE;
3671
+        }
3672
+        if (getParsingFlags(m)._overflowWeeks && overflow === -1) {
3673
+            overflow = WEEK;
3674
+        }
3675
+        if (getParsingFlags(m)._overflowWeekday && overflow === -1) {
3676
+            overflow = WEEKDAY;
3677
+        }
3678
+
3679
+        getParsingFlags(m).overflow = overflow;
3680
+    }
3681
+
3682
+    return m;
3683
+}
3684
+
3685
+// Pick the first defined of two or three arguments.
3686
+function defaults(a, b, c) {
3687
+    if (a != null) {
3688
+        return a;
3689
+    }
3690
+    if (b != null) {
3691
+        return b;
3692
+    }
3693
+    return c;
3694
+}
3695
+
3696
+function currentDateArray(config) {
3697
+    // hooks is actually the exported moment object
3698
+    var nowValue = new Date(hooks.now());
3699
+    if (config._useUTC) {
3700
+        return [nowValue.getUTCFullYear(), nowValue.getUTCMonth(), nowValue.getUTCDate()];
3701
+    }
3702
+    return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()];
3703
+}
3704
+
3705
+// convert an array to a date.
3706
+// the array should mirror the parameters below
3707
+// note: all values past the year are optional and will default to the lowest possible value.
3708
+// [year, month, day , hour, minute, second, millisecond]
3709
+function configFromArray (config) {
3710
+    var i, date, input = [], currentDate, expectedWeekday, yearToUse;
3711
+
3712
+    if (config._d) {
3713
+        return;
3714
+    }
3715
+
3716
+    currentDate = currentDateArray(config);
3717
+
3718
+    //compute day of the year from weeks and weekdays
3719
+    if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {
3720
+        dayOfYearFromWeekInfo(config);
3721
+    }
3722
+
3723
+    //if the day of the year is set, figure out what it is
3724
+    if (config._dayOfYear != null) {
3725
+        yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);
3726
+
3727
+        if (config._dayOfYear > daysInYear(yearToUse) || config._dayOfYear === 0) {
3728
+            getParsingFlags(config)._overflowDayOfYear = true;
3729
+        }
3730
+
3731
+        date = createUTCDate(yearToUse, 0, config._dayOfYear);
3732
+        config._a[MONTH] = date.getUTCMonth();
3733
+        config._a[DATE] = date.getUTCDate();
3734
+    }
3735
+
3736
+    // Default to current date.
3737
+    // * if no year, month, day of month are given, default to today
3738
+    // * if day of month is given, default month and year
3739
+    // * if month is given, default only year
3740
+    // * if year is given, don't default anything
3741
+    for (i = 0; i < 3 && config._a[i] == null; ++i) {
3742
+        config._a[i] = input[i] = currentDate[i];
3743
+    }
3744
+
3745
+    // Zero out whatever was not defaulted, including time
3746
+    for (; i < 7; i++) {
3747
+        config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];
3748
+    }
3749
+
3750
+    // Check for 24:00:00.000
3751
+    if (config._a[HOUR] === 24 &&
3752
+            config._a[MINUTE] === 0 &&
3753
+            config._a[SECOND] === 0 &&
3754
+            config._a[MILLISECOND] === 0) {
3755
+        config._nextDay = true;
3756
+        config._a[HOUR] = 0;
3757
+    }
3758
+
3759
+    config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);
3760
+    expectedWeekday = config._useUTC ? config._d.getUTCDay() : config._d.getDay();
3761
+
3762
+    // Apply timezone offset from input. The actual utcOffset can be changed
3763
+    // with parseZone.
3764
+    if (config._tzm != null) {
3765
+        config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
3766
+    }
3767
+
3768
+    if (config._nextDay) {
3769
+        config._a[HOUR] = 24;
3770
+    }
3771
+
3772
+    // check for mismatching day of week
3773
+    if (config._w && typeof config._w.d !== 'undefined' && config._w.d !== expectedWeekday) {
3774
+        getParsingFlags(config).weekdayMismatch = true;
3775
+    }
3776
+}
3777
+
3778
+function dayOfYearFromWeekInfo(config) {
3779
+    var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow;
3780
+
3781
+    w = config._w;
3782
+    if (w.GG != null || w.W != null || w.E != null) {
3783
+        dow = 1;
3784
+        doy = 4;
3785
+
3786
+        // TODO: We need to take the current isoWeekYear, but that depends on
3787
+        // how we interpret now (local, utc, fixed offset). So create
3788
+        // a now version of current config (take local/utc/offset flags, and
3789
+        // create now).
3790
+        weekYear = defaults(w.GG, config._a[YEAR], weekOfYear(createLocal(), 1, 4).year);
3791
+        week = defaults(w.W, 1);
3792
+        weekday = defaults(w.E, 1);
3793
+        if (weekday < 1 || weekday > 7) {
3794
+            weekdayOverflow = true;
3795
+        }
3796
+    } else {
3797
+        dow = config._locale._week.dow;
3798
+        doy = config._locale._week.doy;
3799
+
3800
+        var curWeek = weekOfYear(createLocal(), dow, doy);
3801
+
3802
+        weekYear = defaults(w.gg, config._a[YEAR], curWeek.year);
3803
+
3804
+        // Default to current week.
3805
+        week = defaults(w.w, curWeek.week);
3806
+
3807
+        if (w.d != null) {
3808
+            // weekday -- low day numbers are considered next week
3809
+            weekday = w.d;
3810
+            if (weekday < 0 || weekday > 6) {
3811
+                weekdayOverflow = true;
3812
+            }
3813
+        } else if (w.e != null) {
3814
+            // local weekday -- counting starts from begining of week
3815
+            weekday = w.e + dow;
3816
+            if (w.e < 0 || w.e > 6) {
3817
+                weekdayOverflow = true;
3818
+            }
3819
+        } else {
3820
+            // default to begining of week
3821
+            weekday = dow;
3822
+        }
3823
+    }
3824
+    if (week < 1 || week > weeksInYear(weekYear, dow, doy)) {
3825
+        getParsingFlags(config)._overflowWeeks = true;
3826
+    } else if (weekdayOverflow != null) {
3827
+        getParsingFlags(config)._overflowWeekday = true;
3828
+    } else {
3829
+        temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy);
3830
+        config._a[YEAR] = temp.year;
3831
+        config._dayOfYear = temp.dayOfYear;
3832
+    }
3833
+}
3834
+
3835
+// iso 8601 regex
3836
+// 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00)
3837
+var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/;
3838
+var basicIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/;
3839
+
3840
+var tzRegex = /Z|[+-]\d\d(?::?\d\d)?/;
3841
+
3842
+var isoDates = [
3843
+    ['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/],
3844
+    ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/],
3845
+    ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/],
3846
+    ['GGGG-[W]WW', /\d{4}-W\d\d/, false],
3847
+    ['YYYY-DDD', /\d{4}-\d{3}/],
3848
+    ['YYYY-MM', /\d{4}-\d\d/, false],
3849
+    ['YYYYYYMMDD', /[+-]\d{10}/],
3850
+    ['YYYYMMDD', /\d{8}/],
3851
+    // YYYYMM is NOT allowed by the standard
3852
+    ['GGGG[W]WWE', /\d{4}W\d{3}/],
3853
+    ['GGGG[W]WW', /\d{4}W\d{2}/, false],
3854
+    ['YYYYDDD', /\d{7}/]
3855
+];
3856
+
3857
+// iso time formats and regexes
3858
+var isoTimes = [
3859
+    ['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/],
3860
+    ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/],
3861
+    ['HH:mm:ss', /\d\d:\d\d:\d\d/],
3862
+    ['HH:mm', /\d\d:\d\d/],
3863
+    ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/],
3864
+    ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/],
3865
+    ['HHmmss', /\d\d\d\d\d\d/],
3866
+    ['HHmm', /\d\d\d\d/],
3867
+    ['HH', /\d\d/]
3868
+];
3869
+
3870
+var aspNetJsonRegex = /^\/?Date\((\-?\d+)/i;
3871
+
3872
+// date from iso format
3873
+function configFromISO(config) {
3874
+    var i, l,
3875
+        string = config._i,
3876
+        match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string),
3877
+        allowTime, dateFormat, timeFormat, tzFormat;
3878
+
3879
+    if (match) {
3880
+        getParsingFlags(config).iso = true;
3881
+
3882
+        for (i = 0, l = isoDates.length; i < l; i++) {
3883
+            if (isoDates[i][1].exec(match[1])) {
3884
+                dateFormat = isoDates[i][0];
3885
+                allowTime = isoDates[i][2] !== false;
3886
+                break;
3887
+            }
3888
+        }
3889
+        if (dateFormat == null) {
3890
+            config._isValid = false;
3891
+            return;
3892
+        }
3893
+        if (match[3]) {
3894
+            for (i = 0, l = isoTimes.length; i < l; i++) {
3895
+                if (isoTimes[i][1].exec(match[3])) {
3896
+                    // match[2] should be 'T' or space
3897
+                    timeFormat = (match[2] || ' ') + isoTimes[i][0];
3898
+                    break;
3899
+                }
3900
+            }
3901
+            if (timeFormat == null) {
3902
+                config._isValid = false;
3903
+                return;
3904
+            }
3905
+        }
3906
+        if (!allowTime && timeFormat != null) {
3907
+            config._isValid = false;
3908
+            return;
3909
+        }
3910
+        if (match[4]) {
3911
+            if (tzRegex.exec(match[4])) {
3912
+                tzFormat = 'Z';
3913
+            } else {
3914
+                config._isValid = false;
3915
+                return;
3916
+            }
3917
+        }
3918
+        config._f = dateFormat + (timeFormat || '') + (tzFormat || '');
3919
+        configFromStringAndFormat(config);
3920
+    } else {
3921
+        config._isValid = false;
3922
+    }
3923
+}
3924
+
3925
+// RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3
3926
+var rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/;
3927
+
3928
+function extractFromRFC2822Strings(yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) {
3929
+    var result = [
3930
+        untruncateYear(yearStr),
3931
+        defaultLocaleMonthsShort.indexOf(monthStr),
3932
+        parseInt(dayStr, 10),
3933
+        parseInt(hourStr, 10),
3934
+        parseInt(minuteStr, 10)
3935
+    ];
3936
+
3937
+    if (secondStr) {
3938
+        result.push(parseInt(secondStr, 10));
3939
+    }
3940
+
3941
+    return result;
3942
+}
3943
+
3944
+function untruncateYear(yearStr) {
3945
+    var year = parseInt(yearStr, 10);
3946
+    if (year <= 49) {
3947
+        return 2000 + year;
3948
+    } else if (year <= 999) {
3949
+        return 1900 + year;
3950
+    }
3951
+    return year;
3952
+}
3953
+
3954
+function preprocessRFC2822(s) {
3955
+    // Remove comments and folding whitespace and replace multiple-spaces with a single space
3956
+    return s.replace(/\([^)]*\)|[\n\t]/g, ' ').replace(/(\s\s+)/g, ' ').trim();
3957
+}
3958
+
3959
+function checkWeekday(weekdayStr, parsedInput, config) {
3960
+    if (weekdayStr) {
3961
+        // TODO: Replace the vanilla JS Date object with an indepentent day-of-week check.
3962
+        var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr),
3963
+            weekdayActual = new Date(parsedInput[0], parsedInput[1], parsedInput[2]).getDay();
3964
+        if (weekdayProvided !== weekdayActual) {
3965
+            getParsingFlags(config).weekdayMismatch = true;
3966
+            config._isValid = false;
3967
+            return false;
3968
+        }
3969
+    }
3970
+    return true;
3971
+}
3972
+
3973
+var obsOffsets = {
3974
+    UT: 0,
3975
+    GMT: 0,
3976
+    EDT: -4 * 60,
3977
+    EST: -5 * 60,
3978
+    CDT: -5 * 60,
3979
+    CST: -6 * 60,
3980
+    MDT: -6 * 60,
3981
+    MST: -7 * 60,
3982
+    PDT: -7 * 60,
3983
+    PST: -8 * 60
3984
+};
3985
+
3986
+function calculateOffset(obsOffset, militaryOffset, numOffset) {
3987
+    if (obsOffset) {
3988
+        return obsOffsets[obsOffset];
3989
+    } else if (militaryOffset) {
3990
+        // the only allowed military tz is Z
3991
+        return 0;
3992
+    } else {
3993
+        var hm = parseInt(numOffset, 10);
3994
+        var m = hm % 100, h = (hm - m) / 100;
3995
+        return h * 60 + m;
3996
+    }
3997
+}
3998
+
3999
+// date and time from ref 2822 format
4000
+function configFromRFC2822(config) {
4001
+    var match = rfc2822.exec(preprocessRFC2822(config._i));
4002
+    if (match) {
4003
+        var parsedArray = extractFromRFC2822Strings(match[4], match[3], match[2], match[5], match[6], match[7]);
4004
+        if (!checkWeekday(match[1], parsedArray, config)) {
4005
+            return;
4006
+        }
4007
+
4008
+        config._a = parsedArray;
4009
+        config._tzm = calculateOffset(match[8], match[9], match[10]);
4010
+
4011
+        config._d = createUTCDate.apply(null, config._a);
4012
+        config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
4013
+
4014
+        getParsingFlags(config).rfc2822 = true;
4015
+    } else {
4016
+        config._isValid = false;
4017
+    }
4018
+}
4019
+
4020
+// date from iso format or fallback
4021
+function configFromString(config) {
4022
+    var matched = aspNetJsonRegex.exec(config._i);
4023
+
4024
+    if (matched !== null) {
4025
+        config._d = new Date(+matched[1]);
4026
+        return;
4027
+    }
4028
+
4029
+    configFromISO(config);
4030
+    if (config._isValid === false) {
4031
+        delete config._isValid;
4032
+    } else {
4033
+        return;
4034
+    }
4035
+
4036
+    configFromRFC2822(config);
4037
+    if (config._isValid === false) {
4038
+        delete config._isValid;
4039
+    } else {
4040
+        return;
4041
+    }
4042
+
4043
+    // Final attempt, use Input Fallback
4044
+    hooks.createFromInputFallback(config);
4045
+}
4046
+
4047
+hooks.createFromInputFallback = deprecate(
4048
+    'value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' +
4049
+    'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' +
4050
+    'discouraged and will be removed in an upcoming major release. Please refer to ' +
4051
+    'http://momentjs.com/guides/#/warnings/js-date/ for more info.',
4052
+    function (config) {
4053
+        config._d = new Date(config._i + (config._useUTC ? ' UTC' : ''));
4054
+    }
4055
+);
4056
+
4057
+// constant that refers to the ISO standard
4058
+hooks.ISO_8601 = function () {};
4059
+
4060
+// constant that refers to the RFC 2822 form
4061
+hooks.RFC_2822 = function () {};
4062
+
4063
+// date from string and format string
4064
+function configFromStringAndFormat(config) {
4065
+    // TODO: Move this to another part of the creation flow to prevent circular deps
4066
+    if (config._f === hooks.ISO_8601) {
4067
+        configFromISO(config);
4068
+        return;
4069
+    }
4070
+    if (config._f === hooks.RFC_2822) {
4071
+        configFromRFC2822(config);
4072
+        return;
4073
+    }
4074
+    config._a = [];
4075
+    getParsingFlags(config).empty = true;
4076
+
4077
+    // This array is used to make a Date, either with `new Date` or `Date.UTC`
4078
+    var string = '' + config._i,
4079
+        i, parsedInput, tokens, token, skipped,
4080
+        stringLength = string.length,
4081
+        totalParsedInputLength = 0;
4082
+
4083
+    tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];
4084
+
4085
+    for (i = 0; i < tokens.length; i++) {
4086
+        token = tokens[i];
4087
+        parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];
4088
+        // console.log('token', token, 'parsedInput', parsedInput,
4089
+        //         'regex', getParseRegexForToken(token, config));
4090
+        if (parsedInput) {
4091
+            skipped = string.substr(0, string.indexOf(parsedInput));
4092
+            if (skipped.length > 0) {
4093
+                getParsingFlags(config).unusedInput.push(skipped);
4094
+            }
4095
+            string = string.slice(string.indexOf(parsedInput) + parsedInput.length);
4096
+            totalParsedInputLength += parsedInput.length;
4097
+        }
4098
+        // don't parse if it's not a known token
4099
+        if (formatTokenFunctions[token]) {
4100
+            if (parsedInput) {
4101
+                getParsingFlags(config).empty = false;
4102
+            }
4103
+            else {
4104
+                getParsingFlags(config).unusedTokens.push(token);
4105
+            }
4106
+            addTimeToArrayFromToken(token, parsedInput, config);
4107
+        }
4108
+        else if (config._strict && !parsedInput) {
4109
+            getParsingFlags(config).unusedTokens.push(token);
4110
+        }
4111
+    }
4112
+
4113
+    // add remaining unparsed input length to the string
4114
+    getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength;
4115
+    if (string.length > 0) {
4116
+        getParsingFlags(config).unusedInput.push(string);
4117
+    }
4118
+
4119
+    // clear _12h flag if hour is <= 12
4120
+    if (config._a[HOUR] <= 12 &&
4121
+        getParsingFlags(config).bigHour === true &&
4122
+        config._a[HOUR] > 0) {
4123
+        getParsingFlags(config).bigHour = undefined;
4124
+    }
4125
+
4126
+    getParsingFlags(config).parsedDateParts = config._a.slice(0);
4127
+    getParsingFlags(config).meridiem = config._meridiem;
4128
+    // handle meridiem
4129
+    config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem);
4130
+
4131
+    configFromArray(config);
4132
+    checkOverflow(config);
4133
+}
4134
+
4135
+
4136
+function meridiemFixWrap (locale, hour, meridiem) {
4137
+    var isPm;
4138
+
4139
+    if (meridiem == null) {
4140
+        // nothing to do
4141
+        return hour;
4142
+    }
4143
+    if (locale.meridiemHour != null) {
4144
+        return locale.meridiemHour(hour, meridiem);
4145
+    } else if (locale.isPM != null) {
4146
+        // Fallback
4147
+        isPm = locale.isPM(meridiem);
4148
+        if (isPm && hour < 12) {
4149
+            hour += 12;
4150
+        }
4151
+        if (!isPm && hour === 12) {
4152
+            hour = 0;
4153
+        }
4154
+        return hour;
4155
+    } else {
4156
+        // this is not supposed to happen
4157
+        return hour;
4158
+    }
4159
+}
4160
+
4161
+// date from string and array of format strings
4162
+function configFromStringAndArray(config) {
4163
+    var tempConfig,
4164
+        bestMoment,
4165
+
4166
+        scoreToBeat,
4167
+        i,
4168
+        currentScore;
4169
+
4170
+    if (config._f.length === 0) {
4171
+        getParsingFlags(config).invalidFormat = true;
4172
+        config._d = new Date(NaN);
4173
+        return;
4174
+    }
4175
+
4176
+    for (i = 0; i < config._f.length; i++) {
4177
+        currentScore = 0;
4178
+        tempConfig = copyConfig({}, config);
4179
+        if (config._useUTC != null) {
4180
+            tempConfig._useUTC = config._useUTC;
4181
+        }
4182
+        tempConfig._f = config._f[i];
4183
+        configFromStringAndFormat(tempConfig);
4184
+
4185
+        if (!isValid(tempConfig)) {
4186
+            continue;
4187
+        }
4188
+
4189
+        // if there is any input that was not parsed add a penalty for that format
4190
+        currentScore += getParsingFlags(tempConfig).charsLeftOver;
4191
+
4192
+        //or tokens
4193
+        currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10;
4194
+
4195
+        getParsingFlags(tempConfig).score = currentScore;
4196
+
4197
+        if (scoreToBeat == null || currentScore < scoreToBeat) {
4198
+            scoreToBeat = currentScore;
4199
+            bestMoment = tempConfig;
4200
+        }
4201
+    }
4202
+
4203
+    extend(config, bestMoment || tempConfig);
4204
+}
4205
+
4206
+function configFromObject(config) {
4207
+    if (config._d) {
4208
+        return;
4209
+    }
4210
+
4211
+    var i = normalizeObjectUnits(config._i);
4212
+    config._a = map([i.year, i.month, i.day || i.date, i.hour, i.minute, i.second, i.millisecond], function (obj) {
4213
+        return obj && parseInt(obj, 10);
4214
+    });
4215
+
4216
+    configFromArray(config);
4217
+}
4218
+
4219
+function createFromConfig (config) {
4220
+    var res = new Moment(checkOverflow(prepareConfig(config)));
4221
+    if (res._nextDay) {
4222
+        // Adding is smart enough around DST
4223
+        res.add(1, 'd');
4224
+        res._nextDay = undefined;
4225
+    }
4226
+
4227
+    return res;
4228
+}
4229
+
4230
+function prepareConfig (config) {
4231
+    var input = config._i,
4232
+        format = config._f;
4233
+
4234
+    config._locale = config._locale || getLocale(config._l);
4235
+
4236
+    if (input === null || (format === undefined && input === '')) {
4237
+        return createInvalid({nullInput: true});
4238
+    }
4239
+
4240
+    if (typeof input === 'string') {
4241
+        config._i = input = config._locale.preparse(input);
4242
+    }
4243
+
4244
+    if (isMoment(input)) {
4245
+        return new Moment(checkOverflow(input));
4246
+    } else if (isDate(input)) {
4247
+        config._d = input;
4248
+    } else if (isArray(format)) {
4249
+        configFromStringAndArray(config);
4250
+    } else if (format) {
4251
+        configFromStringAndFormat(config);
4252
+    }  else {
4253
+        configFromInput(config);
4254
+    }
4255
+
4256
+    if (!isValid(config)) {
4257
+        config._d = null;
4258
+    }
4259
+
4260
+    return config;
4261
+}
4262
+
4263
+function configFromInput(config) {
4264
+    var input = config._i;
4265
+    if (isUndefined(input)) {
4266
+        config._d = new Date(hooks.now());
4267
+    } else if (isDate(input)) {
4268
+        config._d = new Date(input.valueOf());
4269
+    } else if (typeof input === 'string') {
4270
+        configFromString(config);
4271
+    } else if (isArray(input)) {
4272
+        config._a = map(input.slice(0), function (obj) {
4273
+            return parseInt(obj, 10);
4274
+        });
4275
+        configFromArray(config);
4276
+    } else if (isObject(input)) {
4277
+        configFromObject(config);
4278
+    } else if (isNumber(input)) {
4279
+        // from milliseconds
4280
+        config._d = new Date(input);
4281
+    } else {
4282
+        hooks.createFromInputFallback(config);
4283
+    }
4284
+}
4285
+
4286
+function createLocalOrUTC (input, format, locale, strict, isUTC) {
4287
+    var c = {};
4288
+
4289
+    if (locale === true || locale === false) {
4290
+        strict = locale;
4291
+        locale = undefined;
4292
+    }
4293
+
4294
+    if ((isObject(input) && isObjectEmpty(input)) ||
4295
+            (isArray(input) && input.length === 0)) {
4296
+        input = undefined;
4297
+    }
4298
+    // object construction must be done this way.
4299
+    // https://github.com/moment/moment/issues/1423
4300
+    c._isAMomentObject = true;
4301
+    c._useUTC = c._isUTC = isUTC;
4302
+    c._l = locale;
4303
+    c._i = input;
4304
+    c._f = format;
4305
+    c._strict = strict;
4306
+
4307
+    return createFromConfig(c);
4308
+}
4309
+
4310
+function createLocal (input, format, locale, strict) {
4311
+    return createLocalOrUTC(input, format, locale, strict, false);
4312
+}
4313
+
4314
+var prototypeMin = deprecate(
4315
+    'moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/',
4316
+    function () {
4317
+        var other = createLocal.apply(null, arguments);
4318
+        if (this.isValid() && other.isValid()) {
4319
+            return other < this ? this : other;
4320
+        } else {
4321
+            return createInvalid();
4322
+        }
4323
+    }
4324
+);
4325
+
4326
+var prototypeMax = deprecate(
4327
+    'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/',
4328
+    function () {
4329
+        var other = createLocal.apply(null, arguments);
4330
+        if (this.isValid() && other.isValid()) {
4331
+            return other > this ? this : other;
4332
+        } else {
4333
+            return createInvalid();
4334
+        }
4335
+    }
4336
+);
4337
+
4338
+// Pick a moment m from moments so that m[fn](other) is true for all
4339
+// other. This relies on the function fn to be transitive.
4340
+//
4341
+// moments should either be an array of moment objects or an array, whose
4342
+// first element is an array of moment objects.
4343
+function pickBy(fn, moments) {
4344
+    var res, i;
4345
+    if (moments.length === 1 && isArray(moments[0])) {
4346
+        moments = moments[0];
4347
+    }
4348
+    if (!moments.length) {
4349
+        return createLocal();
4350
+    }
4351
+    res = moments[0];
4352
+    for (i = 1; i < moments.length; ++i) {
4353
+        if (!moments[i].isValid() || moments[i][fn](res)) {
4354
+            res = moments[i];
4355
+        }
4356
+    }
4357
+    return res;
4358
+}
4359
+
4360
+// TODO: Use [].sort instead?
4361
+function min () {
4362
+    var args = [].slice.call(arguments, 0);
4363
+
4364
+    return pickBy('isBefore', args);
4365
+}
4366
+
4367
+function max () {
4368
+    var args = [].slice.call(arguments, 0);
4369
+
4370
+    return pickBy('isAfter', args);
4371
+}
4372
+
4373
+var now = function () {
4374
+    return Date.now ? Date.now() : +(new Date());
4375
+};
4376
+
4377
+var ordering = ['year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', 'millisecond'];
4378
+
4379
+function isDurationValid(m) {
4380
+    for (var key in m) {
4381
+        if (!(indexOf.call(ordering, key) !== -1 && (m[key] == null || !isNaN(m[key])))) {
4382
+            return false;
4383
+        }
4384
+    }
4385
+
4386
+    var unitHasDecimal = false;
4387
+    for (var i = 0; i < ordering.length; ++i) {
4388
+        if (m[ordering[i]]) {
4389
+            if (unitHasDecimal) {
4390
+                return false; // only allow non-integers for smallest unit
4391
+            }
4392
+            if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) {
4393
+                unitHasDecimal = true;
4394
+            }
4395
+        }
4396
+    }
4397
+
4398
+    return true;
4399
+}
4400
+
4401
+function isValid$1() {
4402
+    return this._isValid;
4403
+}
4404
+
4405
+function createInvalid$1() {
4406
+    return createDuration(NaN);
4407
+}
4408
+
4409
+function Duration (duration) {
4410
+    var normalizedInput = normalizeObjectUnits(duration),
4411
+        years = normalizedInput.year || 0,
4412
+        quarters = normalizedInput.quarter || 0,
4413
+        months = normalizedInput.month || 0,
4414
+        weeks = normalizedInput.week || 0,
4415
+        days = normalizedInput.day || 0,
4416
+        hours = normalizedInput.hour || 0,
4417
+        minutes = normalizedInput.minute || 0,
4418
+        seconds = normalizedInput.second || 0,
4419
+        milliseconds = normalizedInput.millisecond || 0;
4420
+
4421
+    this._isValid = isDurationValid(normalizedInput);
4422
+
4423
+    // representation for dateAddRemove
4424
+    this._milliseconds = +milliseconds +
4425
+        seconds * 1e3 + // 1000
4426
+        minutes * 6e4 + // 1000 * 60
4427
+        hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978
4428
+    // Because of dateAddRemove treats 24 hours as different from a
4429
+    // day when working around DST, we need to store them separately
4430
+    this._days = +days +
4431
+        weeks * 7;
4432
+    // It is impossible to translate months into days without knowing
4433
+    // which months you are are talking about, so we have to store
4434
+    // it separately.
4435
+    this._months = +months +
4436
+        quarters * 3 +
4437
+        years * 12;
4438
+
4439
+    this._data = {};
4440
+
4441
+    this._locale = getLocale();
4442
+
4443
+    this._bubble();
4444
+}
4445
+
4446
+function isDuration (obj) {
4447
+    return obj instanceof Duration;
4448
+}
4449
+
4450
+function absRound (number) {
4451
+    if (number < 0) {
4452
+        return Math.round(-1 * number) * -1;
4453
+    } else {
4454
+        return Math.round(number);
4455
+    }
4456
+}
4457
+
4458
+// FORMATTING
4459
+
4460
+function offset (token, separator) {
4461
+    addFormatToken(token, 0, 0, function () {
4462
+        var offset = this.utcOffset();
4463
+        var sign = '+';
4464
+        if (offset < 0) {
4465
+            offset = -offset;
4466
+            sign = '-';
4467
+        }
4468
+        return sign + zeroFill(~~(offset / 60), 2) + separator + zeroFill(~~(offset) % 60, 2);
4469
+    });
4470
+}
4471
+
4472
+offset('Z', ':');
4473
+offset('ZZ', '');
4474
+
4475
+// PARSING
4476
+
4477
+addRegexToken('Z',  matchShortOffset);
4478
+addRegexToken('ZZ', matchShortOffset);
4479
+addParseToken(['Z', 'ZZ'], function (input, array, config) {
4480
+    config._useUTC = true;
4481
+    config._tzm = offsetFromString(matchShortOffset, input);
4482
+});
4483
+
4484
+// HELPERS
4485
+
4486
+// timezone chunker
4487
+// '+10:00' > ['10',  '00']
4488
+// '-1530'  > ['-15', '30']
4489
+var chunkOffset = /([\+\-]|\d\d)/gi;
4490
+
4491
+function offsetFromString(matcher, string) {
4492
+    var matches = (string || '').match(matcher);
4493
+
4494
+    if (matches === null) {
4495
+        return null;
4496
+    }
4497
+
4498
+    var chunk   = matches[matches.length - 1] || [];
4499
+    var parts   = (chunk + '').match(chunkOffset) || ['-', 0, 0];
4500
+    var minutes = +(parts[1] * 60) + toInt(parts[2]);
4501
+
4502
+    return minutes === 0 ?
4503
+      0 :
4504
+      parts[0] === '+' ? minutes : -minutes;
4505
+}
4506
+
4507
+// Return a moment from input, that is local/utc/zone equivalent to model.
4508
+function cloneWithOffset(input, model) {
4509
+    var res, diff;
4510
+    if (model._isUTC) {
4511
+        res = model.clone();
4512
+        diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();
4513
+        // Use low-level api, because this fn is low-level api.
4514
+        res._d.setTime(res._d.valueOf() + diff);
4515
+        hooks.updateOffset(res, false);
4516
+        return res;
4517
+    } else {
4518
+        return createLocal(input).local();
4519
+    }
4520
+}
4521
+
4522
+function getDateOffset (m) {
4523
+    // On Firefox.24 Date#getTimezoneOffset returns a floating point.
4524
+    // https://github.com/moment/moment/pull/1871
4525
+    return -Math.round(m._d.getTimezoneOffset() / 15) * 15;
4526
+}
4527
+
4528
+// HOOKS
4529
+
4530
+// This function will be called whenever a moment is mutated.
4531
+// It is intended to keep the offset in sync with the timezone.
4532
+hooks.updateOffset = function () {};
4533
+
4534
+// MOMENTS
4535
+
4536
+// keepLocalTime = true means only change the timezone, without
4537
+// affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]-->
4538
+// 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset
4539
+// +0200, so we adjust the time as needed, to be valid.
4540
+//
4541
+// Keeping the time actually adds/subtracts (one hour)
4542
+// from the actual represented time. That is why we call updateOffset
4543
+// a second time. In case it wants us to change the offset again
4544
+// _changeInProgress == true case, then we have to adjust, because
4545
+// there is no such time in the given timezone.
4546
+function getSetOffset (input, keepLocalTime, keepMinutes) {
4547
+    var offset = this._offset || 0,
4548
+        localAdjust;
4549
+    if (!this.isValid()) {
4550
+        return input != null ? this : NaN;
4551
+    }
4552
+    if (input != null) {
4553
+        if (typeof input === 'string') {
4554
+            input = offsetFromString(matchShortOffset, input);
4555
+            if (input === null) {
4556
+                return this;
4557
+            }
4558
+        } else if (Math.abs(input) < 16 && !keepMinutes) {
4559
+            input = input * 60;
4560
+        }
4561
+        if (!this._isUTC && keepLocalTime) {
4562
+            localAdjust = getDateOffset(this);
4563
+        }
4564
+        this._offset = input;
4565
+        this._isUTC = true;
4566
+        if (localAdjust != null) {
4567
+            this.add(localAdjust, 'm');
4568
+        }
4569
+        if (offset !== input) {
4570
+            if (!keepLocalTime || this._changeInProgress) {
4571
+                addSubtract(this, createDuration(input - offset, 'm'), 1, false);
4572
+            } else if (!this._changeInProgress) {
4573
+                this._changeInProgress = true;
4574
+                hooks.updateOffset(this, true);
4575
+                this._changeInProgress = null;
4576
+            }
4577
+        }
4578
+        return this;
4579
+    } else {
4580
+        return this._isUTC ? offset : getDateOffset(this);
4581
+    }
4582
+}
4583
+
4584
+function getSetZone (input, keepLocalTime) {
4585
+    if (input != null) {
4586
+        if (typeof input !== 'string') {
4587
+            input = -input;
4588
+        }
4589
+
4590
+        this.utcOffset(input, keepLocalTime);
4591
+
4592
+        return this;
4593
+    } else {
4594
+        return -this.utcOffset();
4595
+    }
4596
+}
4597
+
4598
+function setOffsetToUTC (keepLocalTime) {
4599
+    return this.utcOffset(0, keepLocalTime);
4600
+}
4601
+
4602
+function setOffsetToLocal (keepLocalTime) {
4603
+    if (this._isUTC) {
4604
+        this.utcOffset(0, keepLocalTime);
4605
+        this._isUTC = false;
4606
+
4607
+        if (keepLocalTime) {
4608
+            this.subtract(getDateOffset(this), 'm');
4609
+        }
4610
+    }
4611
+    return this;
4612
+}
4613
+
4614
+function setOffsetToParsedOffset () {
4615
+    if (this._tzm != null) {
4616
+        this.utcOffset(this._tzm, false, true);
4617
+    } else if (typeof this._i === 'string') {
4618
+        var tZone = offsetFromString(matchOffset, this._i);
4619
+        if (tZone != null) {
4620
+            this.utcOffset(tZone);
4621
+        }
4622
+        else {
4623
+            this.utcOffset(0, true);
4624
+        }
4625
+    }
4626
+    return this;
4627
+}
4628
+
4629
+function hasAlignedHourOffset (input) {
4630
+    if (!this.isValid()) {
4631
+        return false;
4632
+    }
4633
+    input = input ? createLocal(input).utcOffset() : 0;
4634
+
4635
+    return (this.utcOffset() - input) % 60 === 0;
4636
+}
4637
+
4638
+function isDaylightSavingTime () {
4639
+    return (
4640
+        this.utcOffset() > this.clone().month(0).utcOffset() ||
4641
+        this.utcOffset() > this.clone().month(5).utcOffset()
4642
+    );
4643
+}
4644
+
4645
+function isDaylightSavingTimeShifted () {
4646
+    if (!isUndefined(this._isDSTShifted)) {
4647
+        return this._isDSTShifted;
4648
+    }
4649
+
4650
+    var c = {};
4651
+
4652
+    copyConfig(c, this);
4653
+    c = prepareConfig(c);
4654
+
4655
+    if (c._a) {
4656
+        var other = c._isUTC ? createUTC(c._a) : createLocal(c._a);
4657
+        this._isDSTShifted = this.isValid() &&
4658
+            compareArrays(c._a, other.toArray()) > 0;
4659
+    } else {
4660
+        this._isDSTShifted = false;
4661
+    }
4662
+
4663
+    return this._isDSTShifted;
4664
+}
4665
+
4666
+function isLocal () {
4667
+    return this.isValid() ? !this._isUTC : false;
4668
+}
4669
+
4670
+function isUtcOffset () {
4671
+    return this.isValid() ? this._isUTC : false;
4672
+}
4673
+
4674
+function isUtc () {
4675
+    return this.isValid() ? this._isUTC && this._offset === 0 : false;
4676
+}
4677
+
4678
+// ASP.NET json date format regex
4679
+var aspNetRegex = /^(\-|\+)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/;
4680
+
4681
+// from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html
4682
+// somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere
4683
+// and further modified to allow for strings containing both week and day
4684
+var isoRegex = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;
4685
+
4686
+function createDuration (input, key) {
4687
+    var duration = input,
4688
+        // matching against regexp is expensive, do it on demand
4689
+        match = null,
4690
+        sign,
4691
+        ret,
4692
+        diffRes;
4693
+
4694
+    if (isDuration(input)) {
4695
+        duration = {
4696
+            ms : input._milliseconds,
4697
+            d  : input._days,
4698
+            M  : input._months
4699
+        };
4700
+    } else if (isNumber(input)) {
4701
+        duration = {};
4702
+        if (key) {
4703
+            duration[key] = input;
4704
+        } else {
4705
+            duration.milliseconds = input;
4706
+        }
4707
+    } else if (!!(match = aspNetRegex.exec(input))) {
4708
+        sign = (match[1] === '-') ? -1 : 1;
4709
+        duration = {
4710
+            y  : 0,
4711
+            d  : toInt(match[DATE])                         * sign,
4712
+            h  : toInt(match[HOUR])                         * sign,
4713
+            m  : toInt(match[MINUTE])                       * sign,
4714
+            s  : toInt(match[SECOND])                       * sign,
4715
+            ms : toInt(absRound(match[MILLISECOND] * 1000)) * sign // the millisecond decimal point is included in the match
4716
+        };
4717
+    } else if (!!(match = isoRegex.exec(input))) {
4718
+        sign = (match[1] === '-') ? -1 : (match[1] === '+') ? 1 : 1;
4719
+        duration = {
4720
+            y : parseIso(match[2], sign),
4721
+            M : parseIso(match[3], sign),
4722
+            w : parseIso(match[4], sign),
4723
+            d : parseIso(match[5], sign),
4724
+            h : parseIso(match[6], sign),
4725
+            m : parseIso(match[7], sign),
4726
+            s : parseIso(match[8], sign)
4727
+        };
4728
+    } else if (duration == null) {// checks for null or undefined
4729
+        duration = {};
4730
+    } else if (typeof duration === 'object' && ('from' in duration || 'to' in duration)) {
4731
+        diffRes = momentsDifference(createLocal(duration.from), createLocal(duration.to));
4732
+
4733
+        duration = {};
4734
+        duration.ms = diffRes.milliseconds;
4735
+        duration.M = diffRes.months;
4736
+    }
4737
+
4738
+    ret = new Duration(duration);
4739
+
4740
+    if (isDuration(input) && hasOwnProp(input, '_locale')) {
4741
+        ret._locale = input._locale;
4742
+    }
4743
+
4744
+    return ret;
4745
+}
4746
+
4747
+createDuration.fn = Duration.prototype;
4748
+createDuration.invalid = createInvalid$1;
4749
+
4750
+function parseIso (inp, sign) {
4751
+    // We'd normally use ~~inp for this, but unfortunately it also
4752
+    // converts floats to ints.
4753
+    // inp may be undefined, so careful calling replace on it.
4754
+    var res = inp && parseFloat(inp.replace(',', '.'));
4755
+    // apply sign while we're at it
4756
+    return (isNaN(res) ? 0 : res) * sign;
4757
+}
4758
+
4759
+function positiveMomentsDifference(base, other) {
4760
+    var res = {milliseconds: 0, months: 0};
4761
+
4762
+    res.months = other.month() - base.month() +
4763
+        (other.year() - base.year()) * 12;
4764
+    if (base.clone().add(res.months, 'M').isAfter(other)) {
4765
+        --res.months;
4766
+    }
4767
+
4768
+    res.milliseconds = +other - +(base.clone().add(res.months, 'M'));
4769
+
4770
+    return res;
4771
+}
4772
+
4773
+function momentsDifference(base, other) {
4774
+    var res;
4775
+    if (!(base.isValid() && other.isValid())) {
4776
+        return {milliseconds: 0, months: 0};
4777
+    }
4778
+
4779
+    other = cloneWithOffset(other, base);
4780
+    if (base.isBefore(other)) {
4781
+        res = positiveMomentsDifference(base, other);
4782
+    } else {
4783
+        res = positiveMomentsDifference(other, base);
4784
+        res.milliseconds = -res.milliseconds;
4785
+        res.months = -res.months;
4786
+    }
4787
+
4788
+    return res;
4789
+}
4790
+
4791
+// TODO: remove 'name' arg after deprecation is removed
4792
+function createAdder(direction, name) {
4793
+    return function (val, period) {
4794
+        var dur, tmp;
4795
+        //invert the arguments, but complain about it
4796
+        if (period !== null && !isNaN(+period)) {
4797
+            deprecateSimple(name, 'moment().' + name  + '(period, number) is deprecated. Please use moment().' + name + '(number, period). ' +
4798
+            'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.');
4799
+            tmp = val; val = period; period = tmp;
4800
+        }
4801
+
4802
+        val = typeof val === 'string' ? +val : val;
4803
+        dur = createDuration(val, period);
4804
+        addSubtract(this, dur, direction);
4805
+        return this;
4806
+    };
4807
+}
4808
+
4809
+function addSubtract (mom, duration, isAdding, updateOffset) {
4810
+    var milliseconds = duration._milliseconds,
4811
+        days = absRound(duration._days),
4812
+        months = absRound(duration._months);
4813
+
4814
+    if (!mom.isValid()) {
4815
+        // No op
4816
+        return;
4817
+    }
4818
+
4819
+    updateOffset = updateOffset == null ? true : updateOffset;
4820
+
4821
+    if (months) {
4822
+        setMonth(mom, get(mom, 'Month') + months * isAdding);
4823
+    }
4824
+    if (days) {
4825
+        set$1(mom, 'Date', get(mom, 'Date') + days * isAdding);
4826
+    }
4827
+    if (milliseconds) {
4828
+        mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding);
4829
+    }
4830
+    if (updateOffset) {
4831
+        hooks.updateOffset(mom, days || months);
4832
+    }
4833
+}
4834
+
4835
+var add      = createAdder(1, 'add');
4836
+var subtract = createAdder(-1, 'subtract');
4837
+
4838
+function getCalendarFormat(myMoment, now) {
4839
+    var diff = myMoment.diff(now, 'days', true);
4840
+    return diff < -6 ? 'sameElse' :
4841
+            diff < -1 ? 'lastWeek' :
4842
+            diff < 0 ? 'lastDay' :
4843
+            diff < 1 ? 'sameDay' :
4844
+            diff < 2 ? 'nextDay' :
4845
+            diff < 7 ? 'nextWeek' : 'sameElse';
4846
+}
4847
+
4848
+function calendar$1 (time, formats) {
4849
+    // We want to compare the start of today, vs this.
4850
+    // Getting start-of-today depends on whether we're local/utc/offset or not.
4851
+    var now = time || createLocal(),
4852
+        sod = cloneWithOffset(now, this).startOf('day'),
4853
+        format = hooks.calendarFormat(this, sod) || 'sameElse';
4854
+
4855
+    var output = formats && (isFunction(formats[format]) ? formats[format].call(this, now) : formats[format]);
4856
+
4857
+    return this.format(output || this.localeData().calendar(format, this, createLocal(now)));
4858
+}
4859
+
4860
+function clone () {
4861
+    return new Moment(this);
4862
+}
4863
+
4864
+function isAfter (input, units) {
4865
+    var localInput = isMoment(input) ? input : createLocal(input);
4866
+    if (!(this.isValid() && localInput.isValid())) {
4867
+        return false;
4868
+    }
4869
+    units = normalizeUnits(!isUndefined(units) ? units : 'millisecond');
4870
+    if (units === 'millisecond') {
4871
+        return this.valueOf() > localInput.valueOf();
4872
+    } else {
4873
+        return localInput.valueOf() < this.clone().startOf(units).valueOf();
4874
+    }
4875
+}
4876
+
4877
+function isBefore (input, units) {
4878
+    var localInput = isMoment(input) ? input : createLocal(input);
4879
+    if (!(this.isValid() && localInput.isValid())) {
4880
+        return false;
4881
+    }
4882
+    units = normalizeUnits(!isUndefined(units) ? units : 'millisecond');
4883
+    if (units === 'millisecond') {
4884
+        return this.valueOf() < localInput.valueOf();
4885
+    } else {
4886
+        return this.clone().endOf(units).valueOf() < localInput.valueOf();
4887
+    }
4888
+}
4889
+
4890
+function isBetween (from, to, units, inclusivity) {
4891
+    inclusivity = inclusivity || '()';
4892
+    return (inclusivity[0] === '(' ? this.isAfter(from, units) : !this.isBefore(from, units)) &&
4893
+        (inclusivity[1] === ')' ? this.isBefore(to, units) : !this.isAfter(to, units));
4894
+}
4895
+
4896
+function isSame (input, units) {
4897
+    var localInput = isMoment(input) ? input : createLocal(input),
4898
+        inputMs;
4899
+    if (!(this.isValid() && localInput.isValid())) {
4900
+        return false;
4901
+    }
4902
+    units = normalizeUnits(units || 'millisecond');
4903
+    if (units === 'millisecond') {
4904
+        return this.valueOf() === localInput.valueOf();
4905
+    } else {
4906
+        inputMs = localInput.valueOf();
4907
+        return this.clone().startOf(units).valueOf() <= inputMs && inputMs <= this.clone().endOf(units).valueOf();
4908
+    }
4909
+}
4910
+
4911
+function isSameOrAfter (input, units) {
4912
+    return this.isSame(input, units) || this.isAfter(input,units);
4913
+}
4914
+
4915
+function isSameOrBefore (input, units) {
4916
+    return this.isSame(input, units) || this.isBefore(input,units);
4917
+}
4918
+
4919
+function diff (input, units, asFloat) {
4920
+    var that,
4921
+        zoneDelta,
4922
+        delta, output;
4923
+
4924
+    if (!this.isValid()) {
4925
+        return NaN;
4926
+    }
4927
+
4928
+    that = cloneWithOffset(input, this);
4929
+
4930
+    if (!that.isValid()) {
4931
+        return NaN;
4932
+    }
4933
+
4934
+    zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4;
4935
+
4936
+    units = normalizeUnits(units);
4937
+
4938
+    switch (units) {
4939
+        case 'year': output = monthDiff(this, that) / 12; break;
4940
+        case 'month': output = monthDiff(this, that); break;
4941
+        case 'quarter': output = monthDiff(this, that) / 3; break;
4942
+        case 'second': output = (this - that) / 1e3; break; // 1000
4943
+        case 'minute': output = (this - that) / 6e4; break; // 1000 * 60
4944
+        case 'hour': output = (this - that) / 36e5; break; // 1000 * 60 * 60
4945
+        case 'day': output = (this - that - zoneDelta) / 864e5; break; // 1000 * 60 * 60 * 24, negate dst
4946
+        case 'week': output = (this - that - zoneDelta) / 6048e5; break; // 1000 * 60 * 60 * 24 * 7, negate dst
4947
+        default: output = this - that;
4948
+    }
4949
+
4950
+    return asFloat ? output : absFloor(output);
4951
+}
4952
+
4953
+function monthDiff (a, b) {
4954
+    // difference in months
4955
+    var wholeMonthDiff = ((b.year() - a.year()) * 12) + (b.month() - a.month()),
4956
+        // b is in (anchor - 1 month, anchor + 1 month)
4957
+        anchor = a.clone().add(wholeMonthDiff, 'months'),
4958
+        anchor2, adjust;
4959
+
4960
+    if (b - anchor < 0) {
4961
+        anchor2 = a.clone().add(wholeMonthDiff - 1, 'months');
4962
+        // linear across the month
4963
+        adjust = (b - anchor) / (anchor - anchor2);
4964
+    } else {
4965
+        anchor2 = a.clone().add(wholeMonthDiff + 1, 'months');
4966
+        // linear across the month
4967
+        adjust = (b - anchor) / (anchor2 - anchor);
4968
+    }
4969
+
4970
+    //check for negative zero, return zero if negative zero
4971
+    return -(wholeMonthDiff + adjust) || 0;
4972
+}
4973
+
4974
+hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ';
4975
+hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]';
4976
+
4977
+function toString () {
4978
+    return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ');
4979
+}
4980
+
4981
+function toISOString(keepOffset) {
4982
+    if (!this.isValid()) {
4983
+        return null;
4984
+    }
4985
+    var utc = keepOffset !== true;
4986
+    var m = utc ? this.clone().utc() : this;
4987
+    if (m.year() < 0 || m.year() > 9999) {
4988
+        return formatMoment(m, utc ? 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYYYY-MM-DD[T]HH:mm:ss.SSSZ');
4989
+    }
4990
+    if (isFunction(Date.prototype.toISOString)) {
4991
+        // native implementation is ~50x faster, use it when we can
4992
+        if (utc) {
4993
+            return this.toDate().toISOString();
4994
+        } else {
4995
+            return new Date(this._d.valueOf()).toISOString().replace('Z', formatMoment(m, 'Z'));
4996
+        }
4997
+    }
4998
+    return formatMoment(m, utc ? 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYY-MM-DD[T]HH:mm:ss.SSSZ');
4999
+}
5000
+
5001
+/**
5002
+ * Return a human readable representation of a moment that can
5003
+ * also be evaluated to get a new moment which is the same
5004
+ *
5005
+ * @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects
5006
+ */
5007
+function inspect () {
5008
+    if (!this.isValid()) {
5009
+        return 'moment.invalid(/* ' + this._i + ' */)';
5010
+    }
5011
+    var func = 'moment';
5012
+    var zone = '';
5013
+    if (!this.isLocal()) {
5014
+        func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';
5015
+        zone = 'Z';
5016
+    }
5017
+    var prefix = '[' + func + '("]';
5018
+    var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';
5019
+    var datetime = '-MM-DD[T]HH:mm:ss.SSS';
5020
+    var suffix = zone + '[")]';
5021
+
5022
+    return this.format(prefix + year + datetime + suffix);
5023
+}
5024
+
5025
+function format (inputString) {
5026
+    if (!inputString) {
5027
+        inputString = this.isUtc() ? hooks.defaultFormatUtc : hooks.defaultFormat;
5028
+    }
5029
+    var output = formatMoment(this, inputString);
5030
+    return this.localeData().postformat(output);
5031
+}
5032
+
5033
+function from (time, withoutSuffix) {
5034
+    if (this.isValid() &&
5035
+            ((isMoment(time) && time.isValid()) ||
5036
+             createLocal(time).isValid())) {
5037
+        return createDuration({to: this, from: time}).locale(this.locale()).humanize(!withoutSuffix);
5038
+    } else {
5039
+        return this.localeData().invalidDate();
5040
+    }
5041
+}
5042
+
5043
+function fromNow (withoutSuffix) {
5044
+    return this.from(createLocal(), withoutSuffix);
5045
+}
5046
+
5047
+function to (time, withoutSuffix) {
5048
+    if (this.isValid() &&
5049
+            ((isMoment(time) && time.isValid()) ||
5050
+             createLocal(time).isValid())) {
5051
+        return createDuration({from: this, to: time}).locale(this.locale()).humanize(!withoutSuffix);
5052
+    } else {
5053
+        return this.localeData().invalidDate();
5054
+    }
5055
+}
5056
+
5057
+function toNow (withoutSuffix) {
5058
+    return this.to(createLocal(), withoutSuffix);
5059
+}
5060
+
5061
+// If passed a locale key, it will set the locale for this
5062
+// instance.  Otherwise, it will return the locale configuration
5063
+// variables for this instance.
5064
+function locale (key) {
5065
+    var newLocaleData;
5066
+
5067
+    if (key === undefined) {
5068
+        return this._locale._abbr;
5069
+    } else {
5070
+        newLocaleData = getLocale(key);
5071
+        if (newLocaleData != null) {
5072
+            this._locale = newLocaleData;
5073
+        }
5074
+        return this;
5075
+    }
5076
+}
5077
+
5078
+var lang = deprecate(
5079
+    'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.',
5080
+    function (key) {
5081
+        if (key === undefined) {
5082
+            return this.localeData();
5083
+        } else {
5084
+            return this.locale(key);
5085
+        }
5086
+    }
5087
+);
5088
+
5089
+function localeData () {
5090
+    return this._locale;
5091
+}
5092
+
5093
+function startOf (units) {
5094
+    units = normalizeUnits(units);
5095
+    // the following switch intentionally omits break keywords
5096
+    // to utilize falling through the cases.
5097
+    switch (units) {
5098
+        case 'year':
5099
+            this.month(0);
5100
+            /* falls through */
5101
+        case 'quarter':
5102
+        case 'month':
5103
+            this.date(1);
5104
+            /* falls through */
5105
+        case 'week':
5106
+        case 'isoWeek':
5107
+        case 'day':
5108
+        case 'date':
5109
+            this.hours(0);
5110
+            /* falls through */
5111
+        case 'hour':
5112
+            this.minutes(0);
5113
+            /* falls through */
5114
+        case 'minute':
5115
+            this.seconds(0);
5116
+            /* falls through */
5117
+        case 'second':
5118
+            this.milliseconds(0);
5119
+    }
5120
+
5121
+    // weeks are a special case
5122
+    if (units === 'week') {
5123
+        this.weekday(0);
5124
+    }
5125
+    if (units === 'isoWeek') {
5126
+        this.isoWeekday(1);
5127
+    }
5128
+
5129
+    // quarters are also special
5130
+    if (units === 'quarter') {
5131
+        this.month(Math.floor(this.month() / 3) * 3);
5132
+    }
5133
+
5134
+    return this;
5135
+}
5136
+
5137
+function endOf (units) {
5138
+    units = normalizeUnits(units);
5139
+    if (units === undefined || units === 'millisecond') {
5140
+        return this;
5141
+    }
5142
+
5143
+    // 'date' is an alias for 'day', so it should be considered as such.
5144
+    if (units === 'date') {
5145
+        units = 'day';
5146
+    }
5147
+
5148
+    return this.startOf(units).add(1, (units === 'isoWeek' ? 'week' : units)).subtract(1, 'ms');
5149
+}
5150
+
5151
+function valueOf () {
5152
+    return this._d.valueOf() - ((this._offset || 0) * 60000);
5153
+}
5154
+
5155
+function unix () {
5156
+    return Math.floor(this.valueOf() / 1000);
5157
+}
5158
+
5159
+function toDate () {
5160
+    return new Date(this.valueOf());
5161
+}
5162
+
5163
+function toArray () {
5164
+    var m = this;
5165
+    return [m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond()];
5166
+}
5167
+
5168
+function toObject () {
5169
+    var m = this;
5170
+    return {
5171
+        years: m.year(),
5172
+        months: m.month(),
5173
+        date: m.date(),
5174
+        hours: m.hours(),
5175
+        minutes: m.minutes(),
5176
+        seconds: m.seconds(),
5177
+        milliseconds: m.milliseconds()
5178
+    };
5179
+}
5180
+
5181
+function toJSON () {
5182
+    // new Date(NaN).toJSON() === null
5183
+    return this.isValid() ? this.toISOString() : null;
5184
+}
5185
+
5186
+function isValid$2 () {
5187
+    return isValid(this);
5188
+}
5189
+
5190
+function parsingFlags () {
5191
+    return extend({}, getParsingFlags(this));
5192
+}
5193
+
5194
+function invalidAt () {
5195
+    return getParsingFlags(this).overflow;
5196
+}
5197
+
5198
+function creationData() {
5199
+    return {
5200
+        input: this._i,
5201
+        format: this._f,
5202
+        locale: this._locale,
5203
+        isUTC: this._isUTC,
5204
+        strict: this._strict
5205
+    };
5206
+}
5207
+
5208
+// FORMATTING
5209
+
5210
+addFormatToken(0, ['gg', 2], 0, function () {
5211
+    return this.weekYear() % 100;
5212
+});
5213
+
5214
+addFormatToken(0, ['GG', 2], 0, function () {
5215
+    return this.isoWeekYear() % 100;
5216
+});
5217
+
5218
+function addWeekYearFormatToken (token, getter) {
5219
+    addFormatToken(0, [token, token.length], 0, getter);
5220
+}
5221
+
5222
+addWeekYearFormatToken('gggg',     'weekYear');
5223
+addWeekYearFormatToken('ggggg',    'weekYear');
5224
+addWeekYearFormatToken('GGGG',  'isoWeekYear');
5225
+addWeekYearFormatToken('GGGGG', 'isoWeekYear');
5226
+
5227
+// ALIASES
5228
+
5229
+addUnitAlias('weekYear', 'gg');
5230
+addUnitAlias('isoWeekYear', 'GG');
5231
+
5232
+// PRIORITY
5233
+
5234
+addUnitPriority('weekYear', 1);
5235
+addUnitPriority('isoWeekYear', 1);
5236
+
5237
+
5238
+// PARSING
5239
+
5240
+addRegexToken('G',      matchSigned);
5241
+addRegexToken('g',      matchSigned);
5242
+addRegexToken('GG',     match1to2, match2);
5243
+addRegexToken('gg',     match1to2, match2);
5244
+addRegexToken('GGGG',   match1to4, match4);
5245
+addRegexToken('gggg',   match1to4, match4);
5246
+addRegexToken('GGGGG',  match1to6, match6);
5247
+addRegexToken('ggggg',  match1to6, match6);
5248
+
5249
+addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (input, week, config, token) {
5250
+    week[token.substr(0, 2)] = toInt(input);
5251
+});
5252
+
5253
+addWeekParseToken(['gg', 'GG'], function (input, week, config, token) {
5254
+    week[token] = hooks.parseTwoDigitYear(input);
5255
+});
5256
+
5257
+// MOMENTS
5258
+
5259
+function getSetWeekYear (input) {
5260
+    return getSetWeekYearHelper.call(this,
5261
+            input,
5262
+            this.week(),
5263
+            this.weekday(),
5264
+            this.localeData()._week.dow,
5265
+            this.localeData()._week.doy);
5266
+}
5267
+
5268
+function getSetISOWeekYear (input) {
5269
+    return getSetWeekYearHelper.call(this,
5270
+            input, this.isoWeek(), this.isoWeekday(), 1, 4);
5271
+}
5272
+
5273
+function getISOWeeksInYear () {
5274
+    return weeksInYear(this.year(), 1, 4);
5275
+}
5276
+
5277
+function getWeeksInYear () {
5278
+    var weekInfo = this.localeData()._week;
5279
+    return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);
5280
+}
5281
+
5282
+function getSetWeekYearHelper(input, week, weekday, dow, doy) {
5283
+    var weeksTarget;
5284
+    if (input == null) {
5285
+        return weekOfYear(this, dow, doy).year;
5286
+    } else {
5287
+        weeksTarget = weeksInYear(input, dow, doy);
5288
+        if (week > weeksTarget) {
5289
+            week = weeksTarget;
5290
+        }
5291
+        return setWeekAll.call(this, input, week, weekday, dow, doy);
5292
+    }
5293
+}
5294
+
5295
+function setWeekAll(weekYear, week, weekday, dow, doy) {
5296
+    var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy),
5297
+        date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear);
5298
+
5299
+    this.year(date.getUTCFullYear());
5300
+    this.month(date.getUTCMonth());
5301
+    this.date(date.getUTCDate());
5302
+    return this;
5303
+}
5304
+
5305
+// FORMATTING
5306
+
5307
+addFormatToken('Q', 0, 'Qo', 'quarter');
5308
+
5309
+// ALIASES
5310
+
5311
+addUnitAlias('quarter', 'Q');
5312
+
5313
+// PRIORITY
5314
+
5315
+addUnitPriority('quarter', 7);
5316
+
5317
+// PARSING
5318
+
5319
+addRegexToken('Q', match1);
5320
+addParseToken('Q', function (input, array) {
5321
+    array[MONTH] = (toInt(input) - 1) * 3;
5322
+});
5323
+
5324
+// MOMENTS
5325
+
5326
+function getSetQuarter (input) {
5327
+    return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3);
5328
+}
5329
+
5330
+// FORMATTING
5331
+
5332
+addFormatToken('D', ['DD', 2], 'Do', 'date');
5333
+
5334
+// ALIASES
5335
+
5336
+addUnitAlias('date', 'D');
5337
+
5338
+// PRIOROITY
5339
+addUnitPriority('date', 9);
5340
+
5341
+// PARSING
5342
+
5343
+addRegexToken('D',  match1to2);
5344
+addRegexToken('DD', match1to2, match2);
5345
+addRegexToken('Do', function (isStrict, locale) {
5346
+    // TODO: Remove "ordinalParse" fallback in next major release.
5347
+    return isStrict ?
5348
+      (locale._dayOfMonthOrdinalParse || locale._ordinalParse) :
5349
+      locale._dayOfMonthOrdinalParseLenient;
5350
+});
5351
+
5352
+addParseToken(['D', 'DD'], DATE);
5353
+addParseToken('Do', function (input, array) {
5354
+    array[DATE] = toInt(input.match(match1to2)[0]);
5355
+});
5356
+
5357
+// MOMENTS
5358
+
5359
+var getSetDayOfMonth = makeGetSet('Date', true);
5360
+
5361
+// FORMATTING
5362
+
5363
+addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear');
5364
+
5365
+// ALIASES
5366
+
5367
+addUnitAlias('dayOfYear', 'DDD');
5368
+
5369
+// PRIORITY
5370
+addUnitPriority('dayOfYear', 4);
5371
+
5372
+// PARSING
5373
+
5374
+addRegexToken('DDD',  match1to3);
5375
+addRegexToken('DDDD', match3);
5376
+addParseToken(['DDD', 'DDDD'], function (input, array, config) {
5377
+    config._dayOfYear = toInt(input);
5378
+});
5379
+
5380
+// HELPERS
5381
+
5382
+// MOMENTS
5383
+
5384
+function getSetDayOfYear (input) {
5385
+    var dayOfYear = Math.round((this.clone().startOf('day') - this.clone().startOf('year')) / 864e5) + 1;
5386
+    return input == null ? dayOfYear : this.add((input - dayOfYear), 'd');
5387
+}
5388
+
5389
+// FORMATTING
5390
+
5391
+addFormatToken('m', ['mm', 2], 0, 'minute');
5392
+
5393
+// ALIASES
5394
+
5395
+addUnitAlias('minute', 'm');
5396
+
5397
+// PRIORITY
5398
+
5399
+addUnitPriority('minute', 14);
5400
+
5401
+// PARSING
5402
+
5403
+addRegexToken('m',  match1to2);
5404
+addRegexToken('mm', match1to2, match2);
5405
+addParseToken(['m', 'mm'], MINUTE);
5406
+
5407
+// MOMENTS
5408
+
5409
+var getSetMinute = makeGetSet('Minutes', false);
5410
+
5411
+// FORMATTING
5412
+
5413
+addFormatToken('s', ['ss', 2], 0, 'second');
5414
+
5415
+// ALIASES
5416
+
5417
+addUnitAlias('second', 's');
5418
+
5419
+// PRIORITY
5420
+
5421
+addUnitPriority('second', 15);
5422
+
5423
+// PARSING
5424
+
5425
+addRegexToken('s',  match1to2);
5426
+addRegexToken('ss', match1to2, match2);
5427
+addParseToken(['s', 'ss'], SECOND);
5428
+
5429
+// MOMENTS
5430
+
5431
+var getSetSecond = makeGetSet('Seconds', false);
5432
+
5433
+// FORMATTING
5434
+
5435
+addFormatToken('S', 0, 0, function () {
5436
+    return ~~(this.millisecond() / 100);
5437
+});
5438
+
5439
+addFormatToken(0, ['SS', 2], 0, function () {
5440
+    return ~~(this.millisecond() / 10);
5441
+});
5442
+
5443
+addFormatToken(0, ['SSS', 3], 0, 'millisecond');
5444
+addFormatToken(0, ['SSSS', 4], 0, function () {
5445
+    return this.millisecond() * 10;
5446
+});
5447
+addFormatToken(0, ['SSSSS', 5], 0, function () {
5448
+    return this.millisecond() * 100;
5449
+});
5450
+addFormatToken(0, ['SSSSSS', 6], 0, function () {
5451
+    return this.millisecond() * 1000;
5452
+});
5453
+addFormatToken(0, ['SSSSSSS', 7], 0, function () {
5454
+    return this.millisecond() * 10000;
5455
+});
5456
+addFormatToken(0, ['SSSSSSSS', 8], 0, function () {
5457
+    return this.millisecond() * 100000;
5458
+});
5459
+addFormatToken(0, ['SSSSSSSSS', 9], 0, function () {
5460
+    return this.millisecond() * 1000000;
5461
+});
5462
+
5463
+
5464
+// ALIASES
5465
+
5466
+addUnitAlias('millisecond', 'ms');
5467
+
5468
+// PRIORITY
5469
+
5470
+addUnitPriority('millisecond', 16);
5471
+
5472
+// PARSING
5473
+
5474
+addRegexToken('S',    match1to3, match1);
5475
+addRegexToken('SS',   match1to3, match2);
5476
+addRegexToken('SSS',  match1to3, match3);
5477
+
5478
+var token;
5479
+for (token = 'SSSS'; token.length <= 9; token += 'S') {
5480
+    addRegexToken(token, matchUnsigned);
5481
+}
5482
+
5483
+function parseMs(input, array) {
5484
+    array[MILLISECOND] = toInt(('0.' + input) * 1000);
5485
+}
5486
+
5487
+for (token = 'S'; token.length <= 9; token += 'S') {
5488
+    addParseToken(token, parseMs);
5489
+}
5490
+// MOMENTS
5491
+
5492
+var getSetMillisecond = makeGetSet('Milliseconds', false);
5493
+
5494
+// FORMATTING
5495
+
5496
+addFormatToken('z',  0, 0, 'zoneAbbr');
5497
+addFormatToken('zz', 0, 0, 'zoneName');
5498
+
5499
+// MOMENTS
5500
+
5501
+function getZoneAbbr () {
5502
+    return this._isUTC ? 'UTC' : '';
5503
+}
5504
+
5505
+function getZoneName () {
5506
+    return this._isUTC ? 'Coordinated Universal Time' : '';
5507
+}
5508
+
5509
+var proto = Moment.prototype;
5510
+
5511
+proto.add               = add;
5512
+proto.calendar          = calendar$1;
5513
+proto.clone             = clone;
5514
+proto.diff              = diff;
5515
+proto.endOf             = endOf;
5516
+proto.format            = format;
5517
+proto.from              = from;
5518
+proto.fromNow           = fromNow;
5519
+proto.to                = to;
5520
+proto.toNow             = toNow;
5521
+proto.get               = stringGet;
5522
+proto.invalidAt         = invalidAt;
5523
+proto.isAfter           = isAfter;
5524
+proto.isBefore          = isBefore;
5525
+proto.isBetween         = isBetween;
5526
+proto.isSame            = isSame;
5527
+proto.isSameOrAfter     = isSameOrAfter;
5528
+proto.isSameOrBefore    = isSameOrBefore;
5529
+proto.isValid           = isValid$2;
5530
+proto.lang              = lang;
5531
+proto.locale            = locale;
5532
+proto.localeData        = localeData;
5533
+proto.max               = prototypeMax;
5534
+proto.min               = prototypeMin;
5535
+proto.parsingFlags      = parsingFlags;
5536
+proto.set               = stringSet;
5537
+proto.startOf           = startOf;
5538
+proto.subtract          = subtract;
5539
+proto.toArray           = toArray;
5540
+proto.toObject          = toObject;
5541
+proto.toDate            = toDate;
5542
+proto.toISOString       = toISOString;
5543
+proto.inspect           = inspect;
5544
+proto.toJSON            = toJSON;
5545
+proto.toString          = toString;
5546
+proto.unix              = unix;
5547
+proto.valueOf           = valueOf;
5548
+proto.creationData      = creationData;
5549
+
5550
+// Year
5551
+proto.year       = getSetYear;
5552
+proto.isLeapYear = getIsLeapYear;
5553
+
5554
+// Week Year
5555
+proto.weekYear    = getSetWeekYear;
5556
+proto.isoWeekYear = getSetISOWeekYear;
5557
+
5558
+// Quarter
5559
+proto.quarter = proto.quarters = getSetQuarter;
5560
+
5561
+// Month
5562
+proto.month       = getSetMonth;
5563
+proto.daysInMonth = getDaysInMonth;
5564
+
5565
+// Week
5566
+proto.week           = proto.weeks        = getSetWeek;
5567
+proto.isoWeek        = proto.isoWeeks     = getSetISOWeek;
5568
+proto.weeksInYear    = getWeeksInYear;
5569
+proto.isoWeeksInYear = getISOWeeksInYear;
5570
+
5571
+// Day
5572
+proto.date       = getSetDayOfMonth;
5573
+proto.day        = proto.days             = getSetDayOfWeek;
5574
+proto.weekday    = getSetLocaleDayOfWeek;
5575
+proto.isoWeekday = getSetISODayOfWeek;
5576
+proto.dayOfYear  = getSetDayOfYear;
5577
+
5578
+// Hour
5579
+proto.hour = proto.hours = getSetHour;
5580
+
5581
+// Minute
5582
+proto.minute = proto.minutes = getSetMinute;
5583
+
5584
+// Second
5585
+proto.second = proto.seconds = getSetSecond;
5586
+
5587
+// Millisecond
5588
+proto.millisecond = proto.milliseconds = getSetMillisecond;
5589
+
5590
+// Offset
5591
+proto.utcOffset            = getSetOffset;
5592
+proto.utc                  = setOffsetToUTC;
5593
+proto.local                = setOffsetToLocal;
5594
+proto.parseZone            = setOffsetToParsedOffset;
5595
+proto.hasAlignedHourOffset = hasAlignedHourOffset;
5596
+proto.isDST                = isDaylightSavingTime;
5597
+proto.isLocal              = isLocal;
5598
+proto.isUtcOffset          = isUtcOffset;
5599
+proto.isUtc                = isUtc;
5600
+proto.isUTC                = isUtc;
5601
+
5602
+// Timezone
5603
+proto.zoneAbbr = getZoneAbbr;
5604
+proto.zoneName = getZoneName;
5605
+
5606
+// Deprecations
5607
+proto.dates  = deprecate('dates accessor is deprecated. Use date instead.', getSetDayOfMonth);
5608
+proto.months = deprecate('months accessor is deprecated. Use month instead', getSetMonth);
5609
+proto.years  = deprecate('years accessor is deprecated. Use year instead', getSetYear);
5610
+proto.zone   = deprecate('moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/', getSetZone);
5611
+proto.isDSTShifted = deprecate('isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information', isDaylightSavingTimeShifted);
5612
+
5613
+function createUnix (input) {
5614
+    return createLocal(input * 1000);
5615
+}
5616
+
5617
+function createInZone () {
5618
+    return createLocal.apply(null, arguments).parseZone();
5619
+}
5620
+
5621
+function preParsePostFormat (string) {
5622
+    return string;
5623
+}
5624
+
5625
+var proto$1 = Locale.prototype;
5626
+
5627
+proto$1.calendar        = calendar;
5628
+proto$1.longDateFormat  = longDateFormat;
5629
+proto$1.invalidDate     = invalidDate;
5630
+proto$1.ordinal         = ordinal;
5631
+proto$1.preparse        = preParsePostFormat;
5632
+proto$1.postformat      = preParsePostFormat;
5633
+proto$1.relativeTime    = relativeTime;
5634
+proto$1.pastFuture      = pastFuture;
5635
+proto$1.set             = set;
5636
+
5637
+// Month
5638
+proto$1.months            =        localeMonths;
5639
+proto$1.monthsShort       =        localeMonthsShort;
5640
+proto$1.monthsParse       =        localeMonthsParse;
5641
+proto$1.monthsRegex       = monthsRegex;
5642
+proto$1.monthsShortRegex  = monthsShortRegex;
5643
+
5644
+// Week
5645
+proto$1.week = localeWeek;
5646
+proto$1.firstDayOfYear = localeFirstDayOfYear;
5647
+proto$1.firstDayOfWeek = localeFirstDayOfWeek;
5648
+
5649
+// Day of Week
5650
+proto$1.weekdays       =        localeWeekdays;
5651
+proto$1.weekdaysMin    =        localeWeekdaysMin;
5652
+proto$1.weekdaysShort  =        localeWeekdaysShort;
5653
+proto$1.weekdaysParse  =        localeWeekdaysParse;
5654
+
5655
+proto$1.weekdaysRegex       =        weekdaysRegex;
5656
+proto$1.weekdaysShortRegex  =        weekdaysShortRegex;
5657
+proto$1.weekdaysMinRegex    =        weekdaysMinRegex;
5658
+
5659
+// Hours
5660
+proto$1.isPM = localeIsPM;
5661
+proto$1.meridiem = localeMeridiem;
5662
+
5663
+function get$1 (format, index, field, setter) {
5664
+    var locale = getLocale();
5665
+    var utc = createUTC().set(setter, index);
5666
+    return locale[field](utc, format);
5667
+}
5668
+
5669
+function listMonthsImpl (format, index, field) {
5670
+    if (isNumber(format)) {
5671
+        index = format;
5672
+        format = undefined;
5673
+    }
5674
+
5675
+    format = format || '';
5676
+
5677
+    if (index != null) {
5678
+        return get$1(format, index, field, 'month');
5679
+    }
5680
+
5681
+    var i;
5682
+    var out = [];
5683
+    for (i = 0; i < 12; i++) {
5684
+        out[i] = get$1(format, i, field, 'month');
5685
+    }
5686
+    return out;
5687
+}
5688
+
5689
+// ()
5690
+// (5)
5691
+// (fmt, 5)
5692
+// (fmt)
5693
+// (true)
5694
+// (true, 5)
5695
+// (true, fmt, 5)
5696
+// (true, fmt)
5697
+function listWeekdaysImpl (localeSorted, format, index, field) {
5698
+    if (typeof localeSorted === 'boolean') {
5699
+        if (isNumber(format)) {
5700
+            index = format;
5701
+            format = undefined;
5702
+        }
5703
+
5704
+        format = format || '';
5705
+    } else {
5706
+        format = localeSorted;
5707
+        index = format;
5708
+        localeSorted = false;
5709
+
5710
+        if (isNumber(format)) {
5711
+            index = format;
5712
+            format = undefined;
5713
+        }
5714
+
5715
+        format = format || '';
5716
+    }
5717
+
5718
+    var locale = getLocale(),
5719
+        shift = localeSorted ? locale._week.dow : 0;
5720
+
5721
+    if (index != null) {
5722
+        return get$1(format, (index + shift) % 7, field, 'day');
5723
+    }
5724
+
5725
+    var i;
5726
+    var out = [];
5727
+    for (i = 0; i < 7; i++) {
5728
+        out[i] = get$1(format, (i + shift) % 7, field, 'day');
5729
+    }
5730
+    return out;
5731
+}
5732
+
5733
+function listMonths (format, index) {
5734
+    return listMonthsImpl(format, index, 'months');
5735
+}
5736
+
5737
+function listMonthsShort (format, index) {
5738
+    return listMonthsImpl(format, index, 'monthsShort');
5739
+}
5740
+
5741
+function listWeekdays (localeSorted, format, index) {
5742
+    return listWeekdaysImpl(localeSorted, format, index, 'weekdays');
5743
+}
5744
+
5745
+function listWeekdaysShort (localeSorted, format, index) {
5746
+    return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort');
5747
+}
5748
+
5749
+function listWeekdaysMin (localeSorted, format, index) {
5750
+    return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin');
5751
+}
5752
+
5753
+getSetGlobalLocale('en', {
5754
+    dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/,
5755
+    ordinal : function (number) {
5756
+        var b = number % 10,
5757
+            output = (toInt(number % 100 / 10) === 1) ? 'th' :
5758
+            (b === 1) ? 'st' :
5759
+            (b === 2) ? 'nd' :
5760
+            (b === 3) ? 'rd' : 'th';
5761
+        return number + output;
5762
+    }
5763
+});
5764
+
5765
+// Side effect imports
5766
+hooks.lang = deprecate('moment.lang is deprecated. Use moment.locale instead.', getSetGlobalLocale);
5767
+hooks.langData = deprecate('moment.langData is deprecated. Use moment.localeData instead.', getLocale);
5768
+
5769
+var mathAbs = Math.abs;
5770
+
5771
+function abs () {
5772
+    var data           = this._data;
5773
+
5774
+    this._milliseconds = mathAbs(this._milliseconds);
5775
+    this._days         = mathAbs(this._days);
5776
+    this._months       = mathAbs(this._months);
5777
+
5778
+    data.milliseconds  = mathAbs(data.milliseconds);
5779
+    data.seconds       = mathAbs(data.seconds);
5780
+    data.minutes       = mathAbs(data.minutes);
5781
+    data.hours         = mathAbs(data.hours);
5782
+    data.months        = mathAbs(data.months);
5783
+    data.years         = mathAbs(data.years);
5784
+
5785
+    return this;
5786
+}
5787
+
5788
+function addSubtract$1 (duration, input, value, direction) {
5789
+    var other = createDuration(input, value);
5790
+
5791
+    duration._milliseconds += direction * other._milliseconds;
5792
+    duration._days         += direction * other._days;
5793
+    duration._months       += direction * other._months;
5794
+
5795
+    return duration._bubble();
5796
+}
5797
+
5798
+// supports only 2.0-style add(1, 's') or add(duration)
5799
+function add$1 (input, value) {
5800
+    return addSubtract$1(this, input, value, 1);
5801
+}
5802
+
5803
+// supports only 2.0-style subtract(1, 's') or subtract(duration)
5804
+function subtract$1 (input, value) {
5805
+    return addSubtract$1(this, input, value, -1);
5806
+}
5807
+
5808
+function absCeil (number) {
5809
+    if (number < 0) {
5810
+        return Math.floor(number);
5811
+    } else {
5812
+        return Math.ceil(number);
5813
+    }
5814
+}
5815
+
5816
+function bubble () {
5817
+    var milliseconds = this._milliseconds;
5818
+    var days         = this._days;
5819
+    var months       = this._months;
5820
+    var data         = this._data;
5821
+    var seconds, minutes, hours, years, monthsFromDays;
5822
+
5823
+    // if we have a mix of positive and negative values, bubble down first
5824
+    // check: https://github.com/moment/moment/issues/2166
5825
+    if (!((milliseconds >= 0 && days >= 0 && months >= 0) ||
5826
+            (milliseconds <= 0 && days <= 0 && months <= 0))) {
5827
+        milliseconds += absCeil(monthsToDays(months) + days) * 864e5;
5828
+        days = 0;
5829
+        months = 0;
5830
+    }
5831
+
5832
+    // The following code bubbles up values, see the tests for
5833
+    // examples of what that means.
5834
+    data.milliseconds = milliseconds % 1000;
5835
+
5836
+    seconds           = absFloor(milliseconds / 1000);
5837
+    data.seconds      = seconds % 60;
5838
+
5839
+    minutes           = absFloor(seconds / 60);
5840
+    data.minutes      = minutes % 60;
5841
+
5842
+    hours             = absFloor(minutes / 60);
5843
+    data.hours        = hours % 24;
5844
+
5845
+    days += absFloor(hours / 24);
5846
+
5847
+    // convert days to months
5848
+    monthsFromDays = absFloor(daysToMonths(days));
5849
+    months += monthsFromDays;
5850
+    days -= absCeil(monthsToDays(monthsFromDays));
5851
+
5852
+    // 12 months -> 1 year
5853
+    years = absFloor(months / 12);
5854
+    months %= 12;
5855
+
5856
+    data.days   = days;
5857
+    data.months = months;
5858
+    data.years  = years;
5859
+
5860
+    return this;
5861
+}
5862
+
5863
+function daysToMonths (days) {
5864
+    // 400 years have 146097 days (taking into account leap year rules)
5865
+    // 400 years have 12 months === 4800
5866
+    return days * 4800 / 146097;
5867
+}
5868
+
5869
+function monthsToDays (months) {
5870
+    // the reverse of daysToMonths
5871
+    return months * 146097 / 4800;
5872
+}
5873
+
5874
+function as (units) {
5875
+    if (!this.isValid()) {
5876
+        return NaN;
5877
+    }
5878
+    var days;
5879
+    var months;
5880
+    var milliseconds = this._milliseconds;
5881
+
5882
+    units = normalizeUnits(units);
5883
+
5884
+    if (units === 'month' || units === 'year') {
5885
+        days   = this._days   + milliseconds / 864e5;
5886
+        months = this._months + daysToMonths(days);
5887
+        return units === 'month' ? months : months / 12;
5888
+    } else {
5889
+        // handle milliseconds separately because of floating point math errors (issue #1867)
5890
+        days = this._days + Math.round(monthsToDays(this._months));
5891
+        switch (units) {
5892
+            case 'week'   : return days / 7     + milliseconds / 6048e5;
5893
+            case 'day'    : return days         + milliseconds / 864e5;
5894
+            case 'hour'   : return days * 24    + milliseconds / 36e5;
5895
+            case 'minute' : return days * 1440  + milliseconds / 6e4;
5896
+            case 'second' : return days * 86400 + milliseconds / 1000;
5897
+            // Math.floor prevents floating point math errors here
5898
+            case 'millisecond': return Math.floor(days * 864e5) + milliseconds;
5899
+            default: throw new Error('Unknown unit ' + units);
5900
+        }
5901
+    }
5902
+}
5903
+
5904
+// TODO: Use this.as('ms')?
5905
+function valueOf$1 () {
5906
+    if (!this.isValid()) {
5907
+        return NaN;
5908
+    }
5909
+    return (
5910
+        this._milliseconds +
5911
+        this._days * 864e5 +
5912
+        (this._months % 12) * 2592e6 +
5913
+        toInt(this._months / 12) * 31536e6
5914
+    );
5915
+}
5916
+
5917
+function makeAs (alias) {
5918
+    return function () {
5919
+        return this.as(alias);
5920
+    };
5921
+}
5922
+
5923
+var asMilliseconds = makeAs('ms');
5924
+var asSeconds      = makeAs('s');
5925
+var asMinutes      = makeAs('m');
5926
+var asHours        = makeAs('h');
5927
+var asDays         = makeAs('d');
5928
+var asWeeks        = makeAs('w');
5929
+var asMonths       = makeAs('M');
5930
+var asYears        = makeAs('y');
5931
+
5932
+function clone$1 () {
5933
+    return createDuration(this);
5934
+}
5935
+
5936
+function get$2 (units) {
5937
+    units = normalizeUnits(units);
5938
+    return this.isValid() ? this[units + 's']() : NaN;
5939
+}
5940
+
5941
+function makeGetter(name) {
5942
+    return function () {
5943
+        return this.isValid() ? this._data[name] : NaN;
5944
+    };
5945
+}
5946
+
5947
+var milliseconds = makeGetter('milliseconds');
5948
+var seconds      = makeGetter('seconds');
5949
+var minutes      = makeGetter('minutes');
5950
+var hours        = makeGetter('hours');
5951
+var days         = makeGetter('days');
5952
+var months       = makeGetter('months');
5953
+var years        = makeGetter('years');
5954
+
5955
+function weeks () {
5956
+    return absFloor(this.days() / 7);
5957
+}
5958
+
5959
+var round = Math.round;
5960
+var thresholds = {
5961
+    ss: 44,         // a few seconds to seconds
5962
+    s : 45,         // seconds to minute
5963
+    m : 45,         // minutes to hour
5964
+    h : 22,         // hours to day
5965
+    d : 26,         // days to month
5966
+    M : 11          // months to year
5967
+};
5968
+
5969
+// helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize
5970
+function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) {
5971
+    return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
5972
+}
5973
+
5974
+function relativeTime$1 (posNegDuration, withoutSuffix, locale) {
5975
+    var duration = createDuration(posNegDuration).abs();
5976
+    var seconds  = round(duration.as('s'));
5977
+    var minutes  = round(duration.as('m'));
5978
+    var hours    = round(duration.as('h'));
5979
+    var days     = round(duration.as('d'));
5980
+    var months   = round(duration.as('M'));
5981
+    var years    = round(duration.as('y'));
5982
+
5983
+    var a = seconds <= thresholds.ss && ['s', seconds]  ||
5984
+            seconds < thresholds.s   && ['ss', seconds] ||
5985
+            minutes <= 1             && ['m']           ||
5986
+            minutes < thresholds.m   && ['mm', minutes] ||
5987
+            hours   <= 1             && ['h']           ||
5988
+            hours   < thresholds.h   && ['hh', hours]   ||
5989
+            days    <= 1             && ['d']           ||
5990
+            days    < thresholds.d   && ['dd', days]    ||
5991
+            months  <= 1             && ['M']           ||
5992
+            months  < thresholds.M   && ['MM', months]  ||
5993
+            years   <= 1             && ['y']           || ['yy', years];
5994
+
5995
+    a[2] = withoutSuffix;
5996
+    a[3] = +posNegDuration > 0;
5997
+    a[4] = locale;
5998
+    return substituteTimeAgo.apply(null, a);
5999
+}
6000
+
6001
+// This function allows you to set the rounding function for relative time strings
6002
+function getSetRelativeTimeRounding (roundingFunction) {
6003
+    if (roundingFunction === undefined) {
6004
+        return round;
6005
+    }
6006
+    if (typeof(roundingFunction) === 'function') {
6007
+        round = roundingFunction;
6008
+        return true;
6009
+    }
6010
+    return false;
6011
+}
6012
+
6013
+// This function allows you to set a threshold for relative time strings
6014
+function getSetRelativeTimeThreshold (threshold, limit) {
6015
+    if (thresholds[threshold] === undefined) {
6016
+        return false;
6017
+    }
6018
+    if (limit === undefined) {
6019
+        return thresholds[threshold];
6020
+    }
6021
+    thresholds[threshold] = limit;
6022
+    if (threshold === 's') {
6023
+        thresholds.ss = limit - 1;
6024
+    }
6025
+    return true;
6026
+}
6027
+
6028
+function humanize (withSuffix) {
6029
+    if (!this.isValid()) {
6030
+        return this.localeData().invalidDate();
6031
+    }
6032
+
6033
+    var locale = this.localeData();
6034
+    var output = relativeTime$1(this, !withSuffix, locale);
6035
+
6036
+    if (withSuffix) {
6037
+        output = locale.pastFuture(+this, output);
6038
+    }
6039
+
6040
+    return locale.postformat(output);
6041
+}
6042
+
6043
+var abs$1 = Math.abs;
6044
+
6045
+function sign(x) {
6046
+    return ((x > 0) - (x < 0)) || +x;
6047
+}
6048
+
6049
+function toISOString$1() {
6050
+    // for ISO strings we do not use the normal bubbling rules:
6051
+    //  * milliseconds bubble up until they become hours
6052
+    //  * days do not bubble at all
6053
+    //  * months bubble up until they become years
6054
+    // This is because there is no context-free conversion between hours and days
6055
+    // (think of clock changes)
6056
+    // and also not between days and months (28-31 days per month)
6057
+    if (!this.isValid()) {
6058
+        return this.localeData().invalidDate();
6059
+    }
6060
+
6061
+    var seconds = abs$1(this._milliseconds) / 1000;
6062
+    var days         = abs$1(this._days);
6063
+    var months       = abs$1(this._months);
6064
+    var minutes, hours, years;
6065
+
6066
+    // 3600 seconds -> 60 minutes -> 1 hour
6067
+    minutes           = absFloor(seconds / 60);
6068
+    hours             = absFloor(minutes / 60);
6069
+    seconds %= 60;
6070
+    minutes %= 60;
6071
+
6072
+    // 12 months -> 1 year
6073
+    years  = absFloor(months / 12);
6074
+    months %= 12;
6075
+
6076
+
6077
+    // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js
6078
+    var Y = years;
6079
+    var M = months;
6080
+    var D = days;
6081
+    var h = hours;
6082
+    var m = minutes;
6083
+    var s = seconds ? seconds.toFixed(3).replace(/\.?0+$/, '') : '';
6084
+    var total = this.asSeconds();
6085
+
6086
+    if (!total) {
6087
+        // this is the same as C#'s (Noda) and python (isodate)...
6088
+        // but not other JS (goog.date)
6089
+        return 'P0D';
6090
+    }
6091
+
6092
+    var totalSign = total < 0 ? '-' : '';
6093
+    var ymSign = sign(this._months) !== sign(total) ? '-' : '';
6094
+    var daysSign = sign(this._days) !== sign(total) ? '-' : '';
6095
+    var hmsSign = sign(this._milliseconds) !== sign(total) ? '-' : '';
6096
+
6097
+    return totalSign + 'P' +
6098
+        (Y ? ymSign + Y + 'Y' : '') +
6099
+        (M ? ymSign + M + 'M' : '') +
6100
+        (D ? daysSign + D + 'D' : '') +
6101
+        ((h || m || s) ? 'T' : '') +
6102
+        (h ? hmsSign + h + 'H' : '') +
6103
+        (m ? hmsSign + m + 'M' : '') +
6104
+        (s ? hmsSign + s + 'S' : '');
6105
+}
6106
+
6107
+var proto$2 = Duration.prototype;
6108
+
6109
+proto$2.isValid        = isValid$1;
6110
+proto$2.abs            = abs;
6111
+proto$2.add            = add$1;
6112
+proto$2.subtract       = subtract$1;
6113
+proto$2.as             = as;
6114
+proto$2.asMilliseconds = asMilliseconds;
6115
+proto$2.asSeconds      = asSeconds;
6116
+proto$2.asMinutes      = asMinutes;
6117
+proto$2.asHours        = asHours;
6118
+proto$2.asDays         = asDays;
6119
+proto$2.asWeeks        = asWeeks;
6120
+proto$2.asMonths       = asMonths;
6121
+proto$2.asYears        = asYears;
6122
+proto$2.valueOf        = valueOf$1;
6123
+proto$2._bubble        = bubble;
6124
+proto$2.clone          = clone$1;
6125
+proto$2.get            = get$2;
6126
+proto$2.milliseconds   = milliseconds;
6127
+proto$2.seconds        = seconds;
6128
+proto$2.minutes        = minutes;
6129
+proto$2.hours          = hours;
6130
+proto$2.days           = days;
6131
+proto$2.weeks          = weeks;
6132
+proto$2.months         = months;
6133
+proto$2.years          = years;
6134
+proto$2.humanize       = humanize;
6135
+proto$2.toISOString    = toISOString$1;
6136
+proto$2.toString       = toISOString$1;
6137
+proto$2.toJSON         = toISOString$1;
6138
+proto$2.locale         = locale;
6139
+proto$2.localeData     = localeData;
6140
+
6141
+// Deprecations
6142
+proto$2.toIsoString = deprecate('toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', toISOString$1);
6143
+proto$2.lang = lang;
6144
+
6145
+// Side effect imports
6146
+
6147
+// FORMATTING
6148
+
6149
+addFormatToken('X', 0, 0, 'unix');
6150
+addFormatToken('x', 0, 0, 'valueOf');
6151
+
6152
+// PARSING
6153
+
6154
+addRegexToken('x', matchSigned);
6155
+addRegexToken('X', matchTimestamp);
6156
+addParseToken('X', function (input, array, config) {
6157
+    config._d = new Date(parseFloat(input, 10) * 1000);
6158
+});
6159
+addParseToken('x', function (input, array, config) {
6160
+    config._d = new Date(toInt(input));
6161
+});
6162
+
6163
+// Side effect imports
6164
+
6165
+
6166
+hooks.version = '2.20.1';
6167
+
6168
+setHookCallback(createLocal);
6169
+
6170
+hooks.fn                    = proto;
6171
+hooks.min                   = min;
6172
+hooks.max                   = max;
6173
+hooks.now                   = now;
6174
+hooks.utc                   = createUTC;
6175
+hooks.unix                  = createUnix;
6176
+hooks.months                = listMonths;
6177
+hooks.isDate                = isDate;
6178
+hooks.locale                = getSetGlobalLocale;
6179
+hooks.invalid               = createInvalid;
6180
+hooks.duration              = createDuration;
6181
+hooks.isMoment              = isMoment;
6182
+hooks.weekdays              = listWeekdays;
6183
+hooks.parseZone             = createInZone;
6184
+hooks.localeData            = getLocale;
6185
+hooks.isDuration            = isDuration;
6186
+hooks.monthsShort           = listMonthsShort;
6187
+hooks.weekdaysMin           = listWeekdaysMin;
6188
+hooks.defineLocale          = defineLocale;
6189
+hooks.updateLocale          = updateLocale;
6190
+hooks.locales               = listLocales;
6191
+hooks.weekdaysShort         = listWeekdaysShort;
6192
+hooks.normalizeUnits        = normalizeUnits;
6193
+hooks.relativeTimeRounding  = getSetRelativeTimeRounding;
6194
+hooks.relativeTimeThreshold = getSetRelativeTimeThreshold;
6195
+hooks.calendarFormat        = getCalendarFormat;
6196
+hooks.prototype             = proto;
6197
+
6198
+// currently HTML5 input type only supports 24-hour formats
6199
+hooks.HTML5_FMT = {
6200
+    DATETIME_LOCAL: 'YYYY-MM-DDTHH:mm',             // <input type="datetime-local" />
6201
+    DATETIME_LOCAL_SECONDS: 'YYYY-MM-DDTHH:mm:ss',  // <input type="datetime-local" step="1" />
6202
+    DATETIME_LOCAL_MS: 'YYYY-MM-DDTHH:mm:ss.SSS',   // <input type="datetime-local" step="0.001" />
6203
+    DATE: 'YYYY-MM-DD',                             // <input type="date" />
6204
+    TIME: 'HH:mm',                                  // <input type="time" />
6205
+    TIME_SECONDS: 'HH:mm:ss',                       // <input type="time" step="1" />
6206
+    TIME_MS: 'HH:mm:ss.SSS',                        // <input type="time" step="0.001" />
6207
+    WEEK: 'YYYY-[W]WW',                             // <input type="week" />
6208
+    MONTH: 'YYYY-MM'                                // <input type="month" />
6209
+};
6210
+
6211
+return hooks;
6212
+
6213
+})));
6214
+
6215
+},{}],7:[function(require,module,exports){
6216
+/**
6217
+ * @namespace Chart
6218
+ */
6219
+var Chart = require(29)();
6220
+
6221
+Chart.helpers = require(45);
6222
+
6223
+// @todo dispatch these helpers into appropriated helpers/helpers.* file and write unit tests!
6224
+require(27)(Chart);
6225
+
6226
+Chart.defaults = require(25);
6227
+Chart.Element = require(26);
6228
+Chart.elements = require(40);
6229
+Chart.Interaction = require(28);
6230
+Chart.layouts = require(30);
6231
+Chart.platform = require(48);
6232
+Chart.plugins = require(31);
6233
+Chart.Ticks = require(34);
6234
+
6235
+require(22)(Chart);
6236
+require(23)(Chart);
6237
+require(24)(Chart);
6238
+require(33)(Chart);
6239
+require(32)(Chart);
6240
+require(35)(Chart);
6241
+
6242
+require(55)(Chart);
6243
+require(53)(Chart);
6244
+require(54)(Chart);
6245
+require(56)(Chart);
6246
+require(57)(Chart);
6247
+require(58)(Chart);
6248
+
6249
+// Controllers must be loaded after elements
6250
+// See Chart.core.datasetController.dataElementType
6251
+require(15)(Chart);
6252
+require(16)(Chart);
6253
+require(17)(Chart);
6254
+require(18)(Chart);
6255
+require(19)(Chart);
6256
+require(20)(Chart);
6257
+require(21)(Chart);
6258
+
6259
+require(8)(Chart);
6260
+require(9)(Chart);
6261
+require(10)(Chart);
6262
+require(11)(Chart);
6263
+require(12)(Chart);
6264
+require(13)(Chart);
6265
+require(14)(Chart);
6266
+
6267
+// Loading built-it plugins
6268
+var plugins = require(49);
6269
+for (var k in plugins) {
6270
+	if (plugins.hasOwnProperty(k)) {
6271
+		Chart.plugins.register(plugins[k]);
6272
+	}
6273
+}
6274
+
6275
+Chart.platform.initialize();
6276
+
6277
+module.exports = Chart;
6278
+if (typeof window !== 'undefined') {
6279
+	window.Chart = Chart;
6280
+}
6281
+
6282
+// DEPRECATIONS
6283
+
6284
+/**
6285
+ * Provided for backward compatibility, not available anymore
6286
+ * @namespace Chart.Legend
6287
+ * @deprecated since version 2.1.5
6288
+ * @todo remove at version 3
6289
+ * @private
6290
+ */
6291
+Chart.Legend = plugins.legend._element;
6292
+
6293
+/**
6294
+ * Provided for backward compatibility, not available anymore
6295
+ * @namespace Chart.Title
6296
+ * @deprecated since version 2.1.5
6297
+ * @todo remove at version 3
6298
+ * @private
6299
+ */
6300
+Chart.Title = plugins.title._element;
6301
+
6302
+/**
6303
+ * Provided for backward compatibility, use Chart.plugins instead
6304
+ * @namespace Chart.pluginService
6305
+ * @deprecated since version 2.1.5
6306
+ * @todo remove at version 3
6307
+ * @private
6308
+ */
6309
+Chart.pluginService = Chart.plugins;
6310
+
6311
+/**
6312
+ * Provided for backward compatibility, inheriting from Chart.PlugingBase has no
6313
+ * effect, instead simply create/register plugins via plain JavaScript objects.
6314
+ * @interface Chart.PluginBase
6315
+ * @deprecated since version 2.5.0
6316
+ * @todo remove at version 3
6317
+ * @private
6318
+ */
6319
+Chart.PluginBase = Chart.Element.extend({});
6320
+
6321
+/**
6322
+ * Provided for backward compatibility, use Chart.helpers.canvas instead.
6323
+ * @namespace Chart.canvasHelpers
6324
+ * @deprecated since version 2.6.0
6325
+ * @todo remove at version 3
6326
+ * @private
6327
+ */
6328
+Chart.canvasHelpers = Chart.helpers.canvas;
6329
+
6330
+/**
6331
+ * Provided for backward compatibility, use Chart.layouts instead.
6332
+ * @namespace Chart.layoutService
6333
+ * @deprecated since version 2.8.0
6334
+ * @todo remove at version 3
6335
+ * @private
6336
+ */
6337
+Chart.layoutService = Chart.layouts;
6338
+
6339
+},{"10":10,"11":11,"12":12,"13":13,"14":14,"15":15,"16":16,"17":17,"18":18,"19":19,"20":20,"21":21,"22":22,"23":23,"24":24,"25":25,"26":26,"27":27,"28":28,"29":29,"30":30,"31":31,"32":32,"33":33,"34":34,"35":35,"40":40,"45":45,"48":48,"49":49,"53":53,"54":54,"55":55,"56":56,"57":57,"58":58,"8":8,"9":9}],8:[function(require,module,exports){
6340
+'use strict';
6341
+
6342
+module.exports = function(Chart) {
6343
+
6344
+	Chart.Bar = function(context, config) {
6345
+		config.type = 'bar';
6346
+
6347
+		return new Chart(context, config);
6348
+	};
6349
+
6350
+};
6351
+
6352
+},{}],9:[function(require,module,exports){
6353
+'use strict';
6354
+
6355
+module.exports = function(Chart) {
6356
+
6357
+	Chart.Bubble = function(context, config) {
6358
+		config.type = 'bubble';
6359
+		return new Chart(context, config);
6360
+	};
6361
+
6362
+};
6363
+
6364
+},{}],10:[function(require,module,exports){
6365
+'use strict';
6366
+
6367
+module.exports = function(Chart) {
6368
+
6369
+	Chart.Doughnut = function(context, config) {
6370
+		config.type = 'doughnut';
6371
+
6372
+		return new Chart(context, config);
6373
+	};
6374
+
6375
+};
6376
+
6377
+},{}],11:[function(require,module,exports){
6378
+'use strict';
6379
+
6380
+module.exports = function(Chart) {
6381
+
6382
+	Chart.Line = function(context, config) {
6383
+		config.type = 'line';
6384
+
6385
+		return new Chart(context, config);
6386
+	};
6387
+
6388
+};
6389
+
6390
+},{}],12:[function(require,module,exports){
6391
+'use strict';
6392
+
6393
+module.exports = function(Chart) {
6394
+
6395
+	Chart.PolarArea = function(context, config) {
6396
+		config.type = 'polarArea';
6397
+
6398
+		return new Chart(context, config);
6399
+	};
6400
+
6401
+};
6402
+
6403
+},{}],13:[function(require,module,exports){
6404
+'use strict';
6405
+
6406
+module.exports = function(Chart) {
6407
+
6408
+	Chart.Radar = function(context, config) {
6409
+		config.type = 'radar';
6410
+
6411
+		return new Chart(context, config);
6412
+	};
6413
+
6414
+};
6415
+
6416
+},{}],14:[function(require,module,exports){
6417
+'use strict';
6418
+
6419
+module.exports = function(Chart) {
6420
+	Chart.Scatter = function(context, config) {
6421
+		config.type = 'scatter';
6422
+		return new Chart(context, config);
6423
+	};
6424
+};
6425
+
6426
+},{}],15:[function(require,module,exports){
6427
+'use strict';
6428
+
6429
+var defaults = require(25);
6430
+var elements = require(40);
6431
+var helpers = require(45);
6432
+
6433
+defaults._set('bar', {
6434
+	hover: {
6435
+		mode: 'label'
6436
+	},
6437
+
6438
+	scales: {
6439
+		xAxes: [{
6440
+			type: 'category',
6441
+
6442
+			// Specific to Bar Controller
6443
+			categoryPercentage: 0.8,
6444
+			barPercentage: 0.9,
6445
+
6446
+			// offset settings
6447
+			offset: true,
6448
+
6449
+			// grid line settings
6450
+			gridLines: {
6451
+				offsetGridLines: true
6452
+			}
6453
+		}],
6454
+
6455
+		yAxes: [{
6456
+			type: 'linear'
6457
+		}]
6458
+	}
6459
+});
6460
+
6461
+defaults._set('horizontalBar', {
6462
+	hover: {
6463
+		mode: 'index',
6464
+		axis: 'y'
6465
+	},
6466
+
6467
+	scales: {
6468
+		xAxes: [{
6469
+			type: 'linear',
6470
+			position: 'bottom'
6471
+		}],
6472
+
6473
+		yAxes: [{
6474
+			position: 'left',
6475
+			type: 'category',
6476
+
6477
+			// Specific to Horizontal Bar Controller
6478
+			categoryPercentage: 0.8,
6479
+			barPercentage: 0.9,
6480
+
6481
+			// offset settings
6482
+			offset: true,
6483
+
6484
+			// grid line settings
6485
+			gridLines: {
6486
+				offsetGridLines: true
6487
+			}
6488
+		}]
6489
+	},
6490
+
6491
+	elements: {
6492
+		rectangle: {
6493
+			borderSkipped: 'left'
6494
+		}
6495
+	},
6496
+
6497
+	tooltips: {
6498
+		callbacks: {
6499
+			title: function(item, data) {
6500
+				// Pick first xLabel for now
6501
+				var title = '';
6502
+
6503
+				if (item.length > 0) {
6504
+					if (item[0].yLabel) {
6505
+						title = item[0].yLabel;
6506
+					} else if (data.labels.length > 0 && item[0].index < data.labels.length) {
6507
+						title = data.labels[item[0].index];
6508
+					}
6509
+				}
6510
+
6511
+				return title;
6512
+			},
6513
+
6514
+			label: function(item, data) {
6515
+				var datasetLabel = data.datasets[item.datasetIndex].label || '';
6516
+				return datasetLabel + ': ' + item.xLabel;
6517
+			}
6518
+		},
6519
+		mode: 'index',
6520
+		axis: 'y'
6521
+	}
6522
+});
6523
+
6524
+/**
6525
+ * Computes the "optimal" sample size to maintain bars equally sized while preventing overlap.
6526
+ * @private
6527
+ */
6528
+function computeMinSampleSize(scale, pixels) {
6529
+	var min = scale.isHorizontal() ? scale.width : scale.height;
6530
+	var ticks = scale.getTicks();
6531
+	var prev, curr, i, ilen;
6532
+
6533
+	for (i = 1, ilen = pixels.length; i < ilen; ++i) {
6534
+		min = Math.min(min, pixels[i] - pixels[i - 1]);
6535
+	}
6536
+
6537
+	for (i = 0, ilen = ticks.length; i < ilen; ++i) {
6538
+		curr = scale.getPixelForTick(i);
6539
+		min = i > 0 ? Math.min(min, curr - prev) : min;
6540
+		prev = curr;
6541
+	}
6542
+
6543
+	return min;
6544
+}
6545
+
6546
+/**
6547
+ * Computes an "ideal" category based on the absolute bar thickness or, if undefined or null,
6548
+ * uses the smallest interval (see computeMinSampleSize) that prevents bar overlapping. This
6549
+ * mode currently always generates bars equally sized (until we introduce scriptable options?).
6550
+ * @private
6551
+ */
6552
+function computeFitCategoryTraits(index, ruler, options) {
6553
+	var thickness = options.barThickness;
6554
+	var count = ruler.stackCount;
6555
+	var curr = ruler.pixels[index];
6556
+	var size, ratio;
6557
+
6558
+	if (helpers.isNullOrUndef(thickness)) {
6559
+		size = ruler.min * options.categoryPercentage;
6560
+		ratio = options.barPercentage;
6561
+	} else {
6562
+		// When bar thickness is enforced, category and bar percentages are ignored.
6563
+		// Note(SB): we could add support for relative bar thickness (e.g. barThickness: '50%')
6564
+		// and deprecate barPercentage since this value is ignored when thickness is absolute.
6565
+		size = thickness * count;
6566
+		ratio = 1;
6567
+	}
6568
+
6569
+	return {
6570
+		chunk: size / count,
6571
+		ratio: ratio,
6572
+		start: curr - (size / 2)
6573
+	};
6574
+}
6575
+
6576
+/**
6577
+ * Computes an "optimal" category that globally arranges bars side by side (no gap when
6578
+ * percentage options are 1), based on the previous and following categories. This mode
6579
+ * generates bars with different widths when data are not evenly spaced.
6580
+ * @private
6581
+ */
6582
+function computeFlexCategoryTraits(index, ruler, options) {
6583
+	var pixels = ruler.pixels;
6584
+	var curr = pixels[index];
6585
+	var prev = index > 0 ? pixels[index - 1] : null;
6586
+	var next = index < pixels.length - 1 ? pixels[index + 1] : null;
6587
+	var percent = options.categoryPercentage;
6588
+	var start, size;
6589
+
6590
+	if (prev === null) {
6591
+		// first data: its size is double based on the next point or,
6592
+		// if it's also the last data, we use the scale end extremity.
6593
+		prev = curr - (next === null ? ruler.end - curr : next - curr);
6594
+	}
6595
+
6596
+	if (next === null) {
6597
+		// last data: its size is also double based on the previous point.
6598
+		next = curr + curr - prev;
6599
+	}
6600
+
6601
+	start = curr - ((curr - prev) / 2) * percent;
6602
+	size = ((next - prev) / 2) * percent;
6603
+
6604
+	return {
6605
+		chunk: size / ruler.stackCount,
6606
+		ratio: options.barPercentage,
6607
+		start: start
6608
+	};
6609
+}
6610
+
6611
+module.exports = function(Chart) {
6612
+
6613
+	Chart.controllers.bar = Chart.DatasetController.extend({
6614
+
6615
+		dataElementType: elements.Rectangle,
6616
+
6617
+		initialize: function() {
6618
+			var me = this;
6619
+			var meta;
6620
+
6621
+			Chart.DatasetController.prototype.initialize.apply(me, arguments);
6622
+
6623
+			meta = me.getMeta();
6624
+			meta.stack = me.getDataset().stack;
6625
+			meta.bar = true;
6626
+		},
6627
+
6628
+		update: function(reset) {
6629
+			var me = this;
6630
+			var rects = me.getMeta().data;
6631
+			var i, ilen;
6632
+
6633
+			me._ruler = me.getRuler();
6634
+
6635
+			for (i = 0, ilen = rects.length; i < ilen; ++i) {
6636
+				me.updateElement(rects[i], i, reset);
6637
+			}
6638
+		},
6639
+
6640
+		updateElement: function(rectangle, index, reset) {
6641
+			var me = this;
6642
+			var chart = me.chart;
6643
+			var meta = me.getMeta();
6644
+			var dataset = me.getDataset();
6645
+			var custom = rectangle.custom || {};
6646
+			var rectangleOptions = chart.options.elements.rectangle;
6647
+
6648
+			rectangle._xScale = me.getScaleForId(meta.xAxisID);
6649
+			rectangle._yScale = me.getScaleForId(meta.yAxisID);
6650
+			rectangle._datasetIndex = me.index;
6651
+			rectangle._index = index;
6652
+
6653
+			rectangle._model = {
6654
+				datasetLabel: dataset.label,
6655
+				label: chart.data.labels[index],
6656
+				borderSkipped: custom.borderSkipped ? custom.borderSkipped : rectangleOptions.borderSkipped,
6657
+				backgroundColor: custom.backgroundColor ? custom.backgroundColor : helpers.valueAtIndexOrDefault(dataset.backgroundColor, index, rectangleOptions.backgroundColor),
6658
+				borderColor: custom.borderColor ? custom.borderColor : helpers.valueAtIndexOrDefault(dataset.borderColor, index, rectangleOptions.borderColor),
6659
+				borderWidth: custom.borderWidth ? custom.borderWidth : helpers.valueAtIndexOrDefault(dataset.borderWidth, index, rectangleOptions.borderWidth)
6660
+			};
6661
+
6662
+			me.updateElementGeometry(rectangle, index, reset);
6663
+
6664
+			rectangle.pivot();
6665
+		},
6666
+
6667
+		/**
6668
+		 * @private
6669
+		 */
6670
+		updateElementGeometry: function(rectangle, index, reset) {
6671
+			var me = this;
6672
+			var model = rectangle._model;
6673
+			var vscale = me.getValueScale();
6674
+			var base = vscale.getBasePixel();
6675
+			var horizontal = vscale.isHorizontal();
6676
+			var ruler = me._ruler || me.getRuler();
6677
+			var vpixels = me.calculateBarValuePixels(me.index, index);
6678
+			var ipixels = me.calculateBarIndexPixels(me.index, index, ruler);
6679
+
6680
+			model.horizontal = horizontal;
6681
+			model.base = reset ? base : vpixels.base;
6682
+			model.x = horizontal ? reset ? base : vpixels.head : ipixels.center;
6683
+			model.y = horizontal ? ipixels.center : reset ? base : vpixels.head;
6684
+			model.height = horizontal ? ipixels.size : undefined;
6685
+			model.width = horizontal ? undefined : ipixels.size;
6686
+		},
6687
+
6688
+		/**
6689
+		 * @private
6690
+		 */
6691
+		getValueScaleId: function() {
6692
+			return this.getMeta().yAxisID;
6693
+		},
6694
+
6695
+		/**
6696
+		 * @private
6697
+		 */
6698
+		getIndexScaleId: function() {
6699
+			return this.getMeta().xAxisID;
6700
+		},
6701
+
6702
+		/**
6703
+		 * @private
6704
+		 */
6705
+		getValueScale: function() {
6706
+			return this.getScaleForId(this.getValueScaleId());
6707
+		},
6708
+
6709
+		/**
6710
+		 * @private
6711
+		 */
6712
+		getIndexScale: function() {
6713
+			return this.getScaleForId(this.getIndexScaleId());
6714
+		},
6715
+
6716
+		/**
6717
+		 * Returns the stacks based on groups and bar visibility.
6718
+		 * @param {Number} [last] - The dataset index
6719
+		 * @returns {Array} The stack list
6720
+		 * @private
6721
+		 */
6722
+		_getStacks: function(last) {
6723
+			var me = this;
6724
+			var chart = me.chart;
6725
+			var scale = me.getIndexScale();
6726
+			var stacked = scale.options.stacked;
6727
+			var ilen = last === undefined ? chart.data.datasets.length : last + 1;
6728
+			var stacks = [];
6729
+			var i, meta;
6730
+
6731
+			for (i = 0; i < ilen; ++i) {
6732
+				meta = chart.getDatasetMeta(i);
6733
+				if (meta.bar && chart.isDatasetVisible(i) &&
6734
+					(stacked === false ||
6735
+					(stacked === true && stacks.indexOf(meta.stack) === -1) ||
6736
+					(stacked === undefined && (meta.stack === undefined || stacks.indexOf(meta.stack) === -1)))) {
6737
+					stacks.push(meta.stack);
6738
+				}
6739
+			}
6740
+
6741
+			return stacks;
6742
+		},
6743
+
6744
+		/**
6745
+		 * Returns the effective number of stacks based on groups and bar visibility.
6746
+		 * @private
6747
+		 */
6748
+		getStackCount: function() {
6749
+			return this._getStacks().length;
6750
+		},
6751
+
6752
+		/**
6753
+		 * Returns the stack index for the given dataset based on groups and bar visibility.
6754
+		 * @param {Number} [datasetIndex] - The dataset index
6755
+		 * @param {String} [name] - The stack name to find
6756
+		 * @returns {Number} The stack index
6757
+		 * @private
6758
+		 */
6759
+		getStackIndex: function(datasetIndex, name) {
6760
+			var stacks = this._getStacks(datasetIndex);
6761
+			var index = (name !== undefined)
6762
+				? stacks.indexOf(name)
6763
+				: -1; // indexOf returns -1 if element is not present
6764
+
6765
+			return (index === -1)
6766
+				? stacks.length - 1
6767
+				: index;
6768
+		},
6769
+
6770
+		/**
6771
+		 * @private
6772
+		 */
6773
+		getRuler: function() {
6774
+			var me = this;
6775
+			var scale = me.getIndexScale();
6776
+			var stackCount = me.getStackCount();
6777
+			var datasetIndex = me.index;
6778
+			var isHorizontal = scale.isHorizontal();
6779
+			var start = isHorizontal ? scale.left : scale.top;
6780
+			var end = start + (isHorizontal ? scale.width : scale.height);
6781
+			var pixels = [];
6782
+			var i, ilen, min;
6783
+
6784
+			for (i = 0, ilen = me.getMeta().data.length; i < ilen; ++i) {
6785
+				pixels.push(scale.getPixelForValue(null, i, datasetIndex));
6786
+			}
6787
+
6788
+			min = helpers.isNullOrUndef(scale.options.barThickness)
6789
+				? computeMinSampleSize(scale, pixels)
6790
+				: -1;
6791
+
6792
+			return {
6793
+				min: min,
6794
+				pixels: pixels,
6795
+				start: start,
6796
+				end: end,
6797
+				stackCount: stackCount,
6798
+				scale: scale
6799
+			};
6800
+		},
6801
+
6802
+		/**
6803
+		 * Note: pixel values are not clamped to the scale area.
6804
+		 * @private
6805
+		 */
6806
+		calculateBarValuePixels: function(datasetIndex, index) {
6807
+			var me = this;
6808
+			var chart = me.chart;
6809
+			var meta = me.getMeta();
6810
+			var scale = me.getValueScale();
6811
+			var datasets = chart.data.datasets;
6812
+			var value = scale.getRightValue(datasets[datasetIndex].data[index]);
6813
+			var stacked = scale.options.stacked;
6814
+			var stack = meta.stack;
6815
+			var start = 0;
6816
+			var i, imeta, ivalue, base, head, size;
6817
+
6818
+			if (stacked || (stacked === undefined && stack !== undefined)) {
6819
+				for (i = 0; i < datasetIndex; ++i) {
6820
+					imeta = chart.getDatasetMeta(i);
6821
+
6822
+					if (imeta.bar &&
6823
+						imeta.stack === stack &&
6824
+						imeta.controller.getValueScaleId() === scale.id &&
6825
+						chart.isDatasetVisible(i)) {
6826
+
6827
+						ivalue = scale.getRightValue(datasets[i].data[index]);
6828
+						if ((value < 0 && ivalue < 0) || (value >= 0 && ivalue > 0)) {
6829
+							start += ivalue;
6830
+						}
6831
+					}
6832
+				}
6833
+			}
6834
+
6835
+			base = scale.getPixelForValue(start);
6836
+			head = scale.getPixelForValue(start + value);
6837
+			size = (head - base) / 2;
6838
+
6839
+			return {
6840
+				size: size,
6841
+				base: base,
6842
+				head: head,
6843
+				center: head + size / 2
6844
+			};
6845
+		},
6846
+
6847
+		/**
6848
+		 * @private
6849
+		 */
6850
+		calculateBarIndexPixels: function(datasetIndex, index, ruler) {
6851
+			var me = this;
6852
+			var options = ruler.scale.options;
6853
+			var range = options.barThickness === 'flex'
6854
+				? computeFlexCategoryTraits(index, ruler, options)
6855
+				: computeFitCategoryTraits(index, ruler, options);
6856
+
6857
+			var stackIndex = me.getStackIndex(datasetIndex, me.getMeta().stack);
6858
+			var center = range.start + (range.chunk * stackIndex) + (range.chunk / 2);
6859
+			var size = Math.min(
6860
+				helpers.valueOrDefault(options.maxBarThickness, Infinity),
6861
+				range.chunk * range.ratio);
6862
+
6863
+			return {
6864
+				base: center - size / 2,
6865
+				head: center + size / 2,
6866
+				center: center,
6867
+				size: size
6868
+			};
6869
+		},
6870
+
6871
+		draw: function() {
6872
+			var me = this;
6873
+			var chart = me.chart;
6874
+			var scale = me.getValueScale();
6875
+			var rects = me.getMeta().data;
6876
+			var dataset = me.getDataset();
6877
+			var ilen = rects.length;
6878
+			var i = 0;
6879
+
6880
+			helpers.canvas.clipArea(chart.ctx, chart.chartArea);
6881
+
6882
+			for (; i < ilen; ++i) {
6883
+				if (!isNaN(scale.getRightValue(dataset.data[i]))) {
6884
+					rects[i].draw();
6885
+				}
6886
+			}
6887
+
6888
+			helpers.canvas.unclipArea(chart.ctx);
6889
+		},
6890
+
6891
+		setHoverStyle: function(rectangle) {
6892
+			var dataset = this.chart.data.datasets[rectangle._datasetIndex];
6893
+			var index = rectangle._index;
6894
+			var custom = rectangle.custom || {};
6895
+			var model = rectangle._model;
6896
+
6897
+			model.backgroundColor = custom.hoverBackgroundColor ? custom.hoverBackgroundColor : helpers.valueAtIndexOrDefault(dataset.hoverBackgroundColor, index, helpers.getHoverColor(model.backgroundColor));
6898
+			model.borderColor = custom.hoverBorderColor ? custom.hoverBorderColor : helpers.valueAtIndexOrDefault(dataset.hoverBorderColor, index, helpers.getHoverColor(model.borderColor));
6899
+			model.borderWidth = custom.hoverBorderWidth ? custom.hoverBorderWidth : helpers.valueAtIndexOrDefault(dataset.hoverBorderWidth, index, model.borderWidth);
6900
+		},
6901
+
6902
+		removeHoverStyle: function(rectangle) {
6903
+			var dataset = this.chart.data.datasets[rectangle._datasetIndex];
6904
+			var index = rectangle._index;
6905
+			var custom = rectangle.custom || {};
6906
+			var model = rectangle._model;
6907
+			var rectangleElementOptions = this.chart.options.elements.rectangle;
6908
+
6909
+			model.backgroundColor = custom.backgroundColor ? custom.backgroundColor : helpers.valueAtIndexOrDefault(dataset.backgroundColor, index, rectangleElementOptions.backgroundColor);
6910
+			model.borderColor = custom.borderColor ? custom.borderColor : helpers.valueAtIndexOrDefault(dataset.borderColor, index, rectangleElementOptions.borderColor);
6911
+			model.borderWidth = custom.borderWidth ? custom.borderWidth : helpers.valueAtIndexOrDefault(dataset.borderWidth, index, rectangleElementOptions.borderWidth);
6912
+		}
6913
+	});
6914
+
6915
+	Chart.controllers.horizontalBar = Chart.controllers.bar.extend({
6916
+		/**
6917
+		 * @private
6918
+		 */
6919
+		getValueScaleId: function() {
6920
+			return this.getMeta().xAxisID;
6921
+		},
6922
+
6923
+		/**
6924
+		 * @private
6925
+		 */
6926
+		getIndexScaleId: function() {
6927
+			return this.getMeta().yAxisID;
6928
+		}
6929
+	});
6930
+};
6931
+
6932
+},{"25":25,"40":40,"45":45}],16:[function(require,module,exports){
6933
+'use strict';
6934
+
6935
+var defaults = require(25);
6936
+var elements = require(40);
6937
+var helpers = require(45);
6938
+
6939
+defaults._set('bubble', {
6940
+	hover: {
6941
+		mode: 'single'
6942
+	},
6943
+
6944
+	scales: {
6945
+		xAxes: [{
6946
+			type: 'linear', // bubble should probably use a linear scale by default
6947
+			position: 'bottom',
6948
+			id: 'x-axis-0' // need an ID so datasets can reference the scale
6949
+		}],
6950
+		yAxes: [{
6951
+			type: 'linear',
6952
+			position: 'left',
6953
+			id: 'y-axis-0'
6954
+		}]
6955
+	},
6956
+
6957
+	tooltips: {
6958
+		callbacks: {
6959
+			title: function() {
6960
+				// Title doesn't make sense for scatter since we format the data as a point
6961
+				return '';
6962
+			},
6963
+			label: function(item, data) {
6964
+				var datasetLabel = data.datasets[item.datasetIndex].label || '';
6965
+				var dataPoint = data.datasets[item.datasetIndex].data[item.index];
6966
+				return datasetLabel + ': (' + item.xLabel + ', ' + item.yLabel + ', ' + dataPoint.r + ')';
6967
+			}
6968
+		}
6969
+	}
6970
+});
6971
+
6972
+
6973
+module.exports = function(Chart) {
6974
+
6975
+	Chart.controllers.bubble = Chart.DatasetController.extend({
6976
+		/**
6977
+		 * @protected
6978
+		 */
6979
+		dataElementType: elements.Point,
6980
+
6981
+		/**
6982
+		 * @protected
6983
+		 */
6984
+		update: function(reset) {
6985
+			var me = this;
6986
+			var meta = me.getMeta();
6987
+			var points = meta.data;
6988
+
6989
+			// Update Points
6990
+			helpers.each(points, function(point, index) {
6991
+				me.updateElement(point, index, reset);
6992
+			});
6993
+		},
6994
+
6995
+		/**
6996
+		 * @protected
6997
+		 */
6998
+		updateElement: function(point, index, reset) {
6999
+			var me = this;
7000
+			var meta = me.getMeta();
7001
+			var custom = point.custom || {};
7002
+			var xScale = me.getScaleForId(meta.xAxisID);
7003
+			var yScale = me.getScaleForId(meta.yAxisID);
7004
+			var options = me._resolveElementOptions(point, index);
7005
+			var data = me.getDataset().data[index];
7006
+			var dsIndex = me.index;
7007
+
7008
+			var x = reset ? xScale.getPixelForDecimal(0.5) : xScale.getPixelForValue(typeof data === 'object' ? data : NaN, index, dsIndex);
7009
+			var y = reset ? yScale.getBasePixel() : yScale.getPixelForValue(data, index, dsIndex);
7010
+
7011
+			point._xScale = xScale;
7012
+			point._yScale = yScale;
7013
+			point._options = options;
7014
+			point._datasetIndex = dsIndex;
7015
+			point._index = index;
7016
+			point._model = {
7017
+				backgroundColor: options.backgroundColor,
7018
+				borderColor: options.borderColor,
7019
+				borderWidth: options.borderWidth,
7020
+				hitRadius: options.hitRadius,
7021
+				pointStyle: options.pointStyle,
7022
+				radius: reset ? 0 : options.radius,
7023
+				skip: custom.skip || isNaN(x) || isNaN(y),
7024
+				x: x,
7025
+				y: y,
7026
+			};
7027
+
7028
+			point.pivot();
7029
+		},
7030
+
7031
+		/**
7032
+		 * @protected
7033
+		 */
7034
+		setHoverStyle: function(point) {
7035
+			var model = point._model;
7036
+			var options = point._options;
7037
+
7038
+			model.backgroundColor = helpers.valueOrDefault(options.hoverBackgroundColor, helpers.getHoverColor(options.backgroundColor));
7039
+			model.borderColor = helpers.valueOrDefault(options.hoverBorderColor, helpers.getHoverColor(options.borderColor));
7040
+			model.borderWidth = helpers.valueOrDefault(options.hoverBorderWidth, options.borderWidth);
7041
+			model.radius = options.radius + options.hoverRadius;
7042
+		},
7043
+
7044
+		/**
7045
+		 * @protected
7046
+		 */
7047
+		removeHoverStyle: function(point) {
7048
+			var model = point._model;
7049
+			var options = point._options;
7050
+
7051
+			model.backgroundColor = options.backgroundColor;
7052
+			model.borderColor = options.borderColor;
7053
+			model.borderWidth = options.borderWidth;
7054
+			model.radius = options.radius;
7055
+		},
7056
+
7057
+		/**
7058
+		 * @private
7059
+		 */
7060
+		_resolveElementOptions: function(point, index) {
7061
+			var me = this;
7062
+			var chart = me.chart;
7063
+			var datasets = chart.data.datasets;
7064
+			var dataset = datasets[me.index];
7065
+			var custom = point.custom || {};
7066
+			var options = chart.options.elements.point;
7067
+			var resolve = helpers.options.resolve;
7068
+			var data = dataset.data[index];
7069
+			var values = {};
7070
+			var i, ilen, key;
7071
+
7072
+			// Scriptable options
7073
+			var context = {
7074
+				chart: chart,
7075
+				dataIndex: index,
7076
+				dataset: dataset,
7077
+				datasetIndex: me.index
7078
+			};
7079
+
7080
+			var keys = [
7081
+				'backgroundColor',
7082
+				'borderColor',
7083
+				'borderWidth',
7084
+				'hoverBackgroundColor',
7085
+				'hoverBorderColor',
7086
+				'hoverBorderWidth',
7087
+				'hoverRadius',
7088
+				'hitRadius',
7089
+				'pointStyle'
7090
+			];
7091
+
7092
+			for (i = 0, ilen = keys.length; i < ilen; ++i) {
7093
+				key = keys[i];
7094
+				values[key] = resolve([
7095
+					custom[key],
7096
+					dataset[key],
7097
+					options[key]
7098
+				], context, index);
7099
+			}
7100
+
7101
+			// Custom radius resolution
7102
+			values.radius = resolve([
7103
+				custom.radius,
7104
+				data ? data.r : undefined,
7105
+				dataset.radius,
7106
+				options.radius
7107
+			], context, index);
7108
+
7109
+			return values;
7110
+		}
7111
+	});
7112
+};
7113
+
7114
+},{"25":25,"40":40,"45":45}],17:[function(require,module,exports){
7115
+'use strict';
7116
+
7117
+var defaults = require(25);
7118
+var elements = require(40);
7119
+var helpers = require(45);
7120
+
7121
+defaults._set('doughnut', {
7122
+	animation: {
7123
+		// Boolean - Whether we animate the rotation of the Doughnut
7124
+		animateRotate: true,
7125
+		// Boolean - Whether we animate scaling the Doughnut from the centre
7126
+		animateScale: false
7127
+	},
7128
+	hover: {
7129
+		mode: 'single'
7130
+	},
7131
+	legendCallback: function(chart) {
7132
+		var text = [];
7133
+		text.push('<ul class="' + chart.id + '-legend">');
7134
+
7135
+		var data = chart.data;
7136
+		var datasets = data.datasets;
7137
+		var labels = data.labels;
7138
+
7139
+		if (datasets.length) {
7140
+			for (var i = 0; i < datasets[0].data.length; ++i) {
7141
+				text.push('<li><span style="background-color:' + datasets[0].backgroundColor[i] + '"></span>');
7142
+				if (labels[i]) {
7143
+					text.push(labels[i]);
7144
+				}
7145
+				text.push('</li>');
7146
+			}
7147
+		}
7148
+
7149
+		text.push('</ul>');
7150
+		return text.join('');
7151
+	},
7152
+	legend: {
7153
+		labels: {
7154
+			generateLabels: function(chart) {
7155
+				var data = chart.data;
7156
+				if (data.labels.length && data.datasets.length) {
7157
+					return data.labels.map(function(label, i) {
7158
+						var meta = chart.getDatasetMeta(0);
7159
+						var ds = data.datasets[0];
7160
+						var arc = meta.data[i];
7161
+						var custom = arc && arc.custom || {};
7162
+						var valueAtIndexOrDefault = helpers.valueAtIndexOrDefault;
7163
+						var arcOpts = chart.options.elements.arc;
7164
+						var fill = custom.backgroundColor ? custom.backgroundColor : valueAtIndexOrDefault(ds.backgroundColor, i, arcOpts.backgroundColor);
7165
+						var stroke = custom.borderColor ? custom.borderColor : valueAtIndexOrDefault(ds.borderColor, i, arcOpts.borderColor);
7166
+						var bw = custom.borderWidth ? custom.borderWidth : valueAtIndexOrDefault(ds.borderWidth, i, arcOpts.borderWidth);
7167
+
7168
+						return {
7169
+							text: label,
7170
+							fillStyle: fill,
7171
+							strokeStyle: stroke,
7172
+							lineWidth: bw,
7173
+							hidden: isNaN(ds.data[i]) || meta.data[i].hidden,
7174
+
7175
+							// Extra data used for toggling the correct item
7176
+							index: i
7177
+						};
7178
+					});
7179
+				}
7180
+				return [];
7181
+			}
7182
+		},
7183
+
7184
+		onClick: function(e, legendItem) {
7185
+			var index = legendItem.index;
7186
+			var chart = this.chart;
7187
+			var i, ilen, meta;
7188
+
7189
+			for (i = 0, ilen = (chart.data.datasets || []).length; i < ilen; ++i) {
7190
+				meta = chart.getDatasetMeta(i);
7191
+				// toggle visibility of index if exists
7192
+				if (meta.data[index]) {
7193
+					meta.data[index].hidden = !meta.data[index].hidden;
7194
+				}
7195
+			}
7196
+
7197
+			chart.update();
7198
+		}
7199
+	},
7200
+
7201
+	// The percentage of the chart that we cut out of the middle.
7202
+	cutoutPercentage: 50,
7203
+
7204
+	// The rotation of the chart, where the first data arc begins.
7205
+	rotation: Math.PI * -0.5,
7206
+
7207
+	// The total circumference of the chart.
7208
+	circumference: Math.PI * 2.0,
7209
+
7210
+	// Need to override these to give a nice default
7211
+	tooltips: {
7212
+		callbacks: {
7213
+			title: function() {
7214
+				return '';
7215
+			},
7216
+			label: function(tooltipItem, data) {
7217
+				var dataLabel = data.labels[tooltipItem.index];
7218
+				var value = ': ' + data.datasets[tooltipItem.datasetIndex].data[tooltipItem.index];
7219
+
7220
+				if (helpers.isArray(dataLabel)) {
7221
+					// show value on first line of multiline label
7222
+					// need to clone because we are changing the value
7223
+					dataLabel = dataLabel.slice();
7224
+					dataLabel[0] += value;
7225
+				} else {
7226
+					dataLabel += value;
7227
+				}
7228
+
7229
+				return dataLabel;
7230
+			}
7231
+		}
7232
+	}
7233
+});
7234
+
7235
+defaults._set('pie', helpers.clone(defaults.doughnut));
7236
+defaults._set('pie', {
7237
+	cutoutPercentage: 0
7238
+});
7239
+
7240
+module.exports = function(Chart) {
7241
+
7242
+	Chart.controllers.doughnut = Chart.controllers.pie = Chart.DatasetController.extend({
7243
+
7244
+		dataElementType: elements.Arc,
7245
+
7246
+		linkScales: helpers.noop,
7247
+
7248
+		// Get index of the dataset in relation to the visible datasets. This allows determining the inner and outer radius correctly
7249
+		getRingIndex: function(datasetIndex) {
7250
+			var ringIndex = 0;
7251
+
7252
+			for (var j = 0; j < datasetIndex; ++j) {
7253
+				if (this.chart.isDatasetVisible(j)) {
7254
+					++ringIndex;
7255
+				}
7256
+			}
7257
+
7258
+			return ringIndex;
7259
+		},
7260
+
7261
+		update: function(reset) {
7262
+			var me = this;
7263
+			var chart = me.chart;
7264
+			var chartArea = chart.chartArea;
7265
+			var opts = chart.options;
7266
+			var arcOpts = opts.elements.arc;
7267
+			var availableWidth = chartArea.right - chartArea.left - arcOpts.borderWidth;
7268
+			var availableHeight = chartArea.bottom - chartArea.top - arcOpts.borderWidth;
7269
+			var minSize = Math.min(availableWidth, availableHeight);
7270
+			var offset = {x: 0, y: 0};
7271
+			var meta = me.getMeta();
7272
+			var cutoutPercentage = opts.cutoutPercentage;
7273
+			var circumference = opts.circumference;
7274
+
7275
+			// If the chart's circumference isn't a full circle, calculate minSize as a ratio of the width/height of the arc
7276
+			if (circumference < Math.PI * 2.0) {
7277
+				var startAngle = opts.rotation % (Math.PI * 2.0);
7278
+				startAngle += Math.PI * 2.0 * (startAngle >= Math.PI ? -1 : startAngle < -Math.PI ? 1 : 0);
7279
+				var endAngle = startAngle + circumference;
7280
+				var start = {x: Math.cos(startAngle), y: Math.sin(startAngle)};
7281
+				var end = {x: Math.cos(endAngle), y: Math.sin(endAngle)};
7282
+				var contains0 = (startAngle <= 0 && endAngle >= 0) || (startAngle <= Math.PI * 2.0 && Math.PI * 2.0 <= endAngle);
7283
+				var contains90 = (startAngle <= Math.PI * 0.5 && Math.PI * 0.5 <= endAngle) || (startAngle <= Math.PI * 2.5 && Math.PI * 2.5 <= endAngle);
7284
+				var contains180 = (startAngle <= -Math.PI && -Math.PI <= endAngle) || (startAngle <= Math.PI && Math.PI <= endAngle);
7285
+				var contains270 = (startAngle <= -Math.PI * 0.5 && -Math.PI * 0.5 <= endAngle) || (startAngle <= Math.PI * 1.5 && Math.PI * 1.5 <= endAngle);
7286
+				var cutout = cutoutPercentage / 100.0;
7287
+				var min = {x: contains180 ? -1 : Math.min(start.x * (start.x < 0 ? 1 : cutout), end.x * (end.x < 0 ? 1 : cutout)), y: contains270 ? -1 : Math.min(start.y * (start.y < 0 ? 1 : cutout), end.y * (end.y < 0 ? 1 : cutout))};
7288
+				var max = {x: contains0 ? 1 : Math.max(start.x * (start.x > 0 ? 1 : cutout), end.x * (end.x > 0 ? 1 : cutout)), y: contains90 ? 1 : Math.max(start.y * (start.y > 0 ? 1 : cutout), end.y * (end.y > 0 ? 1 : cutout))};
7289
+				var size = {width: (max.x - min.x) * 0.5, height: (max.y - min.y) * 0.5};
7290
+				minSize = Math.min(availableWidth / size.width, availableHeight / size.height);
7291
+				offset = {x: (max.x + min.x) * -0.5, y: (max.y + min.y) * -0.5};
7292
+			}
7293
+
7294
+			chart.borderWidth = me.getMaxBorderWidth(meta.data);
7295
+			chart.outerRadius = Math.max((minSize - chart.borderWidth) / 2, 0);
7296
+			chart.innerRadius = Math.max(cutoutPercentage ? (chart.outerRadius / 100) * (cutoutPercentage) : 0, 0);
7297
+			chart.radiusLength = (chart.outerRadius - chart.innerRadius) / chart.getVisibleDatasetCount();
7298
+			chart.offsetX = offset.x * chart.outerRadius;
7299
+			chart.offsetY = offset.y * chart.outerRadius;
7300
+
7301
+			meta.total = me.calculateTotal();
7302
+
7303
+			me.outerRadius = chart.outerRadius - (chart.radiusLength * me.getRingIndex(me.index));
7304
+			me.innerRadius = Math.max(me.outerRadius - chart.radiusLength, 0);
7305
+
7306
+			helpers.each(meta.data, function(arc, index) {
7307
+				me.updateElement(arc, index, reset);
7308
+			});
7309
+		},
7310
+
7311
+		updateElement: function(arc, index, reset) {
7312
+			var me = this;
7313
+			var chart = me.chart;
7314
+			var chartArea = chart.chartArea;
7315
+			var opts = chart.options;
7316
+			var animationOpts = opts.animation;
7317
+			var centerX = (chartArea.left + chartArea.right) / 2;
7318
+			var centerY = (chartArea.top + chartArea.bottom) / 2;
7319
+			var startAngle = opts.rotation; // non reset case handled later
7320
+			var endAngle = opts.rotation; // non reset case handled later
7321
+			var dataset = me.getDataset();
7322
+			var circumference = reset && animationOpts.animateRotate ? 0 : arc.hidden ? 0 : me.calculateCircumference(dataset.data[index]) * (opts.circumference / (2.0 * Math.PI));
7323
+			var innerRadius = reset && animationOpts.animateScale ? 0 : me.innerRadius;
7324
+			var outerRadius = reset && animationOpts.animateScale ? 0 : me.outerRadius;
7325
+			var valueAtIndexOrDefault = helpers.valueAtIndexOrDefault;
7326
+
7327
+			helpers.extend(arc, {
7328
+				// Utility
7329
+				_datasetIndex: me.index,
7330
+				_index: index,
7331
+
7332
+				// Desired view properties
7333
+				_model: {
7334
+					x: centerX + chart.offsetX,
7335
+					y: centerY + chart.offsetY,
7336
+					startAngle: startAngle,
7337
+					endAngle: endAngle,
7338
+					circumference: circumference,
7339
+					outerRadius: outerRadius,
7340
+					innerRadius: innerRadius,
7341
+					label: valueAtIndexOrDefault(dataset.label, index, chart.data.labels[index])
7342
+				}
7343
+			});
7344
+
7345
+			var model = arc._model;
7346
+			// Resets the visual styles
7347
+			this.removeHoverStyle(arc);
7348
+
7349
+			// Set correct angles if not resetting
7350
+			if (!reset || !animationOpts.animateRotate) {
7351
+				if (index === 0) {
7352
+					model.startAngle = opts.rotation;
7353
+				} else {
7354
+					model.startAngle = me.getMeta().data[index - 1]._model.endAngle;
7355
+				}
7356
+
7357
+				model.endAngle = model.startAngle + model.circumference;
7358
+			}
7359
+
7360
+			arc.pivot();
7361
+		},
7362
+
7363
+		removeHoverStyle: function(arc) {
7364
+			Chart.DatasetController.prototype.removeHoverStyle.call(this, arc, this.chart.options.elements.arc);
7365
+		},
7366
+
7367
+		calculateTotal: function() {
7368
+			var dataset = this.getDataset();
7369
+			var meta = this.getMeta();
7370
+			var total = 0;
7371
+			var value;
7372
+
7373
+			helpers.each(meta.data, function(element, index) {
7374
+				value = dataset.data[index];
7375
+				if (!isNaN(value) && !element.hidden) {
7376
+					total += Math.abs(value);
7377
+				}
7378
+			});
7379
+
7380
+			/* if (total === 0) {
7381
+				total = NaN;
7382
+			}*/
7383
+
7384
+			return total;
7385
+		},
7386
+
7387
+		calculateCircumference: function(value) {
7388
+			var total = this.getMeta().total;
7389
+			if (total > 0 && !isNaN(value)) {
7390
+				return (Math.PI * 2.0) * (Math.abs(value) / total);
7391
+			}
7392
+			return 0;
7393
+		},
7394
+
7395
+		// gets the max border or hover width to properly scale pie charts
7396
+		getMaxBorderWidth: function(arcs) {
7397
+			var max = 0;
7398
+			var index = this.index;
7399
+			var length = arcs.length;
7400
+			var borderWidth;
7401
+			var hoverWidth;
7402
+
7403
+			for (var i = 0; i < length; i++) {
7404
+				borderWidth = arcs[i]._model ? arcs[i]._model.borderWidth : 0;
7405
+				hoverWidth = arcs[i]._chart ? arcs[i]._chart.config.data.datasets[index].hoverBorderWidth : 0;
7406
+
7407
+				max = borderWidth > max ? borderWidth : max;
7408
+				max = hoverWidth > max ? hoverWidth : max;
7409
+			}
7410
+			return max;
7411
+		}
7412
+	});
7413
+};
7414
+
7415
+},{"25":25,"40":40,"45":45}],18:[function(require,module,exports){
7416
+'use strict';
7417
+
7418
+var defaults = require(25);
7419
+var elements = require(40);
7420
+var helpers = require(45);
7421
+
7422
+defaults._set('line', {
7423
+	showLines: true,
7424
+	spanGaps: false,
7425
+
7426
+	hover: {
7427
+		mode: 'label'
7428
+	},
7429
+
7430
+	scales: {
7431
+		xAxes: [{
7432
+			type: 'category',
7433
+			id: 'x-axis-0'
7434
+		}],
7435
+		yAxes: [{
7436
+			type: 'linear',
7437
+			id: 'y-axis-0'
7438
+		}]
7439
+	}
7440
+});
7441
+
7442
+module.exports = function(Chart) {
7443
+
7444
+	function lineEnabled(dataset, options) {
7445
+		return helpers.valueOrDefault(dataset.showLine, options.showLines);
7446
+	}
7447
+
7448
+	Chart.controllers.line = Chart.DatasetController.extend({
7449
+
7450
+		datasetElementType: elements.Line,
7451
+
7452
+		dataElementType: elements.Point,
7453
+
7454
+		update: function(reset) {
7455
+			var me = this;
7456
+			var meta = me.getMeta();
7457
+			var line = meta.dataset;
7458
+			var points = meta.data || [];
7459
+			var options = me.chart.options;
7460
+			var lineElementOptions = options.elements.line;
7461
+			var scale = me.getScaleForId(meta.yAxisID);
7462
+			var i, ilen, custom;
7463
+			var dataset = me.getDataset();
7464
+			var showLine = lineEnabled(dataset, options);
7465
+
7466
+			// Update Line
7467
+			if (showLine) {
7468
+				custom = line.custom || {};
7469
+
7470
+				// Compatibility: If the properties are defined with only the old name, use those values
7471
+				if ((dataset.tension !== undefined) && (dataset.lineTension === undefined)) {
7472
+					dataset.lineTension = dataset.tension;
7473
+				}
7474
+
7475
+				// Utility
7476
+				line._scale = scale;
7477
+				line._datasetIndex = me.index;
7478
+				// Data
7479
+				line._children = points;
7480
+				// Model
7481
+				line._model = {
7482
+					// Appearance
7483
+					// The default behavior of lines is to break at null values, according
7484
+					// to https://github.com/chartjs/Chart.js/issues/2435#issuecomment-216718158
7485
+					// This option gives lines the ability to span gaps
7486
+					spanGaps: dataset.spanGaps ? dataset.spanGaps : options.spanGaps,
7487
+					tension: custom.tension ? custom.tension : helpers.valueOrDefault(dataset.lineTension, lineElementOptions.tension),
7488
+					backgroundColor: custom.backgroundColor ? custom.backgroundColor : (dataset.backgroundColor || lineElementOptions.backgroundColor),
7489
+					borderWidth: custom.borderWidth ? custom.borderWidth : (dataset.borderWidth || lineElementOptions.borderWidth),
7490
+					borderColor: custom.borderColor ? custom.borderColor : (dataset.borderColor || lineElementOptions.borderColor),
7491
+					borderCapStyle: custom.borderCapStyle ? custom.borderCapStyle : (dataset.borderCapStyle || lineElementOptions.borderCapStyle),
7492
+					borderDash: custom.borderDash ? custom.borderDash : (dataset.borderDash || lineElementOptions.borderDash),
7493
+					borderDashOffset: custom.borderDashOffset ? custom.borderDashOffset : (dataset.borderDashOffset || lineElementOptions.borderDashOffset),
7494
+					borderJoinStyle: custom.borderJoinStyle ? custom.borderJoinStyle : (dataset.borderJoinStyle || lineElementOptions.borderJoinStyle),
7495
+					fill: custom.fill ? custom.fill : (dataset.fill !== undefined ? dataset.fill : lineElementOptions.fill),
7496
+					steppedLine: custom.steppedLine ? custom.steppedLine : helpers.valueOrDefault(dataset.steppedLine, lineElementOptions.stepped),
7497
+					cubicInterpolationMode: custom.cubicInterpolationMode ? custom.cubicInterpolationMode : helpers.valueOrDefault(dataset.cubicInterpolationMode, lineElementOptions.cubicInterpolationMode),
7498
+				};
7499
+
7500
+				line.pivot();
7501
+			}
7502
+
7503
+			// Update Points
7504
+			for (i = 0, ilen = points.length; i < ilen; ++i) {
7505
+				me.updateElement(points[i], i, reset);
7506
+			}
7507
+
7508
+			if (showLine && line._model.tension !== 0) {
7509
+				me.updateBezierControlPoints();
7510
+			}
7511
+
7512
+			// Now pivot the point for animation
7513
+			for (i = 0, ilen = points.length; i < ilen; ++i) {
7514
+				points[i].pivot();
7515
+			}
7516
+		},
7517
+
7518
+		getPointBackgroundColor: function(point, index) {
7519
+			var backgroundColor = this.chart.options.elements.point.backgroundColor;
7520
+			var dataset = this.getDataset();
7521
+			var custom = point.custom || {};
7522
+
7523
+			if (custom.backgroundColor) {
7524
+				backgroundColor = custom.backgroundColor;
7525
+			} else if (dataset.pointBackgroundColor) {
7526
+				backgroundColor = helpers.valueAtIndexOrDefault(dataset.pointBackgroundColor, index, backgroundColor);
7527
+			} else if (dataset.backgroundColor) {
7528
+				backgroundColor = dataset.backgroundColor;
7529
+			}
7530
+
7531
+			return backgroundColor;
7532
+		},
7533
+
7534
+		getPointBorderColor: function(point, index) {
7535
+			var borderColor = this.chart.options.elements.point.borderColor;
7536
+			var dataset = this.getDataset();
7537
+			var custom = point.custom || {};
7538
+
7539
+			if (custom.borderColor) {
7540
+				borderColor = custom.borderColor;
7541
+			} else if (dataset.pointBorderColor) {
7542
+				borderColor = helpers.valueAtIndexOrDefault(dataset.pointBorderColor, index, borderColor);
7543
+			} else if (dataset.borderColor) {
7544
+				borderColor = dataset.borderColor;
7545
+			}
7546
+
7547
+			return borderColor;
7548
+		},
7549
+
7550
+		getPointBorderWidth: function(point, index) {
7551
+			var borderWidth = this.chart.options.elements.point.borderWidth;
7552
+			var dataset = this.getDataset();
7553
+			var custom = point.custom || {};
7554
+
7555
+			if (!isNaN(custom.borderWidth)) {
7556
+				borderWidth = custom.borderWidth;
7557
+			} else if (!isNaN(dataset.pointBorderWidth) || helpers.isArray(dataset.pointBorderWidth)) {
7558
+				borderWidth = helpers.valueAtIndexOrDefault(dataset.pointBorderWidth, index, borderWidth);
7559
+			} else if (!isNaN(dataset.borderWidth)) {
7560
+				borderWidth = dataset.borderWidth;
7561
+			}
7562
+
7563
+			return borderWidth;
7564
+		},
7565
+
7566
+		updateElement: function(point, index, reset) {
7567
+			var me = this;
7568
+			var meta = me.getMeta();
7569
+			var custom = point.custom || {};
7570
+			var dataset = me.getDataset();
7571
+			var datasetIndex = me.index;
7572
+			var value = dataset.data[index];
7573
+			var yScale = me.getScaleForId(meta.yAxisID);
7574
+			var xScale = me.getScaleForId(meta.xAxisID);
7575
+			var pointOptions = me.chart.options.elements.point;
7576
+			var x, y;
7577
+
7578
+			// Compatibility: If the properties are defined with only the old name, use those values
7579
+			if ((dataset.radius !== undefined) && (dataset.pointRadius === undefined)) {
7580
+				dataset.pointRadius = dataset.radius;
7581
+			}
7582
+			if ((dataset.hitRadius !== undefined) && (dataset.pointHitRadius === undefined)) {
7583
+				dataset.pointHitRadius = dataset.hitRadius;
7584
+			}
7585
+
7586
+			x = xScale.getPixelForValue(typeof value === 'object' ? value : NaN, index, datasetIndex);
7587
+			y = reset ? yScale.getBasePixel() : me.calculatePointY(value, index, datasetIndex);
7588
+
7589
+			// Utility
7590
+			point._xScale = xScale;
7591
+			point._yScale = yScale;
7592
+			point._datasetIndex = datasetIndex;
7593
+			point._index = index;
7594
+
7595
+			// Desired view properties
7596
+			point._model = {
7597
+				x: x,
7598
+				y: y,
7599
+				skip: custom.skip || isNaN(x) || isNaN(y),
7600
+				// Appearance
7601
+				radius: custom.radius || helpers.valueAtIndexOrDefault(dataset.pointRadius, index, pointOptions.radius),
7602
+				pointStyle: custom.pointStyle || helpers.valueAtIndexOrDefault(dataset.pointStyle, index, pointOptions.pointStyle),
7603
+				backgroundColor: me.getPointBackgroundColor(point, index),
7604
+				borderColor: me.getPointBorderColor(point, index),
7605
+				borderWidth: me.getPointBorderWidth(point, index),
7606
+				tension: meta.dataset._model ? meta.dataset._model.tension : 0,
7607
+				steppedLine: meta.dataset._model ? meta.dataset._model.steppedLine : false,
7608
+				// Tooltip
7609
+				hitRadius: custom.hitRadius || helpers.valueAtIndexOrDefault(dataset.pointHitRadius, index, pointOptions.hitRadius)
7610
+			};
7611
+		},
7612
+
7613
+		calculatePointY: function(value, index, datasetIndex) {
7614
+			var me = this;
7615
+			var chart = me.chart;
7616
+			var meta = me.getMeta();
7617
+			var yScale = me.getScaleForId(meta.yAxisID);
7618
+			var sumPos = 0;
7619
+			var sumNeg = 0;
7620
+			var i, ds, dsMeta;
7621
+
7622
+			if (yScale.options.stacked) {
7623
+				for (i = 0; i < datasetIndex; i++) {
7624
+					ds = chart.data.datasets[i];
7625
+					dsMeta = chart.getDatasetMeta(i);
7626
+					if (dsMeta.type === 'line' && dsMeta.yAxisID === yScale.id && chart.isDatasetVisible(i)) {
7627
+						var stackedRightValue = Number(yScale.getRightValue(ds.data[index]));
7628
+						if (stackedRightValue < 0) {
7629
+							sumNeg += stackedRightValue || 0;
7630
+						} else {
7631
+							sumPos += stackedRightValue || 0;
7632
+						}
7633
+					}
7634
+				}
7635
+
7636
+				var rightValue = Number(yScale.getRightValue(value));
7637
+				if (rightValue < 0) {
7638
+					return yScale.getPixelForValue(sumNeg + rightValue);
7639
+				}
7640
+				return yScale.getPixelForValue(sumPos + rightValue);
7641
+			}
7642
+
7643
+			return yScale.getPixelForValue(value);
7644
+		},
7645
+
7646
+		updateBezierControlPoints: function() {
7647
+			var me = this;
7648
+			var meta = me.getMeta();
7649
+			var area = me.chart.chartArea;
7650
+			var points = (meta.data || []);
7651
+			var i, ilen, point, model, controlPoints;
7652
+
7653
+			// Only consider points that are drawn in case the spanGaps option is used
7654
+			if (meta.dataset._model.spanGaps) {
7655
+				points = points.filter(function(pt) {
7656
+					return !pt._model.skip;
7657
+				});
7658
+			}
7659
+
7660
+			function capControlPoint(pt, min, max) {
7661
+				return Math.max(Math.min(pt, max), min);
7662
+			}
7663
+
7664
+			if (meta.dataset._model.cubicInterpolationMode === 'monotone') {
7665
+				helpers.splineCurveMonotone(points);
7666
+			} else {
7667
+				for (i = 0, ilen = points.length; i < ilen; ++i) {
7668
+					point = points[i];
7669
+					model = point._model;
7670
+					controlPoints = helpers.splineCurve(
7671
+						helpers.previousItem(points, i)._model,
7672
+						model,
7673
+						helpers.nextItem(points, i)._model,
7674
+						meta.dataset._model.tension
7675
+					);
7676
+					model.controlPointPreviousX = controlPoints.previous.x;
7677
+					model.controlPointPreviousY = controlPoints.previous.y;
7678
+					model.controlPointNextX = controlPoints.next.x;
7679
+					model.controlPointNextY = controlPoints.next.y;
7680
+				}
7681
+			}
7682
+
7683
+			if (me.chart.options.elements.line.capBezierPoints) {
7684
+				for (i = 0, ilen = points.length; i < ilen; ++i) {
7685
+					model = points[i]._model;
7686
+					model.controlPointPreviousX = capControlPoint(model.controlPointPreviousX, area.left, area.right);
7687
+					model.controlPointPreviousY = capControlPoint(model.controlPointPreviousY, area.top, area.bottom);
7688
+					model.controlPointNextX = capControlPoint(model.controlPointNextX, area.left, area.right);
7689
+					model.controlPointNextY = capControlPoint(model.controlPointNextY, area.top, area.bottom);
7690
+				}
7691
+			}
7692
+		},
7693
+
7694
+		draw: function() {
7695
+			var me = this;
7696
+			var chart = me.chart;
7697
+			var meta = me.getMeta();
7698
+			var points = meta.data || [];
7699
+			var area = chart.chartArea;
7700
+			var ilen = points.length;
7701
+			var i = 0;
7702
+
7703
+			helpers.canvas.clipArea(chart.ctx, area);
7704
+
7705
+			if (lineEnabled(me.getDataset(), chart.options)) {
7706
+				meta.dataset.draw();
7707
+			}
7708
+
7709
+			helpers.canvas.unclipArea(chart.ctx);
7710
+
7711
+			// Draw the points
7712
+			for (; i < ilen; ++i) {
7713
+				points[i].draw(area);
7714
+			}
7715
+		},
7716
+
7717
+		setHoverStyle: function(point) {
7718
+			// Point
7719
+			var dataset = this.chart.data.datasets[point._datasetIndex];
7720
+			var index = point._index;
7721
+			var custom = point.custom || {};
7722
+			var model = point._model;
7723
+
7724
+			model.radius = custom.hoverRadius || helpers.valueAtIndexOrDefault(dataset.pointHoverRadius, index, this.chart.options.elements.point.hoverRadius);
7725
+			model.backgroundColor = custom.hoverBackgroundColor || helpers.valueAtIndexOrDefault(dataset.pointHoverBackgroundColor, index, helpers.getHoverColor(model.backgroundColor));
7726
+			model.borderColor = custom.hoverBorderColor || helpers.valueAtIndexOrDefault(dataset.pointHoverBorderColor, index, helpers.getHoverColor(model.borderColor));
7727
+			model.borderWidth = custom.hoverBorderWidth || helpers.valueAtIndexOrDefault(dataset.pointHoverBorderWidth, index, model.borderWidth);
7728
+		},
7729
+
7730
+		removeHoverStyle: function(point) {
7731
+			var me = this;
7732
+			var dataset = me.chart.data.datasets[point._datasetIndex];
7733
+			var index = point._index;
7734
+			var custom = point.custom || {};
7735
+			var model = point._model;
7736
+
7737
+			// Compatibility: If the properties are defined with only the old name, use those values
7738
+			if ((dataset.radius !== undefined) && (dataset.pointRadius === undefined)) {
7739
+				dataset.pointRadius = dataset.radius;
7740
+			}
7741
+
7742
+			model.radius = custom.radius || helpers.valueAtIndexOrDefault(dataset.pointRadius, index, me.chart.options.elements.point.radius);
7743
+			model.backgroundColor = me.getPointBackgroundColor(point, index);
7744
+			model.borderColor = me.getPointBorderColor(point, index);
7745
+			model.borderWidth = me.getPointBorderWidth(point, index);
7746
+		}
7747
+	});
7748
+};
7749
+
7750
+},{"25":25,"40":40,"45":45}],19:[function(require,module,exports){
7751
+'use strict';
7752
+
7753
+var defaults = require(25);
7754
+var elements = require(40);
7755
+var helpers = require(45);
7756
+
7757
+defaults._set('polarArea', {
7758
+	scale: {
7759
+		type: 'radialLinear',
7760
+		angleLines: {
7761
+			display: false
7762
+		},
7763
+		gridLines: {
7764
+			circular: true
7765
+		},
7766
+		pointLabels: {
7767
+			display: false
7768
+		},
7769
+		ticks: {
7770
+			beginAtZero: true
7771
+		}
7772
+	},
7773
+
7774
+	// Boolean - Whether to animate the rotation of the chart
7775
+	animation: {
7776
+		animateRotate: true,
7777
+		animateScale: true
7778
+	},
7779
+
7780
+	startAngle: -0.5 * Math.PI,
7781
+	legendCallback: function(chart) {
7782
+		var text = [];
7783
+		text.push('<ul class="' + chart.id + '-legend">');
7784
+
7785
+		var data = chart.data;
7786
+		var datasets = data.datasets;
7787
+		var labels = data.labels;
7788
+
7789
+		if (datasets.length) {
7790
+			for (var i = 0; i < datasets[0].data.length; ++i) {
7791
+				text.push('<li><span style="background-color:' + datasets[0].backgroundColor[i] + '"></span>');
7792
+				if (labels[i]) {
7793
+					text.push(labels[i]);
7794
+				}
7795
+				text.push('</li>');
7796
+			}
7797
+		}
7798
+
7799
+		text.push('</ul>');
7800
+		return text.join('');
7801
+	},
7802
+	legend: {
7803
+		labels: {
7804
+			generateLabels: function(chart) {
7805
+				var data = chart.data;
7806
+				if (data.labels.length && data.datasets.length) {
7807
+					return data.labels.map(function(label, i) {
7808
+						var meta = chart.getDatasetMeta(0);
7809
+						var ds = data.datasets[0];
7810
+						var arc = meta.data[i];
7811
+						var custom = arc.custom || {};
7812
+						var valueAtIndexOrDefault = helpers.valueAtIndexOrDefault;
7813
+						var arcOpts = chart.options.elements.arc;
7814
+						var fill = custom.backgroundColor ? custom.backgroundColor : valueAtIndexOrDefault(ds.backgroundColor, i, arcOpts.backgroundColor);
7815
+						var stroke = custom.borderColor ? custom.borderColor : valueAtIndexOrDefault(ds.borderColor, i, arcOpts.borderColor);
7816
+						var bw = custom.borderWidth ? custom.borderWidth : valueAtIndexOrDefault(ds.borderWidth, i, arcOpts.borderWidth);
7817
+
7818
+						return {
7819
+							text: label,
7820
+							fillStyle: fill,
7821
+							strokeStyle: stroke,
7822
+							lineWidth: bw,
7823
+							hidden: isNaN(ds.data[i]) || meta.data[i].hidden,
7824
+
7825
+							// Extra data used for toggling the correct item
7826
+							index: i
7827
+						};
7828
+					});
7829
+				}
7830
+				return [];
7831
+			}
7832
+		},
7833
+
7834
+		onClick: function(e, legendItem) {
7835
+			var index = legendItem.index;
7836
+			var chart = this.chart;
7837
+			var i, ilen, meta;
7838
+
7839
+			for (i = 0, ilen = (chart.data.datasets || []).length; i < ilen; ++i) {
7840
+				meta = chart.getDatasetMeta(i);
7841
+				meta.data[index].hidden = !meta.data[index].hidden;
7842
+			}
7843
+
7844
+			chart.update();
7845
+		}
7846
+	},
7847
+
7848
+	// Need to override these to give a nice default
7849
+	tooltips: {
7850
+		callbacks: {
7851
+			title: function() {
7852
+				return '';
7853
+			},
7854
+			label: function(item, data) {
7855
+				return data.labels[item.index] + ': ' + item.yLabel;
7856
+			}
7857
+		}
7858
+	}
7859
+});
7860
+
7861
+module.exports = function(Chart) {
7862
+
7863
+	Chart.controllers.polarArea = Chart.DatasetController.extend({
7864
+
7865
+		dataElementType: elements.Arc,
7866
+
7867
+		linkScales: helpers.noop,
7868
+
7869
+		update: function(reset) {
7870
+			var me = this;
7871
+			var chart = me.chart;
7872
+			var chartArea = chart.chartArea;
7873
+			var meta = me.getMeta();
7874
+			var opts = chart.options;
7875
+			var arcOpts = opts.elements.arc;
7876
+			var minSize = Math.min(chartArea.right - chartArea.left, chartArea.bottom - chartArea.top);
7877
+			chart.outerRadius = Math.max((minSize - arcOpts.borderWidth / 2) / 2, 0);
7878
+			chart.innerRadius = Math.max(opts.cutoutPercentage ? (chart.outerRadius / 100) * (opts.cutoutPercentage) : 1, 0);
7879
+			chart.radiusLength = (chart.outerRadius - chart.innerRadius) / chart.getVisibleDatasetCount();
7880
+
7881
+			me.outerRadius = chart.outerRadius - (chart.radiusLength * me.index);
7882
+			me.innerRadius = me.outerRadius - chart.radiusLength;
7883
+
7884
+			meta.count = me.countVisibleElements();
7885
+
7886
+			helpers.each(meta.data, function(arc, index) {
7887
+				me.updateElement(arc, index, reset);
7888
+			});
7889
+		},
7890
+
7891
+		updateElement: function(arc, index, reset) {
7892
+			var me = this;
7893
+			var chart = me.chart;
7894
+			var dataset = me.getDataset();
7895
+			var opts = chart.options;
7896
+			var animationOpts = opts.animation;
7897
+			var scale = chart.scale;
7898
+			var labels = chart.data.labels;
7899
+
7900
+			var circumference = me.calculateCircumference(dataset.data[index]);
7901
+			var centerX = scale.xCenter;
7902
+			var centerY = scale.yCenter;
7903
+
7904
+			// If there is NaN data before us, we need to calculate the starting angle correctly.
7905
+			// We could be way more efficient here, but its unlikely that the polar area chart will have a lot of data
7906
+			var visibleCount = 0;
7907
+			var meta = me.getMeta();
7908
+			for (var i = 0; i < index; ++i) {
7909
+				if (!isNaN(dataset.data[i]) && !meta.data[i].hidden) {
7910
+					++visibleCount;
7911
+				}
7912
+			}
7913
+
7914
+			// var negHalfPI = -0.5 * Math.PI;
7915
+			var datasetStartAngle = opts.startAngle;
7916
+			var distance = arc.hidden ? 0 : scale.getDistanceFromCenterForValue(dataset.data[index]);
7917
+			var startAngle = datasetStartAngle + (circumference * visibleCount);
7918
+			var endAngle = startAngle + (arc.hidden ? 0 : circumference);
7919
+
7920
+			var resetRadius = animationOpts.animateScale ? 0 : scale.getDistanceFromCenterForValue(dataset.data[index]);
7921
+
7922
+			helpers.extend(arc, {
7923
+				// Utility
7924
+				_datasetIndex: me.index,
7925
+				_index: index,
7926
+				_scale: scale,
7927
+
7928
+				// Desired view properties
7929
+				_model: {
7930
+					x: centerX,
7931
+					y: centerY,
7932
+					innerRadius: 0,
7933
+					outerRadius: reset ? resetRadius : distance,
7934
+					startAngle: reset && animationOpts.animateRotate ? datasetStartAngle : startAngle,
7935
+					endAngle: reset && animationOpts.animateRotate ? datasetStartAngle : endAngle,
7936
+					label: helpers.valueAtIndexOrDefault(labels, index, labels[index])
7937
+				}
7938
+			});
7939
+
7940
+			// Apply border and fill style
7941
+			me.removeHoverStyle(arc);
7942
+
7943
+			arc.pivot();
7944
+		},
7945
+
7946
+		removeHoverStyle: function(arc) {
7947
+			Chart.DatasetController.prototype.removeHoverStyle.call(this, arc, this.chart.options.elements.arc);
7948
+		},
7949
+
7950
+		countVisibleElements: function() {
7951
+			var dataset = this.getDataset();
7952
+			var meta = this.getMeta();
7953
+			var count = 0;
7954
+
7955
+			helpers.each(meta.data, function(element, index) {
7956
+				if (!isNaN(dataset.data[index]) && !element.hidden) {
7957
+					count++;
7958
+				}
7959
+			});
7960
+
7961
+			return count;
7962
+		},
7963
+
7964
+		calculateCircumference: function(value) {
7965
+			var count = this.getMeta().count;
7966
+			if (count > 0 && !isNaN(value)) {
7967
+				return (2 * Math.PI) / count;
7968
+			}
7969
+			return 0;
7970
+		}
7971
+	});
7972
+};
7973
+
7974
+},{"25":25,"40":40,"45":45}],20:[function(require,module,exports){
7975
+'use strict';
7976
+
7977
+var defaults = require(25);
7978
+var elements = require(40);
7979
+var helpers = require(45);
7980
+
7981
+defaults._set('radar', {
7982
+	scale: {
7983
+		type: 'radialLinear'
7984
+	},
7985
+	elements: {
7986
+		line: {
7987
+			tension: 0 // no bezier in radar
7988
+		}
7989
+	}
7990
+});
7991
+
7992
+module.exports = function(Chart) {
7993
+
7994
+	Chart.controllers.radar = Chart.DatasetController.extend({
7995
+
7996
+		datasetElementType: elements.Line,
7997
+
7998
+		dataElementType: elements.Point,
7999
+
8000
+		linkScales: helpers.noop,
8001
+
8002
+		update: function(reset) {
8003
+			var me = this;
8004
+			var meta = me.getMeta();
8005
+			var line = meta.dataset;
8006
+			var points = meta.data;
8007
+			var custom = line.custom || {};
8008
+			var dataset = me.getDataset();
8009
+			var lineElementOptions = me.chart.options.elements.line;
8010
+			var scale = me.chart.scale;
8011
+
8012
+			// Compatibility: If the properties are defined with only the old name, use those values
8013
+			if ((dataset.tension !== undefined) && (dataset.lineTension === undefined)) {
8014
+				dataset.lineTension = dataset.tension;
8015
+			}
8016
+
8017
+			helpers.extend(meta.dataset, {
8018
+				// Utility
8019
+				_datasetIndex: me.index,
8020
+				_scale: scale,
8021
+				// Data
8022
+				_children: points,
8023
+				_loop: true,
8024
+				// Model
8025
+				_model: {
8026
+					// Appearance
8027
+					tension: custom.tension ? custom.tension : helpers.valueOrDefault(dataset.lineTension, lineElementOptions.tension),
8028
+					backgroundColor: custom.backgroundColor ? custom.backgroundColor : (dataset.backgroundColor || lineElementOptions.backgroundColor),
8029
+					borderWidth: custom.borderWidth ? custom.borderWidth : (dataset.borderWidth || lineElementOptions.borderWidth),
8030
+					borderColor: custom.borderColor ? custom.borderColor : (dataset.borderColor || lineElementOptions.borderColor),
8031
+					fill: custom.fill ? custom.fill : (dataset.fill !== undefined ? dataset.fill : lineElementOptions.fill),
8032
+					borderCapStyle: custom.borderCapStyle ? custom.borderCapStyle : (dataset.borderCapStyle || lineElementOptions.borderCapStyle),
8033
+					borderDash: custom.borderDash ? custom.borderDash : (dataset.borderDash || lineElementOptions.borderDash),
8034
+					borderDashOffset: custom.borderDashOffset ? custom.borderDashOffset : (dataset.borderDashOffset || lineElementOptions.borderDashOffset),
8035
+					borderJoinStyle: custom.borderJoinStyle ? custom.borderJoinStyle : (dataset.borderJoinStyle || lineElementOptions.borderJoinStyle),
8036
+				}
8037
+			});
8038
+
8039
+			meta.dataset.pivot();
8040
+
8041
+			// Update Points
8042
+			helpers.each(points, function(point, index) {
8043
+				me.updateElement(point, index, reset);
8044
+			}, me);
8045
+
8046
+			// Update bezier control points
8047
+			me.updateBezierControlPoints();
8048
+		},
8049
+		updateElement: function(point, index, reset) {
8050
+			var me = this;
8051
+			var custom = point.custom || {};
8052
+			var dataset = me.getDataset();
8053
+			var scale = me.chart.scale;
8054
+			var pointElementOptions = me.chart.options.elements.point;
8055
+			var pointPosition = scale.getPointPositionForValue(index, dataset.data[index]);
8056
+
8057
+			// Compatibility: If the properties are defined with only the old name, use those values
8058
+			if ((dataset.radius !== undefined) && (dataset.pointRadius === undefined)) {
8059
+				dataset.pointRadius = dataset.radius;
8060
+			}
8061
+			if ((dataset.hitRadius !== undefined) && (dataset.pointHitRadius === undefined)) {
8062
+				dataset.pointHitRadius = dataset.hitRadius;
8063
+			}
8064
+
8065
+			helpers.extend(point, {
8066
+				// Utility
8067
+				_datasetIndex: me.index,
8068
+				_index: index,
8069
+				_scale: scale,
8070
+
8071
+				// Desired view properties
8072
+				_model: {
8073
+					x: reset ? scale.xCenter : pointPosition.x, // value not used in dataset scale, but we want a consistent API between scales
8074
+					y: reset ? scale.yCenter : pointPosition.y,
8075
+
8076
+					// Appearance
8077
+					tension: custom.tension ? custom.tension : helpers.valueOrDefault(dataset.lineTension, me.chart.options.elements.line.tension),
8078
+					radius: custom.radius ? custom.radius : helpers.valueAtIndexOrDefault(dataset.pointRadius, index, pointElementOptions.radius),
8079
+					backgroundColor: custom.backgroundColor ? custom.backgroundColor : helpers.valueAtIndexOrDefault(dataset.pointBackgroundColor, index, pointElementOptions.backgroundColor),
8080
+					borderColor: custom.borderColor ? custom.borderColor : helpers.valueAtIndexOrDefault(dataset.pointBorderColor, index, pointElementOptions.borderColor),
8081
+					borderWidth: custom.borderWidth ? custom.borderWidth : helpers.valueAtIndexOrDefault(dataset.pointBorderWidth, index, pointElementOptions.borderWidth),
8082
+					pointStyle: custom.pointStyle ? custom.pointStyle : helpers.valueAtIndexOrDefault(dataset.pointStyle, index, pointElementOptions.pointStyle),
8083
+
8084
+					// Tooltip
8085
+					hitRadius: custom.hitRadius ? custom.hitRadius : helpers.valueAtIndexOrDefault(dataset.pointHitRadius, index, pointElementOptions.hitRadius)
8086
+				}
8087
+			});
8088
+
8089
+			point._model.skip = custom.skip ? custom.skip : (isNaN(point._model.x) || isNaN(point._model.y));
8090
+		},
8091
+		updateBezierControlPoints: function() {
8092
+			var chartArea = this.chart.chartArea;
8093
+			var meta = this.getMeta();
8094
+
8095
+			helpers.each(meta.data, function(point, index) {
8096
+				var model = point._model;
8097
+				var controlPoints = helpers.splineCurve(
8098
+					helpers.previousItem(meta.data, index, true)._model,
8099
+					model,
8100
+					helpers.nextItem(meta.data, index, true)._model,
8101
+					model.tension
8102
+				);
8103
+
8104
+				// Prevent the bezier going outside of the bounds of the graph
8105
+				model.controlPointPreviousX = Math.max(Math.min(controlPoints.previous.x, chartArea.right), chartArea.left);
8106
+				model.controlPointPreviousY = Math.max(Math.min(controlPoints.previous.y, chartArea.bottom), chartArea.top);
8107
+
8108
+				model.controlPointNextX = Math.max(Math.min(controlPoints.next.x, chartArea.right), chartArea.left);
8109
+				model.controlPointNextY = Math.max(Math.min(controlPoints.next.y, chartArea.bottom), chartArea.top);
8110
+
8111
+				// Now pivot the point for animation
8112
+				point.pivot();
8113
+			});
8114
+		},
8115
+
8116
+		setHoverStyle: function(point) {
8117
+			// Point
8118
+			var dataset = this.chart.data.datasets[point._datasetIndex];
8119
+			var custom = point.custom || {};
8120
+			var index = point._index;
8121
+			var model = point._model;
8122
+
8123
+			model.radius = custom.hoverRadius ? custom.hoverRadius : helpers.valueAtIndexOrDefault(dataset.pointHoverRadius, index, this.chart.options.elements.point.hoverRadius);
8124
+			model.backgroundColor = custom.hoverBackgroundColor ? custom.hoverBackgroundColor : helpers.valueAtIndexOrDefault(dataset.pointHoverBackgroundColor, index, helpers.getHoverColor(model.backgroundColor));
8125
+			model.borderColor = custom.hoverBorderColor ? custom.hoverBorderColor : helpers.valueAtIndexOrDefault(dataset.pointHoverBorderColor, index, helpers.getHoverColor(model.borderColor));
8126
+			model.borderWidth = custom.hoverBorderWidth ? custom.hoverBorderWidth : helpers.valueAtIndexOrDefault(dataset.pointHoverBorderWidth, index, model.borderWidth);
8127
+		},
8128
+
8129
+		removeHoverStyle: function(point) {
8130
+			var dataset = this.chart.data.datasets[point._datasetIndex];
8131
+			var custom = point.custom || {};
8132
+			var index = point._index;
8133
+			var model = point._model;
8134
+			var pointElementOptions = this.chart.options.elements.point;
8135
+
8136
+			model.radius = custom.radius ? custom.radius : helpers.valueAtIndexOrDefault(dataset.pointRadius, index, pointElementOptions.radius);
8137
+			model.backgroundColor = custom.backgroundColor ? custom.backgroundColor : helpers.valueAtIndexOrDefault(dataset.pointBackgroundColor, index, pointElementOptions.backgroundColor);
8138
+			model.borderColor = custom.borderColor ? custom.borderColor : helpers.valueAtIndexOrDefault(dataset.pointBorderColor, index, pointElementOptions.borderColor);
8139
+			model.borderWidth = custom.borderWidth ? custom.borderWidth : helpers.valueAtIndexOrDefault(dataset.pointBorderWidth, index, pointElementOptions.borderWidth);
8140
+		}
8141
+	});
8142
+};
8143
+
8144
+},{"25":25,"40":40,"45":45}],21:[function(require,module,exports){
8145
+'use strict';
8146
+
8147
+var defaults = require(25);
8148
+
8149
+defaults._set('scatter', {
8150
+	hover: {
8151
+		mode: 'single'
8152
+	},
8153
+
8154
+	scales: {
8155
+		xAxes: [{
8156
+			id: 'x-axis-1',    // need an ID so datasets can reference the scale
8157
+			type: 'linear',    // scatter should not use a category axis
8158
+			position: 'bottom'
8159
+		}],
8160
+		yAxes: [{
8161
+			id: 'y-axis-1',
8162
+			type: 'linear',
8163
+			position: 'left'
8164
+		}]
8165
+	},
8166
+
8167
+	showLines: false,
8168
+
8169
+	tooltips: {
8170
+		callbacks: {
8171
+			title: function() {
8172
+				return '';     // doesn't make sense for scatter since data are formatted as a point
8173
+			},
8174
+			label: function(item) {
8175
+				return '(' + item.xLabel + ', ' + item.yLabel + ')';
8176
+			}
8177
+		}
8178
+	}
8179
+});
8180
+
8181
+module.exports = function(Chart) {
8182
+
8183
+	// Scatter charts use line controllers
8184
+	Chart.controllers.scatter = Chart.controllers.line;
8185
+
8186
+};
8187
+
8188
+},{"25":25}],22:[function(require,module,exports){
8189
+/* global window: false */
8190
+'use strict';
8191
+
8192
+var defaults = require(25);
8193
+var Element = require(26);
8194
+var helpers = require(45);
8195
+
8196
+defaults._set('global', {
8197
+	animation: {
8198
+		duration: 1000,
8199
+		easing: 'easeOutQuart',
8200
+		onProgress: helpers.noop,
8201
+		onComplete: helpers.noop
8202
+	}
8203
+});
8204
+
8205
+module.exports = function(Chart) {
8206
+
8207
+	Chart.Animation = Element.extend({
8208
+		chart: null, // the animation associated chart instance
8209
+		currentStep: 0, // the current animation step
8210
+		numSteps: 60, // default number of steps
8211
+		easing: '', // the easing to use for this animation
8212
+		render: null, // render function used by the animation service
8213
+
8214
+		onAnimationProgress: null, // user specified callback to fire on each step of the animation
8215
+		onAnimationComplete: null, // user specified callback to fire when the animation finishes
8216
+	});
8217
+
8218
+	Chart.animationService = {
8219
+		frameDuration: 17,
8220
+		animations: [],
8221
+		dropFrames: 0,
8222
+		request: null,
8223
+
8224
+		/**
8225
+		 * @param {Chart} chart - The chart to animate.
8226
+		 * @param {Chart.Animation} animation - The animation that we will animate.
8227
+		 * @param {Number} duration - The animation duration in ms.
8228
+		 * @param {Boolean} lazy - if true, the chart is not marked as animating to enable more responsive interactions
8229
+		 */
8230
+		addAnimation: function(chart, animation, duration, lazy) {
8231
+			var animations = this.animations;
8232
+			var i, ilen;
8233
+
8234
+			animation.chart = chart;
8235
+
8236
+			if (!lazy) {
8237
+				chart.animating = true;
8238
+			}
8239
+
8240
+			for (i = 0, ilen = animations.length; i < ilen; ++i) {
8241
+				if (animations[i].chart === chart) {
8242
+					animations[i] = animation;
8243
+					return;
8244
+				}
8245
+			}
8246
+
8247
+			animations.push(animation);
8248
+
8249
+			// If there are no animations queued, manually kickstart a digest, for lack of a better word
8250
+			if (animations.length === 1) {
8251
+				this.requestAnimationFrame();
8252
+			}
8253
+		},
8254
+
8255
+		cancelAnimation: function(chart) {
8256
+			var index = helpers.findIndex(this.animations, function(animation) {
8257
+				return animation.chart === chart;
8258
+			});
8259
+
8260
+			if (index !== -1) {
8261
+				this.animations.splice(index, 1);
8262
+				chart.animating = false;
8263
+			}
8264
+		},
8265
+
8266
+		requestAnimationFrame: function() {
8267
+			var me = this;
8268
+			if (me.request === null) {
8269
+				// Skip animation frame requests until the active one is executed.
8270
+				// This can happen when processing mouse events, e.g. 'mousemove'
8271
+				// and 'mouseout' events will trigger multiple renders.
8272
+				me.request = helpers.requestAnimFrame.call(window, function() {
8273
+					me.request = null;
8274
+					me.startDigest();
8275
+				});
8276
+			}
8277
+		},
8278
+
8279
+		/**
8280
+		 * @private
8281
+		 */
8282
+		startDigest: function() {
8283
+			var me = this;
8284
+			var startTime = Date.now();
8285
+			var framesToDrop = 0;
8286
+
8287
+			if (me.dropFrames > 1) {
8288
+				framesToDrop = Math.floor(me.dropFrames);
8289
+				me.dropFrames = me.dropFrames % 1;
8290
+			}
8291
+
8292
+			me.advance(1 + framesToDrop);
8293
+
8294
+			var endTime = Date.now();
8295
+
8296
+			me.dropFrames += (endTime - startTime) / me.frameDuration;
8297
+
8298
+			// Do we have more stuff to animate?
8299
+			if (me.animations.length > 0) {
8300
+				me.requestAnimationFrame();
8301
+			}
8302
+		},
8303
+
8304
+		/**
8305
+		 * @private
8306
+		 */
8307
+		advance: function(count) {
8308
+			var animations = this.animations;
8309
+			var animation, chart;
8310
+			var i = 0;
8311
+
8312
+			while (i < animations.length) {
8313
+				animation = animations[i];
8314
+				chart = animation.chart;
8315
+
8316
+				animation.currentStep = (animation.currentStep || 0) + count;
8317
+				animation.currentStep = Math.min(animation.currentStep, animation.numSteps);
8318
+
8319
+				helpers.callback(animation.render, [chart, animation], chart);
8320
+				helpers.callback(animation.onAnimationProgress, [animation], chart);
8321
+
8322
+				if (animation.currentStep >= animation.numSteps) {
8323
+					helpers.callback(animation.onAnimationComplete, [animation], chart);
8324
+					chart.animating = false;
8325
+					animations.splice(i, 1);
8326
+				} else {
8327
+					++i;
8328
+				}
8329
+			}
8330
+		}
8331
+	};
8332
+
8333
+	/**
8334
+	 * Provided for backward compatibility, use Chart.Animation instead
8335
+	 * @prop Chart.Animation#animationObject
8336
+	 * @deprecated since version 2.6.0
8337
+	 * @todo remove at version 3
8338
+	 */
8339
+	Object.defineProperty(Chart.Animation.prototype, 'animationObject', {
8340
+		get: function() {
8341
+			return this;
8342
+		}
8343
+	});
8344
+
8345
+	/**
8346
+	 * Provided for backward compatibility, use Chart.Animation#chart instead
8347
+	 * @prop Chart.Animation#chartInstance
8348
+	 * @deprecated since version 2.6.0
8349
+	 * @todo remove at version 3
8350
+	 */
8351
+	Object.defineProperty(Chart.Animation.prototype, 'chartInstance', {
8352
+		get: function() {
8353
+			return this.chart;
8354
+		},
8355
+		set: function(value) {
8356
+			this.chart = value;
8357
+		}
8358
+	});
8359
+
8360
+};
8361
+
8362
+},{"25":25,"26":26,"45":45}],23:[function(require,module,exports){
8363
+'use strict';
8364
+
8365
+var defaults = require(25);
8366
+var helpers = require(45);
8367
+var Interaction = require(28);
8368
+var layouts = require(30);
8369
+var platform = require(48);
8370
+var plugins = require(31);
8371
+
8372
+module.exports = function(Chart) {
8373
+
8374
+	// Create a dictionary of chart types, to allow for extension of existing types
8375
+	Chart.types = {};
8376
+
8377
+	// Store a reference to each instance - allowing us to globally resize chart instances on window resize.
8378
+	// Destroy method on the chart will remove the instance of the chart from this reference.
8379
+	Chart.instances = {};
8380
+
8381
+	// Controllers available for dataset visualization eg. bar, line, slice, etc.
8382
+	Chart.controllers = {};
8383
+
8384
+	/**
8385
+	 * Initializes the given config with global and chart default values.
8386
+	 */
8387
+	function initConfig(config) {
8388
+		config = config || {};
8389
+
8390
+		// Do NOT use configMerge() for the data object because this method merges arrays
8391
+		// and so would change references to labels and datasets, preventing data updates.
8392
+		var data = config.data = config.data || {};
8393
+		data.datasets = data.datasets || [];
8394
+		data.labels = data.labels || [];
8395
+
8396
+		config.options = helpers.configMerge(
8397
+			defaults.global,
8398
+			defaults[config.type],
8399
+			config.options || {});
8400
+
8401
+		return config;
8402
+	}
8403
+
8404
+	/**
8405
+	 * Updates the config of the chart
8406
+	 * @param chart {Chart} chart to update the options for
8407
+	 */
8408
+	function updateConfig(chart) {
8409
+		var newOptions = chart.options;
8410
+
8411
+		helpers.each(chart.scales, function(scale) {
8412
+			layouts.removeBox(chart, scale);
8413
+		});
8414
+
8415
+		newOptions = helpers.configMerge(
8416
+			Chart.defaults.global,
8417
+			Chart.defaults[chart.config.type],
8418
+			newOptions);
8419
+
8420
+		chart.options = chart.config.options = newOptions;
8421
+		chart.ensureScalesHaveIDs();
8422
+		chart.buildOrUpdateScales();
8423
+		// Tooltip
8424
+		chart.tooltip._options = newOptions.tooltips;
8425
+		chart.tooltip.initialize();
8426
+	}
8427
+
8428
+	function positionIsHorizontal(position) {
8429
+		return position === 'top' || position === 'bottom';
8430
+	}
8431
+
8432
+	helpers.extend(Chart.prototype, /** @lends Chart */ {
8433
+		/**
8434
+		 * @private
8435
+		 */
8436
+		construct: function(item, config) {
8437
+			var me = this;
8438
+
8439
+			config = initConfig(config);
8440
+
8441
+			var context = platform.acquireContext(item, config);
8442
+			var canvas = context && context.canvas;
8443
+			var height = canvas && canvas.height;
8444
+			var width = canvas && canvas.width;
8445
+
8446
+			me.id = helpers.uid();
8447
+			me.ctx = context;
8448
+			me.canvas = canvas;
8449
+			me.config = config;
8450
+			me.width = width;
8451
+			me.height = height;
8452
+			me.aspectRatio = height ? width / height : null;
8453
+			me.options = config.options;
8454
+			me._bufferedRender = false;
8455
+
8456
+			/**
8457
+			 * Provided for backward compatibility, Chart and Chart.Controller have been merged,
8458
+			 * the "instance" still need to be defined since it might be called from plugins.
8459
+			 * @prop Chart#chart
8460
+			 * @deprecated since version 2.6.0
8461
+			 * @todo remove at version 3
8462
+			 * @private
8463
+			 */
8464
+			me.chart = me;
8465
+			me.controller = me; // chart.chart.controller #inception
8466
+
8467
+			// Add the chart instance to the global namespace
8468
+			Chart.instances[me.id] = me;
8469
+
8470
+			// Define alias to the config data: `chart.data === chart.config.data`
8471
+			Object.defineProperty(me, 'data', {
8472
+				get: function() {
8473
+					return me.config.data;
8474
+				},
8475
+				set: function(value) {
8476
+					me.config.data = value;
8477
+				}
8478
+			});
8479
+
8480
+			if (!context || !canvas) {
8481
+				// The given item is not a compatible context2d element, let's return before finalizing
8482
+				// the chart initialization but after setting basic chart / controller properties that
8483
+				// can help to figure out that the chart is not valid (e.g chart.canvas !== null);
8484
+				// https://github.com/chartjs/Chart.js/issues/2807
8485
+				console.error("Failed to create chart: can't acquire context from the given item");
8486
+				return;
8487
+			}
8488
+
8489
+			me.initialize();
8490
+			me.update();
8491
+		},
8492
+
8493
+		/**
8494
+		 * @private
8495
+		 */
8496
+		initialize: function() {
8497
+			var me = this;
8498
+
8499
+			// Before init plugin notification
8500
+			plugins.notify(me, 'beforeInit');
8501
+
8502
+			helpers.retinaScale(me, me.options.devicePixelRatio);
8503
+
8504
+			me.bindEvents();
8505
+
8506
+			if (me.options.responsive) {
8507
+				// Initial resize before chart draws (must be silent to preserve initial animations).
8508
+				me.resize(true);
8509
+			}
8510
+
8511
+			// Make sure scales have IDs and are built before we build any controllers.
8512
+			me.ensureScalesHaveIDs();
8513
+			me.buildOrUpdateScales();
8514
+			me.initToolTip();
8515
+
8516
+			// After init plugin notification
8517
+			plugins.notify(me, 'afterInit');
8518
+
8519
+			return me;
8520
+		},
8521
+
8522
+		clear: function() {
8523
+			helpers.canvas.clear(this);
8524
+			return this;
8525
+		},
8526
+
8527
+		stop: function() {
8528
+			// Stops any current animation loop occurring
8529
+			Chart.animationService.cancelAnimation(this);
8530
+			return this;
8531
+		},
8532
+
8533
+		resize: function(silent) {
8534
+			var me = this;
8535
+			var options = me.options;
8536
+			var canvas = me.canvas;
8537
+			var aspectRatio = (options.maintainAspectRatio && me.aspectRatio) || null;
8538
+
8539
+			// the canvas render width and height will be casted to integers so make sure that
8540
+			// the canvas display style uses the same integer values to avoid blurring effect.
8541
+
8542
+			// Set to 0 instead of canvas.size because the size defaults to 300x150 if the element is collased
8543
+			var newWidth = Math.max(0, Math.floor(helpers.getMaximumWidth(canvas)));
8544
+			var newHeight = Math.max(0, Math.floor(aspectRatio ? newWidth / aspectRatio : helpers.getMaximumHeight(canvas)));
8545
+
8546
+			if (me.width === newWidth && me.height === newHeight) {
8547
+				return;
8548
+			}
8549
+
8550
+			canvas.width = me.width = newWidth;
8551
+			canvas.height = me.height = newHeight;
8552
+			canvas.style.width = newWidth + 'px';
8553
+			canvas.style.height = newHeight + 'px';
8554
+
8555
+			helpers.retinaScale(me, options.devicePixelRatio);
8556
+
8557
+			if (!silent) {
8558
+				// Notify any plugins about the resize
8559
+				var newSize = {width: newWidth, height: newHeight};
8560
+				plugins.notify(me, 'resize', [newSize]);
8561
+
8562
+				// Notify of resize
8563
+				if (me.options.onResize) {
8564
+					me.options.onResize(me, newSize);
8565
+				}
8566
+
8567
+				me.stop();
8568
+				me.update(me.options.responsiveAnimationDuration);
8569
+			}
8570
+		},
8571
+
8572
+		ensureScalesHaveIDs: function() {
8573
+			var options = this.options;
8574
+			var scalesOptions = options.scales || {};
8575
+			var scaleOptions = options.scale;
8576
+
8577
+			helpers.each(scalesOptions.xAxes, function(xAxisOptions, index) {
8578
+				xAxisOptions.id = xAxisOptions.id || ('x-axis-' + index);
8579
+			});
8580
+
8581
+			helpers.each(scalesOptions.yAxes, function(yAxisOptions, index) {
8582
+				yAxisOptions.id = yAxisOptions.id || ('y-axis-' + index);
8583
+			});
8584
+
8585
+			if (scaleOptions) {
8586
+				scaleOptions.id = scaleOptions.id || 'scale';
8587
+			}
8588
+		},
8589
+
8590
+		/**
8591
+		 * Builds a map of scale ID to scale object for future lookup.
8592
+		 */
8593
+		buildOrUpdateScales: function() {
8594
+			var me = this;
8595
+			var options = me.options;
8596
+			var scales = me.scales || {};
8597
+			var items = [];
8598
+			var updated = Object.keys(scales).reduce(function(obj, id) {
8599
+				obj[id] = false;
8600
+				return obj;
8601
+			}, {});
8602
+
8603
+			if (options.scales) {
8604
+				items = items.concat(
8605
+					(options.scales.xAxes || []).map(function(xAxisOptions) {
8606
+						return {options: xAxisOptions, dtype: 'category', dposition: 'bottom'};
8607
+					}),
8608
+					(options.scales.yAxes || []).map(function(yAxisOptions) {
8609
+						return {options: yAxisOptions, dtype: 'linear', dposition: 'left'};
8610
+					})
8611
+				);
8612
+			}
8613
+
8614
+			if (options.scale) {
8615
+				items.push({
8616
+					options: options.scale,
8617
+					dtype: 'radialLinear',
8618
+					isDefault: true,
8619
+					dposition: 'chartArea'
8620
+				});
8621
+			}
8622
+
8623
+			helpers.each(items, function(item) {
8624
+				var scaleOptions = item.options;
8625
+				var id = scaleOptions.id;
8626
+				var scaleType = helpers.valueOrDefault(scaleOptions.type, item.dtype);
8627
+
8628
+				if (positionIsHorizontal(scaleOptions.position) !== positionIsHorizontal(item.dposition)) {
8629
+					scaleOptions.position = item.dposition;
8630
+				}
8631
+
8632
+				updated[id] = true;
8633
+				var scale = null;
8634
+				if (id in scales && scales[id].type === scaleType) {
8635
+					scale = scales[id];
8636
+					scale.options = scaleOptions;
8637
+					scale.ctx = me.ctx;
8638
+					scale.chart = me;
8639
+				} else {
8640
+					var scaleClass = Chart.scaleService.getScaleConstructor(scaleType);
8641
+					if (!scaleClass) {
8642
+						return;
8643
+					}
8644
+					scale = new scaleClass({
8645
+						id: id,
8646
+						type: scaleType,
8647
+						options: scaleOptions,
8648
+						ctx: me.ctx,
8649
+						chart: me
8650
+					});
8651
+					scales[scale.id] = scale;
8652
+				}
8653
+
8654
+				scale.mergeTicksOptions();
8655
+
8656
+				// TODO(SB): I think we should be able to remove this custom case (options.scale)
8657
+				// and consider it as a regular scale part of the "scales"" map only! This would
8658
+				// make the logic easier and remove some useless? custom code.
8659
+				if (item.isDefault) {
8660
+					me.scale = scale;
8661
+				}
8662
+			});
8663
+			// clear up discarded scales
8664
+			helpers.each(updated, function(hasUpdated, id) {
8665
+				if (!hasUpdated) {
8666
+					delete scales[id];
8667
+				}
8668
+			});
8669
+
8670
+			me.scales = scales;
8671
+
8672
+			Chart.scaleService.addScalesToLayout(this);
8673
+		},
8674
+
8675
+		buildOrUpdateControllers: function() {
8676
+			var me = this;
8677
+			var types = [];
8678
+			var newControllers = [];
8679
+
8680
+			helpers.each(me.data.datasets, function(dataset, datasetIndex) {
8681
+				var meta = me.getDatasetMeta(datasetIndex);
8682
+				var type = dataset.type || me.config.type;
8683
+
8684
+				if (meta.type && meta.type !== type) {
8685
+					me.destroyDatasetMeta(datasetIndex);
8686
+					meta = me.getDatasetMeta(datasetIndex);
8687
+				}
8688
+				meta.type = type;
8689
+
8690
+				types.push(meta.type);
8691
+
8692
+				if (meta.controller) {
8693
+					meta.controller.updateIndex(datasetIndex);
8694
+					meta.controller.linkScales();
8695
+				} else {
8696
+					var ControllerClass = Chart.controllers[meta.type];
8697
+					if (ControllerClass === undefined) {
8698
+						throw new Error('"' + meta.type + '" is not a chart type.');
8699
+					}
8700
+
8701
+					meta.controller = new ControllerClass(me, datasetIndex);
8702
+					newControllers.push(meta.controller);
8703
+				}
8704
+			}, me);
8705
+
8706
+			return newControllers;
8707
+		},
8708
+
8709
+		/**
8710
+		 * Reset the elements of all datasets
8711
+		 * @private
8712
+		 */
8713
+		resetElements: function() {
8714
+			var me = this;
8715
+			helpers.each(me.data.datasets, function(dataset, datasetIndex) {
8716
+				me.getDatasetMeta(datasetIndex).controller.reset();
8717
+			}, me);
8718
+		},
8719
+
8720
+		/**
8721
+		* Resets the chart back to it's state before the initial animation
8722
+		*/
8723
+		reset: function() {
8724
+			this.resetElements();
8725
+			this.tooltip.initialize();
8726
+		},
8727
+
8728
+		update: function(config) {
8729
+			var me = this;
8730
+
8731
+			if (!config || typeof config !== 'object') {
8732
+				// backwards compatibility
8733
+				config = {
8734
+					duration: config,
8735
+					lazy: arguments[1]
8736
+				};
8737
+			}
8738
+
8739
+			updateConfig(me);
8740
+
8741
+			// plugins options references might have change, let's invalidate the cache
8742
+			// https://github.com/chartjs/Chart.js/issues/5111#issuecomment-355934167
8743
+			plugins._invalidate(me);
8744
+
8745
+			if (plugins.notify(me, 'beforeUpdate') === false) {
8746
+				return;
8747
+			}
8748
+
8749
+			// In case the entire data object changed
8750
+			me.tooltip._data = me.data;
8751
+
8752
+			// Make sure dataset controllers are updated and new controllers are reset
8753
+			var newControllers = me.buildOrUpdateControllers();
8754
+
8755
+			// Make sure all dataset controllers have correct meta data counts
8756
+			helpers.each(me.data.datasets, function(dataset, datasetIndex) {
8757
+				me.getDatasetMeta(datasetIndex).controller.buildOrUpdateElements();
8758
+			}, me);
8759
+
8760
+			me.updateLayout();
8761
+
8762
+			// Can only reset the new controllers after the scales have been updated
8763
+			if (me.options.animation && me.options.animation.duration) {
8764
+				helpers.each(newControllers, function(controller) {
8765
+					controller.reset();
8766
+				});
8767
+			}
8768
+
8769
+			me.updateDatasets();
8770
+
8771
+			// Need to reset tooltip in case it is displayed with elements that are removed
8772
+			// after update.
8773
+			me.tooltip.initialize();
8774
+
8775
+			// Last active contains items that were previously in the tooltip.
8776
+			// When we reset the tooltip, we need to clear it
8777
+			me.lastActive = [];
8778
+
8779
+			// Do this before render so that any plugins that need final scale updates can use it
8780
+			plugins.notify(me, 'afterUpdate');
8781
+
8782
+			if (me._bufferedRender) {
8783
+				me._bufferedRequest = {
8784
+					duration: config.duration,
8785
+					easing: config.easing,
8786
+					lazy: config.lazy
8787
+				};
8788
+			} else {
8789
+				me.render(config);
8790
+			}
8791
+		},
8792
+
8793
+		/**
8794
+		 * Updates the chart layout unless a plugin returns `false` to the `beforeLayout`
8795
+		 * hook, in which case, plugins will not be called on `afterLayout`.
8796
+		 * @private
8797
+		 */
8798
+		updateLayout: function() {
8799
+			var me = this;
8800
+
8801
+			if (plugins.notify(me, 'beforeLayout') === false) {
8802
+				return;
8803
+			}
8804
+
8805
+			layouts.update(this, this.width, this.height);
8806
+
8807
+			/**
8808
+			 * Provided for backward compatibility, use `afterLayout` instead.
8809
+			 * @method IPlugin#afterScaleUpdate
8810
+			 * @deprecated since version 2.5.0
8811
+			 * @todo remove at version 3
8812
+			 * @private
8813
+			 */
8814
+			plugins.notify(me, 'afterScaleUpdate');
8815
+			plugins.notify(me, 'afterLayout');
8816
+		},
8817
+
8818
+		/**
8819
+		 * Updates all datasets unless a plugin returns `false` to the `beforeDatasetsUpdate`
8820
+		 * hook, in which case, plugins will not be called on `afterDatasetsUpdate`.
8821
+		 * @private
8822
+		 */
8823
+		updateDatasets: function() {
8824
+			var me = this;
8825
+
8826
+			if (plugins.notify(me, 'beforeDatasetsUpdate') === false) {
8827
+				return;
8828
+			}
8829
+
8830
+			for (var i = 0, ilen = me.data.datasets.length; i < ilen; ++i) {
8831
+				me.updateDataset(i);
8832
+			}
8833
+
8834
+			plugins.notify(me, 'afterDatasetsUpdate');
8835
+		},
8836
+
8837
+		/**
8838
+		 * Updates dataset at index unless a plugin returns `false` to the `beforeDatasetUpdate`
8839
+		 * hook, in which case, plugins will not be called on `afterDatasetUpdate`.
8840
+		 * @private
8841
+		 */
8842
+		updateDataset: function(index) {
8843
+			var me = this;
8844
+			var meta = me.getDatasetMeta(index);
8845
+			var args = {
8846
+				meta: meta,
8847
+				index: index
8848
+			};
8849
+
8850
+			if (plugins.notify(me, 'beforeDatasetUpdate', [args]) === false) {
8851
+				return;
8852
+			}
8853
+
8854
+			meta.controller.update();
8855
+
8856
+			plugins.notify(me, 'afterDatasetUpdate', [args]);
8857
+		},
8858
+
8859
+		render: function(config) {
8860
+			var me = this;
8861
+
8862
+			if (!config || typeof config !== 'object') {
8863
+				// backwards compatibility
8864
+				config = {
8865
+					duration: config,
8866
+					lazy: arguments[1]
8867
+				};
8868
+			}
8869
+
8870
+			var duration = config.duration;
8871
+			var lazy = config.lazy;
8872
+
8873
+			if (plugins.notify(me, 'beforeRender') === false) {
8874
+				return;
8875
+			}
8876
+
8877
+			var animationOptions = me.options.animation;
8878
+			var onComplete = function(animation) {
8879
+				plugins.notify(me, 'afterRender');
8880
+				helpers.callback(animationOptions && animationOptions.onComplete, [animation], me);
8881
+			};
8882
+
8883
+			if (animationOptions && ((typeof duration !== 'undefined' && duration !== 0) || (typeof duration === 'undefined' && animationOptions.duration !== 0))) {
8884
+				var animation = new Chart.Animation({
8885
+					numSteps: (duration || animationOptions.duration) / 16.66, // 60 fps
8886
+					easing: config.easing || animationOptions.easing,
8887
+
8888
+					render: function(chart, animationObject) {
8889
+						var easingFunction = helpers.easing.effects[animationObject.easing];
8890
+						var currentStep = animationObject.currentStep;
8891
+						var stepDecimal = currentStep / animationObject.numSteps;
8892
+
8893
+						chart.draw(easingFunction(stepDecimal), stepDecimal, currentStep);
8894
+					},
8895
+
8896
+					onAnimationProgress: animationOptions.onProgress,
8897
+					onAnimationComplete: onComplete
8898
+				});
8899
+
8900
+				Chart.animationService.addAnimation(me, animation, duration, lazy);
8901
+			} else {
8902
+				me.draw();
8903
+
8904
+				// See https://github.com/chartjs/Chart.js/issues/3781
8905
+				onComplete(new Chart.Animation({numSteps: 0, chart: me}));
8906
+			}
8907
+
8908
+			return me;
8909
+		},
8910
+
8911
+		draw: function(easingValue) {
8912
+			var me = this;
8913
+
8914
+			me.clear();
8915
+
8916
+			if (helpers.isNullOrUndef(easingValue)) {
8917
+				easingValue = 1;
8918
+			}
8919
+
8920
+			me.transition(easingValue);
8921
+
8922
+			if (plugins.notify(me, 'beforeDraw', [easingValue]) === false) {
8923
+				return;
8924
+			}
8925
+
8926
+			// Draw all the scales
8927
+			helpers.each(me.boxes, function(box) {
8928
+				box.draw(me.chartArea);
8929
+			}, me);
8930
+
8931
+			if (me.scale) {
8932
+				me.scale.draw();
8933
+			}
8934
+
8935
+			me.drawDatasets(easingValue);
8936
+			me._drawTooltip(easingValue);
8937
+
8938
+			plugins.notify(me, 'afterDraw', [easingValue]);
8939
+		},
8940
+
8941
+		/**
8942
+		 * @private
8943
+		 */
8944
+		transition: function(easingValue) {
8945
+			var me = this;
8946
+
8947
+			for (var i = 0, ilen = (me.data.datasets || []).length; i < ilen; ++i) {
8948
+				if (me.isDatasetVisible(i)) {
8949
+					me.getDatasetMeta(i).controller.transition(easingValue);
8950
+				}
8951
+			}
8952
+
8953
+			me.tooltip.transition(easingValue);
8954
+		},
8955
+
8956
+		/**
8957
+		 * Draws all datasets unless a plugin returns `false` to the `beforeDatasetsDraw`
8958
+		 * hook, in which case, plugins will not be called on `afterDatasetsDraw`.
8959
+		 * @private
8960
+		 */
8961
+		drawDatasets: function(easingValue) {
8962
+			var me = this;
8963
+
8964
+			if (plugins.notify(me, 'beforeDatasetsDraw', [easingValue]) === false) {
8965
+				return;
8966
+			}
8967
+
8968
+			// Draw datasets reversed to support proper line stacking
8969
+			for (var i = (me.data.datasets || []).length - 1; i >= 0; --i) {
8970
+				if (me.isDatasetVisible(i)) {
8971
+					me.drawDataset(i, easingValue);
8972
+				}
8973
+			}
8974
+
8975
+			plugins.notify(me, 'afterDatasetsDraw', [easingValue]);
8976
+		},
8977
+
8978
+		/**
8979
+		 * Draws dataset at index unless a plugin returns `false` to the `beforeDatasetDraw`
8980
+		 * hook, in which case, plugins will not be called on `afterDatasetDraw`.
8981
+		 * @private
8982
+		 */
8983
+		drawDataset: function(index, easingValue) {
8984
+			var me = this;
8985
+			var meta = me.getDatasetMeta(index);
8986
+			var args = {
8987
+				meta: meta,
8988
+				index: index,
8989
+				easingValue: easingValue
8990
+			};
8991
+
8992
+			if (plugins.notify(me, 'beforeDatasetDraw', [args]) === false) {
8993
+				return;
8994
+			}
8995
+
8996
+			meta.controller.draw(easingValue);
8997
+
8998
+			plugins.notify(me, 'afterDatasetDraw', [args]);
8999
+		},
9000
+
9001
+		/**
9002
+		 * Draws tooltip unless a plugin returns `false` to the `beforeTooltipDraw`
9003
+		 * hook, in which case, plugins will not be called on `afterTooltipDraw`.
9004
+		 * @private
9005
+		 */
9006
+		_drawTooltip: function(easingValue) {
9007
+			var me = this;
9008
+			var tooltip = me.tooltip;
9009
+			var args = {
9010
+				tooltip: tooltip,
9011
+				easingValue: easingValue
9012
+			};
9013
+
9014
+			if (plugins.notify(me, 'beforeTooltipDraw', [args]) === false) {
9015
+				return;
9016
+			}
9017
+
9018
+			tooltip.draw();
9019
+
9020
+			plugins.notify(me, 'afterTooltipDraw', [args]);
9021
+		},
9022
+
9023
+		// Get the single element that was clicked on
9024
+		// @return : An object containing the dataset index and element index of the matching element. Also contains the rectangle that was draw
9025
+		getElementAtEvent: function(e) {
9026
+			return Interaction.modes.single(this, e);
9027
+		},
9028
+
9029
+		getElementsAtEvent: function(e) {
9030
+			return Interaction.modes.label(this, e, {intersect: true});
9031
+		},
9032
+
9033
+		getElementsAtXAxis: function(e) {
9034
+			return Interaction.modes['x-axis'](this, e, {intersect: true});
9035
+		},
9036
+
9037
+		getElementsAtEventForMode: function(e, mode, options) {
9038
+			var method = Interaction.modes[mode];
9039
+			if (typeof method === 'function') {
9040
+				return method(this, e, options);
9041
+			}
9042
+
9043
+			return [];
9044
+		},
9045
+
9046
+		getDatasetAtEvent: function(e) {
9047
+			return Interaction.modes.dataset(this, e, {intersect: true});
9048
+		},
9049
+
9050
+		getDatasetMeta: function(datasetIndex) {
9051
+			var me = this;
9052
+			var dataset = me.data.datasets[datasetIndex];
9053
+			if (!dataset._meta) {
9054
+				dataset._meta = {};
9055
+			}
9056
+
9057
+			var meta = dataset._meta[me.id];
9058
+			if (!meta) {
9059
+				meta = dataset._meta[me.id] = {
9060
+					type: null,
9061
+					data: [],
9062
+					dataset: null,
9063
+					controller: null,
9064
+					hidden: null,			// See isDatasetVisible() comment
9065
+					xAxisID: null,
9066
+					yAxisID: null
9067
+				};
9068
+			}
9069
+
9070
+			return meta;
9071
+		},
9072
+
9073
+		getVisibleDatasetCount: function() {
9074
+			var count = 0;
9075
+			for (var i = 0, ilen = this.data.datasets.length; i < ilen; ++i) {
9076
+				if (this.isDatasetVisible(i)) {
9077
+					count++;
9078
+				}
9079
+			}
9080
+			return count;
9081
+		},
9082
+
9083
+		isDatasetVisible: function(datasetIndex) {
9084
+			var meta = this.getDatasetMeta(datasetIndex);
9085
+
9086
+			// meta.hidden is a per chart dataset hidden flag override with 3 states: if true or false,
9087
+			// the dataset.hidden value is ignored, else if null, the dataset hidden state is returned.
9088
+			return typeof meta.hidden === 'boolean' ? !meta.hidden : !this.data.datasets[datasetIndex].hidden;
9089
+		},
9090
+
9091
+		generateLegend: function() {
9092
+			return this.options.legendCallback(this);
9093
+		},
9094
+
9095
+		/**
9096
+		 * @private
9097
+		 */
9098
+		destroyDatasetMeta: function(datasetIndex) {
9099
+			var id = this.id;
9100
+			var dataset = this.data.datasets[datasetIndex];
9101
+			var meta = dataset._meta && dataset._meta[id];
9102
+
9103
+			if (meta) {
9104
+				meta.controller.destroy();
9105
+				delete dataset._meta[id];
9106
+			}
9107
+		},
9108
+
9109
+		destroy: function() {
9110
+			var me = this;
9111
+			var canvas = me.canvas;
9112
+			var i, ilen;
9113
+
9114
+			me.stop();
9115
+
9116
+			// dataset controllers need to cleanup associated data
9117
+			for (i = 0, ilen = me.data.datasets.length; i < ilen; ++i) {
9118
+				me.destroyDatasetMeta(i);
9119
+			}
9120
+
9121
+			if (canvas) {
9122
+				me.unbindEvents();
9123
+				helpers.canvas.clear(me);
9124
+				platform.releaseContext(me.ctx);
9125
+				me.canvas = null;
9126
+				me.ctx = null;
9127
+			}
9128
+
9129
+			plugins.notify(me, 'destroy');
9130
+
9131
+			delete Chart.instances[me.id];
9132
+		},
9133
+
9134
+		toBase64Image: function() {
9135
+			return this.canvas.toDataURL.apply(this.canvas, arguments);
9136
+		},
9137
+
9138
+		initToolTip: function() {
9139
+			var me = this;
9140
+			me.tooltip = new Chart.Tooltip({
9141
+				_chart: me,
9142
+				_chartInstance: me, // deprecated, backward compatibility
9143
+				_data: me.data,
9144
+				_options: me.options.tooltips
9145
+			}, me);
9146
+		},
9147
+
9148
+		/**
9149
+		 * @private
9150
+		 */
9151
+		bindEvents: function() {
9152
+			var me = this;
9153
+			var listeners = me._listeners = {};
9154
+			var listener = function() {
9155
+				me.eventHandler.apply(me, arguments);
9156
+			};
9157
+
9158
+			helpers.each(me.options.events, function(type) {
9159
+				platform.addEventListener(me, type, listener);
9160
+				listeners[type] = listener;
9161
+			});
9162
+
9163
+			// Elements used to detect size change should not be injected for non responsive charts.
9164
+			// See https://github.com/chartjs/Chart.js/issues/2210
9165
+			if (me.options.responsive) {
9166
+				listener = function() {
9167
+					me.resize();
9168
+				};
9169
+
9170
+				platform.addEventListener(me, 'resize', listener);
9171
+				listeners.resize = listener;
9172
+			}
9173
+		},
9174
+
9175
+		/**
9176
+		 * @private
9177
+		 */
9178
+		unbindEvents: function() {
9179
+			var me = this;
9180
+			var listeners = me._listeners;
9181
+			if (!listeners) {
9182
+				return;
9183
+			}
9184
+
9185
+			delete me._listeners;
9186
+			helpers.each(listeners, function(listener, type) {
9187
+				platform.removeEventListener(me, type, listener);
9188
+			});
9189
+		},
9190
+
9191
+		updateHoverStyle: function(elements, mode, enabled) {
9192
+			var method = enabled ? 'setHoverStyle' : 'removeHoverStyle';
9193
+			var element, i, ilen;
9194
+
9195
+			for (i = 0, ilen = elements.length; i < ilen; ++i) {
9196
+				element = elements[i];
9197
+				if (element) {
9198
+					this.getDatasetMeta(element._datasetIndex).controller[method](element);
9199
+				}
9200
+			}
9201
+		},
9202
+
9203
+		/**
9204
+		 * @private
9205
+		 */
9206
+		eventHandler: function(e) {
9207
+			var me = this;
9208
+			var tooltip = me.tooltip;
9209
+
9210
+			if (plugins.notify(me, 'beforeEvent', [e]) === false) {
9211
+				return;
9212
+			}
9213
+
9214
+			// Buffer any update calls so that renders do not occur
9215
+			me._bufferedRender = true;
9216
+			me._bufferedRequest = null;
9217
+
9218
+			var changed = me.handleEvent(e);
9219
+			// for smooth tooltip animations issue #4989
9220
+			// the tooltip should be the source of change
9221
+			// Animation check workaround:
9222
+			// tooltip._start will be null when tooltip isn't animating
9223
+			if (tooltip) {
9224
+				changed = tooltip._start
9225
+					? tooltip.handleEvent(e)
9226
+					: changed | tooltip.handleEvent(e);
9227
+			}
9228
+
9229
+			plugins.notify(me, 'afterEvent', [e]);
9230
+
9231
+			var bufferedRequest = me._bufferedRequest;
9232
+			if (bufferedRequest) {
9233
+				// If we have an update that was triggered, we need to do a normal render
9234
+				me.render(bufferedRequest);
9235
+			} else if (changed && !me.animating) {
9236
+				// If entering, leaving, or changing elements, animate the change via pivot
9237
+				me.stop();
9238
+
9239
+				// We only need to render at this point. Updating will cause scales to be
9240
+				// recomputed generating flicker & using more memory than necessary.
9241
+				me.render(me.options.hover.animationDuration, true);
9242
+			}
9243
+
9244
+			me._bufferedRender = false;
9245
+			me._bufferedRequest = null;
9246
+
9247
+			return me;
9248
+		},
9249
+
9250
+		/**
9251
+		 * Handle an event
9252
+		 * @private
9253
+		 * @param {IEvent} event the event to handle
9254
+		 * @return {Boolean} true if the chart needs to re-render
9255
+		 */
9256
+		handleEvent: function(e) {
9257
+			var me = this;
9258
+			var options = me.options || {};
9259
+			var hoverOptions = options.hover;
9260
+			var changed = false;
9261
+
9262
+			me.lastActive = me.lastActive || [];
9263
+
9264
+			// Find Active Elements for hover and tooltips
9265
+			if (e.type === 'mouseout') {
9266
+				me.active = [];
9267
+			} else {
9268
+				me.active = me.getElementsAtEventForMode(e, hoverOptions.mode, hoverOptions);
9269
+			}
9270
+
9271
+			// Invoke onHover hook
9272
+			// Need to call with native event here to not break backwards compatibility
9273
+			helpers.callback(options.onHover || options.hover.onHover, [e.native, me.active], me);
9274
+
9275
+			if (e.type === 'mouseup' || e.type === 'click') {
9276
+				if (options.onClick) {
9277
+					// Use e.native here for backwards compatibility
9278
+					options.onClick.call(me, e.native, me.active);
9279
+				}
9280
+			}
9281
+
9282
+			// Remove styling for last active (even if it may still be active)
9283
+			if (me.lastActive.length) {
9284
+				me.updateHoverStyle(me.lastActive, hoverOptions.mode, false);
9285
+			}
9286
+
9287
+			// Built in hover styling
9288
+			if (me.active.length && hoverOptions.mode) {
9289
+				me.updateHoverStyle(me.active, hoverOptions.mode, true);
9290
+			}
9291
+
9292
+			changed = !helpers.arrayEquals(me.active, me.lastActive);
9293
+
9294
+			// Remember Last Actives
9295
+			me.lastActive = me.active;
9296
+
9297
+			return changed;
9298
+		}
9299
+	});
9300
+
9301
+	/**
9302
+	 * Provided for backward compatibility, use Chart instead.
9303
+	 * @class Chart.Controller
9304
+	 * @deprecated since version 2.6.0
9305
+	 * @todo remove at version 3
9306
+	 * @private
9307
+	 */
9308
+	Chart.Controller = Chart;
9309
+};
9310
+
9311
+},{"25":25,"28":28,"30":30,"31":31,"45":45,"48":48}],24:[function(require,module,exports){
9312
+'use strict';
9313
+
9314
+var helpers = require(45);
9315
+
9316
+module.exports = function(Chart) {
9317
+
9318
+	var arrayEvents = ['push', 'pop', 'shift', 'splice', 'unshift'];
9319
+
9320
+	/**
9321
+	 * Hooks the array methods that add or remove values ('push', pop', 'shift', 'splice',
9322
+	 * 'unshift') and notify the listener AFTER the array has been altered. Listeners are
9323
+	 * called on the 'onData*' callbacks (e.g. onDataPush, etc.) with same arguments.
9324
+	 */
9325
+	function listenArrayEvents(array, listener) {
9326
+		if (array._chartjs) {
9327
+			array._chartjs.listeners.push(listener);
9328
+			return;
9329
+		}
9330
+
9331
+		Object.defineProperty(array, '_chartjs', {
9332
+			configurable: true,
9333
+			enumerable: false,
9334
+			value: {
9335
+				listeners: [listener]
9336
+			}
9337
+		});
9338
+
9339
+		arrayEvents.forEach(function(key) {
9340
+			var method = 'onData' + key.charAt(0).toUpperCase() + key.slice(1);
9341
+			var base = array[key];
9342
+
9343
+			Object.defineProperty(array, key, {
9344
+				configurable: true,
9345
+				enumerable: false,
9346
+				value: function() {
9347
+					var args = Array.prototype.slice.call(arguments);
9348
+					var res = base.apply(this, args);
9349
+
9350
+					helpers.each(array._chartjs.listeners, function(object) {
9351
+						if (typeof object[method] === 'function') {
9352
+							object[method].apply(object, args);
9353
+						}
9354
+					});
9355
+
9356
+					return res;
9357
+				}
9358
+			});
9359
+		});
9360
+	}
9361
+
9362
+	/**
9363
+	 * Removes the given array event listener and cleanup extra attached properties (such as
9364
+	 * the _chartjs stub and overridden methods) if array doesn't have any more listeners.
9365
+	 */
9366
+	function unlistenArrayEvents(array, listener) {
9367
+		var stub = array._chartjs;
9368
+		if (!stub) {
9369
+			return;
9370
+		}
9371
+
9372
+		var listeners = stub.listeners;
9373
+		var index = listeners.indexOf(listener);
9374
+		if (index !== -1) {
9375
+			listeners.splice(index, 1);
9376
+		}
9377
+
9378
+		if (listeners.length > 0) {
9379
+			return;
9380
+		}
9381
+
9382
+		arrayEvents.forEach(function(key) {
9383
+			delete array[key];
9384
+		});
9385
+
9386
+		delete array._chartjs;
9387
+	}
9388
+
9389
+	// Base class for all dataset controllers (line, bar, etc)
9390
+	Chart.DatasetController = function(chart, datasetIndex) {
9391
+		this.initialize(chart, datasetIndex);
9392
+	};
9393
+
9394
+	helpers.extend(Chart.DatasetController.prototype, {
9395
+
9396
+		/**
9397
+		 * Element type used to generate a meta dataset (e.g. Chart.element.Line).
9398
+		 * @type {Chart.core.element}
9399
+		 */
9400
+		datasetElementType: null,
9401
+
9402
+		/**
9403
+		 * Element type used to generate a meta data (e.g. Chart.element.Point).
9404
+		 * @type {Chart.core.element}
9405
+		 */
9406
+		dataElementType: null,
9407
+
9408
+		initialize: function(chart, datasetIndex) {
9409
+			var me = this;
9410
+			me.chart = chart;
9411
+			me.index = datasetIndex;
9412
+			me.linkScales();
9413
+			me.addElements();
9414
+		},
9415
+
9416
+		updateIndex: function(datasetIndex) {
9417
+			this.index = datasetIndex;
9418
+		},
9419
+
9420
+		linkScales: function() {
9421
+			var me = this;
9422
+			var meta = me.getMeta();
9423
+			var dataset = me.getDataset();
9424
+
9425
+			if (meta.xAxisID === null || !(meta.xAxisID in me.chart.scales)) {
9426
+				meta.xAxisID = dataset.xAxisID || me.chart.options.scales.xAxes[0].id;
9427
+			}
9428
+			if (meta.yAxisID === null || !(meta.yAxisID in me.chart.scales)) {
9429
+				meta.yAxisID = dataset.yAxisID || me.chart.options.scales.yAxes[0].id;
9430
+			}
9431
+		},
9432
+
9433
+		getDataset: function() {
9434
+			return this.chart.data.datasets[this.index];
9435
+		},
9436
+
9437
+		getMeta: function() {
9438
+			return this.chart.getDatasetMeta(this.index);
9439
+		},
9440
+
9441
+		getScaleForId: function(scaleID) {
9442
+			return this.chart.scales[scaleID];
9443
+		},
9444
+
9445
+		reset: function() {
9446
+			this.update(true);
9447
+		},
9448
+
9449
+		/**
9450
+		 * @private
9451
+		 */
9452
+		destroy: function() {
9453
+			if (this._data) {
9454
+				unlistenArrayEvents(this._data, this);
9455
+			}
9456
+		},
9457
+
9458
+		createMetaDataset: function() {
9459
+			var me = this;
9460
+			var type = me.datasetElementType;
9461
+			return type && new type({
9462
+				_chart: me.chart,
9463
+				_datasetIndex: me.index
9464
+			});
9465
+		},
9466
+
9467
+		createMetaData: function(index) {
9468
+			var me = this;
9469
+			var type = me.dataElementType;
9470
+			return type && new type({
9471
+				_chart: me.chart,
9472
+				_datasetIndex: me.index,
9473
+				_index: index
9474
+			});
9475
+		},
9476
+
9477
+		addElements: function() {
9478
+			var me = this;
9479
+			var meta = me.getMeta();
9480
+			var data = me.getDataset().data || [];
9481
+			var metaData = meta.data;
9482
+			var i, ilen;
9483
+
9484
+			for (i = 0, ilen = data.length; i < ilen; ++i) {
9485
+				metaData[i] = metaData[i] || me.createMetaData(i);
9486
+			}
9487
+
9488
+			meta.dataset = meta.dataset || me.createMetaDataset();
9489
+		},
9490
+
9491
+		addElementAndReset: function(index) {
9492
+			var element = this.createMetaData(index);
9493
+			this.getMeta().data.splice(index, 0, element);
9494
+			this.updateElement(element, index, true);
9495
+		},
9496
+
9497
+		buildOrUpdateElements: function() {
9498
+			var me = this;
9499
+			var dataset = me.getDataset();
9500
+			var data = dataset.data || (dataset.data = []);
9501
+
9502
+			// In order to correctly handle data addition/deletion animation (an thus simulate
9503
+			// real-time charts), we need to monitor these data modifications and synchronize
9504
+			// the internal meta data accordingly.
9505
+			if (me._data !== data) {
9506
+				if (me._data) {
9507
+					// This case happens when the user replaced the data array instance.
9508
+					unlistenArrayEvents(me._data, me);
9509
+				}
9510
+
9511
+				listenArrayEvents(data, me);
9512
+				me._data = data;
9513
+			}
9514
+
9515
+			// Re-sync meta data in case the user replaced the data array or if we missed
9516
+			// any updates and so make sure that we handle number of datapoints changing.
9517
+			me.resyncElements();
9518
+		},
9519
+
9520
+		update: helpers.noop,
9521
+
9522
+		transition: function(easingValue) {
9523
+			var meta = this.getMeta();
9524
+			var elements = meta.data || [];
9525
+			var ilen = elements.length;
9526
+			var i = 0;
9527
+
9528
+			for (; i < ilen; ++i) {
9529
+				elements[i].transition(easingValue);
9530
+			}
9531
+
9532
+			if (meta.dataset) {
9533
+				meta.dataset.transition(easingValue);
9534
+			}
9535
+		},
9536
+
9537
+		draw: function() {
9538
+			var meta = this.getMeta();
9539
+			var elements = meta.data || [];
9540
+			var ilen = elements.length;
9541
+			var i = 0;
9542
+
9543
+			if (meta.dataset) {
9544
+				meta.dataset.draw();
9545
+			}
9546
+
9547
+			for (; i < ilen; ++i) {
9548
+				elements[i].draw();
9549
+			}
9550
+		},
9551
+
9552
+		removeHoverStyle: function(element, elementOpts) {
9553
+			var dataset = this.chart.data.datasets[element._datasetIndex];
9554
+			var index = element._index;
9555
+			var custom = element.custom || {};
9556
+			var valueOrDefault = helpers.valueAtIndexOrDefault;
9557
+			var model = element._model;
9558
+
9559
+			model.backgroundColor = custom.backgroundColor ? custom.backgroundColor : valueOrDefault(dataset.backgroundColor, index, elementOpts.backgroundColor);
9560
+			model.borderColor = custom.borderColor ? custom.borderColor : valueOrDefault(dataset.borderColor, index, elementOpts.borderColor);
9561
+			model.borderWidth = custom.borderWidth ? custom.borderWidth : valueOrDefault(dataset.borderWidth, index, elementOpts.borderWidth);
9562
+		},
9563
+
9564
+		setHoverStyle: function(element) {
9565
+			var dataset = this.chart.data.datasets[element._datasetIndex];
9566
+			var index = element._index;
9567
+			var custom = element.custom || {};
9568
+			var valueOrDefault = helpers.valueAtIndexOrDefault;
9569
+			var getHoverColor = helpers.getHoverColor;
9570
+			var model = element._model;
9571
+
9572
+			model.backgroundColor = custom.hoverBackgroundColor ? custom.hoverBackgroundColor : valueOrDefault(dataset.hoverBackgroundColor, index, getHoverColor(model.backgroundColor));
9573
+			model.borderColor = custom.hoverBorderColor ? custom.hoverBorderColor : valueOrDefault(dataset.hoverBorderColor, index, getHoverColor(model.borderColor));
9574
+			model.borderWidth = custom.hoverBorderWidth ? custom.hoverBorderWidth : valueOrDefault(dataset.hoverBorderWidth, index, model.borderWidth);
9575
+		},
9576
+
9577
+		/**
9578
+		 * @private
9579
+		 */
9580
+		resyncElements: function() {
9581
+			var me = this;
9582
+			var meta = me.getMeta();
9583
+			var data = me.getDataset().data;
9584
+			var numMeta = meta.data.length;
9585
+			var numData = data.length;
9586
+
9587
+			if (numData < numMeta) {
9588
+				meta.data.splice(numData, numMeta - numData);
9589
+			} else if (numData > numMeta) {
9590
+				me.insertElements(numMeta, numData - numMeta);
9591
+			}
9592
+		},
9593
+
9594
+		/**
9595
+		 * @private
9596
+		 */
9597
+		insertElements: function(start, count) {
9598
+			for (var i = 0; i < count; ++i) {
9599
+				this.addElementAndReset(start + i);
9600
+			}
9601
+		},
9602
+
9603
+		/**
9604
+		 * @private
9605
+		 */
9606
+		onDataPush: function() {
9607
+			this.insertElements(this.getDataset().data.length - 1, arguments.length);
9608
+		},
9609
+
9610
+		/**
9611
+		 * @private
9612
+		 */
9613
+		onDataPop: function() {
9614
+			this.getMeta().data.pop();
9615
+		},
9616
+
9617
+		/**
9618
+		 * @private
9619
+		 */
9620
+		onDataShift: function() {
9621
+			this.getMeta().data.shift();
9622
+		},
9623
+
9624
+		/**
9625
+		 * @private
9626
+		 */
9627
+		onDataSplice: function(start, count) {
9628
+			this.getMeta().data.splice(start, count);
9629
+			this.insertElements(start, arguments.length - 2);
9630
+		},
9631
+
9632
+		/**
9633
+		 * @private
9634
+		 */
9635
+		onDataUnshift: function() {
9636
+			this.insertElements(0, arguments.length);
9637
+		}
9638
+	});
9639
+
9640
+	Chart.DatasetController.extend = helpers.inherits;
9641
+};
9642
+
9643
+},{"45":45}],25:[function(require,module,exports){
9644
+'use strict';
9645
+
9646
+var helpers = require(45);
9647
+
9648
+module.exports = {
9649
+	/**
9650
+	 * @private
9651
+	 */
9652
+	_set: function(scope, values) {
9653
+		return helpers.merge(this[scope] || (this[scope] = {}), values);
9654
+	}
9655
+};
9656
+
9657
+},{"45":45}],26:[function(require,module,exports){
9658
+'use strict';
9659
+
9660
+var color = require(2);
9661
+var helpers = require(45);
9662
+
9663
+function interpolate(start, view, model, ease) {
9664
+	var keys = Object.keys(model);
9665
+	var i, ilen, key, actual, origin, target, type, c0, c1;
9666
+
9667
+	for (i = 0, ilen = keys.length; i < ilen; ++i) {
9668
+		key = keys[i];
9669
+
9670
+		target = model[key];
9671
+
9672
+		// if a value is added to the model after pivot() has been called, the view
9673
+		// doesn't contain it, so let's initialize the view to the target value.
9674
+		if (!view.hasOwnProperty(key)) {
9675
+			view[key] = target;
9676
+		}
9677
+
9678
+		actual = view[key];
9679
+
9680
+		if (actual === target || key[0] === '_') {
9681
+			continue;
9682
+		}
9683
+
9684
+		if (!start.hasOwnProperty(key)) {
9685
+			start[key] = actual;
9686
+		}
9687
+
9688
+		origin = start[key];
9689
+
9690
+		type = typeof target;
9691
+
9692
+		if (type === typeof origin) {
9693
+			if (type === 'string') {
9694
+				c0 = color(origin);
9695
+				if (c0.valid) {
9696
+					c1 = color(target);
9697
+					if (c1.valid) {
9698
+						view[key] = c1.mix(c0, ease).rgbString();
9699
+						continue;
9700
+					}
9701
+				}
9702
+			} else if (type === 'number' && isFinite(origin) && isFinite(target)) {
9703
+				view[key] = origin + (target - origin) * ease;
9704
+				continue;
9705
+			}
9706
+		}
9707
+
9708
+		view[key] = target;
9709
+	}
9710
+}
9711
+
9712
+var Element = function(configuration) {
9713
+	helpers.extend(this, configuration);
9714
+	this.initialize.apply(this, arguments);
9715
+};
9716
+
9717
+helpers.extend(Element.prototype, {
9718
+
9719
+	initialize: function() {
9720
+		this.hidden = false;
9721
+	},
9722
+
9723
+	pivot: function() {
9724
+		var me = this;
9725
+		if (!me._view) {
9726
+			me._view = helpers.clone(me._model);
9727
+		}
9728
+		me._start = {};
9729
+		return me;
9730
+	},
9731
+
9732
+	transition: function(ease) {
9733
+		var me = this;
9734
+		var model = me._model;
9735
+		var start = me._start;
9736
+		var view = me._view;
9737
+
9738
+		// No animation -> No Transition
9739
+		if (!model || ease === 1) {
9740
+			me._view = model;
9741
+			me._start = null;
9742
+			return me;
9743
+		}
9744
+
9745
+		if (!view) {
9746
+			view = me._view = {};
9747
+		}
9748
+
9749
+		if (!start) {
9750
+			start = me._start = {};
9751
+		}
9752
+
9753
+		interpolate(start, view, model, ease);
9754
+
9755
+		return me;
9756
+	},
9757
+
9758
+	tooltipPosition: function() {
9759
+		return {
9760
+			x: this._model.x,
9761
+			y: this._model.y
9762
+		};
9763
+	},
9764
+
9765
+	hasValue: function() {
9766
+		return helpers.isNumber(this._model.x) && helpers.isNumber(this._model.y);
9767
+	}
9768
+});
9769
+
9770
+Element.extend = helpers.inherits;
9771
+
9772
+module.exports = Element;
9773
+
9774
+},{"2":2,"45":45}],27:[function(require,module,exports){
9775
+/* global window: false */
9776
+/* global document: false */
9777
+'use strict';
9778
+
9779
+var color = require(2);
9780
+var defaults = require(25);
9781
+var helpers = require(45);
9782
+
9783
+module.exports = function(Chart) {
9784
+
9785
+	// -- Basic js utility methods
9786
+
9787
+	helpers.configMerge = function(/* objects ... */) {
9788
+		return helpers.merge(helpers.clone(arguments[0]), [].slice.call(arguments, 1), {
9789
+			merger: function(key, target, source, options) {
9790
+				var tval = target[key] || {};
9791
+				var sval = source[key];
9792
+
9793
+				if (key === 'scales') {
9794
+					// scale config merging is complex. Add our own function here for that
9795
+					target[key] = helpers.scaleMerge(tval, sval);
9796
+				} else if (key === 'scale') {
9797
+					// used in polar area & radar charts since there is only one scale
9798
+					target[key] = helpers.merge(tval, [Chart.scaleService.getScaleDefaults(sval.type), sval]);
9799
+				} else {
9800
+					helpers._merger(key, target, source, options);
9801
+				}
9802
+			}
9803
+		});
9804
+	};
9805
+
9806
+	helpers.scaleMerge = function(/* objects ... */) {
9807
+		return helpers.merge(helpers.clone(arguments[0]), [].slice.call(arguments, 1), {
9808
+			merger: function(key, target, source, options) {
9809
+				if (key === 'xAxes' || key === 'yAxes') {
9810
+					var slen = source[key].length;
9811
+					var i, type, scale;
9812
+
9813
+					if (!target[key]) {
9814
+						target[key] = [];
9815
+					}
9816
+
9817
+					for (i = 0; i < slen; ++i) {
9818
+						scale = source[key][i];
9819
+						type = helpers.valueOrDefault(scale.type, key === 'xAxes' ? 'category' : 'linear');
9820
+
9821
+						if (i >= target[key].length) {
9822
+							target[key].push({});
9823
+						}
9824
+
9825
+						if (!target[key][i].type || (scale.type && scale.type !== target[key][i].type)) {
9826
+							// new/untyped scale or type changed: let's apply the new defaults
9827
+							// then merge source scale to correctly overwrite the defaults.
9828
+							helpers.merge(target[key][i], [Chart.scaleService.getScaleDefaults(type), scale]);
9829
+						} else {
9830
+							// scales type are the same
9831
+							helpers.merge(target[key][i], scale);
9832
+						}
9833
+					}
9834
+				} else {
9835
+					helpers._merger(key, target, source, options);
9836
+				}
9837
+			}
9838
+		});
9839
+	};
9840
+
9841
+	helpers.where = function(collection, filterCallback) {
9842
+		if (helpers.isArray(collection) && Array.prototype.filter) {
9843
+			return collection.filter(filterCallback);
9844
+		}
9845
+		var filtered = [];
9846
+
9847
+		helpers.each(collection, function(item) {
9848
+			if (filterCallback(item)) {
9849
+				filtered.push(item);
9850
+			}
9851
+		});
9852
+
9853
+		return filtered;
9854
+	};
9855
+	helpers.findIndex = Array.prototype.findIndex ?
9856
+		function(array, callback, scope) {
9857
+			return array.findIndex(callback, scope);
9858
+		} :
9859
+		function(array, callback, scope) {
9860
+			scope = scope === undefined ? array : scope;
9861
+			for (var i = 0, ilen = array.length; i < ilen; ++i) {
9862
+				if (callback.call(scope, array[i], i, array)) {
9863
+					return i;
9864
+				}
9865
+			}
9866
+			return -1;
9867
+		};
9868
+	helpers.findNextWhere = function(arrayToSearch, filterCallback, startIndex) {
9869
+		// Default to start of the array
9870
+		if (helpers.isNullOrUndef(startIndex)) {
9871
+			startIndex = -1;
9872
+		}
9873
+		for (var i = startIndex + 1; i < arrayToSearch.length; i++) {
9874
+			var currentItem = arrayToSearch[i];
9875
+			if (filterCallback(currentItem)) {
9876
+				return currentItem;
9877
+			}
9878
+		}
9879
+	};
9880
+	helpers.findPreviousWhere = function(arrayToSearch, filterCallback, startIndex) {
9881
+		// Default to end of the array
9882
+		if (helpers.isNullOrUndef(startIndex)) {
9883
+			startIndex = arrayToSearch.length;
9884
+		}
9885
+		for (var i = startIndex - 1; i >= 0; i--) {
9886
+			var currentItem = arrayToSearch[i];
9887
+			if (filterCallback(currentItem)) {
9888
+				return currentItem;
9889
+			}
9890
+		}
9891
+	};
9892
+
9893
+	// -- Math methods
9894
+	helpers.isNumber = function(n) {
9895
+		return !isNaN(parseFloat(n)) && isFinite(n);
9896
+	};
9897
+	helpers.almostEquals = function(x, y, epsilon) {
9898
+		return Math.abs(x - y) < epsilon;
9899
+	};
9900
+	helpers.almostWhole = function(x, epsilon) {
9901
+		var rounded = Math.round(x);
9902
+		return (((rounded - epsilon) < x) && ((rounded + epsilon) > x));
9903
+	};
9904
+	helpers.max = function(array) {
9905
+		return array.reduce(function(max, value) {
9906
+			if (!isNaN(value)) {
9907
+				return Math.max(max, value);
9908
+			}
9909
+			return max;
9910
+		}, Number.NEGATIVE_INFINITY);
9911
+	};
9912
+	helpers.min = function(array) {
9913
+		return array.reduce(function(min, value) {
9914
+			if (!isNaN(value)) {
9915
+				return Math.min(min, value);
9916
+			}
9917
+			return min;
9918
+		}, Number.POSITIVE_INFINITY);
9919
+	};
9920
+	helpers.sign = Math.sign ?
9921
+		function(x) {
9922
+			return Math.sign(x);
9923
+		} :
9924
+		function(x) {
9925
+			x = +x; // convert to a number
9926
+			if (x === 0 || isNaN(x)) {
9927
+				return x;
9928
+			}
9929
+			return x > 0 ? 1 : -1;
9930
+		};
9931
+	helpers.log10 = Math.log10 ?
9932
+		function(x) {
9933
+			return Math.log10(x);
9934
+		} :
9935
+		function(x) {
9936
+			var exponent = Math.log(x) * Math.LOG10E; // Math.LOG10E = 1 / Math.LN10.
9937
+			// Check for whole powers of 10,
9938
+			// which due to floating point rounding error should be corrected.
9939
+			var powerOf10 = Math.round(exponent);
9940
+			var isPowerOf10 = x === Math.pow(10, powerOf10);
9941
+
9942
+			return isPowerOf10 ? powerOf10 : exponent;
9943
+		};
9944
+	helpers.toRadians = function(degrees) {
9945
+		return degrees * (Math.PI / 180);
9946
+	};
9947
+	helpers.toDegrees = function(radians) {
9948
+		return radians * (180 / Math.PI);
9949
+	};
9950
+	// Gets the angle from vertical upright to the point about a centre.
9951
+	helpers.getAngleFromPoint = function(centrePoint, anglePoint) {
9952
+		var distanceFromXCenter = anglePoint.x - centrePoint.x;
9953
+		var distanceFromYCenter = anglePoint.y - centrePoint.y;
9954
+		var radialDistanceFromCenter = Math.sqrt(distanceFromXCenter * distanceFromXCenter + distanceFromYCenter * distanceFromYCenter);
9955
+
9956
+		var angle = Math.atan2(distanceFromYCenter, distanceFromXCenter);
9957
+
9958
+		if (angle < (-0.5 * Math.PI)) {
9959
+			angle += 2.0 * Math.PI; // make sure the returned angle is in the range of (-PI/2, 3PI/2]
9960
+		}
9961
+
9962
+		return {
9963
+			angle: angle,
9964
+			distance: radialDistanceFromCenter
9965
+		};
9966
+	};
9967
+	helpers.distanceBetweenPoints = function(pt1, pt2) {
9968
+		return Math.sqrt(Math.pow(pt2.x - pt1.x, 2) + Math.pow(pt2.y - pt1.y, 2));
9969
+	};
9970
+	helpers.aliasPixel = function(pixelWidth) {
9971
+		return (pixelWidth % 2 === 0) ? 0 : 0.5;
9972
+	};
9973
+	helpers.splineCurve = function(firstPoint, middlePoint, afterPoint, t) {
9974
+		// Props to Rob Spencer at scaled innovation for his post on splining between points
9975
+		// http://scaledinnovation.com/analytics/splines/aboutSplines.html
9976
+
9977
+		// This function must also respect "skipped" points
9978
+
9979
+		var previous = firstPoint.skip ? middlePoint : firstPoint;
9980
+		var current = middlePoint;
9981
+		var next = afterPoint.skip ? middlePoint : afterPoint;
9982
+
9983
+		var d01 = Math.sqrt(Math.pow(current.x - previous.x, 2) + Math.pow(current.y - previous.y, 2));
9984
+		var d12 = Math.sqrt(Math.pow(next.x - current.x, 2) + Math.pow(next.y - current.y, 2));
9985
+
9986
+		var s01 = d01 / (d01 + d12);
9987
+		var s12 = d12 / (d01 + d12);
9988
+
9989
+		// If all points are the same, s01 & s02 will be inf
9990
+		s01 = isNaN(s01) ? 0 : s01;
9991
+		s12 = isNaN(s12) ? 0 : s12;
9992
+
9993
+		var fa = t * s01; // scaling factor for triangle Ta
9994
+		var fb = t * s12;
9995
+
9996
+		return {
9997
+			previous: {
9998
+				x: current.x - fa * (next.x - previous.x),
9999
+				y: current.y - fa * (next.y - previous.y)
10000
+			},
10001
+			next: {
10002
+				x: current.x + fb * (next.x - previous.x),
10003
+				y: current.y + fb * (next.y - previous.y)
10004
+			}
10005
+		};
10006
+	};
10007
+	helpers.EPSILON = Number.EPSILON || 1e-14;
10008
+	helpers.splineCurveMonotone = function(points) {
10009
+		// This function calculates Bézier control points in a similar way than |splineCurve|,
10010
+		// but preserves monotonicity of the provided data and ensures no local extremums are added
10011
+		// between the dataset discrete points due to the interpolation.
10012
+		// See : https://en.wikipedia.org/wiki/Monotone_cubic_interpolation
10013
+
10014
+		var pointsWithTangents = (points || []).map(function(point) {
10015
+			return {
10016
+				model: point._model,
10017
+				deltaK: 0,
10018
+				mK: 0
10019
+			};
10020
+		});
10021
+
10022
+		// Calculate slopes (deltaK) and initialize tangents (mK)
10023
+		var pointsLen = pointsWithTangents.length;
10024
+		var i, pointBefore, pointCurrent, pointAfter;
10025
+		for (i = 0; i < pointsLen; ++i) {
10026
+			pointCurrent = pointsWithTangents[i];
10027
+			if (pointCurrent.model.skip) {
10028
+				continue;
10029
+			}
10030
+
10031
+			pointBefore = i > 0 ? pointsWithTangents[i - 1] : null;
10032
+			pointAfter = i < pointsLen - 1 ? pointsWithTangents[i + 1] : null;
10033
+			if (pointAfter && !pointAfter.model.skip) {
10034
+				var slopeDeltaX = (pointAfter.model.x - pointCurrent.model.x);
10035
+
10036
+				// In the case of two points that appear at the same x pixel, slopeDeltaX is 0
10037
+				pointCurrent.deltaK = slopeDeltaX !== 0 ? (pointAfter.model.y - pointCurrent.model.y) / slopeDeltaX : 0;
10038
+			}
10039
+
10040
+			if (!pointBefore || pointBefore.model.skip) {
10041
+				pointCurrent.mK = pointCurrent.deltaK;
10042
+			} else if (!pointAfter || pointAfter.model.skip) {
10043
+				pointCurrent.mK = pointBefore.deltaK;
10044
+			} else if (this.sign(pointBefore.deltaK) !== this.sign(pointCurrent.deltaK)) {
10045
+				pointCurrent.mK = 0;
10046
+			} else {
10047
+				pointCurrent.mK = (pointBefore.deltaK + pointCurrent.deltaK) / 2;
10048
+			}
10049
+		}
10050
+
10051
+		// Adjust tangents to ensure monotonic properties
10052
+		var alphaK, betaK, tauK, squaredMagnitude;
10053
+		for (i = 0; i < pointsLen - 1; ++i) {
10054
+			pointCurrent = pointsWithTangents[i];
10055
+			pointAfter = pointsWithTangents[i + 1];
10056
+			if (pointCurrent.model.skip || pointAfter.model.skip) {
10057
+				continue;
10058
+			}
10059
+
10060
+			if (helpers.almostEquals(pointCurrent.deltaK, 0, this.EPSILON)) {
10061
+				pointCurrent.mK = pointAfter.mK = 0;
10062
+				continue;
10063
+			}
10064
+
10065
+			alphaK = pointCurrent.mK / pointCurrent.deltaK;
10066
+			betaK = pointAfter.mK / pointCurrent.deltaK;
10067
+			squaredMagnitude = Math.pow(alphaK, 2) + Math.pow(betaK, 2);
10068
+			if (squaredMagnitude <= 9) {
10069
+				continue;
10070
+			}
10071
+
10072
+			tauK = 3 / Math.sqrt(squaredMagnitude);
10073
+			pointCurrent.mK = alphaK * tauK * pointCurrent.deltaK;
10074
+			pointAfter.mK = betaK * tauK * pointCurrent.deltaK;
10075
+		}
10076
+
10077
+		// Compute control points
10078
+		var deltaX;
10079
+		for (i = 0; i < pointsLen; ++i) {
10080
+			pointCurrent = pointsWithTangents[i];
10081
+			if (pointCurrent.model.skip) {
10082
+				continue;
10083
+			}
10084
+
10085
+			pointBefore = i > 0 ? pointsWithTangents[i - 1] : null;
10086
+			pointAfter = i < pointsLen - 1 ? pointsWithTangents[i + 1] : null;
10087
+			if (pointBefore && !pointBefore.model.skip) {
10088
+				deltaX = (pointCurrent.model.x - pointBefore.model.x) / 3;
10089
+				pointCurrent.model.controlPointPreviousX = pointCurrent.model.x - deltaX;
10090
+				pointCurrent.model.controlPointPreviousY = pointCurrent.model.y - deltaX * pointCurrent.mK;
10091
+			}
10092
+			if (pointAfter && !pointAfter.model.skip) {
10093
+				deltaX = (pointAfter.model.x - pointCurrent.model.x) / 3;
10094
+				pointCurrent.model.controlPointNextX = pointCurrent.model.x + deltaX;
10095
+				pointCurrent.model.controlPointNextY = pointCurrent.model.y + deltaX * pointCurrent.mK;
10096
+			}
10097
+		}
10098
+	};
10099
+	helpers.nextItem = function(collection, index, loop) {
10100
+		if (loop) {
10101
+			return index >= collection.length - 1 ? collection[0] : collection[index + 1];
10102
+		}
10103
+		return index >= collection.length - 1 ? collection[collection.length - 1] : collection[index + 1];
10104
+	};
10105
+	helpers.previousItem = function(collection, index, loop) {
10106
+		if (loop) {
10107
+			return index <= 0 ? collection[collection.length - 1] : collection[index - 1];
10108
+		}
10109
+		return index <= 0 ? collection[0] : collection[index - 1];
10110
+	};
10111
+	// Implementation of the nice number algorithm used in determining where axis labels will go
10112
+	helpers.niceNum = function(range, round) {
10113
+		var exponent = Math.floor(helpers.log10(range));
10114
+		var fraction = range / Math.pow(10, exponent);
10115
+		var niceFraction;
10116
+
10117
+		if (round) {
10118
+			if (fraction < 1.5) {
10119
+				niceFraction = 1;
10120
+			} else if (fraction < 3) {
10121
+				niceFraction = 2;
10122
+			} else if (fraction < 7) {
10123
+				niceFraction = 5;
10124
+			} else {
10125
+				niceFraction = 10;
10126
+			}
10127
+		} else if (fraction <= 1.0) {
10128
+			niceFraction = 1;
10129
+		} else if (fraction <= 2) {
10130
+			niceFraction = 2;
10131
+		} else if (fraction <= 5) {
10132
+			niceFraction = 5;
10133
+		} else {
10134
+			niceFraction = 10;
10135
+		}
10136
+
10137
+		return niceFraction * Math.pow(10, exponent);
10138
+	};
10139
+	// Request animation polyfill - http://www.paulirish.com/2011/requestanimationframe-for-smart-animating/
10140
+	helpers.requestAnimFrame = (function() {
10141
+		if (typeof window === 'undefined') {
10142
+			return function(callback) {
10143
+				callback();
10144
+			};
10145
+		}
10146
+		return window.requestAnimationFrame ||
10147
+			window.webkitRequestAnimationFrame ||
10148
+			window.mozRequestAnimationFrame ||
10149
+			window.oRequestAnimationFrame ||
10150
+			window.msRequestAnimationFrame ||
10151
+			function(callback) {
10152
+				return window.setTimeout(callback, 1000 / 60);
10153
+			};
10154
+	}());
10155
+	// -- DOM methods
10156
+	helpers.getRelativePosition = function(evt, chart) {
10157
+		var mouseX, mouseY;
10158
+		var e = evt.originalEvent || evt;
10159
+		var canvas = evt.currentTarget || evt.srcElement;
10160
+		var boundingRect = canvas.getBoundingClientRect();
10161
+
10162
+		var touches = e.touches;
10163
+		if (touches && touches.length > 0) {
10164
+			mouseX = touches[0].clientX;
10165
+			mouseY = touches[0].clientY;
10166
+
10167
+		} else {
10168
+			mouseX = e.clientX;
10169
+			mouseY = e.clientY;
10170
+		}
10171
+
10172
+		// Scale mouse coordinates into canvas coordinates
10173
+		// by following the pattern laid out by 'jerryj' in the comments of
10174
+		// http://www.html5canvastutorials.com/advanced/html5-canvas-mouse-coordinates/
10175
+		var paddingLeft = parseFloat(helpers.getStyle(canvas, 'padding-left'));
10176
+		var paddingTop = parseFloat(helpers.getStyle(canvas, 'padding-top'));
10177
+		var paddingRight = parseFloat(helpers.getStyle(canvas, 'padding-right'));
10178
+		var paddingBottom = parseFloat(helpers.getStyle(canvas, 'padding-bottom'));
10179
+		var width = boundingRect.right - boundingRect.left - paddingLeft - paddingRight;
10180
+		var height = boundingRect.bottom - boundingRect.top - paddingTop - paddingBottom;
10181
+
10182
+		// We divide by the current device pixel ratio, because the canvas is scaled up by that amount in each direction. However
10183
+		// the backend model is in unscaled coordinates. Since we are going to deal with our model coordinates, we go back here
10184
+		mouseX = Math.round((mouseX - boundingRect.left - paddingLeft) / (width) * canvas.width / chart.currentDevicePixelRatio);
10185
+		mouseY = Math.round((mouseY - boundingRect.top - paddingTop) / (height) * canvas.height / chart.currentDevicePixelRatio);
10186
+
10187
+		return {
10188
+			x: mouseX,
10189
+			y: mouseY
10190
+		};
10191
+
10192
+	};
10193
+
10194
+	// Private helper function to convert max-width/max-height values that may be percentages into a number
10195
+	function parseMaxStyle(styleValue, node, parentProperty) {
10196
+		var valueInPixels;
10197
+		if (typeof styleValue === 'string') {
10198
+			valueInPixels = parseInt(styleValue, 10);
10199
+
10200
+			if (styleValue.indexOf('%') !== -1) {
10201
+				// percentage * size in dimension
10202
+				valueInPixels = valueInPixels / 100 * node.parentNode[parentProperty];
10203
+			}
10204
+		} else {
10205
+			valueInPixels = styleValue;
10206
+		}
10207
+
10208
+		return valueInPixels;
10209
+	}
10210
+
10211
+	/**
10212
+	 * Returns if the given value contains an effective constraint.
10213
+	 * @private
10214
+	 */
10215
+	function isConstrainedValue(value) {
10216
+		return value !== undefined && value !== null && value !== 'none';
10217
+	}
10218
+
10219
+	// Private helper to get a constraint dimension
10220
+	// @param domNode : the node to check the constraint on
10221
+	// @param maxStyle : the style that defines the maximum for the direction we are using (maxWidth / maxHeight)
10222
+	// @param percentageProperty : property of parent to use when calculating width as a percentage
10223
+	// @see http://www.nathanaeljones.com/blog/2013/reading-max-width-cross-browser
10224
+	function getConstraintDimension(domNode, maxStyle, percentageProperty) {
10225
+		var view = document.defaultView;
10226
+		var parentNode = domNode.parentNode;
10227
+		var constrainedNode = view.getComputedStyle(domNode)[maxStyle];
10228
+		var constrainedContainer = view.getComputedStyle(parentNode)[maxStyle];
10229
+		var hasCNode = isConstrainedValue(constrainedNode);
10230
+		var hasCContainer = isConstrainedValue(constrainedContainer);
10231
+		var infinity = Number.POSITIVE_INFINITY;
10232
+
10233
+		if (hasCNode || hasCContainer) {
10234
+			return Math.min(
10235
+				hasCNode ? parseMaxStyle(constrainedNode, domNode, percentageProperty) : infinity,
10236
+				hasCContainer ? parseMaxStyle(constrainedContainer, parentNode, percentageProperty) : infinity);
10237
+		}
10238
+
10239
+		return 'none';
10240
+	}
10241
+	// returns Number or undefined if no constraint
10242
+	helpers.getConstraintWidth = function(domNode) {
10243
+		return getConstraintDimension(domNode, 'max-width', 'clientWidth');
10244
+	};
10245
+	// returns Number or undefined if no constraint
10246
+	helpers.getConstraintHeight = function(domNode) {
10247
+		return getConstraintDimension(domNode, 'max-height', 'clientHeight');
10248
+	};
10249
+	helpers.getMaximumWidth = function(domNode) {
10250
+		var container = domNode.parentNode;
10251
+		if (!container) {
10252
+			return domNode.clientWidth;
10253
+		}
10254
+
10255
+		var paddingLeft = parseInt(helpers.getStyle(container, 'padding-left'), 10);
10256
+		var paddingRight = parseInt(helpers.getStyle(container, 'padding-right'), 10);
10257
+		var w = container.clientWidth - paddingLeft - paddingRight;
10258
+		var cw = helpers.getConstraintWidth(domNode);
10259
+		return isNaN(cw) ? w : Math.min(w, cw);
10260
+	};
10261
+	helpers.getMaximumHeight = function(domNode) {
10262
+		var container = domNode.parentNode;
10263
+		if (!container) {
10264
+			return domNode.clientHeight;
10265
+		}
10266
+
10267
+		var paddingTop = parseInt(helpers.getStyle(container, 'padding-top'), 10);
10268
+		var paddingBottom = parseInt(helpers.getStyle(container, 'padding-bottom'), 10);
10269
+		var h = container.clientHeight - paddingTop - paddingBottom;
10270
+		var ch = helpers.getConstraintHeight(domNode);
10271
+		return isNaN(ch) ? h : Math.min(h, ch);
10272
+	};
10273
+	helpers.getStyle = function(el, property) {
10274
+		return el.currentStyle ?
10275
+			el.currentStyle[property] :
10276
+			document.defaultView.getComputedStyle(el, null).getPropertyValue(property);
10277
+	};
10278
+	helpers.retinaScale = function(chart, forceRatio) {
10279
+		var pixelRatio = chart.currentDevicePixelRatio = forceRatio || window.devicePixelRatio || 1;
10280
+		if (pixelRatio === 1) {
10281
+			return;
10282
+		}
10283
+
10284
+		var canvas = chart.canvas;
10285
+		var height = chart.height;
10286
+		var width = chart.width;
10287
+
10288
+		canvas.height = height * pixelRatio;
10289
+		canvas.width = width * pixelRatio;
10290
+		chart.ctx.scale(pixelRatio, pixelRatio);
10291
+
10292
+		// If no style has been set on the canvas, the render size is used as display size,
10293
+		// making the chart visually bigger, so let's enforce it to the "correct" values.
10294
+		// See https://github.com/chartjs/Chart.js/issues/3575
10295
+		if (!canvas.style.height && !canvas.style.width) {
10296
+			canvas.style.height = height + 'px';
10297
+			canvas.style.width = width + 'px';
10298
+		}
10299
+	};
10300
+	// -- Canvas methods
10301
+	helpers.fontString = function(pixelSize, fontStyle, fontFamily) {
10302
+		return fontStyle + ' ' + pixelSize + 'px ' + fontFamily;
10303
+	};
10304
+	helpers.longestText = function(ctx, font, arrayOfThings, cache) {
10305
+		cache = cache || {};
10306
+		var data = cache.data = cache.data || {};
10307
+		var gc = cache.garbageCollect = cache.garbageCollect || [];
10308
+
10309
+		if (cache.font !== font) {
10310
+			data = cache.data = {};
10311
+			gc = cache.garbageCollect = [];
10312
+			cache.font = font;
10313
+		}
10314
+
10315
+		ctx.font = font;
10316
+		var longest = 0;
10317
+		helpers.each(arrayOfThings, function(thing) {
10318
+			// Undefined strings and arrays should not be measured
10319
+			if (thing !== undefined && thing !== null && helpers.isArray(thing) !== true) {
10320
+				longest = helpers.measureText(ctx, data, gc, longest, thing);
10321
+			} else if (helpers.isArray(thing)) {
10322
+				// if it is an array lets measure each element
10323
+				// to do maybe simplify this function a bit so we can do this more recursively?
10324
+				helpers.each(thing, function(nestedThing) {
10325
+					// Undefined strings and arrays should not be measured
10326
+					if (nestedThing !== undefined && nestedThing !== null && !helpers.isArray(nestedThing)) {
10327
+						longest = helpers.measureText(ctx, data, gc, longest, nestedThing);
10328
+					}
10329
+				});
10330
+			}
10331
+		});
10332
+
10333
+		var gcLen = gc.length / 2;
10334
+		if (gcLen > arrayOfThings.length) {
10335
+			for (var i = 0; i < gcLen; i++) {
10336
+				delete data[gc[i]];
10337
+			}
10338
+			gc.splice(0, gcLen);
10339
+		}
10340
+		return longest;
10341
+	};
10342
+	helpers.measureText = function(ctx, data, gc, longest, string) {
10343
+		var textWidth = data[string];
10344
+		if (!textWidth) {
10345
+			textWidth = data[string] = ctx.measureText(string).width;
10346
+			gc.push(string);
10347
+		}
10348
+		if (textWidth > longest) {
10349
+			longest = textWidth;
10350
+		}
10351
+		return longest;
10352
+	};
10353
+	helpers.numberOfLabelLines = function(arrayOfThings) {
10354
+		var numberOfLines = 1;
10355
+		helpers.each(arrayOfThings, function(thing) {
10356
+			if (helpers.isArray(thing)) {
10357
+				if (thing.length > numberOfLines) {
10358
+					numberOfLines = thing.length;
10359
+				}
10360
+			}
10361
+		});
10362
+		return numberOfLines;
10363
+	};
10364
+
10365
+	helpers.color = !color ?
10366
+		function(value) {
10367
+			console.error('Color.js not found!');
10368
+			return value;
10369
+		} :
10370
+		function(value) {
10371
+			/* global CanvasGradient */
10372
+			if (value instanceof CanvasGradient) {
10373
+				value = defaults.global.defaultColor;
10374
+			}
10375
+
10376
+			return color(value);
10377
+		};
10378
+
10379
+	helpers.getHoverColor = function(colorValue) {
10380
+		/* global CanvasPattern */
10381
+		return (colorValue instanceof CanvasPattern) ?
10382
+			colorValue :
10383
+			helpers.color(colorValue).saturate(0.5).darken(0.1).rgbString();
10384
+	};
10385
+};
10386
+
10387
+},{"2":2,"25":25,"45":45}],28:[function(require,module,exports){
10388
+'use strict';
10389
+
10390
+var helpers = require(45);
10391
+
10392
+/**
10393
+ * Helper function to get relative position for an event
10394
+ * @param {Event|IEvent} event - The event to get the position for
10395
+ * @param {Chart} chart - The chart
10396
+ * @returns {Point} the event position
10397
+ */
10398
+function getRelativePosition(e, chart) {
10399
+	if (e.native) {
10400
+		return {
10401
+			x: e.x,
10402
+			y: e.y
10403
+		};
10404
+	}
10405
+
10406
+	return helpers.getRelativePosition(e, chart);
10407
+}
10408
+
10409
+/**
10410
+ * Helper function to traverse all of the visible elements in the chart
10411
+ * @param chart {chart} the chart
10412
+ * @param handler {Function} the callback to execute for each visible item
10413
+ */
10414
+function parseVisibleItems(chart, handler) {
10415
+	var datasets = chart.data.datasets;
10416
+	var meta, i, j, ilen, jlen;
10417
+
10418
+	for (i = 0, ilen = datasets.length; i < ilen; ++i) {
10419
+		if (!chart.isDatasetVisible(i)) {
10420
+			continue;
10421
+		}
10422
+
10423
+		meta = chart.getDatasetMeta(i);
10424
+		for (j = 0, jlen = meta.data.length; j < jlen; ++j) {
10425
+			var element = meta.data[j];
10426
+			if (!element._view.skip) {
10427
+				handler(element);
10428
+			}
10429
+		}
10430
+	}
10431
+}
10432
+
10433
+/**
10434
+ * Helper function to get the items that intersect the event position
10435
+ * @param items {ChartElement[]} elements to filter
10436
+ * @param position {Point} the point to be nearest to
10437
+ * @return {ChartElement[]} the nearest items
10438
+ */
10439
+function getIntersectItems(chart, position) {
10440
+	var elements = [];
10441
+
10442
+	parseVisibleItems(chart, function(element) {
10443
+		if (element.inRange(position.x, position.y)) {
10444
+			elements.push(element);
10445
+		}
10446
+	});
10447
+
10448
+	return elements;
10449
+}
10450
+
10451
+/**
10452
+ * Helper function to get the items nearest to the event position considering all visible items in teh chart
10453
+ * @param chart {Chart} the chart to look at elements from
10454
+ * @param position {Point} the point to be nearest to
10455
+ * @param intersect {Boolean} if true, only consider items that intersect the position
10456
+ * @param distanceMetric {Function} function to provide the distance between points
10457
+ * @return {ChartElement[]} the nearest items
10458
+ */
10459
+function getNearestItems(chart, position, intersect, distanceMetric) {
10460
+	var minDistance = Number.POSITIVE_INFINITY;
10461
+	var nearestItems = [];
10462
+
10463
+	parseVisibleItems(chart, function(element) {
10464
+		if (intersect && !element.inRange(position.x, position.y)) {
10465
+			return;
10466
+		}
10467
+
10468
+		var center = element.getCenterPoint();
10469
+		var distance = distanceMetric(position, center);
10470
+
10471
+		if (distance < minDistance) {
10472
+			nearestItems = [element];
10473
+			minDistance = distance;
10474
+		} else if (distance === minDistance) {
10475
+			// Can have multiple items at the same distance in which case we sort by size
10476
+			nearestItems.push(element);
10477
+		}
10478
+	});
10479
+
10480
+	return nearestItems;
10481
+}
10482
+
10483
+/**
10484
+ * Get a distance metric function for two points based on the
10485
+ * axis mode setting
10486
+ * @param {String} axis the axis mode. x|y|xy
10487
+ */
10488
+function getDistanceMetricForAxis(axis) {
10489
+	var useX = axis.indexOf('x') !== -1;
10490
+	var useY = axis.indexOf('y') !== -1;
10491
+
10492
+	return function(pt1, pt2) {
10493
+		var deltaX = useX ? Math.abs(pt1.x - pt2.x) : 0;
10494
+		var deltaY = useY ? Math.abs(pt1.y - pt2.y) : 0;
10495
+		return Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY, 2));
10496
+	};
10497
+}
10498
+
10499
+function indexMode(chart, e, options) {
10500
+	var position = getRelativePosition(e, chart);
10501
+	// Default axis for index mode is 'x' to match old behaviour
10502
+	options.axis = options.axis || 'x';
10503
+	var distanceMetric = getDistanceMetricForAxis(options.axis);
10504
+	var items = options.intersect ? getIntersectItems(chart, position) : getNearestItems(chart, position, false, distanceMetric);
10505
+	var elements = [];
10506
+
10507
+	if (!items.length) {
10508
+		return [];
10509
+	}
10510
+
10511
+	chart.data.datasets.forEach(function(dataset, datasetIndex) {
10512
+		if (chart.isDatasetVisible(datasetIndex)) {
10513
+			var meta = chart.getDatasetMeta(datasetIndex);
10514
+			var element = meta.data[items[0]._index];
10515
+
10516
+			// don't count items that are skipped (null data)
10517
+			if (element && !element._view.skip) {
10518
+				elements.push(element);
10519
+			}
10520
+		}
10521
+	});
10522
+
10523
+	return elements;
10524
+}
10525
+
10526
+/**
10527
+ * @interface IInteractionOptions
10528
+ */
10529
+/**
10530
+ * If true, only consider items that intersect the point
10531
+ * @name IInterfaceOptions#boolean
10532
+ * @type Boolean
10533
+ */
10534
+
10535
+/**
10536
+ * Contains interaction related functions
10537
+ * @namespace Chart.Interaction
10538
+ */
10539
+module.exports = {
10540
+	// Helper function for different modes
10541
+	modes: {
10542
+		single: function(chart, e) {
10543
+			var position = getRelativePosition(e, chart);
10544
+			var elements = [];
10545
+
10546
+			parseVisibleItems(chart, function(element) {
10547
+				if (element.inRange(position.x, position.y)) {
10548
+					elements.push(element);
10549
+					return elements;
10550
+				}
10551
+			});
10552
+
10553
+			return elements.slice(0, 1);
10554
+		},
10555
+
10556
+		/**
10557
+		 * @function Chart.Interaction.modes.label
10558
+		 * @deprecated since version 2.4.0
10559
+		 * @todo remove at version 3
10560
+		 * @private
10561
+		 */
10562
+		label: indexMode,
10563
+
10564
+		/**
10565
+		 * Returns items at the same index. If the options.intersect parameter is true, we only return items if we intersect something
10566
+		 * If the options.intersect mode is false, we find the nearest item and return the items at the same index as that item
10567
+		 * @function Chart.Interaction.modes.index
10568
+		 * @since v2.4.0
10569
+		 * @param chart {chart} the chart we are returning items from
10570
+		 * @param e {Event} the event we are find things at
10571
+		 * @param options {IInteractionOptions} options to use during interaction
10572
+		 * @return {Chart.Element[]} Array of elements that are under the point. If none are found, an empty array is returned
10573
+		 */
10574
+		index: indexMode,
10575
+
10576
+		/**
10577
+		 * Returns items in the same dataset. If the options.intersect parameter is true, we only return items if we intersect something
10578
+		 * If the options.intersect is false, we find the nearest item and return the items in that dataset
10579
+		 * @function Chart.Interaction.modes.dataset
10580
+		 * @param chart {chart} the chart we are returning items from
10581
+		 * @param e {Event} the event we are find things at
10582
+		 * @param options {IInteractionOptions} options to use during interaction
10583
+		 * @return {Chart.Element[]} Array of elements that are under the point. If none are found, an empty array is returned
10584
+		 */
10585
+		dataset: function(chart, e, options) {
10586
+			var position = getRelativePosition(e, chart);
10587
+			options.axis = options.axis || 'xy';
10588
+			var distanceMetric = getDistanceMetricForAxis(options.axis);
10589
+			var items = options.intersect ? getIntersectItems(chart, position) : getNearestItems(chart, position, false, distanceMetric);
10590
+
10591
+			if (items.length > 0) {
10592
+				items = chart.getDatasetMeta(items[0]._datasetIndex).data;
10593
+			}
10594
+
10595
+			return items;
10596
+		},
10597
+
10598
+		/**
10599
+		 * @function Chart.Interaction.modes.x-axis
10600
+		 * @deprecated since version 2.4.0. Use index mode and intersect == true
10601
+		 * @todo remove at version 3
10602
+		 * @private
10603
+		 */
10604
+		'x-axis': function(chart, e) {
10605
+			return indexMode(chart, e, {intersect: false});
10606
+		},
10607
+
10608
+		/**
10609
+		 * Point mode returns all elements that hit test based on the event position
10610
+		 * of the event
10611
+		 * @function Chart.Interaction.modes.intersect
10612
+		 * @param chart {chart} the chart we are returning items from
10613
+		 * @param e {Event} the event we are find things at
10614
+		 * @return {Chart.Element[]} Array of elements that are under the point. If none are found, an empty array is returned
10615
+		 */
10616
+		point: function(chart, e) {
10617
+			var position = getRelativePosition(e, chart);
10618
+			return getIntersectItems(chart, position);
10619
+		},
10620
+
10621
+		/**
10622
+		 * nearest mode returns the element closest to the point
10623
+		 * @function Chart.Interaction.modes.intersect
10624
+		 * @param chart {chart} the chart we are returning items from
10625
+		 * @param e {Event} the event we are find things at
10626
+		 * @param options {IInteractionOptions} options to use
10627
+		 * @return {Chart.Element[]} Array of elements that are under the point. If none are found, an empty array is returned
10628
+		 */
10629
+		nearest: function(chart, e, options) {
10630
+			var position = getRelativePosition(e, chart);
10631
+			options.axis = options.axis || 'xy';
10632
+			var distanceMetric = getDistanceMetricForAxis(options.axis);
10633
+			var nearestItems = getNearestItems(chart, position, options.intersect, distanceMetric);
10634
+
10635
+			// We have multiple items at the same distance from the event. Now sort by smallest
10636
+			if (nearestItems.length > 1) {
10637
+				nearestItems.sort(function(a, b) {
10638
+					var sizeA = a.getArea();
10639
+					var sizeB = b.getArea();
10640
+					var ret = sizeA - sizeB;
10641
+
10642
+					if (ret === 0) {
10643
+						// if equal sort by dataset index
10644
+						ret = a._datasetIndex - b._datasetIndex;
10645
+					}
10646
+
10647
+					return ret;
10648
+				});
10649
+			}
10650
+
10651
+			// Return only 1 item
10652
+			return nearestItems.slice(0, 1);
10653
+		},
10654
+
10655
+		/**
10656
+		 * x mode returns the elements that hit-test at the current x coordinate
10657
+		 * @function Chart.Interaction.modes.x
10658
+		 * @param chart {chart} the chart we are returning items from
10659
+		 * @param e {Event} the event we are find things at
10660
+		 * @param options {IInteractionOptions} options to use
10661
+		 * @return {Chart.Element[]} Array of elements that are under the point. If none are found, an empty array is returned
10662
+		 */
10663
+		x: function(chart, e, options) {
10664
+			var position = getRelativePosition(e, chart);
10665
+			var items = [];
10666
+			var intersectsItem = false;
10667
+
10668
+			parseVisibleItems(chart, function(element) {
10669
+				if (element.inXRange(position.x)) {
10670
+					items.push(element);
10671
+				}
10672
+
10673
+				if (element.inRange(position.x, position.y)) {
10674
+					intersectsItem = true;
10675
+				}
10676
+			});
10677
+
10678
+			// If we want to trigger on an intersect and we don't have any items
10679
+			// that intersect the position, return nothing
10680
+			if (options.intersect && !intersectsItem) {
10681
+				items = [];
10682
+			}
10683
+			return items;
10684
+		},
10685
+
10686
+		/**
10687
+		 * y mode returns the elements that hit-test at the current y coordinate
10688
+		 * @function Chart.Interaction.modes.y
10689
+		 * @param chart {chart} the chart we are returning items from
10690
+		 * @param e {Event} the event we are find things at
10691
+		 * @param options {IInteractionOptions} options to use
10692
+		 * @return {Chart.Element[]} Array of elements that are under the point. If none are found, an empty array is returned
10693
+		 */
10694
+		y: function(chart, e, options) {
10695
+			var position = getRelativePosition(e, chart);
10696
+			var items = [];
10697
+			var intersectsItem = false;
10698
+
10699
+			parseVisibleItems(chart, function(element) {
10700
+				if (element.inYRange(position.y)) {
10701
+					items.push(element);
10702
+				}
10703
+
10704
+				if (element.inRange(position.x, position.y)) {
10705
+					intersectsItem = true;
10706
+				}
10707
+			});
10708
+
10709
+			// If we want to trigger on an intersect and we don't have any items
10710
+			// that intersect the position, return nothing
10711
+			if (options.intersect && !intersectsItem) {
10712
+				items = [];
10713
+			}
10714
+			return items;
10715
+		}
10716
+	}
10717
+};
10718
+
10719
+},{"45":45}],29:[function(require,module,exports){
10720
+'use strict';
10721
+
10722
+var defaults = require(25);
10723
+
10724
+defaults._set('global', {
10725
+	responsive: true,
10726
+	responsiveAnimationDuration: 0,
10727
+	maintainAspectRatio: true,
10728
+	events: ['mousemove', 'mouseout', 'click', 'touchstart', 'touchmove'],
10729
+	hover: {
10730
+		onHover: null,
10731
+		mode: 'nearest',
10732
+		intersect: true,
10733
+		animationDuration: 400
10734
+	},
10735
+	onClick: null,
10736
+	defaultColor: 'rgba(0,0,0,0.1)',
10737
+	defaultFontColor: '#666',
10738
+	defaultFontFamily: "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",
10739
+	defaultFontSize: 12,
10740
+	defaultFontStyle: 'normal',
10741
+	showLines: true,
10742
+
10743
+	// Element defaults defined in element extensions
10744
+	elements: {},
10745
+
10746
+	// Layout options such as padding
10747
+	layout: {
10748
+		padding: {
10749
+			top: 0,
10750
+			right: 0,
10751
+			bottom: 0,
10752
+			left: 0
10753
+		}
10754
+	}
10755
+});
10756
+
10757
+module.exports = function() {
10758
+
10759
+	// Occupy the global variable of Chart, and create a simple base class
10760
+	var Chart = function(item, config) {
10761
+		this.construct(item, config);
10762
+		return this;
10763
+	};
10764
+
10765
+	Chart.Chart = Chart;
10766
+
10767
+	return Chart;
10768
+};
10769
+
10770
+},{"25":25}],30:[function(require,module,exports){
10771
+'use strict';
10772
+
10773
+var helpers = require(45);
10774
+
10775
+function filterByPosition(array, position) {
10776
+	return helpers.where(array, function(v) {
10777
+		return v.position === position;
10778
+	});
10779
+}
10780
+
10781
+function sortByWeight(array, reverse) {
10782
+	array.forEach(function(v, i) {
10783
+		v._tmpIndex_ = i;
10784
+		return v;
10785
+	});
10786
+	array.sort(function(a, b) {
10787
+		var v0 = reverse ? b : a;
10788
+		var v1 = reverse ? a : b;
10789
+		return v0.weight === v1.weight ?
10790
+			v0._tmpIndex_ - v1._tmpIndex_ :
10791
+			v0.weight - v1.weight;
10792
+	});
10793
+	array.forEach(function(v) {
10794
+		delete v._tmpIndex_;
10795
+	});
10796
+}
10797
+
10798
+/**
10799
+ * @interface ILayoutItem
10800
+ * @prop {String} position - The position of the item in the chart layout. Possible values are
10801
+ * 'left', 'top', 'right', 'bottom', and 'chartArea'
10802
+ * @prop {Number} weight - The weight used to sort the item. Higher weights are further away from the chart area
10803
+ * @prop {Boolean} fullWidth - if true, and the item is horizontal, then push vertical boxes down
10804
+ * @prop {Function} isHorizontal - returns true if the layout item is horizontal (ie. top or bottom)
10805
+ * @prop {Function} update - Takes two parameters: width and height. Returns size of item
10806
+ * @prop {Function} getPadding -  Returns an object with padding on the edges
10807
+ * @prop {Number} width - Width of item. Must be valid after update()
10808
+ * @prop {Number} height - Height of item. Must be valid after update()
10809
+ * @prop {Number} left - Left edge of the item. Set by layout system and cannot be used in update
10810
+ * @prop {Number} top - Top edge of the item. Set by layout system and cannot be used in update
10811
+ * @prop {Number} right - Right edge of the item. Set by layout system and cannot be used in update
10812
+ * @prop {Number} bottom - Bottom edge of the item. Set by layout system and cannot be used in update
10813
+ */
10814
+
10815
+// The layout service is very self explanatory.  It's responsible for the layout within a chart.
10816
+// Scales, Legends and Plugins all rely on the layout service and can easily register to be placed anywhere they need
10817
+// It is this service's responsibility of carrying out that layout.
10818
+module.exports = {
10819
+	defaults: {},
10820
+
10821
+	/**
10822
+	 * Register a box to a chart.
10823
+	 * A box is simply a reference to an object that requires layout. eg. Scales, Legend, Title.
10824
+	 * @param {Chart} chart - the chart to use
10825
+	 * @param {ILayoutItem} item - the item to add to be layed out
10826
+	 */
10827
+	addBox: function(chart, item) {
10828
+		if (!chart.boxes) {
10829
+			chart.boxes = [];
10830
+		}
10831
+
10832
+		// initialize item with default values
10833
+		item.fullWidth = item.fullWidth || false;
10834
+		item.position = item.position || 'top';
10835
+		item.weight = item.weight || 0;
10836
+
10837
+		chart.boxes.push(item);
10838
+	},
10839
+
10840
+	/**
10841
+	 * Remove a layoutItem from a chart
10842
+	 * @param {Chart} chart - the chart to remove the box from
10843
+	 * @param {Object} layoutItem - the item to remove from the layout
10844
+	 */
10845
+	removeBox: function(chart, layoutItem) {
10846
+		var index = chart.boxes ? chart.boxes.indexOf(layoutItem) : -1;
10847
+		if (index !== -1) {
10848
+			chart.boxes.splice(index, 1);
10849
+		}
10850
+	},
10851
+
10852
+	/**
10853
+	 * Sets (or updates) options on the given `item`.
10854
+	 * @param {Chart} chart - the chart in which the item lives (or will be added to)
10855
+	 * @param {Object} item - the item to configure with the given options
10856
+	 * @param {Object} options - the new item options.
10857
+	 */
10858
+	configure: function(chart, item, options) {
10859
+		var props = ['fullWidth', 'position', 'weight'];
10860
+		var ilen = props.length;
10861
+		var i = 0;
10862
+		var prop;
10863
+
10864
+		for (; i < ilen; ++i) {
10865
+			prop = props[i];
10866
+			if (options.hasOwnProperty(prop)) {
10867
+				item[prop] = options[prop];
10868
+			}
10869
+		}
10870
+	},
10871
+
10872
+	/**
10873
+	 * Fits boxes of the given chart into the given size by having each box measure itself
10874
+	 * then running a fitting algorithm
10875
+	 * @param {Chart} chart - the chart
10876
+	 * @param {Number} width - the width to fit into
10877
+	 * @param {Number} height - the height to fit into
10878
+	 */
10879
+	update: function(chart, width, height) {
10880
+		if (!chart) {
10881
+			return;
10882
+		}
10883
+
10884
+		var layoutOptions = chart.options.layout || {};
10885
+		var padding = helpers.options.toPadding(layoutOptions.padding);
10886
+		var leftPadding = padding.left;
10887
+		var rightPadding = padding.right;
10888
+		var topPadding = padding.top;
10889
+		var bottomPadding = padding.bottom;
10890
+
10891
+		var leftBoxes = filterByPosition(chart.boxes, 'left');
10892
+		var rightBoxes = filterByPosition(chart.boxes, 'right');
10893
+		var topBoxes = filterByPosition(chart.boxes, 'top');
10894
+		var bottomBoxes = filterByPosition(chart.boxes, 'bottom');
10895
+		var chartAreaBoxes = filterByPosition(chart.boxes, 'chartArea');
10896
+
10897
+		// Sort boxes by weight. A higher weight is further away from the chart area
10898
+		sortByWeight(leftBoxes, true);
10899
+		sortByWeight(rightBoxes, false);
10900
+		sortByWeight(topBoxes, true);
10901
+		sortByWeight(bottomBoxes, false);
10902
+
10903
+		// Essentially we now have any number of boxes on each of the 4 sides.
10904
+		// Our canvas looks like the following.
10905
+		// The areas L1 and L2 are the left axes. R1 is the right axis, T1 is the top axis and
10906
+		// B1 is the bottom axis
10907
+		// There are also 4 quadrant-like locations (left to right instead of clockwise) reserved for chart overlays
10908
+		// These locations are single-box locations only, when trying to register a chartArea location that is already taken,
10909
+		// an error will be thrown.
10910
+		//
10911
+		// |----------------------------------------------------|
10912
+		// |                  T1 (Full Width)                   |
10913
+		// |----------------------------------------------------|
10914
+		// |    |    |                 T2                  |    |
10915
+		// |    |----|-------------------------------------|----|
10916
+		// |    |    | C1 |                           | C2 |    |
10917
+		// |    |    |----|                           |----|    |
10918
+		// |    |    |                                     |    |
10919
+		// | L1 | L2 |           ChartArea (C0)            | R1 |
10920
+		// |    |    |                                     |    |
10921
+		// |    |    |----|                           |----|    |
10922
+		// |    |    | C3 |                           | C4 |    |
10923
+		// |    |----|-------------------------------------|----|
10924
+		// |    |    |                 B1                  |    |
10925
+		// |----------------------------------------------------|
10926
+		// |                  B2 (Full Width)                   |
10927
+		// |----------------------------------------------------|
10928
+		//
10929
+		// What we do to find the best sizing, we do the following
10930
+		// 1. Determine the minimum size of the chart area.
10931
+		// 2. Split the remaining width equally between each vertical axis
10932
+		// 3. Split the remaining height equally between each horizontal axis
10933
+		// 4. Give each layout the maximum size it can be. The layout will return it's minimum size
10934
+		// 5. Adjust the sizes of each axis based on it's minimum reported size.
10935
+		// 6. Refit each axis
10936
+		// 7. Position each axis in the final location
10937
+		// 8. Tell the chart the final location of the chart area
10938
+		// 9. Tell any axes that overlay the chart area the positions of the chart area
10939
+
10940
+		// Step 1
10941
+		var chartWidth = width - leftPadding - rightPadding;
10942
+		var chartHeight = height - topPadding - bottomPadding;
10943
+		var chartAreaWidth = chartWidth / 2; // min 50%
10944
+		var chartAreaHeight = chartHeight / 2; // min 50%
10945
+
10946
+		// Step 2
10947
+		var verticalBoxWidth = (width - chartAreaWidth) / (leftBoxes.length + rightBoxes.length);
10948
+
10949
+		// Step 3
10950
+		var horizontalBoxHeight = (height - chartAreaHeight) / (topBoxes.length + bottomBoxes.length);
10951
+
10952
+		// Step 4
10953
+		var maxChartAreaWidth = chartWidth;
10954
+		var maxChartAreaHeight = chartHeight;
10955
+		var minBoxSizes = [];
10956
+
10957
+		function getMinimumBoxSize(box) {
10958
+			var minSize;
10959
+			var isHorizontal = box.isHorizontal();
10960
+
10961
+			if (isHorizontal) {
10962
+				minSize = box.update(box.fullWidth ? chartWidth : maxChartAreaWidth, horizontalBoxHeight);
10963
+				maxChartAreaHeight -= minSize.height;
10964
+			} else {
10965
+				minSize = box.update(verticalBoxWidth, maxChartAreaHeight);
10966
+				maxChartAreaWidth -= minSize.width;
10967
+			}
10968
+
10969
+			minBoxSizes.push({
10970
+				horizontal: isHorizontal,
10971
+				minSize: minSize,
10972
+				box: box,
10973
+			});
10974
+		}
10975
+
10976
+		helpers.each(leftBoxes.concat(rightBoxes, topBoxes, bottomBoxes), getMinimumBoxSize);
10977
+
10978
+		// If a horizontal box has padding, we move the left boxes over to avoid ugly charts (see issue #2478)
10979
+		var maxHorizontalLeftPadding = 0;
10980
+		var maxHorizontalRightPadding = 0;
10981
+		var maxVerticalTopPadding = 0;
10982
+		var maxVerticalBottomPadding = 0;
10983
+
10984
+		helpers.each(topBoxes.concat(bottomBoxes), function(horizontalBox) {
10985
+			if (horizontalBox.getPadding) {
10986
+				var boxPadding = horizontalBox.getPadding();
10987
+				maxHorizontalLeftPadding = Math.max(maxHorizontalLeftPadding, boxPadding.left);
10988
+				maxHorizontalRightPadding = Math.max(maxHorizontalRightPadding, boxPadding.right);
10989
+			}
10990
+		});
10991
+
10992
+		helpers.each(leftBoxes.concat(rightBoxes), function(verticalBox) {
10993
+			if (verticalBox.getPadding) {
10994
+				var boxPadding = verticalBox.getPadding();
10995
+				maxVerticalTopPadding = Math.max(maxVerticalTopPadding, boxPadding.top);
10996
+				maxVerticalBottomPadding = Math.max(maxVerticalBottomPadding, boxPadding.bottom);
10997
+			}
10998
+		});
10999
+
11000
+		// At this point, maxChartAreaHeight and maxChartAreaWidth are the size the chart area could
11001
+		// be if the axes are drawn at their minimum sizes.
11002
+		// Steps 5 & 6
11003
+		var totalLeftBoxesWidth = leftPadding;
11004
+		var totalRightBoxesWidth = rightPadding;
11005
+		var totalTopBoxesHeight = topPadding;
11006
+		var totalBottomBoxesHeight = bottomPadding;
11007
+
11008
+		// Function to fit a box
11009
+		function fitBox(box) {
11010
+			var minBoxSize = helpers.findNextWhere(minBoxSizes, function(minBox) {
11011
+				return minBox.box === box;
11012
+			});
11013
+
11014
+			if (minBoxSize) {
11015
+				if (box.isHorizontal()) {
11016
+					var scaleMargin = {
11017
+						left: Math.max(totalLeftBoxesWidth, maxHorizontalLeftPadding),
11018
+						right: Math.max(totalRightBoxesWidth, maxHorizontalRightPadding),
11019
+						top: 0,
11020
+						bottom: 0
11021
+					};
11022
+
11023
+					// Don't use min size here because of label rotation. When the labels are rotated, their rotation highly depends
11024
+					// on the margin. Sometimes they need to increase in size slightly
11025
+					box.update(box.fullWidth ? chartWidth : maxChartAreaWidth, chartHeight / 2, scaleMargin);
11026
+				} else {
11027
+					box.update(minBoxSize.minSize.width, maxChartAreaHeight);
11028
+				}
11029
+			}
11030
+		}
11031
+
11032
+		// Update, and calculate the left and right margins for the horizontal boxes
11033
+		helpers.each(leftBoxes.concat(rightBoxes), fitBox);
11034
+
11035
+		helpers.each(leftBoxes, function(box) {
11036
+			totalLeftBoxesWidth += box.width;
11037
+		});
11038
+
11039
+		helpers.each(rightBoxes, function(box) {
11040
+			totalRightBoxesWidth += box.width;
11041
+		});
11042
+
11043
+		// Set the Left and Right margins for the horizontal boxes
11044
+		helpers.each(topBoxes.concat(bottomBoxes), fitBox);
11045
+
11046
+		// Figure out how much margin is on the top and bottom of the vertical boxes
11047
+		helpers.each(topBoxes, function(box) {
11048
+			totalTopBoxesHeight += box.height;
11049
+		});
11050
+
11051
+		helpers.each(bottomBoxes, function(box) {
11052
+			totalBottomBoxesHeight += box.height;
11053
+		});
11054
+
11055
+		function finalFitVerticalBox(box) {
11056
+			var minBoxSize = helpers.findNextWhere(minBoxSizes, function(minSize) {
11057
+				return minSize.box === box;
11058
+			});
11059
+
11060
+			var scaleMargin = {
11061
+				left: 0,
11062
+				right: 0,
11063
+				top: totalTopBoxesHeight,
11064
+				bottom: totalBottomBoxesHeight
11065
+			};
11066
+
11067
+			if (minBoxSize) {
11068
+				box.update(minBoxSize.minSize.width, maxChartAreaHeight, scaleMargin);
11069
+			}
11070
+		}
11071
+
11072
+		// Let the left layout know the final margin
11073
+		helpers.each(leftBoxes.concat(rightBoxes), finalFitVerticalBox);
11074
+
11075
+		// Recalculate because the size of each layout might have changed slightly due to the margins (label rotation for instance)
11076
+		totalLeftBoxesWidth = leftPadding;
11077
+		totalRightBoxesWidth = rightPadding;
11078
+		totalTopBoxesHeight = topPadding;
11079
+		totalBottomBoxesHeight = bottomPadding;
11080
+
11081
+		helpers.each(leftBoxes, function(box) {
11082
+			totalLeftBoxesWidth += box.width;
11083
+		});
11084
+
11085
+		helpers.each(rightBoxes, function(box) {
11086
+			totalRightBoxesWidth += box.width;
11087
+		});
11088
+
11089
+		helpers.each(topBoxes, function(box) {
11090
+			totalTopBoxesHeight += box.height;
11091
+		});
11092
+		helpers.each(bottomBoxes, function(box) {
11093
+			totalBottomBoxesHeight += box.height;
11094
+		});
11095
+
11096
+		// We may be adding some padding to account for rotated x axis labels
11097
+		var leftPaddingAddition = Math.max(maxHorizontalLeftPadding - totalLeftBoxesWidth, 0);
11098
+		totalLeftBoxesWidth += leftPaddingAddition;
11099
+		totalRightBoxesWidth += Math.max(maxHorizontalRightPadding - totalRightBoxesWidth, 0);
11100
+
11101
+		var topPaddingAddition = Math.max(maxVerticalTopPadding - totalTopBoxesHeight, 0);
11102
+		totalTopBoxesHeight += topPaddingAddition;
11103
+		totalBottomBoxesHeight += Math.max(maxVerticalBottomPadding - totalBottomBoxesHeight, 0);
11104
+
11105
+		// Figure out if our chart area changed. This would occur if the dataset layout label rotation
11106
+		// changed due to the application of the margins in step 6. Since we can only get bigger, this is safe to do
11107
+		// without calling `fit` again
11108
+		var newMaxChartAreaHeight = height - totalTopBoxesHeight - totalBottomBoxesHeight;
11109
+		var newMaxChartAreaWidth = width - totalLeftBoxesWidth - totalRightBoxesWidth;
11110
+
11111
+		if (newMaxChartAreaWidth !== maxChartAreaWidth || newMaxChartAreaHeight !== maxChartAreaHeight) {
11112
+			helpers.each(leftBoxes, function(box) {
11113
+				box.height = newMaxChartAreaHeight;
11114
+			});
11115
+
11116
+			helpers.each(rightBoxes, function(box) {
11117
+				box.height = newMaxChartAreaHeight;
11118
+			});
11119
+
11120
+			helpers.each(topBoxes, function(box) {
11121
+				if (!box.fullWidth) {
11122
+					box.width = newMaxChartAreaWidth;
11123
+				}
11124
+			});
11125
+
11126
+			helpers.each(bottomBoxes, function(box) {
11127
+				if (!box.fullWidth) {
11128
+					box.width = newMaxChartAreaWidth;
11129
+				}
11130
+			});
11131
+
11132
+			maxChartAreaHeight = newMaxChartAreaHeight;
11133
+			maxChartAreaWidth = newMaxChartAreaWidth;
11134
+		}
11135
+
11136
+		// Step 7 - Position the boxes
11137
+		var left = leftPadding + leftPaddingAddition;
11138
+		var top = topPadding + topPaddingAddition;
11139
+
11140
+		function placeBox(box) {
11141
+			if (box.isHorizontal()) {
11142
+				box.left = box.fullWidth ? leftPadding : totalLeftBoxesWidth;
11143
+				box.right = box.fullWidth ? width - rightPadding : totalLeftBoxesWidth + maxChartAreaWidth;
11144
+				box.top = top;
11145
+				box.bottom = top + box.height;
11146
+
11147
+				// Move to next point
11148
+				top = box.bottom;
11149
+
11150
+			} else {
11151
+
11152
+				box.left = left;
11153
+				box.right = left + box.width;
11154
+				box.top = totalTopBoxesHeight;
11155
+				box.bottom = totalTopBoxesHeight + maxChartAreaHeight;
11156
+
11157
+				// Move to next point
11158
+				left = box.right;
11159
+			}
11160
+		}
11161
+
11162
+		helpers.each(leftBoxes.concat(topBoxes), placeBox);
11163
+
11164
+		// Account for chart width and height
11165
+		left += maxChartAreaWidth;
11166
+		top += maxChartAreaHeight;
11167
+
11168
+		helpers.each(rightBoxes, placeBox);
11169
+		helpers.each(bottomBoxes, placeBox);
11170
+
11171
+		// Step 8
11172
+		chart.chartArea = {
11173
+			left: totalLeftBoxesWidth,
11174
+			top: totalTopBoxesHeight,
11175
+			right: totalLeftBoxesWidth + maxChartAreaWidth,
11176
+			bottom: totalTopBoxesHeight + maxChartAreaHeight
11177
+		};
11178
+
11179
+		// Step 9
11180
+		helpers.each(chartAreaBoxes, function(box) {
11181
+			box.left = chart.chartArea.left;
11182
+			box.top = chart.chartArea.top;
11183
+			box.right = chart.chartArea.right;
11184
+			box.bottom = chart.chartArea.bottom;
11185
+
11186
+			box.update(maxChartAreaWidth, maxChartAreaHeight);
11187
+		});
11188
+	}
11189
+};
11190
+
11191
+},{"45":45}],31:[function(require,module,exports){
11192
+'use strict';
11193
+
11194
+var defaults = require(25);
11195
+var helpers = require(45);
11196
+
11197
+defaults._set('global', {
11198
+	plugins: {}
11199
+});
11200
+
11201
+/**
11202
+ * The plugin service singleton
11203
+ * @namespace Chart.plugins
11204
+ * @since 2.1.0
11205
+ */
11206
+module.exports = {
11207
+	/**
11208
+	 * Globally registered plugins.
11209
+	 * @private
11210
+	 */
11211
+	_plugins: [],
11212
+
11213
+	/**
11214
+	 * This identifier is used to invalidate the descriptors cache attached to each chart
11215
+	 * when a global plugin is registered or unregistered. In this case, the cache ID is
11216
+	 * incremented and descriptors are regenerated during following API calls.
11217
+	 * @private
11218
+	 */
11219
+	_cacheId: 0,
11220
+
11221
+	/**
11222
+	 * Registers the given plugin(s) if not already registered.
11223
+	 * @param {Array|Object} plugins plugin instance(s).
11224
+	 */
11225
+	register: function(plugins) {
11226
+		var p = this._plugins;
11227
+		([]).concat(plugins).forEach(function(plugin) {
11228
+			if (p.indexOf(plugin) === -1) {
11229
+				p.push(plugin);
11230
+			}
11231
+		});
11232
+
11233
+		this._cacheId++;
11234
+	},
11235
+
11236
+	/**
11237
+	 * Unregisters the given plugin(s) only if registered.
11238
+	 * @param {Array|Object} plugins plugin instance(s).
11239
+	 */
11240
+	unregister: function(plugins) {
11241
+		var p = this._plugins;
11242
+		([]).concat(plugins).forEach(function(plugin) {
11243
+			var idx = p.indexOf(plugin);
11244
+			if (idx !== -1) {
11245
+				p.splice(idx, 1);
11246
+			}
11247
+		});
11248
+
11249
+		this._cacheId++;
11250
+	},
11251
+
11252
+	/**
11253
+	 * Remove all registered plugins.
11254
+	 * @since 2.1.5
11255
+	 */
11256
+	clear: function() {
11257
+		this._plugins = [];
11258
+		this._cacheId++;
11259
+	},
11260
+
11261
+	/**
11262
+	 * Returns the number of registered plugins?
11263
+	 * @returns {Number}
11264
+	 * @since 2.1.5
11265
+	 */
11266
+	count: function() {
11267
+		return this._plugins.length;
11268
+	},
11269
+
11270
+	/**
11271
+	 * Returns all registered plugin instances.
11272
+	 * @returns {Array} array of plugin objects.
11273
+	 * @since 2.1.5
11274
+	 */
11275
+	getAll: function() {
11276
+		return this._plugins;
11277
+	},
11278
+
11279
+	/**
11280
+	 * Calls enabled plugins for `chart` on the specified hook and with the given args.
11281
+	 * This method immediately returns as soon as a plugin explicitly returns false. The
11282
+	 * returned value can be used, for instance, to interrupt the current action.
11283
+	 * @param {Object} chart - The chart instance for which plugins should be called.
11284
+	 * @param {String} hook - The name of the plugin method to call (e.g. 'beforeUpdate').
11285
+	 * @param {Array} [args] - Extra arguments to apply to the hook call.
11286
+	 * @returns {Boolean} false if any of the plugins return false, else returns true.
11287
+	 */
11288
+	notify: function(chart, hook, args) {
11289
+		var descriptors = this.descriptors(chart);
11290
+		var ilen = descriptors.length;
11291
+		var i, descriptor, plugin, params, method;
11292
+
11293
+		for (i = 0; i < ilen; ++i) {
11294
+			descriptor = descriptors[i];
11295
+			plugin = descriptor.plugin;
11296
+			method = plugin[hook];
11297
+			if (typeof method === 'function') {
11298
+				params = [chart].concat(args || []);
11299
+				params.push(descriptor.options);
11300
+				if (method.apply(plugin, params) === false) {
11301
+					return false;
11302
+				}
11303
+			}
11304
+		}
11305
+
11306
+		return true;
11307
+	},
11308
+
11309
+	/**
11310
+	 * Returns descriptors of enabled plugins for the given chart.
11311
+	 * @returns {Array} [{ plugin, options }]
11312
+	 * @private
11313
+	 */
11314
+	descriptors: function(chart) {
11315
+		var cache = chart.$plugins || (chart.$plugins = {});
11316
+		if (cache.id === this._cacheId) {
11317
+			return cache.descriptors;
11318
+		}
11319
+
11320
+		var plugins = [];
11321
+		var descriptors = [];
11322
+		var config = (chart && chart.config) || {};
11323
+		var options = (config.options && config.options.plugins) || {};
11324
+
11325
+		this._plugins.concat(config.plugins || []).forEach(function(plugin) {
11326
+			var idx = plugins.indexOf(plugin);
11327
+			if (idx !== -1) {
11328
+				return;
11329
+			}
11330
+
11331
+			var id = plugin.id;
11332
+			var opts = options[id];
11333
+			if (opts === false) {
11334
+				return;
11335
+			}
11336
+
11337
+			if (opts === true) {
11338
+				opts = helpers.clone(defaults.global.plugins[id]);
11339
+			}
11340
+
11341
+			plugins.push(plugin);
11342
+			descriptors.push({
11343
+				plugin: plugin,
11344
+				options: opts || {}
11345
+			});
11346
+		});
11347
+
11348
+		cache.descriptors = descriptors;
11349
+		cache.id = this._cacheId;
11350
+		return descriptors;
11351
+	},
11352
+
11353
+	/**
11354
+	 * Invalidates cache for the given chart: descriptors hold a reference on plugin option,
11355
+	 * but in some cases, this reference can be changed by the user when updating options.
11356
+	 * https://github.com/chartjs/Chart.js/issues/5111#issuecomment-355934167
11357
+	 * @private
11358
+	 */
11359
+	_invalidate: function(chart) {
11360
+		delete chart.$plugins;
11361
+	}
11362
+};
11363
+
11364
+/**
11365
+ * Plugin extension hooks.
11366
+ * @interface IPlugin
11367
+ * @since 2.1.0
11368
+ */
11369
+/**
11370
+ * @method IPlugin#beforeInit
11371
+ * @desc Called before initializing `chart`.
11372
+ * @param {Chart.Controller} chart - The chart instance.
11373
+ * @param {Object} options - The plugin options.
11374
+ */
11375
+/**
11376
+ * @method IPlugin#afterInit
11377
+ * @desc Called after `chart` has been initialized and before the first update.
11378
+ * @param {Chart.Controller} chart - The chart instance.
11379
+ * @param {Object} options - The plugin options.
11380
+ */
11381
+/**
11382
+ * @method IPlugin#beforeUpdate
11383
+ * @desc Called before updating `chart`. If any plugin returns `false`, the update
11384
+ * is cancelled (and thus subsequent render(s)) until another `update` is triggered.
11385
+ * @param {Chart.Controller} chart - The chart instance.
11386
+ * @param {Object} options - The plugin options.
11387
+ * @returns {Boolean} `false` to cancel the chart update.
11388
+ */
11389
+/**
11390
+ * @method IPlugin#afterUpdate
11391
+ * @desc Called after `chart` has been updated and before rendering. Note that this
11392
+ * hook will not be called if the chart update has been previously cancelled.
11393
+ * @param {Chart.Controller} chart - The chart instance.
11394
+ * @param {Object} options - The plugin options.
11395
+ */
11396
+/**
11397
+ * @method IPlugin#beforeDatasetsUpdate
11398
+ * @desc Called before updating the `chart` datasets. If any plugin returns `false`,
11399
+ * the datasets update is cancelled until another `update` is triggered.
11400
+ * @param {Chart.Controller} chart - The chart instance.
11401
+ * @param {Object} options - The plugin options.
11402
+ * @returns {Boolean} false to cancel the datasets update.
11403
+ * @since version 2.1.5
11404
+*/
11405
+/**
11406
+ * @method IPlugin#afterDatasetsUpdate
11407
+ * @desc Called after the `chart` datasets have been updated. Note that this hook
11408
+ * will not be called if the datasets update has been previously cancelled.
11409
+ * @param {Chart.Controller} chart - The chart instance.
11410
+ * @param {Object} options - The plugin options.
11411
+ * @since version 2.1.5
11412
+ */
11413
+/**
11414
+ * @method IPlugin#beforeDatasetUpdate
11415
+ * @desc Called before updating the `chart` dataset at the given `args.index`. If any plugin
11416
+ * returns `false`, the datasets update is cancelled until another `update` is triggered.
11417
+ * @param {Chart} chart - The chart instance.
11418
+ * @param {Object} args - The call arguments.
11419
+ * @param {Number} args.index - The dataset index.
11420
+ * @param {Object} args.meta - The dataset metadata.
11421
+ * @param {Object} options - The plugin options.
11422
+ * @returns {Boolean} `false` to cancel the chart datasets drawing.
11423
+ */
11424
+/**
11425
+ * @method IPlugin#afterDatasetUpdate
11426
+ * @desc Called after the `chart` datasets at the given `args.index` has been updated. Note
11427
+ * that this hook will not be called if the datasets update has been previously cancelled.
11428
+ * @param {Chart} chart - The chart instance.
11429
+ * @param {Object} args - The call arguments.
11430
+ * @param {Number} args.index - The dataset index.
11431
+ * @param {Object} args.meta - The dataset metadata.
11432
+ * @param {Object} options - The plugin options.
11433
+ */
11434
+/**
11435
+ * @method IPlugin#beforeLayout
11436
+ * @desc Called before laying out `chart`. If any plugin returns `false`,
11437
+ * the layout update is cancelled until another `update` is triggered.
11438
+ * @param {Chart.Controller} chart - The chart instance.
11439
+ * @param {Object} options - The plugin options.
11440
+ * @returns {Boolean} `false` to cancel the chart layout.
11441
+ */
11442
+/**
11443
+ * @method IPlugin#afterLayout
11444
+ * @desc Called after the `chart` has been layed out. Note that this hook will not
11445
+ * be called if the layout update has been previously cancelled.
11446
+ * @param {Chart.Controller} chart - The chart instance.
11447
+ * @param {Object} options - The plugin options.
11448
+ */
11449
+/**
11450
+ * @method IPlugin#beforeRender
11451
+ * @desc Called before rendering `chart`. If any plugin returns `false`,
11452
+ * the rendering is cancelled until another `render` is triggered.
11453
+ * @param {Chart.Controller} chart - The chart instance.
11454
+ * @param {Object} options - The plugin options.
11455
+ * @returns {Boolean} `false` to cancel the chart rendering.
11456
+ */
11457
+/**
11458
+ * @method IPlugin#afterRender
11459
+ * @desc Called after the `chart` has been fully rendered (and animation completed). Note
11460
+ * that this hook will not be called if the rendering has been previously cancelled.
11461
+ * @param {Chart.Controller} chart - The chart instance.
11462
+ * @param {Object} options - The plugin options.
11463
+ */
11464
+/**
11465
+ * @method IPlugin#beforeDraw
11466
+ * @desc Called before drawing `chart` at every animation frame specified by the given
11467
+ * easing value. If any plugin returns `false`, the frame drawing is cancelled until
11468
+ * another `render` is triggered.
11469
+ * @param {Chart.Controller} chart - The chart instance.
11470
+ * @param {Number} easingValue - The current animation value, between 0.0 and 1.0.
11471
+ * @param {Object} options - The plugin options.
11472
+ * @returns {Boolean} `false` to cancel the chart drawing.
11473
+ */
11474
+/**
11475
+ * @method IPlugin#afterDraw
11476
+ * @desc Called after the `chart` has been drawn for the specific easing value. Note
11477
+ * that this hook will not be called if the drawing has been previously cancelled.
11478
+ * @param {Chart.Controller} chart - The chart instance.
11479
+ * @param {Number} easingValue - The current animation value, between 0.0 and 1.0.
11480
+ * @param {Object} options - The plugin options.
11481
+ */
11482
+/**
11483
+ * @method IPlugin#beforeDatasetsDraw
11484
+ * @desc Called before drawing the `chart` datasets. If any plugin returns `false`,
11485
+ * the datasets drawing is cancelled until another `render` is triggered.
11486
+ * @param {Chart.Controller} chart - The chart instance.
11487
+ * @param {Number} easingValue - The current animation value, between 0.0 and 1.0.
11488
+ * @param {Object} options - The plugin options.
11489
+ * @returns {Boolean} `false` to cancel the chart datasets drawing.
11490
+ */
11491
+/**
11492
+ * @method IPlugin#afterDatasetsDraw
11493
+ * @desc Called after the `chart` datasets have been drawn. Note that this hook
11494
+ * will not be called if the datasets drawing has been previously cancelled.
11495
+ * @param {Chart.Controller} chart - The chart instance.
11496
+ * @param {Number} easingValue - The current animation value, between 0.0 and 1.0.
11497
+ * @param {Object} options - The plugin options.
11498
+ */
11499
+/**
11500
+ * @method IPlugin#beforeDatasetDraw
11501
+ * @desc Called before drawing the `chart` dataset at the given `args.index` (datasets
11502
+ * are drawn in the reverse order). If any plugin returns `false`, the datasets drawing
11503
+ * is cancelled until another `render` is triggered.
11504
+ * @param {Chart} chart - The chart instance.
11505
+ * @param {Object} args - The call arguments.
11506
+ * @param {Number} args.index - The dataset index.
11507
+ * @param {Object} args.meta - The dataset metadata.
11508
+ * @param {Number} args.easingValue - The current animation value, between 0.0 and 1.0.
11509
+ * @param {Object} options - The plugin options.
11510
+ * @returns {Boolean} `false` to cancel the chart datasets drawing.
11511
+ */
11512
+/**
11513
+ * @method IPlugin#afterDatasetDraw
11514
+ * @desc Called after the `chart` datasets at the given `args.index` have been drawn
11515
+ * (datasets are drawn in the reverse order). Note that this hook will not be called
11516
+ * if the datasets drawing has been previously cancelled.
11517
+ * @param {Chart} chart - The chart instance.
11518
+ * @param {Object} args - The call arguments.
11519
+ * @param {Number} args.index - The dataset index.
11520
+ * @param {Object} args.meta - The dataset metadata.
11521
+ * @param {Number} args.easingValue - The current animation value, between 0.0 and 1.0.
11522
+ * @param {Object} options - The plugin options.
11523
+ */
11524
+/**
11525
+ * @method IPlugin#beforeTooltipDraw
11526
+ * @desc Called before drawing the `tooltip`. If any plugin returns `false`,
11527
+ * the tooltip drawing is cancelled until another `render` is triggered.
11528
+ * @param {Chart} chart - The chart instance.
11529
+ * @param {Object} args - The call arguments.
11530
+ * @param {Object} args.tooltip - The tooltip.
11531
+ * @param {Number} args.easingValue - The current animation value, between 0.0 and 1.0.
11532
+ * @param {Object} options - The plugin options.
11533
+ * @returns {Boolean} `false` to cancel the chart tooltip drawing.
11534
+ */
11535
+/**
11536
+ * @method IPlugin#afterTooltipDraw
11537
+ * @desc Called after drawing the `tooltip`. Note that this hook will not
11538
+ * be called if the tooltip drawing has been previously cancelled.
11539
+ * @param {Chart} chart - The chart instance.
11540
+ * @param {Object} args - The call arguments.
11541
+ * @param {Object} args.tooltip - The tooltip.
11542
+ * @param {Number} args.easingValue - The current animation value, between 0.0 and 1.0.
11543
+ * @param {Object} options - The plugin options.
11544
+ */
11545
+/**
11546
+ * @method IPlugin#beforeEvent
11547
+ * @desc Called before processing the specified `event`. If any plugin returns `false`,
11548
+ * the event will be discarded.
11549
+ * @param {Chart.Controller} chart - The chart instance.
11550
+ * @param {IEvent} event - The event object.
11551
+ * @param {Object} options - The plugin options.
11552
+ */
11553
+/**
11554
+ * @method IPlugin#afterEvent
11555
+ * @desc Called after the `event` has been consumed. Note that this hook
11556
+ * will not be called if the `event` has been previously discarded.
11557
+ * @param {Chart.Controller} chart - The chart instance.
11558
+ * @param {IEvent} event - The event object.
11559
+ * @param {Object} options - The plugin options.
11560
+ */
11561
+/**
11562
+ * @method IPlugin#resize
11563
+ * @desc Called after the chart as been resized.
11564
+ * @param {Chart.Controller} chart - The chart instance.
11565
+ * @param {Number} size - The new canvas display size (eq. canvas.style width & height).
11566
+ * @param {Object} options - The plugin options.
11567
+ */
11568
+/**
11569
+ * @method IPlugin#destroy
11570
+ * @desc Called after the chart as been destroyed.
11571
+ * @param {Chart.Controller} chart - The chart instance.
11572
+ * @param {Object} options - The plugin options.
11573
+ */
11574
+
11575
+},{"25":25,"45":45}],32:[function(require,module,exports){
11576
+'use strict';
11577
+
11578
+var defaults = require(25);
11579
+var Element = require(26);
11580
+var helpers = require(45);
11581
+var Ticks = require(34);
11582
+
11583
+defaults._set('scale', {
11584
+	display: true,
11585
+	position: 'left',
11586
+	offset: false,
11587
+
11588
+	// grid line settings
11589
+	gridLines: {
11590
+		display: true,
11591
+		color: 'rgba(0, 0, 0, 0.1)',
11592
+		lineWidth: 1,
11593
+		drawBorder: true,
11594
+		drawOnChartArea: true,
11595
+		drawTicks: true,
11596
+		tickMarkLength: 10,
11597
+		zeroLineWidth: 1,
11598
+		zeroLineColor: 'rgba(0,0,0,0.25)',
11599
+		zeroLineBorderDash: [],
11600
+		zeroLineBorderDashOffset: 0.0,
11601
+		offsetGridLines: false,
11602
+		borderDash: [],
11603
+		borderDashOffset: 0.0
11604
+	},
11605
+
11606
+	// scale label
11607
+	scaleLabel: {
11608
+		// display property
11609
+		display: false,
11610
+
11611
+		// actual label
11612
+		labelString: '',
11613
+
11614
+		// line height
11615
+		lineHeight: 1.2,
11616
+
11617
+		// top/bottom padding
11618
+		padding: {
11619
+			top: 4,
11620
+			bottom: 4
11621
+		}
11622
+	},
11623
+
11624
+	// label settings
11625
+	ticks: {
11626
+		beginAtZero: false,
11627
+		minRotation: 0,
11628
+		maxRotation: 50,
11629
+		mirror: false,
11630
+		padding: 0,
11631
+		reverse: false,
11632
+		display: true,
11633
+		autoSkip: true,
11634
+		autoSkipPadding: 0,
11635
+		labelOffset: 0,
11636
+		// We pass through arrays to be rendered as multiline labels, we convert Others to strings here.
11637
+		callback: Ticks.formatters.values,
11638
+		minor: {},
11639
+		major: {}
11640
+	}
11641
+});
11642
+
11643
+function labelsFromTicks(ticks) {
11644
+	var labels = [];
11645
+	var i, ilen;
11646
+
11647
+	for (i = 0, ilen = ticks.length; i < ilen; ++i) {
11648
+		labels.push(ticks[i].label);
11649
+	}
11650
+
11651
+	return labels;
11652
+}
11653
+
11654
+function getLineValue(scale, index, offsetGridLines) {
11655
+	var lineValue = scale.getPixelForTick(index);
11656
+
11657
+	if (offsetGridLines) {
11658
+		if (index === 0) {
11659
+			lineValue -= (scale.getPixelForTick(1) - lineValue) / 2;
11660
+		} else {
11661
+			lineValue -= (lineValue - scale.getPixelForTick(index - 1)) / 2;
11662
+		}
11663
+	}
11664
+	return lineValue;
11665
+}
11666
+
11667
+module.exports = function(Chart) {
11668
+
11669
+	function computeTextSize(context, tick, font) {
11670
+		return helpers.isArray(tick) ?
11671
+			helpers.longestText(context, font, tick) :
11672
+			context.measureText(tick).width;
11673
+	}
11674
+
11675
+	function parseFontOptions(options) {
11676
+		var valueOrDefault = helpers.valueOrDefault;
11677
+		var globalDefaults = defaults.global;
11678
+		var size = valueOrDefault(options.fontSize, globalDefaults.defaultFontSize);
11679
+		var style = valueOrDefault(options.fontStyle, globalDefaults.defaultFontStyle);
11680
+		var family = valueOrDefault(options.fontFamily, globalDefaults.defaultFontFamily);
11681
+
11682
+		return {
11683
+			size: size,
11684
+			style: style,
11685
+			family: family,
11686
+			font: helpers.fontString(size, style, family)
11687
+		};
11688
+	}
11689
+
11690
+	function parseLineHeight(options) {
11691
+		return helpers.options.toLineHeight(
11692
+			helpers.valueOrDefault(options.lineHeight, 1.2),
11693
+			helpers.valueOrDefault(options.fontSize, defaults.global.defaultFontSize));
11694
+	}
11695
+
11696
+	Chart.Scale = Element.extend({
11697
+		/**
11698
+		 * Get the padding needed for the scale
11699
+		 * @method getPadding
11700
+		 * @private
11701
+		 * @returns {Padding} the necessary padding
11702
+		 */
11703
+		getPadding: function() {
11704
+			var me = this;
11705
+			return {
11706
+				left: me.paddingLeft || 0,
11707
+				top: me.paddingTop || 0,
11708
+				right: me.paddingRight || 0,
11709
+				bottom: me.paddingBottom || 0
11710
+			};
11711
+		},
11712
+
11713
+		/**
11714
+		 * Returns the scale tick objects ({label, major})
11715
+		 * @since 2.7
11716
+		 */
11717
+		getTicks: function() {
11718
+			return this._ticks;
11719
+		},
11720
+
11721
+		// These methods are ordered by lifecyle. Utilities then follow.
11722
+		// Any function defined here is inherited by all scale types.
11723
+		// Any function can be extended by the scale type
11724
+
11725
+		mergeTicksOptions: function() {
11726
+			var ticks = this.options.ticks;
11727
+			if (ticks.minor === false) {
11728
+				ticks.minor = {
11729
+					display: false
11730
+				};
11731
+			}
11732
+			if (ticks.major === false) {
11733
+				ticks.major = {
11734
+					display: false
11735
+				};
11736
+			}
11737
+			for (var key in ticks) {
11738
+				if (key !== 'major' && key !== 'minor') {
11739
+					if (typeof ticks.minor[key] === 'undefined') {
11740
+						ticks.minor[key] = ticks[key];
11741
+					}
11742
+					if (typeof ticks.major[key] === 'undefined') {
11743
+						ticks.major[key] = ticks[key];
11744
+					}
11745
+				}
11746
+			}
11747
+		},
11748
+		beforeUpdate: function() {
11749
+			helpers.callback(this.options.beforeUpdate, [this]);
11750
+		},
11751
+		update: function(maxWidth, maxHeight, margins) {
11752
+			var me = this;
11753
+			var i, ilen, labels, label, ticks, tick;
11754
+
11755
+			// Update Lifecycle - Probably don't want to ever extend or overwrite this function ;)
11756
+			me.beforeUpdate();
11757
+
11758
+			// Absorb the master measurements
11759
+			me.maxWidth = maxWidth;
11760
+			me.maxHeight = maxHeight;
11761
+			me.margins = helpers.extend({
11762
+				left: 0,
11763
+				right: 0,
11764
+				top: 0,
11765
+				bottom: 0
11766
+			}, margins);
11767
+			me.longestTextCache = me.longestTextCache || {};
11768
+
11769
+			// Dimensions
11770
+			me.beforeSetDimensions();
11771
+			me.setDimensions();
11772
+			me.afterSetDimensions();
11773
+
11774
+			// Data min/max
11775
+			me.beforeDataLimits();
11776
+			me.determineDataLimits();
11777
+			me.afterDataLimits();
11778
+
11779
+			// Ticks - `this.ticks` is now DEPRECATED!
11780
+			// Internal ticks are now stored as objects in the PRIVATE `this._ticks` member
11781
+			// and must not be accessed directly from outside this class. `this.ticks` being
11782
+			// around for long time and not marked as private, we can't change its structure
11783
+			// without unexpected breaking changes. If you need to access the scale ticks,
11784
+			// use scale.getTicks() instead.
11785
+
11786
+			me.beforeBuildTicks();
11787
+
11788
+			// New implementations should return an array of objects but for BACKWARD COMPAT,
11789
+			// we still support no return (`this.ticks` internally set by calling this method).
11790
+			ticks = me.buildTicks() || [];
11791
+
11792
+			me.afterBuildTicks();
11793
+
11794
+			me.beforeTickToLabelConversion();
11795
+
11796
+			// New implementations should return the formatted tick labels but for BACKWARD
11797
+			// COMPAT, we still support no return (`this.ticks` internally changed by calling
11798
+			// this method and supposed to contain only string values).
11799
+			labels = me.convertTicksToLabels(ticks) || me.ticks;
11800
+
11801
+			me.afterTickToLabelConversion();
11802
+
11803
+			me.ticks = labels;   // BACKWARD COMPATIBILITY
11804
+
11805
+			// IMPORTANT: from this point, we consider that `this.ticks` will NEVER change!
11806
+
11807
+			// BACKWARD COMPAT: synchronize `_ticks` with labels (so potentially `this.ticks`)
11808
+			for (i = 0, ilen = labels.length; i < ilen; ++i) {
11809
+				label = labels[i];
11810
+				tick = ticks[i];
11811
+				if (!tick) {
11812
+					ticks.push(tick = {
11813
+						label: label,
11814
+						major: false
11815
+					});
11816
+				} else {
11817
+					tick.label = label;
11818
+				}
11819
+			}
11820
+
11821
+			me._ticks = ticks;
11822
+
11823
+			// Tick Rotation
11824
+			me.beforeCalculateTickRotation();
11825
+			me.calculateTickRotation();
11826
+			me.afterCalculateTickRotation();
11827
+			// Fit
11828
+			me.beforeFit();
11829
+			me.fit();
11830
+			me.afterFit();
11831
+			//
11832
+			me.afterUpdate();
11833
+
11834
+			return me.minSize;
11835
+
11836
+		},
11837
+		afterUpdate: function() {
11838
+			helpers.callback(this.options.afterUpdate, [this]);
11839
+		},
11840
+
11841
+		//
11842
+
11843
+		beforeSetDimensions: function() {
11844
+			helpers.callback(this.options.beforeSetDimensions, [this]);
11845
+		},
11846
+		setDimensions: function() {
11847
+			var me = this;
11848
+			// Set the unconstrained dimension before label rotation
11849
+			if (me.isHorizontal()) {
11850
+				// Reset position before calculating rotation
11851
+				me.width = me.maxWidth;
11852
+				me.left = 0;
11853
+				me.right = me.width;
11854
+			} else {
11855
+				me.height = me.maxHeight;
11856
+
11857
+				// Reset position before calculating rotation
11858
+				me.top = 0;
11859
+				me.bottom = me.height;
11860
+			}
11861
+
11862
+			// Reset padding
11863
+			me.paddingLeft = 0;
11864
+			me.paddingTop = 0;
11865
+			me.paddingRight = 0;
11866
+			me.paddingBottom = 0;
11867
+		},
11868
+		afterSetDimensions: function() {
11869
+			helpers.callback(this.options.afterSetDimensions, [this]);
11870
+		},
11871
+
11872
+		// Data limits
11873
+		beforeDataLimits: function() {
11874
+			helpers.callback(this.options.beforeDataLimits, [this]);
11875
+		},
11876
+		determineDataLimits: helpers.noop,
11877
+		afterDataLimits: function() {
11878
+			helpers.callback(this.options.afterDataLimits, [this]);
11879
+		},
11880
+
11881
+		//
11882
+		beforeBuildTicks: function() {
11883
+			helpers.callback(this.options.beforeBuildTicks, [this]);
11884
+		},
11885
+		buildTicks: helpers.noop,
11886
+		afterBuildTicks: function() {
11887
+			helpers.callback(this.options.afterBuildTicks, [this]);
11888
+		},
11889
+
11890
+		beforeTickToLabelConversion: function() {
11891
+			helpers.callback(this.options.beforeTickToLabelConversion, [this]);
11892
+		},
11893
+		convertTicksToLabels: function() {
11894
+			var me = this;
11895
+			// Convert ticks to strings
11896
+			var tickOpts = me.options.ticks;
11897
+			me.ticks = me.ticks.map(tickOpts.userCallback || tickOpts.callback, this);
11898
+		},
11899
+		afterTickToLabelConversion: function() {
11900
+			helpers.callback(this.options.afterTickToLabelConversion, [this]);
11901
+		},
11902
+
11903
+		//
11904
+
11905
+		beforeCalculateTickRotation: function() {
11906
+			helpers.callback(this.options.beforeCalculateTickRotation, [this]);
11907
+		},
11908
+		calculateTickRotation: function() {
11909
+			var me = this;
11910
+			var context = me.ctx;
11911
+			var tickOpts = me.options.ticks;
11912
+			var labels = labelsFromTicks(me._ticks);
11913
+
11914
+			// Get the width of each grid by calculating the difference
11915
+			// between x offsets between 0 and 1.
11916
+			var tickFont = parseFontOptions(tickOpts);
11917
+			context.font = tickFont.font;
11918
+
11919
+			var labelRotation = tickOpts.minRotation || 0;
11920
+
11921
+			if (labels.length && me.options.display && me.isHorizontal()) {
11922
+				var originalLabelWidth = helpers.longestText(context, tickFont.font, labels, me.longestTextCache);
11923
+				var labelWidth = originalLabelWidth;
11924
+				var cosRotation, sinRotation;
11925
+
11926
+				// Allow 3 pixels x2 padding either side for label readability
11927
+				var tickWidth = me.getPixelForTick(1) - me.getPixelForTick(0) - 6;
11928
+
11929
+				// Max label rotation can be set or default to 90 - also act as a loop counter
11930
+				while (labelWidth > tickWidth && labelRotation < tickOpts.maxRotation) {
11931
+					var angleRadians = helpers.toRadians(labelRotation);
11932
+					cosRotation = Math.cos(angleRadians);
11933
+					sinRotation = Math.sin(angleRadians);
11934
+
11935
+					if (sinRotation * originalLabelWidth > me.maxHeight) {
11936
+						// go back one step
11937
+						labelRotation--;
11938
+						break;
11939
+					}
11940
+
11941
+					labelRotation++;
11942
+					labelWidth = cosRotation * originalLabelWidth;
11943
+				}
11944
+			}
11945
+
11946
+			me.labelRotation = labelRotation;
11947
+		},
11948
+		afterCalculateTickRotation: function() {
11949
+			helpers.callback(this.options.afterCalculateTickRotation, [this]);
11950
+		},
11951
+
11952
+		//
11953
+
11954
+		beforeFit: function() {
11955
+			helpers.callback(this.options.beforeFit, [this]);
11956
+		},
11957
+		fit: function() {
11958
+			var me = this;
11959
+			// Reset
11960
+			var minSize = me.minSize = {
11961
+				width: 0,
11962
+				height: 0
11963
+			};
11964
+
11965
+			var labels = labelsFromTicks(me._ticks);
11966
+
11967
+			var opts = me.options;
11968
+			var tickOpts = opts.ticks;
11969
+			var scaleLabelOpts = opts.scaleLabel;
11970
+			var gridLineOpts = opts.gridLines;
11971
+			var display = opts.display;
11972
+			var isHorizontal = me.isHorizontal();
11973
+
11974
+			var tickFont = parseFontOptions(tickOpts);
11975
+			var tickMarkLength = opts.gridLines.tickMarkLength;
11976
+
11977
+			// Width
11978
+			if (isHorizontal) {
11979
+				// subtract the margins to line up with the chartArea if we are a full width scale
11980
+				minSize.width = me.isFullWidth() ? me.maxWidth - me.margins.left - me.margins.right : me.maxWidth;
11981
+			} else {
11982
+				minSize.width = display && gridLineOpts.drawTicks ? tickMarkLength : 0;
11983
+			}
11984
+
11985
+			// height
11986
+			if (isHorizontal) {
11987
+				minSize.height = display && gridLineOpts.drawTicks ? tickMarkLength : 0;
11988
+			} else {
11989
+				minSize.height = me.maxHeight; // fill all the height
11990
+			}
11991
+
11992
+			// Are we showing a title for the scale?
11993
+			if (scaleLabelOpts.display && display) {
11994
+				var scaleLabelLineHeight = parseLineHeight(scaleLabelOpts);
11995
+				var scaleLabelPadding = helpers.options.toPadding(scaleLabelOpts.padding);
11996
+				var deltaHeight = scaleLabelLineHeight + scaleLabelPadding.height;
11997
+
11998
+				if (isHorizontal) {
11999
+					minSize.height += deltaHeight;
12000
+				} else {
12001
+					minSize.width += deltaHeight;
12002
+				}
12003
+			}
12004
+
12005
+			// Don't bother fitting the ticks if we are not showing them
12006
+			if (tickOpts.display && display) {
12007
+				var largestTextWidth = helpers.longestText(me.ctx, tickFont.font, labels, me.longestTextCache);
12008
+				var tallestLabelHeightInLines = helpers.numberOfLabelLines(labels);
12009
+				var lineSpace = tickFont.size * 0.5;
12010
+				var tickPadding = me.options.ticks.padding;
12011
+
12012
+				if (isHorizontal) {
12013
+					// A horizontal axis is more constrained by the height.
12014
+					me.longestLabelWidth = largestTextWidth;
12015
+
12016
+					var angleRadians = helpers.toRadians(me.labelRotation);
12017
+					var cosRotation = Math.cos(angleRadians);
12018
+					var sinRotation = Math.sin(angleRadians);
12019
+
12020
+					// TODO - improve this calculation
12021
+					var labelHeight = (sinRotation * largestTextWidth)
12022
+						+ (tickFont.size * tallestLabelHeightInLines)
12023
+						+ (lineSpace * (tallestLabelHeightInLines - 1))
12024
+						+ lineSpace; // padding
12025
+
12026
+					minSize.height = Math.min(me.maxHeight, minSize.height + labelHeight + tickPadding);
12027
+
12028
+					me.ctx.font = tickFont.font;
12029
+					var firstLabelWidth = computeTextSize(me.ctx, labels[0], tickFont.font);
12030
+					var lastLabelWidth = computeTextSize(me.ctx, labels[labels.length - 1], tickFont.font);
12031
+
12032
+					// Ensure that our ticks are always inside the canvas. When rotated, ticks are right aligned
12033
+					// which means that the right padding is dominated by the font height
12034
+					if (me.labelRotation !== 0) {
12035
+						me.paddingLeft = opts.position === 'bottom' ? (cosRotation * firstLabelWidth) + 3 : (cosRotation * lineSpace) + 3; // add 3 px to move away from canvas edges
12036
+						me.paddingRight = opts.position === 'bottom' ? (cosRotation * lineSpace) + 3 : (cosRotation * lastLabelWidth) + 3;
12037
+					} else {
12038
+						me.paddingLeft = firstLabelWidth / 2 + 3; // add 3 px to move away from canvas edges
12039
+						me.paddingRight = lastLabelWidth / 2 + 3;
12040
+					}
12041
+				} else {
12042
+					// A vertical axis is more constrained by the width. Labels are the
12043
+					// dominant factor here, so get that length first and account for padding
12044
+					if (tickOpts.mirror) {
12045
+						largestTextWidth = 0;
12046
+					} else {
12047
+						// use lineSpace for consistency with horizontal axis
12048
+						// tickPadding is not implemented for horizontal
12049
+						largestTextWidth += tickPadding + lineSpace;
12050
+					}
12051
+
12052
+					minSize.width = Math.min(me.maxWidth, minSize.width + largestTextWidth);
12053
+
12054
+					me.paddingTop = tickFont.size / 2;
12055
+					me.paddingBottom = tickFont.size / 2;
12056
+				}
12057
+			}
12058
+
12059
+			me.handleMargins();
12060
+
12061
+			me.width = minSize.width;
12062
+			me.height = minSize.height;
12063
+		},
12064
+
12065
+		/**
12066
+		 * Handle margins and padding interactions
12067
+		 * @private
12068
+		 */
12069
+		handleMargins: function() {
12070
+			var me = this;
12071
+			if (me.margins) {
12072
+				me.paddingLeft = Math.max(me.paddingLeft - me.margins.left, 0);
12073
+				me.paddingTop = Math.max(me.paddingTop - me.margins.top, 0);
12074
+				me.paddingRight = Math.max(me.paddingRight - me.margins.right, 0);
12075
+				me.paddingBottom = Math.max(me.paddingBottom - me.margins.bottom, 0);
12076
+			}
12077
+		},
12078
+
12079
+		afterFit: function() {
12080
+			helpers.callback(this.options.afterFit, [this]);
12081
+		},
12082
+
12083
+		// Shared Methods
12084
+		isHorizontal: function() {
12085
+			return this.options.position === 'top' || this.options.position === 'bottom';
12086
+		},
12087
+		isFullWidth: function() {
12088
+			return (this.options.fullWidth);
12089
+		},
12090
+
12091
+		// Get the correct value. NaN bad inputs, If the value type is object get the x or y based on whether we are horizontal or not
12092
+		getRightValue: function(rawValue) {
12093
+			// Null and undefined values first
12094
+			if (helpers.isNullOrUndef(rawValue)) {
12095
+				return NaN;
12096
+			}
12097
+			// isNaN(object) returns true, so make sure NaN is checking for a number; Discard Infinite values
12098
+			if (typeof rawValue === 'number' && !isFinite(rawValue)) {
12099
+				return NaN;
12100
+			}
12101
+			// If it is in fact an object, dive in one more level
12102
+			if (rawValue) {
12103
+				if (this.isHorizontal()) {
12104
+					if (rawValue.x !== undefined) {
12105
+						return this.getRightValue(rawValue.x);
12106
+					}
12107
+				} else if (rawValue.y !== undefined) {
12108
+					return this.getRightValue(rawValue.y);
12109
+				}
12110
+			}
12111
+
12112
+			// Value is good, return it
12113
+			return rawValue;
12114
+		},
12115
+
12116
+		/**
12117
+		 * Used to get the value to display in the tooltip for the data at the given index
12118
+		 * @param index
12119
+		 * @param datasetIndex
12120
+		 */
12121
+		getLabelForIndex: helpers.noop,
12122
+
12123
+		/**
12124
+		 * Returns the location of the given data point. Value can either be an index or a numerical value
12125
+		 * The coordinate (0, 0) is at the upper-left corner of the canvas
12126
+		 * @param value
12127
+		 * @param index
12128
+		 * @param datasetIndex
12129
+		 */
12130
+		getPixelForValue: helpers.noop,
12131
+
12132
+		/**
12133
+		 * Used to get the data value from a given pixel. This is the inverse of getPixelForValue
12134
+		 * The coordinate (0, 0) is at the upper-left corner of the canvas
12135
+		 * @param pixel
12136
+		 */
12137
+		getValueForPixel: helpers.noop,
12138
+
12139
+		/**
12140
+		 * Returns the location of the tick at the given index
12141
+		 * The coordinate (0, 0) is at the upper-left corner of the canvas
12142
+		 */
12143
+		getPixelForTick: function(index) {
12144
+			var me = this;
12145
+			var offset = me.options.offset;
12146
+			if (me.isHorizontal()) {
12147
+				var innerWidth = me.width - (me.paddingLeft + me.paddingRight);
12148
+				var tickWidth = innerWidth / Math.max((me._ticks.length - (offset ? 0 : 1)), 1);
12149
+				var pixel = (tickWidth * index) + me.paddingLeft;
12150
+
12151
+				if (offset) {
12152
+					pixel += tickWidth / 2;
12153
+				}
12154
+
12155
+				var finalVal = me.left + Math.round(pixel);
12156
+				finalVal += me.isFullWidth() ? me.margins.left : 0;
12157
+				return finalVal;
12158
+			}
12159
+			var innerHeight = me.height - (me.paddingTop + me.paddingBottom);
12160
+			return me.top + (index * (innerHeight / (me._ticks.length - 1)));
12161
+		},
12162
+
12163
+		/**
12164
+		 * Utility for getting the pixel location of a percentage of scale
12165
+		 * The coordinate (0, 0) is at the upper-left corner of the canvas
12166
+		 */
12167
+		getPixelForDecimal: function(decimal) {
12168
+			var me = this;
12169
+			if (me.isHorizontal()) {
12170
+				var innerWidth = me.width - (me.paddingLeft + me.paddingRight);
12171
+				var valueOffset = (innerWidth * decimal) + me.paddingLeft;
12172
+
12173
+				var finalVal = me.left + Math.round(valueOffset);
12174
+				finalVal += me.isFullWidth() ? me.margins.left : 0;
12175
+				return finalVal;
12176
+			}
12177
+			return me.top + (decimal * me.height);
12178
+		},
12179
+
12180
+		/**
12181
+		 * Returns the pixel for the minimum chart value
12182
+		 * The coordinate (0, 0) is at the upper-left corner of the canvas
12183
+		 */
12184
+		getBasePixel: function() {
12185
+			return this.getPixelForValue(this.getBaseValue());
12186
+		},
12187
+
12188
+		getBaseValue: function() {
12189
+			var me = this;
12190
+			var min = me.min;
12191
+			var max = me.max;
12192
+
12193
+			return me.beginAtZero ? 0 :
12194
+				min < 0 && max < 0 ? max :
12195
+				min > 0 && max > 0 ? min :
12196
+				0;
12197
+		},
12198
+
12199
+		/**
12200
+		 * Returns a subset of ticks to be plotted to avoid overlapping labels.
12201
+		 * @private
12202
+		 */
12203
+		_autoSkip: function(ticks) {
12204
+			var skipRatio;
12205
+			var me = this;
12206
+			var isHorizontal = me.isHorizontal();
12207
+			var optionTicks = me.options.ticks.minor;
12208
+			var tickCount = ticks.length;
12209
+			var labelRotationRadians = helpers.toRadians(me.labelRotation);
12210
+			var cosRotation = Math.cos(labelRotationRadians);
12211
+			var longestRotatedLabel = me.longestLabelWidth * cosRotation;
12212
+			var result = [];
12213
+			var i, tick, shouldSkip;
12214
+
12215
+			// figure out the maximum number of gridlines to show
12216
+			var maxTicks;
12217
+			if (optionTicks.maxTicksLimit) {
12218
+				maxTicks = optionTicks.maxTicksLimit;
12219
+			}
12220
+
12221
+			if (isHorizontal) {
12222
+				skipRatio = false;
12223
+
12224
+				if ((longestRotatedLabel + optionTicks.autoSkipPadding) * tickCount > (me.width - (me.paddingLeft + me.paddingRight))) {
12225
+					skipRatio = 1 + Math.floor(((longestRotatedLabel + optionTicks.autoSkipPadding) * tickCount) / (me.width - (me.paddingLeft + me.paddingRight)));
12226
+				}
12227
+
12228
+				// if they defined a max number of optionTicks,
12229
+				// increase skipRatio until that number is met
12230
+				if (maxTicks && tickCount > maxTicks) {
12231
+					skipRatio = Math.max(skipRatio, Math.floor(tickCount / maxTicks));
12232
+				}
12233
+			}
12234
+
12235
+			for (i = 0; i < tickCount; i++) {
12236
+				tick = ticks[i];
12237
+
12238
+				// Since we always show the last tick,we need may need to hide the last shown one before
12239
+				shouldSkip = (skipRatio > 1 && i % skipRatio > 0) || (i % skipRatio === 0 && i + skipRatio >= tickCount);
12240
+				if (shouldSkip && i !== tickCount - 1) {
12241
+					// leave tick in place but make sure it's not displayed (#4635)
12242
+					delete tick.label;
12243
+				}
12244
+				result.push(tick);
12245
+			}
12246
+			return result;
12247
+		},
12248
+
12249
+		// Actually draw the scale on the canvas
12250
+		// @param {rectangle} chartArea : the area of the chart to draw full grid lines on
12251
+		draw: function(chartArea) {
12252
+			var me = this;
12253
+			var options = me.options;
12254
+			if (!options.display) {
12255
+				return;
12256
+			}
12257
+
12258
+			var context = me.ctx;
12259
+			var globalDefaults = defaults.global;
12260
+			var optionTicks = options.ticks.minor;
12261
+			var optionMajorTicks = options.ticks.major || optionTicks;
12262
+			var gridLines = options.gridLines;
12263
+			var scaleLabel = options.scaleLabel;
12264
+
12265
+			var isRotated = me.labelRotation !== 0;
12266
+			var isHorizontal = me.isHorizontal();
12267
+
12268
+			var ticks = optionTicks.autoSkip ? me._autoSkip(me.getTicks()) : me.getTicks();
12269
+			var tickFontColor = helpers.valueOrDefault(optionTicks.fontColor, globalDefaults.defaultFontColor);
12270
+			var tickFont = parseFontOptions(optionTicks);
12271
+			var majorTickFontColor = helpers.valueOrDefault(optionMajorTicks.fontColor, globalDefaults.defaultFontColor);
12272
+			var majorTickFont = parseFontOptions(optionMajorTicks);
12273
+
12274
+			var tl = gridLines.drawTicks ? gridLines.tickMarkLength : 0;
12275
+
12276
+			var scaleLabelFontColor = helpers.valueOrDefault(scaleLabel.fontColor, globalDefaults.defaultFontColor);
12277
+			var scaleLabelFont = parseFontOptions(scaleLabel);
12278
+			var scaleLabelPadding = helpers.options.toPadding(scaleLabel.padding);
12279
+			var labelRotationRadians = helpers.toRadians(me.labelRotation);
12280
+
12281
+			var itemsToDraw = [];
12282
+
12283
+			var axisWidth = me.options.gridLines.lineWidth;
12284
+			var xTickStart = options.position === 'right' ? me.right : me.right - axisWidth - tl;
12285
+			var xTickEnd = options.position === 'right' ? me.right + tl : me.right;
12286
+			var yTickStart = options.position === 'bottom' ? me.top + axisWidth : me.bottom - tl - axisWidth;
12287
+			var yTickEnd = options.position === 'bottom' ? me.top + axisWidth + tl : me.bottom + axisWidth;
12288
+
12289
+			helpers.each(ticks, function(tick, index) {
12290
+				// autoskipper skipped this tick (#4635)
12291
+				if (helpers.isNullOrUndef(tick.label)) {
12292
+					return;
12293
+				}
12294
+
12295
+				var label = tick.label;
12296
+				var lineWidth, lineColor, borderDash, borderDashOffset;
12297
+				if (index === me.zeroLineIndex && options.offset === gridLines.offsetGridLines) {
12298
+					// Draw the first index specially
12299
+					lineWidth = gridLines.zeroLineWidth;
12300
+					lineColor = gridLines.zeroLineColor;
12301
+					borderDash = gridLines.zeroLineBorderDash;
12302
+					borderDashOffset = gridLines.zeroLineBorderDashOffset;
12303
+				} else {
12304
+					lineWidth = helpers.valueAtIndexOrDefault(gridLines.lineWidth, index);
12305
+					lineColor = helpers.valueAtIndexOrDefault(gridLines.color, index);
12306
+					borderDash = helpers.valueOrDefault(gridLines.borderDash, globalDefaults.borderDash);
12307
+					borderDashOffset = helpers.valueOrDefault(gridLines.borderDashOffset, globalDefaults.borderDashOffset);
12308
+				}
12309
+
12310
+				// Common properties
12311
+				var tx1, ty1, tx2, ty2, x1, y1, x2, y2, labelX, labelY;
12312
+				var textAlign = 'middle';
12313
+				var textBaseline = 'middle';
12314
+				var tickPadding = optionTicks.padding;
12315
+
12316
+				if (isHorizontal) {
12317
+					var labelYOffset = tl + tickPadding;
12318
+
12319
+					if (options.position === 'bottom') {
12320
+						// bottom
12321
+						textBaseline = !isRotated ? 'top' : 'middle';
12322
+						textAlign = !isRotated ? 'center' : 'right';
12323
+						labelY = me.top + labelYOffset;
12324
+					} else {
12325
+						// top
12326
+						textBaseline = !isRotated ? 'bottom' : 'middle';
12327
+						textAlign = !isRotated ? 'center' : 'left';
12328
+						labelY = me.bottom - labelYOffset;
12329
+					}
12330
+
12331
+					var xLineValue = getLineValue(me, index, gridLines.offsetGridLines && ticks.length > 1);
12332
+					if (xLineValue < me.left) {
12333
+						lineColor = 'rgba(0,0,0,0)';
12334
+					}
12335
+					xLineValue += helpers.aliasPixel(lineWidth);
12336
+
12337
+					labelX = me.getPixelForTick(index) + optionTicks.labelOffset; // x values for optionTicks (need to consider offsetLabel option)
12338
+
12339
+					tx1 = tx2 = x1 = x2 = xLineValue;
12340
+					ty1 = yTickStart;
12341
+					ty2 = yTickEnd;
12342
+					y1 = chartArea.top;
12343
+					y2 = chartArea.bottom + axisWidth;
12344
+				} else {
12345
+					var isLeft = options.position === 'left';
12346
+					var labelXOffset;
12347
+
12348
+					if (optionTicks.mirror) {
12349
+						textAlign = isLeft ? 'left' : 'right';
12350
+						labelXOffset = tickPadding;
12351
+					} else {
12352
+						textAlign = isLeft ? 'right' : 'left';
12353
+						labelXOffset = tl + tickPadding;
12354
+					}
12355
+
12356
+					labelX = isLeft ? me.right - labelXOffset : me.left + labelXOffset;
12357
+
12358
+					var yLineValue = getLineValue(me, index, gridLines.offsetGridLines && ticks.length > 1);
12359
+					if (yLineValue < me.top) {
12360
+						lineColor = 'rgba(0,0,0,0)';
12361
+					}
12362
+					yLineValue += helpers.aliasPixel(lineWidth);
12363
+
12364
+					labelY = me.getPixelForTick(index) + optionTicks.labelOffset;
12365
+
12366
+					tx1 = xTickStart;
12367
+					tx2 = xTickEnd;
12368
+					x1 = chartArea.left;
12369
+					x2 = chartArea.right + axisWidth;
12370
+					ty1 = ty2 = y1 = y2 = yLineValue;
12371
+				}
12372
+
12373
+				itemsToDraw.push({
12374
+					tx1: tx1,
12375
+					ty1: ty1,
12376
+					tx2: tx2,
12377
+					ty2: ty2,
12378
+					x1: x1,
12379
+					y1: y1,
12380
+					x2: x2,
12381
+					y2: y2,
12382
+					labelX: labelX,
12383
+					labelY: labelY,
12384
+					glWidth: lineWidth,
12385
+					glColor: lineColor,
12386
+					glBorderDash: borderDash,
12387
+					glBorderDashOffset: borderDashOffset,
12388
+					rotation: -1 * labelRotationRadians,
12389
+					label: label,
12390
+					major: tick.major,
12391
+					textBaseline: textBaseline,
12392
+					textAlign: textAlign
12393
+				});
12394
+			});
12395
+
12396
+			// Draw all of the tick labels, tick marks, and grid lines at the correct places
12397
+			helpers.each(itemsToDraw, function(itemToDraw) {
12398
+				if (gridLines.display) {
12399
+					context.save();
12400
+					context.lineWidth = itemToDraw.glWidth;
12401
+					context.strokeStyle = itemToDraw.glColor;
12402
+					if (context.setLineDash) {
12403
+						context.setLineDash(itemToDraw.glBorderDash);
12404
+						context.lineDashOffset = itemToDraw.glBorderDashOffset;
12405
+					}
12406
+
12407
+					context.beginPath();
12408
+
12409
+					if (gridLines.drawTicks) {
12410
+						context.moveTo(itemToDraw.tx1, itemToDraw.ty1);
12411
+						context.lineTo(itemToDraw.tx2, itemToDraw.ty2);
12412
+					}
12413
+
12414
+					if (gridLines.drawOnChartArea) {
12415
+						context.moveTo(itemToDraw.x1, itemToDraw.y1);
12416
+						context.lineTo(itemToDraw.x2, itemToDraw.y2);
12417
+					}
12418
+
12419
+					context.stroke();
12420
+					context.restore();
12421
+				}
12422
+
12423
+				if (optionTicks.display) {
12424
+					// Make sure we draw text in the correct color and font
12425
+					context.save();
12426
+					context.translate(itemToDraw.labelX, itemToDraw.labelY);
12427
+					context.rotate(itemToDraw.rotation);
12428
+					context.font = itemToDraw.major ? majorTickFont.font : tickFont.font;
12429
+					context.fillStyle = itemToDraw.major ? majorTickFontColor : tickFontColor;
12430
+					context.textBaseline = itemToDraw.textBaseline;
12431
+					context.textAlign = itemToDraw.textAlign;
12432
+
12433
+					var label = itemToDraw.label;
12434
+					if (helpers.isArray(label)) {
12435
+						var lineCount = label.length;
12436
+						var lineHeight = tickFont.size * 1.5;
12437
+						var y = me.isHorizontal() ? 0 : -lineHeight * (lineCount - 1) / 2;
12438
+
12439
+						for (var i = 0; i < lineCount; ++i) {
12440
+							// We just make sure the multiline element is a string here..
12441
+							context.fillText('' + label[i], 0, y);
12442
+							// apply same lineSpacing as calculated @ L#320
12443
+							y += lineHeight;
12444
+						}
12445
+					} else {
12446
+						context.fillText(label, 0, 0);
12447
+					}
12448
+					context.restore();
12449
+				}
12450
+			});
12451
+
12452
+			if (scaleLabel.display) {
12453
+				// Draw the scale label
12454
+				var scaleLabelX;
12455
+				var scaleLabelY;
12456
+				var rotation = 0;
12457
+				var halfLineHeight = parseLineHeight(scaleLabel) / 2;
12458
+
12459
+				if (isHorizontal) {
12460
+					scaleLabelX = me.left + ((me.right - me.left) / 2); // midpoint of the width
12461
+					scaleLabelY = options.position === 'bottom'
12462
+						? me.bottom - halfLineHeight - scaleLabelPadding.bottom
12463
+						: me.top + halfLineHeight + scaleLabelPadding.top;
12464
+				} else {
12465
+					var isLeft = options.position === 'left';
12466
+					scaleLabelX = isLeft
12467
+						? me.left + halfLineHeight + scaleLabelPadding.top
12468
+						: me.right - halfLineHeight - scaleLabelPadding.top;
12469
+					scaleLabelY = me.top + ((me.bottom - me.top) / 2);
12470
+					rotation = isLeft ? -0.5 * Math.PI : 0.5 * Math.PI;
12471
+				}
12472
+
12473
+				context.save();
12474
+				context.translate(scaleLabelX, scaleLabelY);
12475
+				context.rotate(rotation);
12476
+				context.textAlign = 'center';
12477
+				context.textBaseline = 'middle';
12478
+				context.fillStyle = scaleLabelFontColor; // render in correct colour
12479
+				context.font = scaleLabelFont.font;
12480
+				context.fillText(scaleLabel.labelString, 0, 0);
12481
+				context.restore();
12482
+			}
12483
+
12484
+			if (gridLines.drawBorder) {
12485
+				// Draw the line at the edge of the axis
12486
+				context.lineWidth = helpers.valueAtIndexOrDefault(gridLines.lineWidth, 0);
12487
+				context.strokeStyle = helpers.valueAtIndexOrDefault(gridLines.color, 0);
12488
+				var x1 = me.left;
12489
+				var x2 = me.right + axisWidth;
12490
+				var y1 = me.top;
12491
+				var y2 = me.bottom + axisWidth;
12492
+
12493
+				var aliasPixel = helpers.aliasPixel(context.lineWidth);
12494
+				if (isHorizontal) {
12495
+					y1 = y2 = options.position === 'top' ? me.bottom : me.top;
12496
+					y1 += aliasPixel;
12497
+					y2 += aliasPixel;
12498
+				} else {
12499
+					x1 = x2 = options.position === 'left' ? me.right : me.left;
12500
+					x1 += aliasPixel;
12501
+					x2 += aliasPixel;
12502
+				}
12503
+
12504
+				context.beginPath();
12505
+				context.moveTo(x1, y1);
12506
+				context.lineTo(x2, y2);
12507
+				context.stroke();
12508
+			}
12509
+		}
12510
+	});
12511
+};
12512
+
12513
+},{"25":25,"26":26,"34":34,"45":45}],33:[function(require,module,exports){
12514
+'use strict';
12515
+
12516
+var defaults = require(25);
12517
+var helpers = require(45);
12518
+var layouts = require(30);
12519
+
12520
+module.exports = function(Chart) {
12521
+
12522
+	Chart.scaleService = {
12523
+		// Scale registration object. Extensions can register new scale types (such as log or DB scales) and then
12524
+		// use the new chart options to grab the correct scale
12525
+		constructors: {},
12526
+		// Use a registration function so that we can move to an ES6 map when we no longer need to support
12527
+		// old browsers
12528
+
12529
+		// Scale config defaults
12530
+		defaults: {},
12531
+		registerScaleType: function(type, scaleConstructor, scaleDefaults) {
12532
+			this.constructors[type] = scaleConstructor;
12533
+			this.defaults[type] = helpers.clone(scaleDefaults);
12534
+		},
12535
+		getScaleConstructor: function(type) {
12536
+			return this.constructors.hasOwnProperty(type) ? this.constructors[type] : undefined;
12537
+		},
12538
+		getScaleDefaults: function(type) {
12539
+			// Return the scale defaults merged with the global settings so that we always use the latest ones
12540
+			return this.defaults.hasOwnProperty(type) ? helpers.merge({}, [defaults.scale, this.defaults[type]]) : {};
12541
+		},
12542
+		updateScaleDefaults: function(type, additions) {
12543
+			var me = this;
12544
+			if (me.defaults.hasOwnProperty(type)) {
12545
+				me.defaults[type] = helpers.extend(me.defaults[type], additions);
12546
+			}
12547
+		},
12548
+		addScalesToLayout: function(chart) {
12549
+			// Adds each scale to the chart.boxes array to be sized accordingly
12550
+			helpers.each(chart.scales, function(scale) {
12551
+				// Set ILayoutItem parameters for backwards compatibility
12552
+				scale.fullWidth = scale.options.fullWidth;
12553
+				scale.position = scale.options.position;
12554
+				scale.weight = scale.options.weight;
12555
+				layouts.addBox(chart, scale);
12556
+			});
12557
+		}
12558
+	};
12559
+};
12560
+
12561
+},{"25":25,"30":30,"45":45}],34:[function(require,module,exports){
12562
+'use strict';
12563
+
12564
+var helpers = require(45);
12565
+
12566
+/**
12567
+ * Namespace to hold static tick generation functions
12568
+ * @namespace Chart.Ticks
12569
+ */
12570
+module.exports = {
12571
+	/**
12572
+	 * Namespace to hold formatters for different types of ticks
12573
+	 * @namespace Chart.Ticks.formatters
12574
+	 */
12575
+	formatters: {
12576
+		/**
12577
+		 * Formatter for value labels
12578
+		 * @method Chart.Ticks.formatters.values
12579
+		 * @param value the value to display
12580
+		 * @return {String|Array} the label to display
12581
+		 */
12582
+		values: function(value) {
12583
+			return helpers.isArray(value) ? value : '' + value;
12584
+		},
12585
+
12586
+		/**
12587
+		 * Formatter for linear numeric ticks
12588
+		 * @method Chart.Ticks.formatters.linear
12589
+		 * @param tickValue {Number} the value to be formatted
12590
+		 * @param index {Number} the position of the tickValue parameter in the ticks array
12591
+		 * @param ticks {Array<Number>} the list of ticks being converted
12592
+		 * @return {String} string representation of the tickValue parameter
12593
+		 */
12594
+		linear: function(tickValue, index, ticks) {
12595
+			// If we have lots of ticks, don't use the ones
12596
+			var delta = ticks.length > 3 ? ticks[2] - ticks[1] : ticks[1] - ticks[0];
12597
+
12598
+			// If we have a number like 2.5 as the delta, figure out how many decimal places we need
12599
+			if (Math.abs(delta) > 1) {
12600
+				if (tickValue !== Math.floor(tickValue)) {
12601
+					// not an integer
12602
+					delta = tickValue - Math.floor(tickValue);
12603
+				}
12604
+			}
12605
+
12606
+			var logDelta = helpers.log10(Math.abs(delta));
12607
+			var tickString = '';
12608
+
12609
+			if (tickValue !== 0) {
12610
+				var numDecimal = -1 * Math.floor(logDelta);
12611
+				numDecimal = Math.max(Math.min(numDecimal, 20), 0); // toFixed has a max of 20 decimal places
12612
+				tickString = tickValue.toFixed(numDecimal);
12613
+			} else {
12614
+				tickString = '0'; // never show decimal places for 0
12615
+			}
12616
+
12617
+			return tickString;
12618
+		},
12619
+
12620
+		logarithmic: function(tickValue, index, ticks) {
12621
+			var remain = tickValue / (Math.pow(10, Math.floor(helpers.log10(tickValue))));
12622
+
12623
+			if (tickValue === 0) {
12624
+				return '0';
12625
+			} else if (remain === 1 || remain === 2 || remain === 5 || index === 0 || index === ticks.length - 1) {
12626
+				return tickValue.toExponential();
12627
+			}
12628
+			return '';
12629
+		}
12630
+	}
12631
+};
12632
+
12633
+},{"45":45}],35:[function(require,module,exports){
12634
+'use strict';
12635
+
12636
+var defaults = require(25);
12637
+var Element = require(26);
12638
+var helpers = require(45);
12639
+
12640
+defaults._set('global', {
12641
+	tooltips: {
12642
+		enabled: true,
12643
+		custom: null,
12644
+		mode: 'nearest',
12645
+		position: 'average',
12646
+		intersect: true,
12647
+		backgroundColor: 'rgba(0,0,0,0.8)',
12648
+		titleFontStyle: 'bold',
12649
+		titleSpacing: 2,
12650
+		titleMarginBottom: 6,
12651
+		titleFontColor: '#fff',
12652
+		titleAlign: 'left',
12653
+		bodySpacing: 2,
12654
+		bodyFontColor: '#fff',
12655
+		bodyAlign: 'left',
12656
+		footerFontStyle: 'bold',
12657
+		footerSpacing: 2,
12658
+		footerMarginTop: 6,
12659
+		footerFontColor: '#fff',
12660
+		footerAlign: 'left',
12661
+		yPadding: 6,
12662
+		xPadding: 6,
12663
+		caretPadding: 2,
12664
+		caretSize: 5,
12665
+		cornerRadius: 6,
12666
+		multiKeyBackground: '#fff',
12667
+		displayColors: true,
12668
+		borderColor: 'rgba(0,0,0,0)',
12669
+		borderWidth: 0,
12670
+		callbacks: {
12671
+			// Args are: (tooltipItems, data)
12672
+			beforeTitle: helpers.noop,
12673
+			title: function(tooltipItems, data) {
12674
+				// Pick first xLabel for now
12675
+				var title = '';
12676
+				var labels = data.labels;
12677
+				var labelCount = labels ? labels.length : 0;
12678
+
12679
+				if (tooltipItems.length > 0) {
12680
+					var item = tooltipItems[0];
12681
+
12682
+					if (item.xLabel) {
12683
+						title = item.xLabel;
12684
+					} else if (labelCount > 0 && item.index < labelCount) {
12685
+						title = labels[item.index];
12686
+					}
12687
+				}
12688
+
12689
+				return title;
12690
+			},
12691
+			afterTitle: helpers.noop,
12692
+
12693
+			// Args are: (tooltipItems, data)
12694
+			beforeBody: helpers.noop,
12695
+
12696
+			// Args are: (tooltipItem, data)
12697
+			beforeLabel: helpers.noop,
12698
+			label: function(tooltipItem, data) {
12699
+				var label = data.datasets[tooltipItem.datasetIndex].label || '';
12700
+
12701
+				if (label) {
12702
+					label += ': ';
12703
+				}
12704
+				label += tooltipItem.yLabel;
12705
+				return label;
12706
+			},
12707
+			labelColor: function(tooltipItem, chart) {
12708
+				var meta = chart.getDatasetMeta(tooltipItem.datasetIndex);
12709
+				var activeElement = meta.data[tooltipItem.index];
12710
+				var view = activeElement._view;
12711
+				return {
12712
+					borderColor: view.borderColor,
12713
+					backgroundColor: view.backgroundColor
12714
+				};
12715
+			},
12716
+			labelTextColor: function() {
12717
+				return this._options.bodyFontColor;
12718
+			},
12719
+			afterLabel: helpers.noop,
12720
+
12721
+			// Args are: (tooltipItems, data)
12722
+			afterBody: helpers.noop,
12723
+
12724
+			// Args are: (tooltipItems, data)
12725
+			beforeFooter: helpers.noop,
12726
+			footer: helpers.noop,
12727
+			afterFooter: helpers.noop
12728
+		}
12729
+	}
12730
+});
12731
+
12732
+module.exports = function(Chart) {
12733
+
12734
+	/**
12735
+ 	 * Helper method to merge the opacity into a color
12736
+ 	 */
12737
+	function mergeOpacity(colorString, opacity) {
12738
+		var color = helpers.color(colorString);
12739
+		return color.alpha(opacity * color.alpha()).rgbaString();
12740
+	}
12741
+
12742
+	// Helper to push or concat based on if the 2nd parameter is an array or not
12743
+	function pushOrConcat(base, toPush) {
12744
+		if (toPush) {
12745
+			if (helpers.isArray(toPush)) {
12746
+				// base = base.concat(toPush);
12747
+				Array.prototype.push.apply(base, toPush);
12748
+			} else {
12749
+				base.push(toPush);
12750
+			}
12751
+		}
12752
+
12753
+		return base;
12754
+	}
12755
+
12756
+	// Private helper to create a tooltip item model
12757
+	// @param element : the chart element (point, arc, bar) to create the tooltip item for
12758
+	// @return : new tooltip item
12759
+	function createTooltipItem(element) {
12760
+		var xScale = element._xScale;
12761
+		var yScale = element._yScale || element._scale; // handle radar || polarArea charts
12762
+		var index = element._index;
12763
+		var datasetIndex = element._datasetIndex;
12764
+
12765
+		return {
12766
+			xLabel: xScale ? xScale.getLabelForIndex(index, datasetIndex) : '',
12767
+			yLabel: yScale ? yScale.getLabelForIndex(index, datasetIndex) : '',
12768
+			index: index,
12769
+			datasetIndex: datasetIndex,
12770
+			x: element._model.x,
12771
+			y: element._model.y
12772
+		};
12773
+	}
12774
+
12775
+	/**
12776
+	 * Helper to get the reset model for the tooltip
12777
+	 * @param tooltipOpts {Object} the tooltip options
12778
+	 */
12779
+	function getBaseModel(tooltipOpts) {
12780
+		var globalDefaults = defaults.global;
12781
+		var valueOrDefault = helpers.valueOrDefault;
12782
+
12783
+		return {
12784
+			// Positioning
12785
+			xPadding: tooltipOpts.xPadding,
12786
+			yPadding: tooltipOpts.yPadding,
12787
+			xAlign: tooltipOpts.xAlign,
12788
+			yAlign: tooltipOpts.yAlign,
12789
+
12790
+			// Body
12791
+			bodyFontColor: tooltipOpts.bodyFontColor,
12792
+			_bodyFontFamily: valueOrDefault(tooltipOpts.bodyFontFamily, globalDefaults.defaultFontFamily),
12793
+			_bodyFontStyle: valueOrDefault(tooltipOpts.bodyFontStyle, globalDefaults.defaultFontStyle),
12794
+			_bodyAlign: tooltipOpts.bodyAlign,
12795
+			bodyFontSize: valueOrDefault(tooltipOpts.bodyFontSize, globalDefaults.defaultFontSize),
12796
+			bodySpacing: tooltipOpts.bodySpacing,
12797
+
12798
+			// Title
12799
+			titleFontColor: tooltipOpts.titleFontColor,
12800
+			_titleFontFamily: valueOrDefault(tooltipOpts.titleFontFamily, globalDefaults.defaultFontFamily),
12801
+			_titleFontStyle: valueOrDefault(tooltipOpts.titleFontStyle, globalDefaults.defaultFontStyle),
12802
+			titleFontSize: valueOrDefault(tooltipOpts.titleFontSize, globalDefaults.defaultFontSize),
12803
+			_titleAlign: tooltipOpts.titleAlign,
12804
+			titleSpacing: tooltipOpts.titleSpacing,
12805
+			titleMarginBottom: tooltipOpts.titleMarginBottom,
12806
+
12807
+			// Footer
12808
+			footerFontColor: tooltipOpts.footerFontColor,
12809
+			_footerFontFamily: valueOrDefault(tooltipOpts.footerFontFamily, globalDefaults.defaultFontFamily),
12810
+			_footerFontStyle: valueOrDefault(tooltipOpts.footerFontStyle, globalDefaults.defaultFontStyle),
12811
+			footerFontSize: valueOrDefault(tooltipOpts.footerFontSize, globalDefaults.defaultFontSize),
12812
+			_footerAlign: tooltipOpts.footerAlign,
12813
+			footerSpacing: tooltipOpts.footerSpacing,
12814
+			footerMarginTop: tooltipOpts.footerMarginTop,
12815
+
12816
+			// Appearance
12817
+			caretSize: tooltipOpts.caretSize,
12818
+			cornerRadius: tooltipOpts.cornerRadius,
12819
+			backgroundColor: tooltipOpts.backgroundColor,
12820
+			opacity: 0,
12821
+			legendColorBackground: tooltipOpts.multiKeyBackground,
12822
+			displayColors: tooltipOpts.displayColors,
12823
+			borderColor: tooltipOpts.borderColor,
12824
+			borderWidth: tooltipOpts.borderWidth
12825
+		};
12826
+	}
12827
+
12828
+	/**
12829
+	 * Get the size of the tooltip
12830
+	 */
12831
+	function getTooltipSize(tooltip, model) {
12832
+		var ctx = tooltip._chart.ctx;
12833
+
12834
+		var height = model.yPadding * 2; // Tooltip Padding
12835
+		var width = 0;
12836
+
12837
+		// Count of all lines in the body
12838
+		var body = model.body;
12839
+		var combinedBodyLength = body.reduce(function(count, bodyItem) {
12840
+			return count + bodyItem.before.length + bodyItem.lines.length + bodyItem.after.length;
12841
+		}, 0);
12842
+		combinedBodyLength += model.beforeBody.length + model.afterBody.length;
12843
+
12844
+		var titleLineCount = model.title.length;
12845
+		var footerLineCount = model.footer.length;
12846
+		var titleFontSize = model.titleFontSize;
12847
+		var bodyFontSize = model.bodyFontSize;
12848
+		var footerFontSize = model.footerFontSize;
12849
+
12850
+		height += titleLineCount * titleFontSize; // Title Lines
12851
+		height += titleLineCount ? (titleLineCount - 1) * model.titleSpacing : 0; // Title Line Spacing
12852
+		height += titleLineCount ? model.titleMarginBottom : 0; // Title's bottom Margin
12853
+		height += combinedBodyLength * bodyFontSize; // Body Lines
12854
+		height += combinedBodyLength ? (combinedBodyLength - 1) * model.bodySpacing : 0; // Body Line Spacing
12855
+		height += footerLineCount ? model.footerMarginTop : 0; // Footer Margin
12856
+		height += footerLineCount * (footerFontSize); // Footer Lines
12857
+		height += footerLineCount ? (footerLineCount - 1) * model.footerSpacing : 0; // Footer Line Spacing
12858
+
12859
+		// Title width
12860
+		var widthPadding = 0;
12861
+		var maxLineWidth = function(line) {
12862
+			width = Math.max(width, ctx.measureText(line).width + widthPadding);
12863
+		};
12864
+
12865
+		ctx.font = helpers.fontString(titleFontSize, model._titleFontStyle, model._titleFontFamily);
12866
+		helpers.each(model.title, maxLineWidth);
12867
+
12868
+		// Body width
12869
+		ctx.font = helpers.fontString(bodyFontSize, model._bodyFontStyle, model._bodyFontFamily);
12870
+		helpers.each(model.beforeBody.concat(model.afterBody), maxLineWidth);
12871
+
12872
+		// Body lines may include some extra width due to the color box
12873
+		widthPadding = model.displayColors ? (bodyFontSize + 2) : 0;
12874
+		helpers.each(body, function(bodyItem) {
12875
+			helpers.each(bodyItem.before, maxLineWidth);
12876
+			helpers.each(bodyItem.lines, maxLineWidth);
12877
+			helpers.each(bodyItem.after, maxLineWidth);
12878
+		});
12879
+
12880
+		// Reset back to 0
12881
+		widthPadding = 0;
12882
+
12883
+		// Footer width
12884
+		ctx.font = helpers.fontString(footerFontSize, model._footerFontStyle, model._footerFontFamily);
12885
+		helpers.each(model.footer, maxLineWidth);
12886
+
12887
+		// Add padding
12888
+		width += 2 * model.xPadding;
12889
+
12890
+		return {
12891
+			width: width,
12892
+			height: height
12893
+		};
12894
+	}
12895
+
12896
+	/**
12897
+	 * Helper to get the alignment of a tooltip given the size
12898
+	 */
12899
+	function determineAlignment(tooltip, size) {
12900
+		var model = tooltip._model;
12901
+		var chart = tooltip._chart;
12902
+		var chartArea = tooltip._chart.chartArea;
12903
+		var xAlign = 'center';
12904
+		var yAlign = 'center';
12905
+
12906
+		if (model.y < size.height) {
12907
+			yAlign = 'top';
12908
+		} else if (model.y > (chart.height - size.height)) {
12909
+			yAlign = 'bottom';
12910
+		}
12911
+
12912
+		var lf, rf; // functions to determine left, right alignment
12913
+		var olf, orf; // functions to determine if left/right alignment causes tooltip to go outside chart
12914
+		var yf; // function to get the y alignment if the tooltip goes outside of the left or right edges
12915
+		var midX = (chartArea.left + chartArea.right) / 2;
12916
+		var midY = (chartArea.top + chartArea.bottom) / 2;
12917
+
12918
+		if (yAlign === 'center') {
12919
+			lf = function(x) {
12920
+				return x <= midX;
12921
+			};
12922
+			rf = function(x) {
12923
+				return x > midX;
12924
+			};
12925
+		} else {
12926
+			lf = function(x) {
12927
+				return x <= (size.width / 2);
12928
+			};
12929
+			rf = function(x) {
12930
+				return x >= (chart.width - (size.width / 2));
12931
+			};
12932
+		}
12933
+
12934
+		olf = function(x) {
12935
+			return x + size.width + model.caretSize + model.caretPadding > chart.width;
12936
+		};
12937
+		orf = function(x) {
12938
+			return x - size.width - model.caretSize - model.caretPadding < 0;
12939
+		};
12940
+		yf = function(y) {
12941
+			return y <= midY ? 'top' : 'bottom';
12942
+		};
12943
+
12944
+		if (lf(model.x)) {
12945
+			xAlign = 'left';
12946
+
12947
+			// Is tooltip too wide and goes over the right side of the chart.?
12948
+			if (olf(model.x)) {
12949
+				xAlign = 'center';
12950
+				yAlign = yf(model.y);
12951
+			}
12952
+		} else if (rf(model.x)) {
12953
+			xAlign = 'right';
12954
+
12955
+			// Is tooltip too wide and goes outside left edge of canvas?
12956
+			if (orf(model.x)) {
12957
+				xAlign = 'center';
12958
+				yAlign = yf(model.y);
12959
+			}
12960
+		}
12961
+
12962
+		var opts = tooltip._options;
12963
+		return {
12964
+			xAlign: opts.xAlign ? opts.xAlign : xAlign,
12965
+			yAlign: opts.yAlign ? opts.yAlign : yAlign
12966
+		};
12967
+	}
12968
+
12969
+	/**
12970
+	 * @Helper to get the location a tooltip needs to be placed at given the initial position (via the vm) and the size and alignment
12971
+	 */
12972
+	function getBackgroundPoint(vm, size, alignment, chart) {
12973
+		// Background Position
12974
+		var x = vm.x;
12975
+		var y = vm.y;
12976
+
12977
+		var caretSize = vm.caretSize;
12978
+		var caretPadding = vm.caretPadding;
12979
+		var cornerRadius = vm.cornerRadius;
12980
+		var xAlign = alignment.xAlign;
12981
+		var yAlign = alignment.yAlign;
12982
+		var paddingAndSize = caretSize + caretPadding;
12983
+		var radiusAndPadding = cornerRadius + caretPadding;
12984
+
12985
+		if (xAlign === 'right') {
12986
+			x -= size.width;
12987
+		} else if (xAlign === 'center') {
12988
+			x -= (size.width / 2);
12989
+			if (x + size.width > chart.width) {
12990
+				x = chart.width - size.width;
12991
+			}
12992
+			if (x < 0) {
12993
+				x = 0;
12994
+			}
12995
+		}
12996
+
12997
+		if (yAlign === 'top') {
12998
+			y += paddingAndSize;
12999
+		} else if (yAlign === 'bottom') {
13000
+			y -= size.height + paddingAndSize;
13001
+		} else {
13002
+			y -= (size.height / 2);
13003
+		}
13004
+
13005
+		if (yAlign === 'center') {
13006
+			if (xAlign === 'left') {
13007
+				x += paddingAndSize;
13008
+			} else if (xAlign === 'right') {
13009
+				x -= paddingAndSize;
13010
+			}
13011
+		} else if (xAlign === 'left') {
13012
+			x -= radiusAndPadding;
13013
+		} else if (xAlign === 'right') {
13014
+			x += radiusAndPadding;
13015
+		}
13016
+
13017
+		return {
13018
+			x: x,
13019
+			y: y
13020
+		};
13021
+	}
13022
+
13023
+	Chart.Tooltip = Element.extend({
13024
+		initialize: function() {
13025
+			this._model = getBaseModel(this._options);
13026
+			this._lastActive = [];
13027
+		},
13028
+
13029
+		// Get the title
13030
+		// Args are: (tooltipItem, data)
13031
+		getTitle: function() {
13032
+			var me = this;
13033
+			var opts = me._options;
13034
+			var callbacks = opts.callbacks;
13035
+
13036
+			var beforeTitle = callbacks.beforeTitle.apply(me, arguments);
13037
+			var title = callbacks.title.apply(me, arguments);
13038
+			var afterTitle = callbacks.afterTitle.apply(me, arguments);
13039
+
13040
+			var lines = [];
13041
+			lines = pushOrConcat(lines, beforeTitle);
13042
+			lines = pushOrConcat(lines, title);
13043
+			lines = pushOrConcat(lines, afterTitle);
13044
+
13045
+			return lines;
13046
+		},
13047
+
13048
+		// Args are: (tooltipItem, data)
13049
+		getBeforeBody: function() {
13050
+			var lines = this._options.callbacks.beforeBody.apply(this, arguments);
13051
+			return helpers.isArray(lines) ? lines : lines !== undefined ? [lines] : [];
13052
+		},
13053
+
13054
+		// Args are: (tooltipItem, data)
13055
+		getBody: function(tooltipItems, data) {
13056
+			var me = this;
13057
+			var callbacks = me._options.callbacks;
13058
+			var bodyItems = [];
13059
+
13060
+			helpers.each(tooltipItems, function(tooltipItem) {
13061
+				var bodyItem = {
13062
+					before: [],
13063
+					lines: [],
13064
+					after: []
13065
+				};
13066
+				pushOrConcat(bodyItem.before, callbacks.beforeLabel.call(me, tooltipItem, data));
13067
+				pushOrConcat(bodyItem.lines, callbacks.label.call(me, tooltipItem, data));
13068
+				pushOrConcat(bodyItem.after, callbacks.afterLabel.call(me, tooltipItem, data));
13069
+
13070
+				bodyItems.push(bodyItem);
13071
+			});
13072
+
13073
+			return bodyItems;
13074
+		},
13075
+
13076
+		// Args are: (tooltipItem, data)
13077
+		getAfterBody: function() {
13078
+			var lines = this._options.callbacks.afterBody.apply(this, arguments);
13079
+			return helpers.isArray(lines) ? lines : lines !== undefined ? [lines] : [];
13080
+		},
13081
+
13082
+		// Get the footer and beforeFooter and afterFooter lines
13083
+		// Args are: (tooltipItem, data)
13084
+		getFooter: function() {
13085
+			var me = this;
13086
+			var callbacks = me._options.callbacks;
13087
+
13088
+			var beforeFooter = callbacks.beforeFooter.apply(me, arguments);
13089
+			var footer = callbacks.footer.apply(me, arguments);
13090
+			var afterFooter = callbacks.afterFooter.apply(me, arguments);
13091
+
13092
+			var lines = [];
13093
+			lines = pushOrConcat(lines, beforeFooter);
13094
+			lines = pushOrConcat(lines, footer);
13095
+			lines = pushOrConcat(lines, afterFooter);
13096
+
13097
+			return lines;
13098
+		},
13099
+
13100
+		update: function(changed) {
13101
+			var me = this;
13102
+			var opts = me._options;
13103
+
13104
+			// Need to regenerate the model because its faster than using extend and it is necessary due to the optimization in Chart.Element.transition
13105
+			// that does _view = _model if ease === 1. This causes the 2nd tooltip update to set properties in both the view and model at the same time
13106
+			// which breaks any animations.
13107
+			var existingModel = me._model;
13108
+			var model = me._model = getBaseModel(opts);
13109
+			var active = me._active;
13110
+
13111
+			var data = me._data;
13112
+
13113
+			// In the case where active.length === 0 we need to keep these at existing values for good animations
13114
+			var alignment = {
13115
+				xAlign: existingModel.xAlign,
13116
+				yAlign: existingModel.yAlign
13117
+			};
13118
+			var backgroundPoint = {
13119
+				x: existingModel.x,
13120
+				y: existingModel.y
13121
+			};
13122
+			var tooltipSize = {
13123
+				width: existingModel.width,
13124
+				height: existingModel.height
13125
+			};
13126
+			var tooltipPosition = {
13127
+				x: existingModel.caretX,
13128
+				y: existingModel.caretY
13129
+			};
13130
+
13131
+			var i, len;
13132
+
13133
+			if (active.length) {
13134
+				model.opacity = 1;
13135
+
13136
+				var labelColors = [];
13137
+				var labelTextColors = [];
13138
+				tooltipPosition = Chart.Tooltip.positioners[opts.position].call(me, active, me._eventPosition);
13139
+
13140
+				var tooltipItems = [];
13141
+				for (i = 0, len = active.length; i < len; ++i) {
13142
+					tooltipItems.push(createTooltipItem(active[i]));
13143
+				}
13144
+
13145
+				// If the user provided a filter function, use it to modify the tooltip items
13146
+				if (opts.filter) {
13147
+					tooltipItems = tooltipItems.filter(function(a) {
13148
+						return opts.filter(a, data);
13149
+					});
13150
+				}
13151
+
13152
+				// If the user provided a sorting function, use it to modify the tooltip items
13153
+				if (opts.itemSort) {
13154
+					tooltipItems = tooltipItems.sort(function(a, b) {
13155
+						return opts.itemSort(a, b, data);
13156
+					});
13157
+				}
13158
+
13159
+				// Determine colors for boxes
13160
+				helpers.each(tooltipItems, function(tooltipItem) {
13161
+					labelColors.push(opts.callbacks.labelColor.call(me, tooltipItem, me._chart));
13162
+					labelTextColors.push(opts.callbacks.labelTextColor.call(me, tooltipItem, me._chart));
13163
+				});
13164
+
13165
+
13166
+				// Build the Text Lines
13167
+				model.title = me.getTitle(tooltipItems, data);
13168
+				model.beforeBody = me.getBeforeBody(tooltipItems, data);
13169
+				model.body = me.getBody(tooltipItems, data);
13170
+				model.afterBody = me.getAfterBody(tooltipItems, data);
13171
+				model.footer = me.getFooter(tooltipItems, data);
13172
+
13173
+				// Initial positioning and colors
13174
+				model.x = Math.round(tooltipPosition.x);
13175
+				model.y = Math.round(tooltipPosition.y);
13176
+				model.caretPadding = opts.caretPadding;
13177
+				model.labelColors = labelColors;
13178
+				model.labelTextColors = labelTextColors;
13179
+
13180
+				// data points
13181
+				model.dataPoints = tooltipItems;
13182
+
13183
+				// We need to determine alignment of the tooltip
13184
+				tooltipSize = getTooltipSize(this, model);
13185
+				alignment = determineAlignment(this, tooltipSize);
13186
+				// Final Size and Position
13187
+				backgroundPoint = getBackgroundPoint(model, tooltipSize, alignment, me._chart);
13188
+			} else {
13189
+				model.opacity = 0;
13190
+			}
13191
+
13192
+			model.xAlign = alignment.xAlign;
13193
+			model.yAlign = alignment.yAlign;
13194
+			model.x = backgroundPoint.x;
13195
+			model.y = backgroundPoint.y;
13196
+			model.width = tooltipSize.width;
13197
+			model.height = tooltipSize.height;
13198
+
13199
+			// Point where the caret on the tooltip points to
13200
+			model.caretX = tooltipPosition.x;
13201
+			model.caretY = tooltipPosition.y;
13202
+
13203
+			me._model = model;
13204
+
13205
+			if (changed && opts.custom) {
13206
+				opts.custom.call(me, model);
13207
+			}
13208
+
13209
+			return me;
13210
+		},
13211
+		drawCaret: function(tooltipPoint, size) {
13212
+			var ctx = this._chart.ctx;
13213
+			var vm = this._view;
13214
+			var caretPosition = this.getCaretPosition(tooltipPoint, size, vm);
13215
+
13216
+			ctx.lineTo(caretPosition.x1, caretPosition.y1);
13217
+			ctx.lineTo(caretPosition.x2, caretPosition.y2);
13218
+			ctx.lineTo(caretPosition.x3, caretPosition.y3);
13219
+		},
13220
+		getCaretPosition: function(tooltipPoint, size, vm) {
13221
+			var x1, x2, x3, y1, y2, y3;
13222
+			var caretSize = vm.caretSize;
13223
+			var cornerRadius = vm.cornerRadius;
13224
+			var xAlign = vm.xAlign;
13225
+			var yAlign = vm.yAlign;
13226
+			var ptX = tooltipPoint.x;
13227
+			var ptY = tooltipPoint.y;
13228
+			var width = size.width;
13229
+			var height = size.height;
13230
+
13231
+			if (yAlign === 'center') {
13232
+				y2 = ptY + (height / 2);
13233
+
13234
+				if (xAlign === 'left') {
13235
+					x1 = ptX;
13236
+					x2 = x1 - caretSize;
13237
+					x3 = x1;
13238
+
13239
+					y1 = y2 + caretSize;
13240
+					y3 = y2 - caretSize;
13241
+				} else {
13242
+					x1 = ptX + width;
13243
+					x2 = x1 + caretSize;
13244
+					x3 = x1;
13245
+
13246
+					y1 = y2 - caretSize;
13247
+					y3 = y2 + caretSize;
13248
+				}
13249
+			} else {
13250
+				if (xAlign === 'left') {
13251
+					x2 = ptX + cornerRadius + (caretSize);
13252
+					x1 = x2 - caretSize;
13253
+					x3 = x2 + caretSize;
13254
+				} else if (xAlign === 'right') {
13255
+					x2 = ptX + width - cornerRadius - caretSize;
13256
+					x1 = x2 - caretSize;
13257
+					x3 = x2 + caretSize;
13258
+				} else {
13259
+					x2 = vm.caretX;
13260
+					x1 = x2 - caretSize;
13261
+					x3 = x2 + caretSize;
13262
+				}
13263
+				if (yAlign === 'top') {
13264
+					y1 = ptY;
13265
+					y2 = y1 - caretSize;
13266
+					y3 = y1;
13267
+				} else {
13268
+					y1 = ptY + height;
13269
+					y2 = y1 + caretSize;
13270
+					y3 = y1;
13271
+					// invert drawing order
13272
+					var tmp = x3;
13273
+					x3 = x1;
13274
+					x1 = tmp;
13275
+				}
13276
+			}
13277
+			return {x1: x1, x2: x2, x3: x3, y1: y1, y2: y2, y3: y3};
13278
+		},
13279
+		drawTitle: function(pt, vm, ctx, opacity) {
13280
+			var title = vm.title;
13281
+
13282
+			if (title.length) {
13283
+				ctx.textAlign = vm._titleAlign;
13284
+				ctx.textBaseline = 'top';
13285
+
13286
+				var titleFontSize = vm.titleFontSize;
13287
+				var titleSpacing = vm.titleSpacing;
13288
+
13289
+				ctx.fillStyle = mergeOpacity(vm.titleFontColor, opacity);
13290
+				ctx.font = helpers.fontString(titleFontSize, vm._titleFontStyle, vm._titleFontFamily);
13291
+
13292
+				var i, len;
13293
+				for (i = 0, len = title.length; i < len; ++i) {
13294
+					ctx.fillText(title[i], pt.x, pt.y);
13295
+					pt.y += titleFontSize + titleSpacing; // Line Height and spacing
13296
+
13297
+					if (i + 1 === title.length) {
13298
+						pt.y += vm.titleMarginBottom - titleSpacing; // If Last, add margin, remove spacing
13299
+					}
13300
+				}
13301
+			}
13302
+		},
13303
+		drawBody: function(pt, vm, ctx, opacity) {
13304
+			var bodyFontSize = vm.bodyFontSize;
13305
+			var bodySpacing = vm.bodySpacing;
13306
+			var body = vm.body;
13307
+
13308
+			ctx.textAlign = vm._bodyAlign;
13309
+			ctx.textBaseline = 'top';
13310
+			ctx.font = helpers.fontString(bodyFontSize, vm._bodyFontStyle, vm._bodyFontFamily);
13311
+
13312
+			// Before Body
13313
+			var xLinePadding = 0;
13314
+			var fillLineOfText = function(line) {
13315
+				ctx.fillText(line, pt.x + xLinePadding, pt.y);
13316
+				pt.y += bodyFontSize + bodySpacing;
13317
+			};
13318
+
13319
+			// Before body lines
13320
+			ctx.fillStyle = mergeOpacity(vm.bodyFontColor, opacity);
13321
+			helpers.each(vm.beforeBody, fillLineOfText);
13322
+
13323
+			var drawColorBoxes = vm.displayColors;
13324
+			xLinePadding = drawColorBoxes ? (bodyFontSize + 2) : 0;
13325
+
13326
+			// Draw body lines now
13327
+			helpers.each(body, function(bodyItem, i) {
13328
+				var textColor = mergeOpacity(vm.labelTextColors[i], opacity);
13329
+				ctx.fillStyle = textColor;
13330
+				helpers.each(bodyItem.before, fillLineOfText);
13331
+
13332
+				helpers.each(bodyItem.lines, function(line) {
13333
+					// Draw Legend-like boxes if needed
13334
+					if (drawColorBoxes) {
13335
+						// Fill a white rect so that colours merge nicely if the opacity is < 1
13336
+						ctx.fillStyle = mergeOpacity(vm.legendColorBackground, opacity);
13337
+						ctx.fillRect(pt.x, pt.y, bodyFontSize, bodyFontSize);
13338
+
13339
+						// Border
13340
+						ctx.lineWidth = 1;
13341
+						ctx.strokeStyle = mergeOpacity(vm.labelColors[i].borderColor, opacity);
13342
+						ctx.strokeRect(pt.x, pt.y, bodyFontSize, bodyFontSize);
13343
+
13344
+						// Inner square
13345
+						ctx.fillStyle = mergeOpacity(vm.labelColors[i].backgroundColor, opacity);
13346
+						ctx.fillRect(pt.x + 1, pt.y + 1, bodyFontSize - 2, bodyFontSize - 2);
13347
+						ctx.fillStyle = textColor;
13348
+					}
13349
+
13350
+					fillLineOfText(line);
13351
+				});
13352
+
13353
+				helpers.each(bodyItem.after, fillLineOfText);
13354
+			});
13355
+
13356
+			// Reset back to 0 for after body
13357
+			xLinePadding = 0;
13358
+
13359
+			// After body lines
13360
+			helpers.each(vm.afterBody, fillLineOfText);
13361
+			pt.y -= bodySpacing; // Remove last body spacing
13362
+		},
13363
+		drawFooter: function(pt, vm, ctx, opacity) {
13364
+			var footer = vm.footer;
13365
+
13366
+			if (footer.length) {
13367
+				pt.y += vm.footerMarginTop;
13368
+
13369
+				ctx.textAlign = vm._footerAlign;
13370
+				ctx.textBaseline = 'top';
13371
+
13372
+				ctx.fillStyle = mergeOpacity(vm.footerFontColor, opacity);
13373
+				ctx.font = helpers.fontString(vm.footerFontSize, vm._footerFontStyle, vm._footerFontFamily);
13374
+
13375
+				helpers.each(footer, function(line) {
13376
+					ctx.fillText(line, pt.x, pt.y);
13377
+					pt.y += vm.footerFontSize + vm.footerSpacing;
13378
+				});
13379
+			}
13380
+		},
13381
+		drawBackground: function(pt, vm, ctx, tooltipSize, opacity) {
13382
+			ctx.fillStyle = mergeOpacity(vm.backgroundColor, opacity);
13383
+			ctx.strokeStyle = mergeOpacity(vm.borderColor, opacity);
13384
+			ctx.lineWidth = vm.borderWidth;
13385
+			var xAlign = vm.xAlign;
13386
+			var yAlign = vm.yAlign;
13387
+			var x = pt.x;
13388
+			var y = pt.y;
13389
+			var width = tooltipSize.width;
13390
+			var height = tooltipSize.height;
13391
+			var radius = vm.cornerRadius;
13392
+
13393
+			ctx.beginPath();
13394
+			ctx.moveTo(x + radius, y);
13395
+			if (yAlign === 'top') {
13396
+				this.drawCaret(pt, tooltipSize);
13397
+			}
13398
+			ctx.lineTo(x + width - radius, y);
13399
+			ctx.quadraticCurveTo(x + width, y, x + width, y + radius);
13400
+			if (yAlign === 'center' && xAlign === 'right') {
13401
+				this.drawCaret(pt, tooltipSize);
13402
+			}
13403
+			ctx.lineTo(x + width, y + height - radius);
13404
+			ctx.quadraticCurveTo(x + width, y + height, x + width - radius, y + height);
13405
+			if (yAlign === 'bottom') {
13406
+				this.drawCaret(pt, tooltipSize);
13407
+			}
13408
+			ctx.lineTo(x + radius, y + height);
13409
+			ctx.quadraticCurveTo(x, y + height, x, y + height - radius);
13410
+			if (yAlign === 'center' && xAlign === 'left') {
13411
+				this.drawCaret(pt, tooltipSize);
13412
+			}
13413
+			ctx.lineTo(x, y + radius);
13414
+			ctx.quadraticCurveTo(x, y, x + radius, y);
13415
+			ctx.closePath();
13416
+
13417
+			ctx.fill();
13418
+
13419
+			if (vm.borderWidth > 0) {
13420
+				ctx.stroke();
13421
+			}
13422
+		},
13423
+		draw: function() {
13424
+			var ctx = this._chart.ctx;
13425
+			var vm = this._view;
13426
+
13427
+			if (vm.opacity === 0) {
13428
+				return;
13429
+			}
13430
+
13431
+			var tooltipSize = {
13432
+				width: vm.width,
13433
+				height: vm.height
13434
+			};
13435
+			var pt = {
13436
+				x: vm.x,
13437
+				y: vm.y
13438
+			};
13439
+
13440
+			// IE11/Edge does not like very small opacities, so snap to 0
13441
+			var opacity = Math.abs(vm.opacity < 1e-3) ? 0 : vm.opacity;
13442
+
13443
+			// Truthy/falsey value for empty tooltip
13444
+			var hasTooltipContent = vm.title.length || vm.beforeBody.length || vm.body.length || vm.afterBody.length || vm.footer.length;
13445
+
13446
+			if (this._options.enabled && hasTooltipContent) {
13447
+				// Draw Background
13448
+				this.drawBackground(pt, vm, ctx, tooltipSize, opacity);
13449
+
13450
+				// Draw Title, Body, and Footer
13451
+				pt.x += vm.xPadding;
13452
+				pt.y += vm.yPadding;
13453
+
13454
+				// Titles
13455
+				this.drawTitle(pt, vm, ctx, opacity);
13456
+
13457
+				// Body
13458
+				this.drawBody(pt, vm, ctx, opacity);
13459
+
13460
+				// Footer
13461
+				this.drawFooter(pt, vm, ctx, opacity);
13462
+			}
13463
+		},
13464
+
13465
+		/**
13466
+		 * Handle an event
13467
+		 * @private
13468
+		 * @param {IEvent} event - The event to handle
13469
+		 * @returns {Boolean} true if the tooltip changed
13470
+		 */
13471
+		handleEvent: function(e) {
13472
+			var me = this;
13473
+			var options = me._options;
13474
+			var changed = false;
13475
+
13476
+			me._lastActive = me._lastActive || [];
13477
+
13478
+			// Find Active Elements for tooltips
13479
+			if (e.type === 'mouseout') {
13480
+				me._active = [];
13481
+			} else {
13482
+				me._active = me._chart.getElementsAtEventForMode(e, options.mode, options);
13483
+			}
13484
+
13485
+			// Remember Last Actives
13486
+			changed = !helpers.arrayEquals(me._active, me._lastActive);
13487
+
13488
+			// Only handle target event on tooltip change
13489
+			if (changed) {
13490
+				me._lastActive = me._active;
13491
+
13492
+				if (options.enabled || options.custom) {
13493
+					me._eventPosition = {
13494
+						x: e.x,
13495
+						y: e.y
13496
+					};
13497
+
13498
+					me.update(true);
13499
+					me.pivot();
13500
+				}
13501
+			}
13502
+
13503
+			return changed;
13504
+		}
13505
+	});
13506
+
13507
+	/**
13508
+	 * @namespace Chart.Tooltip.positioners
13509
+	 */
13510
+	Chart.Tooltip.positioners = {
13511
+		/**
13512
+		 * Average mode places the tooltip at the average position of the elements shown
13513
+		 * @function Chart.Tooltip.positioners.average
13514
+		 * @param elements {ChartElement[]} the elements being displayed in the tooltip
13515
+		 * @returns {Point} tooltip position
13516
+		 */
13517
+		average: function(elements) {
13518
+			if (!elements.length) {
13519
+				return false;
13520
+			}
13521
+
13522
+			var i, len;
13523
+			var x = 0;
13524
+			var y = 0;
13525
+			var count = 0;
13526
+
13527
+			for (i = 0, len = elements.length; i < len; ++i) {
13528
+				var el = elements[i];
13529
+				if (el && el.hasValue()) {
13530
+					var pos = el.tooltipPosition();
13531
+					x += pos.x;
13532
+					y += pos.y;
13533
+					++count;
13534
+				}
13535
+			}
13536
+
13537
+			return {
13538
+				x: Math.round(x / count),
13539
+				y: Math.round(y / count)
13540
+			};
13541
+		},
13542
+
13543
+		/**
13544
+		 * Gets the tooltip position nearest of the item nearest to the event position
13545
+		 * @function Chart.Tooltip.positioners.nearest
13546
+		 * @param elements {Chart.Element[]} the tooltip elements
13547
+		 * @param eventPosition {Point} the position of the event in canvas coordinates
13548
+		 * @returns {Point} the tooltip position
13549
+		 */
13550
+		nearest: function(elements, eventPosition) {
13551
+			var x = eventPosition.x;
13552
+			var y = eventPosition.y;
13553
+			var minDistance = Number.POSITIVE_INFINITY;
13554
+			var i, len, nearestElement;
13555
+
13556
+			for (i = 0, len = elements.length; i < len; ++i) {
13557
+				var el = elements[i];
13558
+				if (el && el.hasValue()) {
13559
+					var center = el.getCenterPoint();
13560
+					var d = helpers.distanceBetweenPoints(eventPosition, center);
13561
+
13562
+					if (d < minDistance) {
13563
+						minDistance = d;
13564
+						nearestElement = el;
13565
+					}
13566
+				}
13567
+			}
13568
+
13569
+			if (nearestElement) {
13570
+				var tp = nearestElement.tooltipPosition();
13571
+				x = tp.x;
13572
+				y = tp.y;
13573
+			}
13574
+
13575
+			return {
13576
+				x: x,
13577
+				y: y
13578
+			};
13579
+		}
13580
+	};
13581
+};
13582
+
13583
+},{"25":25,"26":26,"45":45}],36:[function(require,module,exports){
13584
+'use strict';
13585
+
13586
+var defaults = require(25);
13587
+var Element = require(26);
13588
+var helpers = require(45);
13589
+
13590
+defaults._set('global', {
13591
+	elements: {
13592
+		arc: {
13593
+			backgroundColor: defaults.global.defaultColor,
13594
+			borderColor: '#fff',
13595
+			borderWidth: 2
13596
+		}
13597
+	}
13598
+});
13599
+
13600
+module.exports = Element.extend({
13601
+	inLabelRange: function(mouseX) {
13602
+		var vm = this._view;
13603
+
13604
+		if (vm) {
13605
+			return (Math.pow(mouseX - vm.x, 2) < Math.pow(vm.radius + vm.hoverRadius, 2));
13606
+		}
13607
+		return false;
13608
+	},
13609
+
13610
+	inRange: function(chartX, chartY) {
13611
+		var vm = this._view;
13612
+
13613
+		if (vm) {
13614
+			var pointRelativePosition = helpers.getAngleFromPoint(vm, {x: chartX, y: chartY});
13615
+			var	angle = pointRelativePosition.angle;
13616
+			var distance = pointRelativePosition.distance;
13617
+
13618
+			// Sanitise angle range
13619
+			var startAngle = vm.startAngle;
13620
+			var endAngle = vm.endAngle;
13621
+			while (endAngle < startAngle) {
13622
+				endAngle += 2.0 * Math.PI;
13623
+			}
13624
+			while (angle > endAngle) {
13625
+				angle -= 2.0 * Math.PI;
13626
+			}
13627
+			while (angle < startAngle) {
13628
+				angle += 2.0 * Math.PI;
13629
+			}
13630
+
13631
+			// Check if within the range of the open/close angle
13632
+			var betweenAngles = (angle >= startAngle && angle <= endAngle);
13633
+			var withinRadius = (distance >= vm.innerRadius && distance <= vm.outerRadius);
13634
+
13635
+			return (betweenAngles && withinRadius);
13636
+		}
13637
+		return false;
13638
+	},
13639
+
13640
+	getCenterPoint: function() {
13641
+		var vm = this._view;
13642
+		var halfAngle = (vm.startAngle + vm.endAngle) / 2;
13643
+		var halfRadius = (vm.innerRadius + vm.outerRadius) / 2;
13644
+		return {
13645
+			x: vm.x + Math.cos(halfAngle) * halfRadius,
13646
+			y: vm.y + Math.sin(halfAngle) * halfRadius
13647
+		};
13648
+	},
13649
+
13650
+	getArea: function() {
13651
+		var vm = this._view;
13652
+		return Math.PI * ((vm.endAngle - vm.startAngle) / (2 * Math.PI)) * (Math.pow(vm.outerRadius, 2) - Math.pow(vm.innerRadius, 2));
13653
+	},
13654
+
13655
+	tooltipPosition: function() {
13656
+		var vm = this._view;
13657
+		var centreAngle = vm.startAngle + ((vm.endAngle - vm.startAngle) / 2);
13658
+		var rangeFromCentre = (vm.outerRadius - vm.innerRadius) / 2 + vm.innerRadius;
13659
+
13660
+		return {
13661
+			x: vm.x + (Math.cos(centreAngle) * rangeFromCentre),
13662
+			y: vm.y + (Math.sin(centreAngle) * rangeFromCentre)
13663
+		};
13664
+	},
13665
+
13666
+	draw: function() {
13667
+		var ctx = this._chart.ctx;
13668
+		var vm = this._view;
13669
+		var sA = vm.startAngle;
13670
+		var eA = vm.endAngle;
13671
+
13672
+		ctx.beginPath();
13673
+
13674
+		ctx.arc(vm.x, vm.y, vm.outerRadius, sA, eA);
13675
+		ctx.arc(vm.x, vm.y, vm.innerRadius, eA, sA, true);
13676
+
13677
+		ctx.closePath();
13678
+		ctx.strokeStyle = vm.borderColor;
13679
+		ctx.lineWidth = vm.borderWidth;
13680
+
13681
+		ctx.fillStyle = vm.backgroundColor;
13682
+
13683
+		ctx.fill();
13684
+		ctx.lineJoin = 'bevel';
13685
+
13686
+		if (vm.borderWidth) {
13687
+			ctx.stroke();
13688
+		}
13689
+	}
13690
+});
13691
+
13692
+},{"25":25,"26":26,"45":45}],37:[function(require,module,exports){
13693
+'use strict';
13694
+
13695
+var defaults = require(25);
13696
+var Element = require(26);
13697
+var helpers = require(45);
13698
+
13699
+var globalDefaults = defaults.global;
13700
+
13701
+defaults._set('global', {
13702
+	elements: {
13703
+		line: {
13704
+			tension: 0.4,
13705
+			backgroundColor: globalDefaults.defaultColor,
13706
+			borderWidth: 3,
13707
+			borderColor: globalDefaults.defaultColor,
13708
+			borderCapStyle: 'butt',
13709
+			borderDash: [],
13710
+			borderDashOffset: 0.0,
13711
+			borderJoinStyle: 'miter',
13712
+			capBezierPoints: true,
13713
+			fill: true, // do we fill in the area between the line and its base axis
13714
+		}
13715
+	}
13716
+});
13717
+
13718
+module.exports = Element.extend({
13719
+	draw: function() {
13720
+		var me = this;
13721
+		var vm = me._view;
13722
+		var ctx = me._chart.ctx;
13723
+		var spanGaps = vm.spanGaps;
13724
+		var points = me._children.slice(); // clone array
13725
+		var globalOptionLineElements = globalDefaults.elements.line;
13726
+		var lastDrawnIndex = -1;
13727
+		var index, current, previous, currentVM;
13728
+
13729
+		// If we are looping, adding the first point again
13730
+		if (me._loop && points.length) {
13731
+			points.push(points[0]);
13732
+		}
13733
+
13734
+		ctx.save();
13735
+
13736
+		// Stroke Line Options
13737
+		ctx.lineCap = vm.borderCapStyle || globalOptionLineElements.borderCapStyle;
13738
+
13739
+		// IE 9 and 10 do not support line dash
13740
+		if (ctx.setLineDash) {
13741
+			ctx.setLineDash(vm.borderDash || globalOptionLineElements.borderDash);
13742
+		}
13743
+
13744
+		ctx.lineDashOffset = vm.borderDashOffset || globalOptionLineElements.borderDashOffset;
13745
+		ctx.lineJoin = vm.borderJoinStyle || globalOptionLineElements.borderJoinStyle;
13746
+		ctx.lineWidth = vm.borderWidth || globalOptionLineElements.borderWidth;
13747
+		ctx.strokeStyle = vm.borderColor || globalDefaults.defaultColor;
13748
+
13749
+		// Stroke Line
13750
+		ctx.beginPath();
13751
+		lastDrawnIndex = -1;
13752
+
13753
+		for (index = 0; index < points.length; ++index) {
13754
+			current = points[index];
13755
+			previous = helpers.previousItem(points, index);
13756
+			currentVM = current._view;
13757
+
13758
+			// First point moves to it's starting position no matter what
13759
+			if (index === 0) {
13760
+				if (!currentVM.skip) {
13761
+					ctx.moveTo(currentVM.x, currentVM.y);
13762
+					lastDrawnIndex = index;
13763
+				}
13764
+			} else {
13765
+				previous = lastDrawnIndex === -1 ? previous : points[lastDrawnIndex];
13766
+
13767
+				if (!currentVM.skip) {
13768
+					if ((lastDrawnIndex !== (index - 1) && !spanGaps) || lastDrawnIndex === -1) {
13769
+						// There was a gap and this is the first point after the gap
13770
+						ctx.moveTo(currentVM.x, currentVM.y);
13771
+					} else {
13772
+						// Line to next point
13773
+						helpers.canvas.lineTo(ctx, previous._view, current._view);
13774
+					}
13775
+					lastDrawnIndex = index;
13776
+				}
13777
+			}
13778
+		}
13779
+
13780
+		ctx.stroke();
13781
+		ctx.restore();
13782
+	}
13783
+});
13784
+
13785
+},{"25":25,"26":26,"45":45}],38:[function(require,module,exports){
13786
+'use strict';
13787
+
13788
+var defaults = require(25);
13789
+var Element = require(26);
13790
+var helpers = require(45);
13791
+
13792
+var defaultColor = defaults.global.defaultColor;
13793
+
13794
+defaults._set('global', {
13795
+	elements: {
13796
+		point: {
13797
+			radius: 3,
13798
+			pointStyle: 'circle',
13799
+			backgroundColor: defaultColor,
13800
+			borderColor: defaultColor,
13801
+			borderWidth: 1,
13802
+			// Hover
13803
+			hitRadius: 1,
13804
+			hoverRadius: 4,
13805
+			hoverBorderWidth: 1
13806
+		}
13807
+	}
13808
+});
13809
+
13810
+function xRange(mouseX) {
13811
+	var vm = this._view;
13812
+	return vm ? (Math.abs(mouseX - vm.x) < vm.radius + vm.hitRadius) : false;
13813
+}
13814
+
13815
+function yRange(mouseY) {
13816
+	var vm = this._view;
13817
+	return vm ? (Math.abs(mouseY - vm.y) < vm.radius + vm.hitRadius) : false;
13818
+}
13819
+
13820
+module.exports = Element.extend({
13821
+	inRange: function(mouseX, mouseY) {
13822
+		var vm = this._view;
13823
+		return vm ? ((Math.pow(mouseX - vm.x, 2) + Math.pow(mouseY - vm.y, 2)) < Math.pow(vm.hitRadius + vm.radius, 2)) : false;
13824
+	},
13825
+
13826
+	inLabelRange: xRange,
13827
+	inXRange: xRange,
13828
+	inYRange: yRange,
13829
+
13830
+	getCenterPoint: function() {
13831
+		var vm = this._view;
13832
+		return {
13833
+			x: vm.x,
13834
+			y: vm.y
13835
+		};
13836
+	},
13837
+
13838
+	getArea: function() {
13839
+		return Math.PI * Math.pow(this._view.radius, 2);
13840
+	},
13841
+
13842
+	tooltipPosition: function() {
13843
+		var vm = this._view;
13844
+		return {
13845
+			x: vm.x,
13846
+			y: vm.y,
13847
+			padding: vm.radius + vm.borderWidth
13848
+		};
13849
+	},
13850
+
13851
+	draw: function(chartArea) {
13852
+		var vm = this._view;
13853
+		var model = this._model;
13854
+		var ctx = this._chart.ctx;
13855
+		var pointStyle = vm.pointStyle;
13856
+		var radius = vm.radius;
13857
+		var x = vm.x;
13858
+		var y = vm.y;
13859
+		var color = helpers.color;
13860
+		var errMargin = 1.01; // 1.01 is margin for Accumulated error. (Especially Edge, IE.)
13861
+		var ratio = 0;
13862
+
13863
+		if (vm.skip) {
13864
+			return;
13865
+		}
13866
+
13867
+		ctx.strokeStyle = vm.borderColor || defaultColor;
13868
+		ctx.lineWidth = helpers.valueOrDefault(vm.borderWidth, defaults.global.elements.point.borderWidth);
13869
+		ctx.fillStyle = vm.backgroundColor || defaultColor;
13870
+
13871
+		// Cliping for Points.
13872
+		// going out from inner charArea?
13873
+		if ((chartArea !== undefined) && ((model.x < chartArea.left) || (chartArea.right * errMargin < model.x) || (model.y < chartArea.top) || (chartArea.bottom * errMargin < model.y))) {
13874
+			// Point fade out
13875
+			if (model.x < chartArea.left) {
13876
+				ratio = (x - model.x) / (chartArea.left - model.x);
13877
+			} else if (chartArea.right * errMargin < model.x) {
13878
+				ratio = (model.x - x) / (model.x - chartArea.right);
13879
+			} else if (model.y < chartArea.top) {
13880
+				ratio = (y - model.y) / (chartArea.top - model.y);
13881
+			} else if (chartArea.bottom * errMargin < model.y) {
13882
+				ratio = (model.y - y) / (model.y - chartArea.bottom);
13883
+			}
13884
+			ratio = Math.round(ratio * 100) / 100;
13885
+			ctx.strokeStyle = color(ctx.strokeStyle).alpha(ratio).rgbString();
13886
+			ctx.fillStyle = color(ctx.fillStyle).alpha(ratio).rgbString();
13887
+		}
13888
+
13889
+		helpers.canvas.drawPoint(ctx, pointStyle, radius, x, y);
13890
+	}
13891
+});
13892
+
13893
+},{"25":25,"26":26,"45":45}],39:[function(require,module,exports){
13894
+'use strict';
13895
+
13896
+var defaults = require(25);
13897
+var Element = require(26);
13898
+
13899
+defaults._set('global', {
13900
+	elements: {
13901
+		rectangle: {
13902
+			backgroundColor: defaults.global.defaultColor,
13903
+			borderColor: defaults.global.defaultColor,
13904
+			borderSkipped: 'bottom',
13905
+			borderWidth: 0
13906
+		}
13907
+	}
13908
+});
13909
+
13910
+function isVertical(bar) {
13911
+	return bar._view.width !== undefined;
13912
+}
13913
+
13914
+/**
13915
+ * Helper function to get the bounds of the bar regardless of the orientation
13916
+ * @param bar {Chart.Element.Rectangle} the bar
13917
+ * @return {Bounds} bounds of the bar
13918
+ * @private
13919
+ */
13920
+function getBarBounds(bar) {
13921
+	var vm = bar._view;
13922
+	var x1, x2, y1, y2;
13923
+
13924
+	if (isVertical(bar)) {
13925
+		// vertical
13926
+		var halfWidth = vm.width / 2;
13927
+		x1 = vm.x - halfWidth;
13928
+		x2 = vm.x + halfWidth;
13929
+		y1 = Math.min(vm.y, vm.base);
13930
+		y2 = Math.max(vm.y, vm.base);
13931
+	} else {
13932
+		// horizontal bar
13933
+		var halfHeight = vm.height / 2;
13934
+		x1 = Math.min(vm.x, vm.base);
13935
+		x2 = Math.max(vm.x, vm.base);
13936
+		y1 = vm.y - halfHeight;
13937
+		y2 = vm.y + halfHeight;
13938
+	}
13939
+
13940
+	return {
13941
+		left: x1,
13942
+		top: y1,
13943
+		right: x2,
13944
+		bottom: y2
13945
+	};
13946
+}
13947
+
13948
+module.exports = Element.extend({
13949
+	draw: function() {
13950
+		var ctx = this._chart.ctx;
13951
+		var vm = this._view;
13952
+		var left, right, top, bottom, signX, signY, borderSkipped;
13953
+		var borderWidth = vm.borderWidth;
13954
+
13955
+		if (!vm.horizontal) {
13956
+			// bar
13957
+			left = vm.x - vm.width / 2;
13958
+			right = vm.x + vm.width / 2;
13959
+			top = vm.y;
13960
+			bottom = vm.base;
13961
+			signX = 1;
13962
+			signY = bottom > top ? 1 : -1;
13963
+			borderSkipped = vm.borderSkipped || 'bottom';
13964
+		} else {
13965
+			// horizontal bar
13966
+			left = vm.base;
13967
+			right = vm.x;
13968
+			top = vm.y - vm.height / 2;
13969
+			bottom = vm.y + vm.height / 2;
13970
+			signX = right > left ? 1 : -1;
13971
+			signY = 1;
13972
+			borderSkipped = vm.borderSkipped || 'left';
13973
+		}
13974
+
13975
+		// Canvas doesn't allow us to stroke inside the width so we can
13976
+		// adjust the sizes to fit if we're setting a stroke on the line
13977
+		if (borderWidth) {
13978
+			// borderWidth shold be less than bar width and bar height.
13979
+			var barSize = Math.min(Math.abs(left - right), Math.abs(top - bottom));
13980
+			borderWidth = borderWidth > barSize ? barSize : borderWidth;
13981
+			var halfStroke = borderWidth / 2;
13982
+			// Adjust borderWidth when bar top position is near vm.base(zero).
13983
+			var borderLeft = left + (borderSkipped !== 'left' ? halfStroke * signX : 0);
13984
+			var borderRight = right + (borderSkipped !== 'right' ? -halfStroke * signX : 0);
13985
+			var borderTop = top + (borderSkipped !== 'top' ? halfStroke * signY : 0);
13986
+			var borderBottom = bottom + (borderSkipped !== 'bottom' ? -halfStroke * signY : 0);
13987
+			// not become a vertical line?
13988
+			if (borderLeft !== borderRight) {
13989
+				top = borderTop;
13990
+				bottom = borderBottom;
13991
+			}
13992
+			// not become a horizontal line?
13993
+			if (borderTop !== borderBottom) {
13994
+				left = borderLeft;
13995
+				right = borderRight;
13996
+			}
13997
+		}
13998
+
13999
+		ctx.beginPath();
14000
+		ctx.fillStyle = vm.backgroundColor;
14001
+		ctx.strokeStyle = vm.borderColor;
14002
+		ctx.lineWidth = borderWidth;
14003
+
14004
+		// Corner points, from bottom-left to bottom-right clockwise
14005
+		// | 1 2 |
14006
+		// | 0 3 |
14007
+		var corners = [
14008
+			[left, bottom],
14009
+			[left, top],
14010
+			[right, top],
14011
+			[right, bottom]
14012
+		];
14013
+
14014
+		// Find first (starting) corner with fallback to 'bottom'
14015
+		var borders = ['bottom', 'left', 'top', 'right'];
14016
+		var startCorner = borders.indexOf(borderSkipped, 0);
14017
+		if (startCorner === -1) {
14018
+			startCorner = 0;
14019
+		}
14020
+
14021
+		function cornerAt(index) {
14022
+			return corners[(startCorner + index) % 4];
14023
+		}
14024
+
14025
+		// Draw rectangle from 'startCorner'
14026
+		var corner = cornerAt(0);
14027
+		ctx.moveTo(corner[0], corner[1]);
14028
+
14029
+		for (var i = 1; i < 4; i++) {
14030
+			corner = cornerAt(i);
14031
+			ctx.lineTo(corner[0], corner[1]);
14032
+		}
14033
+
14034
+		ctx.fill();
14035
+		if (borderWidth) {
14036
+			ctx.stroke();
14037
+		}
14038
+	},
14039
+
14040
+	height: function() {
14041
+		var vm = this._view;
14042
+		return vm.base - vm.y;
14043
+	},
14044
+
14045
+	inRange: function(mouseX, mouseY) {
14046
+		var inRange = false;
14047
+
14048
+		if (this._view) {
14049
+			var bounds = getBarBounds(this);
14050
+			inRange = mouseX >= bounds.left && mouseX <= bounds.right && mouseY >= bounds.top && mouseY <= bounds.bottom;
14051
+		}
14052
+
14053
+		return inRange;
14054
+	},
14055
+
14056
+	inLabelRange: function(mouseX, mouseY) {
14057
+		var me = this;
14058
+		if (!me._view) {
14059
+			return false;
14060
+		}
14061
+
14062
+		var inRange = false;
14063
+		var bounds = getBarBounds(me);
14064
+
14065
+		if (isVertical(me)) {
14066
+			inRange = mouseX >= bounds.left && mouseX <= bounds.right;
14067
+		} else {
14068
+			inRange = mouseY >= bounds.top && mouseY <= bounds.bottom;
14069
+		}
14070
+
14071
+		return inRange;
14072
+	},
14073
+
14074
+	inXRange: function(mouseX) {
14075
+		var bounds = getBarBounds(this);
14076
+		return mouseX >= bounds.left && mouseX <= bounds.right;
14077
+	},
14078
+
14079
+	inYRange: function(mouseY) {
14080
+		var bounds = getBarBounds(this);
14081
+		return mouseY >= bounds.top && mouseY <= bounds.bottom;
14082
+	},
14083
+
14084
+	getCenterPoint: function() {
14085
+		var vm = this._view;
14086
+		var x, y;
14087
+		if (isVertical(this)) {
14088
+			x = vm.x;
14089
+			y = (vm.y + vm.base) / 2;
14090
+		} else {
14091
+			x = (vm.x + vm.base) / 2;
14092
+			y = vm.y;
14093
+		}
14094
+
14095
+		return {x: x, y: y};
14096
+	},
14097
+
14098
+	getArea: function() {
14099
+		var vm = this._view;
14100
+		return vm.width * Math.abs(vm.y - vm.base);
14101
+	},
14102
+
14103
+	tooltipPosition: function() {
14104
+		var vm = this._view;
14105
+		return {
14106
+			x: vm.x,
14107
+			y: vm.y
14108
+		};
14109
+	}
14110
+});
14111
+
14112
+},{"25":25,"26":26}],40:[function(require,module,exports){
14113
+'use strict';
14114
+
14115
+module.exports = {};
14116
+module.exports.Arc = require(36);
14117
+module.exports.Line = require(37);
14118
+module.exports.Point = require(38);
14119
+module.exports.Rectangle = require(39);
14120
+
14121
+},{"36":36,"37":37,"38":38,"39":39}],41:[function(require,module,exports){
14122
+'use strict';
14123
+
14124
+var helpers = require(42);
14125
+
14126
+/**
14127
+ * @namespace Chart.helpers.canvas
14128
+ */
14129
+var exports = module.exports = {
14130
+	/**
14131
+	 * Clears the entire canvas associated to the given `chart`.
14132
+	 * @param {Chart} chart - The chart for which to clear the canvas.
14133
+	 */
14134
+	clear: function(chart) {
14135
+		chart.ctx.clearRect(0, 0, chart.width, chart.height);
14136
+	},
14137
+
14138
+	/**
14139
+	 * Creates a "path" for a rectangle with rounded corners at position (x, y) with a
14140
+	 * given size (width, height) and the same `radius` for all corners.
14141
+	 * @param {CanvasRenderingContext2D} ctx - The canvas 2D Context.
14142
+	 * @param {Number} x - The x axis of the coordinate for the rectangle starting point.
14143
+	 * @param {Number} y - The y axis of the coordinate for the rectangle starting point.
14144
+	 * @param {Number} width - The rectangle's width.
14145
+	 * @param {Number} height - The rectangle's height.
14146
+	 * @param {Number} radius - The rounded amount (in pixels) for the four corners.
14147
+	 * @todo handle `radius` as top-left, top-right, bottom-right, bottom-left array/object?
14148
+	 */
14149
+	roundedRect: function(ctx, x, y, width, height, radius) {
14150
+		if (radius) {
14151
+			var rx = Math.min(radius, width / 2);
14152
+			var ry = Math.min(radius, height / 2);
14153
+
14154
+			ctx.moveTo(x + rx, y);
14155
+			ctx.lineTo(x + width - rx, y);
14156
+			ctx.quadraticCurveTo(x + width, y, x + width, y + ry);
14157
+			ctx.lineTo(x + width, y + height - ry);
14158
+			ctx.quadraticCurveTo(x + width, y + height, x + width - rx, y + height);
14159
+			ctx.lineTo(x + rx, y + height);
14160
+			ctx.quadraticCurveTo(x, y + height, x, y + height - ry);
14161
+			ctx.lineTo(x, y + ry);
14162
+			ctx.quadraticCurveTo(x, y, x + rx, y);
14163
+		} else {
14164
+			ctx.rect(x, y, width, height);
14165
+		}
14166
+	},
14167
+
14168
+	drawPoint: function(ctx, style, radius, x, y) {
14169
+		var type, edgeLength, xOffset, yOffset, height, size;
14170
+
14171
+		if (style && typeof style === 'object') {
14172
+			type = style.toString();
14173
+			if (type === '[object HTMLImageElement]' || type === '[object HTMLCanvasElement]') {
14174
+				ctx.drawImage(style, x - style.width / 2, y - style.height / 2, style.width, style.height);
14175
+				return;
14176
+			}
14177
+		}
14178
+
14179
+		if (isNaN(radius) || radius <= 0) {
14180
+			return;
14181
+		}
14182
+
14183
+		switch (style) {
14184
+		// Default includes circle
14185
+		default:
14186
+			ctx.beginPath();
14187
+			ctx.arc(x, y, radius, 0, Math.PI * 2);
14188
+			ctx.closePath();
14189
+			ctx.fill();
14190
+			break;
14191
+		case 'triangle':
14192
+			ctx.beginPath();
14193
+			edgeLength = 3 * radius / Math.sqrt(3);
14194
+			height = edgeLength * Math.sqrt(3) / 2;
14195
+			ctx.moveTo(x - edgeLength / 2, y + height / 3);
14196
+			ctx.lineTo(x + edgeLength / 2, y + height / 3);
14197
+			ctx.lineTo(x, y - 2 * height / 3);
14198
+			ctx.closePath();
14199
+			ctx.fill();
14200
+			break;
14201
+		case 'rect':
14202
+			size = 1 / Math.SQRT2 * radius;
14203
+			ctx.beginPath();
14204
+			ctx.fillRect(x - size, y - size, 2 * size, 2 * size);
14205
+			ctx.strokeRect(x - size, y - size, 2 * size, 2 * size);
14206
+			break;
14207
+		case 'rectRounded':
14208
+			var offset = radius / Math.SQRT2;
14209
+			var leftX = x - offset;
14210
+			var topY = y - offset;
14211
+			var sideSize = Math.SQRT2 * radius;
14212
+			ctx.beginPath();
14213
+			this.roundedRect(ctx, leftX, topY, sideSize, sideSize, radius / 2);
14214
+			ctx.closePath();
14215
+			ctx.fill();
14216
+			break;
14217
+		case 'rectRot':
14218
+			size = 1 / Math.SQRT2 * radius;
14219
+			ctx.beginPath();
14220
+			ctx.moveTo(x - size, y);
14221
+			ctx.lineTo(x, y + size);
14222
+			ctx.lineTo(x + size, y);
14223
+			ctx.lineTo(x, y - size);
14224
+			ctx.closePath();
14225
+			ctx.fill();
14226
+			break;
14227
+		case 'cross':
14228
+			ctx.beginPath();
14229
+			ctx.moveTo(x, y + radius);
14230
+			ctx.lineTo(x, y - radius);
14231
+			ctx.moveTo(x - radius, y);
14232
+			ctx.lineTo(x + radius, y);
14233
+			ctx.closePath();
14234
+			break;
14235
+		case 'crossRot':
14236
+			ctx.beginPath();
14237
+			xOffset = Math.cos(Math.PI / 4) * radius;
14238
+			yOffset = Math.sin(Math.PI / 4) * radius;
14239
+			ctx.moveTo(x - xOffset, y - yOffset);
14240
+			ctx.lineTo(x + xOffset, y + yOffset);
14241
+			ctx.moveTo(x - xOffset, y + yOffset);
14242
+			ctx.lineTo(x + xOffset, y - yOffset);
14243
+			ctx.closePath();
14244
+			break;
14245
+		case 'star':
14246
+			ctx.beginPath();
14247
+			ctx.moveTo(x, y + radius);
14248
+			ctx.lineTo(x, y - radius);
14249
+			ctx.moveTo(x - radius, y);
14250
+			ctx.lineTo(x + radius, y);
14251
+			xOffset = Math.cos(Math.PI / 4) * radius;
14252
+			yOffset = Math.sin(Math.PI / 4) * radius;
14253
+			ctx.moveTo(x - xOffset, y - yOffset);
14254
+			ctx.lineTo(x + xOffset, y + yOffset);
14255
+			ctx.moveTo(x - xOffset, y + yOffset);
14256
+			ctx.lineTo(x + xOffset, y - yOffset);
14257
+			ctx.closePath();
14258
+			break;
14259
+		case 'line':
14260
+			ctx.beginPath();
14261
+			ctx.moveTo(x - radius, y);
14262
+			ctx.lineTo(x + radius, y);
14263
+			ctx.closePath();
14264
+			break;
14265
+		case 'dash':
14266
+			ctx.beginPath();
14267
+			ctx.moveTo(x, y);
14268
+			ctx.lineTo(x + radius, y);
14269
+			ctx.closePath();
14270
+			break;
14271
+		}
14272
+
14273
+		ctx.stroke();
14274
+	},
14275
+
14276
+	clipArea: function(ctx, area) {
14277
+		ctx.save();
14278
+		ctx.beginPath();
14279
+		ctx.rect(area.left, area.top, area.right - area.left, area.bottom - area.top);
14280
+		ctx.clip();
14281
+	},
14282
+
14283
+	unclipArea: function(ctx) {
14284
+		ctx.restore();
14285
+	},
14286
+
14287
+	lineTo: function(ctx, previous, target, flip) {
14288
+		if (target.steppedLine) {
14289
+			if ((target.steppedLine === 'after' && !flip) || (target.steppedLine !== 'after' && flip)) {
14290
+				ctx.lineTo(previous.x, target.y);
14291
+			} else {
14292
+				ctx.lineTo(target.x, previous.y);
14293
+			}
14294
+			ctx.lineTo(target.x, target.y);
14295
+			return;
14296
+		}
14297
+
14298
+		if (!target.tension) {
14299
+			ctx.lineTo(target.x, target.y);
14300
+			return;
14301
+		}
14302
+
14303
+		ctx.bezierCurveTo(
14304
+			flip ? previous.controlPointPreviousX : previous.controlPointNextX,
14305
+			flip ? previous.controlPointPreviousY : previous.controlPointNextY,
14306
+			flip ? target.controlPointNextX : target.controlPointPreviousX,
14307
+			flip ? target.controlPointNextY : target.controlPointPreviousY,
14308
+			target.x,
14309
+			target.y);
14310
+	}
14311
+};
14312
+
14313
+// DEPRECATIONS
14314
+
14315
+/**
14316
+ * Provided for backward compatibility, use Chart.helpers.canvas.clear instead.
14317
+ * @namespace Chart.helpers.clear
14318
+ * @deprecated since version 2.7.0
14319
+ * @todo remove at version 3
14320
+ * @private
14321
+ */
14322
+helpers.clear = exports.clear;
14323
+
14324
+/**
14325
+ * Provided for backward compatibility, use Chart.helpers.canvas.roundedRect instead.
14326
+ * @namespace Chart.helpers.drawRoundedRectangle
14327
+ * @deprecated since version 2.7.0
14328
+ * @todo remove at version 3
14329
+ * @private
14330
+ */
14331
+helpers.drawRoundedRectangle = function(ctx) {
14332
+	ctx.beginPath();
14333
+	exports.roundedRect.apply(exports, arguments);
14334
+	ctx.closePath();
14335
+};
14336
+
14337
+},{"42":42}],42:[function(require,module,exports){
14338
+'use strict';
14339
+
14340
+/**
14341
+ * @namespace Chart.helpers
14342
+ */
14343
+var helpers = {
14344
+	/**
14345
+	 * An empty function that can be used, for example, for optional callback.
14346
+	 */
14347
+	noop: function() {},
14348
+
14349
+	/**
14350
+	 * Returns a unique id, sequentially generated from a global variable.
14351
+	 * @returns {Number}
14352
+	 * @function
14353
+	 */
14354
+	uid: (function() {
14355
+		var id = 0;
14356
+		return function() {
14357
+			return id++;
14358
+		};
14359
+	}()),
14360
+
14361
+	/**
14362
+	 * Returns true if `value` is neither null nor undefined, else returns false.
14363
+	 * @param {*} value - The value to test.
14364
+	 * @returns {Boolean}
14365
+	 * @since 2.7.0
14366
+	 */
14367
+	isNullOrUndef: function(value) {
14368
+		return value === null || typeof value === 'undefined';
14369
+	},
14370
+
14371
+	/**
14372
+	 * Returns true if `value` is an array, else returns false.
14373
+	 * @param {*} value - The value to test.
14374
+	 * @returns {Boolean}
14375
+	 * @function
14376
+	 */
14377
+	isArray: Array.isArray ? Array.isArray : function(value) {
14378
+		return Object.prototype.toString.call(value) === '[object Array]';
14379
+	},
14380
+
14381
+	/**
14382
+	 * Returns true if `value` is an object (excluding null), else returns false.
14383
+	 * @param {*} value - The value to test.
14384
+	 * @returns {Boolean}
14385
+	 * @since 2.7.0
14386
+	 */
14387
+	isObject: function(value) {
14388
+		return value !== null && Object.prototype.toString.call(value) === '[object Object]';
14389
+	},
14390
+
14391
+	/**
14392
+	 * Returns `value` if defined, else returns `defaultValue`.
14393
+	 * @param {*} value - The value to return if defined.
14394
+	 * @param {*} defaultValue - The value to return if `value` is undefined.
14395
+	 * @returns {*}
14396
+	 */
14397
+	valueOrDefault: function(value, defaultValue) {
14398
+		return typeof value === 'undefined' ? defaultValue : value;
14399
+	},
14400
+
14401
+	/**
14402
+	 * Returns value at the given `index` in array if defined, else returns `defaultValue`.
14403
+	 * @param {Array} value - The array to lookup for value at `index`.
14404
+	 * @param {Number} index - The index in `value` to lookup for value.
14405
+	 * @param {*} defaultValue - The value to return if `value[index]` is undefined.
14406
+	 * @returns {*}
14407
+	 */
14408
+	valueAtIndexOrDefault: function(value, index, defaultValue) {
14409
+		return helpers.valueOrDefault(helpers.isArray(value) ? value[index] : value, defaultValue);
14410
+	},
14411
+
14412
+	/**
14413
+	 * Calls `fn` with the given `args` in the scope defined by `thisArg` and returns the
14414
+	 * value returned by `fn`. If `fn` is not a function, this method returns undefined.
14415
+	 * @param {Function} fn - The function to call.
14416
+	 * @param {Array|undefined|null} args - The arguments with which `fn` should be called.
14417
+	 * @param {Object} [thisArg] - The value of `this` provided for the call to `fn`.
14418
+	 * @returns {*}
14419
+	 */
14420
+	callback: function(fn, args, thisArg) {
14421
+		if (fn && typeof fn.call === 'function') {
14422
+			return fn.apply(thisArg, args);
14423
+		}
14424
+	},
14425
+
14426
+	/**
14427
+	 * Note(SB) for performance sake, this method should only be used when loopable type
14428
+	 * is unknown or in none intensive code (not called often and small loopable). Else
14429
+	 * it's preferable to use a regular for() loop and save extra function calls.
14430
+	 * @param {Object|Array} loopable - The object or array to be iterated.
14431
+	 * @param {Function} fn - The function to call for each item.
14432
+	 * @param {Object} [thisArg] - The value of `this` provided for the call to `fn`.
14433
+	 * @param {Boolean} [reverse] - If true, iterates backward on the loopable.
14434
+	 */
14435
+	each: function(loopable, fn, thisArg, reverse) {
14436
+		var i, len, keys;
14437
+		if (helpers.isArray(loopable)) {
14438
+			len = loopable.length;
14439
+			if (reverse) {
14440
+				for (i = len - 1; i >= 0; i--) {
14441
+					fn.call(thisArg, loopable[i], i);
14442
+				}
14443
+			} else {
14444
+				for (i = 0; i < len; i++) {
14445
+					fn.call(thisArg, loopable[i], i);
14446
+				}
14447
+			}
14448
+		} else if (helpers.isObject(loopable)) {
14449
+			keys = Object.keys(loopable);
14450
+			len = keys.length;
14451
+			for (i = 0; i < len; i++) {
14452
+				fn.call(thisArg, loopable[keys[i]], keys[i]);
14453
+			}
14454
+		}
14455
+	},
14456
+
14457
+	/**
14458
+	 * Returns true if the `a0` and `a1` arrays have the same content, else returns false.
14459
+	 * @see http://stackoverflow.com/a/14853974
14460
+	 * @param {Array} a0 - The array to compare
14461
+	 * @param {Array} a1 - The array to compare
14462
+	 * @returns {Boolean}
14463
+	 */
14464
+	arrayEquals: function(a0, a1) {
14465
+		var i, ilen, v0, v1;
14466
+
14467
+		if (!a0 || !a1 || a0.length !== a1.length) {
14468
+			return false;
14469
+		}
14470
+
14471
+		for (i = 0, ilen = a0.length; i < ilen; ++i) {
14472
+			v0 = a0[i];
14473
+			v1 = a1[i];
14474
+
14475
+			if (v0 instanceof Array && v1 instanceof Array) {
14476
+				if (!helpers.arrayEquals(v0, v1)) {
14477
+					return false;
14478
+				}
14479
+			} else if (v0 !== v1) {
14480
+				// NOTE: two different object instances will never be equal: {x:20} != {x:20}
14481
+				return false;
14482
+			}
14483
+		}
14484
+
14485
+		return true;
14486
+	},
14487
+
14488
+	/**
14489
+	 * Returns a deep copy of `source` without keeping references on objects and arrays.
14490
+	 * @param {*} source - The value to clone.
14491
+	 * @returns {*}
14492
+	 */
14493
+	clone: function(source) {
14494
+		if (helpers.isArray(source)) {
14495
+			return source.map(helpers.clone);
14496
+		}
14497
+
14498
+		if (helpers.isObject(source)) {
14499
+			var target = {};
14500
+			var keys = Object.keys(source);
14501
+			var klen = keys.length;
14502
+			var k = 0;
14503
+
14504
+			for (; k < klen; ++k) {
14505
+				target[keys[k]] = helpers.clone(source[keys[k]]);
14506
+			}
14507
+
14508
+			return target;
14509
+		}
14510
+
14511
+		return source;
14512
+	},
14513
+
14514
+	/**
14515
+	 * The default merger when Chart.helpers.merge is called without merger option.
14516
+	 * Note(SB): this method is also used by configMerge and scaleMerge as fallback.
14517
+	 * @private
14518
+	 */
14519
+	_merger: function(key, target, source, options) {
14520
+		var tval = target[key];
14521
+		var sval = source[key];
14522
+
14523
+		if (helpers.isObject(tval) && helpers.isObject(sval)) {
14524
+			helpers.merge(tval, sval, options);
14525
+		} else {
14526
+			target[key] = helpers.clone(sval);
14527
+		}
14528
+	},
14529
+
14530
+	/**
14531
+	 * Merges source[key] in target[key] only if target[key] is undefined.
14532
+	 * @private
14533
+	 */
14534
+	_mergerIf: function(key, target, source) {
14535
+		var tval = target[key];
14536
+		var sval = source[key];
14537
+
14538
+		if (helpers.isObject(tval) && helpers.isObject(sval)) {
14539
+			helpers.mergeIf(tval, sval);
14540
+		} else if (!target.hasOwnProperty(key)) {
14541
+			target[key] = helpers.clone(sval);
14542
+		}
14543
+	},
14544
+
14545
+	/**
14546
+	 * Recursively deep copies `source` properties into `target` with the given `options`.
14547
+	 * IMPORTANT: `target` is not cloned and will be updated with `source` properties.
14548
+	 * @param {Object} target - The target object in which all sources are merged into.
14549
+	 * @param {Object|Array(Object)} source - Object(s) to merge into `target`.
14550
+	 * @param {Object} [options] - Merging options:
14551
+	 * @param {Function} [options.merger] - The merge method (key, target, source, options)
14552
+	 * @returns {Object} The `target` object.
14553
+	 */
14554
+	merge: function(target, source, options) {
14555
+		var sources = helpers.isArray(source) ? source : [source];
14556
+		var ilen = sources.length;
14557
+		var merge, i, keys, klen, k;
14558
+
14559
+		if (!helpers.isObject(target)) {
14560
+			return target;
14561
+		}
14562
+
14563
+		options = options || {};
14564
+		merge = options.merger || helpers._merger;
14565
+
14566
+		for (i = 0; i < ilen; ++i) {
14567
+			source = sources[i];
14568
+			if (!helpers.isObject(source)) {
14569
+				continue;
14570
+			}
14571
+
14572
+			keys = Object.keys(source);
14573
+			for (k = 0, klen = keys.length; k < klen; ++k) {
14574
+				merge(keys[k], target, source, options);
14575
+			}
14576
+		}
14577
+
14578
+		return target;
14579
+	},
14580
+
14581
+	/**
14582
+	 * Recursively deep copies `source` properties into `target` *only* if not defined in target.
14583
+	 * IMPORTANT: `target` is not cloned and will be updated with `source` properties.
14584
+	 * @param {Object} target - The target object in which all sources are merged into.
14585
+	 * @param {Object|Array(Object)} source - Object(s) to merge into `target`.
14586
+	 * @returns {Object} The `target` object.
14587
+	 */
14588
+	mergeIf: function(target, source) {
14589
+		return helpers.merge(target, source, {merger: helpers._mergerIf});
14590
+	},
14591
+
14592
+	/**
14593
+	 * Applies the contents of two or more objects together into the first object.
14594
+	 * @param {Object} target - The target object in which all objects are merged into.
14595
+	 * @param {Object} arg1 - Object containing additional properties to merge in target.
14596
+	 * @param {Object} argN - Additional objects containing properties to merge in target.
14597
+	 * @returns {Object} The `target` object.
14598
+	 */
14599
+	extend: function(target) {
14600
+		var setFn = function(value, key) {
14601
+			target[key] = value;
14602
+		};
14603
+		for (var i = 1, ilen = arguments.length; i < ilen; ++i) {
14604
+			helpers.each(arguments[i], setFn);
14605
+		}
14606
+		return target;
14607
+	},
14608
+
14609
+	/**
14610
+	 * Basic javascript inheritance based on the model created in Backbone.js
14611
+	 */
14612
+	inherits: function(extensions) {
14613
+		var me = this;
14614
+		var ChartElement = (extensions && extensions.hasOwnProperty('constructor')) ? extensions.constructor : function() {
14615
+			return me.apply(this, arguments);
14616
+		};
14617
+
14618
+		var Surrogate = function() {
14619
+			this.constructor = ChartElement;
14620
+		};
14621
+
14622
+		Surrogate.prototype = me.prototype;
14623
+		ChartElement.prototype = new Surrogate();
14624
+		ChartElement.extend = helpers.inherits;
14625
+
14626
+		if (extensions) {
14627
+			helpers.extend(ChartElement.prototype, extensions);
14628
+		}
14629
+
14630
+		ChartElement.__super__ = me.prototype;
14631
+		return ChartElement;
14632
+	}
14633
+};
14634
+
14635
+module.exports = helpers;
14636
+
14637
+// DEPRECATIONS
14638
+
14639
+/**
14640
+ * Provided for backward compatibility, use Chart.helpers.callback instead.
14641
+ * @function Chart.helpers.callCallback
14642
+ * @deprecated since version 2.6.0
14643
+ * @todo remove at version 3
14644
+ * @private
14645
+ */
14646
+helpers.callCallback = helpers.callback;
14647
+
14648
+/**
14649
+ * Provided for backward compatibility, use Array.prototype.indexOf instead.
14650
+ * Array.prototype.indexOf compatibility: Chrome, Opera, Safari, FF1.5+, IE9+
14651
+ * @function Chart.helpers.indexOf
14652
+ * @deprecated since version 2.7.0
14653
+ * @todo remove at version 3
14654
+ * @private
14655
+ */
14656
+helpers.indexOf = function(array, item, fromIndex) {
14657
+	return Array.prototype.indexOf.call(array, item, fromIndex);
14658
+};
14659
+
14660
+/**
14661
+ * Provided for backward compatibility, use Chart.helpers.valueOrDefault instead.
14662
+ * @function Chart.helpers.getValueOrDefault
14663
+ * @deprecated since version 2.7.0
14664
+ * @todo remove at version 3
14665
+ * @private
14666
+ */
14667
+helpers.getValueOrDefault = helpers.valueOrDefault;
14668
+
14669
+/**
14670
+ * Provided for backward compatibility, use Chart.helpers.valueAtIndexOrDefault instead.
14671
+ * @function Chart.helpers.getValueAtIndexOrDefault
14672
+ * @deprecated since version 2.7.0
14673
+ * @todo remove at version 3
14674
+ * @private
14675
+ */
14676
+helpers.getValueAtIndexOrDefault = helpers.valueAtIndexOrDefault;
14677
+
14678
+},{}],43:[function(require,module,exports){
14679
+'use strict';
14680
+
14681
+var helpers = require(42);
14682
+
14683
+/**
14684
+ * Easing functions adapted from Robert Penner's easing equations.
14685
+ * @namespace Chart.helpers.easingEffects
14686
+ * @see http://www.robertpenner.com/easing/
14687
+ */
14688
+var effects = {
14689
+	linear: function(t) {
14690
+		return t;
14691
+	},
14692
+
14693
+	easeInQuad: function(t) {
14694
+		return t * t;
14695
+	},
14696
+
14697
+	easeOutQuad: function(t) {
14698
+		return -t * (t - 2);
14699
+	},
14700
+
14701
+	easeInOutQuad: function(t) {
14702
+		if ((t /= 0.5) < 1) {
14703
+			return 0.5 * t * t;
14704
+		}
14705
+		return -0.5 * ((--t) * (t - 2) - 1);
14706
+	},
14707
+
14708
+	easeInCubic: function(t) {
14709
+		return t * t * t;
14710
+	},
14711
+
14712
+	easeOutCubic: function(t) {
14713
+		return (t = t - 1) * t * t + 1;
14714
+	},
14715
+
14716
+	easeInOutCubic: function(t) {
14717
+		if ((t /= 0.5) < 1) {
14718
+			return 0.5 * t * t * t;
14719
+		}
14720
+		return 0.5 * ((t -= 2) * t * t + 2);
14721
+	},
14722
+
14723
+	easeInQuart: function(t) {
14724
+		return t * t * t * t;
14725
+	},
14726
+
14727
+	easeOutQuart: function(t) {
14728
+		return -((t = t - 1) * t * t * t - 1);
14729
+	},
14730
+
14731
+	easeInOutQuart: function(t) {
14732
+		if ((t /= 0.5) < 1) {
14733
+			return 0.5 * t * t * t * t;
14734
+		}
14735
+		return -0.5 * ((t -= 2) * t * t * t - 2);
14736
+	},
14737
+
14738
+	easeInQuint: function(t) {
14739
+		return t * t * t * t * t;
14740
+	},
14741
+
14742
+	easeOutQuint: function(t) {
14743
+		return (t = t - 1) * t * t * t * t + 1;
14744
+	},
14745
+
14746
+	easeInOutQuint: function(t) {
14747
+		if ((t /= 0.5) < 1) {
14748
+			return 0.5 * t * t * t * t * t;
14749
+		}
14750
+		return 0.5 * ((t -= 2) * t * t * t * t + 2);
14751
+	},
14752
+
14753
+	easeInSine: function(t) {
14754
+		return -Math.cos(t * (Math.PI / 2)) + 1;
14755
+	},
14756
+
14757
+	easeOutSine: function(t) {
14758
+		return Math.sin(t * (Math.PI / 2));
14759
+	},
14760
+
14761
+	easeInOutSine: function(t) {
14762
+		return -0.5 * (Math.cos(Math.PI * t) - 1);
14763
+	},
14764
+
14765
+	easeInExpo: function(t) {
14766
+		return (t === 0) ? 0 : Math.pow(2, 10 * (t - 1));
14767
+	},
14768
+
14769
+	easeOutExpo: function(t) {
14770
+		return (t === 1) ? 1 : -Math.pow(2, -10 * t) + 1;
14771
+	},
14772
+
14773
+	easeInOutExpo: function(t) {
14774
+		if (t === 0) {
14775
+			return 0;
14776
+		}
14777
+		if (t === 1) {
14778
+			return 1;
14779
+		}
14780
+		if ((t /= 0.5) < 1) {
14781
+			return 0.5 * Math.pow(2, 10 * (t - 1));
14782
+		}
14783
+		return 0.5 * (-Math.pow(2, -10 * --t) + 2);
14784
+	},
14785
+
14786
+	easeInCirc: function(t) {
14787
+		if (t >= 1) {
14788
+			return t;
14789
+		}
14790
+		return -(Math.sqrt(1 - t * t) - 1);
14791
+	},
14792
+
14793
+	easeOutCirc: function(t) {
14794
+		return Math.sqrt(1 - (t = t - 1) * t);
14795
+	},
14796
+
14797
+	easeInOutCirc: function(t) {
14798
+		if ((t /= 0.5) < 1) {
14799
+			return -0.5 * (Math.sqrt(1 - t * t) - 1);
14800
+		}
14801
+		return 0.5 * (Math.sqrt(1 - (t -= 2) * t) + 1);
14802
+	},
14803
+
14804
+	easeInElastic: function(t) {
14805
+		var s = 1.70158;
14806
+		var p = 0;
14807
+		var a = 1;
14808
+		if (t === 0) {
14809
+			return 0;
14810
+		}
14811
+		if (t === 1) {
14812
+			return 1;
14813
+		}
14814
+		if (!p) {
14815
+			p = 0.3;
14816
+		}
14817
+		if (a < 1) {
14818
+			a = 1;
14819
+			s = p / 4;
14820
+		} else {
14821
+			s = p / (2 * Math.PI) * Math.asin(1 / a);
14822
+		}
14823
+		return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t - s) * (2 * Math.PI) / p));
14824
+	},
14825
+
14826
+	easeOutElastic: function(t) {
14827
+		var s = 1.70158;
14828
+		var p = 0;
14829
+		var a = 1;
14830
+		if (t === 0) {
14831
+			return 0;
14832
+		}
14833
+		if (t === 1) {
14834
+			return 1;
14835
+		}
14836
+		if (!p) {
14837
+			p = 0.3;
14838
+		}
14839
+		if (a < 1) {
14840
+			a = 1;
14841
+			s = p / 4;
14842
+		} else {
14843
+			s = p / (2 * Math.PI) * Math.asin(1 / a);
14844
+		}
14845
+		return a * Math.pow(2, -10 * t) * Math.sin((t - s) * (2 * Math.PI) / p) + 1;
14846
+	},
14847
+
14848
+	easeInOutElastic: function(t) {
14849
+		var s = 1.70158;
14850
+		var p = 0;
14851
+		var a = 1;
14852
+		if (t === 0) {
14853
+			return 0;
14854
+		}
14855
+		if ((t /= 0.5) === 2) {
14856
+			return 1;
14857
+		}
14858
+		if (!p) {
14859
+			p = 0.45;
14860
+		}
14861
+		if (a < 1) {
14862
+			a = 1;
14863
+			s = p / 4;
14864
+		} else {
14865
+			s = p / (2 * Math.PI) * Math.asin(1 / a);
14866
+		}
14867
+		if (t < 1) {
14868
+			return -0.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t - s) * (2 * Math.PI) / p));
14869
+		}
14870
+		return a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t - s) * (2 * Math.PI) / p) * 0.5 + 1;
14871
+	},
14872
+	easeInBack: function(t) {
14873
+		var s = 1.70158;
14874
+		return t * t * ((s + 1) * t - s);
14875
+	},
14876
+
14877
+	easeOutBack: function(t) {
14878
+		var s = 1.70158;
14879
+		return (t = t - 1) * t * ((s + 1) * t + s) + 1;
14880
+	},
14881
+
14882
+	easeInOutBack: function(t) {
14883
+		var s = 1.70158;
14884
+		if ((t /= 0.5) < 1) {
14885
+			return 0.5 * (t * t * (((s *= (1.525)) + 1) * t - s));
14886
+		}
14887
+		return 0.5 * ((t -= 2) * t * (((s *= (1.525)) + 1) * t + s) + 2);
14888
+	},
14889
+
14890
+	easeInBounce: function(t) {
14891
+		return 1 - effects.easeOutBounce(1 - t);
14892
+	},
14893
+
14894
+	easeOutBounce: function(t) {
14895
+		if (t < (1 / 2.75)) {
14896
+			return 7.5625 * t * t;
14897
+		}
14898
+		if (t < (2 / 2.75)) {
14899
+			return 7.5625 * (t -= (1.5 / 2.75)) * t + 0.75;
14900
+		}
14901
+		if (t < (2.5 / 2.75)) {
14902
+			return 7.5625 * (t -= (2.25 / 2.75)) * t + 0.9375;
14903
+		}
14904
+		return 7.5625 * (t -= (2.625 / 2.75)) * t + 0.984375;
14905
+	},
14906
+
14907
+	easeInOutBounce: function(t) {
14908
+		if (t < 0.5) {
14909
+			return effects.easeInBounce(t * 2) * 0.5;
14910
+		}
14911
+		return effects.easeOutBounce(t * 2 - 1) * 0.5 + 0.5;
14912
+	}
14913
+};
14914
+
14915
+module.exports = {
14916
+	effects: effects
14917
+};
14918
+
14919
+// DEPRECATIONS
14920
+
14921
+/**
14922
+ * Provided for backward compatibility, use Chart.helpers.easing.effects instead.
14923
+ * @function Chart.helpers.easingEffects
14924
+ * @deprecated since version 2.7.0
14925
+ * @todo remove at version 3
14926
+ * @private
14927
+ */
14928
+helpers.easingEffects = effects;
14929
+
14930
+},{"42":42}],44:[function(require,module,exports){
14931
+'use strict';
14932
+
14933
+var helpers = require(42);
14934
+
14935
+/**
14936
+ * @alias Chart.helpers.options
14937
+ * @namespace
14938
+ */
14939
+module.exports = {
14940
+	/**
14941
+	 * Converts the given line height `value` in pixels for a specific font `size`.
14942
+	 * @param {Number|String} value - The lineHeight to parse (eg. 1.6, '14px', '75%', '1.6em').
14943
+	 * @param {Number} size - The font size (in pixels) used to resolve relative `value`.
14944
+	 * @returns {Number} The effective line height in pixels (size * 1.2 if value is invalid).
14945
+	 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/line-height
14946
+	 * @since 2.7.0
14947
+	 */
14948
+	toLineHeight: function(value, size) {
14949
+		var matches = ('' + value).match(/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/);
14950
+		if (!matches || matches[1] === 'normal') {
14951
+			return size * 1.2;
14952
+		}
14953
+
14954
+		value = +matches[2];
14955
+
14956
+		switch (matches[3]) {
14957
+		case 'px':
14958
+			return value;
14959
+		case '%':
14960
+			value /= 100;
14961
+			break;
14962
+		default:
14963
+			break;
14964
+		}
14965
+
14966
+		return size * value;
14967
+	},
14968
+
14969
+	/**
14970
+	 * Converts the given value into a padding object with pre-computed width/height.
14971
+	 * @param {Number|Object} value - If a number, set the value to all TRBL component,
14972
+	 *  else, if and object, use defined properties and sets undefined ones to 0.
14973
+	 * @returns {Object} The padding values (top, right, bottom, left, width, height)
14974
+	 * @since 2.7.0
14975
+	 */
14976
+	toPadding: function(value) {
14977
+		var t, r, b, l;
14978
+
14979
+		if (helpers.isObject(value)) {
14980
+			t = +value.top || 0;
14981
+			r = +value.right || 0;
14982
+			b = +value.bottom || 0;
14983
+			l = +value.left || 0;
14984
+		} else {
14985
+			t = r = b = l = +value || 0;
14986
+		}
14987
+
14988
+		return {
14989
+			top: t,
14990
+			right: r,
14991
+			bottom: b,
14992
+			left: l,
14993
+			height: t + b,
14994
+			width: l + r
14995
+		};
14996
+	},
14997
+
14998
+	/**
14999
+	 * Evaluates the given `inputs` sequentially and returns the first defined value.
15000
+	 * @param {Array[]} inputs - An array of values, falling back to the last value.
15001
+	 * @param {Object} [context] - If defined and the current value is a function, the value
15002
+	 * is called with `context` as first argument and the result becomes the new input.
15003
+	 * @param {Number} [index] - If defined and the current value is an array, the value
15004
+	 * at `index` become the new input.
15005
+	 * @since 2.7.0
15006
+	 */
15007
+	resolve: function(inputs, context, index) {
15008
+		var i, ilen, value;
15009
+
15010
+		for (i = 0, ilen = inputs.length; i < ilen; ++i) {
15011
+			value = inputs[i];
15012
+			if (value === undefined) {
15013
+				continue;
15014
+			}
15015
+			if (context !== undefined && typeof value === 'function') {
15016
+				value = value(context);
15017
+			}
15018
+			if (index !== undefined && helpers.isArray(value)) {
15019
+				value = value[index];
15020
+			}
15021
+			if (value !== undefined) {
15022
+				return value;
15023
+			}
15024
+		}
15025
+	}
15026
+};
15027
+
15028
+},{"42":42}],45:[function(require,module,exports){
15029
+'use strict';
15030
+
15031
+module.exports = require(42);
15032
+module.exports.easing = require(43);
15033
+module.exports.canvas = require(41);
15034
+module.exports.options = require(44);
15035
+
15036
+},{"41":41,"42":42,"43":43,"44":44}],46:[function(require,module,exports){
15037
+/**
15038
+ * Platform fallback implementation (minimal).
15039
+ * @see https://github.com/chartjs/Chart.js/pull/4591#issuecomment-319575939
15040
+ */
15041
+
15042
+module.exports = {
15043
+	acquireContext: function(item) {
15044
+		if (item && item.canvas) {
15045
+			// Support for any object associated to a canvas (including a context2d)
15046
+			item = item.canvas;
15047
+		}
15048
+
15049
+		return item && item.getContext('2d') || null;
15050
+	}
15051
+};
15052
+
15053
+},{}],47:[function(require,module,exports){
15054
+/**
15055
+ * Chart.Platform implementation for targeting a web browser
15056
+ */
15057
+
15058
+'use strict';
15059
+
15060
+var helpers = require(45);
15061
+
15062
+var EXPANDO_KEY = '$chartjs';
15063
+var CSS_PREFIX = 'chartjs-';
15064
+var CSS_RENDER_MONITOR = CSS_PREFIX + 'render-monitor';
15065
+var CSS_RENDER_ANIMATION = CSS_PREFIX + 'render-animation';
15066
+var ANIMATION_START_EVENTS = ['animationstart', 'webkitAnimationStart'];
15067
+
15068
+/**
15069
+ * DOM event types -> Chart.js event types.
15070
+ * Note: only events with different types are mapped.
15071
+ * @see https://developer.mozilla.org/en-US/docs/Web/Events
15072
+ */
15073
+var EVENT_TYPES = {
15074
+	touchstart: 'mousedown',
15075
+	touchmove: 'mousemove',
15076
+	touchend: 'mouseup',
15077
+	pointerenter: 'mouseenter',
15078
+	pointerdown: 'mousedown',
15079
+	pointermove: 'mousemove',
15080
+	pointerup: 'mouseup',
15081
+	pointerleave: 'mouseout',
15082
+	pointerout: 'mouseout'
15083
+};
15084
+
15085
+/**
15086
+ * The "used" size is the final value of a dimension property after all calculations have
15087
+ * been performed. This method uses the computed style of `element` but returns undefined
15088
+ * if the computed style is not expressed in pixels. That can happen in some cases where
15089
+ * `element` has a size relative to its parent and this last one is not yet displayed,
15090
+ * for example because of `display: none` on a parent node.
15091
+ * @see https://developer.mozilla.org/en-US/docs/Web/CSS/used_value
15092
+ * @returns {Number} Size in pixels or undefined if unknown.
15093
+ */
15094
+function readUsedSize(element, property) {
15095
+	var value = helpers.getStyle(element, property);
15096
+	var matches = value && value.match(/^(\d+)(\.\d+)?px$/);
15097
+	return matches ? Number(matches[1]) : undefined;
15098
+}
15099
+
15100
+/**
15101
+ * Initializes the canvas style and render size without modifying the canvas display size,
15102
+ * since responsiveness is handled by the controller.resize() method. The config is used
15103
+ * to determine the aspect ratio to apply in case no explicit height has been specified.
15104
+ */
15105
+function initCanvas(canvas, config) {
15106
+	var style = canvas.style;
15107
+
15108
+	// NOTE(SB) canvas.getAttribute('width') !== canvas.width: in the first case it
15109
+	// returns null or '' if no explicit value has been set to the canvas attribute.
15110
+	var renderHeight = canvas.getAttribute('height');
15111
+	var renderWidth = canvas.getAttribute('width');
15112
+
15113
+	// Chart.js modifies some canvas values that we want to restore on destroy
15114
+	canvas[EXPANDO_KEY] = {
15115
+		initial: {
15116
+			height: renderHeight,
15117
+			width: renderWidth,
15118
+			style: {
15119
+				display: style.display,
15120
+				height: style.height,
15121
+				width: style.width
15122
+			}
15123
+		}
15124
+	};
15125
+
15126
+	// Force canvas to display as block to avoid extra space caused by inline
15127
+	// elements, which would interfere with the responsive resize process.
15128
+	// https://github.com/chartjs/Chart.js/issues/2538
15129
+	style.display = style.display || 'block';
15130
+
15131
+	if (renderWidth === null || renderWidth === '') {
15132
+		var displayWidth = readUsedSize(canvas, 'width');
15133
+		if (displayWidth !== undefined) {
15134
+			canvas.width = displayWidth;
15135
+		}
15136
+	}
15137
+
15138
+	if (renderHeight === null || renderHeight === '') {
15139
+		if (canvas.style.height === '') {
15140
+			// If no explicit render height and style height, let's apply the aspect ratio,
15141
+			// which one can be specified by the user but also by charts as default option
15142
+			// (i.e. options.aspectRatio). If not specified, use canvas aspect ratio of 2.
15143
+			canvas.height = canvas.width / (config.options.aspectRatio || 2);
15144
+		} else {
15145
+			var displayHeight = readUsedSize(canvas, 'height');
15146
+			if (displayWidth !== undefined) {
15147
+				canvas.height = displayHeight;
15148
+			}
15149
+		}
15150
+	}
15151
+
15152
+	return canvas;
15153
+}
15154
+
15155
+/**
15156
+ * Detects support for options object argument in addEventListener.
15157
+ * https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Safely_detecting_option_support
15158
+ * @private
15159
+ */
15160
+var supportsEventListenerOptions = (function() {
15161
+	var supports = false;
15162
+	try {
15163
+		var options = Object.defineProperty({}, 'passive', {
15164
+			get: function() {
15165
+				supports = true;
15166
+			}
15167
+		});
15168
+		window.addEventListener('e', null, options);
15169
+	} catch (e) {
15170
+		// continue regardless of error
15171
+	}
15172
+	return supports;
15173
+}());
15174
+
15175
+// Default passive to true as expected by Chrome for 'touchstart' and 'touchend' events.
15176
+// https://github.com/chartjs/Chart.js/issues/4287
15177
+var eventListenerOptions = supportsEventListenerOptions ? {passive: true} : false;
15178
+
15179
+function addEventListener(node, type, listener) {
15180
+	node.addEventListener(type, listener, eventListenerOptions);
15181
+}
15182
+
15183
+function removeEventListener(node, type, listener) {
15184
+	node.removeEventListener(type, listener, eventListenerOptions);
15185
+}
15186
+
15187
+function createEvent(type, chart, x, y, nativeEvent) {
15188
+	return {
15189
+		type: type,
15190
+		chart: chart,
15191
+		native: nativeEvent || null,
15192
+		x: x !== undefined ? x : null,
15193
+		y: y !== undefined ? y : null,
15194
+	};
15195
+}
15196
+
15197
+function fromNativeEvent(event, chart) {
15198
+	var type = EVENT_TYPES[event.type] || event.type;
15199
+	var pos = helpers.getRelativePosition(event, chart);
15200
+	return createEvent(type, chart, pos.x, pos.y, event);
15201
+}
15202
+
15203
+function throttled(fn, thisArg) {
15204
+	var ticking = false;
15205
+	var args = [];
15206
+
15207
+	return function() {
15208
+		args = Array.prototype.slice.call(arguments);
15209
+		thisArg = thisArg || this;
15210
+
15211
+		if (!ticking) {
15212
+			ticking = true;
15213
+			helpers.requestAnimFrame.call(window, function() {
15214
+				ticking = false;
15215
+				fn.apply(thisArg, args);
15216
+			});
15217
+		}
15218
+	};
15219
+}
15220
+
15221
+// Implementation based on https://github.com/marcj/css-element-queries
15222
+function createResizer(handler) {
15223
+	var resizer = document.createElement('div');
15224
+	var cls = CSS_PREFIX + 'size-monitor';
15225
+	var maxSize = 1000000;
15226
+	var style =
15227
+		'position:absolute;' +
15228
+		'left:0;' +
15229
+		'top:0;' +
15230
+		'right:0;' +
15231
+		'bottom:0;' +
15232
+		'overflow:hidden;' +
15233
+		'pointer-events:none;' +
15234
+		'visibility:hidden;' +
15235
+		'z-index:-1;';
15236
+
15237
+	resizer.style.cssText = style;
15238
+	resizer.className = cls;
15239
+	resizer.innerHTML =
15240
+		'<div class="' + cls + '-expand" style="' + style + '">' +
15241
+			'<div style="' +
15242
+				'position:absolute;' +
15243
+				'width:' + maxSize + 'px;' +
15244
+				'height:' + maxSize + 'px;' +
15245
+				'left:0;' +
15246
+				'top:0">' +
15247
+			'</div>' +
15248
+		'</div>' +
15249
+		'<div class="' + cls + '-shrink" style="' + style + '">' +
15250
+			'<div style="' +
15251
+				'position:absolute;' +
15252
+				'width:200%;' +
15253
+				'height:200%;' +
15254
+				'left:0; ' +
15255
+				'top:0">' +
15256
+			'</div>' +
15257
+		'</div>';
15258
+
15259
+	var expand = resizer.childNodes[0];
15260
+	var shrink = resizer.childNodes[1];
15261
+
15262
+	resizer._reset = function() {
15263
+		expand.scrollLeft = maxSize;
15264
+		expand.scrollTop = maxSize;
15265
+		shrink.scrollLeft = maxSize;
15266
+		shrink.scrollTop = maxSize;
15267
+	};
15268
+	var onScroll = function() {
15269
+		resizer._reset();
15270
+		handler();
15271
+	};
15272
+
15273
+	addEventListener(expand, 'scroll', onScroll.bind(expand, 'expand'));
15274
+	addEventListener(shrink, 'scroll', onScroll.bind(shrink, 'shrink'));
15275
+
15276
+	return resizer;
15277
+}
15278
+
15279
+// https://davidwalsh.name/detect-node-insertion
15280
+function watchForRender(node, handler) {
15281
+	var expando = node[EXPANDO_KEY] || (node[EXPANDO_KEY] = {});
15282
+	var proxy = expando.renderProxy = function(e) {
15283
+		if (e.animationName === CSS_RENDER_ANIMATION) {
15284
+			handler();
15285
+		}
15286
+	};
15287
+
15288
+	helpers.each(ANIMATION_START_EVENTS, function(type) {
15289
+		addEventListener(node, type, proxy);
15290
+	});
15291
+
15292
+	// #4737: Chrome might skip the CSS animation when the CSS_RENDER_MONITOR class
15293
+	// is removed then added back immediately (same animation frame?). Accessing the
15294
+	// `offsetParent` property will force a reflow and re-evaluate the CSS animation.
15295
+	// https://gist.github.com/paulirish/5d52fb081b3570c81e3a#box-metrics
15296
+	// https://github.com/chartjs/Chart.js/issues/4737
15297
+	expando.reflow = !!node.offsetParent;
15298
+
15299
+	node.classList.add(CSS_RENDER_MONITOR);
15300
+}
15301
+
15302
+function unwatchForRender(node) {
15303
+	var expando = node[EXPANDO_KEY] || {};
15304
+	var proxy = expando.renderProxy;
15305
+
15306
+	if (proxy) {
15307
+		helpers.each(ANIMATION_START_EVENTS, function(type) {
15308
+			removeEventListener(node, type, proxy);
15309
+		});
15310
+
15311
+		delete expando.renderProxy;
15312
+	}
15313
+
15314
+	node.classList.remove(CSS_RENDER_MONITOR);
15315
+}
15316
+
15317
+function addResizeListener(node, listener, chart) {
15318
+	var expando = node[EXPANDO_KEY] || (node[EXPANDO_KEY] = {});
15319
+
15320
+	// Let's keep track of this added resizer and thus avoid DOM query when removing it.
15321
+	var resizer = expando.resizer = createResizer(throttled(function() {
15322
+		if (expando.resizer) {
15323
+			return listener(createEvent('resize', chart));
15324
+		}
15325
+	}));
15326
+
15327
+	// The resizer needs to be attached to the node parent, so we first need to be
15328
+	// sure that `node` is attached to the DOM before injecting the resizer element.
15329
+	watchForRender(node, function() {
15330
+		if (expando.resizer) {
15331
+			var container = node.parentNode;
15332
+			if (container && container !== resizer.parentNode) {
15333
+				container.insertBefore(resizer, container.firstChild);
15334
+			}
15335
+
15336
+			// The container size might have changed, let's reset the resizer state.
15337
+			resizer._reset();
15338
+		}
15339
+	});
15340
+}
15341
+
15342
+function removeResizeListener(node) {
15343
+	var expando = node[EXPANDO_KEY] || {};
15344
+	var resizer = expando.resizer;
15345
+
15346
+	delete expando.resizer;
15347
+	unwatchForRender(node);
15348
+
15349
+	if (resizer && resizer.parentNode) {
15350
+		resizer.parentNode.removeChild(resizer);
15351
+	}
15352
+}
15353
+
15354
+function injectCSS(platform, css) {
15355
+	// http://stackoverflow.com/q/3922139
15356
+	var style = platform._style || document.createElement('style');
15357
+	if (!platform._style) {
15358
+		platform._style = style;
15359
+		css = '/* Chart.js */\n' + css;
15360
+		style.setAttribute('type', 'text/css');
15361
+		document.getElementsByTagName('head')[0].appendChild(style);
15362
+	}
15363
+
15364
+	style.appendChild(document.createTextNode(css));
15365
+}
15366
+
15367
+module.exports = {
15368
+	/**
15369
+	 * This property holds whether this platform is enabled for the current environment.
15370
+	 * Currently used by platform.js to select the proper implementation.
15371
+	 * @private
15372
+	 */
15373
+	_enabled: typeof window !== 'undefined' && typeof document !== 'undefined',
15374
+
15375
+	initialize: function() {
15376
+		var keyframes = 'from{opacity:0.99}to{opacity:1}';
15377
+
15378
+		injectCSS(this,
15379
+			// DOM rendering detection
15380
+			// https://davidwalsh.name/detect-node-insertion
15381
+			'@-webkit-keyframes ' + CSS_RENDER_ANIMATION + '{' + keyframes + '}' +
15382
+			'@keyframes ' + CSS_RENDER_ANIMATION + '{' + keyframes + '}' +
15383
+			'.' + CSS_RENDER_MONITOR + '{' +
15384
+				'-webkit-animation:' + CSS_RENDER_ANIMATION + ' 0.001s;' +
15385
+				'animation:' + CSS_RENDER_ANIMATION + ' 0.001s;' +
15386
+			'}'
15387
+		);
15388
+	},
15389
+
15390
+	acquireContext: function(item, config) {
15391
+		if (typeof item === 'string') {
15392
+			item = document.getElementById(item);
15393
+		} else if (item.length) {
15394
+			// Support for array based queries (such as jQuery)
15395
+			item = item[0];
15396
+		}
15397
+
15398
+		if (item && item.canvas) {
15399
+			// Support for any object associated to a canvas (including a context2d)
15400
+			item = item.canvas;
15401
+		}
15402
+
15403
+		// To prevent canvas fingerprinting, some add-ons undefine the getContext
15404
+		// method, for example: https://github.com/kkapsner/CanvasBlocker
15405
+		// https://github.com/chartjs/Chart.js/issues/2807
15406
+		var context = item && item.getContext && item.getContext('2d');
15407
+
15408
+		// `instanceof HTMLCanvasElement/CanvasRenderingContext2D` fails when the item is
15409
+		// inside an iframe or when running in a protected environment. We could guess the
15410
+		// types from their toString() value but let's keep things flexible and assume it's
15411
+		// a sufficient condition if the item has a context2D which has item as `canvas`.
15412
+		// https://github.com/chartjs/Chart.js/issues/3887
15413
+		// https://github.com/chartjs/Chart.js/issues/4102
15414
+		// https://github.com/chartjs/Chart.js/issues/4152
15415
+		if (context && context.canvas === item) {
15416
+			initCanvas(item, config);
15417
+			return context;
15418
+		}
15419
+
15420
+		return null;
15421
+	},
15422
+
15423
+	releaseContext: function(context) {
15424
+		var canvas = context.canvas;
15425
+		if (!canvas[EXPANDO_KEY]) {
15426
+			return;
15427
+		}
15428
+
15429
+		var initial = canvas[EXPANDO_KEY].initial;
15430
+		['height', 'width'].forEach(function(prop) {
15431
+			var value = initial[prop];
15432
+			if (helpers.isNullOrUndef(value)) {
15433
+				canvas.removeAttribute(prop);
15434
+			} else {
15435
+				canvas.setAttribute(prop, value);
15436
+			}
15437
+		});
15438
+
15439
+		helpers.each(initial.style || {}, function(value, key) {
15440
+			canvas.style[key] = value;
15441
+		});
15442
+
15443
+		// The canvas render size might have been changed (and thus the state stack discarded),
15444
+		// we can't use save() and restore() to restore the initial state. So make sure that at
15445
+		// least the canvas context is reset to the default state by setting the canvas width.
15446
+		// https://www.w3.org/TR/2011/WD-html5-20110525/the-canvas-element.html
15447
+		canvas.width = canvas.width;
15448
+
15449
+		delete canvas[EXPANDO_KEY];
15450
+	},
15451
+
15452
+	addEventListener: function(chart, type, listener) {
15453
+		var canvas = chart.canvas;
15454
+		if (type === 'resize') {
15455
+			// Note: the resize event is not supported on all browsers.
15456
+			addResizeListener(canvas, listener, chart);
15457
+			return;
15458
+		}
15459
+
15460
+		var expando = listener[EXPANDO_KEY] || (listener[EXPANDO_KEY] = {});
15461
+		var proxies = expando.proxies || (expando.proxies = {});
15462
+		var proxy = proxies[chart.id + '_' + type] = function(event) {
15463
+			listener(fromNativeEvent(event, chart));
15464
+		};
15465
+
15466
+		addEventListener(canvas, type, proxy);
15467
+	},
15468
+
15469
+	removeEventListener: function(chart, type, listener) {
15470
+		var canvas = chart.canvas;
15471
+		if (type === 'resize') {
15472
+			// Note: the resize event is not supported on all browsers.
15473
+			removeResizeListener(canvas, listener);
15474
+			return;
15475
+		}
15476
+
15477
+		var expando = listener[EXPANDO_KEY] || {};
15478
+		var proxies = expando.proxies || {};
15479
+		var proxy = proxies[chart.id + '_' + type];
15480
+		if (!proxy) {
15481
+			return;
15482
+		}
15483
+
15484
+		removeEventListener(canvas, type, proxy);
15485
+	}
15486
+};
15487
+
15488
+// DEPRECATIONS
15489
+
15490
+/**
15491
+ * Provided for backward compatibility, use EventTarget.addEventListener instead.
15492
+ * EventTarget.addEventListener compatibility: Chrome, Opera 7, Safari, FF1.5+, IE9+
15493
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener
15494
+ * @function Chart.helpers.addEvent
15495
+ * @deprecated since version 2.7.0
15496
+ * @todo remove at version 3
15497
+ * @private
15498
+ */
15499
+helpers.addEvent = addEventListener;
15500
+
15501
+/**
15502
+ * Provided for backward compatibility, use EventTarget.removeEventListener instead.
15503
+ * EventTarget.removeEventListener compatibility: Chrome, Opera 7, Safari, FF1.5+, IE9+
15504
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/removeEventListener
15505
+ * @function Chart.helpers.removeEvent
15506
+ * @deprecated since version 2.7.0
15507
+ * @todo remove at version 3
15508
+ * @private
15509
+ */
15510
+helpers.removeEvent = removeEventListener;
15511
+
15512
+},{"45":45}],48:[function(require,module,exports){
15513
+'use strict';
15514
+
15515
+var helpers = require(45);
15516
+var basic = require(46);
15517
+var dom = require(47);
15518
+
15519
+// @TODO Make possible to select another platform at build time.
15520
+var implementation = dom._enabled ? dom : basic;
15521
+
15522
+/**
15523
+ * @namespace Chart.platform
15524
+ * @see https://chartjs.gitbooks.io/proposals/content/Platform.html
15525
+ * @since 2.4.0
15526
+ */
15527
+module.exports = helpers.extend({
15528
+	/**
15529
+	 * @since 2.7.0
15530
+	 */
15531
+	initialize: function() {},
15532
+
15533
+	/**
15534
+	 * Called at chart construction time, returns a context2d instance implementing
15535
+	 * the [W3C Canvas 2D Context API standard]{@link https://www.w3.org/TR/2dcontext/}.
15536
+	 * @param {*} item - The native item from which to acquire context (platform specific)
15537
+	 * @param {Object} options - The chart options
15538
+	 * @returns {CanvasRenderingContext2D} context2d instance
15539
+	 */
15540
+	acquireContext: function() {},
15541
+
15542
+	/**
15543
+	 * Called at chart destruction time, releases any resources associated to the context
15544
+	 * previously returned by the acquireContext() method.
15545
+	 * @param {CanvasRenderingContext2D} context - The context2d instance
15546
+	 * @returns {Boolean} true if the method succeeded, else false
15547
+	 */
15548
+	releaseContext: function() {},
15549
+
15550
+	/**
15551
+	 * Registers the specified listener on the given chart.
15552
+	 * @param {Chart} chart - Chart from which to listen for event
15553
+	 * @param {String} type - The ({@link IEvent}) type to listen for
15554
+	 * @param {Function} listener - Receives a notification (an object that implements
15555
+	 * the {@link IEvent} interface) when an event of the specified type occurs.
15556
+	 */
15557
+	addEventListener: function() {},
15558
+
15559
+	/**
15560
+	 * Removes the specified listener previously registered with addEventListener.
15561
+	 * @param {Chart} chart -Chart from which to remove the listener
15562
+	 * @param {String} type - The ({@link IEvent}) type to remove
15563
+	 * @param {Function} listener - The listener function to remove from the event target.
15564
+	 */
15565
+	removeEventListener: function() {}
15566
+
15567
+}, implementation);
15568
+
15569
+/**
15570
+ * @interface IPlatform
15571
+ * Allows abstracting platform dependencies away from the chart
15572
+ * @borrows Chart.platform.acquireContext as acquireContext
15573
+ * @borrows Chart.platform.releaseContext as releaseContext
15574
+ * @borrows Chart.platform.addEventListener as addEventListener
15575
+ * @borrows Chart.platform.removeEventListener as removeEventListener
15576
+ */
15577
+
15578
+/**
15579
+ * @interface IEvent
15580
+ * @prop {String} type - The event type name, possible values are:
15581
+ * 'contextmenu', 'mouseenter', 'mousedown', 'mousemove', 'mouseup', 'mouseout',
15582
+ * 'click', 'dblclick', 'keydown', 'keypress', 'keyup' and 'resize'
15583
+ * @prop {*} native - The original native event (null for emulated events, e.g. 'resize')
15584
+ * @prop {Number} x - The mouse x position, relative to the canvas (null for incompatible events)
15585
+ * @prop {Number} y - The mouse y position, relative to the canvas (null for incompatible events)
15586
+ */
15587
+
15588
+},{"45":45,"46":46,"47":47}],49:[function(require,module,exports){
15589
+'use strict';
15590
+
15591
+module.exports = {};
15592
+module.exports.filler = require(50);
15593
+module.exports.legend = require(51);
15594
+module.exports.title = require(52);
15595
+
15596
+},{"50":50,"51":51,"52":52}],50:[function(require,module,exports){
15597
+/**
15598
+ * Plugin based on discussion from the following Chart.js issues:
15599
+ * @see https://github.com/chartjs/Chart.js/issues/2380#issuecomment-279961569
15600
+ * @see https://github.com/chartjs/Chart.js/issues/2440#issuecomment-256461897
15601
+ */
15602
+
15603
+'use strict';
15604
+
15605
+var defaults = require(25);
15606
+var elements = require(40);
15607
+var helpers = require(45);
15608
+
15609
+defaults._set('global', {
15610
+	plugins: {
15611
+		filler: {
15612
+			propagate: true
15613
+		}
15614
+	}
15615
+});
15616
+
15617
+var mappers = {
15618
+	dataset: function(source) {
15619
+		var index = source.fill;
15620
+		var chart = source.chart;
15621
+		var meta = chart.getDatasetMeta(index);
15622
+		var visible = meta && chart.isDatasetVisible(index);
15623
+		var points = (visible && meta.dataset._children) || [];
15624
+		var length = points.length || 0;
15625
+
15626
+		return !length ? null : function(point, i) {
15627
+			return (i < length && points[i]._view) || null;
15628
+		};
15629
+	},
15630
+
15631
+	boundary: function(source) {
15632
+		var boundary = source.boundary;
15633
+		var x = boundary ? boundary.x : null;
15634
+		var y = boundary ? boundary.y : null;
15635
+
15636
+		return function(point) {
15637
+			return {
15638
+				x: x === null ? point.x : x,
15639
+				y: y === null ? point.y : y,
15640
+			};
15641
+		};
15642
+	}
15643
+};
15644
+
15645
+// @todo if (fill[0] === '#')
15646
+function decodeFill(el, index, count) {
15647
+	var model = el._model || {};
15648
+	var fill = model.fill;
15649
+	var target;
15650
+
15651
+	if (fill === undefined) {
15652
+		fill = !!model.backgroundColor;
15653
+	}
15654
+
15655
+	if (fill === false || fill === null) {
15656
+		return false;
15657
+	}
15658
+
15659
+	if (fill === true) {
15660
+		return 'origin';
15661
+	}
15662
+
15663
+	target = parseFloat(fill, 10);
15664
+	if (isFinite(target) && Math.floor(target) === target) {
15665
+		if (fill[0] === '-' || fill[0] === '+') {
15666
+			target = index + target;
15667
+		}
15668
+
15669
+		if (target === index || target < 0 || target >= count) {
15670
+			return false;
15671
+		}
15672
+
15673
+		return target;
15674
+	}
15675
+
15676
+	switch (fill) {
15677
+	// compatibility
15678
+	case 'bottom':
15679
+		return 'start';
15680
+	case 'top':
15681
+		return 'end';
15682
+	case 'zero':
15683
+		return 'origin';
15684
+	// supported boundaries
15685
+	case 'origin':
15686
+	case 'start':
15687
+	case 'end':
15688
+		return fill;
15689
+	// invalid fill values
15690
+	default:
15691
+		return false;
15692
+	}
15693
+}
15694
+
15695
+function computeBoundary(source) {
15696
+	var model = source.el._model || {};
15697
+	var scale = source.el._scale || {};
15698
+	var fill = source.fill;
15699
+	var target = null;
15700
+	var horizontal;
15701
+
15702
+	if (isFinite(fill)) {
15703
+		return null;
15704
+	}
15705
+
15706
+	// Backward compatibility: until v3, we still need to support boundary values set on
15707
+	// the model (scaleTop, scaleBottom and scaleZero) because some external plugins and
15708
+	// controllers might still use it (e.g. the Smith chart).
15709
+
15710
+	if (fill === 'start') {
15711
+		target = model.scaleBottom === undefined ? scale.bottom : model.scaleBottom;
15712
+	} else if (fill === 'end') {
15713
+		target = model.scaleTop === undefined ? scale.top : model.scaleTop;
15714
+	} else if (model.scaleZero !== undefined) {
15715
+		target = model.scaleZero;
15716
+	} else if (scale.getBasePosition) {
15717
+		target = scale.getBasePosition();
15718
+	} else if (scale.getBasePixel) {
15719
+		target = scale.getBasePixel();
15720
+	}
15721
+
15722
+	if (target !== undefined && target !== null) {
15723
+		if (target.x !== undefined && target.y !== undefined) {
15724
+			return target;
15725
+		}
15726
+
15727
+		if (typeof target === 'number' && isFinite(target)) {
15728
+			horizontal = scale.isHorizontal();
15729
+			return {
15730
+				x: horizontal ? target : null,
15731
+				y: horizontal ? null : target
15732
+			};
15733
+		}
15734
+	}
15735
+
15736
+	return null;
15737
+}
15738
+
15739
+function resolveTarget(sources, index, propagate) {
15740
+	var source = sources[index];
15741
+	var fill = source.fill;
15742
+	var visited = [index];
15743
+	var target;
15744
+
15745
+	if (!propagate) {
15746
+		return fill;
15747
+	}
15748
+
15749
+	while (fill !== false && visited.indexOf(fill) === -1) {
15750
+		if (!isFinite(fill)) {
15751
+			return fill;
15752
+		}
15753
+
15754
+		target = sources[fill];
15755
+		if (!target) {
15756
+			return false;
15757
+		}
15758
+
15759
+		if (target.visible) {
15760
+			return fill;
15761
+		}
15762
+
15763
+		visited.push(fill);
15764
+		fill = target.fill;
15765
+	}
15766
+
15767
+	return false;
15768
+}
15769
+
15770
+function createMapper(source) {
15771
+	var fill = source.fill;
15772
+	var type = 'dataset';
15773
+
15774
+	if (fill === false) {
15775
+		return null;
15776
+	}
15777
+
15778
+	if (!isFinite(fill)) {
15779
+		type = 'boundary';
15780
+	}
15781
+
15782
+	return mappers[type](source);
15783
+}
15784
+
15785
+function isDrawable(point) {
15786
+	return point && !point.skip;
15787
+}
15788
+
15789
+function drawArea(ctx, curve0, curve1, len0, len1) {
15790
+	var i;
15791
+
15792
+	if (!len0 || !len1) {
15793
+		return;
15794
+	}
15795
+
15796
+	// building first area curve (normal)
15797
+	ctx.moveTo(curve0[0].x, curve0[0].y);
15798
+	for (i = 1; i < len0; ++i) {
15799
+		helpers.canvas.lineTo(ctx, curve0[i - 1], curve0[i]);
15800
+	}
15801
+
15802
+	// joining the two area curves
15803
+	ctx.lineTo(curve1[len1 - 1].x, curve1[len1 - 1].y);
15804
+
15805
+	// building opposite area curve (reverse)
15806
+	for (i = len1 - 1; i > 0; --i) {
15807
+		helpers.canvas.lineTo(ctx, curve1[i], curve1[i - 1], true);
15808
+	}
15809
+}
15810
+
15811
+function doFill(ctx, points, mapper, view, color, loop) {
15812
+	var count = points.length;
15813
+	var span = view.spanGaps;
15814
+	var curve0 = [];
15815
+	var curve1 = [];
15816
+	var len0 = 0;
15817
+	var len1 = 0;
15818
+	var i, ilen, index, p0, p1, d0, d1;
15819
+
15820
+	ctx.beginPath();
15821
+
15822
+	for (i = 0, ilen = (count + !!loop); i < ilen; ++i) {
15823
+		index = i % count;
15824
+		p0 = points[index]._view;
15825
+		p1 = mapper(p0, index, view);
15826
+		d0 = isDrawable(p0);
15827
+		d1 = isDrawable(p1);
15828
+
15829
+		if (d0 && d1) {
15830
+			len0 = curve0.push(p0);
15831
+			len1 = curve1.push(p1);
15832
+		} else if (len0 && len1) {
15833
+			if (!span) {
15834
+				drawArea(ctx, curve0, curve1, len0, len1);
15835
+				len0 = len1 = 0;
15836
+				curve0 = [];
15837
+				curve1 = [];
15838
+			} else {
15839
+				if (d0) {
15840
+					curve0.push(p0);
15841
+				}
15842
+				if (d1) {
15843
+					curve1.push(p1);
15844
+				}
15845
+			}
15846
+		}
15847
+	}
15848
+
15849
+	drawArea(ctx, curve0, curve1, len0, len1);
15850
+
15851
+	ctx.closePath();
15852
+	ctx.fillStyle = color;
15853
+	ctx.fill();
15854
+}
15855
+
15856
+module.exports = {
15857
+	id: 'filler',
15858
+
15859
+	afterDatasetsUpdate: function(chart, options) {
15860
+		var count = (chart.data.datasets || []).length;
15861
+		var propagate = options.propagate;
15862
+		var sources = [];
15863
+		var meta, i, el, source;
15864
+
15865
+		for (i = 0; i < count; ++i) {
15866
+			meta = chart.getDatasetMeta(i);
15867
+			el = meta.dataset;
15868
+			source = null;
15869
+
15870
+			if (el && el._model && el instanceof elements.Line) {
15871
+				source = {
15872
+					visible: chart.isDatasetVisible(i),
15873
+					fill: decodeFill(el, i, count),
15874
+					chart: chart,
15875
+					el: el
15876
+				};
15877
+			}
15878
+
15879
+			meta.$filler = source;
15880
+			sources.push(source);
15881
+		}
15882
+
15883
+		for (i = 0; i < count; ++i) {
15884
+			source = sources[i];
15885
+			if (!source) {
15886
+				continue;
15887
+			}
15888
+
15889
+			source.fill = resolveTarget(sources, i, propagate);
15890
+			source.boundary = computeBoundary(source);
15891
+			source.mapper = createMapper(source);
15892
+		}
15893
+	},
15894
+
15895
+	beforeDatasetDraw: function(chart, args) {
15896
+		var meta = args.meta.$filler;
15897
+		if (!meta) {
15898
+			return;
15899
+		}
15900
+
15901
+		var ctx = chart.ctx;
15902
+		var el = meta.el;
15903
+		var view = el._view;
15904
+		var points = el._children || [];
15905
+		var mapper = meta.mapper;
15906
+		var color = view.backgroundColor || defaults.global.defaultColor;
15907
+
15908
+		if (mapper && color && points.length) {
15909
+			helpers.canvas.clipArea(ctx, chart.chartArea);
15910
+			doFill(ctx, points, mapper, view, color, el._loop);
15911
+			helpers.canvas.unclipArea(ctx);
15912
+		}
15913
+	}
15914
+};
15915
+
15916
+},{"25":25,"40":40,"45":45}],51:[function(require,module,exports){
15917
+'use strict';
15918
+
15919
+var defaults = require(25);
15920
+var Element = require(26);
15921
+var helpers = require(45);
15922
+var layouts = require(30);
15923
+
15924
+var noop = helpers.noop;
15925
+
15926
+defaults._set('global', {
15927
+	legend: {
15928
+		display: true,
15929
+		position: 'top',
15930
+		fullWidth: true,
15931
+		reverse: false,
15932
+		weight: 1000,
15933
+
15934
+		// a callback that will handle
15935
+		onClick: function(e, legendItem) {
15936
+			var index = legendItem.datasetIndex;
15937
+			var ci = this.chart;
15938
+			var meta = ci.getDatasetMeta(index);
15939
+
15940
+			// See controller.isDatasetVisible comment
15941
+			meta.hidden = meta.hidden === null ? !ci.data.datasets[index].hidden : null;
15942
+
15943
+			// We hid a dataset ... rerender the chart
15944
+			ci.update();
15945
+		},
15946
+
15947
+		onHover: null,
15948
+
15949
+		labels: {
15950
+			boxWidth: 40,
15951
+			padding: 10,
15952
+			// Generates labels shown in the legend
15953
+			// Valid properties to return:
15954
+			// text : text to display
15955
+			// fillStyle : fill of coloured box
15956
+			// strokeStyle: stroke of coloured box
15957
+			// hidden : if this legend item refers to a hidden item
15958
+			// lineCap : cap style for line
15959
+			// lineDash
15960
+			// lineDashOffset :
15961
+			// lineJoin :
15962
+			// lineWidth :
15963
+			generateLabels: function(chart) {
15964
+				var data = chart.data;
15965
+				return helpers.isArray(data.datasets) ? data.datasets.map(function(dataset, i) {
15966
+					return {
15967
+						text: dataset.label,
15968
+						fillStyle: (!helpers.isArray(dataset.backgroundColor) ? dataset.backgroundColor : dataset.backgroundColor[0]),
15969
+						hidden: !chart.isDatasetVisible(i),
15970
+						lineCap: dataset.borderCapStyle,
15971
+						lineDash: dataset.borderDash,
15972
+						lineDashOffset: dataset.borderDashOffset,
15973
+						lineJoin: dataset.borderJoinStyle,
15974
+						lineWidth: dataset.borderWidth,
15975
+						strokeStyle: dataset.borderColor,
15976
+						pointStyle: dataset.pointStyle,
15977
+
15978
+						// Below is extra data used for toggling the datasets
15979
+						datasetIndex: i
15980
+					};
15981
+				}, this) : [];
15982
+			}
15983
+		}
15984
+	},
15985
+
15986
+	legendCallback: function(chart) {
15987
+		var text = [];
15988
+		text.push('<ul class="' + chart.id + '-legend">');
15989
+		for (var i = 0; i < chart.data.datasets.length; i++) {
15990
+			text.push('<li><span style="background-color:' + chart.data.datasets[i].backgroundColor + '"></span>');
15991
+			if (chart.data.datasets[i].label) {
15992
+				text.push(chart.data.datasets[i].label);
15993
+			}
15994
+			text.push('</li>');
15995
+		}
15996
+		text.push('</ul>');
15997
+		return text.join('');
15998
+	}
15999
+});
16000
+
16001
+/**
16002
+ * Helper function to get the box width based on the usePointStyle option
16003
+ * @param labelopts {Object} the label options on the legend
16004
+ * @param fontSize {Number} the label font size
16005
+ * @return {Number} width of the color box area
16006
+ */
16007
+function getBoxWidth(labelOpts, fontSize) {
16008
+	return labelOpts.usePointStyle ?
16009
+		fontSize * Math.SQRT2 :
16010
+		labelOpts.boxWidth;
16011
+}
16012
+
16013
+/**
16014
+ * IMPORTANT: this class is exposed publicly as Chart.Legend, backward compatibility required!
16015
+ */
16016
+var Legend = Element.extend({
16017
+
16018
+	initialize: function(config) {
16019
+		helpers.extend(this, config);
16020
+
16021
+		// Contains hit boxes for each dataset (in dataset order)
16022
+		this.legendHitBoxes = [];
16023
+
16024
+		// Are we in doughnut mode which has a different data type
16025
+		this.doughnutMode = false;
16026
+	},
16027
+
16028
+	// These methods are ordered by lifecycle. Utilities then follow.
16029
+	// Any function defined here is inherited by all legend types.
16030
+	// Any function can be extended by the legend type
16031
+
16032
+	beforeUpdate: noop,
16033
+	update: function(maxWidth, maxHeight, margins) {
16034
+		var me = this;
16035
+
16036
+		// Update Lifecycle - Probably don't want to ever extend or overwrite this function ;)
16037
+		me.beforeUpdate();
16038
+
16039
+		// Absorb the master measurements
16040
+		me.maxWidth = maxWidth;
16041
+		me.maxHeight = maxHeight;
16042
+		me.margins = margins;
16043
+
16044
+		// Dimensions
16045
+		me.beforeSetDimensions();
16046
+		me.setDimensions();
16047
+		me.afterSetDimensions();
16048
+		// Labels
16049
+		me.beforeBuildLabels();
16050
+		me.buildLabels();
16051
+		me.afterBuildLabels();
16052
+
16053
+		// Fit
16054
+		me.beforeFit();
16055
+		me.fit();
16056
+		me.afterFit();
16057
+		//
16058
+		me.afterUpdate();
16059
+
16060
+		return me.minSize;
16061
+	},
16062
+	afterUpdate: noop,
16063
+
16064
+	//
16065
+
16066
+	beforeSetDimensions: noop,
16067
+	setDimensions: function() {
16068
+		var me = this;
16069
+		// Set the unconstrained dimension before label rotation
16070
+		if (me.isHorizontal()) {
16071
+			// Reset position before calculating rotation
16072
+			me.width = me.maxWidth;
16073
+			me.left = 0;
16074
+			me.right = me.width;
16075
+		} else {
16076
+			me.height = me.maxHeight;
16077
+
16078
+			// Reset position before calculating rotation
16079
+			me.top = 0;
16080
+			me.bottom = me.height;
16081
+		}
16082
+
16083
+		// Reset padding
16084
+		me.paddingLeft = 0;
16085
+		me.paddingTop = 0;
16086
+		me.paddingRight = 0;
16087
+		me.paddingBottom = 0;
16088
+
16089
+		// Reset minSize
16090
+		me.minSize = {
16091
+			width: 0,
16092
+			height: 0
16093
+		};
16094
+	},
16095
+	afterSetDimensions: noop,
16096
+
16097
+	//
16098
+
16099
+	beforeBuildLabels: noop,
16100
+	buildLabels: function() {
16101
+		var me = this;
16102
+		var labelOpts = me.options.labels || {};
16103
+		var legendItems = helpers.callback(labelOpts.generateLabels, [me.chart], me) || [];
16104
+
16105
+		if (labelOpts.filter) {
16106
+			legendItems = legendItems.filter(function(item) {
16107
+				return labelOpts.filter(item, me.chart.data);
16108
+			});
16109
+		}
16110
+
16111
+		if (me.options.reverse) {
16112
+			legendItems.reverse();
16113
+		}
16114
+
16115
+		me.legendItems = legendItems;
16116
+	},
16117
+	afterBuildLabels: noop,
16118
+
16119
+	//
16120
+
16121
+	beforeFit: noop,
16122
+	fit: function() {
16123
+		var me = this;
16124
+		var opts = me.options;
16125
+		var labelOpts = opts.labels;
16126
+		var display = opts.display;
16127
+
16128
+		var ctx = me.ctx;
16129
+
16130
+		var globalDefault = defaults.global;
16131
+		var valueOrDefault = helpers.valueOrDefault;
16132
+		var fontSize = valueOrDefault(labelOpts.fontSize, globalDefault.defaultFontSize);
16133
+		var fontStyle = valueOrDefault(labelOpts.fontStyle, globalDefault.defaultFontStyle);
16134
+		var fontFamily = valueOrDefault(labelOpts.fontFamily, globalDefault.defaultFontFamily);
16135
+		var labelFont = helpers.fontString(fontSize, fontStyle, fontFamily);
16136
+
16137
+		// Reset hit boxes
16138
+		var hitboxes = me.legendHitBoxes = [];
16139
+
16140
+		var minSize = me.minSize;
16141
+		var isHorizontal = me.isHorizontal();
16142
+
16143
+		if (isHorizontal) {
16144
+			minSize.width = me.maxWidth; // fill all the width
16145
+			minSize.height = display ? 10 : 0;
16146
+		} else {
16147
+			minSize.width = display ? 10 : 0;
16148
+			minSize.height = me.maxHeight; // fill all the height
16149
+		}
16150
+
16151
+		// Increase sizes here
16152
+		if (display) {
16153
+			ctx.font = labelFont;
16154
+
16155
+			if (isHorizontal) {
16156
+				// Labels
16157
+
16158
+				// Width of each line of legend boxes. Labels wrap onto multiple lines when there are too many to fit on one
16159
+				var lineWidths = me.lineWidths = [0];
16160
+				var totalHeight = me.legendItems.length ? fontSize + (labelOpts.padding) : 0;
16161
+
16162
+				ctx.textAlign = 'left';
16163
+				ctx.textBaseline = 'top';
16164
+
16165
+				helpers.each(me.legendItems, function(legendItem, i) {
16166
+					var boxWidth = getBoxWidth(labelOpts, fontSize);
16167
+					var width = boxWidth + (fontSize / 2) + ctx.measureText(legendItem.text).width;
16168
+
16169
+					if (lineWidths[lineWidths.length - 1] + width + labelOpts.padding >= me.width) {
16170
+						totalHeight += fontSize + (labelOpts.padding);
16171
+						lineWidths[lineWidths.length] = me.left;
16172
+					}
16173
+
16174
+					// Store the hitbox width and height here. Final position will be updated in `draw`
16175
+					hitboxes[i] = {
16176
+						left: 0,
16177
+						top: 0,
16178
+						width: width,
16179
+						height: fontSize
16180
+					};
16181
+
16182
+					lineWidths[lineWidths.length - 1] += width + labelOpts.padding;
16183
+				});
16184
+
16185
+				minSize.height += totalHeight;
16186
+
16187
+			} else {
16188
+				var vPadding = labelOpts.padding;
16189
+				var columnWidths = me.columnWidths = [];
16190
+				var totalWidth = labelOpts.padding;
16191
+				var currentColWidth = 0;
16192
+				var currentColHeight = 0;
16193
+				var itemHeight = fontSize + vPadding;
16194
+
16195
+				helpers.each(me.legendItems, function(legendItem, i) {
16196
+					var boxWidth = getBoxWidth(labelOpts, fontSize);
16197
+					var itemWidth = boxWidth + (fontSize / 2) + ctx.measureText(legendItem.text).width;
16198
+
16199
+					// If too tall, go to new column
16200
+					if (currentColHeight + itemHeight > minSize.height) {
16201
+						totalWidth += currentColWidth + labelOpts.padding;
16202
+						columnWidths.push(currentColWidth); // previous column width
16203
+
16204
+						currentColWidth = 0;
16205
+						currentColHeight = 0;
16206
+					}
16207
+
16208
+					// Get max width
16209
+					currentColWidth = Math.max(currentColWidth, itemWidth);
16210
+					currentColHeight += itemHeight;
16211
+
16212
+					// Store the hitbox width and height here. Final position will be updated in `draw`
16213
+					hitboxes[i] = {
16214
+						left: 0,
16215
+						top: 0,
16216
+						width: itemWidth,
16217
+						height: fontSize
16218
+					};
16219
+				});
16220
+
16221
+				totalWidth += currentColWidth;
16222
+				columnWidths.push(currentColWidth);
16223
+				minSize.width += totalWidth;
16224
+			}
16225
+		}
16226
+
16227
+		me.width = minSize.width;
16228
+		me.height = minSize.height;
16229
+	},
16230
+	afterFit: noop,
16231
+
16232
+	// Shared Methods
16233
+	isHorizontal: function() {
16234
+		return this.options.position === 'top' || this.options.position === 'bottom';
16235
+	},
16236
+
16237
+	// Actually draw the legend on the canvas
16238
+	draw: function() {
16239
+		var me = this;
16240
+		var opts = me.options;
16241
+		var labelOpts = opts.labels;
16242
+		var globalDefault = defaults.global;
16243
+		var lineDefault = globalDefault.elements.line;
16244
+		var legendWidth = me.width;
16245
+		var lineWidths = me.lineWidths;
16246
+
16247
+		if (opts.display) {
16248
+			var ctx = me.ctx;
16249
+			var valueOrDefault = helpers.valueOrDefault;
16250
+			var fontColor = valueOrDefault(labelOpts.fontColor, globalDefault.defaultFontColor);
16251
+			var fontSize = valueOrDefault(labelOpts.fontSize, globalDefault.defaultFontSize);
16252
+			var fontStyle = valueOrDefault(labelOpts.fontStyle, globalDefault.defaultFontStyle);
16253
+			var fontFamily = valueOrDefault(labelOpts.fontFamily, globalDefault.defaultFontFamily);
16254
+			var labelFont = helpers.fontString(fontSize, fontStyle, fontFamily);
16255
+			var cursor;
16256
+
16257
+			// Canvas setup
16258
+			ctx.textAlign = 'left';
16259
+			ctx.textBaseline = 'middle';
16260
+			ctx.lineWidth = 0.5;
16261
+			ctx.strokeStyle = fontColor; // for strikethrough effect
16262
+			ctx.fillStyle = fontColor; // render in correct colour
16263
+			ctx.font = labelFont;
16264
+
16265
+			var boxWidth = getBoxWidth(labelOpts, fontSize);
16266
+			var hitboxes = me.legendHitBoxes;
16267
+
16268
+			// current position
16269
+			var drawLegendBox = function(x, y, legendItem) {
16270
+				if (isNaN(boxWidth) || boxWidth <= 0) {
16271
+					return;
16272
+				}
16273
+
16274
+				// Set the ctx for the box
16275
+				ctx.save();
16276
+
16277
+				ctx.fillStyle = valueOrDefault(legendItem.fillStyle, globalDefault.defaultColor);
16278
+				ctx.lineCap = valueOrDefault(legendItem.lineCap, lineDefault.borderCapStyle);
16279
+				ctx.lineDashOffset = valueOrDefault(legendItem.lineDashOffset, lineDefault.borderDashOffset);
16280
+				ctx.lineJoin = valueOrDefault(legendItem.lineJoin, lineDefault.borderJoinStyle);
16281
+				ctx.lineWidth = valueOrDefault(legendItem.lineWidth, lineDefault.borderWidth);
16282
+				ctx.strokeStyle = valueOrDefault(legendItem.strokeStyle, globalDefault.defaultColor);
16283
+				var isLineWidthZero = (valueOrDefault(legendItem.lineWidth, lineDefault.borderWidth) === 0);
16284
+
16285
+				if (ctx.setLineDash) {
16286
+					// IE 9 and 10 do not support line dash
16287
+					ctx.setLineDash(valueOrDefault(legendItem.lineDash, lineDefault.borderDash));
16288
+				}
16289
+
16290
+				if (opts.labels && opts.labels.usePointStyle) {
16291
+					// Recalculate x and y for drawPoint() because its expecting
16292
+					// x and y to be center of figure (instead of top left)
16293
+					var radius = fontSize * Math.SQRT2 / 2;
16294
+					var offSet = radius / Math.SQRT2;
16295
+					var centerX = x + offSet;
16296
+					var centerY = y + offSet;
16297
+
16298
+					// Draw pointStyle as legend symbol
16299
+					helpers.canvas.drawPoint(ctx, legendItem.pointStyle, radius, centerX, centerY);
16300
+				} else {
16301
+					// Draw box as legend symbol
16302
+					if (!isLineWidthZero) {
16303
+						ctx.strokeRect(x, y, boxWidth, fontSize);
16304
+					}
16305
+					ctx.fillRect(x, y, boxWidth, fontSize);
16306
+				}
16307
+
16308
+				ctx.restore();
16309
+			};
16310
+			var fillText = function(x, y, legendItem, textWidth) {
16311
+				var halfFontSize = fontSize / 2;
16312
+				var xLeft = boxWidth + halfFontSize + x;
16313
+				var yMiddle = y + halfFontSize;
16314
+
16315
+				ctx.fillText(legendItem.text, xLeft, yMiddle);
16316
+
16317
+				if (legendItem.hidden) {
16318
+					// Strikethrough the text if hidden
16319
+					ctx.beginPath();
16320
+					ctx.lineWidth = 2;
16321
+					ctx.moveTo(xLeft, yMiddle);
16322
+					ctx.lineTo(xLeft + textWidth, yMiddle);
16323
+					ctx.stroke();
16324
+				}
16325
+			};
16326
+
16327
+			// Horizontal
16328
+			var isHorizontal = me.isHorizontal();
16329
+			if (isHorizontal) {
16330
+				cursor = {
16331
+					x: me.left + ((legendWidth - lineWidths[0]) / 2),
16332
+					y: me.top + labelOpts.padding,
16333
+					line: 0
16334
+				};
16335
+			} else {
16336
+				cursor = {
16337
+					x: me.left + labelOpts.padding,
16338
+					y: me.top + labelOpts.padding,
16339
+					line: 0
16340
+				};
16341
+			}
16342
+
16343
+			var itemHeight = fontSize + labelOpts.padding;
16344
+			helpers.each(me.legendItems, function(legendItem, i) {
16345
+				var textWidth = ctx.measureText(legendItem.text).width;
16346
+				var width = boxWidth + (fontSize / 2) + textWidth;
16347
+				var x = cursor.x;
16348
+				var y = cursor.y;
16349
+
16350
+				if (isHorizontal) {
16351
+					if (x + width >= legendWidth) {
16352
+						y = cursor.y += itemHeight;
16353
+						cursor.line++;
16354
+						x = cursor.x = me.left + ((legendWidth - lineWidths[cursor.line]) / 2);
16355
+					}
16356
+				} else if (y + itemHeight > me.bottom) {
16357
+					x = cursor.x = x + me.columnWidths[cursor.line] + labelOpts.padding;
16358
+					y = cursor.y = me.top + labelOpts.padding;
16359
+					cursor.line++;
16360
+				}
16361
+
16362
+				drawLegendBox(x, y, legendItem);
16363
+
16364
+				hitboxes[i].left = x;
16365
+				hitboxes[i].top = y;
16366
+
16367
+				// Fill the actual label
16368
+				fillText(x, y, legendItem, textWidth);
16369
+
16370
+				if (isHorizontal) {
16371
+					cursor.x += width + (labelOpts.padding);
16372
+				} else {
16373
+					cursor.y += itemHeight;
16374
+				}
16375
+
16376
+			});
16377
+		}
16378
+	},
16379
+
16380
+	/**
16381
+	 * Handle an event
16382
+	 * @private
16383
+	 * @param {IEvent} event - The event to handle
16384
+	 * @return {Boolean} true if a change occured
16385
+	 */
16386
+	handleEvent: function(e) {
16387
+		var me = this;
16388
+		var opts = me.options;
16389
+		var type = e.type === 'mouseup' ? 'click' : e.type;
16390
+		var changed = false;
16391
+
16392
+		if (type === 'mousemove') {
16393
+			if (!opts.onHover) {
16394
+				return;
16395
+			}
16396
+		} else if (type === 'click') {
16397
+			if (!opts.onClick) {
16398
+				return;
16399
+			}
16400
+		} else {
16401
+			return;
16402
+		}
16403
+
16404
+		// Chart event already has relative position in it
16405
+		var x = e.x;
16406
+		var y = e.y;
16407
+
16408
+		if (x >= me.left && x <= me.right && y >= me.top && y <= me.bottom) {
16409
+			// See if we are touching one of the dataset boxes
16410
+			var lh = me.legendHitBoxes;
16411
+			for (var i = 0; i < lh.length; ++i) {
16412
+				var hitBox = lh[i];
16413
+
16414
+				if (x >= hitBox.left && x <= hitBox.left + hitBox.width && y >= hitBox.top && y <= hitBox.top + hitBox.height) {
16415
+					// Touching an element
16416
+					if (type === 'click') {
16417
+						// use e.native for backwards compatibility
16418
+						opts.onClick.call(me, e.native, me.legendItems[i]);
16419
+						changed = true;
16420
+						break;
16421
+					} else if (type === 'mousemove') {
16422
+						// use e.native for backwards compatibility
16423
+						opts.onHover.call(me, e.native, me.legendItems[i]);
16424
+						changed = true;
16425
+						break;
16426
+					}
16427
+				}
16428
+			}
16429
+		}
16430
+
16431
+		return changed;
16432
+	}
16433
+});
16434
+
16435
+function createNewLegendAndAttach(chart, legendOpts) {
16436
+	var legend = new Legend({
16437
+		ctx: chart.ctx,
16438
+		options: legendOpts,
16439
+		chart: chart
16440
+	});
16441
+
16442
+	layouts.configure(chart, legend, legendOpts);
16443
+	layouts.addBox(chart, legend);
16444
+	chart.legend = legend;
16445
+}
16446
+
16447
+module.exports = {
16448
+	id: 'legend',
16449
+
16450
+	/**
16451
+	 * Backward compatibility: since 2.1.5, the legend is registered as a plugin, making
16452
+	 * Chart.Legend obsolete. To avoid a breaking change, we export the Legend as part of
16453
+	 * the plugin, which one will be re-exposed in the chart.js file.
16454
+	 * https://github.com/chartjs/Chart.js/pull/2640
16455
+	 * @private
16456
+	 */
16457
+	_element: Legend,
16458
+
16459
+	beforeInit: function(chart) {
16460
+		var legendOpts = chart.options.legend;
16461
+
16462
+		if (legendOpts) {
16463
+			createNewLegendAndAttach(chart, legendOpts);
16464
+		}
16465
+	},
16466
+
16467
+	beforeUpdate: function(chart) {
16468
+		var legendOpts = chart.options.legend;
16469
+		var legend = chart.legend;
16470
+
16471
+		if (legendOpts) {
16472
+			helpers.mergeIf(legendOpts, defaults.global.legend);
16473
+
16474
+			if (legend) {
16475
+				layouts.configure(chart, legend, legendOpts);
16476
+				legend.options = legendOpts;
16477
+			} else {
16478
+				createNewLegendAndAttach(chart, legendOpts);
16479
+			}
16480
+		} else if (legend) {
16481
+			layouts.removeBox(chart, legend);
16482
+			delete chart.legend;
16483
+		}
16484
+	},
16485
+
16486
+	afterEvent: function(chart, e) {
16487
+		var legend = chart.legend;
16488
+		if (legend) {
16489
+			legend.handleEvent(e);
16490
+		}
16491
+	}
16492
+};
16493
+
16494
+},{"25":25,"26":26,"30":30,"45":45}],52:[function(require,module,exports){
16495
+'use strict';
16496
+
16497
+var defaults = require(25);
16498
+var Element = require(26);
16499
+var helpers = require(45);
16500
+var layouts = require(30);
16501
+
16502
+var noop = helpers.noop;
16503
+
16504
+defaults._set('global', {
16505
+	title: {
16506
+		display: false,
16507
+		fontStyle: 'bold',
16508
+		fullWidth: true,
16509
+		lineHeight: 1.2,
16510
+		padding: 10,
16511
+		position: 'top',
16512
+		text: '',
16513
+		weight: 2000         // by default greater than legend (1000) to be above
16514
+	}
16515
+});
16516
+
16517
+/**
16518
+ * IMPORTANT: this class is exposed publicly as Chart.Legend, backward compatibility required!
16519
+ */
16520
+var Title = Element.extend({
16521
+	initialize: function(config) {
16522
+		var me = this;
16523
+		helpers.extend(me, config);
16524
+
16525
+		// Contains hit boxes for each dataset (in dataset order)
16526
+		me.legendHitBoxes = [];
16527
+	},
16528
+
16529
+	// These methods are ordered by lifecycle. Utilities then follow.
16530
+
16531
+	beforeUpdate: noop,
16532
+	update: function(maxWidth, maxHeight, margins) {
16533
+		var me = this;
16534
+
16535
+		// Update Lifecycle - Probably don't want to ever extend or overwrite this function ;)
16536
+		me.beforeUpdate();
16537
+
16538
+		// Absorb the master measurements
16539
+		me.maxWidth = maxWidth;
16540
+		me.maxHeight = maxHeight;
16541
+		me.margins = margins;
16542
+
16543
+		// Dimensions
16544
+		me.beforeSetDimensions();
16545
+		me.setDimensions();
16546
+		me.afterSetDimensions();
16547
+		// Labels
16548
+		me.beforeBuildLabels();
16549
+		me.buildLabels();
16550
+		me.afterBuildLabels();
16551
+
16552
+		// Fit
16553
+		me.beforeFit();
16554
+		me.fit();
16555
+		me.afterFit();
16556
+		//
16557
+		me.afterUpdate();
16558
+
16559
+		return me.minSize;
16560
+
16561
+	},
16562
+	afterUpdate: noop,
16563
+
16564
+	//
16565
+
16566
+	beforeSetDimensions: noop,
16567
+	setDimensions: function() {
16568
+		var me = this;
16569
+		// Set the unconstrained dimension before label rotation
16570
+		if (me.isHorizontal()) {
16571
+			// Reset position before calculating rotation
16572
+			me.width = me.maxWidth;
16573
+			me.left = 0;
16574
+			me.right = me.width;
16575
+		} else {
16576
+			me.height = me.maxHeight;
16577
+
16578
+			// Reset position before calculating rotation
16579
+			me.top = 0;
16580
+			me.bottom = me.height;
16581
+		}
16582
+
16583
+		// Reset padding
16584
+		me.paddingLeft = 0;
16585
+		me.paddingTop = 0;
16586
+		me.paddingRight = 0;
16587
+		me.paddingBottom = 0;
16588
+
16589
+		// Reset minSize
16590
+		me.minSize = {
16591
+			width: 0,
16592
+			height: 0
16593
+		};
16594
+	},
16595
+	afterSetDimensions: noop,
16596
+
16597
+	//
16598
+
16599
+	beforeBuildLabels: noop,
16600
+	buildLabels: noop,
16601
+	afterBuildLabels: noop,
16602
+
16603
+	//
16604
+
16605
+	beforeFit: noop,
16606
+	fit: function() {
16607
+		var me = this;
16608
+		var valueOrDefault = helpers.valueOrDefault;
16609
+		var opts = me.options;
16610
+		var display = opts.display;
16611
+		var fontSize = valueOrDefault(opts.fontSize, defaults.global.defaultFontSize);
16612
+		var minSize = me.minSize;
16613
+		var lineCount = helpers.isArray(opts.text) ? opts.text.length : 1;
16614
+		var lineHeight = helpers.options.toLineHeight(opts.lineHeight, fontSize);
16615
+		var textSize = display ? (lineCount * lineHeight) + (opts.padding * 2) : 0;
16616
+
16617
+		if (me.isHorizontal()) {
16618
+			minSize.width = me.maxWidth; // fill all the width
16619
+			minSize.height = textSize;
16620
+		} else {
16621
+			minSize.width = textSize;
16622
+			minSize.height = me.maxHeight; // fill all the height
16623
+		}
16624
+
16625
+		me.width = minSize.width;
16626
+		me.height = minSize.height;
16627
+
16628
+	},
16629
+	afterFit: noop,
16630
+
16631
+	// Shared Methods
16632
+	isHorizontal: function() {
16633
+		var pos = this.options.position;
16634
+		return pos === 'top' || pos === 'bottom';
16635
+	},
16636
+
16637
+	// Actually draw the title block on the canvas
16638
+	draw: function() {
16639
+		var me = this;
16640
+		var ctx = me.ctx;
16641
+		var valueOrDefault = helpers.valueOrDefault;
16642
+		var opts = me.options;
16643
+		var globalDefaults = defaults.global;
16644
+
16645
+		if (opts.display) {
16646
+			var fontSize = valueOrDefault(opts.fontSize, globalDefaults.defaultFontSize);
16647
+			var fontStyle = valueOrDefault(opts.fontStyle, globalDefaults.defaultFontStyle);
16648
+			var fontFamily = valueOrDefault(opts.fontFamily, globalDefaults.defaultFontFamily);
16649
+			var titleFont = helpers.fontString(fontSize, fontStyle, fontFamily);
16650
+			var lineHeight = helpers.options.toLineHeight(opts.lineHeight, fontSize);
16651
+			var offset = lineHeight / 2 + opts.padding;
16652
+			var rotation = 0;
16653
+			var top = me.top;
16654
+			var left = me.left;
16655
+			var bottom = me.bottom;
16656
+			var right = me.right;
16657
+			var maxWidth, titleX, titleY;
16658
+
16659
+			ctx.fillStyle = valueOrDefault(opts.fontColor, globalDefaults.defaultFontColor); // render in correct colour
16660
+			ctx.font = titleFont;
16661
+
16662
+			// Horizontal
16663
+			if (me.isHorizontal()) {
16664
+				titleX = left + ((right - left) / 2); // midpoint of the width
16665
+				titleY = top + offset;
16666
+				maxWidth = right - left;
16667
+			} else {
16668
+				titleX = opts.position === 'left' ? left + offset : right - offset;
16669
+				titleY = top + ((bottom - top) / 2);
16670
+				maxWidth = bottom - top;
16671
+				rotation = Math.PI * (opts.position === 'left' ? -0.5 : 0.5);
16672
+			}
16673
+
16674
+			ctx.save();
16675
+			ctx.translate(titleX, titleY);
16676
+			ctx.rotate(rotation);
16677
+			ctx.textAlign = 'center';
16678
+			ctx.textBaseline = 'middle';
16679
+
16680
+			var text = opts.text;
16681
+			if (helpers.isArray(text)) {
16682
+				var y = 0;
16683
+				for (var i = 0; i < text.length; ++i) {
16684
+					ctx.fillText(text[i], 0, y, maxWidth);
16685
+					y += lineHeight;
16686
+				}
16687
+			} else {
16688
+				ctx.fillText(text, 0, 0, maxWidth);
16689
+			}
16690
+
16691
+			ctx.restore();
16692
+		}
16693
+	}
16694
+});
16695
+
16696
+function createNewTitleBlockAndAttach(chart, titleOpts) {
16697
+	var title = new Title({
16698
+		ctx: chart.ctx,
16699
+		options: titleOpts,
16700
+		chart: chart
16701
+	});
16702
+
16703
+	layouts.configure(chart, title, titleOpts);
16704
+	layouts.addBox(chart, title);
16705
+	chart.titleBlock = title;
16706
+}
16707
+
16708
+module.exports = {
16709
+	id: 'title',
16710
+
16711
+	/**
16712
+	 * Backward compatibility: since 2.1.5, the title is registered as a plugin, making
16713
+	 * Chart.Title obsolete. To avoid a breaking change, we export the Title as part of
16714
+	 * the plugin, which one will be re-exposed in the chart.js file.
16715
+	 * https://github.com/chartjs/Chart.js/pull/2640
16716
+	 * @private
16717
+	 */
16718
+	_element: Title,
16719
+
16720
+	beforeInit: function(chart) {
16721
+		var titleOpts = chart.options.title;
16722
+
16723
+		if (titleOpts) {
16724
+			createNewTitleBlockAndAttach(chart, titleOpts);
16725
+		}
16726
+	},
16727
+
16728
+	beforeUpdate: function(chart) {
16729
+		var titleOpts = chart.options.title;
16730
+		var titleBlock = chart.titleBlock;
16731
+
16732
+		if (titleOpts) {
16733
+			helpers.mergeIf(titleOpts, defaults.global.title);
16734
+
16735
+			if (titleBlock) {
16736
+				layouts.configure(chart, titleBlock, titleOpts);
16737
+				titleBlock.options = titleOpts;
16738
+			} else {
16739
+				createNewTitleBlockAndAttach(chart, titleOpts);
16740
+			}
16741
+		} else if (titleBlock) {
16742
+			layouts.removeBox(chart, titleBlock);
16743
+			delete chart.titleBlock;
16744
+		}
16745
+	}
16746
+};
16747
+
16748
+},{"25":25,"26":26,"30":30,"45":45}],53:[function(require,module,exports){
16749
+'use strict';
16750
+
16751
+module.exports = function(Chart) {
16752
+
16753
+	// Default config for a category scale
16754
+	var defaultConfig = {
16755
+		position: 'bottom'
16756
+	};
16757
+
16758
+	var DatasetScale = Chart.Scale.extend({
16759
+		/**
16760
+		* Internal function to get the correct labels. If data.xLabels or data.yLabels are defined, use those
16761
+		* else fall back to data.labels
16762
+		* @private
16763
+		*/
16764
+		getLabels: function() {
16765
+			var data = this.chart.data;
16766
+			return this.options.labels || (this.isHorizontal() ? data.xLabels : data.yLabels) || data.labels;
16767
+		},
16768
+
16769
+		determineDataLimits: function() {
16770
+			var me = this;
16771
+			var labels = me.getLabels();
16772
+			me.minIndex = 0;
16773
+			me.maxIndex = labels.length - 1;
16774
+			var findIndex;
16775
+
16776
+			if (me.options.ticks.min !== undefined) {
16777
+				// user specified min value
16778
+				findIndex = labels.indexOf(me.options.ticks.min);
16779
+				me.minIndex = findIndex !== -1 ? findIndex : me.minIndex;
16780
+			}
16781
+
16782
+			if (me.options.ticks.max !== undefined) {
16783
+				// user specified max value
16784
+				findIndex = labels.indexOf(me.options.ticks.max);
16785
+				me.maxIndex = findIndex !== -1 ? findIndex : me.maxIndex;
16786
+			}
16787
+
16788
+			me.min = labels[me.minIndex];
16789
+			me.max = labels[me.maxIndex];
16790
+		},
16791
+
16792
+		buildTicks: function() {
16793
+			var me = this;
16794
+			var labels = me.getLabels();
16795
+			// If we are viewing some subset of labels, slice the original array
16796
+			me.ticks = (me.minIndex === 0 && me.maxIndex === labels.length - 1) ? labels : labels.slice(me.minIndex, me.maxIndex + 1);
16797
+		},
16798
+
16799
+		getLabelForIndex: function(index, datasetIndex) {
16800
+			var me = this;
16801
+			var data = me.chart.data;
16802
+			var isHorizontal = me.isHorizontal();
16803
+
16804
+			if (data.yLabels && !isHorizontal) {
16805
+				return me.getRightValue(data.datasets[datasetIndex].data[index]);
16806
+			}
16807
+			return me.ticks[index - me.minIndex];
16808
+		},
16809
+
16810
+		// Used to get data value locations.  Value can either be an index or a numerical value
16811
+		getPixelForValue: function(value, index) {
16812
+			var me = this;
16813
+			var offset = me.options.offset;
16814
+			// 1 is added because we need the length but we have the indexes
16815
+			var offsetAmt = Math.max((me.maxIndex + 1 - me.minIndex - (offset ? 0 : 1)), 1);
16816
+
16817
+			// If value is a data object, then index is the index in the data array,
16818
+			// not the index of the scale. We need to change that.
16819
+			var valueCategory;
16820
+			if (value !== undefined && value !== null) {
16821
+				valueCategory = me.isHorizontal() ? value.x : value.y;
16822
+			}
16823
+			if (valueCategory !== undefined || (value !== undefined && isNaN(index))) {
16824
+				var labels = me.getLabels();
16825
+				value = valueCategory || value;
16826
+				var idx = labels.indexOf(value);
16827
+				index = idx !== -1 ? idx : index;
16828
+			}
16829
+
16830
+			if (me.isHorizontal()) {
16831
+				var valueWidth = me.width / offsetAmt;
16832
+				var widthOffset = (valueWidth * (index - me.minIndex));
16833
+
16834
+				if (offset) {
16835
+					widthOffset += (valueWidth / 2);
16836
+				}
16837
+
16838
+				return me.left + Math.round(widthOffset);
16839
+			}
16840
+			var valueHeight = me.height / offsetAmt;
16841
+			var heightOffset = (valueHeight * (index - me.minIndex));
16842
+
16843
+			if (offset) {
16844
+				heightOffset += (valueHeight / 2);
16845
+			}
16846
+
16847
+			return me.top + Math.round(heightOffset);
16848
+		},
16849
+		getPixelForTick: function(index) {
16850
+			return this.getPixelForValue(this.ticks[index], index + this.minIndex, null);
16851
+		},
16852
+		getValueForPixel: function(pixel) {
16853
+			var me = this;
16854
+			var offset = me.options.offset;
16855
+			var value;
16856
+			var offsetAmt = Math.max((me._ticks.length - (offset ? 0 : 1)), 1);
16857
+			var horz = me.isHorizontal();
16858
+			var valueDimension = (horz ? me.width : me.height) / offsetAmt;
16859
+
16860
+			pixel -= horz ? me.left : me.top;
16861
+
16862
+			if (offset) {
16863
+				pixel -= (valueDimension / 2);
16864
+			}
16865
+
16866
+			if (pixel <= 0) {
16867
+				value = 0;
16868
+			} else {
16869
+				value = Math.round(pixel / valueDimension);
16870
+			}
16871
+
16872
+			return value + me.minIndex;
16873
+		},
16874
+		getBasePixel: function() {
16875
+			return this.bottom;
16876
+		}
16877
+	});
16878
+
16879
+	Chart.scaleService.registerScaleType('category', DatasetScale, defaultConfig);
16880
+
16881
+};
16882
+
16883
+},{}],54:[function(require,module,exports){
16884
+'use strict';
16885
+
16886
+var defaults = require(25);
16887
+var helpers = require(45);
16888
+var Ticks = require(34);
16889
+
16890
+module.exports = function(Chart) {
16891
+
16892
+	var defaultConfig = {
16893
+		position: 'left',
16894
+		ticks: {
16895
+			callback: Ticks.formatters.linear
16896
+		}
16897
+	};
16898
+
16899
+	var LinearScale = Chart.LinearScaleBase.extend({
16900
+
16901
+		determineDataLimits: function() {
16902
+			var me = this;
16903
+			var opts = me.options;
16904
+			var chart = me.chart;
16905
+			var data = chart.data;
16906
+			var datasets = data.datasets;
16907
+			var isHorizontal = me.isHorizontal();
16908
+			var DEFAULT_MIN = 0;
16909
+			var DEFAULT_MAX = 1;
16910
+
16911
+			function IDMatches(meta) {
16912
+				return isHorizontal ? meta.xAxisID === me.id : meta.yAxisID === me.id;
16913
+			}
16914
+
16915
+			// First Calculate the range
16916
+			me.min = null;
16917
+			me.max = null;
16918
+
16919
+			var hasStacks = opts.stacked;
16920
+			if (hasStacks === undefined) {
16921
+				helpers.each(datasets, function(dataset, datasetIndex) {
16922
+					if (hasStacks) {
16923
+						return;
16924
+					}
16925
+
16926
+					var meta = chart.getDatasetMeta(datasetIndex);
16927
+					if (chart.isDatasetVisible(datasetIndex) && IDMatches(meta) &&
16928
+						meta.stack !== undefined) {
16929
+						hasStacks = true;
16930
+					}
16931
+				});
16932
+			}
16933
+
16934
+			if (opts.stacked || hasStacks) {
16935
+				var valuesPerStack = {};
16936
+
16937
+				helpers.each(datasets, function(dataset, datasetIndex) {
16938
+					var meta = chart.getDatasetMeta(datasetIndex);
16939
+					var key = [
16940
+						meta.type,
16941
+						// we have a separate stack for stack=undefined datasets when the opts.stacked is undefined
16942
+						((opts.stacked === undefined && meta.stack === undefined) ? datasetIndex : ''),
16943
+						meta.stack
16944
+					].join('.');
16945
+
16946
+					if (valuesPerStack[key] === undefined) {
16947
+						valuesPerStack[key] = {
16948
+							positiveValues: [],
16949
+							negativeValues: []
16950
+						};
16951
+					}
16952
+
16953
+					// Store these per type
16954
+					var positiveValues = valuesPerStack[key].positiveValues;
16955
+					var negativeValues = valuesPerStack[key].negativeValues;
16956
+
16957
+					if (chart.isDatasetVisible(datasetIndex) && IDMatches(meta)) {
16958
+						helpers.each(dataset.data, function(rawValue, index) {
16959
+							var value = +me.getRightValue(rawValue);
16960
+							if (isNaN(value) || meta.data[index].hidden) {
16961
+								return;
16962
+							}
16963
+
16964
+							positiveValues[index] = positiveValues[index] || 0;
16965
+							negativeValues[index] = negativeValues[index] || 0;
16966
+
16967
+							if (opts.relativePoints) {
16968
+								positiveValues[index] = 100;
16969
+							} else if (value < 0) {
16970
+								negativeValues[index] += value;
16971
+							} else {
16972
+								positiveValues[index] += value;
16973
+							}
16974
+						});
16975
+					}
16976
+				});
16977
+
16978
+				helpers.each(valuesPerStack, function(valuesForType) {
16979
+					var values = valuesForType.positiveValues.concat(valuesForType.negativeValues);
16980
+					var minVal = helpers.min(values);
16981
+					var maxVal = helpers.max(values);
16982
+					me.min = me.min === null ? minVal : Math.min(me.min, minVal);
16983
+					me.max = me.max === null ? maxVal : Math.max(me.max, maxVal);
16984
+				});
16985
+
16986
+			} else {
16987
+				helpers.each(datasets, function(dataset, datasetIndex) {
16988
+					var meta = chart.getDatasetMeta(datasetIndex);
16989
+					if (chart.isDatasetVisible(datasetIndex) && IDMatches(meta)) {
16990
+						helpers.each(dataset.data, function(rawValue, index) {
16991
+							var value = +me.getRightValue(rawValue);
16992
+							if (isNaN(value) || meta.data[index].hidden) {
16993
+								return;
16994
+							}
16995
+
16996
+							if (me.min === null) {
16997
+								me.min = value;
16998
+							} else if (value < me.min) {
16999
+								me.min = value;
17000
+							}
17001
+
17002
+							if (me.max === null) {
17003
+								me.max = value;
17004
+							} else if (value > me.max) {
17005
+								me.max = value;
17006
+							}
17007
+						});
17008
+					}
17009
+				});
17010
+			}
17011
+
17012
+			me.min = isFinite(me.min) && !isNaN(me.min) ? me.min : DEFAULT_MIN;
17013
+			me.max = isFinite(me.max) && !isNaN(me.max) ? me.max : DEFAULT_MAX;
17014
+
17015
+			// Common base implementation to handle ticks.min, ticks.max, ticks.beginAtZero
17016
+			this.handleTickRangeOptions();
17017
+		},
17018
+		getTickLimit: function() {
17019
+			var maxTicks;
17020
+			var me = this;
17021
+			var tickOpts = me.options.ticks;
17022
+
17023
+			if (me.isHorizontal()) {
17024
+				maxTicks = Math.min(tickOpts.maxTicksLimit ? tickOpts.maxTicksLimit : 11, Math.ceil(me.width / 50));
17025
+			} else {
17026
+				// The factor of 2 used to scale the font size has been experimentally determined.
17027
+				var tickFontSize = helpers.valueOrDefault(tickOpts.fontSize, defaults.global.defaultFontSize);
17028
+				maxTicks = Math.min(tickOpts.maxTicksLimit ? tickOpts.maxTicksLimit : 11, Math.ceil(me.height / (2 * tickFontSize)));
17029
+			}
17030
+
17031
+			return maxTicks;
17032
+		},
17033
+		// Called after the ticks are built. We need
17034
+		handleDirectionalChanges: function() {
17035
+			if (!this.isHorizontal()) {
17036
+				// We are in a vertical orientation. The top value is the highest. So reverse the array
17037
+				this.ticks.reverse();
17038
+			}
17039
+		},
17040
+		getLabelForIndex: function(index, datasetIndex) {
17041
+			return +this.getRightValue(this.chart.data.datasets[datasetIndex].data[index]);
17042
+		},
17043
+		// Utils
17044
+		getPixelForValue: function(value) {
17045
+			// This must be called after fit has been run so that
17046
+			// this.left, this.top, this.right, and this.bottom have been defined
17047
+			var me = this;
17048
+			var start = me.start;
17049
+
17050
+			var rightValue = +me.getRightValue(value);
17051
+			var pixel;
17052
+			var range = me.end - start;
17053
+
17054
+			if (me.isHorizontal()) {
17055
+				pixel = me.left + (me.width / range * (rightValue - start));
17056
+			} else {
17057
+				pixel = me.bottom - (me.height / range * (rightValue - start));
17058
+			}
17059
+			return pixel;
17060
+		},
17061
+		getValueForPixel: function(pixel) {
17062
+			var me = this;
17063
+			var isHorizontal = me.isHorizontal();
17064
+			var innerDimension = isHorizontal ? me.width : me.height;
17065
+			var offset = (isHorizontal ? pixel - me.left : me.bottom - pixel) / innerDimension;
17066
+			return me.start + ((me.end - me.start) * offset);
17067
+		},
17068
+		getPixelForTick: function(index) {
17069
+			return this.getPixelForValue(this.ticksAsNumbers[index]);
17070
+		}
17071
+	});
17072
+	Chart.scaleService.registerScaleType('linear', LinearScale, defaultConfig);
17073
+
17074
+};
17075
+
17076
+},{"25":25,"34":34,"45":45}],55:[function(require,module,exports){
17077
+'use strict';
17078
+
17079
+var helpers = require(45);
17080
+
17081
+/**
17082
+ * Generate a set of linear ticks
17083
+ * @param generationOptions the options used to generate the ticks
17084
+ * @param dataRange the range of the data
17085
+ * @returns {Array<Number>} array of tick values
17086
+ */
17087
+function generateTicks(generationOptions, dataRange) {
17088
+	var ticks = [];
17089
+	// To get a "nice" value for the tick spacing, we will use the appropriately named
17090
+	// "nice number" algorithm. See http://stackoverflow.com/questions/8506881/nice-label-algorithm-for-charts-with-minimum-ticks
17091
+	// for details.
17092
+
17093
+	var spacing;
17094
+	if (generationOptions.stepSize && generationOptions.stepSize > 0) {
17095
+		spacing = generationOptions.stepSize;
17096
+	} else {
17097
+		var niceRange = helpers.niceNum(dataRange.max - dataRange.min, false);
17098
+		spacing = helpers.niceNum(niceRange / (generationOptions.maxTicks - 1), true);
17099
+	}
17100
+	var niceMin = Math.floor(dataRange.min / spacing) * spacing;
17101
+	var niceMax = Math.ceil(dataRange.max / spacing) * spacing;
17102
+
17103
+	// If min, max and stepSize is set and they make an evenly spaced scale use it.
17104
+	if (generationOptions.min && generationOptions.max && generationOptions.stepSize) {
17105
+		// If very close to our whole number, use it.
17106
+		if (helpers.almostWhole((generationOptions.max - generationOptions.min) / generationOptions.stepSize, spacing / 1000)) {
17107
+			niceMin = generationOptions.min;
17108
+			niceMax = generationOptions.max;
17109
+		}
17110
+	}
17111
+
17112
+	var numSpaces = (niceMax - niceMin) / spacing;
17113
+	// If very close to our rounded value, use it.
17114
+	if (helpers.almostEquals(numSpaces, Math.round(numSpaces), spacing / 1000)) {
17115
+		numSpaces = Math.round(numSpaces);
17116
+	} else {
17117
+		numSpaces = Math.ceil(numSpaces);
17118
+	}
17119
+
17120
+	var precision = 1;
17121
+	if (spacing < 1) {
17122
+		precision = Math.pow(10, spacing.toString().length - 2);
17123
+		niceMin = Math.round(niceMin * precision) / precision;
17124
+		niceMax = Math.round(niceMax * precision) / precision;
17125
+	}
17126
+	ticks.push(generationOptions.min !== undefined ? generationOptions.min : niceMin);
17127
+	for (var j = 1; j < numSpaces; ++j) {
17128
+		ticks.push(Math.round((niceMin + j * spacing) * precision) / precision);
17129
+	}
17130
+	ticks.push(generationOptions.max !== undefined ? generationOptions.max : niceMax);
17131
+
17132
+	return ticks;
17133
+}
17134
+
17135
+
17136
+module.exports = function(Chart) {
17137
+
17138
+	var noop = helpers.noop;
17139
+
17140
+	Chart.LinearScaleBase = Chart.Scale.extend({
17141
+		getRightValue: function(value) {
17142
+			if (typeof value === 'string') {
17143
+				return +value;
17144
+			}
17145
+			return Chart.Scale.prototype.getRightValue.call(this, value);
17146
+		},
17147
+
17148
+		handleTickRangeOptions: function() {
17149
+			var me = this;
17150
+			var opts = me.options;
17151
+			var tickOpts = opts.ticks;
17152
+
17153
+			// If we are forcing it to begin at 0, but 0 will already be rendered on the chart,
17154
+			// do nothing since that would make the chart weird. If the user really wants a weird chart
17155
+			// axis, they can manually override it
17156
+			if (tickOpts.beginAtZero) {
17157
+				var minSign = helpers.sign(me.min);
17158
+				var maxSign = helpers.sign(me.max);
17159
+
17160
+				if (minSign < 0 && maxSign < 0) {
17161
+					// move the top up to 0
17162
+					me.max = 0;
17163
+				} else if (minSign > 0 && maxSign > 0) {
17164
+					// move the bottom down to 0
17165
+					me.min = 0;
17166
+				}
17167
+			}
17168
+
17169
+			var setMin = tickOpts.min !== undefined || tickOpts.suggestedMin !== undefined;
17170
+			var setMax = tickOpts.max !== undefined || tickOpts.suggestedMax !== undefined;
17171
+
17172
+			if (tickOpts.min !== undefined) {
17173
+				me.min = tickOpts.min;
17174
+			} else if (tickOpts.suggestedMin !== undefined) {
17175
+				if (me.min === null) {
17176
+					me.min = tickOpts.suggestedMin;
17177
+				} else {
17178
+					me.min = Math.min(me.min, tickOpts.suggestedMin);
17179
+				}
17180
+			}
17181
+
17182
+			if (tickOpts.max !== undefined) {
17183
+				me.max = tickOpts.max;
17184
+			} else if (tickOpts.suggestedMax !== undefined) {
17185
+				if (me.max === null) {
17186
+					me.max = tickOpts.suggestedMax;
17187
+				} else {
17188
+					me.max = Math.max(me.max, tickOpts.suggestedMax);
17189
+				}
17190
+			}
17191
+
17192
+			if (setMin !== setMax) {
17193
+				// We set the min or the max but not both.
17194
+				// So ensure that our range is good
17195
+				// Inverted or 0 length range can happen when
17196
+				// ticks.min is set, and no datasets are visible
17197
+				if (me.min >= me.max) {
17198
+					if (setMin) {
17199
+						me.max = me.min + 1;
17200
+					} else {
17201
+						me.min = me.max - 1;
17202
+					}
17203
+				}
17204
+			}
17205
+
17206
+			if (me.min === me.max) {
17207
+				me.max++;
17208
+
17209
+				if (!tickOpts.beginAtZero) {
17210
+					me.min--;
17211
+				}
17212
+			}
17213
+		},
17214
+		getTickLimit: noop,
17215
+		handleDirectionalChanges: noop,
17216
+
17217
+		buildTicks: function() {
17218
+			var me = this;
17219
+			var opts = me.options;
17220
+			var tickOpts = opts.ticks;
17221
+
17222
+			// Figure out what the max number of ticks we can support it is based on the size of
17223
+			// the axis area. For now, we say that the minimum tick spacing in pixels must be 50
17224
+			// We also limit the maximum number of ticks to 11 which gives a nice 10 squares on
17225
+			// the graph. Make sure we always have at least 2 ticks
17226
+			var maxTicks = me.getTickLimit();
17227
+			maxTicks = Math.max(2, maxTicks);
17228
+
17229
+			var numericGeneratorOptions = {
17230
+				maxTicks: maxTicks,
17231
+				min: tickOpts.min,
17232
+				max: tickOpts.max,
17233
+				stepSize: helpers.valueOrDefault(tickOpts.fixedStepSize, tickOpts.stepSize)
17234
+			};
17235
+			var ticks = me.ticks = generateTicks(numericGeneratorOptions, me);
17236
+
17237
+			me.handleDirectionalChanges();
17238
+
17239
+			// At this point, we need to update our max and min given the tick values since we have expanded the
17240
+			// range of the scale
17241
+			me.max = helpers.max(ticks);
17242
+			me.min = helpers.min(ticks);
17243
+
17244
+			if (tickOpts.reverse) {
17245
+				ticks.reverse();
17246
+
17247
+				me.start = me.max;
17248
+				me.end = me.min;
17249
+			} else {
17250
+				me.start = me.min;
17251
+				me.end = me.max;
17252
+			}
17253
+		},
17254
+		convertTicksToLabels: function() {
17255
+			var me = this;
17256
+			me.ticksAsNumbers = me.ticks.slice();
17257
+			me.zeroLineIndex = me.ticks.indexOf(0);
17258
+
17259
+			Chart.Scale.prototype.convertTicksToLabels.call(me);
17260
+		}
17261
+	});
17262
+};
17263
+
17264
+},{"45":45}],56:[function(require,module,exports){
17265
+'use strict';
17266
+
17267
+var helpers = require(45);
17268
+var Ticks = require(34);
17269
+
17270
+/**
17271
+ * Generate a set of logarithmic ticks
17272
+ * @param generationOptions the options used to generate the ticks
17273
+ * @param dataRange the range of the data
17274
+ * @returns {Array<Number>} array of tick values
17275
+ */
17276
+function generateTicks(generationOptions, dataRange) {
17277
+	var ticks = [];
17278
+	var valueOrDefault = helpers.valueOrDefault;
17279
+
17280
+	// Figure out what the max number of ticks we can support it is based on the size of
17281
+	// the axis area. For now, we say that the minimum tick spacing in pixels must be 50
17282
+	// We also limit the maximum number of ticks to 11 which gives a nice 10 squares on
17283
+	// the graph
17284
+	var tickVal = valueOrDefault(generationOptions.min, Math.pow(10, Math.floor(helpers.log10(dataRange.min))));
17285
+
17286
+	var endExp = Math.floor(helpers.log10(dataRange.max));
17287
+	var endSignificand = Math.ceil(dataRange.max / Math.pow(10, endExp));
17288
+	var exp, significand;
17289
+
17290
+	if (tickVal === 0) {
17291
+		exp = Math.floor(helpers.log10(dataRange.minNotZero));
17292
+		significand = Math.floor(dataRange.minNotZero / Math.pow(10, exp));
17293
+
17294
+		ticks.push(tickVal);
17295
+		tickVal = significand * Math.pow(10, exp);
17296
+	} else {
17297
+		exp = Math.floor(helpers.log10(tickVal));
17298
+		significand = Math.floor(tickVal / Math.pow(10, exp));
17299
+	}
17300
+	var precision = exp < 0 ? Math.pow(10, Math.abs(exp)) : 1;
17301
+
17302
+	do {
17303
+		ticks.push(tickVal);
17304
+
17305
+		++significand;
17306
+		if (significand === 10) {
17307
+			significand = 1;
17308
+			++exp;
17309
+			precision = exp >= 0 ? 1 : precision;
17310
+		}
17311
+
17312
+		tickVal = Math.round(significand * Math.pow(10, exp) * precision) / precision;
17313
+	} while (exp < endExp || (exp === endExp && significand < endSignificand));
17314
+
17315
+	var lastTick = valueOrDefault(generationOptions.max, tickVal);
17316
+	ticks.push(lastTick);
17317
+
17318
+	return ticks;
17319
+}
17320
+
17321
+
17322
+module.exports = function(Chart) {
17323
+
17324
+	var defaultConfig = {
17325
+		position: 'left',
17326
+
17327
+		// label settings
17328
+		ticks: {
17329
+			callback: Ticks.formatters.logarithmic
17330
+		}
17331
+	};
17332
+
17333
+	var LogarithmicScale = Chart.Scale.extend({
17334
+		determineDataLimits: function() {
17335
+			var me = this;
17336
+			var opts = me.options;
17337
+			var chart = me.chart;
17338
+			var data = chart.data;
17339
+			var datasets = data.datasets;
17340
+			var isHorizontal = me.isHorizontal();
17341
+			function IDMatches(meta) {
17342
+				return isHorizontal ? meta.xAxisID === me.id : meta.yAxisID === me.id;
17343
+			}
17344
+
17345
+			// Calculate Range
17346
+			me.min = null;
17347
+			me.max = null;
17348
+			me.minNotZero = null;
17349
+
17350
+			var hasStacks = opts.stacked;
17351
+			if (hasStacks === undefined) {
17352
+				helpers.each(datasets, function(dataset, datasetIndex) {
17353
+					if (hasStacks) {
17354
+						return;
17355
+					}
17356
+
17357
+					var meta = chart.getDatasetMeta(datasetIndex);
17358
+					if (chart.isDatasetVisible(datasetIndex) && IDMatches(meta) &&
17359
+						meta.stack !== undefined) {
17360
+						hasStacks = true;
17361
+					}
17362
+				});
17363
+			}
17364
+
17365
+			if (opts.stacked || hasStacks) {
17366
+				var valuesPerStack = {};
17367
+
17368
+				helpers.each(datasets, function(dataset, datasetIndex) {
17369
+					var meta = chart.getDatasetMeta(datasetIndex);
17370
+					var key = [
17371
+						meta.type,
17372
+						// we have a separate stack for stack=undefined datasets when the opts.stacked is undefined
17373
+						((opts.stacked === undefined && meta.stack === undefined) ? datasetIndex : ''),
17374
+						meta.stack
17375
+					].join('.');
17376
+
17377
+					if (chart.isDatasetVisible(datasetIndex) && IDMatches(meta)) {
17378
+						if (valuesPerStack[key] === undefined) {
17379
+							valuesPerStack[key] = [];
17380
+						}
17381
+
17382
+						helpers.each(dataset.data, function(rawValue, index) {
17383
+							var values = valuesPerStack[key];
17384
+							var value = +me.getRightValue(rawValue);
17385
+							// invalid, hidden and negative values are ignored
17386
+							if (isNaN(value) || meta.data[index].hidden || value < 0) {
17387
+								return;
17388
+							}
17389
+							values[index] = values[index] || 0;
17390
+							values[index] += value;
17391
+						});
17392
+					}
17393
+				});
17394
+
17395
+				helpers.each(valuesPerStack, function(valuesForType) {
17396
+					if (valuesForType.length > 0) {
17397
+						var minVal = helpers.min(valuesForType);
17398
+						var maxVal = helpers.max(valuesForType);
17399
+						me.min = me.min === null ? minVal : Math.min(me.min, minVal);
17400
+						me.max = me.max === null ? maxVal : Math.max(me.max, maxVal);
17401
+					}
17402
+				});
17403
+
17404
+			} else {
17405
+				helpers.each(datasets, function(dataset, datasetIndex) {
17406
+					var meta = chart.getDatasetMeta(datasetIndex);
17407
+					if (chart.isDatasetVisible(datasetIndex) && IDMatches(meta)) {
17408
+						helpers.each(dataset.data, function(rawValue, index) {
17409
+							var value = +me.getRightValue(rawValue);
17410
+							// invalid, hidden and negative values are ignored
17411
+							if (isNaN(value) || meta.data[index].hidden || value < 0) {
17412
+								return;
17413
+							}
17414
+
17415
+							if (me.min === null) {
17416
+								me.min = value;
17417
+							} else if (value < me.min) {
17418
+								me.min = value;
17419
+							}
17420
+
17421
+							if (me.max === null) {
17422
+								me.max = value;
17423
+							} else if (value > me.max) {
17424
+								me.max = value;
17425
+							}
17426
+
17427
+							if (value !== 0 && (me.minNotZero === null || value < me.minNotZero)) {
17428
+								me.minNotZero = value;
17429
+							}
17430
+						});
17431
+					}
17432
+				});
17433
+			}
17434
+
17435
+			// Common base implementation to handle ticks.min, ticks.max
17436
+			this.handleTickRangeOptions();
17437
+		},
17438
+		handleTickRangeOptions: function() {
17439
+			var me = this;
17440
+			var opts = me.options;
17441
+			var tickOpts = opts.ticks;
17442
+			var valueOrDefault = helpers.valueOrDefault;
17443
+			var DEFAULT_MIN = 1;
17444
+			var DEFAULT_MAX = 10;
17445
+
17446
+			me.min = valueOrDefault(tickOpts.min, me.min);
17447
+			me.max = valueOrDefault(tickOpts.max, me.max);
17448
+
17449
+			if (me.min === me.max) {
17450
+				if (me.min !== 0 && me.min !== null) {
17451
+					me.min = Math.pow(10, Math.floor(helpers.log10(me.min)) - 1);
17452
+					me.max = Math.pow(10, Math.floor(helpers.log10(me.max)) + 1);
17453
+				} else {
17454
+					me.min = DEFAULT_MIN;
17455
+					me.max = DEFAULT_MAX;
17456
+				}
17457
+			}
17458
+			if (me.min === null) {
17459
+				me.min = Math.pow(10, Math.floor(helpers.log10(me.max)) - 1);
17460
+			}
17461
+			if (me.max === null) {
17462
+				me.max = me.min !== 0
17463
+					? Math.pow(10, Math.floor(helpers.log10(me.min)) + 1)
17464
+					: DEFAULT_MAX;
17465
+			}
17466
+			if (me.minNotZero === null) {
17467
+				if (me.min > 0) {
17468
+					me.minNotZero = me.min;
17469
+				} else if (me.max < 1) {
17470
+					me.minNotZero = Math.pow(10, Math.floor(helpers.log10(me.max)));
17471
+				} else {
17472
+					me.minNotZero = DEFAULT_MIN;
17473
+				}
17474
+			}
17475
+		},
17476
+		buildTicks: function() {
17477
+			var me = this;
17478
+			var opts = me.options;
17479
+			var tickOpts = opts.ticks;
17480
+			var reverse = !me.isHorizontal();
17481
+
17482
+			var generationOptions = {
17483
+				min: tickOpts.min,
17484
+				max: tickOpts.max
17485
+			};
17486
+			var ticks = me.ticks = generateTicks(generationOptions, me);
17487
+
17488
+			// At this point, we need to update our max and min given the tick values since we have expanded the
17489
+			// range of the scale
17490
+			me.max = helpers.max(ticks);
17491
+			me.min = helpers.min(ticks);
17492
+
17493
+			if (tickOpts.reverse) {
17494
+				reverse = !reverse;
17495
+				me.start = me.max;
17496
+				me.end = me.min;
17497
+			} else {
17498
+				me.start = me.min;
17499
+				me.end = me.max;
17500
+			}
17501
+			if (reverse) {
17502
+				ticks.reverse();
17503
+			}
17504
+		},
17505
+		convertTicksToLabels: function() {
17506
+			this.tickValues = this.ticks.slice();
17507
+
17508
+			Chart.Scale.prototype.convertTicksToLabels.call(this);
17509
+		},
17510
+		// Get the correct tooltip label
17511
+		getLabelForIndex: function(index, datasetIndex) {
17512
+			return +this.getRightValue(this.chart.data.datasets[datasetIndex].data[index]);
17513
+		},
17514
+		getPixelForTick: function(index) {
17515
+			return this.getPixelForValue(this.tickValues[index]);
17516
+		},
17517
+		/**
17518
+		 * Returns the value of the first tick.
17519
+		 * @param {Number} value - The minimum not zero value.
17520
+		 * @return {Number} The first tick value.
17521
+		 * @private
17522
+		 */
17523
+		_getFirstTickValue: function(value) {
17524
+			var exp = Math.floor(helpers.log10(value));
17525
+			var significand = Math.floor(value / Math.pow(10, exp));
17526
+
17527
+			return significand * Math.pow(10, exp);
17528
+		},
17529
+		getPixelForValue: function(value) {
17530
+			var me = this;
17531
+			var reverse = me.options.ticks.reverse;
17532
+			var log10 = helpers.log10;
17533
+			var firstTickValue = me._getFirstTickValue(me.minNotZero);
17534
+			var offset = 0;
17535
+			var innerDimension, pixel, start, end, sign;
17536
+
17537
+			value = +me.getRightValue(value);
17538
+			if (reverse) {
17539
+				start = me.end;
17540
+				end = me.start;
17541
+				sign = -1;
17542
+			} else {
17543
+				start = me.start;
17544
+				end = me.end;
17545
+				sign = 1;
17546
+			}
17547
+			if (me.isHorizontal()) {
17548
+				innerDimension = me.width;
17549
+				pixel = reverse ? me.right : me.left;
17550
+			} else {
17551
+				innerDimension = me.height;
17552
+				sign *= -1; // invert, since the upper-left corner of the canvas is at pixel (0, 0)
17553
+				pixel = reverse ? me.top : me.bottom;
17554
+			}
17555
+			if (value !== start) {
17556
+				if (start === 0) { // include zero tick
17557
+					offset = helpers.getValueOrDefault(
17558
+						me.options.ticks.fontSize,
17559
+						Chart.defaults.global.defaultFontSize
17560
+					);
17561
+					innerDimension -= offset;
17562
+					start = firstTickValue;
17563
+				}
17564
+				if (value !== 0) {
17565
+					offset += innerDimension / (log10(end) - log10(start)) * (log10(value) - log10(start));
17566
+				}
17567
+				pixel += sign * offset;
17568
+			}
17569
+			return pixel;
17570
+		},
17571
+		getValueForPixel: function(pixel) {
17572
+			var me = this;
17573
+			var reverse = me.options.ticks.reverse;
17574
+			var log10 = helpers.log10;
17575
+			var firstTickValue = me._getFirstTickValue(me.minNotZero);
17576
+			var innerDimension, start, end, value;
17577
+
17578
+			if (reverse) {
17579
+				start = me.end;
17580
+				end = me.start;
17581
+			} else {
17582
+				start = me.start;
17583
+				end = me.end;
17584
+			}
17585
+			if (me.isHorizontal()) {
17586
+				innerDimension = me.width;
17587
+				value = reverse ? me.right - pixel : pixel - me.left;
17588
+			} else {
17589
+				innerDimension = me.height;
17590
+				value = reverse ? pixel - me.top : me.bottom - pixel;
17591
+			}
17592
+			if (value !== start) {
17593
+				if (start === 0) { // include zero tick
17594
+					var offset = helpers.getValueOrDefault(
17595
+						me.options.ticks.fontSize,
17596
+						Chart.defaults.global.defaultFontSize
17597
+					);
17598
+					value -= offset;
17599
+					innerDimension -= offset;
17600
+					start = firstTickValue;
17601
+				}
17602
+				value *= log10(end) - log10(start);
17603
+				value /= innerDimension;
17604
+				value = Math.pow(10, log10(start) + value);
17605
+			}
17606
+			return value;
17607
+		}
17608
+	});
17609
+	Chart.scaleService.registerScaleType('logarithmic', LogarithmicScale, defaultConfig);
17610
+
17611
+};
17612
+
17613
+},{"34":34,"45":45}],57:[function(require,module,exports){
17614
+'use strict';
17615
+
17616
+var defaults = require(25);
17617
+var helpers = require(45);
17618
+var Ticks = require(34);
17619
+
17620
+module.exports = function(Chart) {
17621
+
17622
+	var globalDefaults = defaults.global;
17623
+
17624
+	var defaultConfig = {
17625
+		display: true,
17626
+
17627
+		// Boolean - Whether to animate scaling the chart from the centre
17628
+		animate: true,
17629
+		position: 'chartArea',
17630
+
17631
+		angleLines: {
17632
+			display: true,
17633
+			color: 'rgba(0, 0, 0, 0.1)',
17634
+			lineWidth: 1
17635
+		},
17636
+
17637
+		gridLines: {
17638
+			circular: false
17639
+		},
17640
+
17641
+		// label settings
17642
+		ticks: {
17643
+			// Boolean - Show a backdrop to the scale label
17644
+			showLabelBackdrop: true,
17645
+
17646
+			// String - The colour of the label backdrop
17647
+			backdropColor: 'rgba(255,255,255,0.75)',
17648
+
17649
+			// Number - The backdrop padding above & below the label in pixels
17650
+			backdropPaddingY: 2,
17651
+
17652
+			// Number - The backdrop padding to the side of the label in pixels
17653
+			backdropPaddingX: 2,
17654
+
17655
+			callback: Ticks.formatters.linear
17656
+		},
17657
+
17658
+		pointLabels: {
17659
+			// Boolean - if true, show point labels
17660
+			display: true,
17661
+
17662
+			// Number - Point label font size in pixels
17663
+			fontSize: 10,
17664
+
17665
+			// Function - Used to convert point labels
17666
+			callback: function(label) {
17667
+				return label;
17668
+			}
17669
+		}
17670
+	};
17671
+
17672
+	function getValueCount(scale) {
17673
+		var opts = scale.options;
17674
+		return opts.angleLines.display || opts.pointLabels.display ? scale.chart.data.labels.length : 0;
17675
+	}
17676
+
17677
+	function getPointLabelFontOptions(scale) {
17678
+		var pointLabelOptions = scale.options.pointLabels;
17679
+		var fontSize = helpers.valueOrDefault(pointLabelOptions.fontSize, globalDefaults.defaultFontSize);
17680
+		var fontStyle = helpers.valueOrDefault(pointLabelOptions.fontStyle, globalDefaults.defaultFontStyle);
17681
+		var fontFamily = helpers.valueOrDefault(pointLabelOptions.fontFamily, globalDefaults.defaultFontFamily);
17682
+		var font = helpers.fontString(fontSize, fontStyle, fontFamily);
17683
+
17684
+		return {
17685
+			size: fontSize,
17686
+			style: fontStyle,
17687
+			family: fontFamily,
17688
+			font: font
17689
+		};
17690
+	}
17691
+
17692
+	function measureLabelSize(ctx, fontSize, label) {
17693
+		if (helpers.isArray(label)) {
17694
+			return {
17695
+				w: helpers.longestText(ctx, ctx.font, label),
17696
+				h: (label.length * fontSize) + ((label.length - 1) * 1.5 * fontSize)
17697
+			};
17698
+		}
17699
+
17700
+		return {
17701
+			w: ctx.measureText(label).width,
17702
+			h: fontSize
17703
+		};
17704
+	}
17705
+
17706
+	function determineLimits(angle, pos, size, min, max) {
17707
+		if (angle === min || angle === max) {
17708
+			return {
17709
+				start: pos - (size / 2),
17710
+				end: pos + (size / 2)
17711
+			};
17712
+		} else if (angle < min || angle > max) {
17713
+			return {
17714
+				start: pos - size - 5,
17715
+				end: pos
17716
+			};
17717
+		}
17718
+
17719
+		return {
17720
+			start: pos,
17721
+			end: pos + size + 5
17722
+		};
17723
+	}
17724
+
17725
+	/**
17726
+	 * Helper function to fit a radial linear scale with point labels
17727
+	 */
17728
+	function fitWithPointLabels(scale) {
17729
+		/*
17730
+		 * Right, this is really confusing and there is a lot of maths going on here
17731
+		 * The gist of the problem is here: https://gist.github.com/nnnick/696cc9c55f4b0beb8fe9
17732
+		 *
17733
+		 * Reaction: https://dl.dropboxusercontent.com/u/34601363/toomuchscience.gif
17734
+		 *
17735
+		 * Solution:
17736
+		 *
17737
+		 * We assume the radius of the polygon is half the size of the canvas at first
17738
+		 * at each index we check if the text overlaps.
17739
+		 *
17740
+		 * Where it does, we store that angle and that index.
17741
+		 *
17742
+		 * After finding the largest index and angle we calculate how much we need to remove
17743
+		 * from the shape radius to move the point inwards by that x.
17744
+		 *
17745
+		 * We average the left and right distances to get the maximum shape radius that can fit in the box
17746
+		 * along with labels.
17747
+		 *
17748
+		 * Once we have that, we can find the centre point for the chart, by taking the x text protrusion
17749
+		 * on each side, removing that from the size, halving it and adding the left x protrusion width.
17750
+		 *
17751
+		 * This will mean we have a shape fitted to the canvas, as large as it can be with the labels
17752
+		 * and position it in the most space efficient manner
17753
+		 *
17754
+		 * https://dl.dropboxusercontent.com/u/34601363/yeahscience.gif
17755
+		 */
17756
+
17757
+		var plFont = getPointLabelFontOptions(scale);
17758
+
17759
+		// Get maximum radius of the polygon. Either half the height (minus the text width) or half the width.
17760
+		// Use this to calculate the offset + change. - Make sure L/R protrusion is at least 0 to stop issues with centre points
17761
+		var largestPossibleRadius = Math.min(scale.height / 2, scale.width / 2);
17762
+		var furthestLimits = {
17763
+			r: scale.width,
17764
+			l: 0,
17765
+			t: scale.height,
17766
+			b: 0
17767
+		};
17768
+		var furthestAngles = {};
17769
+		var i, textSize, pointPosition;
17770
+
17771
+		scale.ctx.font = plFont.font;
17772
+		scale._pointLabelSizes = [];
17773
+
17774
+		var valueCount = getValueCount(scale);
17775
+		for (i = 0; i < valueCount; i++) {
17776
+			pointPosition = scale.getPointPosition(i, largestPossibleRadius);
17777
+			textSize = measureLabelSize(scale.ctx, plFont.size, scale.pointLabels[i] || '');
17778
+			scale._pointLabelSizes[i] = textSize;
17779
+
17780
+			// Add quarter circle to make degree 0 mean top of circle
17781
+			var angleRadians = scale.getIndexAngle(i);
17782
+			var angle = helpers.toDegrees(angleRadians) % 360;
17783
+			var hLimits = determineLimits(angle, pointPosition.x, textSize.w, 0, 180);
17784
+			var vLimits = determineLimits(angle, pointPosition.y, textSize.h, 90, 270);
17785
+
17786
+			if (hLimits.start < furthestLimits.l) {
17787
+				furthestLimits.l = hLimits.start;
17788
+				furthestAngles.l = angleRadians;
17789
+			}
17790
+
17791
+			if (hLimits.end > furthestLimits.r) {
17792
+				furthestLimits.r = hLimits.end;
17793
+				furthestAngles.r = angleRadians;
17794
+			}
17795
+
17796
+			if (vLimits.start < furthestLimits.t) {
17797
+				furthestLimits.t = vLimits.start;
17798
+				furthestAngles.t = angleRadians;
17799
+			}
17800
+
17801
+			if (vLimits.end > furthestLimits.b) {
17802
+				furthestLimits.b = vLimits.end;
17803
+				furthestAngles.b = angleRadians;
17804
+			}
17805
+		}
17806
+
17807
+		scale.setReductions(largestPossibleRadius, furthestLimits, furthestAngles);
17808
+	}
17809
+
17810
+	/**
17811
+	 * Helper function to fit a radial linear scale with no point labels
17812
+	 */
17813
+	function fit(scale) {
17814
+		var largestPossibleRadius = Math.min(scale.height / 2, scale.width / 2);
17815
+		scale.drawingArea = Math.round(largestPossibleRadius);
17816
+		scale.setCenterPoint(0, 0, 0, 0);
17817
+	}
17818
+
17819
+	function getTextAlignForAngle(angle) {
17820
+		if (angle === 0 || angle === 180) {
17821
+			return 'center';
17822
+		} else if (angle < 180) {
17823
+			return 'left';
17824
+		}
17825
+
17826
+		return 'right';
17827
+	}
17828
+
17829
+	function fillText(ctx, text, position, fontSize) {
17830
+		if (helpers.isArray(text)) {
17831
+			var y = position.y;
17832
+			var spacing = 1.5 * fontSize;
17833
+
17834
+			for (var i = 0; i < text.length; ++i) {
17835
+				ctx.fillText(text[i], position.x, y);
17836
+				y += spacing;
17837
+			}
17838
+		} else {
17839
+			ctx.fillText(text, position.x, position.y);
17840
+		}
17841
+	}
17842
+
17843
+	function adjustPointPositionForLabelHeight(angle, textSize, position) {
17844
+		if (angle === 90 || angle === 270) {
17845
+			position.y -= (textSize.h / 2);
17846
+		} else if (angle > 270 || angle < 90) {
17847
+			position.y -= textSize.h;
17848
+		}
17849
+	}
17850
+
17851
+	function drawPointLabels(scale) {
17852
+		var ctx = scale.ctx;
17853
+		var opts = scale.options;
17854
+		var angleLineOpts = opts.angleLines;
17855
+		var pointLabelOpts = opts.pointLabels;
17856
+
17857
+		ctx.lineWidth = angleLineOpts.lineWidth;
17858
+		ctx.strokeStyle = angleLineOpts.color;
17859
+
17860
+		var outerDistance = scale.getDistanceFromCenterForValue(opts.ticks.reverse ? scale.min : scale.max);
17861
+
17862
+		// Point Label Font
17863
+		var plFont = getPointLabelFontOptions(scale);
17864
+
17865
+		ctx.textBaseline = 'top';
17866
+
17867
+		for (var i = getValueCount(scale) - 1; i >= 0; i--) {
17868
+			if (angleLineOpts.display) {
17869
+				var outerPosition = scale.getPointPosition(i, outerDistance);
17870
+				ctx.beginPath();
17871
+				ctx.moveTo(scale.xCenter, scale.yCenter);
17872
+				ctx.lineTo(outerPosition.x, outerPosition.y);
17873
+				ctx.stroke();
17874
+				ctx.closePath();
17875
+			}
17876
+
17877
+			if (pointLabelOpts.display) {
17878
+				// Extra 3px out for some label spacing
17879
+				var pointLabelPosition = scale.getPointPosition(i, outerDistance + 5);
17880
+
17881
+				// Keep this in loop since we may support array properties here
17882
+				var pointLabelFontColor = helpers.valueAtIndexOrDefault(pointLabelOpts.fontColor, i, globalDefaults.defaultFontColor);
17883
+				ctx.font = plFont.font;
17884
+				ctx.fillStyle = pointLabelFontColor;
17885
+
17886
+				var angleRadians = scale.getIndexAngle(i);
17887
+				var angle = helpers.toDegrees(angleRadians);
17888
+				ctx.textAlign = getTextAlignForAngle(angle);
17889
+				adjustPointPositionForLabelHeight(angle, scale._pointLabelSizes[i], pointLabelPosition);
17890
+				fillText(ctx, scale.pointLabels[i] || '', pointLabelPosition, plFont.size);
17891
+			}
17892
+		}
17893
+	}
17894
+
17895
+	function drawRadiusLine(scale, gridLineOpts, radius, index) {
17896
+		var ctx = scale.ctx;
17897
+		ctx.strokeStyle = helpers.valueAtIndexOrDefault(gridLineOpts.color, index - 1);
17898
+		ctx.lineWidth = helpers.valueAtIndexOrDefault(gridLineOpts.lineWidth, index - 1);
17899
+
17900
+		if (scale.options.gridLines.circular) {
17901
+			// Draw circular arcs between the points
17902
+			ctx.beginPath();
17903
+			ctx.arc(scale.xCenter, scale.yCenter, radius, 0, Math.PI * 2);
17904
+			ctx.closePath();
17905
+			ctx.stroke();
17906
+		} else {
17907
+			// Draw straight lines connecting each index
17908
+			var valueCount = getValueCount(scale);
17909
+
17910
+			if (valueCount === 0) {
17911
+				return;
17912
+			}
17913
+
17914
+			ctx.beginPath();
17915
+			var pointPosition = scale.getPointPosition(0, radius);
17916
+			ctx.moveTo(pointPosition.x, pointPosition.y);
17917
+
17918
+			for (var i = 1; i < valueCount; i++) {
17919
+				pointPosition = scale.getPointPosition(i, radius);
17920
+				ctx.lineTo(pointPosition.x, pointPosition.y);
17921
+			}
17922
+
17923
+			ctx.closePath();
17924
+			ctx.stroke();
17925
+		}
17926
+	}
17927
+
17928
+	function numberOrZero(param) {
17929
+		return helpers.isNumber(param) ? param : 0;
17930
+	}
17931
+
17932
+	var LinearRadialScale = Chart.LinearScaleBase.extend({
17933
+		setDimensions: function() {
17934
+			var me = this;
17935
+			var opts = me.options;
17936
+			var tickOpts = opts.ticks;
17937
+			// Set the unconstrained dimension before label rotation
17938
+			me.width = me.maxWidth;
17939
+			me.height = me.maxHeight;
17940
+			me.xCenter = Math.round(me.width / 2);
17941
+			me.yCenter = Math.round(me.height / 2);
17942
+
17943
+			var minSize = helpers.min([me.height, me.width]);
17944
+			var tickFontSize = helpers.valueOrDefault(tickOpts.fontSize, globalDefaults.defaultFontSize);
17945
+			me.drawingArea = opts.display ? (minSize / 2) - (tickFontSize / 2 + tickOpts.backdropPaddingY) : (minSize / 2);
17946
+		},
17947
+		determineDataLimits: function() {
17948
+			var me = this;
17949
+			var chart = me.chart;
17950
+			var min = Number.POSITIVE_INFINITY;
17951
+			var max = Number.NEGATIVE_INFINITY;
17952
+
17953
+			helpers.each(chart.data.datasets, function(dataset, datasetIndex) {
17954
+				if (chart.isDatasetVisible(datasetIndex)) {
17955
+					var meta = chart.getDatasetMeta(datasetIndex);
17956
+
17957
+					helpers.each(dataset.data, function(rawValue, index) {
17958
+						var value = +me.getRightValue(rawValue);
17959
+						if (isNaN(value) || meta.data[index].hidden) {
17960
+							return;
17961
+						}
17962
+
17963
+						min = Math.min(value, min);
17964
+						max = Math.max(value, max);
17965
+					});
17966
+				}
17967
+			});
17968
+
17969
+			me.min = (min === Number.POSITIVE_INFINITY ? 0 : min);
17970
+			me.max = (max === Number.NEGATIVE_INFINITY ? 0 : max);
17971
+
17972
+			// Common base implementation to handle ticks.min, ticks.max, ticks.beginAtZero
17973
+			me.handleTickRangeOptions();
17974
+		},
17975
+		getTickLimit: function() {
17976
+			var tickOpts = this.options.ticks;
17977
+			var tickFontSize = helpers.valueOrDefault(tickOpts.fontSize, globalDefaults.defaultFontSize);
17978
+			return Math.min(tickOpts.maxTicksLimit ? tickOpts.maxTicksLimit : 11, Math.ceil(this.drawingArea / (1.5 * tickFontSize)));
17979
+		},
17980
+		convertTicksToLabels: function() {
17981
+			var me = this;
17982
+
17983
+			Chart.LinearScaleBase.prototype.convertTicksToLabels.call(me);
17984
+
17985
+			// Point labels
17986
+			me.pointLabels = me.chart.data.labels.map(me.options.pointLabels.callback, me);
17987
+		},
17988
+		getLabelForIndex: function(index, datasetIndex) {
17989
+			return +this.getRightValue(this.chart.data.datasets[datasetIndex].data[index]);
17990
+		},
17991
+		fit: function() {
17992
+			if (this.options.pointLabels.display) {
17993
+				fitWithPointLabels(this);
17994
+			} else {
17995
+				fit(this);
17996
+			}
17997
+		},
17998
+		/**
17999
+		 * Set radius reductions and determine new radius and center point
18000
+		 * @private
18001
+		 */
18002
+		setReductions: function(largestPossibleRadius, furthestLimits, furthestAngles) {
18003
+			var me = this;
18004
+			var radiusReductionLeft = furthestLimits.l / Math.sin(furthestAngles.l);
18005
+			var radiusReductionRight = Math.max(furthestLimits.r - me.width, 0) / Math.sin(furthestAngles.r);
18006
+			var radiusReductionTop = -furthestLimits.t / Math.cos(furthestAngles.t);
18007
+			var radiusReductionBottom = -Math.max(furthestLimits.b - me.height, 0) / Math.cos(furthestAngles.b);
18008
+
18009
+			radiusReductionLeft = numberOrZero(radiusReductionLeft);
18010
+			radiusReductionRight = numberOrZero(radiusReductionRight);
18011
+			radiusReductionTop = numberOrZero(radiusReductionTop);
18012
+			radiusReductionBottom = numberOrZero(radiusReductionBottom);
18013
+
18014
+			me.drawingArea = Math.min(
18015
+				Math.round(largestPossibleRadius - (radiusReductionLeft + radiusReductionRight) / 2),
18016
+				Math.round(largestPossibleRadius - (radiusReductionTop + radiusReductionBottom) / 2));
18017
+			me.setCenterPoint(radiusReductionLeft, radiusReductionRight, radiusReductionTop, radiusReductionBottom);
18018
+		},
18019
+		setCenterPoint: function(leftMovement, rightMovement, topMovement, bottomMovement) {
18020
+			var me = this;
18021
+			var maxRight = me.width - rightMovement - me.drawingArea;
18022
+			var maxLeft = leftMovement + me.drawingArea;
18023
+			var maxTop = topMovement + me.drawingArea;
18024
+			var maxBottom = me.height - bottomMovement - me.drawingArea;
18025
+
18026
+			me.xCenter = Math.round(((maxLeft + maxRight) / 2) + me.left);
18027
+			me.yCenter = Math.round(((maxTop + maxBottom) / 2) + me.top);
18028
+		},
18029
+
18030
+		getIndexAngle: function(index) {
18031
+			var angleMultiplier = (Math.PI * 2) / getValueCount(this);
18032
+			var startAngle = this.chart.options && this.chart.options.startAngle ?
18033
+				this.chart.options.startAngle :
18034
+				0;
18035
+
18036
+			var startAngleRadians = startAngle * Math.PI * 2 / 360;
18037
+
18038
+			// Start from the top instead of right, so remove a quarter of the circle
18039
+			return index * angleMultiplier + startAngleRadians;
18040
+		},
18041
+		getDistanceFromCenterForValue: function(value) {
18042
+			var me = this;
18043
+
18044
+			if (value === null) {
18045
+				return 0; // null always in center
18046
+			}
18047
+
18048
+			// Take into account half font size + the yPadding of the top value
18049
+			var scalingFactor = me.drawingArea / (me.max - me.min);
18050
+			if (me.options.ticks.reverse) {
18051
+				return (me.max - value) * scalingFactor;
18052
+			}
18053
+			return (value - me.min) * scalingFactor;
18054
+		},
18055
+		getPointPosition: function(index, distanceFromCenter) {
18056
+			var me = this;
18057
+			var thisAngle = me.getIndexAngle(index) - (Math.PI / 2);
18058
+			return {
18059
+				x: Math.round(Math.cos(thisAngle) * distanceFromCenter) + me.xCenter,
18060
+				y: Math.round(Math.sin(thisAngle) * distanceFromCenter) + me.yCenter
18061
+			};
18062
+		},
18063
+		getPointPositionForValue: function(index, value) {
18064
+			return this.getPointPosition(index, this.getDistanceFromCenterForValue(value));
18065
+		},
18066
+
18067
+		getBasePosition: function() {
18068
+			var me = this;
18069
+			var min = me.min;
18070
+			var max = me.max;
18071
+
18072
+			return me.getPointPositionForValue(0,
18073
+				me.beginAtZero ? 0 :
18074
+				min < 0 && max < 0 ? max :
18075
+				min > 0 && max > 0 ? min :
18076
+				0);
18077
+		},
18078
+
18079
+		draw: function() {
18080
+			var me = this;
18081
+			var opts = me.options;
18082
+			var gridLineOpts = opts.gridLines;
18083
+			var tickOpts = opts.ticks;
18084
+			var valueOrDefault = helpers.valueOrDefault;
18085
+
18086
+			if (opts.display) {
18087
+				var ctx = me.ctx;
18088
+				var startAngle = this.getIndexAngle(0);
18089
+
18090
+				// Tick Font
18091
+				var tickFontSize = valueOrDefault(tickOpts.fontSize, globalDefaults.defaultFontSize);
18092
+				var tickFontStyle = valueOrDefault(tickOpts.fontStyle, globalDefaults.defaultFontStyle);
18093
+				var tickFontFamily = valueOrDefault(tickOpts.fontFamily, globalDefaults.defaultFontFamily);
18094
+				var tickLabelFont = helpers.fontString(tickFontSize, tickFontStyle, tickFontFamily);
18095
+
18096
+				helpers.each(me.ticks, function(label, index) {
18097
+					// Don't draw a centre value (if it is minimum)
18098
+					if (index > 0 || tickOpts.reverse) {
18099
+						var yCenterOffset = me.getDistanceFromCenterForValue(me.ticksAsNumbers[index]);
18100
+
18101
+						// Draw circular lines around the scale
18102
+						if (gridLineOpts.display && index !== 0) {
18103
+							drawRadiusLine(me, gridLineOpts, yCenterOffset, index);
18104
+						}
18105
+
18106
+						if (tickOpts.display) {
18107
+							var tickFontColor = valueOrDefault(tickOpts.fontColor, globalDefaults.defaultFontColor);
18108
+							ctx.font = tickLabelFont;
18109
+
18110
+							ctx.save();
18111
+							ctx.translate(me.xCenter, me.yCenter);
18112
+							ctx.rotate(startAngle);
18113
+
18114
+							if (tickOpts.showLabelBackdrop) {
18115
+								var labelWidth = ctx.measureText(label).width;
18116
+								ctx.fillStyle = tickOpts.backdropColor;
18117
+								ctx.fillRect(
18118
+									-labelWidth / 2 - tickOpts.backdropPaddingX,
18119
+									-yCenterOffset - tickFontSize / 2 - tickOpts.backdropPaddingY,
18120
+									labelWidth + tickOpts.backdropPaddingX * 2,
18121
+									tickFontSize + tickOpts.backdropPaddingY * 2
18122
+								);
18123
+							}
18124
+
18125
+							ctx.textAlign = 'center';
18126
+							ctx.textBaseline = 'middle';
18127
+							ctx.fillStyle = tickFontColor;
18128
+							ctx.fillText(label, 0, -yCenterOffset);
18129
+							ctx.restore();
18130
+						}
18131
+					}
18132
+				});
18133
+
18134
+				if (opts.angleLines.display || opts.pointLabels.display) {
18135
+					drawPointLabels(me);
18136
+				}
18137
+			}
18138
+		}
18139
+	});
18140
+	Chart.scaleService.registerScaleType('radialLinear', LinearRadialScale, defaultConfig);
18141
+
18142
+};
18143
+
18144
+},{"25":25,"34":34,"45":45}],58:[function(require,module,exports){
18145
+/* global window: false */
18146
+'use strict';
18147
+
18148
+var moment = require(6);
18149
+moment = typeof moment === 'function' ? moment : window.moment;
18150
+
18151
+var defaults = require(25);
18152
+var helpers = require(45);
18153
+
18154
+// Integer constants are from the ES6 spec.
18155
+var MIN_INTEGER = Number.MIN_SAFE_INTEGER || -9007199254740991;
18156
+var MAX_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
18157
+
18158
+var INTERVALS = {
18159
+	millisecond: {
18160
+		common: true,
18161
+		size: 1,
18162
+		steps: [1, 2, 5, 10, 20, 50, 100, 250, 500]
18163
+	},
18164
+	second: {
18165
+		common: true,
18166
+		size: 1000,
18167
+		steps: [1, 2, 5, 10, 30]
18168
+	},
18169
+	minute: {
18170
+		common: true,
18171
+		size: 60000,
18172
+		steps: [1, 2, 5, 10, 30]
18173
+	},
18174
+	hour: {
18175
+		common: true,
18176
+		size: 3600000,
18177
+		steps: [1, 2, 3, 6, 12]
18178
+	},
18179
+	day: {
18180
+		common: true,
18181
+		size: 86400000,
18182
+		steps: [1, 2, 5]
18183
+	},
18184
+	week: {
18185
+		common: false,
18186
+		size: 604800000,
18187
+		steps: [1, 2, 3, 4]
18188
+	},
18189
+	month: {
18190
+		common: true,
18191
+		size: 2.628e9,
18192
+		steps: [1, 2, 3]
18193
+	},
18194
+	quarter: {
18195
+		common: false,
18196
+		size: 7.884e9,
18197
+		steps: [1, 2, 3, 4]
18198
+	},
18199
+	year: {
18200
+		common: true,
18201
+		size: 3.154e10
18202
+	}
18203
+};
18204
+
18205
+var UNITS = Object.keys(INTERVALS);
18206
+
18207
+function sorter(a, b) {
18208
+	return a - b;
18209
+}
18210
+
18211
+function arrayUnique(items) {
18212
+	var hash = {};
18213
+	var out = [];
18214
+	var i, ilen, item;
18215
+
18216
+	for (i = 0, ilen = items.length; i < ilen; ++i) {
18217
+		item = items[i];
18218
+		if (!hash[item]) {
18219
+			hash[item] = true;
18220
+			out.push(item);
18221
+		}
18222
+	}
18223
+
18224
+	return out;
18225
+}
18226
+
18227
+/**
18228
+ * Returns an array of {time, pos} objects used to interpolate a specific `time` or position
18229
+ * (`pos`) on the scale, by searching entries before and after the requested value. `pos` is
18230
+ * a decimal between 0 and 1: 0 being the start of the scale (left or top) and 1 the other
18231
+ * extremity (left + width or top + height). Note that it would be more optimized to directly
18232
+ * store pre-computed pixels, but the scale dimensions are not guaranteed at the time we need
18233
+ * to create the lookup table. The table ALWAYS contains at least two items: min and max.
18234
+ *
18235
+ * @param {Number[]} timestamps - timestamps sorted from lowest to highest.
18236
+ * @param {String} distribution - If 'linear', timestamps will be spread linearly along the min
18237
+ * and max range, so basically, the table will contains only two items: {min, 0} and {max, 1}.
18238
+ * If 'series', timestamps will be positioned at the same distance from each other. In this
18239
+ * case, only timestamps that break the time linearity are registered, meaning that in the
18240
+ * best case, all timestamps are linear, the table contains only min and max.
18241
+ */
18242
+function buildLookupTable(timestamps, min, max, distribution) {
18243
+	if (distribution === 'linear' || !timestamps.length) {
18244
+		return [
18245
+			{time: min, pos: 0},
18246
+			{time: max, pos: 1}
18247
+		];
18248
+	}
18249
+
18250
+	var table = [];
18251
+	var items = [min];
18252
+	var i, ilen, prev, curr, next;
18253
+
18254
+	for (i = 0, ilen = timestamps.length; i < ilen; ++i) {
18255
+		curr = timestamps[i];
18256
+		if (curr > min && curr < max) {
18257
+			items.push(curr);
18258
+		}
18259
+	}
18260
+
18261
+	items.push(max);
18262
+
18263
+	for (i = 0, ilen = items.length; i < ilen; ++i) {
18264
+		next = items[i + 1];
18265
+		prev = items[i - 1];
18266
+		curr = items[i];
18267
+
18268
+		// only add points that breaks the scale linearity
18269
+		if (prev === undefined || next === undefined || Math.round((next + prev) / 2) !== curr) {
18270
+			table.push({time: curr, pos: i / (ilen - 1)});
18271
+		}
18272
+	}
18273
+
18274
+	return table;
18275
+}
18276
+
18277
+// @see adapted from http://www.anujgakhar.com/2014/03/01/binary-search-in-javascript/
18278
+function lookup(table, key, value) {
18279
+	var lo = 0;
18280
+	var hi = table.length - 1;
18281
+	var mid, i0, i1;
18282
+
18283
+	while (lo >= 0 && lo <= hi) {
18284
+		mid = (lo + hi) >> 1;
18285
+		i0 = table[mid - 1] || null;
18286
+		i1 = table[mid];
18287
+
18288
+		if (!i0) {
18289
+			// given value is outside table (before first item)
18290
+			return {lo: null, hi: i1};
18291
+		} else if (i1[key] < value) {
18292
+			lo = mid + 1;
18293
+		} else if (i0[key] > value) {
18294
+			hi = mid - 1;
18295
+		} else {
18296
+			return {lo: i0, hi: i1};
18297
+		}
18298
+	}
18299
+
18300
+	// given value is outside table (after last item)
18301
+	return {lo: i1, hi: null};
18302
+}
18303
+
18304
+/**
18305
+ * Linearly interpolates the given source `value` using the table items `skey` values and
18306
+ * returns the associated `tkey` value. For example, interpolate(table, 'time', 42, 'pos')
18307
+ * returns the position for a timestamp equal to 42. If value is out of bounds, values at
18308
+ * index [0, 1] or [n - 1, n] are used for the interpolation.
18309
+ */
18310
+function interpolate(table, skey, sval, tkey) {
18311
+	var range = lookup(table, skey, sval);
18312
+
18313
+	// Note: the lookup table ALWAYS contains at least 2 items (min and max)
18314
+	var prev = !range.lo ? table[0] : !range.hi ? table[table.length - 2] : range.lo;
18315
+	var next = !range.lo ? table[1] : !range.hi ? table[table.length - 1] : range.hi;
18316
+
18317
+	var span = next[skey] - prev[skey];
18318
+	var ratio = span ? (sval - prev[skey]) / span : 0;
18319
+	var offset = (next[tkey] - prev[tkey]) * ratio;
18320
+
18321
+	return prev[tkey] + offset;
18322
+}
18323
+
18324
+/**
18325
+ * Convert the given value to a moment object using the given time options.
18326
+ * @see http://momentjs.com/docs/#/parsing/
18327
+ */
18328
+function momentify(value, options) {
18329
+	var parser = options.parser;
18330
+	var format = options.parser || options.format;
18331
+
18332
+	if (typeof parser === 'function') {
18333
+		return parser(value);
18334
+	}
18335
+
18336
+	if (typeof value === 'string' && typeof format === 'string') {
18337
+		return moment(value, format);
18338
+	}
18339
+
18340
+	if (!(value instanceof moment)) {
18341
+		value = moment(value);
18342
+	}
18343
+
18344
+	if (value.isValid()) {
18345
+		return value;
18346
+	}
18347
+
18348
+	// Labels are in an incompatible moment format and no `parser` has been provided.
18349
+	// The user might still use the deprecated `format` option to convert his inputs.
18350
+	if (typeof format === 'function') {
18351
+		return format(value);
18352
+	}
18353
+
18354
+	return value;
18355
+}
18356
+
18357
+function parse(input, scale) {
18358
+	if (helpers.isNullOrUndef(input)) {
18359
+		return null;
18360
+	}
18361
+
18362
+	var options = scale.options.time;
18363
+	var value = momentify(scale.getRightValue(input), options);
18364
+	if (!value.isValid()) {
18365
+		return null;
18366
+	}
18367
+
18368
+	if (options.round) {
18369
+		value.startOf(options.round);
18370
+	}
18371
+
18372
+	return value.valueOf();
18373
+}
18374
+
18375
+/**
18376
+ * Returns the number of unit to skip to be able to display up to `capacity` number of ticks
18377
+ * in `unit` for the given `min` / `max` range and respecting the interval steps constraints.
18378
+ */
18379
+function determineStepSize(min, max, unit, capacity) {
18380
+	var range = max - min;
18381
+	var interval = INTERVALS[unit];
18382
+	var milliseconds = interval.size;
18383
+	var steps = interval.steps;
18384
+	var i, ilen, factor;
18385
+
18386
+	if (!steps) {
18387
+		return Math.ceil(range / (capacity * milliseconds));
18388
+	}
18389
+
18390
+	for (i = 0, ilen = steps.length; i < ilen; ++i) {
18391
+		factor = steps[i];
18392
+		if (Math.ceil(range / (milliseconds * factor)) <= capacity) {
18393
+			break;
18394
+		}
18395
+	}
18396
+
18397
+	return factor;
18398
+}
18399
+
18400
+/**
18401
+ * Figures out what unit results in an appropriate number of auto-generated ticks
18402
+ */
18403
+function determineUnitForAutoTicks(minUnit, min, max, capacity) {
18404
+	var ilen = UNITS.length;
18405
+	var i, interval, factor;
18406
+
18407
+	for (i = UNITS.indexOf(minUnit); i < ilen - 1; ++i) {
18408
+		interval = INTERVALS[UNITS[i]];
18409
+		factor = interval.steps ? interval.steps[interval.steps.length - 1] : MAX_INTEGER;
18410
+
18411
+		if (interval.common && Math.ceil((max - min) / (factor * interval.size)) <= capacity) {
18412
+			return UNITS[i];
18413
+		}
18414
+	}
18415
+
18416
+	return UNITS[ilen - 1];
18417
+}
18418
+
18419
+/**
18420
+ * Figures out what unit to format a set of ticks with
18421
+ */
18422
+function determineUnitForFormatting(ticks, minUnit, min, max) {
18423
+	var duration = moment.duration(moment(max).diff(moment(min)));
18424
+	var ilen = UNITS.length;
18425
+	var i, unit;
18426
+
18427
+	for (i = ilen - 1; i >= UNITS.indexOf(minUnit); i--) {
18428
+		unit = UNITS[i];
18429
+		if (INTERVALS[unit].common && duration.as(unit) >= ticks.length) {
18430
+			return unit;
18431
+		}
18432
+	}
18433
+
18434
+	return UNITS[minUnit ? UNITS.indexOf(minUnit) : 0];
18435
+}
18436
+
18437
+function determineMajorUnit(unit) {
18438
+	for (var i = UNITS.indexOf(unit) + 1, ilen = UNITS.length; i < ilen; ++i) {
18439
+		if (INTERVALS[UNITS[i]].common) {
18440
+			return UNITS[i];
18441
+		}
18442
+	}
18443
+}
18444
+
18445
+/**
18446
+ * Generates a maximum of `capacity` timestamps between min and max, rounded to the
18447
+ * `minor` unit, aligned on the `major` unit and using the given scale time `options`.
18448
+ * Important: this method can return ticks outside the min and max range, it's the
18449
+ * responsibility of the calling code to clamp values if needed.
18450
+ */
18451
+function generate(min, max, capacity, options) {
18452
+	var timeOpts = options.time;
18453
+	var minor = timeOpts.unit || determineUnitForAutoTicks(timeOpts.minUnit, min, max, capacity);
18454
+	var major = determineMajorUnit(minor);
18455
+	var stepSize = helpers.valueOrDefault(timeOpts.stepSize, timeOpts.unitStepSize);
18456
+	var weekday = minor === 'week' ? timeOpts.isoWeekday : false;
18457
+	var majorTicksEnabled = options.ticks.major.enabled;
18458
+	var interval = INTERVALS[minor];
18459
+	var first = moment(min);
18460
+	var last = moment(max);
18461
+	var ticks = [];
18462
+	var time;
18463
+
18464
+	if (!stepSize) {
18465
+		stepSize = determineStepSize(min, max, minor, capacity);
18466
+	}
18467
+
18468
+	// For 'week' unit, handle the first day of week option
18469
+	if (weekday) {
18470
+		first = first.isoWeekday(weekday);
18471
+		last = last.isoWeekday(weekday);
18472
+	}
18473
+
18474
+	// Align first/last ticks on unit
18475
+	first = first.startOf(weekday ? 'day' : minor);
18476
+	last = last.startOf(weekday ? 'day' : minor);
18477
+
18478
+	// Make sure that the last tick include max
18479
+	if (last < max) {
18480
+		last.add(1, minor);
18481
+	}
18482
+
18483
+	time = moment(first);
18484
+
18485
+	if (majorTicksEnabled && major && !weekday && !timeOpts.round) {
18486
+		// Align the first tick on the previous `minor` unit aligned on the `major` unit:
18487
+		// we first aligned time on the previous `major` unit then add the number of full
18488
+		// stepSize there is between first and the previous major time.
18489
+		time.startOf(major);
18490
+		time.add(~~((first - time) / (interval.size * stepSize)) * stepSize, minor);
18491
+	}
18492
+
18493
+	for (; time < last; time.add(stepSize, minor)) {
18494
+		ticks.push(+time);
18495
+	}
18496
+
18497
+	ticks.push(+time);
18498
+
18499
+	return ticks;
18500
+}
18501
+
18502
+/**
18503
+ * Returns the right and left offsets from edges in the form of {left, right}.
18504
+ * Offsets are added when the `offset` option is true.
18505
+ */
18506
+function computeOffsets(table, ticks, min, max, options) {
18507
+	var left = 0;
18508
+	var right = 0;
18509
+	var upper, lower;
18510
+
18511
+	if (options.offset && ticks.length) {
18512
+		if (!options.time.min) {
18513
+			upper = ticks.length > 1 ? ticks[1] : max;
18514
+			lower = ticks[0];
18515
+			left = (
18516
+				interpolate(table, 'time', upper, 'pos') -
18517
+				interpolate(table, 'time', lower, 'pos')
18518
+			) / 2;
18519
+		}
18520
+		if (!options.time.max) {
18521
+			upper = ticks[ticks.length - 1];
18522
+			lower = ticks.length > 1 ? ticks[ticks.length - 2] : min;
18523
+			right = (
18524
+				interpolate(table, 'time', upper, 'pos') -
18525
+				interpolate(table, 'time', lower, 'pos')
18526
+			) / 2;
18527
+		}
18528
+	}
18529
+
18530
+	return {left: left, right: right};
18531
+}
18532
+
18533
+function ticksFromTimestamps(values, majorUnit) {
18534
+	var ticks = [];
18535
+	var i, ilen, value, major;
18536
+
18537
+	for (i = 0, ilen = values.length; i < ilen; ++i) {
18538
+		value = values[i];
18539
+		major = majorUnit ? value === +moment(value).startOf(majorUnit) : false;
18540
+
18541
+		ticks.push({
18542
+			value: value,
18543
+			major: major
18544
+		});
18545
+	}
18546
+
18547
+	return ticks;
18548
+}
18549
+
18550
+function determineLabelFormat(data, timeOpts) {
18551
+	var i, momentDate, hasTime;
18552
+	var ilen = data.length;
18553
+
18554
+	// find the label with the most parts (milliseconds, minutes, etc.)
18555
+	// format all labels with the same level of detail as the most specific label
18556
+	for (i = 0; i < ilen; i++) {
18557
+		momentDate = momentify(data[i], timeOpts);
18558
+		if (momentDate.millisecond() !== 0) {
18559
+			return 'MMM D, YYYY h:mm:ss.SSS a';
18560
+		}
18561
+		if (momentDate.second() !== 0 || momentDate.minute() !== 0 || momentDate.hour() !== 0) {
18562
+			hasTime = true;
18563
+		}
18564
+	}
18565
+	if (hasTime) {
18566
+		return 'MMM D, YYYY h:mm:ss a';
18567
+	}
18568
+	return 'MMM D, YYYY';
18569
+}
18570
+
18571
+module.exports = function(Chart) {
18572
+
18573
+	var defaultConfig = {
18574
+		position: 'bottom',
18575
+
18576
+		/**
18577
+		 * Data distribution along the scale:
18578
+		 * - 'linear': data are spread according to their time (distances can vary),
18579
+		 * - 'series': data are spread at the same distance from each other.
18580
+		 * @see https://github.com/chartjs/Chart.js/pull/4507
18581
+		 * @since 2.7.0
18582
+		 */
18583
+		distribution: 'linear',
18584
+
18585
+		/**
18586
+		 * Scale boundary strategy (bypassed by min/max time options)
18587
+		 * - `data`: make sure data are fully visible, ticks outside are removed
18588
+		 * - `ticks`: make sure ticks are fully visible, data outside are truncated
18589
+		 * @see https://github.com/chartjs/Chart.js/pull/4556
18590
+		 * @since 2.7.0
18591
+		 */
18592
+		bounds: 'data',
18593
+
18594
+		time: {
18595
+			parser: false, // false == a pattern string from http://momentjs.com/docs/#/parsing/string-format/ or a custom callback that converts its argument to a moment
18596
+			format: false, // DEPRECATED false == date objects, moment object, callback or a pattern string from http://momentjs.com/docs/#/parsing/string-format/
18597
+			unit: false, // false == automatic or override with week, month, year, etc.
18598
+			round: false, // none, or override with week, month, year, etc.
18599
+			displayFormat: false, // DEPRECATED
18600
+			isoWeekday: false, // override week start day - see http://momentjs.com/docs/#/get-set/iso-weekday/
18601
+			minUnit: 'millisecond',
18602
+
18603
+			// defaults to unit's corresponding unitFormat below or override using pattern string from http://momentjs.com/docs/#/displaying/format/
18604
+			displayFormats: {
18605
+				millisecond: 'h:mm:ss.SSS a', // 11:20:01.123 AM,
18606
+				second: 'h:mm:ss a', // 11:20:01 AM
18607
+				minute: 'h:mm a', // 11:20 AM
18608
+				hour: 'hA', // 5PM
18609
+				day: 'MMM D', // Sep 4
18610
+				week: 'll', // Week 46, or maybe "[W]WW - YYYY" ?
18611
+				month: 'MMM YYYY', // Sept 2015
18612
+				quarter: '[Q]Q - YYYY', // Q3
18613
+				year: 'YYYY' // 2015
18614
+			},
18615
+		},
18616
+		ticks: {
18617
+			autoSkip: false,
18618
+
18619
+			/**
18620
+			 * Ticks generation input values:
18621
+			 * - 'auto': generates "optimal" ticks based on scale size and time options.
18622
+			 * - 'data': generates ticks from data (including labels from data {t|x|y} objects).
18623
+			 * - 'labels': generates ticks from user given `data.labels` values ONLY.
18624
+			 * @see https://github.com/chartjs/Chart.js/pull/4507
18625
+			 * @since 2.7.0
18626
+			 */
18627
+			source: 'auto',
18628
+
18629
+			major: {
18630
+				enabled: false
18631
+			}
18632
+		}
18633
+	};
18634
+
18635
+	var TimeScale = Chart.Scale.extend({
18636
+		initialize: function() {
18637
+			if (!moment) {
18638
+				throw new Error('Chart.js - Moment.js could not be found! You must include it before Chart.js to use the time scale. Download at https://momentjs.com');
18639
+			}
18640
+
18641
+			this.mergeTicksOptions();
18642
+
18643
+			Chart.Scale.prototype.initialize.call(this);
18644
+		},
18645
+
18646
+		update: function() {
18647
+			var me = this;
18648
+			var options = me.options;
18649
+
18650
+			// DEPRECATIONS: output a message only one time per update
18651
+			if (options.time && options.time.format) {
18652
+				console.warn('options.time.format is deprecated and replaced by options.time.parser.');
18653
+			}
18654
+
18655
+			return Chart.Scale.prototype.update.apply(me, arguments);
18656
+		},
18657
+
18658
+		/**
18659
+		 * Allows data to be referenced via 't' attribute
18660
+		 */
18661
+		getRightValue: function(rawValue) {
18662
+			if (rawValue && rawValue.t !== undefined) {
18663
+				rawValue = rawValue.t;
18664
+			}
18665
+			return Chart.Scale.prototype.getRightValue.call(this, rawValue);
18666
+		},
18667
+
18668
+		determineDataLimits: function() {
18669
+			var me = this;
18670
+			var chart = me.chart;
18671
+			var timeOpts = me.options.time;
18672
+			var unit = timeOpts.unit || 'day';
18673
+			var min = MAX_INTEGER;
18674
+			var max = MIN_INTEGER;
18675
+			var timestamps = [];
18676
+			var datasets = [];
18677
+			var labels = [];
18678
+			var i, j, ilen, jlen, data, timestamp;
18679
+
18680
+			// Convert labels to timestamps
18681
+			for (i = 0, ilen = chart.data.labels.length; i < ilen; ++i) {
18682
+				labels.push(parse(chart.data.labels[i], me));
18683
+			}
18684
+
18685
+			// Convert data to timestamps
18686
+			for (i = 0, ilen = (chart.data.datasets || []).length; i < ilen; ++i) {
18687
+				if (chart.isDatasetVisible(i)) {
18688
+					data = chart.data.datasets[i].data;
18689
+
18690
+					// Let's consider that all data have the same format.
18691
+					if (helpers.isObject(data[0])) {
18692
+						datasets[i] = [];
18693
+
18694
+						for (j = 0, jlen = data.length; j < jlen; ++j) {
18695
+							timestamp = parse(data[j], me);
18696
+							timestamps.push(timestamp);
18697
+							datasets[i][j] = timestamp;
18698
+						}
18699
+					} else {
18700
+						timestamps.push.apply(timestamps, labels);
18701
+						datasets[i] = labels.slice(0);
18702
+					}
18703
+				} else {
18704
+					datasets[i] = [];
18705
+				}
18706
+			}
18707
+
18708
+			if (labels.length) {
18709
+				// Sort labels **after** data have been converted
18710
+				labels = arrayUnique(labels).sort(sorter);
18711
+				min = Math.min(min, labels[0]);
18712
+				max = Math.max(max, labels[labels.length - 1]);
18713
+			}
18714
+
18715
+			if (timestamps.length) {
18716
+				timestamps = arrayUnique(timestamps).sort(sorter);
18717
+				min = Math.min(min, timestamps[0]);
18718
+				max = Math.max(max, timestamps[timestamps.length - 1]);
18719
+			}
18720
+
18721
+			min = parse(timeOpts.min, me) || min;
18722
+			max = parse(timeOpts.max, me) || max;
18723
+
18724
+			// In case there is no valid min/max, set limits based on unit time option
18725
+			min = min === MAX_INTEGER ? +moment().startOf(unit) : min;
18726
+			max = max === MIN_INTEGER ? +moment().endOf(unit) + 1 : max;
18727
+
18728
+			// Make sure that max is strictly higher than min (required by the lookup table)
18729
+			me.min = Math.min(min, max);
18730
+			me.max = Math.max(min + 1, max);
18731
+
18732
+			// PRIVATE
18733
+			me._horizontal = me.isHorizontal();
18734
+			me._table = [];
18735
+			me._timestamps = {
18736
+				data: timestamps,
18737
+				datasets: datasets,
18738
+				labels: labels
18739
+			};
18740
+		},
18741
+
18742
+		buildTicks: function() {
18743
+			var me = this;
18744
+			var min = me.min;
18745
+			var max = me.max;
18746
+			var options = me.options;
18747
+			var timeOpts = options.time;
18748
+			var timestamps = [];
18749
+			var ticks = [];
18750
+			var i, ilen, timestamp;
18751
+
18752
+			switch (options.ticks.source) {
18753
+			case 'data':
18754
+				timestamps = me._timestamps.data;
18755
+				break;
18756
+			case 'labels':
18757
+				timestamps = me._timestamps.labels;
18758
+				break;
18759
+			case 'auto':
18760
+			default:
18761
+				timestamps = generate(min, max, me.getLabelCapacity(min), options);
18762
+			}
18763
+
18764
+			if (options.bounds === 'ticks' && timestamps.length) {
18765
+				min = timestamps[0];
18766
+				max = timestamps[timestamps.length - 1];
18767
+			}
18768
+
18769
+			// Enforce limits with user min/max options
18770
+			min = parse(timeOpts.min, me) || min;
18771
+			max = parse(timeOpts.max, me) || max;
18772
+
18773
+			// Remove ticks outside the min/max range
18774
+			for (i = 0, ilen = timestamps.length; i < ilen; ++i) {
18775
+				timestamp = timestamps[i];
18776
+				if (timestamp >= min && timestamp <= max) {
18777
+					ticks.push(timestamp);
18778
+				}
18779
+			}
18780
+
18781
+			me.min = min;
18782
+			me.max = max;
18783
+
18784
+			// PRIVATE
18785
+			me._unit = timeOpts.unit || determineUnitForFormatting(ticks, timeOpts.minUnit, me.min, me.max);
18786
+			me._majorUnit = determineMajorUnit(me._unit);
18787
+			me._table = buildLookupTable(me._timestamps.data, min, max, options.distribution);
18788
+			me._offsets = computeOffsets(me._table, ticks, min, max, options);
18789
+			me._labelFormat = determineLabelFormat(me._timestamps.data, timeOpts);
18790
+
18791
+			return ticksFromTimestamps(ticks, me._majorUnit);
18792
+		},
18793
+
18794
+		getLabelForIndex: function(index, datasetIndex) {
18795
+			var me = this;
18796
+			var data = me.chart.data;
18797
+			var timeOpts = me.options.time;
18798
+			var label = data.labels && index < data.labels.length ? data.labels[index] : '';
18799
+			var value = data.datasets[datasetIndex].data[index];
18800
+
18801
+			if (helpers.isObject(value)) {
18802
+				label = me.getRightValue(value);
18803
+			}
18804
+			if (timeOpts.tooltipFormat) {
18805
+				return momentify(label, timeOpts).format(timeOpts.tooltipFormat);
18806
+			}
18807
+			if (typeof label === 'string') {
18808
+				return label;
18809
+			}
18810
+
18811
+			return momentify(label, timeOpts).format(me._labelFormat);
18812
+		},
18813
+
18814
+		/**
18815
+		 * Function to format an individual tick mark
18816
+		 * @private
18817
+		 */
18818
+		tickFormatFunction: function(tick, index, ticks, formatOverride) {
18819
+			var me = this;
18820
+			var options = me.options;
18821
+			var time = tick.valueOf();
18822
+			var formats = options.time.displayFormats;
18823
+			var minorFormat = formats[me._unit];
18824
+			var majorUnit = me._majorUnit;
18825
+			var majorFormat = formats[majorUnit];
18826
+			var majorTime = tick.clone().startOf(majorUnit).valueOf();
18827
+			var majorTickOpts = options.ticks.major;
18828
+			var major = majorTickOpts.enabled && majorUnit && majorFormat && time === majorTime;
18829
+			var label = tick.format(formatOverride ? formatOverride : major ? majorFormat : minorFormat);
18830
+			var tickOpts = major ? majorTickOpts : options.ticks.minor;
18831
+			var formatter = helpers.valueOrDefault(tickOpts.callback, tickOpts.userCallback);
18832
+
18833
+			return formatter ? formatter(label, index, ticks) : label;
18834
+		},
18835
+
18836
+		convertTicksToLabels: function(ticks) {
18837
+			var labels = [];
18838
+			var i, ilen;
18839
+
18840
+			for (i = 0, ilen = ticks.length; i < ilen; ++i) {
18841
+				labels.push(this.tickFormatFunction(moment(ticks[i].value), i, ticks));
18842
+			}
18843
+
18844
+			return labels;
18845
+		},
18846
+
18847
+		/**
18848
+		 * @private
18849
+		 */
18850
+		getPixelForOffset: function(time) {
18851
+			var me = this;
18852
+			var size = me._horizontal ? me.width : me.height;
18853
+			var start = me._horizontal ? me.left : me.top;
18854
+			var pos = interpolate(me._table, 'time', time, 'pos');
18855
+
18856
+			return start + size * (me._offsets.left + pos) / (me._offsets.left + 1 + me._offsets.right);
18857
+		},
18858
+
18859
+		getPixelForValue: function(value, index, datasetIndex) {
18860
+			var me = this;
18861
+			var time = null;
18862
+
18863
+			if (index !== undefined && datasetIndex !== undefined) {
18864
+				time = me._timestamps.datasets[datasetIndex][index];
18865
+			}
18866
+
18867
+			if (time === null) {
18868
+				time = parse(value, me);
18869
+			}
18870
+
18871
+			if (time !== null) {
18872
+				return me.getPixelForOffset(time);
18873
+			}
18874
+		},
18875
+
18876
+		getPixelForTick: function(index) {
18877
+			var ticks = this.getTicks();
18878
+			return index >= 0 && index < ticks.length ?
18879
+				this.getPixelForOffset(ticks[index].value) :
18880
+				null;
18881
+		},
18882
+
18883
+		getValueForPixel: function(pixel) {
18884
+			var me = this;
18885
+			var size = me._horizontal ? me.width : me.height;
18886
+			var start = me._horizontal ? me.left : me.top;
18887
+			var pos = (size ? (pixel - start) / size : 0) * (me._offsets.left + 1 + me._offsets.left) - me._offsets.right;
18888
+			var time = interpolate(me._table, 'pos', pos, 'time');
18889
+
18890
+			return moment(time);
18891
+		},
18892
+
18893
+		/**
18894
+		 * Crude approximation of what the label width might be
18895
+		 * @private
18896
+		 */
18897
+		getLabelWidth: function(label) {
18898
+			var me = this;
18899
+			var ticksOpts = me.options.ticks;
18900
+			var tickLabelWidth = me.ctx.measureText(label).width;
18901
+			var angle = helpers.toRadians(ticksOpts.maxRotation);
18902
+			var cosRotation = Math.cos(angle);
18903
+			var sinRotation = Math.sin(angle);
18904
+			var tickFontSize = helpers.valueOrDefault(ticksOpts.fontSize, defaults.global.defaultFontSize);
18905
+
18906
+			return (tickLabelWidth * cosRotation) + (tickFontSize * sinRotation);
18907
+		},
18908
+
18909
+		/**
18910
+		 * @private
18911
+		 */
18912
+		getLabelCapacity: function(exampleTime) {
18913
+			var me = this;
18914
+
18915
+			var formatOverride = me.options.time.displayFormats.millisecond;	// Pick the longest format for guestimation
18916
+
18917
+			var exampleLabel = me.tickFormatFunction(moment(exampleTime), 0, [], formatOverride);
18918
+			var tickLabelWidth = me.getLabelWidth(exampleLabel);
18919
+			var innerWidth = me.isHorizontal() ? me.width : me.height;
18920
+
18921
+			var capacity = Math.floor(innerWidth / tickLabelWidth);
18922
+			return capacity > 0 ? capacity : 1;
18923
+		}
18924
+	});
18925
+
18926
+	Chart.scaleService.registerScaleType('time', TimeScale, defaultConfig);
18927
+};
18928
+
18929
+},{"25":25,"45":45,"6":6}]},{},[7])(7)
18930
+});