/* Highcharts JS v6.0.4 (2017-12-15) Annotations module (c) 2009-2017 Torstein Honsi License: www.highcharts.com/license */ (function(m){"object"===typeof module&&module.exports?module.exports=m:m(Highcharts)})(function(m){(function(f){var n=f.merge,m=f.addEvent,v=f.extend,l=f.each,C=f.isString,x=f.isNumber,u=f.defined,D=f.isObject,E=f.inArray,y=f.erase,F=f.find,G=f.format,p=f.pick,H=f.destroyObjectProperties,z=f.Tooltip.prototype,I=f.Series.prototype,w=f.Chart.prototype,J={arrow:{render:!1,id:"arrow",refY:5,refX:5,markerWidth:10,markerHeight:10,children:[{tagName:"path",attrs:{d:"M 0 0 L 10 5 L 0 10 Z",strokeWidth:0}}]}}, q={markerSetter:function(a){return function(b){this.attr(a,"url(#"+b+")")}}};v(q,{markerEndSetter:q.markerSetter("marker-end"),markerStartSetter:q.markerSetter("marker-start")});f.SVGRenderer.prototype.addMarker=function(a,b){a=p(a,f.uniqueKey());var c=this.createElement("marker").attr({id:a,markerWidth:p(b.markerWidth,20),markerHeight:p(b.markerHeight,20),refX:b.refX||0,refY:b.refY||0,orient:b.orient||"auto"}).add(this.defs),d={stroke:b.color||"none",fill:b.color||"rgba(0, 0, 0, 0.75)"};b=b.children; c.id=a;l(b,function(a){this.createElement(a.tagName).attr(n(d,a.attrs)).add(c)},this);return c};var A=f.MockPoint=function(a,b){this.mock=!0;this.series={visible:!0,chart:a,getPlotBox:I.getPlotBox};this.init(a,b)},K=f.mockPoint=function(a,b){return new A(a,b)};A.prototype={init:function(a,b){var c=b.xAxis,c=u(c)?a.xAxis[c]||a.get(c):null,d=b.yAxis;a=u(d)?a.yAxis[d]||a.get(d):null;c?(this.x=b.x,this.series.xAxis=c):this.plotX=b.x;a?(this.y=b.y,this.series.yAxis=a):this.plotY=b.y},translate:function(){var a= this.series,b=a.xAxis,a=a.yAxis,c;c=!0;b&&(this.plotX=c=b.toPixels(this.x,!0),c=0<=c&&c<=b.len);a&&(this.plotY=b=a.toPixels(this.y,!0),c=c&&0<=b&&b<=a.len);this.isInside=c},alignToBox:function(a){a&&this.translate();a=this.plotX;var b=this.plotY,c;this.series.chart.inverted&&(c=a,a=b,b=c);return[a,b,0,0]},getLabelConfig:function(){return{x:this.x,y:this.y,point:this}}};f.defaultOptions.annotations=[];var B=f.Annotation=function(a,b){this.chart=a;this.labels=[];this.shapes=[];this.options=n(this.defaultOptions, b);this.init(a,b)};B.prototype={shapesWithoutBackground:["connector"],attrsMap:{backgroundColor:"fill",borderColor:"stroke",borderWidth:"stroke-width",strokeWidth:"stroke-width",stroke:"stroke",fill:"fill",zIndex:"zIndex",width:"width",height:"height",borderRadius:"r",r:"r",padding:"padding",dashStyle:"dashstyle"},defaultOptions:{visible:!0,labelOptions:{align:"center",allowOverlap:!1,backgroundColor:"rgba(0, 0, 0, 0.75)",borderColor:"black",borderRadius:1,borderWidth:1,crop:!1,formatter:function(){return u(this.y)? this.y:"Annotation label"},overflow:"justify",padding:5,shadow:!1,shape:"callout",style:{fontSize:"11px",fontWeight:"normal",color:"contrast"},useHTML:!1,verticalAlign:"bottom",x:0,y:-16},shapeOptions:{stroke:"rgba(0, 0, 0, 0.75)",strokeWidth:1,fill:"rgba(0, 0, 0, 0.75)",r:0},zIndex:6},init:function(){var a=this;l(this.options.labels||[],this.initLabel,this);l(this.options.shapes||[],this.initShape,this);this.chart.labelCollectors.push(function(){var b=[];l(a.labels,function(a){a.options.allowOverlap|| b.push(a)});return b})},redraw:function(){this.group||this.render();this.redrawItems(this.shapes);this.redrawItems(this.labels)},redrawItems:function(a){for(var b=a.length;b--;)this.redrawItem(a[b])},render:function(){var a=this.chart.renderer,b=this.group=a.g("annotation").attr({zIndex:this.options.zIndex,visibility:this.options.visible?"visible":"hidden"}).add();this.shapesGroup=a.g("annotation-shapes").add(b);this.labelsGroup=a.g("annotation-labels").attr({translateX:0,translateY:0}).add(b);this.shapesGroup.clip(this.chart.plotBoxClip)}, setVisible:function(a){var b=this.options;a=p(a,!b.visible);this.group.attr({visibility:a?"visible":"hidden"});b.visible=a},destroy:function(){var a=this.chart;l(this.labels,function(a){a.destroy()});l(this.shapes,function(a){a.destroy()});H(this,a)},initShape:function(a){var b=this.chart.renderer;a=n(this.options.shapeOptions,a);var c=this.attrsFromOptions(a),d=b[a.type]?a.type:"rect",b=b[d](0,-9E9,0,0);b.points=[];b.type=d;b.options=a;b.itemType="shape";"path"===d&&v(b,{markerStartSetter:q.markerStartSetter, markerEndSetter:q.markerEndSetter,markerStart:q.markerStart,markerEnd:q.markerEnd});b.attr(c);this.shapes.push(b)},initLabel:function(a){a=n(this.options.labelOptions,a);var b=a.style,c=this.attrsFromOptions(a),d=this.chart.renderer.label("",0,-9E9,a.shape,null,null,a.useHTML,null,"annotation-label");"contrast"===b.color&&(b.color=this.chart.renderer.getContrast(-1c&&("right"===e?a.align="left":a.x=-c);c=b+h.width-g;c>d.plotWidth&&("left"===e?a.align="right":a.x=d.plotWidth-c);c=k+g;0>c&&("bottom"===f?a.verticalAlign="top":a.y=-c);c=k+h.height-g;c>d.plotHeight&&("top"===f?a.verticalAlign="bottom":a.y=d.plotHeight-c);return a},attrsFromOptions:function(a){var b= this.attrsMap,c={},d,e;for(d in a)(e=b[d])&&(c[e]=a[d]);return c}};f.extend(w,{addAnnotation:function(a,b){a=new B(this,a);this.annotations.push(a);p(b,!0)&&a.redraw();return a},removeAnnotation:function(a){var b=this.annotations,c=F(b,function(b){return b.options.id===a});c&&(y(b,c),c.destroy())},drawAnnotations:function(){var a=this.plotBoxClip,b=this.plotBox;a?a.attr(b):this.plotBoxClip=this.renderer.clipRect(b);l(this.annotations,function(a){a.redraw()})}});w.callbacks.push(function(a){a.annotations= [];l(a.options.annotations,function(b){a.addAnnotation(b,!1)});a.drawAnnotations();m(a,"redraw",a.drawAnnotations);m(a,"destroy",function(){var b=a.plotBoxClip;b&&b.destroy&&b.destroy()})});f.wrap(w,"getContainer",function(a){a.call(this);a=this.renderer;var b=this.options,c,d;b.defs=n(b.defs||{},{markers:J});b=b.defs.markers;for(c in b)d=b[c],p(d.render,!0)&&a.addMarker(d.id,d)});f.SVGRenderer.prototype.symbols.connector=function(a,b,c,d,e){var f=e&&e.anchorX;e=e&&e.anchorY;var g,h,k=c/2;x(f)&&x(e)&& (g=["M",f,e],h=b-e,0>h&&(h=-d-h),hb+d?g.push("L",a+k,b+d):ea+c&&g.push("L",a+c,b+d/2));return g||[]}})(m)});