/*
 Highcharts JS v7.2.1 (2019-10-31)

 Highcharts Drilldown module

 Author: Torstein Honsi
 License: www.highcharts.com/license

*/
(function(g){"object"===typeof module&&module.exports?(g["default"]=g,module.exports=g):"function"===typeof define&&define.amd?define("highcharts/modules/drilldown",["highcharts"],function(n){g(n);g.Highcharts=n;return g}):g("undefined"!==typeof Highcharts?Highcharts:void 0)})(function(g){function n(f,g,q,n){f.hasOwnProperty(g)||(f[g]=n.apply(null,q))}g=g?g._modules:{};n(g,"modules/drilldown.src.js",[g["parts/Globals.js"],g["parts/Utilities.js"]],function(f,g){var q=g.extend,n=g.objectEach,t=g.pick,
C=g.syncTimeout,w=f.animObject,x=f.noop,y=f.color;g=f.defaultOptions;var D=f.format,p=f.Chart,r=f.seriesTypes,z=r.pie;r=r.column;var A=f.Tick,u=f.fireEvent,B=1;q(g.lang,{drillUpText:"\u25c1 Back to {series.name}"});g.drilldown={activeAxisLabelStyle:{cursor:"pointer",color:"#003399",fontWeight:"bold",textDecoration:"underline"},activeDataLabelStyle:{cursor:"pointer",color:"#003399",fontWeight:"bold",textDecoration:"underline"},animation:{duration:500},drillUpButton:{position:{align:"right",x:-10,y:10}}};
f.SVGRenderer.prototype.Element.prototype.fadeIn=function(a){this.attr({opacity:.1,visibility:"inherit"}).animate({opacity:t(this.newOpacity,1)},a||{duration:250})};p.prototype.addSeriesAsDrilldown=function(a,b){this.addSingleSeriesAsDrilldown(a,b);this.applyDrilldown()};p.prototype.addSingleSeriesAsDrilldown=function(a,b){var c=a.series,d=c.xAxis,e=c.yAxis,h=[],l=[],k;var m=this.styledMode?{colorIndex:t(a.colorIndex,c.colorIndex)}:{color:a.color||c.color};this.drilldownLevels||(this.drilldownLevels=
[]);var g=c.options._levelNumber||0;(k=this.drilldownLevels[this.drilldownLevels.length-1])&&k.levelNumber!==g&&(k=void 0);b=q(q({_ddSeriesId:B++},m),b);var n=c.points.indexOf(a);c.chart.series.forEach(function(a){a.xAxis!==d||a.isDrilling||(a.options._ddSeriesId=a.options._ddSeriesId||B++,a.options._colorIndex=a.userOptions._colorIndex,a.options._levelNumber=a.options._levelNumber||g,k?(h=k.levelSeries,l=k.levelSeriesOptions):(h.push(a),a.purgedOptions=f.merge({_ddSeriesId:a.options._ddSeriesId,
_levelNumber:a.options._levelNumber,selected:a.options.selected},a.userOptions),l.push(a.purgedOptions)))});a=q({levelNumber:g,seriesOptions:c.options,seriesPurgedOptions:c.purgedOptions,levelSeriesOptions:l,levelSeries:h,shapeArgs:a.shapeArgs,bBox:a.graphic?a.graphic.getBBox():{},color:a.isNull?(new f.Color(y)).setOpacity(0).get():y,lowerSeriesOptions:b,pointOptions:c.options.data[n],pointIndex:n,oldExtremes:{xMin:d&&d.userMin,xMax:d&&d.userMax,yMin:e&&e.userMin,yMax:e&&e.userMax},resetZoomButton:this.resetZoomButton},
m);this.drilldownLevels.push(a);d&&d.names&&(d.names.length=0);b=a.lowerSeries=this.addSeries(b,!1);b.options._levelNumber=g+1;d&&(d.oldPos=d.pos,d.userMin=d.userMax=null,e.userMin=e.userMax=null);c.type===b.type&&(b.animate=b.animateDrilldown||x,b.options.animation=!0)};p.prototype.applyDrilldown=function(){var a=this.drilldownLevels;if(a&&0<a.length){var b=a[a.length-1].levelNumber;this.drilldownLevels.forEach(function(a){a.levelNumber===b&&a.levelSeries.forEach(function(a){a.options&&a.options._levelNumber===
b&&a.remove(!1)})})}this.resetZoomButton&&(this.resetZoomButton.hide(),delete this.resetZoomButton);this.pointer.reset();this.redraw();this.showDrillUpButton();u(this,"afterDrilldown")};p.prototype.getDrilldownBackText=function(){var a=this.drilldownLevels;if(a&&0<a.length)return a=a[a.length-1],a.series=a.seriesOptions,D(this.options.lang.drillUpText,a)};p.prototype.showDrillUpButton=function(){var a=this,b=this.getDrilldownBackText(),c=a.options.drilldown.drillUpButton,d;if(this.drillUpButton)this.drillUpButton.attr({text:b}).align();
else{var e=(d=c.theme)&&d.states;this.drillUpButton=this.renderer.button(b,null,null,function(){a.drillUp()},d,e&&e.hover,e&&e.select).addClass("highcharts-drillup-button").attr({align:c.position.align,zIndex:7}).add().align(c.position,!1,c.relativeTo||"plotBox")}};p.prototype.drillUp=function(){if(this.drilldownLevels&&0!==this.drilldownLevels.length){for(var a=this,b=a.drilldownLevels,c=b[b.length-1].levelNumber,d=b.length,e=a.series,h,l,k,m,f=function(b){e.forEach(function(a){a.options._ddSeriesId===
b._ddSeriesId&&(c=a)});var c=c||a.addSeries(b,!1);c.type===k.type&&c.animateDrillupTo&&(c.animate=c.animateDrillupTo);b===l.seriesPurgedOptions&&(m=c)};d--;)if(l=b[d],l.levelNumber===c){b.pop();k=l.lowerSeries;if(!k.chart)for(h=e.length;h--;)if(e[h].options.id===l.lowerSeriesOptions.id&&e[h].options._levelNumber===c+1){k=e[h];break}k.xData=[];l.levelSeriesOptions.forEach(f);u(a,"drillup",{seriesOptions:l.seriesOptions});m.type===k.type&&(m.drilldownLevel=l,m.options.animation=a.options.drilldown.animation,
k.animateDrillupFrom&&k.chart&&k.animateDrillupFrom(l));m.options._levelNumber=c;k.remove(!1);m.xAxis&&(h=l.oldExtremes,m.xAxis.setExtremes(h.xMin,h.xMax,!1),m.yAxis.setExtremes(h.yMin,h.yMax,!1));l.resetZoomButton&&(a.resetZoomButton=l.resetZoomButton,a.resetZoomButton.show())}this.redraw();0===this.drilldownLevels.length?this.drillUpButton=this.drillUpButton.destroy():this.drillUpButton.attr({text:this.getDrilldownBackText()}).align();this.ddDupes.length=[];u(a,"drillupall")}};p.prototype.callbacks.push(function(){var a=
this;a.drilldown={update:function(b,c){f.merge(!0,a.options.drilldown,b);t(c,!0)&&a.redraw()}}});f.addEvent(p,"beforeShowResetZoom",function(){if(this.drillUpButton)return!1});f.addEvent(p,"render",function(){(this.xAxis||[]).forEach(function(a){a.ddPoints={};a.series.forEach(function(b){var c,d=b.xData||[],e=b.points;for(c=0;c<d.length;c++){var h=b.options.data[c];"number"!==typeof h&&(h=b.pointClass.prototype.optionsToObject.call({series:b},h),h.drilldown&&(a.ddPoints[d[c]]||(a.ddPoints[d[c]]=[]),
a.ddPoints[d[c]].push(e?e[c]:!0)))}});n(a.ticks,A.prototype.drillable)})});r.prototype.animateDrillupTo=function(a){if(!a){var b=this,c=b.drilldownLevel;this.points.forEach(function(a){var b=a.dataLabel;a.graphic&&a.graphic.hide();b&&(b.hidden="hidden"===b.attr("visibility"),b.hidden||(b.hide(),a.connector&&a.connector.hide()))});C(function(){b.points&&b.points.forEach(function(a,b){b=b===(c&&c.pointIndex)?"show":"fadeIn";var d="show"===b?!0:void 0,e=a.dataLabel;if(a.graphic)a.graphic[b](d);e&&!e.hidden&&
(e.fadeIn(),a.connector&&a.connector.fadeIn())})},Math.max(this.chart.options.drilldown.animation.duration-50,0));this.animate=x}};r.prototype.animateDrilldown=function(a){var b=this,c=this.chart,d=c.drilldownLevels,e,h=w(c.options.drilldown.animation),f=this.xAxis,k=c.styledMode;a||(d.forEach(function(a){b.options._ddSeriesId===a.lowerSeriesOptions._ddSeriesId&&(e=a.shapeArgs,k||(e.fill=a.color))}),e.x+=t(f.oldPos,f.pos)-f.pos,this.points.forEach(function(a){var c=a.shapeArgs;k||(c.fill=a.color);
a.graphic&&a.graphic.attr(e).animate(q(a.shapeArgs,{fill:a.color||b.color}),h);a.dataLabel&&a.dataLabel.fadeIn(h)}),this.animate=null)};r.prototype.animateDrillupFrom=function(a){var b=w(this.chart.options.drilldown.animation),c=this.group,d=c!==this.chart.columnGroup,e=this;e.trackerGroups.forEach(function(a){if(e[a])e[a].on("mouseover")});d&&delete this.group;this.points.forEach(function(h){var g=h.graphic,k=a.shapeArgs,m=function(){g.destroy();c&&d&&(c=c.destroy())};g&&(delete h.graphic,e.chart.styledMode||
(k.fill=a.color),b.duration?g.animate(k,f.merge(b,{complete:m})):(g.attr(k),m()))})};z&&q(z.prototype,{animateDrillupTo:r.prototype.animateDrillupTo,animateDrillupFrom:r.prototype.animateDrillupFrom,animateDrilldown:function(a){var b=this.chart.drilldownLevels[this.chart.drilldownLevels.length-1],c=this.chart.options.drilldown.animation,d=b.shapeArgs,e=d.start,h=(d.end-e)/this.points.length,g=this.chart.styledMode;a||(this.points.forEach(function(a,l){var k=a.shapeArgs;g||(d.fill=b.color,k.fill=a.color);
if(a.graphic)a.graphic.attr(f.merge(d,{start:e+l*h,end:e+(l+1)*h}))[c?"animate":"attr"](k,c)}),this.animate=null)}});f.Point.prototype.doDrilldown=function(a,b,c){var d=this.series.chart,e=d.options.drilldown,h=(e.series||[]).length;d.ddDupes||(d.ddDupes=[]);for(;h--&&!f;)if(e.series[h].id===this.drilldown&&-1===d.ddDupes.indexOf(this.drilldown)){var f=e.series[h];d.ddDupes.push(this.drilldown)}u(d,"drilldown",{point:this,seriesOptions:f,category:b,originalEvent:c,points:void 0!==b&&this.series.xAxis.getDDPoints(b).slice(0)},
function(b){var c=b.point.series&&b.point.series.chart,d=b.seriesOptions;c&&d&&(a?c.addSingleSeriesAsDrilldown(b.point,d):c.addSeriesAsDrilldown(b.point,d))})};f.Axis.prototype.drilldownCategory=function(a,b){n(this.getDDPoints(a),function(c){c&&c.series&&c.series.visible&&c.doDrilldown&&c.doDrilldown(!0,a,b)});this.chart.applyDrilldown()};f.Axis.prototype.getDDPoints=function(a){return this.ddPoints&&this.ddPoints[a]};A.prototype.drillable=function(){var a=this.pos,b=this.label,c=this.axis,d="xAxis"===
c.coll&&c.getDDPoints,e=d&&c.getDDPoints(a),h=c.chart.styledMode;d&&(b&&e&&e.length?(b.drillable=!0,b.basicStyles||h||(b.basicStyles=f.merge(b.styles)),b.addClass("highcharts-drilldown-axis-label").on("click",function(b){c.drilldownCategory(a,b)}),h||b.css(c.chart.options.drilldown.activeAxisLabelStyle)):b&&b.drillable&&(h||(b.styles={},b.css(b.basicStyles)),b.on("click",null),b.removeClass("highcharts-drilldown-axis-label")))};f.addEvent(f.Point,"afterInit",function(){var a=this,b=a.series;a.drilldown&&
f.addEvent(a,"click",function(c){b.xAxis&&!1===b.chart.options.drilldown.allowPointDrilldown?b.xAxis.drilldownCategory(a.x,c):a.doDrilldown(void 0,void 0,c)});return a});f.addEvent(f.Series,"afterDrawDataLabels",function(){var a=this.chart.options.drilldown.activeDataLabelStyle,b=this.chart.renderer,c=this.chart.styledMode;this.points.forEach(function(d){var e=d.options.dataLabels,f=t(d.dlOptions,e&&e.style,{});d.drilldown&&d.dataLabel&&("contrast"!==a.color||c||(f.color=b.getContrast(d.color||this.color)),
e&&e.color&&(f.color=e.color),d.dataLabel.addClass("highcharts-drilldown-data-label"),c||d.dataLabel.css(a).css(f))},this)});var v=function(a,b,c,d){a[c?"addClass":"removeClass"]("highcharts-drilldown-point");d||a.css({cursor:b})};f.addEvent(f.Series,"afterDrawTracker",function(){var a=this.chart.styledMode;this.points.forEach(function(b){b.drilldown&&b.graphic&&v(b.graphic,"pointer",!0,a)})});f.addEvent(f.Point,"afterSetState",function(){var a=this.series.chart.styledMode;this.drilldown&&this.series.halo&&
"hover"===this.state?v(this.series.halo,"pointer",!0,a):this.series.halo&&v(this.series.halo,"auto",!1,a)})});n(g,"masters/modules/drilldown.src.js",[],function(){})});
//# sourceMappingURL=drilldown.js.map