diff --git a/javascripts/langviews/config.js b/javascripts/langviews/config.js
index 4c7a5c29c..7ff66446b 100644
--- a/javascripts/langviews/config.js
+++ b/javascripts/langviews/config.js
@@ -42,7 +42,6 @@ const config = {
name: 'Validated'
}
},
- dateLimit: 90, // num days
dateRangeSelector: '#range_input',
defaults: {
dateRange: 'latest-20',
diff --git a/javascripts/massviews/config.js b/javascripts/massviews/config.js
index a6b3f65df..5a845b8e4 100644
--- a/javascripts/massviews/config.js
+++ b/javascripts/massviews/config.js
@@ -12,7 +12,6 @@
const config = {
agentSelector: '#agent_select',
chart: '.aqs-chart',
- dateLimit: 31, // num days
dateRangeSelector: '#range_input',
defaults: {
dateRange: 'latest-20',
diff --git a/javascripts/redirectviews/config.js b/javascripts/redirectviews/config.js
index 25dac067f..29316c15f 100644
--- a/javascripts/redirectviews/config.js
+++ b/javascripts/redirectviews/config.js
@@ -16,7 +16,6 @@ const config = {
return `${$.i18n('totals')}: ${scope.formatNumber(scope.outputData.sum)}
(${scope.formatNumber(Math.round(scope.outputData.average))}/${$.i18n('day')})`;
},
- dateLimit: 90, // num days
dateRangeSelector: '#range_input',
defaults: {
dateRange: 'latest-20',
diff --git a/public_html/langviews/application.js b/public_html/langviews/application.js
index 523511a6c..124c8e920 100644
--- a/public_html/langviews/application.js
+++ b/public_html/langviews/application.js
@@ -9,7 +9,7 @@ if(!this.singleDatePicker&&this.leftCalendar.month&&this.rightCalendar.month&&(t
r.update()}},cutoutPercentage:50,rotation:Math.PI*-.5,circumference:2*Math.PI,tooltips:{callbacks:{title:function(){return""},label:function(t,e){return e.labels[t.index]+": "+e.datasets[t.datasetIndex].data[t.index]}}}},i.pie=e.clone(i.doughnut),e.extend(i.pie,{cutoutPercentage:0}),t.controllers.doughnut=t.controllers.pie=t.DatasetController.extend({dataElementType:t.elements.Arc,linkScales:e.noop,getRingIndex:function(t){for(var e=0,i=0;t>i;++i)this.chart.isDatasetVisible(i)&&++e;return e},update:function(t){var i=this,n=i.chart,o=n.chartArea,a=n.options,r=a.elements.arc,s=o.right-o.left-r.borderWidth,l=o.bottom-o.top-r.borderWidth,c=Math.min(s,l),u={x:0,y:0},d=i.getMeta(),h=a.cutoutPercentage,f=a.circumference;if(f<2*Math.PI){var p=a.rotation%(2*Math.PI);p+=2*Math.PI*(p>=Math.PI?-1:p<-Math.PI?1:0);var g=p+f,m={x:Math.cos(p),y:Math.sin(p)},k={x:Math.cos(g),y:Math.sin(g)},v=0>=p&&g>=0||p<=2*Math.PI&&2*Math.PI<=g,w=p<=.5*Math.PI&&.5*Math.PI<=g||p<=2.5*Math.PI&&2.5*Math.PI<=g,y=p<=-Math.PI&&-Math.PI<=g||p<=Math.PI&&Math.PI<=g,b=p<=.5*-Math.PI&&.5*-Math.PI<=g||p<=1.5*Math.PI&&1.5*Math.PI<=g,x=h/100,D={x:y?-1:Math.min(m.x*(m.x<0?1:x),k.x*(k.x<0?1:x)),y:b?-1:Math.min(m.y*(m.y<0?1:x),k.y*(k.y<0?1:x))},C={x:v?1:Math.max(m.x*(m.x>0?1:x),k.x*(k.x>0?1:x)),y:w?1:Math.max(m.y*(m.y>0?1:x),k.y*(k.y>0?1:x))},S={width:.5*(C.x-D.x),height:.5*(C.y-D.y)};c=Math.min(s/S.width,l/S.height),u={x:(C.x+D.x)*-.5,y:(C.y+D.y)*-.5}}n.borderWidth=i.getMaxBorderWidth(d.data),n.outerRadius=Math.max((c-n.borderWidth)/2,0),n.innerRadius=Math.max(h?n.outerRadius/100*h:1,0),n.radiusLength=(n.outerRadius-n.innerRadius)/n.getVisibleDatasetCount(),n.offsetX=u.x*n.outerRadius,n.offsetY=u.y*n.outerRadius,d.total=i.calculateTotal(),i.outerRadius=n.outerRadius-n.radiusLength*i.getRingIndex(i.index),i.innerRadius=i.outerRadius-n.radiusLength,e.each(d.data,function(e,n){i.updateElement(e,n,t)})},updateElement:function(t,i,n){var o=this,a=o.chart,r=a.chartArea,s=a.options,l=s.animation,c=(r.left+r.right)/2,u=(r.top+r.bottom)/2,d=s.rotation,h=s.rotation,f=o.getDataset(),p=n&&l.animateRotate?0:t.hidden?0:o.calculateCircumference(f.data[i])*(s.circumference/(2*Math.PI)),g=n&&l.animateScale?0:o.innerRadius,m=n&&l.animateScale?0:o.outerRadius,k=e.getValueAtIndexOrDefault;e.extend(t,{_datasetIndex:o.index,_index:i,_model:{x:c+a.offsetX,y:u+a.offsetY,startAngle:d,endAngle:h,circumference:p,outerRadius:m,innerRadius:g,label:k(f.label,i,a.data.labels[i])}});var v=t._model;this.removeHoverStyle(t),n&&l.animateRotate||(0===i?v.startAngle=s.rotation:v.startAngle=o.getMeta().data[i-1]._model.endAngle,v.endAngle=v.startAngle+v.circumference),t.pivot()},removeHoverStyle:function(e){t.DatasetController.prototype.removeHoverStyle.call(this,e,this.chart.options.elements.arc)},calculateTotal:function(){var t,i=this.getDataset(),n=this.getMeta(),o=0;return e.each(n.data,function(e,n){t=i.data[n],isNaN(t)||e.hidden||(o+=Math.abs(t))}),o},calculateCircumference:function(t){var e=this.getMeta().total;return e>0&&!isNaN(t)?2*Math.PI*(t/e):0},getMaxBorderWidth:function(t){for(var e,i,n=0,o=this.index,a=t.length,r=0;a>r;r++)e=t[r]._model?t[r]._model.borderWidth:0,i=t[r]._chart?t[r]._chart.config.data.datasets[o].hoverBorderWidth:0,n=e>n?e:n,n=i>n?i:n;return n}})}},{}],18:[function(t,e,i){"use strict";e.exports=function(t){function e(t,e){return i.getValueOrDefault(t.showLine,e.showLines)}var i=t.helpers;t.defaults.line={showLines:!0,spanGaps:!1,hover:{mode:"label"},scales:{xAxes:[{type:"category",id:"x-axis-0"}],yAxes:[{type:"linear",id:"y-axis-0"}]}},t.controllers.line=t.DatasetController.extend({datasetElementType:t.elements.Line,dataElementType:t.elements.Point,addElementAndReset:function(i){var n=this,o=n.chart.options,a=n.getMeta();t.DatasetController.prototype.addElementAndReset.call(n,i),e(n.getDataset(),o)&&0!==a.dataset._model.tension&&n.updateBezierControlPoints()},update:function(t){var n,o,a,r=this,s=r.getMeta(),l=s.dataset,c=s.data||[],u=r.chart.options,d=u.elements.line,h=r.getScaleForId(s.yAxisID),f=r.getDataset(),p=e(f,u);for(p&&(a=l.custom||{},void 0!==f.tension&&void 0===f.lineTension&&(f.lineTension=f.tension),l._scale=h,l._datasetIndex=r.index,l._children=c,l._model={spanGaps:f.spanGaps?f.spanGaps:u.spanGaps,tension:a.tension?a.tension:i.getValueOrDefault(f.lineTension,d.tension),backgroundColor:a.backgroundColor?a.backgroundColor:f.backgroundColor||d.backgroundColor,borderWidth:a.borderWidth?a.borderWidth:f.borderWidth||d.borderWidth,borderColor:a.borderColor?a.borderColor:f.borderColor||d.borderColor,borderCapStyle:a.borderCapStyle?a.borderCapStyle:f.borderCapStyle||d.borderCapStyle,borderDash:a.borderDash?a.borderDash:f.borderDash||d.borderDash,borderDashOffset:a.borderDashOffset?a.borderDashOffset:f.borderDashOffset||d.borderDashOffset,borderJoinStyle:a.borderJoinStyle?a.borderJoinStyle:f.borderJoinStyle||d.borderJoinStyle,fill:a.fill?a.fill:void 0!==f.fill?f.fill:d.fill,steppedLine:a.steppedLine?a.steppedLine:i.getValueOrDefault(f.steppedLine,d.stepped),cubicInterpolationMode:a.cubicInterpolationMode?a.cubicInterpolationMode:i.getValueOrDefault(f.cubicInterpolationMode,d.cubicInterpolationMode),scaleTop:h.top,scaleBottom:h.bottom,scaleZero:h.getBasePixel()},l.pivot()),n=0,o=c.length;o>n;++n)r.updateElement(c[n],n,t);for(p&&0!==l._model.tension&&r.updateBezierControlPoints(),n=0,o=c.length;o>n;++n)c[n].pivot()},getPointBackgroundColor:function(t,e){var n=this.chart.options.elements.point.backgroundColor,o=this.getDataset(),a=t.custom||{};return a.backgroundColor?n=a.backgroundColor:o.pointBackgroundColor?n=i.getValueAtIndexOrDefault(o.pointBackgroundColor,e,n):o.backgroundColor&&(n=o.backgroundColor),n},getPointBorderColor:function(t,e){var n=this.chart.options.elements.point.borderColor,o=this.getDataset(),a=t.custom||{};return a.borderColor?n=a.borderColor:o.pointBorderColor?n=i.getValueAtIndexOrDefault(o.pointBorderColor,e,n):o.borderColor&&(n=o.borderColor),n},getPointBorderWidth:function(t,e){var n=this.chart.options.elements.point.borderWidth,o=this.getDataset(),a=t.custom||{};return a.borderWidth?n=a.borderWidth:o.pointBorderWidth?n=i.getValueAtIndexOrDefault(o.pointBorderWidth,e,n):o.borderWidth&&(n=o.borderWidth),n},updateElement:function(t,e,n){var o,a,r=this,s=r.getMeta(),l=t.custom||{},c=r.getDataset(),u=r.index,d=c.data[e],h=r.getScaleForId(s.yAxisID),f=r.getScaleForId(s.xAxisID),p=r.chart.options.elements.point,g=r.chart.data.labels||[],m=1===g.length||1===c.data.length||r.chart.isCombo;void 0!==c.radius&&void 0===c.pointRadius&&(c.pointRadius=c.radius),void 0!==c.hitRadius&&void 0===c.pointHitRadius&&(c.pointHitRadius=c.hitRadius),o=f.getPixelForValue("object"==typeof d?d:NaN,e,u,m),a=n?h.getBasePixel():r.calculatePointY(d,e,u),t._xScale=f,t._yScale=h,t._datasetIndex=u,t._index=e,t._model={x:o,y:a,skip:l.skip||isNaN(o)||isNaN(a),radius:l.radius||i.getValueAtIndexOrDefault(c.pointRadius,e,p.radius),pointStyle:l.pointStyle||i.getValueAtIndexOrDefault(c.pointStyle,e,p.pointStyle),backgroundColor:r.getPointBackgroundColor(t,e),borderColor:r.getPointBorderColor(t,e),borderWidth:r.getPointBorderWidth(t,e),tension:s.dataset._model?s.dataset._model.tension:0,steppedLine:!!s.dataset._model&&s.dataset._model.steppedLine,hitRadius:l.hitRadius||i.getValueAtIndexOrDefault(c.pointHitRadius,e,p.hitRadius)}},calculatePointY:function(t,e,i){var n,o,a,r=this,s=r.chart,l=r.getMeta(),c=r.getScaleForId(l.yAxisID),u=0,d=0;if(c.options.stacked){for(n=0;i>n;n++)if(o=s.data.datasets[n],a=s.getDatasetMeta(n),"line"===a.type&&a.yAxisID===c.id&&s.isDatasetVisible(n)){var h=Number(c.getRightValue(o.data[e]));0>h?d+=h||0:u+=h||0}var f=Number(c.getRightValue(t));return 0>f?c.getPixelForValue(d+f):c.getPixelForValue(u+f)}return c.getPixelForValue(t)},updateBezierControlPoints:function(){function t(t,e,i){return Math.max(Math.min(t,i),e)}var e,n,o,a,r,s=this,l=s.getMeta(),c=s.chart.chartArea,u=l.data||[];if(l.dataset._model.spanGaps&&(u=u.filter(function(t){return!t._model.skip})),"monotone"===l.dataset._model.cubicInterpolationMode)i.splineCurveMonotone(u);else for(e=0,n=u.length;n>e;++e)o=u[e],a=o._model,r=i.splineCurve(i.previousItem(u,e)._model,a,i.nextItem(u,e)._model,l.dataset._model.tension),a.controlPointPreviousX=r.previous.x,a.controlPointPreviousY=r.previous.y,a.controlPointNextX=r.next.x,a.controlPointNextY=r.next.y;if(s.chart.options.elements.line.capBezierPoints)for(e=0,n=u.length;n>e;++e)a=u[e]._model,a.controlPointPreviousX=t(a.controlPointPreviousX,c.left,c.right),a.controlPointPreviousY=t(a.controlPointPreviousY,c.top,c.bottom),a.controlPointNextX=t(a.controlPointNextX,c.left,c.right),a.controlPointNextY=t(a.controlPointNextY,c.top,c.bottom)},draw:function(t){var i,n,o=this,a=o.getMeta(),r=a.data||[],s=t||1;for(i=0,n=r.length;n>i;++i)r[i].transition(s);for(e(o.getDataset(),o.chart.options)&&a.dataset.transition(s).draw(),i=0,n=r.length;n>i;++i)r[i].draw()},setHoverStyle:function(t){var e=this.chart.data.datasets[t._datasetIndex],n=t._index,o=t.custom||{},a=t._model;a.radius=o.hoverRadius||i.getValueAtIndexOrDefault(e.pointHoverRadius,n,this.chart.options.elements.point.hoverRadius),a.backgroundColor=o.hoverBackgroundColor||i.getValueAtIndexOrDefault(e.pointHoverBackgroundColor,n,i.getHoverColor(a.backgroundColor)),a.borderColor=o.hoverBorderColor||i.getValueAtIndexOrDefault(e.pointHoverBorderColor,n,i.getHoverColor(a.borderColor)),a.borderWidth=o.hoverBorderWidth||i.getValueAtIndexOrDefault(e.pointHoverBorderWidth,n,a.borderWidth)},removeHoverStyle:function(t){var e=this,n=e.chart.data.datasets[t._datasetIndex],o=t._index,a=t.custom||{},r=t._model;void 0!==n.radius&&void 0===n.pointRadius&&(n.pointRadius=n.radius),r.radius=a.radius||i.getValueAtIndexOrDefault(n.pointRadius,o,e.chart.options.elements.point.radius),r.backgroundColor=e.getPointBackgroundColor(t,o),r.borderColor=e.getPointBorderColor(t,o),r.borderWidth=e.getPointBorderWidth(t,o)}})}},{}],19:[function(t,e,i){"use strict";e.exports=function(t){var e=t.helpers;t.defaults.polarArea={scale:{type:"radialLinear",lineArc:!0,ticks:{beginAtZero:!0}},animation:{animateRotate:!0,animateScale:!0},startAngle:-.5*Math.PI,aspectRatio:1,legendCallback:function(t){var e=[];e.push('
');var i=t.data,n=i.datasets,o=i.labels;if(n.length)for(var a=0;a'),o[a]&&e.push(o[a]),e.push("");return e.push("
"),e.join("")},legend:{labels:{generateLabels:function(t){var i=t.data;return i.labels.length&&i.datasets.length?i.labels.map(function(n,o){var a=t.getDatasetMeta(0),r=i.datasets[0],s=a.data[o],l=s.custom||{},c=e.getValueAtIndexOrDefault,u=t.options.elements.arc,d=l.backgroundColor?l.backgroundColor:c(r.backgroundColor,o,u.backgroundColor),h=l.borderColor?l.borderColor:c(r.borderColor,o,u.borderColor),f=l.borderWidth?l.borderWidth:c(r.borderWidth,o,u.borderWidth);return{text:n,fillStyle:d,strokeStyle:h,lineWidth:f,hidden:isNaN(r.data[o])||a.data[o].hidden,index:o}}):[]}},onClick:function(t,e){var i,n,o,a=e.index,r=this.chart;for(i=0,n=(r.data.datasets||[]).length;n>i;++i)o=r.getDatasetMeta(i),o.data[a].hidden=!o.data[a].hidden;r.update()}},tooltips:{callbacks:{title:function(){return""},label:function(t,e){return e.labels[t.index]+": "+t.yLabel}}}},t.controllers.polarArea=t.DatasetController.extend({dataElementType:t.elements.Arc,linkScales:e.noop,update:function(t){var i=this,n=i.chart,o=n.chartArea,a=i.getMeta(),r=n.options,s=r.elements.arc,l=Math.min(o.right-o.left,o.bottom-o.top);n.outerRadius=Math.max((l-s.borderWidth/2)/2,0),n.innerRadius=Math.max(r.cutoutPercentage?n.outerRadius/100*r.cutoutPercentage:1,0),n.radiusLength=(n.outerRadius-n.innerRadius)/n.getVisibleDatasetCount(),i.outerRadius=n.outerRadius-n.radiusLength*i.index,i.innerRadius=i.outerRadius-n.radiusLength,a.count=i.countVisibleElements(),e.each(a.data,function(e,n){i.updateElement(e,n,t)})},updateElement:function(t,i,n){for(var o=this,a=o.chart,r=o.getDataset(),s=a.options,l=s.animation,c=a.scale,u=e.getValueAtIndexOrDefault,d=a.data.labels,h=o.calculateCircumference(r.data[i]),f=c.xCenter,p=c.yCenter,g=0,m=o.getMeta(),k=0;i>k;++k)isNaN(r.data[k])||m.data[k].hidden||++g;var v=s.startAngle,w=t.hidden?0:c.getDistanceFromCenterForValue(r.data[i]),y=v+h*g,b=y+(t.hidden?0:h),x=l.animateScale?0:c.getDistanceFromCenterForValue(r.data[i]);e.extend(t,{_datasetIndex:o.index,_index:i,_scale:c,_model:{x:f,y:p,innerRadius:0,outerRadius:n?x:w,startAngle:n&&l.animateRotate?v:y,endAngle:n&&l.animateRotate?v:b,label:u(d,i,d[i])}}),o.removeHoverStyle(t),t.pivot()},removeHoverStyle:function(e){t.DatasetController.prototype.removeHoverStyle.call(this,e,this.chart.options.elements.arc)},countVisibleElements:function(){var t=this.getDataset(),i=this.getMeta(),n=0;return e.each(i.data,function(e,i){isNaN(t.data[i])||e.hidden||n++}),n},calculateCircumference:function(t){var e=this.getMeta().count;return e>0&&!isNaN(t)?2*Math.PI/e:0}})}},{}],20:[function(t,e,i){"use strict";e.exports=function(t){var e=t.helpers;t.defaults.radar={scale:{type:"radialLinear"},elements:{line:{tension:0}}},t.controllers.radar=t.DatasetController.extend({datasetElementType:t.elements.Line,dataElementType:t.elements.Point,linkScales:e.noop,addElementAndReset:function(e){t.DatasetController.prototype.addElementAndReset.call(this,e),this.updateBezierControlPoints()},update:function(t){var i=this,n=i.getMeta(),o=n.dataset,a=n.data,r=o.custom||{},s=i.getDataset(),l=i.chart.options.elements.line,c=i.chart.scale;void 0!==s.tension&&void 0===s.lineTension&&(s.lineTension=s.tension),e.extend(n.dataset,{_datasetIndex:i.index,_children:a,_loop:!0,_model:{tension:r.tension?r.tension:e.getValueOrDefault(s.lineTension,l.tension),backgroundColor:r.backgroundColor?r.backgroundColor:s.backgroundColor||l.backgroundColor,borderWidth:r.borderWidth?r.borderWidth:s.borderWidth||l.borderWidth,borderColor:r.borderColor?r.borderColor:s.borderColor||l.borderColor,fill:r.fill?r.fill:void 0!==s.fill?s.fill:l.fill,borderCapStyle:r.borderCapStyle?r.borderCapStyle:s.borderCapStyle||l.borderCapStyle,borderDash:r.borderDash?r.borderDash:s.borderDash||l.borderDash,borderDashOffset:r.borderDashOffset?r.borderDashOffset:s.borderDashOffset||l.borderDashOffset,borderJoinStyle:r.borderJoinStyle?r.borderJoinStyle:s.borderJoinStyle||l.borderJoinStyle,scaleTop:c.top,scaleBottom:c.bottom,scaleZero:c.getBasePosition()}}),n.dataset.pivot(),e.each(a,function(e,n){i.updateElement(e,n,t)},i),i.updateBezierControlPoints()},updateElement:function(t,i,n){var o=this,a=t.custom||{},r=o.getDataset(),s=o.chart.scale,l=o.chart.options.elements.point,c=s.getPointPositionForValue(i,r.data[i]);e.extend(t,{_datasetIndex:o.index,_index:i,_scale:s,_model:{x:n?s.xCenter:c.x,y:n?s.yCenter:c.y,tension:a.tension?a.tension:e.getValueOrDefault(r.tension,o.chart.options.elements.line.tension),radius:a.radius?a.radius:e.getValueAtIndexOrDefault(r.pointRadius,i,l.radius),backgroundColor:a.backgroundColor?a.backgroundColor:e.getValueAtIndexOrDefault(r.pointBackgroundColor,i,l.backgroundColor),borderColor:a.borderColor?a.borderColor:e.getValueAtIndexOrDefault(r.pointBorderColor,i,l.borderColor),borderWidth:a.borderWidth?a.borderWidth:e.getValueAtIndexOrDefault(r.pointBorderWidth,i,l.borderWidth),pointStyle:a.pointStyle?a.pointStyle:e.getValueAtIndexOrDefault(r.pointStyle,i,l.pointStyle),hitRadius:a.hitRadius?a.hitRadius:e.getValueAtIndexOrDefault(r.hitRadius,i,l.hitRadius)}}),t._model.skip=a.skip?a.skip:isNaN(t._model.x)||isNaN(t._model.y)},updateBezierControlPoints:function(){var t=this.chart.chartArea,i=this.getMeta();e.each(i.data,function(n,o){var a=n._model,r=e.splineCurve(e.previousItem(i.data,o,!0)._model,a,e.nextItem(i.data,o,!0)._model,a.tension);a.controlPointPreviousX=Math.max(Math.min(r.previous.x,t.right),t.left),a.controlPointPreviousY=Math.max(Math.min(r.previous.y,t.bottom),t.top),a.controlPointNextX=Math.max(Math.min(r.next.x,t.right),t.left),a.controlPointNextY=Math.max(Math.min(r.next.y,t.bottom),t.top),n.pivot()})},draw:function(t){var i=this.getMeta(),n=t||1;e.each(i.data,function(t){t.transition(n)}),i.dataset.transition(n).draw(),e.each(i.data,function(t){t.draw()})},setHoverStyle:function(t){var i=this.chart.data.datasets[t._datasetIndex],n=t.custom||{},o=t._index,a=t._model;a.radius=n.hoverRadius?n.hoverRadius:e.getValueAtIndexOrDefault(i.pointHoverRadius,o,this.chart.options.elements.point.hoverRadius),a.backgroundColor=n.hoverBackgroundColor?n.hoverBackgroundColor:e.getValueAtIndexOrDefault(i.pointHoverBackgroundColor,o,e.getHoverColor(a.backgroundColor)),a.borderColor=n.hoverBorderColor?n.hoverBorderColor:e.getValueAtIndexOrDefault(i.pointHoverBorderColor,o,e.getHoverColor(a.borderColor)),a.borderWidth=n.hoverBorderWidth?n.hoverBorderWidth:e.getValueAtIndexOrDefault(i.pointHoverBorderWidth,o,a.borderWidth)},removeHoverStyle:function(t){var i=this.chart.data.datasets[t._datasetIndex],n=t.custom||{},o=t._index,a=t._model,r=this.chart.options.elements.point;a.radius=n.radius?n.radius:e.getValueAtIndexOrDefault(i.radius,o,r.radius),a.backgroundColor=n.backgroundColor?n.backgroundColor:e.getValueAtIndexOrDefault(i.pointBackgroundColor,o,r.backgroundColor),a.borderColor=n.borderColor?n.borderColor:e.getValueAtIndexOrDefault(i.pointBorderColor,o,r.borderColor),a.borderWidth=n.borderWidth?n.borderWidth:e.getValueAtIndexOrDefault(i.pointBorderWidth,o,r.borderWidth)}})}},{}],21:[function(t,e,i){"use strict";e.exports=function(t){var e=t.helpers;t.defaults.global.animation={duration:1e3,easing:"easeOutQuart",onProgress:e.noop,onComplete:e.noop},t.Animation=t.Element.extend({currentStep:null,numSteps:60,easing:"",render:null,onAnimationProgress:null,onAnimationComplete:null}),t.animationService={frameDuration:17,animations:[],dropFrames:0,request:null,addAnimation:function(t,e,i,n){var o=this;n||(t.animating=!0);for(var a=0;a1&&(i=Math.floor(t.dropFrames),t.dropFrames=t.dropFrames%1);for(var n=0;nt.animations[n].animationObject.numSteps&&(t.animations[n].animationObject.currentStep=t.animations[n].animationObject.numSteps),t.animations[n].animationObject.render(t.animations[n].chartInstance,t.animations[n].animationObject),t.animations[n].animationObject.onAnimationProgress&&t.animations[n].animationObject.onAnimationProgress.call&&t.animations[n].animationObject.onAnimationProgress.call(t.animations[n].chartInstance,t.animations[n]),t.animations[n].animationObject.currentStep===t.animations[n].animationObject.numSteps?(t.animations[n].animationObject.onAnimationComplete&&t.animations[n].animationObject.onAnimationComplete.call&&t.animations[n].animationObject.onAnimationComplete.call(t.animations[n].chartInstance,t.animations[n]),t.animations[n].chartInstance.animating=!1,t.animations.splice(n,1)):++n;var o=Date.now(),a=(o-e)/t.frameDuration;t.dropFrames+=a,t.animations.length>0&&t.requestAnimationFrame()}}}},{}],22:[function(t,e,i){"use strict";e.exports=function(t){var e=t.canvasHelpers={};e.drawPoint=function(t,e,i,n,o){var a,r,s,l,c,u;if("object"==typeof e&&(a=e.toString(),"[object HTMLImageElement]"===a||"[object HTMLCanvasElement]"===a))return void t.drawImage(e,n-e.width/2,o-e.height/2);if(!(isNaN(i)||0>=i)){switch(e){default:t.beginPath(),t.arc(n,o,i,0,2*Math.PI),t.closePath(),t.fill();break;case"triangle":t.beginPath(),r=3*i/Math.sqrt(3),c=r*Math.sqrt(3)/2,t.moveTo(n-r/2,o+c/3),t.lineTo(n+r/2,o+c/3),t.lineTo(n,o-2*c/3),t.closePath(),t.fill();break;case"rect":u=1/Math.SQRT2*i,t.beginPath(),t.fillRect(n-u,o-u,2*u,2*u),t.strokeRect(n-u,o-u,2*u,2*u);break;case"rectRot":u=1/Math.SQRT2*i,t.beginPath(),t.moveTo(n-u,o),t.lineTo(n,o+u),t.lineTo(n+u,o),t.lineTo(n,o-u),t.closePath(),t.fill();break;case"cross":t.beginPath(),t.moveTo(n,o+i),t.lineTo(n,o-i),t.moveTo(n-i,o),t.lineTo(n+i,o),t.closePath();break;case"crossRot":t.beginPath(),s=Math.cos(Math.PI/4)*i,l=Math.sin(Math.PI/4)*i,t.moveTo(n-s,o-l),t.lineTo(n+s,o+l),t.moveTo(n-s,o+l),t.lineTo(n+s,o-l),t.closePath();break;case"star":t.beginPath(),t.moveTo(n,o+i),t.lineTo(n,o-i),t.moveTo(n-i,o),t.lineTo(n+i,o),s=Math.cos(Math.PI/4)*i,l=Math.sin(Math.PI/4)*i,t.moveTo(n-s,o-l),t.lineTo(n+s,o+l),t.moveTo(n-s,o+l),t.lineTo(n+s,o-l),t.closePath();break;case"line":t.beginPath(),t.moveTo(n-i,o),t.lineTo(n+i,o),t.closePath();break;case"dash":t.beginPath(),t.moveTo(n,o),t.lineTo(n+i,o),t.closePath()}t.stroke()}}}},{}],23:[function(t,e,i){"use strict";e.exports=function(t){var e=t.helpers;t.types={},t.instances={},t.controllers={},t.Controller=function(i){return this.chart=i,this.config=i.config,this.options=this.config.options=e.configMerge(t.defaults.global,t.defaults[this.config.type],this.config.options||{}),this.id=e.uid(),Object.defineProperty(this,"data",{get:function(){return this.config.data}}),t.instances[this.id]=this,this.options.responsive&&this.resize(!0),this.initialize(),this},e.extend(t.Controller.prototype,{initialize:function(){var e=this;return t.plugins.notify("beforeInit",[e]),e.bindEvents(),e.ensureScalesHaveIDs(),e.buildOrUpdateControllers(),e.buildScales(),e.updateLayout(),e.resetElements(),e.initToolTip(),e.update(),t.plugins.notify("afterInit",[e]),e},clear:function(){return e.clear(this.chart),this},stop:function(){return t.animationService.cancelAnimation(this),this},resize:function(i){var n=this,o=n.chart,a=o.canvas,r=e.getMaximumWidth(a),s=o.aspectRatio,l=n.options.maintainAspectRatio&&isNaN(s)===!1&&isFinite(s)&&0!==s?r/s:e.getMaximumHeight(a),c=o.width!==r||o.height!==l;if(!c)return n;a.width=o.width=r,a.height=o.height=l,e.retinaScale(o);var u={width:r,height:l};return t.plugins.notify("resize",[n,u]),n.options.onResize&&n.options.onResize(n,u),i||(n.stop(),n.update(n.options.responsiveAnimationDuration)),n},ensureScalesHaveIDs:function(){var t=this.options,i=t.scales||{},n=t.scale;e.each(i.xAxes,function(t,e){t.id=t.id||"x-axis-"+e}),e.each(i.yAxes,function(t,e){t.id=t.id||"y-axis-"+e}),n&&(n.id=n.id||"scale")},buildScales:function(){var i=this,n=i.options,o=i.scales={},a=[];n.scales&&(a=a.concat((n.scales.xAxes||[]).map(function(t){return{options:t,dtype:"category"}}),(n.scales.yAxes||[]).map(function(t){return{options:t,dtype:"linear"}}))),n.scale&&a.push({options:n.scale,dtype:"radialLinear",isDefault:!0}),e.each(a,function(n){var a=n.options,r=e.getValueOrDefault(a.type,n.dtype),s=t.scaleService.getScaleConstructor(r);if(s){var l=new s({id:a.id,options:a,ctx:i.chart.ctx,chart:i});o[l.id]=l,n.isDefault&&(i.scale=l)}}),t.scaleService.addScalesToLayout(this)},updateLayout:function(){t.layoutService.update(this,this.chart.width,this.chart.height)},buildOrUpdateControllers:function(){var i=this,n=[],o=[];if(e.each(i.data.datasets,function(e,a){var r=i.getDatasetMeta(a);r.type||(r.type=e.type||i.config.type),n.push(r.type),r.controller?r.controller.updateIndex(a):(r.controller=new t.controllers[r.type](i,a),o.push(r.controller))},i),n.length>1)for(var a=1;ae;++e)n.getDatasetMeta(e).controller.update();t.plugins.notify("afterDatasetsUpdate",[n])}},render:function(i,n){var o=this;t.plugins.notify("beforeRender",[o]);var a=o.options.animation;if(a&&("undefined"!=typeof i&&0!==i||"undefined"==typeof i&&0!==a.duration)){var r=new t.Animation;r.numSteps=(i||a.duration)/16.66,r.easing=a.easing,r.render=function(t,i){var n=e.easingEffects[i.easing],o=i.currentStep/i.numSteps,a=n(o);t.draw(a,o,i.currentStep)},r.onAnimationProgress=a.onProgress,r.onAnimationComplete=a.onComplete,t.animationService.addAnimation(o,r,i,n)}else o.draw(),a&&a.onComplete&&a.onComplete.call&&a.onComplete.call(o);return o},draw:function(i){var n=this,o=i||1;n.clear(),t.plugins.notify("beforeDraw",[n,o]),e.each(n.boxes,function(t){t.draw(n.chartArea)},n),n.scale&&n.scale.draw(),t.plugins.notify("beforeDatasetsDraw",[n,o]),e.each(n.data.datasets,function(t,e){n.isDatasetVisible(e)&&n.getDatasetMeta(e).controller.draw(i)},n,!0),t.plugins.notify("afterDatasetsDraw",[n,o]),n.tooltip.transition(o).draw(),t.plugins.notify("afterDraw",[n,o])},getElementAtEvent:function(t){var i=this,n=e.getRelativePosition(t,i.chart),o=[];return e.each(i.data.datasets,function(t,a){if(i.isDatasetVisible(a)){var r=i.getDatasetMeta(a);e.each(r.data,function(t){return t.inRange(n.x,n.y)?(o.push(t),o):void 0})}}),o.slice(0,1)},getElementsAtEvent:function(t){var i=this,n=e.getRelativePosition(t,i.chart),o=[],a=function(){if(i.data.datasets)for(var t=0;t0&&(e=this.getDatasetMeta(e[0]._datasetIndex).data),e},getDatasetMeta:function(t){var e=this,i=e.data.datasets[t];i._meta||(i._meta={});var n=i._meta[e.id];return n||(n=i._meta[e.id]={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null}),n},getVisibleDatasetCount:function(){for(var t=0,e=0,i=this.data.datasets.length;i>e;++e)this.isDatasetVisible(e)&&t++;return t},isDatasetVisible:function(t){var e=this.getDatasetMeta(t);return"boolean"==typeof e.hidden?!e.hidden:!this.data.datasets[t].hidden},generateLegend:function(){return this.options.legendCallback(this)},destroy:function(){var i=this;i.stop(),i.clear(),e.unbindEvents(i,i.events),e.removeResizeListener(i.chart.canvas.parentNode);var n=i.chart.canvas;n.width=i.chart.width,n.height=i.chart.height,void 0!==i.chart.originalDevicePixelRatio&&i.chart.ctx.scale(1/i.chart.originalDevicePixelRatio,1/i.chart.originalDevicePixelRatio),n.style.width=i.chart.originalCanvasStyleWidth,n.style.height=i.chart.originalCanvasStyleHeight,t.plugins.notify("destroy",[i]),delete t.instances[i.id]},toBase64Image:function(){return this.chart.canvas.toDataURL.apply(this.chart.canvas,arguments)},initToolTip:function(){var e=this;e.tooltip=new t.Tooltip({_chart:e.chart,_chartInstance:e,_data:e.data,_options:e.options.tooltips},e)},bindEvents:function(){var t=this;e.bindEvents(t,t.options.events,function(e){t.eventHandler(e)})},updateHoverStyle:function(t,e,i){var n,o,a,r=i?"setHoverStyle":"removeHoverStyle";switch(e){case"single":t=[t[0]];break;case"label":case"dataset":case"x-axis":break;default:return}for(o=0,a=t.length;a>o;++o)n=t[o],n&&this.getDatasetMeta(n._datasetIndex).controller[r](n)},eventHandler:function(t){var i=this,n=i.tooltip,o=i.options||{},a=o.hover,r=o.tooltips;return i.lastActive=i.lastActive||[],i.lastTooltipActive=i.lastTooltipActive||[],"mouseout"===t.type?(i.active=[],i.tooltipActive=[]):(i.active=i.getElementsAtEventForMode(t,a.mode),i.tooltipActive=i.getElementsAtEventForMode(t,r.mode)),a.onHover&&a.onHover.call(i,i.active),i.legend&&i.legend.handleEvent&&i.legend.handleEvent(t),("mouseup"===t.type||"click"===t.type)&&o.onClick&&o.onClick.call(i,t,i.active),i.lastActive.length&&i.updateHoverStyle(i.lastActive,a.mode,!1),i.active.length&&a.mode&&i.updateHoverStyle(i.active,a.mode,!0),(r.enabled||r.custom)&&(n.initialize(),n._active=i.tooltipActive,n.update(!0)),n.pivot(),i.animating||e.arrayEquals(i.active,i.lastActive)&&e.arrayEquals(i.tooltipActive,i.lastTooltipActive)||(i.stop(),(r.enabled||r.custom)&&n.update(!0),i.render(a.animationDuration,!0)),i.lastActive=i.active,i.lastTooltipActive=i.tooltipActive,i}})}},{}],24:[function(t,e,i){"use strict";e.exports=function(t){var e=t.helpers,i=e.noop;t.DatasetController=function(t,e){this.initialize(t,e)},e.extend(t.DatasetController.prototype,{datasetElementType:null,dataElementType:null,initialize:function(t,e){var i=this;i.chart=t,i.index=e,i.linkScales(),i.addElements()},updateIndex:function(t){this.index=t},linkScales:function(){var t=this,e=t.getMeta(),i=t.getDataset();null===e.xAxisID&&(e.xAxisID=i.xAxisID||t.chart.options.scales.xAxes[0].id),null===e.yAxisID&&(e.yAxisID=i.yAxisID||t.chart.options.scales.yAxes[0].id)},getDataset:function(){return this.chart.data.datasets[this.index]},getMeta:function(){return this.chart.getDatasetMeta(this.index)},getScaleForId:function(t){return this.chart.scales[t]},reset:function(){this.update(!0)},createMetaDataset:function(){var t=this,e=t.datasetElementType;return e&&new e({_chart:t.chart.chart,_datasetIndex:t.index})},createMetaData:function(t){var e=this,i=e.dataElementType;return i&&new i({_chart:e.chart.chart,_datasetIndex:e.index,_index:t})},addElements:function(){var t,e,i=this,n=i.getMeta(),o=i.getDataset().data||[],a=n.data;for(t=0,e=o.length;e>t;++t)a[t]=a[t]||i.createMetaData(n,t);n.dataset=n.dataset||i.createMetaDataset()},addElementAndReset:function(t){var e=this,i=e.createMetaData(t);e.getMeta().data.splice(t,0,i),e.updateElement(i,t,!0)},buildOrUpdateElements:function(){var t=this.getMeta(),e=t.data,i=this.getDataset().data.length,n=e.length;if(n>i)e.splice(i,n-i);else if(i>n)for(var o=n;i>o;++o)this.addElementAndReset(o)},update:i,draw:function(t){var i=t||1;e.each(this.getMeta().data,function(t){t.transition(i).draw()})},removeHoverStyle:function(t,i){var n=this.chart.data.datasets[t._datasetIndex],o=t._index,a=t.custom||{},r=e.getValueAtIndexOrDefault,s=t._model;s.backgroundColor=a.backgroundColor?a.backgroundColor:r(n.backgroundColor,o,i.backgroundColor),s.borderColor=a.borderColor?a.borderColor:r(n.borderColor,o,i.borderColor),s.borderWidth=a.borderWidth?a.borderWidth:r(n.borderWidth,o,i.borderWidth)},setHoverStyle:function(t){var i=this.chart.data.datasets[t._datasetIndex],n=t._index,o=t.custom||{},a=e.getValueAtIndexOrDefault,r=e.getHoverColor,s=t._model;s.backgroundColor=o.hoverBackgroundColor?o.hoverBackgroundColor:a(i.hoverBackgroundColor,n,r(s.backgroundColor)),s.borderColor=o.hoverBorderColor?o.hoverBorderColor:a(i.hoverBorderColor,n,r(s.borderColor)),
s.borderWidth=o.hoverBorderWidth?o.hoverBorderWidth:a(i.hoverBorderWidth,n,s.borderWidth)}}),t.DatasetController.extend=e.inherits}},{}],25:[function(t,e,i){"use strict";e.exports=function(t){var e=t.helpers;t.elements={},t.Element=function(t){e.extend(this,t),this.initialize.apply(this,arguments)},e.extend(t.Element.prototype,{initialize:function(){this.hidden=!1},pivot:function(){var t=this;return t._view||(t._view=e.clone(t._model)),t._start=e.clone(t._view),t},transition:function(t){var i=this;return i._view||(i._view=e.clone(i._model)),1===t?(i._view=i._model,i._start=null,i):(i._start||i.pivot(),e.each(i._model,function(n,o){if("_"===o[0]);else if(i._view.hasOwnProperty(o))if(n===i._view[o]);else if("string"==typeof n)try{var a=e.color(i._model[o]).mix(e.color(i._start[o]),t);i._view[o]=a.rgbString()}catch(t){i._view[o]=n}else if("number"==typeof n){var r=void 0!==i._start[o]&&isNaN(i._start[o])===!1?i._start[o]:0;i._view[o]=(i._model[o]-r)*t+r}else i._view[o]=n;else"number"!=typeof n||isNaN(i._view[o])?i._view[o]=n:i._view[o]=n*t},i),i)},tooltipPosition:function(){return{x:this._model.x,y:this._model.y}},hasValue:function(){return e.isNumber(this._model.x)&&e.isNumber(this._model.y)}}),t.Element.extend=e.inherits}},{}],26:[function(t,e,i){"use strict";var n=t(3);e.exports=function(t){function e(t,e,i){var n;return"string"==typeof t?(n=parseInt(t,10),-1!==t.indexOf("%")&&(n=n/100*e.parentNode[i])):n=t,n}function i(t){return void 0!==t&&null!==t&&"none"!==t}function o(t,n,o){var a=document.defaultView,r=t.parentNode,s=a.getComputedStyle(t)[n],l=a.getComputedStyle(r)[n],c=i(s),u=i(l),d=Number.POSITIVE_INFINITY;return c||u?Math.min(c?e(s,t,o):d,u?e(l,r,o):d):"none"}var a=t.helpers={};a.each=function(t,e,i,n){var o,r;if(a.isArray(t))if(r=t.length,n)for(o=r-1;o>=0;o--)e.call(i,t[o],o);else for(o=0;r>o;o++)e.call(i,t[o],o);else if("object"==typeof t){var s=Object.keys(t);for(r=s.length,o=0;r>o;o++)e.call(i,t[s[o]],s[o])}},a.clone=function(t){var e={};return a.each(t,function(t,i){a.isArray(t)?e[i]=t.slice(0):"object"==typeof t&&null!==t?e[i]=a.clone(t):e[i]=t}),e},a.extend=function(t){for(var e=function(e,i){t[i]=e},i=1,n=arguments.length;n>i;i++)a.each(arguments[i],e);return t},a.configMerge=function(e){var i=a.clone(e);return a.each(Array.prototype.slice.call(arguments,1),function(e){a.each(e,function(e,n){if("scales"===n)i[n]=a.scaleMerge(i.hasOwnProperty(n)?i[n]:{},e);else if("scale"===n)i[n]=a.configMerge(i.hasOwnProperty(n)?i[n]:{},t.scaleService.getScaleDefaults(e.type),e);else if(i.hasOwnProperty(n)&&a.isArray(i[n])&&a.isArray(e)){var o=i[n];a.each(e,function(t,e){e=n[i].length||!n[i][o].type?n[i].push(a.configMerge(s,e)):e.type&&e.type!==n[i][o].type?n[i][o]=a.configMerge(n[i][o],s,e):n[i][o]=a.configMerge(n[i][o],e)}):(n[i]=[],a.each(e,function(e){var o=a.getValueOrDefault(e.type,"xAxes"===i?"category":"linear");n[i].push(a.configMerge(t.scaleService.getScaleDefaults(o),e))})):n.hasOwnProperty(i)&&"object"==typeof n[i]&&null!==n[i]&&"object"==typeof e?n[i]=a.configMerge(n[i],e):n[i]=e}),n},a.getValueAtIndexOrDefault=function(t,e,i){return void 0===t||null===t?i:a.isArray(t)?ei;++i)if(t[i]===e)return i;return-1},a.where=function(t,e){if(a.isArray(t)&&Array.prototype.filter)return t.filter(e);var i=[];return a.each(t,function(t){e(t)&&i.push(t)}),i},a.findIndex=Array.prototype.findIndex?function(t,e,i){return t.findIndex(e,i)}:function(t,e,i){i=void 0===i?t:i;for(var n=0,o=t.length;o>n;++n)if(e.call(i,t[n],n,t))return n;return-1},a.findNextWhere=function(t,e,i){(void 0===i||null===i)&&(i=-1);for(var n=i+1;n=0;n--){var o=t[n];if(e(o))return o}},a.inherits=function(t){var e=this,i=t&&t.hasOwnProperty("constructor")?t.constructor:function(){return e.apply(this,arguments)},n=function(){this.constructor=i};return n.prototype=e.prototype,i.prototype=new n,i.extend=a.inherits,t&&a.extend(i.prototype,t),i.__super__=e.prototype,i},a.noop=function(){},a.uid=function(){var t=0;return function(){return t++}}(),a.isNumber=function(t){return!isNaN(parseFloat(t))&&isFinite(t)},a.almostEquals=function(t,e,i){return Math.abs(t-e)0?1:-1},a.log10=Math.log10?function(t){return Math.log10(t)}:function(t){return Math.log(t)/Math.LN10},a.toRadians=function(t){return t*(Math.PI/180)},a.toDegrees=function(t){return t*(180/Math.PI)},a.getAngleFromPoint=function(t,e){var i=e.x-t.x,n=e.y-t.y,o=Math.sqrt(i*i+n*n),a=Math.atan2(n,i);return a<-.5*Math.PI&&(a+=2*Math.PI),{angle:a,distance:o}},a.aliasPixel=function(t){return t%2===0?0:.5},a.splineCurve=function(t,e,i,n){var o=t.skip?e:t,a=e,r=i.skip?e:i,s=Math.sqrt(Math.pow(a.x-o.x,2)+Math.pow(a.y-o.y,2)),l=Math.sqrt(Math.pow(r.x-a.x,2)+Math.pow(r.y-a.y,2)),c=s/(s+l),u=l/(s+l);c=isNaN(c)?0:c,u=isNaN(u)?0:u;var d=n*c,h=n*u;return{previous:{x:a.x-d*(r.x-o.x),y:a.y-d*(r.y-o.y)},next:{x:a.x+h*(r.x-o.x),y:a.y+h*(r.y-o.y)}}},a.EPSILON=Number.EPSILON||1e-14,a.splineCurveMonotone=function(t){var e,i,n,o,r=(t||[]).map(function(t){return{model:t._model,deltaK:0,mK:0}}),s=r.length;for(e=0;s>e;++e)n=r[e],n.model.skip||(i=e>0?r[e-1]:null,o=s-1>e?r[e+1]:null,o&&!o.model.skip&&(n.deltaK=(o.model.y-n.model.y)/(o.model.x-n.model.x)),!i||i.model.skip?n.mK=n.deltaK:!o||o.model.skip?n.mK=i.deltaK:this.sign(i.deltaK)!==this.sign(n.deltaK)?n.mK=0:n.mK=(i.deltaK+n.deltaK)/2);var l,c,u,d;for(e=0;s-1>e;++e)n=r[e],o=r[e+1],n.model.skip||o.model.skip||(a.almostEquals(n.deltaK,0,this.EPSILON)?n.mK=o.mK=0:(l=n.mK/n.deltaK,c=o.mK/n.deltaK,d=Math.pow(l,2)+Math.pow(c,2),9>=d||(u=3/Math.sqrt(d),n.mK=l*u*n.deltaK,o.mK=c*u*n.deltaK)));var h;for(e=0;s>e;++e)n=r[e],n.model.skip||(i=e>0?r[e-1]:null,o=s-1>e?r[e+1]:null,i&&!i.model.skip&&(h=(n.model.x-i.model.x)/3,n.model.controlPointPreviousX=n.model.x-h,n.model.controlPointPreviousY=n.model.y-h*n.mK),o&&!o.model.skip&&(h=(o.model.x-n.model.x)/3,n.model.controlPointNextX=n.model.x+h,n.model.controlPointNextY=n.model.y+h*n.mK))},a.nextItem=function(t,e,i){return i?e>=t.length-1?t[0]:t[e+1]:e>=t.length-1?t[t.length-1]:t[e+1]},a.previousItem=function(t,e,i){return i?0>=e?t[t.length-1]:t[e-1]:0>=e?t[0]:t[e-1]},a.niceNum=function(t,e){var i,n=Math.floor(a.log10(t)),o=t/Math.pow(10,n);return i=e?1.5>o?1:3>o?2:7>o?5:10:1>=o?1:2>=o?2:5>=o?5:10,i*Math.pow(10,n)};var r=a.easingEffects={linear:function(t){return t},easeInQuad:function(t){return t*t},easeOutQuad:function(t){return-1*t*(t-2)},easeInOutQuad:function(t){return(t/=.5)<1?.5*t*t:-.5*(--t*(t-2)-1)},easeInCubic:function(t){return t*t*t},easeOutCubic:function(t){return 1*((t=t/1-1)*t*t+1)},easeInOutCubic:function(t){return(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2)},easeInQuart:function(t){return t*t*t*t},easeOutQuart:function(t){return-1*((t=t/1-1)*t*t*t-1)},easeInOutQuart:function(t){return(t/=.5)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)},easeInQuint:function(t){return 1*(t/=1)*t*t*t*t},easeOutQuint:function(t){return 1*((t=t/1-1)*t*t*t*t+1)},easeInOutQuint:function(t){return(t/=.5)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)},easeInSine:function(t){return-1*Math.cos(t/1*(Math.PI/2))+1},easeOutSine:function(t){return 1*Math.sin(t/1*(Math.PI/2))},easeInOutSine:function(t){return-.5*(Math.cos(Math.PI*t/1)-1)},easeInExpo:function(t){return 0===t?1:1*Math.pow(2,10*(t/1-1))},easeOutExpo:function(t){return 1===t?1:1*(-Math.pow(2,-10*t/1)+1)},easeInOutExpo:function(t){return 0===t?0:1===t?1:(t/=.5)<1?.5*Math.pow(2,10*(t-1)):.5*(-Math.pow(2,-10*--t)+2)},easeInCirc:function(t){return t>=1?t:-1*(Math.sqrt(1-(t/=1)*t)-1)},easeOutCirc:function(t){return 1*Math.sqrt(1-(t=t/1-1)*t)},easeInOutCirc:function(t){return(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},easeInElastic:function(t){var e=1.70158,i=0,n=1;return 0===t?0:1===(t/=1)?1:(i||(i=.3),nt?-.5*(n*Math.pow(2,10*(t-=1))*Math.sin((1*t-e)*(2*Math.PI)/i)):n*Math.pow(2,-10*(t-=1))*Math.sin((1*t-e)*(2*Math.PI)/i)*.5+1)},easeInBack:function(t){var e=1.70158;return 1*(t/=1)*t*((e+1)*t-e)},easeOutBack:function(t){var e=1.70158;return 1*((t=t/1-1)*t*((e+1)*t+e)+1)},easeInOutBack:function(t){var e=1.70158;return(t/=.5)<1?.5*(t*t*(((e*=1.525)+1)*t-e)):.5*((t-=2)*t*(((e*=1.525)+1)*t+e)+2)},easeInBounce:function(t){return 1-r.easeOutBounce(1-t)},easeOutBounce:function(t){return(t/=1)<1/2.75?1*(7.5625*t*t):2/2.75>t?1*(7.5625*(t-=1.5/2.75)*t+.75):2.5/2.75>t?1*(7.5625*(t-=2.25/2.75)*t+.9375):1*(7.5625*(t-=2.625/2.75)*t+.984375)},easeInOutBounce:function(t){return.5>t?.5*r.easeInBounce(2*t):.5*r.easeOutBounce(2*t-1)+.5}};a.requestAnimFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){return window.setTimeout(t,1e3/60)}}(),a.cancelAnimFrame=function(){return window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.oCancelAnimationFrame||window.msCancelAnimationFrame||function(t){return window.clearTimeout(t,1e3/60)}}(),a.getRelativePosition=function(t,e){var i,n,o=t.originalEvent||t,r=t.currentTarget||t.srcElement,s=r.getBoundingClientRect(),l=o.touches;l&&l.length>0?(i=l[0].clientX,n=l[0].clientY):(i=o.clientX,n=o.clientY);var c=parseFloat(a.getStyle(r,"padding-left")),u=parseFloat(a.getStyle(r,"padding-top")),d=parseFloat(a.getStyle(r,"padding-right")),h=parseFloat(a.getStyle(r,"padding-bottom")),f=s.right-s.left-c-d,p=s.bottom-s.top-u-h;return i=Math.round((i-s.left-c)/f*r.width/e.currentDevicePixelRatio),n=Math.round((n-s.top-u)/p*r.height/e.currentDevicePixelRatio),{x:i,y:n}},a.addEvent=function(t,e,i){t.addEventListener?t.addEventListener(e,i):t.attachEvent?t.attachEvent("on"+e,i):t["on"+e]=i},a.removeEvent=function(t,e,i){t.removeEventListener?t.removeEventListener(e,i,!1):t.detachEvent?t.detachEvent("on"+e,i):t["on"+e]=a.noop},a.bindEvents=function(t,e,i){var n=t.events=t.events||{};a.each(e,function(e){n[e]=function(){i.apply(t,arguments)},a.addEvent(t.chart.canvas,e,n[e])})},a.unbindEvents=function(t,e){var i=t.chart.canvas;a.each(e,function(t,e){a.removeEvent(i,e,t)})},a.getConstraintWidth=function(t){return o(t,"max-width","clientWidth")},a.getConstraintHeight=function(t){return o(t,"max-height","clientHeight")},a.getMaximumWidth=function(t){var e=t.parentNode,i=parseInt(a.getStyle(e,"padding-left"),10),n=parseInt(a.getStyle(e,"padding-right"),10),o=e.clientWidth-i-n,r=a.getConstraintWidth(t);return isNaN(r)?o:Math.min(o,r)},a.getMaximumHeight=function(t){var e=t.parentNode,i=parseInt(a.getStyle(e,"padding-top"),10),n=parseInt(a.getStyle(e,"padding-bottom"),10),o=e.clientHeight-i-n,r=a.getConstraintHeight(t);return isNaN(r)?o:Math.min(o,r)},a.getStyle=function(t,e){return t.currentStyle?t.currentStyle[e]:document.defaultView.getComputedStyle(t,null).getPropertyValue(e)},a.retinaScale=function(t){var e=t.ctx,i=t.canvas,n=i.width,o=i.height,a=t.currentDevicePixelRatio=window.devicePixelRatio||1;1!==a&&(i.height=o*a,i.width=n*a,e.scale(a,a),t.originalDevicePixelRatio=t.originalDevicePixelRatio||a),i.style.width=n+"px",i.style.height=o+"px"},a.clear=function(t){t.ctx.clearRect(0,0,t.width,t.height)},a.fontString=function(t,e,i){return e+" "+t+"px "+i},a.longestText=function(t,e,i,n){n=n||{};var o=n.data=n.data||{},r=n.garbageCollect=n.garbageCollect||[];n.font!==e&&(o=n.data={},r=n.garbageCollect=[],n.font=e),t.font=e;var s=0;a.each(i,function(e){void 0!==e&&null!==e&&a.isArray(e)!==!0?s=a.measureText(t,o,r,s,e):a.isArray(e)&&a.each(e,function(e){void 0===e||null===e||a.isArray(e)||(s=a.measureText(t,o,r,s,e))})});var l=r.length/2;if(l>i.length){for(var c=0;l>c;c++)delete o[r[c]];r.splice(0,l)}return s},a.measureText=function(t,e,i,n,o){var a=e[o];return a||(a=e[o]=t.measureText(o).width,i.push(o)),a>n&&(n=a),n},a.numberOfLabelLines=function(t){var e=1;return a.each(t,function(t){a.isArray(t)&&t.length>e&&(e=t.length)}),e},a.drawRoundedRectangle=function(t,e,i,n,o,a){t.beginPath(),t.moveTo(e+a,i),t.lineTo(e+n-a,i),t.quadraticCurveTo(e+n,i,e+n,i+a),t.lineTo(e+n,i+o-a),t.quadraticCurveTo(e+n,i+o,e+n-a,i+o),t.lineTo(e+a,i+o),t.quadraticCurveTo(e,i+o,e,i+o-a),t.lineTo(e,i+a),t.quadraticCurveTo(e,i,e+a,i),t.closePath()},a.color=function(e){return n?n(e instanceof CanvasGradient?t.defaults.global.defaultColor:e):(console.error("Color.js not found!"),e)},a.addResizeListener=function(t,e){var i=document.createElement("iframe"),n="chartjs-hidden-iframe";i.classlist?i.classlist.add(n):i.setAttribute("class",n),i.tabIndex=-1;var o=i.style;o.width="100%",o.display="block",o.border=0,o.height=0,o.margin=0,o.position="absolute",o.left=0,o.right=0,o.top=0,o.bottom=0,t.insertBefore(i,t.firstChild),(i.contentWindow||i).onresize=function(){return e?e():void 0}},a.removeResizeListener=function(t){var e=t.querySelector(".chartjs-hidden-iframe");e&&e.parentNode.removeChild(e)},a.isArray=Array.isArray?function(t){return Array.isArray(t)}:function(t){return"[object Array]"===Object.prototype.toString.call(t)},a.arrayEquals=function(t,e){var i,n,o,r;if(!t||!e||t.length!==e.length)return!1;for(i=0,n=t.length;n>i;++i)if(o=t[i],r=e[i],o instanceof Array&&r instanceof Array){if(!a.arrayEquals(o,r))return!1}else if(o!==r)return!1;return!0},a.callCallback=function(t,e,i){t&&"function"==typeof t.call&&t.apply(i,e)},a.getHoverColor=function(t){return t instanceof CanvasPattern?t:a.color(t).saturate(.5).darken(.1).rgbString()}}},{3:3}],27:[function(t,e,i){"use strict";e.exports=function(){var t=function(e,i){var n=this,o=t.helpers;return n.config=i||{data:{datasets:[]}},e.length&&e[0].getContext&&(e=e[0]),e.getContext&&(e=e.getContext("2d")),n.ctx=e,n.canvas=e.canvas,e.canvas.style.display=e.canvas.style.display||"block",n.width=e.canvas.width||parseInt(o.getStyle(e.canvas,"width"),10)||o.getMaximumWidth(e.canvas),n.height=e.canvas.height||parseInt(o.getStyle(e.canvas,"height"),10)||o.getMaximumHeight(e.canvas),n.aspectRatio=n.width/n.height,(isNaN(n.aspectRatio)||isFinite(n.aspectRatio)===!1)&&(n.aspectRatio=void 0!==i.aspectRatio?i.aspectRatio:2),n.originalCanvasStyleWidth=e.canvas.style.width,n.originalCanvasStyleHeight=e.canvas.style.height,o.retinaScale(n),n.controller=new t.Controller(n),o.addResizeListener(e.canvas.parentNode,function(){n.controller&&n.controller.config.options.responsive&&n.controller.resize()}),n.controller?n.controller:n};return t.defaults={global:{responsive:!0,responsiveAnimationDuration:0,maintainAspectRatio:!0,events:["mousemove","mouseout","click","touchstart","touchmove"],hover:{onHover:null,mode:"single",animationDuration:400},onClick:null,defaultColor:"rgba(0,0,0,0.1)",defaultFontColor:"#666",defaultFontFamily:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",defaultFontSize:12,defaultFontStyle:"normal",showLines:!0,elements:{},legendCallback:function(t){var e=[];e.push('');for(var i=0;i'),t.data.datasets[i].label&&e.push(t.data.datasets[i].label),e.push("");return e.push("
"),e.join("")}}},t.Chart=t,t}},{}],28:[function(t,e,i){"use strict";e.exports=function(t){var e=t.helpers;t.layoutService={defaults:{},addBox:function(t,e){t.boxes||(t.boxes=[]),t.boxes.push(e)},removeBox:function(t,e){t.boxes&&t.boxes.splice(t.boxes.indexOf(e),1)},update:function(t,i,n){function o(t){var e,i=t.isHorizontal();i?(e=t.update(t.options.fullWidth?g:b,y),x-=e.height):(e=t.update(w,v),b-=e.width),D.push({horizontal:i,minSize:e,box:t})}function a(t){var i=e.findNextWhere(D,function(e){return e.box===t});if(i)if(t.isHorizontal()){var n={left:C,right:S,top:0,bottom:0};t.update(t.options.fullWidth?g:b,m/2,n)}else t.update(i.minSize.width,x)}function r(t){var i=e.findNextWhere(D,function(e){return e.box===t}),n={left:0,right:0,top:M,bottom:Y};i&&t.update(i.minSize.width,x,n)}function s(t){t.isHorizontal()?(t.left=t.options.fullWidth?l:C,t.right=t.options.fullWidth?i-l:C+b,t.top=A,t.bottom=A+t.height,A=t.bottom):(t.left=P,t.right=P+t.width,t.top=M,t.bottom=M+x,P=t.right)}if(t){var l=0,c=0,u=e.where(t.boxes,function(t){return"left"===t.options.position}),d=e.where(t.boxes,function(t){return"right"===t.options.position}),h=e.where(t.boxes,function(t){return"top"===t.options.position}),f=e.where(t.boxes,function(t){return"bottom"===t.options.position}),p=e.where(t.boxes,function(t){return"chartArea"===t.options.position});h.sort(function(t,e){return(e.options.fullWidth?1:0)-(t.options.fullWidth?1:0)}),f.sort(function(t,e){return(t.options.fullWidth?1:0)-(e.options.fullWidth?1:0)});var g=i-2*l,m=n-2*c,k=g/2,v=m/2,w=(i-k)/(u.length+d.length),y=(n-v)/(h.length+f.length),b=g,x=m,D=[];e.each(u.concat(d,h,f),o);var C=l,S=l,M=c,Y=c;e.each(u.concat(d),a),e.each(u,function(t){C+=t.width}),e.each(d,function(t){S+=t.width}),e.each(h.concat(f),a),e.each(h,function(t){M+=t.height}),e.each(f,function(t){Y+=t.height}),e.each(u.concat(d),r),C=l,S=l,M=c,Y=c,e.each(u,function(t){C+=t.width}),e.each(d,function(t){S+=t.width}),e.each(h,function(t){M+=t.height}),e.each(f,function(t){Y+=t.height});var _=n-M-Y,T=i-C-S;(T!==b||_!==x)&&(e.each(u,function(t){t.height=_}),e.each(d,function(t){t.height=_}),e.each(h,function(t){t.options.fullWidth||(t.width=T)}),e.each(f,function(t){t.options.fullWidth||(t.width=T)}),x=_,b=T);var P=l,A=c;e.each(u.concat(h),s),P+=b,A+=x,e.each(d,s),e.each(f,s),t.chartArea={left:C,top:M,right:C+b,bottom:M+x},e.each(p,function(e){e.left=t.chartArea.left,e.top=t.chartArea.top,e.right=t.chartArea.right,e.bottom=t.chartArea.bottom,e.update(b,x)})}}}}},{}],29:[function(t,e,i){"use strict";e.exports=function(t){var e=t.helpers,i=e.noop;t.defaults.global.legend={display:!0,position:"top",fullWidth:!0,reverse:!1,onClick:function(t,e){var i=e.datasetIndex,n=this.chart,o=n.getDatasetMeta(i);o.hidden=null===o.hidden?!n.data.datasets[i].hidden:null,n.update()},onHover:null,labels:{boxWidth:40,padding:10,generateLabels:function(t){var i=t.data;return e.isArray(i.datasets)?i.datasets.map(function(i,n){return{text:i.label,fillStyle:e.isArray(i.backgroundColor)?i.backgroundColor[0]:i.backgroundColor,hidden:!t.isDatasetVisible(n),lineCap:i.borderCapStyle,lineDash:i.borderDash,lineDashOffset:i.borderDashOffset,lineJoin:i.borderJoinStyle,lineWidth:i.borderWidth,strokeStyle:i.borderColor,pointStyle:i.pointStyle,datasetIndex:n}},this):[]}}},t.Legend=t.Element.extend({initialize:function(t){e.extend(this,t),this.legendHitBoxes=[],this.doughnutMode=!1},beforeUpdate:i,update:function(t,e,i){var n=this;return n.beforeUpdate(),n.maxWidth=t,n.maxHeight=e,n.margins=i,n.beforeSetDimensions(),n.setDimensions(),n.afterSetDimensions(),n.beforeBuildLabels(),n.buildLabels(),n.afterBuildLabels(),n.beforeFit(),n.fit(),n.afterFit(),n.afterUpdate(),n.minSize},afterUpdate:i,beforeSetDimensions:i,setDimensions:function(){var t=this;t.isHorizontal()?(t.width=t.maxWidth,t.left=0,t.right=t.width):(t.height=t.maxHeight,t.top=0,t.bottom=t.height),t.paddingLeft=0,t.paddingTop=0,t.paddingRight=0,t.paddingBottom=0,t.minSize={width:0,height:0}},afterSetDimensions:i,beforeBuildLabels:i,buildLabels:function(){var t=this;t.legendItems=t.options.labels.generateLabels.call(t,t.chart),t.options.reverse&&t.legendItems.reverse()},afterBuildLabels:i,beforeFit:i,fit:function(){var i=this,n=i.options,o=n.labels,a=n.display,r=i.ctx,s=t.defaults.global,l=e.getValueOrDefault,c=l(o.fontSize,s.defaultFontSize),u=l(o.fontStyle,s.defaultFontStyle),d=l(o.fontFamily,s.defaultFontFamily),h=e.fontString(c,u,d),f=i.legendHitBoxes=[],p=i.minSize,g=i.isHorizontal();if(g?(p.width=i.maxWidth,p.height=a?10:0):(p.width=a?10:0,p.height=i.maxHeight),a)if(r.font=h,g){var m=i.lineWidths=[0],k=i.legendItems.length?c+o.padding:0;r.textAlign="left",r.textBaseline="top",e.each(i.legendItems,function(t,e){var n=o.usePointStyle?c*Math.sqrt(2):o.boxWidth,a=n+c/2+r.measureText(t.text).width;m[m.length-1]+a+o.padding>=i.width&&(k+=c+o.padding,m[m.length]=i.left),f[e]={left:0,top:0,width:a,height:c},m[m.length-1]+=a+o.padding}),p.height+=k}else{var v=o.padding,w=i.columnWidths=[],y=o.padding,b=0,x=0,D=c+v;e.each(i.legendItems,function(t,e){var i=o.usePointStyle?2*o.boxWidth:o.boxWidth,n=i+c/2+r.measureText(t.text).width;x+D>p.height&&(y+=b+o.padding,w.push(b),b=0,x=0),b=Math.max(b,n),x+=D,f[e]={left:0,top:0,width:n,height:c}}),y+=b,w.push(b),p.width+=y}i.width=p.width,i.height=p.height},afterFit:i,isHorizontal:function(){return"top"===this.options.position||"bottom"===this.options.position},draw:function(){var i=this,n=i.options,o=n.labels,a=t.defaults.global,r=a.elements.line,s=i.width,l=i.lineWidths;if(n.display){var c,u=i.ctx,d=e.getValueOrDefault,h=d(o.fontColor,a.defaultFontColor),f=d(o.fontSize,a.defaultFontSize),p=d(o.fontStyle,a.defaultFontStyle),g=d(o.fontFamily,a.defaultFontFamily),m=e.fontString(f,p,g);u.textAlign="left",u.textBaseline="top",u.lineWidth=.5,u.strokeStyle=h,u.fillStyle=h,u.font=m;var k=o.boxWidth,v=i.legendHitBoxes,w=function(e,i,o){if(!(isNaN(k)||0>=k)){u.save(),u.fillStyle=d(o.fillStyle,a.defaultColor),u.lineCap=d(o.lineCap,r.borderCapStyle),u.lineDashOffset=d(o.lineDashOffset,r.borderDashOffset),u.lineJoin=d(o.lineJoin,r.borderJoinStyle),u.lineWidth=d(o.lineWidth,r.borderWidth),u.strokeStyle=d(o.strokeStyle,a.defaultColor);var s=0===d(o.lineWidth,r.borderWidth);if(u.setLineDash&&u.setLineDash(d(o.lineDash,r.borderDash)),n.labels&&n.labels.usePointStyle){var l=f*Math.SQRT2/2,c=l/Math.SQRT2,h=e+c,p=i+c;t.canvasHelpers.drawPoint(u,o.pointStyle,l,h,p)}else s||u.strokeRect(e,i,k,f),u.fillRect(e,i,k,f);u.restore()}},y=function(t,e,i,n){u.fillText(i.text,k+f/2+t,e),i.hidden&&(u.beginPath(),u.lineWidth=2,u.moveTo(k+f/2+t,e+f/2),u.lineTo(k+f/2+t+n,e+f/2),u.stroke())},b=i.isHorizontal();c=b?{x:i.left+(s-l[0])/2,y:i.top+o.padding,line:0}:{x:i.left+o.padding,y:i.top+o.padding,line:0};var x=f+o.padding;e.each(i.legendItems,function(t,e){var n=u.measureText(t.text).width,a=o.usePointStyle?f+f/2+n:k+f/2+n,r=c.x,d=c.y;b?r+a>=s&&(d=c.y+=x,c.line++,r=c.x=i.left+(s-l[c.line])/2):d+x>i.bottom&&(r=c.x=r+i.columnWidths[c.line]+o.padding,d=c.y=i.top,c.line++),w(r,d,t),v[e].left=r,v[e].top=d,y(r,d,t,n),b?c.x+=a+o.padding:c.y+=x})}},handleEvent:function(t){var i=this,n=i.options,o="mouseup"===t.type?"click":t.type;if("mousemove"===o){if(!n.onHover)return}else{if("click"!==o)return;if(!n.onClick)return}var a=e.getRelativePosition(t,i.chart.chart),r=a.x,s=a.y;if(r>=i.left&&r<=i.right&&s>=i.top&&s<=i.bottom)for(var l=i.legendHitBoxes,c=0;c=u.left&&r<=u.left+u.width&&s>=u.top&&s<=u.top+u.height){if("click"===o){n.onClick.call(i,t,i.legendItems[c]);break}if("mousemove"===o){n.onHover.call(i,t,i.legendItems[c]);break}}}}}),t.plugins.register({beforeInit:function(e){var i=e.options,n=i.legend;n&&(e.legend=new t.Legend({ctx:e.chart.ctx,options:n,chart:e}),t.layoutService.addBox(e,e.legend))}})}},{}],30:[function(t,e,i){"use strict";e.exports=function(t){var e=t.helpers.noop;t.plugins={_plugins:[],register:function(t){var e=this._plugins;[].concat(t).forEach(function(t){-1===e.indexOf(t)&&e.push(t)})},unregister:function(t){var e=this._plugins;[].concat(t).forEach(function(t){var i=e.indexOf(t);-1!==i&&e.splice(i,1)})},clear:function(){this._plugins=[]},count:function(){return this._plugins.length},getAll:function(){return this._plugins},notify:function(t,e){var i,n,o=this._plugins,a=o.length;for(i=0;a>i;++i)if(n=o[i],"function"==typeof n[t]&&n[t].apply(n,e||[])===!1)return!1;return!0}},t.PluginBase=t.Element.extend({beforeInit:e,afterInit:e,beforeUpdate:e,afterUpdate:e,beforeDraw:e,afterDraw:e,destroy:e}),t.pluginService=t.plugins}},{}],31:[function(t,e,i){"use strict";e.exports=function(t){var e=t.helpers;t.defaults.scale={display:!0,position:"left",gridLines:{display:!0,color:"rgba(0, 0, 0, 0.1)",lineWidth:1,drawBorder:!0,drawOnChartArea:!0,drawTicks:!0,tickMarkLength:10,zeroLineWidth:1,zeroLineColor:"rgba(0,0,0,0.25)",offsetGridLines:!1,borderDash:[],borderDashOffset:0},scaleLabel:{labelString:"",display:!1},ticks:{beginAtZero:!1,minRotation:0,maxRotation:50,mirror:!1,padding:10,reverse:!1,display:!0,autoSkip:!0,autoSkipPadding:0,labelOffset:0,callback:function(t){return e.isArray(t)?t:""+t}}},t.Scale=t.Element.extend({beforeUpdate:function(){e.callCallback(this.options.beforeUpdate,[this])},update:function(t,i,n){var o=this;return o.beforeUpdate(),o.maxWidth=t,o.maxHeight=i,o.margins=e.extend({left:0,right:0,top:0,bottom:0},n),o.beforeSetDimensions(),o.setDimensions(),o.afterSetDimensions(),o.beforeDataLimits(),o.determineDataLimits(),o.afterDataLimits(),o.beforeBuildTicks(),o.buildTicks(),o.afterBuildTicks(),o.beforeTickToLabelConversion(),o.convertTicksToLabels(),o.afterTickToLabelConversion(),o.beforeCalculateTickRotation(),o.calculateTickRotation(),o.afterCalculateTickRotation(),o.beforeFit(),o.fit(),o.afterFit(),o.afterUpdate(),o.minSize},afterUpdate:function(){e.callCallback(this.options.afterUpdate,[this])},beforeSetDimensions:function(){e.callCallback(this.options.beforeSetDimensions,[this])},setDimensions:function(){var t=this;t.isHorizontal()?(t.width=t.maxWidth,t.left=0,t.right=t.width):(t.height=t.maxHeight,t.top=0,t.bottom=t.height),t.paddingLeft=0,t.paddingTop=0,t.paddingRight=0,t.paddingBottom=0},afterSetDimensions:function(){e.callCallback(this.options.afterSetDimensions,[this])},beforeDataLimits:function(){e.callCallback(this.options.beforeDataLimits,[this])},determineDataLimits:e.noop,afterDataLimits:function(){e.callCallback(this.options.afterDataLimits,[this])},beforeBuildTicks:function(){e.callCallback(this.options.beforeBuildTicks,[this])},buildTicks:e.noop,afterBuildTicks:function(){e.callCallback(this.options.afterBuildTicks,[this])},beforeTickToLabelConversion:function(){e.callCallback(this.options.beforeTickToLabelConversion,[this])},convertTicksToLabels:function(){var t=this;t.ticks=t.ticks.map(function(e,i,n){return t.options.ticks.userCallback?t.options.ticks.userCallback(e,i,n):t.options.ticks.callback(e,i,n)},t)},afterTickToLabelConversion:function(){e.callCallback(this.options.afterTickToLabelConversion,[this])},beforeCalculateTickRotation:function(){e.callCallback(this.options.beforeCalculateTickRotation,[this])},calculateTickRotation:function(){var i=this,n=i.ctx,o=t.defaults.global,a=i.options.ticks,r=e.getValueOrDefault(a.fontSize,o.defaultFontSize),s=e.getValueOrDefault(a.fontStyle,o.defaultFontStyle),l=e.getValueOrDefault(a.fontFamily,o.defaultFontFamily),c=e.fontString(r,s,l);n.font=c;var u,d=n.measureText(i.ticks[0]).width,h=n.measureText(i.ticks[i.ticks.length-1]).width;if(i.labelRotation=a.minRotation||0,i.paddingRight=0,i.paddingLeft=0,i.options.display&&i.isHorizontal()){i.paddingRight=h/2+3,i.paddingLeft=d/2+3,i.longestTextCache||(i.longestTextCache={});for(var f,p,g=e.longestText(n,c,i.ticks,i.longestTextCache),m=g,k=i.getPixelForTick(1)-i.getPixelForTick(0)-6;m>k&&i.labelRotationi.yLabelWidth&&(i.paddingLeft=u+r/2),i.paddingRight=r/2,p*g>i.maxHeight){i.labelRotation--;break}i.labelRotation++,m=f*g}}i.margins&&(i.paddingLeft=Math.max(i.paddingLeft-i.margins.left,0),i.paddingRight=Math.max(i.paddingRight-i.margins.right,0))},afterCalculateTickRotation:function(){e.callCallback(this.options.afterCalculateTickRotation,[this])},beforeFit:function(){e.callCallback(this.options.beforeFit,[this])},fit:function(){var i=this,n=i.minSize={width:0,height:0},o=i.options,a=t.defaults.global,r=o.ticks,s=o.scaleLabel,l=o.gridLines,c=o.display,u=i.isHorizontal(),d=e.getValueOrDefault(r.fontSize,a.defaultFontSize),h=e.getValueOrDefault(r.fontStyle,a.defaultFontStyle),f=e.getValueOrDefault(r.fontFamily,a.defaultFontFamily),p=e.fontString(d,h,f),g=e.getValueOrDefault(s.fontSize,a.defaultFontSize),m=o.gridLines.tickMarkLength;if(u?n.width=i.isFullWidth()?i.maxWidth-i.margins.left-i.margins.right:i.maxWidth:n.width=c&&l.drawTicks?m:0,u?n.height=c&&l.drawTicks?m:0:n.height=i.maxHeight,s.display&&c&&(u?n.height+=1.5*g:n.width+=1.5*g),r.display&&c){i.longestTextCache||(i.longestTextCache={});var k=e.longestText(i.ctx,p,i.ticks,i.longestTextCache),v=e.numberOfLabelLines(i.ticks),w=.5*d;if(u){i.longestLabelWidth=k;var y=Math.sin(e.toRadians(i.labelRotation))*i.longestLabelWidth+d*v+w*v;n.height=Math.min(i.maxHeight,n.height+y),i.ctx.font=p;var b=i.ctx.measureText(i.ticks[0]).width,x=i.ctx.measureText(i.ticks[i.ticks.length-1]).width,D=Math.cos(e.toRadians(i.labelRotation)),C=Math.sin(e.toRadians(i.labelRotation));i.paddingLeft=0!==i.labelRotation?D*b+3:b/2+3,i.paddingRight=0!==i.labelRotation?C*(d/2)+3:x/2+3}else{var S=i.maxWidth-n.width,M=r.mirror;M?k=0:k+=i.options.ticks.padding,S>k?n.width+=k:n.width=i.maxWidth,i.paddingTop=d/2,i.paddingBottom=d/2}}i.margins&&(i.paddingLeft=Math.max(i.paddingLeft-i.margins.left,0),i.paddingTop=Math.max(i.paddingTop-i.margins.top,0),i.paddingRight=Math.max(i.paddingRight-i.margins.right,0),i.paddingBottom=Math.max(i.paddingBottom-i.margins.bottom,0)),i.width=n.width,i.height=n.height},afterFit:function(){e.callCallback(this.options.afterFit,[this])},isHorizontal:function(){return"top"===this.options.position||"bottom"===this.options.position},isFullWidth:function(){return this.options.fullWidth},getRightValue:function(t){return null===t||"undefined"==typeof t?NaN:"number"==typeof t&&isNaN(t)?NaN:"object"==typeof t?t instanceof Date||t.isValid?t:this.getRightValue(this.isHorizontal()?t.x:t.y):t},getLabelForIndex:e.noop,getPixelForValue:e.noop,getValueForPixel:e.noop,getPixelForTick:function(t,e){var i=this;if(i.isHorizontal()){var n=i.width-(i.paddingLeft+i.paddingRight),o=n/Math.max(i.ticks.length-(i.options.gridLines.offsetGridLines?0:1),1),a=o*t+i.paddingLeft;e&&(a+=o/2);var r=i.left+Math.round(a);return r+=i.isFullWidth()?i.margins.left:0}var s=i.height-(i.paddingTop+i.paddingBottom);return i.top+t*(s/(i.ticks.length-1))},getPixelForDecimal:function(t){var e=this;if(e.isHorizontal()){var i=e.width-(e.paddingLeft+e.paddingRight),n=i*t+e.paddingLeft,o=e.left+Math.round(n);return o+=e.isFullWidth()?e.margins.left:0}return e.top+t*e.height},getBasePixel:function(){var t=this,e=t.min,i=t.max;return t.getPixelForValue(t.beginAtZero?0:0>e&&0>i?i:e>0&&i>0?e:0)},draw:function(i){var n=this,o=n.options;if(o.display){var a,r,s=n.ctx,l=t.defaults.global,c=o.ticks,u=o.gridLines,d=o.scaleLabel,h=0!==n.labelRotation,f=c.autoSkip,p=n.isHorizontal();c.maxTicksLimit&&(r=c.maxTicksLimit);var g=e.getValueOrDefault(c.fontColor,l.defaultFontColor),m=e.getValueOrDefault(c.fontSize,l.defaultFontSize),k=e.getValueOrDefault(c.fontStyle,l.defaultFontStyle),v=e.getValueOrDefault(c.fontFamily,l.defaultFontFamily),w=e.fontString(m,k,v),y=u.tickMarkLength,b=e.getValueOrDefault(u.borderDash,l.borderDash),x=e.getValueOrDefault(u.borderDashOffset,l.borderDashOffset),D=e.getValueOrDefault(d.fontColor,l.defaultFontColor),C=e.getValueOrDefault(d.fontSize,l.defaultFontSize),S=e.getValueOrDefault(d.fontStyle,l.defaultFontStyle),M=e.getValueOrDefault(d.fontFamily,l.defaultFontFamily),Y=e.fontString(C,S,M),_=e.toRadians(n.labelRotation),T=Math.cos(_),P=n.longestLabelWidth*T;
s.fillStyle=g;var A=[];if(p){if(a=!1,h&&(P/=2),(P+c.autoSkipPadding)*n.ticks.length>n.width-(n.paddingLeft+n.paddingRight)&&(a=1+Math.floor((P+c.autoSkipPadding)*n.ticks.length/(n.width-(n.paddingLeft+n.paddingRight)))),r&&n.ticks.length>r)for(;!a||n.ticks.length/(a||1)>r;)a||(a=1),a+=1;f||(a=!1)}var I="right"===o.position?n.left:n.right-y,O="right"===o.position?n.left+y:n.right,L="bottom"===o.position?n.top:n.bottom-y,F="bottom"===o.position?n.top+y:n.bottom;if(e.each(n.ticks,function(t,r){if(void 0!==t&&null!==t){var s=n.ticks.length===r+1,l=a>1&&r%a>0||r%a===0&&r+a>=n.ticks.length;if((!l||s)&&void 0!==t&&null!==t){var d,f;r===("undefined"!=typeof n.zeroLineIndex?n.zeroLineIndex:0)?(d=u.zeroLineWidth,f=u.zeroLineColor):(d=e.getValueAtIndexOrDefault(u.lineWidth,r),f=e.getValueAtIndexOrDefault(u.color,r));var g,m,k,v,w,D,C,S,M,Y,T="middle",P="middle";if(p){h||(P="top"===o.position?"bottom":"top"),T=h?"right":"center";var E=n.getPixelForTick(r)+e.aliasPixel(d);M=n.getPixelForTick(r,u.offsetGridLines)+c.labelOffset,Y=h?n.top+12:"top"===o.position?n.bottom-y:n.top+y,g=k=w=C=E,m=L,v=F,D=i.top,S=i.bottom}else{"left"===o.position?c.mirror?(M=n.right+c.padding,T="left"):(M=n.right-c.padding,T="right"):c.mirror?(M=n.left-c.padding,T="right"):(M=n.left+c.padding,T="left");var j=n.getPixelForTick(r);j+=e.aliasPixel(d),Y=n.getPixelForTick(r,u.offsetGridLines),g=I,k=O,w=i.left,C=i.right,m=v=D=S=j}A.push({tx1:g,ty1:m,tx2:k,ty2:v,x1:w,y1:D,x2:C,y2:S,labelX:M,labelY:Y,glWidth:d,glColor:f,glBorderDash:b,glBorderDashOffset:x,rotation:-1*_,label:t,textBaseline:P,textAlign:T})}}}),e.each(A,function(t){if(u.display&&(s.save(),s.lineWidth=t.glWidth,s.strokeStyle=t.glColor,s.setLineDash&&(s.setLineDash(t.glBorderDash),s.lineDashOffset=t.glBorderDashOffset),s.beginPath(),u.drawTicks&&(s.moveTo(t.tx1,t.ty1),s.lineTo(t.tx2,t.ty2)),u.drawOnChartArea&&(s.moveTo(t.x1,t.y1),s.lineTo(t.x2,t.y2)),s.stroke(),s.restore()),c.display){s.save(),s.translate(t.labelX,t.labelY),s.rotate(t.rotation),s.font=w,s.textBaseline=t.textBaseline,s.textAlign=t.textAlign;var i=t.label;if(e.isArray(i))for(var n=0,o=-(i.length-1)*m*.75;ne;++e){var a=t[e];if(a&&a.hasValue()){var r=a.tooltipPosition();n.push(r.x),o.push(r.y)}}var s=0,l=0;for(e=0;e0){var a=t[0];a.xLabel?i=a.xLabel:o>0&&a.indexe;++e)p.push(n(c[e]));s.itemSort&&(p=p.sort(function(t,e){return s.itemSort(t,e,u)})),c.length>1&&o.each(p,function(t){h.push(s.callbacks.labelColor.call(r,t,d))}),o.extend(l,{title:r.getTitle(p,u),beforeBody:r.getBeforeBody(p,u),body:r.getBody(p,u),afterBody:r.getAfterBody(p,u),footer:r.getFooter(p,u),x:Math.round(f.x),y:Math.round(f.y),caretPadding:o.getValueOrDefault(f.padding,2),labelColors:h});var g=r.getTooltipSize(l);r.determineAlignment(g),o.extend(l,r.getBackgroundPoint(l,g))}else r._model.opacity=0;return t&&s.custom&&s.custom.call(r,l),r},getTooltipSize:function(t){var e=this._chart.ctx,i={height:2*t.yPadding,width:0},n=t.body,a=n.reduce(function(t,e){return t+e.before.length+e.lines.length+e.after.length},0);a+=t.beforeBody.length+t.afterBody.length;var r=t.title.length,s=t.footer.length,l=t.titleFontSize,c=t.bodyFontSize,u=t.footerFontSize;i.height+=r*l,i.height+=(r-1)*t.titleSpacing,i.height+=r?t.titleMarginBottom:0,i.height+=a*c,i.height+=a?(a-1)*t.bodySpacing:0,i.height+=s?t.footerMarginTop:0,i.height+=s*u,i.height+=s?(s-1)*t.footerSpacing:0;var d=0,h=function(t){i.width=Math.max(i.width,e.measureText(t).width+d)};return e.font=o.fontString(l,t._titleFontStyle,t._titleFontFamily),o.each(t.title,h),e.font=o.fontString(c,t._bodyFontStyle,t._bodyFontFamily),o.each(t.beforeBody.concat(t.afterBody),h),d=n.length>1?c+2:0,o.each(n,function(t){o.each(t.before,h),o.each(t.lines,h),o.each(t.after,h)}),d=0,e.font=o.fontString(u,t._footerFontStyle,t._footerFontFamily),o.each(t.footer,h),i.width+=2*t.xPadding,i},determineAlignment:function(t){var e=this,i=e._model,n=e._chart,o=e._chartInstance.chartArea;i.yn.height-t.height&&(i.yAlign="bottom");var a,r,s,l,c,u=(o.left+o.right)/2,d=(o.top+o.bottom)/2;"center"===i.yAlign?(a=function(t){return u>=t},r=function(t){return t>u}):(a=function(e){return e<=t.width/2},r=function(e){return e>=n.width-t.width/2}),s=function(e){return e+t.width>n.width},l=function(e){return e-t.width<0},c=function(t){return d>=t?"top":"bottom"},a(i.x)?(i.xAlign="left",s(i.x)&&(i.xAlign="center",i.yAlign=c(i.y))):r(i.x)&&(i.xAlign="right",l(i.x)&&(i.xAlign="center",i.yAlign=c(i.y)))},getBackgroundPoint:function(t,e){var i={x:t.x,y:t.y},n=t.caretSize,o=t.caretPadding,a=t.cornerRadius,r=t.xAlign,s=t.yAlign,l=n+o,c=a+o;return"right"===r?i.x-=e.width:"center"===r&&(i.x-=e.width/2),"top"===s?i.y+=l:"bottom"===s?i.y-=e.height+l:i.y-=e.height/2,"center"===s?"left"===r?i.x+=l:"right"===r&&(i.x-=l):"left"===r?i.x-=c:"right"===r&&(i.x+=c),i},drawCaret:function(t,e,i){var n,a,r,s,l,c,u=this._view,d=this._chart.ctx,h=u.caretSize,f=u.cornerRadius,p=u.xAlign,g=u.yAlign,m=t.x,k=t.y,v=e.width,w=e.height;"center"===g?("left"===p?(n=m,a=n-h,r=n):(n=m+v,a=n+h,r=n),l=k+w/2,s=l-h,c=l+h):("left"===p?(n=m+f,a=n+h,r=a+h):"right"===p?(n=m+v-f,a=n-h,r=a-h):(a=m+v/2,n=a-h,r=a+h),"top"===g?(s=k,l=s-h,c=s):(s=k+w,l=s+h,c=s));var y=o.color(u.backgroundColor);d.fillStyle=y.alpha(i*y.alpha()).rgbString(),d.beginPath(),d.moveTo(n,s),d.lineTo(a,l),d.lineTo(r,c),d.closePath(),d.fill()},drawTitle:function(t,e,i,n){var a=e.title;if(a.length){i.textAlign=e._titleAlign,i.textBaseline="top";var r=e.titleFontSize,s=e.titleSpacing,l=o.color(e.titleFontColor);i.fillStyle=l.alpha(n*l.alpha()).rgbString(),i.font=o.fontString(r,e._titleFontStyle,e._titleFontFamily);var c,u;for(c=0,u=a.length;u>c;++c)i.fillText(a[c],t.x,t.y),t.y+=r+s,c+1===a.length&&(t.y+=e.titleMarginBottom-s)}},drawBody:function(t,e,i,n){var a=e.bodyFontSize,r=e.bodySpacing,s=e.body;i.textAlign=e._bodyAlign,i.textBaseline="top";var l=o.color(e.bodyFontColor),c=l.alpha(n*l.alpha()).rgbString();i.fillStyle=c,i.font=o.fontString(a,e._bodyFontStyle,e._bodyFontFamily);var u=0,d=function(e){i.fillText(e,t.x+u,t.y),t.y+=a+r};o.each(e.beforeBody,d);var h=s.length>1;u=h?a+2:0,o.each(s,function(r,s){o.each(r.before,d),o.each(r.lines,function(r){h&&(i.fillStyle=o.color(e.legendColorBackground).alpha(n).rgbaString(),i.fillRect(t.x,t.y,a,a),i.strokeStyle=o.color(e.labelColors[s].borderColor).alpha(n).rgbaString(),i.strokeRect(t.x,t.y,a,a),i.fillStyle=o.color(e.labelColors[s].backgroundColor).alpha(n).rgbaString(),i.fillRect(t.x+1,t.y+1,a-2,a-2),i.fillStyle=c),d(r)}),o.each(r.after,d)}),u=0,o.each(e.afterBody,d),t.y-=r},drawFooter:function(t,e,i,n){var a=e.footer;if(a.length){t.y+=e.footerMarginTop,i.textAlign=e._footerAlign,i.textBaseline="top";var r=o.color(e.footerFontColor);i.fillStyle=r.alpha(n*r.alpha()).rgbString(),i.font=o.fontString(e.footerFontSize,e._footerFontStyle,e._footerFontFamily),o.each(a,function(n){i.fillText(n,t.x,t.y),t.y+=e.footerFontSize+e.footerSpacing})}},draw:function(){var t=this._chart.ctx,e=this._view;if(0!==e.opacity){var i=this.getTooltipSize(e),n={x:e.x,y:e.y},a=Math.abs(e.opacity<.001)?0:e.opacity;if(this._options.enabled){var r=o.color(e.backgroundColor);t.fillStyle=r.alpha(a*r.alpha()).rgbString(),o.drawRoundedRectangle(t,n.x,n.y,i.width,i.height,e.cornerRadius),t.fill(),this.drawCaret(n,i,a),n.x+=e.xPadding,n.y+=e.yPadding,this.drawTitle(n,e,t,a),this.drawBody(n,e,t,a),this.drawFooter(n,e,t,a)}}}})}},{}],35:[function(t,e,i){"use strict";e.exports=function(t){var e=t.helpers,i=t.defaults.global;i.elements.arc={backgroundColor:i.defaultColor,borderColor:"#fff",borderWidth:2},t.elements.Arc=t.Element.extend({inLabelRange:function(t){var e=this._view;return!!e&&Math.pow(t-e.x,2)l;)l+=2*Math.PI;for(;a>l;)a-=2*Math.PI;for(;s>a;)a+=2*Math.PI;var c=a>=s&&l>=a,u=r>=n.innerRadius&&r<=n.outerRadius;return c&&u}return!1},tooltipPosition:function(){var t=this._view,e=t.startAngle+(t.endAngle-t.startAngle)/2,i=(t.outerRadius-t.innerRadius)/2+t.innerRadius;return{x:t.x+Math.cos(e)*i,y:t.y+Math.sin(e)*i}},draw:function(){var t=this._chart.ctx,e=this._view,i=e.startAngle,n=e.endAngle;t.beginPath(),t.arc(e.x,e.y,e.outerRadius,i,n),t.arc(e.x,e.y,e.innerRadius,n,i,!0),t.closePath(),t.strokeStyle=e.borderColor,t.lineWidth=e.borderWidth,t.fillStyle=e.backgroundColor,t.fill(),t.lineJoin="bevel",e.borderWidth&&t.stroke()}})}},{}],36:[function(t,e,i){"use strict";e.exports=function(t){var e=t.helpers,i=t.defaults.global;t.defaults.global.elements.line={tension:.4,backgroundColor:i.defaultColor,borderWidth:3,borderColor:i.defaultColor,borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",capBezierPoints:!0,fill:!0},t.elements.Line=t.Element.extend({draw:function(){function t(t,e){var i=e._view;e._view.steppedLine===!0?(l.lineTo(i.x,t._view.y),l.lineTo(i.x,i.y)):0===e._view.tension?l.lineTo(i.x,i.y):l.bezierCurveTo(t._view.controlPointNextX,t._view.controlPointNextY,i.controlPointPreviousX,i.controlPointPreviousY,i.x,i.y)}var n=this,o=n._view,a=o.spanGaps,r=o.scaleZero,s=n._loop,l=n._chart.ctx;l.save();var c=n._children.slice(),u=-1;s&&c.length&&c.push(c[0]);var d,h,f,p;if(c.length&&o.fill){for(l.beginPath(),d=0;dd;d++)e.lineTo.apply(e,t(d));e.fill(),i.borderWidth&&e.stroke()},height:function(){var t=this._view;return t.base-t.y},inRange:function(t,e){var i=this._view;return!!i&&(i.y=i.x-i.width/2&&t<=i.x+i.width/2&&e>=i.y&&e<=i.base:t>=i.x-i.width/2&&t<=i.x+i.width/2&&e>=i.base&&e<=i.y)},inLabelRange:function(t){var e=this._view;return!!e&&(t>=e.x-e.width/2&&t<=e.x+e.width/2)},tooltipPosition:function(){var t=this._view;return{x:t.x,y:t.y}}})}},{}],39:[function(t,e,i){"use strict";e.exports=function(t){var e=t.helpers,i={position:"bottom"},n=t.Scale.extend({getLabels:function(){var t=this.chart.data;return(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels},determineDataLimits:function(){var t=this,i=t.getLabels();t.minIndex=0,t.maxIndex=i.length-1;var n;void 0!==t.options.ticks.min&&(n=e.indexOf(i,t.options.ticks.min),t.minIndex=-1!==n?n:t.minIndex),void 0!==t.options.ticks.max&&(n=e.indexOf(i,t.options.ticks.max),t.maxIndex=-1!==n?n:t.maxIndex),t.min=i[t.minIndex],t.max=i[t.maxIndex]},buildTicks:function(){var t=this,e=t.getLabels();t.ticks=0===t.minIndex&&t.maxIndex===e.length-1?e:e.slice(t.minIndex,t.maxIndex+1)},getLabelForIndex:function(t,e){var i=this,n=i.chart.data,o=i.isHorizontal();return n.xLabels&&o||n.yLabels&&!o?i.getRightValue(n.datasets[e].data[t]):i.ticks[t]},getPixelForValue:function(t,e,i,n){var o=this,a=Math.max(o.maxIndex+1-o.minIndex-(o.options.gridLines.offsetGridLines?0:1),1);if(void 0!==t&&isNaN(e)){var r=o.getLabels(),s=r.indexOf(t);e=-1!==s?s:e}if(o.isHorizontal()){var l=o.width-(o.paddingLeft+o.paddingRight),c=l/a,u=c*(e-o.minIndex)+o.paddingLeft;return(o.options.gridLines.offsetGridLines&&n||o.maxIndex===o.minIndex&&n)&&(u+=c/2),o.left+Math.round(u)}var d=o.height-(o.paddingTop+o.paddingBottom),h=d/a,f=h*(e-o.minIndex)+o.paddingTop;return o.options.gridLines.offsetGridLines&&n&&(f+=h/2),o.top+Math.round(f)},getPixelForTick:function(t,e){return this.getPixelForValue(this.ticks[t],t+this.minIndex,null,e)},getValueForPixel:function(t){var e,i=this,n=Math.max(i.ticks.length-(i.options.gridLines.offsetGridLines?0:1),1),o=i.isHorizontal(),a=o?i.width-(i.paddingLeft+i.paddingRight):i.height-(i.paddingTop+i.paddingBottom),r=a/n;return t-=o?i.left:i.top,i.options.gridLines.offsetGridLines&&(t-=r/2),t-=o?i.paddingLeft:i.paddingTop,e=0>=t?0:Math.round(t/r)},getBasePixel:function(){return this.bottom}});t.scaleService.registerScaleType("category",n,i)}},{}],40:[function(t,e,i){"use strict";e.exports=function(t){var e=t.helpers,i={position:"left",ticks:{callback:function(t,i,n){var o=n.length>3?n[2]-n[1]:n[1]-n[0];Math.abs(o)>1&&t!==Math.floor(t)&&(o=t-Math.floor(t));var a=e.log10(Math.abs(o)),r="";if(0!==t){var s=-1*Math.floor(a);s=Math.max(Math.min(s,20),0),r=t.toFixed(s)}else r="0";return r}}},n=t.LinearScaleBase.extend({determineDataLimits:function(){function t(t){return s?t.xAxisID===i.id:t.yAxisID===i.id}var i=this,n=i.options,o=i.chart,a=o.data,r=a.datasets,s=i.isHorizontal();if(i.min=null,i.max=null,n.stacked){var l={};e.each(r,function(a,r){var s=o.getDatasetMeta(r);void 0===l[s.type]&&(l[s.type]={positiveValues:[],negativeValues:[]});var c=l[s.type].positiveValues,u=l[s.type].negativeValues;o.isDatasetVisible(r)&&t(s)&&e.each(a.data,function(t,e){var o=+i.getRightValue(t);isNaN(o)||s.data[e].hidden||(c[e]=c[e]||0,u[e]=u[e]||0,n.relativePoints?c[e]=100:0>o?u[e]+=o:c[e]+=o)})}),e.each(l,function(t){var n=t.positiveValues.concat(t.negativeValues),o=e.min(n),a=e.max(n);i.min=null===i.min?o:Math.min(i.min,o),i.max=null===i.max?a:Math.max(i.max,a)})}else e.each(r,function(n,a){var r=o.getDatasetMeta(a);o.isDatasetVisible(a)&&t(r)&&e.each(n.data,function(t,e){var n=+i.getRightValue(t);isNaN(n)||r.data[e].hidden||(null===i.min?i.min=n:ni.max&&(i.max=n))})});this.handleTickRangeOptions()},getTickLimit:function(){var i,n=this,o=n.options.ticks;if(n.isHorizontal())i=Math.min(o.maxTicksLimit?o.maxTicksLimit:11,Math.ceil(n.width/50));else{var a=e.getValueOrDefault(o.fontSize,t.defaults.global.defaultFontSize);i=Math.min(o.maxTicksLimit?o.maxTicksLimit:11,Math.ceil(n.height/(2*a)))}return i},handleDirectionalChanges:function(){this.isHorizontal()||this.ticks.reverse()},getLabelForIndex:function(t,e){return+this.getRightValue(this.chart.data.datasets[e].data[t])},getPixelForValue:function(t){var e,i,n=this,o=n.paddingLeft,a=n.paddingBottom,r=n.start,s=+n.getRightValue(t),l=n.end-r;return n.isHorizontal()?(i=n.width-(o+n.paddingRight),e=n.left+i/l*(s-r),Math.round(e+o)):(i=n.height-(n.paddingTop+a),e=n.bottom-a-i/l*(s-r),Math.round(e))},getValueForPixel:function(t){var e=this,i=e.isHorizontal(),n=e.paddingLeft,o=e.paddingBottom,a=i?e.width-(n+e.paddingRight):e.height-(e.paddingTop+o),r=(i?t-e.left-n:e.bottom-o-t)/a;return e.start+(e.end-e.start)*r},getPixelForTick:function(t){return this.getPixelForValue(this.ticksAsNumbers[t])}});t.scaleService.registerScaleType("linear",n,i)}},{}],41:[function(t,e,i){"use strict";e.exports=function(t){var e=t.helpers,i=e.noop;t.LinearScaleBase=t.Scale.extend({handleTickRangeOptions:function(){var t=this,i=t.options,n=i.ticks;if(n.beginAtZero){var o=e.sign(t.min),a=e.sign(t.max);0>o&&0>a?t.max=0:o>0&&a>0&&(t.min=0)}void 0!==n.min?t.min=n.min:void 0!==n.suggestedMin&&(t.min=Math.min(t.min,n.suggestedMin)),void 0!==n.max?t.max=n.max:void 0!==n.suggestedMax&&(t.max=Math.max(t.max,n.suggestedMax)),t.min===t.max&&(t.max++,n.beginAtZero||t.min--)},getTickLimit:i,handleDirectionalChanges:i,buildTicks:function(){var t=this,i=t.options,n=t.ticks=[],o=i.ticks,a=e.getValueOrDefault,r=t.getTickLimit();r=Math.max(2,r);var s,l=o.fixedStepSize&&o.fixedStepSize>0||o.stepSize&&o.stepSize>0;if(l)s=a(o.fixedStepSize,o.stepSize);else{var c=e.niceNum(t.max-t.min,!1);s=e.niceNum(c/(r-1),!0)}var u=Math.floor(t.min/s)*s,d=Math.ceil(t.max/s)*s,h=(d-u)/s;h=e.almostEquals(h,Math.round(h),s/1e3)?Math.round(h):Math.ceil(h),n.push(void 0!==o.min?o.min:u);for(var f=1;h>f;++f)n.push(u+f*s);n.push(void 0!==o.max?o.max:d),t.handleDirectionalChanges(),t.max=e.max(n),t.min=e.min(n),o.reverse?(n.reverse(),t.start=t.max,t.end=t.min):(t.start=t.min,t.end=t.max)},convertTicksToLabels:function(){var e=this;e.ticksAsNumbers=e.ticks.slice(),e.zeroLineIndex=e.ticks.indexOf(0),t.Scale.prototype.convertTicksToLabels.call(e)}})}},{}],42:[function(t,e,i){"use strict";e.exports=function(t){var e=t.helpers,i={position:"left",ticks:{callback:function(t,i,n){var o=t/Math.pow(10,Math.floor(e.log10(t)));return 0===t?"0":1===o||2===o||5===o||0===i||i===n.length-1?t.toExponential():""}}},n=t.Scale.extend({determineDataLimits:function(){function t(t){return c?t.xAxisID===i.id:t.yAxisID===i.id}var i=this,n=i.options,o=n.ticks,a=i.chart,r=a.data,s=r.datasets,l=e.getValueOrDefault,c=i.isHorizontal();if(i.min=null,i.max=null,i.minNotZero=null,n.stacked){var u={};e.each(s,function(o,r){var s=a.getDatasetMeta(r);a.isDatasetVisible(r)&&t(s)&&(void 0===u[s.type]&&(u[s.type]=[]),e.each(o.data,function(t,e){var o=u[s.type],a=+i.getRightValue(t);isNaN(a)||s.data[e].hidden||(o[e]=o[e]||0,n.relativePoints?o[e]=100:o[e]+=a)}))}),e.each(u,function(t){var n=e.min(t),o=e.max(t);i.min=null===i.min?n:Math.min(i.min,n),i.max=null===i.max?o:Math.max(i.max,o)})}else e.each(s,function(n,o){var r=a.getDatasetMeta(o);a.isDatasetVisible(o)&&t(r)&&e.each(n.data,function(t,e){var n=+i.getRightValue(t);isNaN(n)||r.data[e].hidden||(null===i.min?i.min=n:ni.max&&(i.max=n),0!==n&&(null===i.minNotZero||nt.max&&(t.max=n))})}}),t.handleTickRangeOptions()},getTickLimit:function(){var t=this.options.ticks,n=e.getValueOrDefault(t.fontSize,i.defaultFontSize);return Math.min(t.maxTicksLimit?t.maxTicksLimit:11,Math.ceil(this.drawingArea/(1.5*n)))},convertTicksToLabels:function(){var e=this;t.LinearScaleBase.prototype.convertTicksToLabels.call(e),e.pointLabels=e.chart.data.labels.map(e.options.pointLabels.callback,e)},getLabelForIndex:function(t,e){return+this.getRightValue(this.chart.data.datasets[e].data[t])},fit:function(){var t,n,o,a,r,s,l,c,u,d,h,f,p=this.options.pointLabels,g=e.getValueOrDefault(p.fontSize,i.defaultFontSize),m=e.getValueOrDefault(p.fontStyle,i.defaultFontStyle),k=e.getValueOrDefault(p.fontFamily,i.defaultFontFamily),v=e.fontString(g,m,k),w=e.min([this.height/2-g-5,this.width/2]),y=this.width,b=0;for(this.ctx.font=v,n=0;ny&&(y=t.x+a,r=n),t.x-aD?t.x+o>y&&(y=t.x+o,r=n):t.x-oe&&0>i?i:e>0&&i>0?e:0)},draw:function(){var t=this,n=t.options,o=n.gridLines,a=n.ticks,r=n.angleLines,s=n.pointLabels,l=e.getValueOrDefault;if(n.display){var c=t.ctx,u=l(a.fontSize,i.defaultFontSize),d=l(a.fontStyle,i.defaultFontStyle),h=l(a.fontFamily,i.defaultFontFamily),f=e.fontString(u,d,h);if(e.each(t.ticks,function(r,s){if(s>0||n.reverse){var d=t.getDistanceFromCenterForValue(t.ticksAsNumbers[s]),h=t.yCenter-d;if(o.display&&0!==s)if(c.strokeStyle=e.getValueAtIndexOrDefault(o.color,s-1),c.lineWidth=e.getValueAtIndexOrDefault(o.lineWidth,s-1),n.lineArc)c.beginPath(),c.arc(t.xCenter,t.yCenter,d,0,2*Math.PI),c.closePath(),c.stroke();else{c.beginPath();for(var p=0;p=0;w--){if(r.display){var y=t.getPointPosition(w,p);c.beginPath(),c.moveTo(t.xCenter,t.yCenter),c.lineTo(y.x,y.y),c.stroke(),c.closePath()}var b=t.getPointPosition(w,p+5),x=l(s.fontColor,i.defaultFontColor);c.font=v,c.fillStyle=x;var D=t.pointLabels,C=this.getIndexAngle(w)+Math.PI/2,S=360*C/(2*Math.PI)%360;0===S||180===S?c.textAlign="center":180>S?c.textAlign="left":c.textAlign="right",90===S||270===S?c.textBaseline="middle":S>270||90>S?c.textBaseline="bottom":c.textBaseline="top",c.fillText(D[w]?D[w]:"",b.x,b.y)}}}}});t.scaleService.registerScaleType("radialLinear",o,n)}},{}],44:[function(t,e,i){"use strict";var n=t(1);n="function"==typeof n?n:window.moment,e.exports=function(t){var e=t.helpers,i={units:[{name:"millisecond",steps:[1,2,5,10,20,50,100,250,500]},{name:"second",steps:[1,2,5,10,30]},{name:"minute",steps:[1,2,5,10,30]},{name:"hour",steps:[1,2,3,6,12]},{name:"day",steps:[1,2,5]},{name:"week",maxStep:4},{name:"month",maxStep:3},{name:"quarter",maxStep:4},{name:"year",maxStep:!1}]},o={position:"bottom",time:{parser:!1,format:!1,unit:!1,round:!1,displayFormat:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{millisecond:"h:mm:ss.SSS a",second:"h:mm:ss a",minute:"h:mm:ss a",hour:"MMM D, hA",day:"ll",week:"ll",month:"MMM YYYY",quarter:"[Q]Q - YYYY",year:"YYYY"}},ticks:{autoSkip:!1}},a=t.Scale.extend({initialize:function(){if(!n)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");t.Scale.prototype.initialize.call(this)},getLabelMoment:function(t,e){return null===t||null===e?null:"undefined"!=typeof this.labelMoments[t]?this.labelMoments[t][e]:null},getLabelDiff:function(t,e){var i=this;return null===t||null===e?null:(void 0===i.labelDiffs&&i.buildLabelDiffs(),"undefined"!=typeof i.labelDiffs[t]?i.labelDiffs[t][e]:null)},getMomentStartOf:function(t){var e=this;return"week"===e.options.time.unit&&e.options.time.isoWeekday!==!1?t.clone().startOf("isoWeek").isoWeekday(e.options.time.isoWeekday):t.clone().startOf(e.tickUnit)},determineDataLimits:function(){var t=this;t.labelMoments=[];var i=[];t.chart.data.labels&&t.chart.data.labels.length>0?(e.each(t.chart.data.labels,function(e){var n=t.parseTime(e);n.isValid()&&(t.options.time.round&&n.startOf(t.options.time.round),i.push(n))},t),t.firstTick=n.min.call(t,i),t.lastTick=n.max.call(t,i)):(t.firstTick=null,t.lastTick=null),e.each(t.chart.data.datasets,function(o,a){var r=[],s=t.chart.isDatasetVisible(a);"object"==typeof o.data[0]&&null!==o.data[0]?e.each(o.data,function(e){var i=t.parseTime(t.getRightValue(e));i.isValid()&&(t.options.time.round&&i.startOf(t.options.time.round),r.push(i),s&&(t.firstTick=null!==t.firstTick?n.min(t.firstTick,i):i,t.lastTick=null!==t.lastTick?n.max(t.lastTick,i):i))},t):r=i,t.labelMoments.push(r)},t),t.options.time.min&&(t.firstTick=t.parseTime(t.options.time.min)),t.options.time.max&&(t.lastTick=t.parseTime(t.options.time.max)),t.firstTick=(t.firstTick||n()).clone(),t.lastTick=(t.lastTick||n()).clone()},buildLabelDiffs:function(){var t=this;t.labelDiffs=[];var i=[];t.chart.data.labels&&t.chart.data.labels.length>0&&e.each(t.chart.data.labels,function(e){var n=t.parseTime(e);n.isValid()&&(t.options.time.round&&n.startOf(t.options.time.round),i.push(n.diff(t.firstTick,t.tickUnit,!0)))},t),e.each(t.chart.data.datasets,function(n){var o=[];"object"==typeof n.data[0]&&null!==n.data[0]?e.each(n.data,function(e){var i=t.parseTime(t.getRightValue(e));i.isValid()&&(t.options.time.round&&i.startOf(t.options.time.round),o.push(i.diff(t.firstTick,t.tickUnit,!0)))},t):o=i,t.labelDiffs.push(o)},t)},buildTicks:function(){var n=this;n.ctx.save();var o=e.getValueOrDefault(n.options.ticks.fontSize,t.defaults.global.defaultFontSize),a=e.getValueOrDefault(n.options.ticks.fontStyle,t.defaults.global.defaultFontStyle),r=e.getValueOrDefault(n.options.ticks.fontFamily,t.defaults.global.defaultFontFamily),s=e.fontString(o,a,r);if(n.ctx.font=s,n.ticks=[],n.unitScale=1,n.scaleSizeInUnits=0,n.options.time.unit)n.tickUnit=n.options.time.unit||"day",n.displayFormat=n.options.time.displayFormats[n.tickUnit],n.scaleSizeInUnits=n.lastTick.diff(n.firstTick,n.tickUnit,!0),n.unitScale=e.getValueOrDefault(n.options.time.unitStepSize,1);else{var l=n.isHorizontal()?n.width-(n.paddingLeft+n.paddingRight):n.height-(n.paddingTop+n.paddingBottom),c=n.tickFormatFunction(n.firstTick,0,[]),u=n.ctx.measureText(c).width,d=Math.cos(e.toRadians(n.options.ticks.maxRotation)),h=Math.sin(e.toRadians(n.options.ticks.maxRotation));u=u*d+o*h;var f=l/u;n.tickUnit=n.options.time.minUnit,n.scaleSizeInUnits=n.lastTick.diff(n.firstTick,n.tickUnit,!0),n.displayFormat=n.options.time.displayFormats[n.tickUnit];for(var p=0,g=i.units[p];p=Math.ceil(n.scaleSizeInUnits/f)){n.unitScale=e.getValueOrDefault(n.options.time.unitStepSize,g.steps[m]);break}break}if(g.maxStep===!1||Math.ceil(n.scaleSizeInUnits/f)b?n.lastTick=n.getMomentStartOf(n.lastTick.add(1,n.tickUnit)):b>=0&&(n.lastTick=y),n.scaleSizeInUnits=n.lastTick.diff(n.firstTick,n.tickUnit,!0)}n.options.time.displayFormat&&(n.displayFormat=n.options.time.displayFormat),n.ticks.push(n.firstTick.clone());for(var x=1;x<=n.scaleSizeInUnits;++x){var D=w.clone().add(x,n.tickUnit);if(n.options.time.max&&D.diff(n.lastTick,n.tickUnit,!0)>=0)break;x%n.unitScale===0&&n.ticks.push(D)}var C=n.ticks[n.ticks.length-1].diff(n.lastTick,n.tickUnit);(0!==C||0===n.scaleSizeInUnits)&&(n.options.time.max?(n.ticks.push(n.lastTick.clone()),n.scaleSizeInUnits=n.lastTick.diff(n.ticks[0],n.tickUnit,!0)):(n.ticks.push(n.lastTick.clone()),n.scaleSizeInUnits=n.lastTick.diff(n.firstTick,n.tickUnit,!0))),n.ctx.restore(),n.labelDiffs=void 0},getLabelForIndex:function(t,e){var i=this,n=i.chart.data.labels&&t"+$.i18n("totals")+": "+t.formatNumber(t.outputData.sum)+"\n ("+t.formatNumber(Math.round(t.outputData.average))+"/"+$.i18n("day")+")"},logarithmicCheckbox:".logarithmic-scale-option",platformSelector:"#platform_select",projectInput:"#project_input",formStates:["initial","processing","complete","invalid"],sourceInput:"#source_input",timestampFormat:"YYYYMMDD00",validateParams:["project","platform","agent","direction","sort","view"],validParams:{direction:["-1","1"],sort:["title","views","badges","lang"],view:["list","chart"]}};e.exports=n},{}],2:[function(t,e,i){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){var i=[],n=!0,o=!1,a=void 0;try{for(var r,s=t[Symbol.iterator]();!(n=(r=s.next()).done)&&(i.push(r.value),!e||i.length!==e);n=!0);}catch(t){o=!0,a=t}finally{try{!n&&s.return&&s.return()}finally{if(o)throw a}}return i}return function(e,i){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,i);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),s=function(){function t(t,e){for(var i=0;i0&&void 0!==arguments[0]&&arguments[0],e={project:$(this.config.projectInput).val(),platform:$(this.config.platformSelector).val(),agent:$(this.config.agentSelector).val()};return this.specialRange&&!t?e.range=this.specialRange.range:(e.start=this.daterangepicker.startDate.format("YYYY-MM-DD"),e.end=this.daterangepicker.endDate.format("YYYY-MM-DD")),t?e.page=$(this.config.sourceInput).val().score():(e.sort=this.sort,e.direction=this.direction,e.view=this.view,this.noLogScale&&(e.autolog="false")),e}},{key:"pushParams",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(window.history&&window.history.replaceState){if(t)return history.replaceState(null,document.title,location.href.split("?")[0]);var e=$(this.config.sourceInput).val().score().replace(/[&%?]/g,escape);window.history.replaceState({},document.title,"?"+$.param(this.getParams())+"&page="+e),$(".permalink").prop("href","/langviews?"+$.param(this.getPermaLink())+"&page="+e)}}},{key:"getBadgeMarkup",value:function(t){if(!this.config.badges[t])return"";var e=this.config.badges[t].image,i=this.config.badges[t].name;return""}},{key:"renderData",value:function(){var t=this;l(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"renderData",this).call(this,function(e){var i=Object.keys(t.outputData.badges).map(function(e){return""+t.getBadgeMarkup(e)+" × "+t.outputData.badges[e]+""}).join(", ");$(".output-totals").html(""+$.i18n("totals")+" | \n "+$.i18n("num-languages",e.length)+" | \n "+$.i18n("unique-titles",t.outputData.titles.length)+" | \n "+i+" | \n "+t.formatNumber(t.outputData.sum)+" | \n "+t.formatNumber(Math.round(t.outputData.average))+" / "+$.i18n("day")+" | "),$("#output_list").html(""),e.forEach(function(e,i){var n="";e.badges&&(n=e.badges.map(t.getBadgeMarkup.bind(t)).join()),$("#output_list").append("\n "+(i+1)+" | \n "+e.lang+' | \n '+e.label+" | \n "+n+" | \n "+t.formatNumber(e.sum)+" | \n "+t.formatNumber(Math.round(e.average))+" / "+$.i18n("day")+" | \n
")})})}},{key:"getSortProperty",value:function(t,e){switch(e){case"lang":return t.lang;case"title":return t.label;case"badges":return t.badges.sort().join("");case"views":return Number(t.sum)}}},{key:"getPageViewsData",value:function(t){var e=this,i=this.daterangepicker.startDate.startOf("day"),n=this.daterangepicker.endDate.startOf("day"),o=Object.keys(t),a=$.Deferred(),r=[],s=0,l={},c=o.length,u=[],d=[],h=function o(h){var f=t[h],p=encodeURIComponent(f.title),g="https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/"+f.lang+"."+e.baseProject+("/"+$(e.config.platformSelector).val()+"/"+$(e.config.agentSelector).val()+"/"+p+"/daily")+("/"+i.format(e.config.timestampFormat)+"/"+n.format(e.config.timestampFormat)),m=$.ajax({url:g,dataType:"json"});r.push(m),m.done(function(t){d.push({badges:f.badges,dbName:h,lang:f.lang,title:f.title,url:f.url,items:t.items})}).fail(function(t){var i="Error in Cassandra table storage backend"===t.responseJSON.title,n=e.getPageLink(f.title,f.lang+"."+e.baseProject+".org");if(i){if(l[h]?l[h]++:l[h]=1,l[h]<3)return c++,e.rateLimit(o,e.config.apiThrottle,e)(h);u.push(n)}else e.writeMessage(n+": "+$.i18n("api-error","Pageviews API")+" - "+t.responseJSON.title);404!==t.status&&(hadFailure=!0)}).always(function(){e.updateProgressBar(++s,c),s===c&&(u.length&&e.writeMessage($.i18n("api-error-timeout",""+u.map(function(t){return"- "+t+"
"}).join("")+"
")),a.resolve(d))})},f=this.rateLimit(h,this.config.apiThrottle,this);return o.forEach(function(t,e){f(t)}),a}},{key:"getInterwikiData",value:function(t,e){var i=this,n=$.Deferred(),o="https://www.wikidata.org/w/api.php?action=wbgetentities&sites="+t+("&titles="+encodeURIComponent(e)+"&props=sitelinks/urls|datatype&format=json&callback=?");return $.getJSON(o).done(function(t){if(t.error)return n.reject($.i18n("api-error","Wikidata")+": "+t.error.info);if(t.entities[-1])return n.reject(""+e.descore().escape()+" - "+$.i18n("api-error-no-data"));var o=Object.keys(t.entities)[0],a=t.entities[o].sitelinks,r={},s=new RegExp("^https://[\\w-]+\\."+i.baseProject+"\\.org");return Object.keys(a).forEach(function(t){var e=a[t].site.replace(/-/g,"_");s.test(a[t].url)&&u[e]&&(a[t].lang=u[e].replace(/\.wiki.*$/,""),r[t]=a[t])}),n.resolve(r)}),n}},{key:"getPageNameFromURL",value:function(t){return t.includes("?")?t.match(/\?(?:.*\b)?title=(.*?)(?:&|$)/)[1]:t.match(/\/wiki\/(.*?)(?:\?|$)/)[1]}},{key:"popParams",value:function(){var t=this,e=this.validateParams(this.parseQueryString("pages"));$(this.config.projectInput).val(e.project),this.validateDateRange(e),this.patchUsage(),$(".site-notice .alert-danger").length&&delete e.page,$(this.config.platformSelector).val(e.platform),$(this.config.agentSelector).val(e.agent),["sort","direction","view"].forEach(function(i){t[i]=e[i]}),this.setupSourceInput(),e.page?this.getPageInfo([e.page]).done(function(e){var i=Object.keys(e)[0];return e[i].missing?(t.setState("initial"),t.writeMessage(t.getPageLink(i)+": "+$.i18n("api-error-no-data"))):($(t.config.sourceInput).val(i),void t.processInput())}).fail(function(){t.writeMessage($.i18n("api-error-unknown","Info"))}):$(this.config.sourceInput).focus()}},{key:"setState",value:function(t){switch($("main").removeClass(this.config.formStates.join(" ")).addClass(t),t){case"initial":this.clearMessages(),this.assignDefaults(),this.destroyChart(),$("output").removeClass("list-mode").removeClass("chart-mode"),$(".data-links").addClass("invisible"),this.typeahead&&this.typeahead.hide(),$(this.config.sourceInput).val("").focus();break;case"processing":this.processStarted(),this.clearMessages(),document.activeElement.blur(),$(".progress-bar").addClass("active");break;case"complete":this.processEnded(),this.updateProgressBar(0),$(".progress-bar").removeClass("active"),$(".data-links").removeClass("invisible");break;case"invalid":}}},{key:"processInput",value:function(){var t=this,e=$(this.config.sourceInput).val();this.setState("processing");var i=function(){$(".output-title").html(t.outputData.link),$(".output-params").html($(t.config.dateRangeSelector).val()),t.setInitialChartType(),t.renderData()};if(this.isRequestCached())return $(".progress-bar").css("width","100%"),$(".progress-counter").text($.i18n("loading-cache")),setTimeout(function(){t.outputData=simpleStorage.get(t.getCacheKey()),i()},500);var n=Object.keys(u).find(function(e){return u[e]===$(t.config.projectInput).val()});$(".progress-counter").text($.i18n("fetching-data","Wikidata")),this.getInterwikiData(n,e).done(function(n){t.getPageViewsData(n).done(function(n){$(".progress-bar").css("width","100%"),$(".progress-counter").text($.i18n("building-dataset"));var o=t.getPageLink(e,t.project);setTimeout(function(){t.buildMotherDataset(e,o,n),i()},250)})}).fail(function(e){t.setState("initial"),"string"==typeof e?t.writeMessage(e):t.writeMessage($.i18n("api-error-unknown","Wikidata"))})}},{key:"setupSourceInput",value:function(){this.typeahead&&this.typeahead.destroy(),$(this.config.sourceInput).typeahead({ajax:{url:"https://"+this.project+".org/w/api.php",timeout:200,triggerLength:1,method:"get",preDispatch:function(t){return{action:"query",list:"prefixsearch",format:"json",pssearch:t}},preProcess:function(t){var e=t.query.prefixsearch.map(function(t){return t.title});return e}}})}},{key:"validateProject",value:function(){l(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"validateProject",this).call(this,!0)&&(this.setState("initial"),this.setupSourceInput())}},{key:"exportCSV",value:function(){var t=this,e="data:text/csv;charset=utf-8,Language,Title,Badges,"+this.getDateHeadings(!1).join(",")+"\n";this.outputData.listData.forEach(function(i){var n='"'+i.label.descore().replace(/"/g,'""')+'"',o='"'+i.badges.map(function(e){return t.config.badges[e].name.replace(/"/g,'""')})+'"';e+=[i.lang,n,o].concat(i.data).join(",")+"\n"}),this.downloadData(e,"csv")}},{key:"baseProject",get:function(){return this.project.split(".")[1]}},{key:"typeahead",get:function(){return $(this.config.sourceInput).data("typeahead")}}]),e}(mix(d).with(h,f));$(document).ready(function(){return document.location.hash&&!document.location.search?document.location.href=document.location.href.replace("#","?"):document.location.hash?document.location.href=document.location.href.replace(/\#.*/,""):void new p})},{"../shared/chart_helpers":3,"../shared/list_helpers":5,"../shared/pv":7,"../shared/site_map":9,"./config":1}],3:[function(t,e,i){"use strict";function n(t){if(Array.isArray(t)){for(var e=0,i=Array(t.length);e0&&void 0!==arguments[0]?arguments[0]:1;"true"===this.rememberChart?this.chartType=this.getFromLocalStorage("pageviews-chart-preference")||this.config.defaults.chartType(t):this.chartType=this.config.defaults.chartType(t)}},{key:"destroyChart",value:function(){this.chartObj&&(this.chartObj.destroy(),$(".chart-legend").html(""))}},{key:"exportCSV",value:function(){var t="data:text/csv;charset=utf-8,Date,",e=[],i=[],n=this.getDateHeadings(!1);n.forEach(function(t,e){i[e]=[t]}),this.chartObj.data.datasets.forEach(function(t){var o='"'+t.label.replace(/"/g,'""')+'"';e.push(o),n.forEach(function(e,n){i[n].push(t.data[n])})}),t=t+e.join(",")+"\n",i.forEach(function(e){t+=e.join(",")+"\n"}),this.downloadData(t,"csv")}},{key:"exportJSON",value:function(){var t=this,e=[];this.chartObj.data.datasets.forEach(function(i,n){var o={page:i.label.replace(/"/g,'"').replace(/'/g,"'"),color:i.strokeColor,sum:i.sum,daily_average:Math.round(i.sum/t.numDaysInRange())};t.getDateHeadings(!1).forEach(function(t,e){o[t.replace(/\\/,"")]=i.data[e]}),e.push(o)});var i="data:text/json;charset=utf-8,"+JSON.stringify(e);this.downloadData(i,"json")}},{key:"exportPNG",value:function(){this.downloadData(this.chartObj.toBase64Image(),"png")}},{key:"fillInZeros",value:function(t,e,i){var n=this,a={};t.items.forEach(function(t){var e=moment(t.timestamp,n.config.timestampFormat).format("YYYYMMDD");a[e]=t}),t.items=[];for(var r=moment(e);r<=i;r.add(1,"day"))if(a[r.format("YYYYMMDD")])t.items.push(a[r.format("YYYYMMDD")]);else{var s=r.isSame(this.config.maxDate)||r.isSame(moment(this.config.maxDate).subtract(1,"days"));t.items.push(o({timestamp:r.format(this.config.timestampFormat)},this.isPageviews()?"views":"devices",s?null:0))}return t}},{key:"buildChartData",value:function(t,e){var i=this,n=void 0;return n=this.isPageviews()?"views":"metaviews"===this.app?"count":"devices",t.map(function(t,o){var a=i.getDateHeadings(!1),r=new Array(a.length),s=0,l=void 0,c=0;t.forEach(function(t){var e=t[n],o=void 0;o="metaviews"===i.app?t.date:moment(t.timestamp,i.config.timestampFormat).format("YYYY-MM-DD"),r[a.indexOf(o)]=e,s+=e||0,e>c&&(c=e),(void 0===l||ee&&0>i?i:e>0&&i>0?e:0)},draw:function(){var t=this,n=t.options,o=n.gridLines,a=n.ticks,r=n.angleLines,s=n.pointLabels,l=e.getValueOrDefault;if(n.display){var c=t.ctx,u=l(a.fontSize,i.defaultFontSize),d=l(a.fontStyle,i.defaultFontStyle),h=l(a.fontFamily,i.defaultFontFamily),f=e.fontString(u,d,h);if(e.each(t.ticks,function(r,s){if(s>0||n.reverse){var d=t.getDistanceFromCenterForValue(t.ticksAsNumbers[s]),h=t.yCenter-d;if(o.display&&0!==s)if(c.strokeStyle=e.getValueAtIndexOrDefault(o.color,s-1),c.lineWidth=e.getValueAtIndexOrDefault(o.lineWidth,s-1),n.lineArc)c.beginPath(),c.arc(t.xCenter,t.yCenter,d,0,2*Math.PI),c.closePath(),c.stroke();else{c.beginPath();for(var p=0;p=0;w--){if(r.display){var y=t.getPointPosition(w,p);c.beginPath(),c.moveTo(t.xCenter,t.yCenter),c.lineTo(y.x,y.y),c.stroke(),c.closePath()}var b=t.getPointPosition(w,p+5),x=l(s.fontColor,i.defaultFontColor);c.font=v,c.fillStyle=x;var D=t.pointLabels,C=this.getIndexAngle(w)+Math.PI/2,S=360*C/(2*Math.PI)%360;0===S||180===S?c.textAlign="center":180>S?c.textAlign="left":c.textAlign="right",90===S||270===S?c.textBaseline="middle":S>270||90>S?c.textBaseline="bottom":c.textBaseline="top",c.fillText(D[w]?D[w]:"",b.x,b.y)}}}}});t.scaleService.registerScaleType("radialLinear",o,n)}},{}],44:[function(t,e,i){"use strict";var n=t(1);n="function"==typeof n?n:window.moment,e.exports=function(t){var e=t.helpers,i={units:[{name:"millisecond",steps:[1,2,5,10,20,50,100,250,500]},{name:"second",steps:[1,2,5,10,30]},{name:"minute",steps:[1,2,5,10,30]},{name:"hour",steps:[1,2,3,6,12]},{name:"day",steps:[1,2,5]},{name:"week",maxStep:4},{name:"month",maxStep:3},{name:"quarter",maxStep:4},{name:"year",maxStep:!1}]},o={position:"bottom",time:{parser:!1,format:!1,unit:!1,round:!1,displayFormat:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{millisecond:"h:mm:ss.SSS a",second:"h:mm:ss a",minute:"h:mm:ss a",hour:"MMM D, hA",day:"ll",week:"ll",month:"MMM YYYY",quarter:"[Q]Q - YYYY",year:"YYYY"}},ticks:{autoSkip:!1}},a=t.Scale.extend({initialize:function(){if(!n)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");t.Scale.prototype.initialize.call(this)},getLabelMoment:function(t,e){return null===t||null===e?null:"undefined"!=typeof this.labelMoments[t]?this.labelMoments[t][e]:null},getLabelDiff:function(t,e){var i=this;return null===t||null===e?null:(void 0===i.labelDiffs&&i.buildLabelDiffs(),"undefined"!=typeof i.labelDiffs[t]?i.labelDiffs[t][e]:null)},getMomentStartOf:function(t){var e=this;return"week"===e.options.time.unit&&e.options.time.isoWeekday!==!1?t.clone().startOf("isoWeek").isoWeekday(e.options.time.isoWeekday):t.clone().startOf(e.tickUnit)},determineDataLimits:function(){var t=this;t.labelMoments=[];var i=[];t.chart.data.labels&&t.chart.data.labels.length>0?(e.each(t.chart.data.labels,function(e){var n=t.parseTime(e);n.isValid()&&(t.options.time.round&&n.startOf(t.options.time.round),i.push(n))},t),t.firstTick=n.min.call(t,i),t.lastTick=n.max.call(t,i)):(t.firstTick=null,t.lastTick=null),e.each(t.chart.data.datasets,function(o,a){var r=[],s=t.chart.isDatasetVisible(a);"object"==typeof o.data[0]&&null!==o.data[0]?e.each(o.data,function(e){var i=t.parseTime(t.getRightValue(e));i.isValid()&&(t.options.time.round&&i.startOf(t.options.time.round),r.push(i),s&&(t.firstTick=null!==t.firstTick?n.min(t.firstTick,i):i,t.lastTick=null!==t.lastTick?n.max(t.lastTick,i):i))},t):r=i,t.labelMoments.push(r)},t),t.options.time.min&&(t.firstTick=t.parseTime(t.options.time.min)),t.options.time.max&&(t.lastTick=t.parseTime(t.options.time.max)),t.firstTick=(t.firstTick||n()).clone(),t.lastTick=(t.lastTick||n()).clone()},buildLabelDiffs:function(){var t=this;t.labelDiffs=[];var i=[];t.chart.data.labels&&t.chart.data.labels.length>0&&e.each(t.chart.data.labels,function(e){var n=t.parseTime(e);n.isValid()&&(t.options.time.round&&n.startOf(t.options.time.round),i.push(n.diff(t.firstTick,t.tickUnit,!0)))},t),e.each(t.chart.data.datasets,function(n){var o=[];"object"==typeof n.data[0]&&null!==n.data[0]?e.each(n.data,function(e){var i=t.parseTime(t.getRightValue(e));i.isValid()&&(t.options.time.round&&i.startOf(t.options.time.round),o.push(i.diff(t.firstTick,t.tickUnit,!0)))},t):o=i,t.labelDiffs.push(o)},t)},buildTicks:function(){var n=this;n.ctx.save();var o=e.getValueOrDefault(n.options.ticks.fontSize,t.defaults.global.defaultFontSize),a=e.getValueOrDefault(n.options.ticks.fontStyle,t.defaults.global.defaultFontStyle),r=e.getValueOrDefault(n.options.ticks.fontFamily,t.defaults.global.defaultFontFamily),s=e.fontString(o,a,r);if(n.ctx.font=s,n.ticks=[],n.unitScale=1,n.scaleSizeInUnits=0,n.options.time.unit)n.tickUnit=n.options.time.unit||"day",n.displayFormat=n.options.time.displayFormats[n.tickUnit],n.scaleSizeInUnits=n.lastTick.diff(n.firstTick,n.tickUnit,!0),n.unitScale=e.getValueOrDefault(n.options.time.unitStepSize,1);else{var l=n.isHorizontal()?n.width-(n.paddingLeft+n.paddingRight):n.height-(n.paddingTop+n.paddingBottom),c=n.tickFormatFunction(n.firstTick,0,[]),u=n.ctx.measureText(c).width,d=Math.cos(e.toRadians(n.options.ticks.maxRotation)),h=Math.sin(e.toRadians(n.options.ticks.maxRotation));u=u*d+o*h;var f=l/u;n.tickUnit=n.options.time.minUnit,n.scaleSizeInUnits=n.lastTick.diff(n.firstTick,n.tickUnit,!0),n.displayFormat=n.options.time.displayFormats[n.tickUnit];for(var p=0,g=i.units[p];p=Math.ceil(n.scaleSizeInUnits/f)){n.unitScale=e.getValueOrDefault(n.options.time.unitStepSize,g.steps[m]);break}break}if(g.maxStep===!1||Math.ceil(n.scaleSizeInUnits/f)b?n.lastTick=n.getMomentStartOf(n.lastTick.add(1,n.tickUnit)):b>=0&&(n.lastTick=y),n.scaleSizeInUnits=n.lastTick.diff(n.firstTick,n.tickUnit,!0)}n.options.time.displayFormat&&(n.displayFormat=n.options.time.displayFormat),n.ticks.push(n.firstTick.clone());for(var x=1;x<=n.scaleSizeInUnits;++x){var D=w.clone().add(x,n.tickUnit);if(n.options.time.max&&D.diff(n.lastTick,n.tickUnit,!0)>=0)break;x%n.unitScale===0&&n.ticks.push(D)}var C=n.ticks[n.ticks.length-1].diff(n.lastTick,n.tickUnit);(0!==C||0===n.scaleSizeInUnits)&&(n.options.time.max?(n.ticks.push(n.lastTick.clone()),n.scaleSizeInUnits=n.lastTick.diff(n.ticks[0],n.tickUnit,!0)):(n.ticks.push(n.lastTick.clone()),n.scaleSizeInUnits=n.lastTick.diff(n.firstTick,n.tickUnit,!0))),n.ctx.restore(),n.labelDiffs=void 0},getLabelForIndex:function(t,e){var i=this,n=i.chart.data.labels&&t"+$.i18n("totals")+": "+t.formatNumber(t.outputData.sum)+"\n ("+t.formatNumber(Math.round(t.outputData.average))+"/"+$.i18n("day")+")"},logarithmicCheckbox:".logarithmic-scale-option",platformSelector:"#platform_select",projectInput:"#project_input",formStates:["initial","processing","complete","invalid"],sourceInput:"#source_input",timestampFormat:"YYYYMMDD00",validateParams:["project","platform","agent","direction","sort","view"],validParams:{direction:["-1","1"],sort:["title","views","badges","lang"],view:["list","chart"]}};e.exports=n},{}],2:[function(t,e,i){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){var i=[],n=!0,o=!1,a=void 0;try{for(var r,s=t[Symbol.iterator]();!(n=(r=s.next()).done)&&(i.push(r.value),!e||i.length!==e);n=!0);}catch(t){o=!0,a=t}finally{try{!n&&s.return&&s.return()}finally{if(o)throw a}}return i}return function(e,i){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,i);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),s=function(){function t(t,e){for(var i=0;i0&&void 0!==arguments[0]&&arguments[0],e={project:$(this.config.projectInput).val(),platform:$(this.config.platformSelector).val(),agent:$(this.config.agentSelector).val()};return this.specialRange&&!t?e.range=this.specialRange.range:(e.start=this.daterangepicker.startDate.format("YYYY-MM-DD"),e.end=this.daterangepicker.endDate.format("YYYY-MM-DD")),t?e.page=$(this.config.sourceInput).val().score():(e.sort=this.sort,e.direction=this.direction,e.view=this.view,this.noLogScale&&(e.autolog="false")),e}},{key:"pushParams",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(window.history&&window.history.replaceState){if(t)return history.replaceState(null,document.title,location.href.split("?")[0]);var e=$(this.config.sourceInput).val().score().replace(/[&%?]/g,escape);window.history.replaceState({},document.title,"?"+$.param(this.getParams())+"&page="+e),$(".permalink").prop("href","/langviews?"+$.param(this.getPermaLink())+"&page="+e)}}},{key:"getBadgeMarkup",value:function(t){if(!this.config.badges[t])return"";var e=this.config.badges[t].image,i=this.config.badges[t].name;return""}},{key:"renderData",value:function(){var t=this;l(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"renderData",this).call(this,function(e){var i=Object.keys(t.outputData.badges).map(function(e){return""+t.getBadgeMarkup(e)+" × "+t.outputData.badges[e]+""}).join(", ");$(".output-totals").html(""+$.i18n("totals")+" | \n "+$.i18n("num-languages",e.length)+" | \n "+$.i18n("unique-titles",t.outputData.titles.length)+" | \n "+i+" | \n "+t.formatNumber(t.outputData.sum)+" | \n "+t.formatNumber(Math.round(t.outputData.average))+" / "+$.i18n("day")+" | "),$("#output_list").html(""),e.forEach(function(e,i){var n="";e.badges&&(n=e.badges.map(t.getBadgeMarkup.bind(t)).join()),$("#output_list").append("\n "+(i+1)+" | \n "+e.lang+' | \n '+e.label+" | \n "+n+" | \n "+t.formatNumber(e.sum)+" | \n "+t.formatNumber(Math.round(e.average))+" / "+$.i18n("day")+" | \n
")})})}},{key:"getSortProperty",value:function(t,e){switch(e){case"lang":return t.lang;case"title":return t.label;case"badges":return t.badges.sort().join("");case"views":return Number(t.sum)}}},{key:"getPageViewsData",value:function(t){var e=this,i=this.daterangepicker.startDate.startOf("day"),n=this.daterangepicker.endDate.startOf("day"),o=Object.keys(t),a=$.Deferred(),r=[],s=0,l={},c=o.length,u=[],d=[],h=function o(h){var f=t[h],p=encodeURIComponent(f.title),g="https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/"+f.lang+"."+e.baseProject+("/"+$(e.config.platformSelector).val()+"/"+$(e.config.agentSelector).val()+"/"+p+"/daily")+("/"+i.format(e.config.timestampFormat)+"/"+n.format(e.config.timestampFormat)),m=$.ajax({url:g,dataType:"json"});r.push(m),m.done(function(t){d.push({badges:f.badges,dbName:h,lang:f.lang,title:f.title,url:f.url,items:t.items})}).fail(function(t){var i="Error in Cassandra table storage backend"===t.responseJSON.title,n=e.getPageLink(f.title,f.lang+"."+e.baseProject+".org");if(i){if(l[h]?l[h]++:l[h]=1,l[h]<3)return c++,e.rateLimit(o,e.config.apiThrottle,e)(h);u.push(n)}else e.writeMessage(n+": "+$.i18n("api-error","Pageviews API")+" - "+t.responseJSON.title);404!==t.status&&(hadFailure=!0)}).always(function(){e.updateProgressBar(++s,c),s===c&&(u.length&&e.writeMessage($.i18n("api-error-timeout",""+u.map(function(t){return"- "+t+"
"}).join("")+"
")),a.resolve(d))})},f=this.rateLimit(h,this.config.apiThrottle,this);return o.forEach(function(t,e){f(t)}),a}},{key:"getInterwikiData",value:function(t,e){var i=this,n=$.Deferred(),o="https://www.wikidata.org/w/api.php?action=wbgetentities&sites="+t+("&titles="+encodeURIComponent(e)+"&props=sitelinks/urls|datatype&format=json&callback=?");return $.getJSON(o).done(function(t){if(t.error)return n.reject($.i18n("api-error","Wikidata")+": "+t.error.info);if(t.entities[-1])return n.reject(""+e.descore().escape()+" - "+$.i18n("api-error-no-data"));var o=Object.keys(t.entities)[0],a=t.entities[o].sitelinks,r={},s=new RegExp("^https://[\\w-]+\\."+i.baseProject+"\\.org");return Object.keys(a).forEach(function(t){var e=a[t].site.replace(/-/g,"_");s.test(a[t].url)&&u[e]&&(a[t].lang=u[e].replace(/\.wiki.*$/,""),r[t]=a[t])}),n.resolve(r)}),n}},{key:"getPageNameFromURL",value:function(t){return t.includes("?")?t.match(/\?(?:.*\b)?title=(.*?)(?:&|$)/)[1]:t.match(/\/wiki\/(.*?)(?:\?|$)/)[1]}},{key:"popParams",value:function(){var t=this,e=this.validateParams(this.parseQueryString("pages"));$(this.config.projectInput).val(e.project),this.validateDateRange(e),this.patchUsage(),$(".site-notice .alert-danger").length&&delete e.page,$(this.config.platformSelector).val(e.platform),$(this.config.agentSelector).val(e.agent),["sort","direction","view"].forEach(function(i){t[i]=e[i]}),this.setupSourceInput(),e.page?this.getPageInfo([e.page]).done(function(e){var i=Object.keys(e)[0];return e[i].missing?(t.setState("initial"),t.writeMessage(t.getPageLink(i)+": "+$.i18n("api-error-no-data"))):($(t.config.sourceInput).val(i),void t.processInput())}).fail(function(){t.writeMessage($.i18n("api-error-unknown","Info"))}):$(this.config.sourceInput).focus()}},{key:"setState",value:function(t){switch($("main").removeClass(this.config.formStates.join(" ")).addClass(t),t){case"initial":this.clearMessages(),this.assignDefaults(),this.destroyChart(),$("output").removeClass("list-mode").removeClass("chart-mode"),$(".data-links").addClass("invisible"),this.typeahead&&this.typeahead.hide(),$(this.config.sourceInput).val("").focus();break;case"processing":this.processStarted(),this.clearMessages(),document.activeElement.blur(),$(".progress-bar").addClass("active");break;case"complete":this.processEnded(),this.updateProgressBar(0),$(".progress-bar").removeClass("active"),$(".data-links").removeClass("invisible");break;case"invalid":}}},{key:"processInput",value:function(){var t=this,e=$(this.config.sourceInput).val();this.setState("processing");var i=function(){$(".output-title").html(t.outputData.link),$(".output-params").html($(t.config.dateRangeSelector).val()),t.setInitialChartType(),t.renderData()};if(this.isRequestCached())return $(".progress-bar").css("width","100%"),$(".progress-counter").text($.i18n("loading-cache")),setTimeout(function(){t.outputData=simpleStorage.get(t.getCacheKey()),i()},500);var n=Object.keys(u).find(function(e){return u[e]===$(t.config.projectInput).val()});$(".progress-counter").text($.i18n("fetching-data","Wikidata")),this.getInterwikiData(n,e).done(function(n){t.getPageViewsData(n).done(function(n){$(".progress-bar").css("width","100%"),$(".progress-counter").text($.i18n("building-dataset"));var o=t.getPageLink(e,t.project);setTimeout(function(){t.buildMotherDataset(e,o,n),i()},250)})}).fail(function(e){t.setState("initial"),"string"==typeof e?t.writeMessage(e):t.writeMessage($.i18n("api-error-unknown","Wikidata"))})}},{key:"setupSourceInput",value:function(){this.typeahead&&this.typeahead.destroy(),$(this.config.sourceInput).typeahead({ajax:{url:"https://"+this.project+".org/w/api.php",timeout:200,triggerLength:1,method:"get",preDispatch:function(t){return{action:"query",list:"prefixsearch",format:"json",pssearch:t}},preProcess:function(t){var e=t.query.prefixsearch.map(function(t){return t.title});return e}}})}},{key:"validateProject",value:function(){l(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"validateProject",this).call(this,!0)&&(this.setState("initial"),this.setupSourceInput())}},{key:"exportCSV",value:function(){var t=this,e="data:text/csv;charset=utf-8,Language,Title,Badges,"+this.getDateHeadings(!1).join(",")+"\n";this.outputData.listData.forEach(function(i){var n='"'+i.label.descore().replace(/"/g,'""')+'"',o='"'+i.badges.map(function(e){return t.config.badges[e].name.replace(/"/g,'""')})+'"';e+=[i.lang,n,o].concat(i.data).join(",")+"\n"}),this.downloadData(e,"csv")}},{key:"baseProject",get:function(){return this.project.split(".")[1]}},{key:"typeahead",get:function(){return $(this.config.sourceInput).data("typeahead")}}]),e}(mix(d).with(h,f));$(document).ready(function(){return document.location.hash&&!document.location.search?document.location.href=document.location.href.replace("#","?"):document.location.hash?document.location.href=document.location.href.replace(/\#.*/,""):void new p})},{"../shared/chart_helpers":3,"../shared/list_helpers":5,"../shared/pv":7,"../shared/site_map":9,"./config":1}],3:[function(t,e,i){"use strict";function n(t){if(Array.isArray(t)){for(var e=0,i=Array(t.length);e0&&void 0!==arguments[0]?arguments[0]:1;"true"===this.rememberChart?this.chartType=this.getFromLocalStorage("pageviews-chart-preference")||this.config.defaults.chartType(t):this.chartType=this.config.defaults.chartType(t)}},{key:"destroyChart",value:function(){this.chartObj&&(this.chartObj.destroy(),$(".chart-legend").html(""))}},{key:"exportCSV",value:function(){var t="data:text/csv;charset=utf-8,Date,",e=[],i=[],n=this.getDateHeadings(!1);n.forEach(function(t,e){i[e]=[t]}),this.chartObj.data.datasets.forEach(function(t){var o='"'+t.label.replace(/"/g,'""')+'"';e.push(o),n.forEach(function(e,n){i[n].push(t.data[n])})}),t=t+e.join(",")+"\n",i.forEach(function(e){t+=e.join(",")+"\n"}),this.downloadData(t,"csv")}},{key:"exportJSON",value:function(){var t=this,e=[];this.chartObj.data.datasets.forEach(function(i,n){var o={page:i.label.replace(/"/g,'"').replace(/'/g,"'"),color:i.strokeColor,sum:i.sum,daily_average:Math.round(i.sum/t.numDaysInRange())};t.getDateHeadings(!1).forEach(function(t,e){o[t.replace(/\\/,"")]=i.data[e]}),e.push(o)});var i="data:text/json;charset=utf-8,"+JSON.stringify(e);this.downloadData(i,"json")}},{key:"exportPNG",value:function(){this.downloadData(this.chartObj.toBase64Image(),"png")}},{key:"fillInZeros",value:function(t,e,i){var n=this,a={};t.items.forEach(function(t){var e=moment(t.timestamp,n.config.timestampFormat).format("YYYYMMDD");a[e]=t}),t.items=[];for(var r=moment(e);r<=i;r.add(1,"day"))if(a[r.format("YYYYMMDD")])t.items.push(a[r.format("YYYYMMDD")]);else{var s=r.isSame(this.config.maxDate)||r.isSame(moment(this.config.maxDate).subtract(1,"days"));t.items.push(o({timestamp:r.format(this.config.timestampFormat)},this.isPageviews()?"views":"devices",s?null:0))}return t}},{key:"buildChartData",value:function(t,e){var i=this,n=void 0;return n=this.isPageviews()?"views":"metaviews"===this.app?"count":"devices",t.map(function(t,o){var a=i.getDateHeadings(!1),r=new Array(a.length),s=0,l=void 0,c=0;t.forEach(function(t){var e=t[n],o=void 0;o="metaviews"===i.app?t.date:moment(t.timestamp,i.config.timestampFormat).format("YYYY-MM-DD"),r[a.indexOf(o)]=e,s+=e||0,e>c&&(c=e),(void 0===l||e"+r.map(function(t){return""+e.getPageLink(t,e.project.escape())+""}).join("")+"")))})};return t.forEach(function(t,e){return l(t,e)}),i}},{key:"getPermaLink",value:function(){var t=this.getParams(!1);return delete t.range,t}},{key:"isLogarithmic",value:function(){return $(this.config.logarithmicCheckbox).is(":checked")&&this.isLogarithmicCapable()}},{key:"isLogarithmicCapable",value:function(){return["line","bar"].includes(this.chartType)}},{key:"isPageviews",value:function(){return"pageviews"===this.app||"pageviews"===$(this.config.dataSourceSelector).val()}},{key:"isUniqueDevices",value:function(){return!this.isPageviews()}},{key:"printChart",value:function(){var t=window.open();t.document.write(''),t.print(),t.close()}},{key:"resetView",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];try{this.destroyChart(),t&&this.resetSelect2()}catch(t){}finally{this.stopSpinny(),$("body").addClass("initial"),$(this.config.chart).hide(),e&&this.clearMessages()}}},{key:"setChartPointDetectionRadius",value:function(){"line"===this.chartType&&(this.numDaysInRange()>50?Chart.defaults.global.elements.point.hitRadius=3:this.numDaysInRange()>30?Chart.defaults.global.elements.point.hitRadius=5:this.numDaysInRange()>20?Chart.defaults.global.elements.point.hitRadius=10:Chart.defaults.global.elements.point.hitRadius=30)}},{key:"shouldBeLogarithmic",value:function(t){var e;if(!this.isLogarithmicCapable()||this.noLogScale)return!1;var i=[];t.forEach(function(t){i.push(t.map(function(t){return t||0}))});var o=Math.max.apply(Math,n((e=[]).concat.apply(e,i)));if(o<=10)return!1;var a=!1;return i.forEach(function(t){t.push(o);var e=t.reduce(function(t,e){return t+e}),i=e/t.length,n=0;if(t.forEach(function(t){return n+=t?t*Math.log(t/i):0}),n/e>.5)return a=!0}),a}},{key:"setupDateRangeSelector",value:function(){var t=this;if(c(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"setupDateRangeSelector",this).call(this),this.isChartApp()){var i=$(this.config.dateRangeSelector);$(".date-latest a").on("click",function(e){var i=$(e.target).data("value");t.setSpecialRange("latest-"+i),$(".latest-text").text($.i18n("latest-days",i))}),i.on("change",function(e){t.setChartPointDetectionRadius(),t.processInput(),$(".latest-text").text($.i18n("latest")),t.specialRange&&t.specialRange.value!==e.target.value&&(t.specialRange=null)})}}},{key:"updateChart",value:function(t){var e=this;$(".chart-legend").html("");var i=t?t.entities:$(this.config.select2Input).val();if(!t||!this.showErrors(t)){if(!i.length)return this.stopSpinny();if(1===i.length?$(".multi-page-chart-node").hide():$(".multi-page-chart-node").show(),t&&(this.outputData=this.buildChartData(t.datasets,i)),"true"===this.autoLogDetection){var o=this.shouldBeLogarithmic(this.outputData.map(function(t){return t.data}));$(this.config.logarithmicCheckbox).prop("checked",o),$(".begin-at-zero").toggleClass("disabled",o)}this.outputData=this.setColorsAndLogValues(this.outputData);var a=Object.assign({scales:{}},this.config.chartConfig[this.chartType].opts,this.config.globalChartOpts);this.isLogarithmic()&&(a.scales=Object.assign({},a.scales,{yAxes:[{type:"logarithmic",ticks:{callback:function(t,i,n){var o=t/Math.pow(10,Math.floor(Chart.helpers.log10(t)));return 1===o||2===o||5===o||0===i||i===n.length-1?e.formatNumber(t):""}}}]})),this.stopSpinny();try{$(".chart-container").html("").append("