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

 Annotations module

 (c) 2009-2019 Torstein Honsi

 License: www.highcharts.com/license
*/
(function(e){"object"===typeof module&&module.exports?(e["default"]=e,module.exports=e):"function"===typeof define&&define.amd?define("highcharts/modules/annotations",["highcharts"],function(p){e(p);e.Highcharts=p;return e}):e("undefined"!==typeof Highcharts?Highcharts:void 0)})(function(e){function p(l,m,e,n){l.hasOwnProperty(m)||(l[m]=n.apply(null,e))}e=e?e._modules:{};p(e,"annotations/eventEmitterMixin.js",[e["parts/Globals.js"],e["parts/Utilities.js"]],function(l,m){var e=m.objectEach,n=m.pick,
f=l.fireEvent;return{addEvents:function(){var c=this;e(c.options.events,function(a,b){var d=function(d){"click"===b&&c.cancelClick||a.call(c,c.chart.pointer.normalize(d),c.target)};if(-1===l.inArray(b,c.nonDOMEvents||[]))c.graphic.on(b,d);else l.addEvent(c,b,d)});c.options.draggable&&(l.addEvent(c.graphic.element,"mousedown",function(a){c.onMouseDown(a)}),l.addEvent(c,"drag",c.onDrag),c.graphic.renderer.styledMode||c.graphic.css({cursor:{x:"ew-resize",y:"ns-resize",xy:"move"}[c.options.draggable]}));
c.isUpdating||f(c,"add")},removeDocEvents:function(){this.removeDrag&&(this.removeDrag=this.removeDrag());this.removeMouseUp&&(this.removeMouseUp=this.removeMouseUp())},onMouseDown:function(c){var a=this,b=a.chart.pointer;c.preventDefault&&c.preventDefault();if(2!==c.button){c=b.normalize(c);var d=c.chartX;var h=c.chartY;a.cancelClick=!1;a.chart.hasDraggedAnnotation=!0;a.removeDrag=l.addEvent(l.doc,"mousemove",function(c){a.hasDragged=!0;c=b.normalize(c);c.prevChartX=d;c.prevChartY=h;f(a,"drag",c);
d=c.chartX;h=c.chartY});a.removeMouseUp=l.addEvent(l.doc,"mouseup",function(d){a.cancelClick=a.hasDragged;a.hasDragged=!1;a.chart.hasDraggedAnnotation=!1;f(n(a.target,a),"afterUpdate");a.onMouseUp(d)})}},onMouseUp:function(){var c=this.chart,a=this.target||this,b=c.options.annotations;c=c.annotations.indexOf(a);this.removeDocEvents();b[c]=a.options},onDrag:function(c){if(this.chart.isInsidePlot(c.chartX-this.chart.plotLeft,c.chartY-this.chart.plotTop)){var a=this.mouseMoveToTranslation(c);"x"===this.options.draggable&&
(a.y=0);"y"===this.options.draggable&&(a.x=0);this.points.length?this.translate(a.x,a.y):(this.shapes.forEach(function(b){b.translate(a.x,a.y)}),this.labels.forEach(function(b){b.translate(a.x,a.y)}));this.redraw(!1)}},mouseMoveToRadians:function(c,a,b){var d=c.prevChartY-b,h=c.prevChartX-a;b=c.chartY-b;c=c.chartX-a;this.chart.inverted&&(a=h,h=d,d=a,a=c,c=b,b=a);return Math.atan2(b,c)-Math.atan2(d,h)},mouseMoveToTranslation:function(c){var a=c.chartX-c.prevChartX;c=c.chartY-c.prevChartY;if(this.chart.inverted){var b=
c;c=a;a=b}return{x:a,y:c}},mouseMoveToScale:function(c,a,b){a=(c.chartX-a||1)/(c.prevChartX-a||1);c=(c.chartY-b||1)/(c.prevChartY-b||1);this.chart.inverted&&(b=c,c=a,a=b);return{x:a,y:c}},destroy:function(){this.removeDocEvents();l.removeEvent(this);this.hcEvents=null}}});p(e,"annotations/ControlPoint.js",[e["parts/Globals.js"],e["parts/Utilities.js"],e["annotations/eventEmitterMixin.js"]],function(l,m,e){function n(a,b,d,h){this.chart=a;this.target=b;this.options=d;this.index=c(d.index,h)}var f=
m.extend,c=m.pick;f(n.prototype,e);n.prototype.nonDOMEvents=["drag"];n.prototype.setVisibility=function(a){this.graphic.attr("visibility",a?"visible":"hidden");this.options.visible=a};n.prototype.render=function(){var a=this.chart,b=this.options;this.graphic=a.renderer.symbol(b.symbol,0,0,b.width,b.height).add(a.controlPointsGroup).css(b.style);this.setVisibility(b.visible);this.addEvents()};n.prototype.redraw=function(a){this.graphic[a?"animate":"attr"](this.options.positioner.call(this,this.target))};
n.prototype.destroy=function(){e.destroy.call(this);this.graphic&&(this.graphic=this.graphic.destroy());this.options=this.target=this.chart=null};n.prototype.update=function(a){var b=this.chart,d=this.target,h=this.index;a=l.merge(!0,this.options,a);this.destroy();this.constructor(b,d,a,h);this.render(b.controlPointsGroup);this.redraw()};return n});p(e,"annotations/MockPoint.js",[e["parts/Globals.js"],e["parts/Utilities.js"]],function(l,m){function e(f,c,a){this.series={visible:!0,chart:f,getPlotBox:l.Series.prototype.getPlotBox};
this.target=c||null;this.options=a;this.applyOptions(this.getOptions())}var n=m.defined;m=m.extend;e.fromPoint=function(f){return new e(f.series.chart,null,{x:f.x,y:f.y,xAxis:f.series.xAxis,yAxis:f.series.yAxis})};e.pointToPixels=function(f,c){var a=f.series,b=a.chart,d=f.plotX,h=f.plotY;b.inverted&&(f.mock?(d=f.plotY,h=f.plotX):(d=b.plotWidth-f.plotY,h=b.plotHeight-f.plotX));a&&!c&&(f=a.getPlotBox(),d+=f.translateX,h+=f.translateY);return{x:d,y:h}};e.pointToOptions=function(f){return{x:f.x,y:f.y,
xAxis:f.series.xAxis,yAxis:f.series.yAxis}};m(e.prototype,{mock:!0,hasDynamicOptions:function(){return"function"===typeof this.options},getOptions:function(){return this.hasDynamicOptions()?this.options(this.target):this.options},applyOptions:function(f){this.command=f.command;this.setAxis(f,"x");this.setAxis(f,"y");this.refresh()},setAxis:function(f,c){c+="Axis";f=f[c];var a=this.series.chart;this.series[c]=f instanceof l.Axis?f:n(f)?a[c][f]||a.get(f):null},toAnchor:function(){var f=[this.plotX,
this.plotY,0,0];this.series.chart.inverted&&(f[0]=this.plotY,f[1]=this.plotX);return f},getLabelConfig:function(){return{x:this.x,y:this.y,point:this}},isInsidePane:function(){var f=this.plotX,c=this.plotY,a=this.series.xAxis,b=this.series.yAxis,d=!0;a&&(d=n(f)&&0<=f&&f<=a.len);b&&(d=d&&n(c)&&0<=c&&c<=b.len);return d},refresh:function(){var f=this.series,c=f.xAxis;f=f.yAxis;var a=this.getOptions();c?(this.x=a.x,this.plotX=c.toPixels(a.x,!0)):(this.x=null,this.plotX=a.x);f?(this.y=a.y,this.plotY=f.toPixels(a.y,
!0)):(this.y=null,this.plotY=a.y);this.isInside=this.isInsidePane()},translate:function(f,c,a,b){this.hasDynamicOptions()||(this.plotX+=a,this.plotY+=b,this.refreshOptions())},scale:function(f,c,a,b){if(!this.hasDynamicOptions()){var d=this.plotY*b;this.plotX=(1-a)*f+this.plotX*a;this.plotY=(1-b)*c+d;this.refreshOptions()}},rotate:function(f,c,a){if(!this.hasDynamicOptions()){var b=Math.cos(a);a=Math.sin(a);var d=this.plotX,h=this.plotY;d-=f;h-=c;this.plotX=d*b-h*a+f;this.plotY=d*a+h*b+c;this.refreshOptions()}},
refreshOptions:function(){var f=this.series,c=f.xAxis;f=f.yAxis;this.x=this.options.x=c?this.options.x=c.toValue(this.plotX,!0):this.plotX;this.y=this.options.y=f?f.toValue(this.plotY,!0):this.plotY}});return e});p(e,"annotations/controllable/controllableMixin.js",[e["parts/Globals.js"],e["parts/Utilities.js"],e["annotations/ControlPoint.js"],e["annotations/MockPoint.js"]],function(l,e,r,n){var f=e.isObject,c=e.isString,a=e.splat;return{init:function(b,d,h){this.annotation=b;this.chart=b.chart;this.options=
d;this.points=[];this.controlPoints=[];this.index=h;this.linkPoints();this.addControlPoints()},attr:function(){this.graphic.attr.apply(this.graphic,arguments)},getPointsOptions:function(){var b=this.options;return b.points||b.point&&a(b.point)},attrsFromOptions:function(b){var d=this.constructor.attrsMap,h={},a,k=this.chart.styledMode;for(a in b){var g=d[a];!g||k&&-1!==["fill","stroke","stroke-width"].indexOf(g)||(h[g]=b[a])}return h},anchor:function(b){var d=b.series.getPlotBox();b=b.mock?b.toAnchor():
l.Tooltip.prototype.getAnchor.call({chart:b.series.chart},b);b={x:b[0]+(this.options.x||0),y:b[1]+(this.options.y||0),height:b[2]||0,width:b[3]||0};return{relativePosition:b,absolutePosition:l.merge(b,{x:b.x+d.translateX,y:b.y+d.translateY})}},point:function(b,d){if(b&&b.series)return b;d&&null!==d.series||(f(b)?d=new n(this.chart,this,b):c(b)?d=this.chart.get(b)||null:"function"===typeof b&&(d=b.call(d,this),d=d.series?d:new n(this.chart,this,b)));return d},linkPoints:function(){var b=this.getPointsOptions(),
d=this.points,h=b&&b.length||0,a;for(a=0;a<h;a++){var k=this.point(b[a],d[a]);if(!k){d.length=0;return}k.mock&&k.refresh();d[a]=k}return d},addControlPoints:function(){var b=this.options.controlPoints;(b||[]).forEach(function(d,h){d=l.merge(this.options.controlPointOptions,d);d.index||(d.index=h);b[h]=d;this.controlPoints.push(new r(this.chart,this,d))},this)},shouldBeDrawn:function(){return!!this.points.length},render:function(){this.controlPoints.forEach(function(b){b.render()})},redraw:function(b){this.controlPoints.forEach(function(d){d.redraw(b)})},
transform:function(b,d,h,a,k){if(this.chart.inverted){var g=d;d=h;h=g}this.points.forEach(function(g,c){this.transformPoint(b,d,h,a,k,c)},this)},transformPoint:function(b,d,h,a,k,g){var c=this.points[g];c.mock||(c=this.points[g]=n.fromPoint(c));c[b](d,h,a,k)},translate:function(b,d){this.transform("translate",null,null,b,d)},translatePoint:function(b,d,h){this.transformPoint("translate",null,null,b,d,h)},translateShape:function(b,d){var h=this.annotation.chart,a=this.annotation.userOptions,k=h.annotations.indexOf(this.annotation);
h=h.options.annotations[k];this.translatePoint(b,d,0);h[this.collection][this.index].point=this.options.point;a[this.collection][this.index].point=this.options.point},rotate:function(b,d,h){this.transform("rotate",b,d,h)},scale:function(b,d,h,a){this.transform("scale",b,d,h,a)},setControlPointsVisibility:function(b){this.controlPoints.forEach(function(d){d.setVisibility(b)})},destroy:function(){this.graphic&&(this.graphic=this.graphic.destroy());this.tracker&&(this.tracker=this.tracker.destroy());
this.controlPoints.forEach(function(b){b.destroy()});this.options=this.controlPoints=this.points=this.chart=null;this.annotation&&(this.annotation=null)},update:function(b){var d=this.annotation;b=l.merge(!0,this.options,b);var h=this.graphic.parentGroup;this.destroy();this.constructor(d,b);this.render(h);this.redraw()}}});p(e,"annotations/controllable/markerMixin.js",[e["parts/Globals.js"],e["parts/Utilities.js"]],function(l,e){var m=e.defined,n=e.objectEach,f=e.splat,c={arrow:{tagName:"marker",
render:!1,id:"arrow",refY:5,refX:9,markerWidth:10,markerHeight:10,children:[{tagName:"path",d:"M 0 0 L 10 5 L 0 10 Z",strokeWidth:0}]},"reverse-arrow":{tagName:"marker",render:!1,id:"reverse-arrow",refY:5,refX:1,markerWidth:10,markerHeight:10,children:[{tagName:"path",d:"M 0 5 L 10 0 L 10 10 Z",strokeWidth:0}]}};l.SVGRenderer.prototype.addMarker=function(a,b){var d={id:a},h={stroke:b.color||"none",fill:b.color||"rgba(0, 0, 0, 0.75)"};d.children=b.children.map(function(d){return l.merge(h,d)});b=this.definition(l.merge(!0,
{markerWidth:20,markerHeight:20,refX:0,refY:0,orient:"auto"},b,d));b.id=a;return b};e=function(a){return function(b){this.attr(a,"url(#"+b+")")}};e={markerEndSetter:e("marker-end"),markerStartSetter:e("marker-start"),setItemMarkers:function(a){var b=a.options,d=a.chart,h=d.options.defs,c=b.fill,k=m(c)&&"none"!==c?c:b.stroke;["markerStart","markerEnd"].forEach(function(g){var c=b[g],f;if(c){for(f in h){var e=h[f];if(c===e.id&&"marker"===e.tagName){var u=e;break}}u&&(c=a[g]=d.renderer.addMarker((b.id||
l.uniqueKey())+"-"+u.id,l.merge(u,{color:k})),a.attr(g,c.attr("id")))}})}};l.SVGRenderer.prototype.definition=function(a){function b(h,a){var k;f(h).forEach(function(g){var h=d.createElement(g.tagName),c={};n(g,function(d,h){"tagName"!==h&&"children"!==h&&"textContent"!==h&&(c[h]=d)});h.attr(c);h.add(a||d.defs);g.textContent&&h.element.appendChild(l.doc.createTextNode(g.textContent));b(g.children||[],h);k=h});return k}var d=this;return b(a)};l.addEvent(l.Chart,"afterGetContainer",function(){this.options.defs=
l.merge(c,this.options.defs||{});n(this.options.defs,function(a){"marker"===a.tagName&&!1!==a.render&&this.renderer.addMarker(a.id,a)},this)});return e});p(e,"annotations/controllable/ControllablePath.js",[e["parts/Globals.js"],e["parts/Utilities.js"],e["annotations/controllable/controllableMixin.js"],e["annotations/controllable/markerMixin.js"]],function(l,e,r,n){function f(b,d,h){this.init(b,d,h);this.collection="shapes"}var c=e.extend,a="rgba(192,192,192,"+(l.svg?.0001:.002)+")";f.attrsMap={dashStyle:"dashstyle",
strokeWidth:"stroke-width",stroke:"stroke",fill:"fill",zIndex:"zIndex"};l.merge(!0,f.prototype,r,{type:"path",setMarkers:n.setItemMarkers,toD:function(){var b=this.options.d;if(b)return"function"===typeof b?b.call(this):b;var d=this.points,h=d.length,a=h,k=d[0],g=a&&this.anchor(k).absolutePosition,c=0,f=2;for(b=g&&["M",g.x,g.y];++c<h&&a;)k=d[c],a=k.command||"L",g=this.anchor(k).absolutePosition,"Z"===a?b[++f]=a:(a!==d[c-1].command&&(b[++f]=a),b[++f]=g.x,b[++f]=g.y),a=k.series.visible;return a?this.chart.renderer.crispLine(b,
this.graphic.strokeWidth()):null},shouldBeDrawn:function(){return r.shouldBeDrawn.call(this)||!!this.options.d},render:function(b){var d=this.options,h=this.attrsFromOptions(d);this.graphic=this.annotation.chart.renderer.path(["M",0,0]).attr(h).add(b);d.className&&this.graphic.addClass(d.className);this.tracker=this.annotation.chart.renderer.path(["M",0,0]).addClass("highcharts-tracker-line").attr({zIndex:2}).add(b);this.annotation.chart.styledMode||this.tracker.attr({"stroke-linejoin":"round",stroke:a,
fill:a,"stroke-width":this.graphic.strokeWidth()+2*d.snap});r.render.call(this);c(this.graphic,{markerStartSetter:n.markerStartSetter,markerEndSetter:n.markerEndSetter});this.setMarkers(this)},redraw:function(a){var d=this.toD(),h=a?"animate":"attr";d?(this.graphic[h]({d:d}),this.tracker[h]({d:d})):(this.graphic.attr({d:"M 0 -9000000000"}),this.tracker.attr({d:"M 0 -9000000000"}));this.graphic.placed=this.tracker.placed=!!d;r.redraw.call(this,a)}});return f});p(e,"annotations/controllable/ControllableRect.js",
[e["parts/Globals.js"],e["annotations/controllable/controllableMixin.js"],e["annotations/controllable/ControllablePath.js"]],function(l,e,r){function m(f,c,a){this.init(f,c,a);this.collection="shapes"}m.attrsMap=l.merge(r.attrsMap,{width:"width",height:"height"});l.merge(!0,m.prototype,e,{type:"rect",translate:e.translateShape,render:function(f){var c=this.attrsFromOptions(this.options);this.graphic=this.annotation.chart.renderer.rect(0,-9E9,0,0).attr(c).add(f);e.render.call(this)},redraw:function(f){var c=
this.anchor(this.points[0]).absolutePosition;if(c)this.graphic[f?"animate":"attr"]({x:c.x,y:c.y,width:this.options.width,height:this.options.height});else this.attr({x:0,y:-9E9});this.graphic.placed=!!c;e.redraw.call(this,f)}});return m});p(e,"annotations/controllable/ControllableCircle.js",[e["parts/Globals.js"],e["annotations/controllable/controllableMixin.js"],e["annotations/controllable/ControllablePath.js"]],function(e,m,r){function l(f,c,a){this.init(f,c,a);this.collection="shapes"}l.attrsMap=
e.merge(r.attrsMap,{r:"r"});e.merge(!0,l.prototype,m,{type:"circle",translate:m.translateShape,render:function(f){var c=this.attrsFromOptions(this.options);this.graphic=this.annotation.chart.renderer.circle(0,-9E9,0).attr(c).add(f);m.render.call(this)},redraw:function(f){var c=this.anchor(this.points[0]).absolutePosition;if(c)this.graphic[f?"animate":"attr"]({x:c.x,y:c.y,r:this.options.r});else this.graphic.attr({x:0,y:-9E9});this.graphic.placed=!!c;m.redraw.call(this,f)},setRadius:function(f){this.options.r=
f}});return l});p(e,"annotations/controllable/ControllableLabel.js",[e["parts/Globals.js"],e["parts/Utilities.js"],e["annotations/controllable/controllableMixin.js"],e["annotations/MockPoint.js"]],function(e,m,r,n){function f(d,h,a){this.init(d,h,a);this.collection="labels"}var c=m.extend,a=m.isNumber,b=m.pick;f.shapesWithoutBackground=["connector"];f.alignedPosition=function(d,h){var a=d.align,k=d.verticalAlign,g=(h.x||0)+(d.x||0),b=(h.y||0)+(d.y||0),c,f;"right"===a?c=1:"center"===a&&(c=2);c&&(g+=
(h.width-(d.width||0))/c);"bottom"===k?f=1:"middle"===k&&(f=2);f&&(b+=(h.height-(d.height||0))/f);return{x:Math.round(g),y:Math.round(b)}};f.justifiedOptions=function(d,a,b,k){var g=b.align,c=b.verticalAlign,h=a.box?0:a.padding||0,f=a.getBBox();a={align:g,verticalAlign:c,x:b.x,y:b.y,width:a.width,height:a.height};b=k.x-d.plotLeft;var u=k.y-d.plotTop;k=b+h;0>k&&("right"===g?a.align="left":a.x=-k);k=b+f.width-h;k>d.plotWidth&&("left"===g?a.align="right":a.x=d.plotWidth-k);k=u+h;0>k&&("bottom"===c?a.verticalAlign=
"top":a.y=-k);k=u+f.height-h;k>d.plotHeight&&("top"===c?a.verticalAlign="bottom":a.y=d.plotHeight-k);return a};f.attrsMap={backgroundColor:"fill",borderColor:"stroke",borderWidth:"stroke-width",zIndex:"zIndex",borderRadius:"r",padding:"padding"};e.merge(!0,f.prototype,r,{translatePoint:function(a,b){r.translatePoint.call(this,a,b,0)},translate:function(a,b){var d=this.annotation.chart,c=this.annotation.userOptions,g=d.annotations.indexOf(this.annotation);g=d.options.annotations[g];d.inverted&&(d=
a,a=b,b=d);this.options.x+=a;this.options.y+=b;g[this.collection][this.index].x=this.options.x;g[this.collection][this.index].y=this.options.y;c[this.collection][this.index].x=this.options.x;c[this.collection][this.index].y=this.options.y},render:function(a){var b=this.options,d=this.attrsFromOptions(b),c=b.style;this.graphic=this.annotation.chart.renderer.label("",0,-9999,b.shape,null,null,b.useHTML,null,"annotation-label").attr(d).add(a);this.annotation.chart.styledMode||("contrast"===c.color&&
(c.color=this.annotation.chart.renderer.getContrast(-1<f.shapesWithoutBackground.indexOf(b.shape)?"#FFFFFF":b.backgroundColor)),this.graphic.css(b.style).shadow(b.shadow));b.className&&this.graphic.addClass(b.className);this.graphic.labelrank=b.labelrank;r.render.call(this)},redraw:function(a){var b=this.options,c=this.text||b.format||b.text,d=this.graphic,g=this.points[0];d.attr({text:c?e.format(c,g.getLabelConfig(),this.annotation.chart.time):b.formatter.call(g,this)});b=this.anchor(g);(c=this.position(b))?
(d.alignAttr=c,c.anchorX=b.absolutePosition.x,c.anchorY=b.absolutePosition.y,d[a?"animate":"attr"](c)):d.attr({x:0,y:-9999});d.placed=!!c;r.redraw.call(this,a)},anchor:function(){var a=r.anchor.apply(this,arguments),b=this.options.x||0,c=this.options.y||0;a.absolutePosition.x-=b;a.absolutePosition.y-=c;a.relativePosition.x-=b;a.relativePosition.y-=c;return a},position:function(a){var d=this.graphic,l=this.annotation.chart,k=this.points[0],g=this.options,q=a.absolutePosition,m=a.relativePosition;if(a=
k.series.visible&&n.prototype.isInsidePane.call(k)){if(g.distance)var t=e.Tooltip.prototype.getPosition.call({chart:l,distance:b(g.distance,16)},d.width,d.height,{plotX:m.x,plotY:m.y,negative:k.negative,ttBelow:k.ttBelow,h:m.height||m.width});else g.positioner?t=g.positioner.call(this):(k={x:q.x,y:q.y,width:0,height:0},t=f.alignedPosition(c(g,{width:d.width,height:d.height}),k),"justify"===this.options.overflow&&(t=f.alignedPosition(f.justifiedOptions(l,d,g,t),k)));g.crop&&(g=t.x-l.plotLeft,k=t.y-
l.plotTop,a=l.isInsidePlot(g,k)&&l.isInsidePlot(g+d.width,k+d.height))}return a?t:null}});e.SVGRenderer.prototype.symbols.connector=function(b,c,f,k,g){var d=g&&g.anchorX;g=g&&g.anchorY;var h=f/2;if(a(d)&&a(g)){var e=["M",d,g];var u=c-g;0>u&&(u=-k-u);u<f&&(h=d<b+f/2?u:f-u);g>c+k?e.push("L",b+h,c+k):g<c?e.push("L",b+h,c):d<b?e.push("L",b,c+k/2):d>b+f&&e.push("L",b+f,c+k/2)}return e||[]};return f});p(e,"annotations/controllable/ControllableImage.js",[e["parts/Globals.js"],e["annotations/controllable/controllableMixin.js"],
e["annotations/controllable/ControllableLabel.js"]],function(e,m,r){function l(f,c,a){this.init(f,c,a);this.collection="shapes"}l.attrsMap={width:"width",height:"height",zIndex:"zIndex"};e.merge(!0,l.prototype,m,{type:"image",translate:m.translateShape,render:function(f){var c=this.attrsFromOptions(this.options),a=this.options;this.graphic=this.annotation.chart.renderer.image(a.src,0,-9E9,a.width,a.height).attr(c).add(f);this.graphic.width=a.width;this.graphic.height=a.height;m.render.call(this)},
redraw:function(f){var c=this.anchor(this.points[0]);if(c=r.prototype.position.call(this,c))this.graphic[f?"animate":"attr"]({x:c.x,y:c.y});else this.graphic.attr({x:0,y:-9E9});this.graphic.placed=!!c;m.redraw.call(this,f)}});return l});p(e,"annotations/annotations.src.js",[e["parts/Globals.js"],e["parts/Utilities.js"],e["annotations/controllable/controllableMixin.js"],e["annotations/controllable/ControllableRect.js"],e["annotations/controllable/ControllableCircle.js"],e["annotations/controllable/ControllablePath.js"],
e["annotations/controllable/ControllableImage.js"],e["annotations/controllable/ControllableLabel.js"],e["annotations/eventEmitterMixin.js"],e["annotations/MockPoint.js"],e["annotations/ControlPoint.js"]],function(e,m,r,n,f,c,a,b,d,h,p){var k=m.defined,g=m.destroyObjectProperties,l=m.erase,v=m.extend,t=m.pick,u=m.splat,w=e.merge,x=e.addEvent,z=e.fireEvent,A=e.find,B=e.reduce;m=e.Chart.prototype;var y=e.Annotation=function(a,b){this.chart=a;this.points=[];this.controlPoints=[];this.coll="annotations";
this.labels=[];this.shapes=[];this.options=w(this.defaultOptions,b);this.userOptions=b;b=this.getLabelsAndShapesOptions(this.options,b);this.options.labels=b.labels;this.options.shapes=b.shapes;this.init(a,this.options)};w(!0,y.prototype,r,d,{nonDOMEvents:["add","afterUpdate","drag","remove"],defaultOptions:{visible:!0,draggable:"xy",labelOptions:{align:"center",allowOverlap:!1,backgroundColor:"rgba(0, 0, 0, 0.75)",borderColor:"black",borderRadius:3,borderWidth:1,className:"",crop:!1,formatter:function(){return k(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,snap:2},controlPointOptions:{symbol:"circle",width:10,height:10,style:{stroke:"black","stroke-width":2,fill:"white"},visible:!1,events:{}},events:{},zIndex:6},init:function(){this.linkPoints();this.addControlPoints();this.addShapes();
this.addLabels();this.addClipPaths();this.setLabelCollector()},getLabelsAndShapesOptions:function(a,b){var c={};["labels","shapes"].forEach(function(d){a[d]&&(c[d]=u(b[d]).map(function(b,c){return w(a[d][c],b)}))});return c},addShapes:function(){(this.options.shapes||[]).forEach(function(a,b){a=this.initShape(a,b);w(!0,this.options.shapes[b],a.options)},this)},addLabels:function(){(this.options.labels||[]).forEach(function(a,b){a=this.initLabel(a,b);w(!0,this.options.labels[b],a.options)},this)},
addClipPaths:function(){this.setClipAxes();this.clipXAxis&&this.clipYAxis&&(this.clipRect=this.chart.renderer.clipRect(this.getClipBox()))},setClipAxes:function(){var a=this.chart.xAxis,b=this.chart.yAxis,c=B((this.options.labels||[]).concat(this.options.shapes||[]),function(c,d){return[a[d&&d.point&&d.point.xAxis]||c[0],b[d&&d.point&&d.point.yAxis]||c[1]]},[]);this.clipXAxis=c[0];this.clipYAxis=c[1]},getClipBox:function(){return{x:this.clipXAxis.left,y:this.clipYAxis.top,width:this.clipXAxis.width,
height:this.clipYAxis.height}},setLabelCollector:function(){var a=this;a.labelCollector=function(){return a.labels.reduce(function(a,b){b.options.allowOverlap||a.push(b.graphic);return a},[])};a.chart.labelCollectors.push(a.labelCollector)},setOptions:function(a){this.options=w(this.defaultOptions,a)},redraw:function(a){this.linkPoints();this.graphic||this.render();this.clipRect&&this.clipRect.animate(this.getClipBox());this.redrawItems(this.shapes,a);this.redrawItems(this.labels,a);r.redraw.call(this,
a)},redrawItems:function(a,b){for(var c=a.length;c--;)this.redrawItem(a[c],b)},render:function(){var a=this.chart.renderer;this.graphic=a.g("annotation").attr({zIndex:this.options.zIndex,visibility:this.options.visible?"visible":"hidden"}).add();this.shapesGroup=a.g("annotation-shapes").add(this.graphic).clip(this.chart.plotBoxClip);this.labelsGroup=a.g("annotation-labels").attr({translateX:0,translateY:0}).add(this.graphic);this.clipRect&&this.graphic.clip(this.clipRect);this.addEvents();r.render.call(this)},
setVisibility:function(a){var b=this.options;a=t(a,!b.visible);this.graphic.attr("visibility",a?"visible":"hidden");a||this.setControlPointsVisibility(!1);b.visible=a},setControlPointsVisibility:function(a){var b=function(b){b.setControlPointsVisibility(a)};r.setControlPointsVisibility.call(this,a);this.shapes.forEach(b);this.labels.forEach(b)},destroy:function(){var a=this.chart,b=function(a){a.destroy()};this.labels.forEach(b);this.shapes.forEach(b);this.clipYAxis=this.clipXAxis=null;l(a.labelCollectors,
this.labelCollector);d.destroy.call(this);r.destroy.call(this);g(this,a)},remove:function(){return this.chart.removeAnnotation(this)},update:function(a){var b=this.chart,c=this.getLabelsAndShapesOptions(this.userOptions,a),d=b.annotations.indexOf(this);a=e.merge(!0,this.userOptions,a);a.labels=c.labels;a.shapes=c.shapes;this.destroy();this.constructor(b,a);b.options.annotations[d]=a;this.isUpdating=!0;this.redraw();this.isUpdating=!1;z(this,"afterUpdate")},initShape:function(a,b){a=w(this.options.shapeOptions,
{controlPointOptions:this.options.controlPointOptions},a);b=new y.shapesMap[a.type](this,a,b);b.itemType="shape";this.shapes.push(b);return b},initLabel:function(a,c){a=w(this.options.labelOptions,{controlPointOptions:this.options.controlPointOptions},a);c=new b(this,a,c);c.itemType="label";this.labels.push(c);return c},redrawItem:function(a,b){a.linkPoints();a.shouldBeDrawn()?(a.graphic||this.renderItem(a),a.redraw(t(b,!0)&&a.graphic.placed),a.points.length&&this.adjustVisibility(a)):this.destroyItem(a)},
adjustVisibility:function(a){var b=!1,c=a.graphic;a.points.forEach(function(a){!1!==a.series.visible&&!1!==a.visible&&(b=!0)});b?"hidden"===c.visibility&&c.show():c.hide()},destroyItem:function(a){l(this[a.itemType+"s"],a);a.destroy()},renderItem:function(a){a.render("label"===a.itemType?this.labelsGroup:this.shapesGroup)}});y.shapesMap={rect:n,circle:f,path:c,image:a};y.types={};y.MockPoint=h;y.ControlPoint=p;e.extendAnnotation=function(a,b,c,d){b=b||y;w(!0,a.prototype,b.prototype,c);a.prototype.defaultOptions=
w(a.prototype.defaultOptions,d||{})};v(m,{initAnnotation:function(a){a=new (y.types[a.type]||y)(this,a);this.annotations.push(a);return a},addAnnotation:function(a,b){a=this.initAnnotation(a);this.options.annotations.push(a.options);t(b,!0)&&a.redraw();return a},removeAnnotation:function(a){var b=this.annotations,c="annotations"===a.coll?a:A(b,function(b){return b.options.id===a});c&&(z(c,"remove"),l(this.options.annotations,c.options),l(b,c),c.destroy())},drawAnnotations:function(){this.plotBoxClip.attr(this.plotBox);
this.annotations.forEach(function(a){a.redraw()})}});m.collectionsWithUpdate.push("annotations");m.collectionsWithInit.annotations=[m.addAnnotation];m.callbacks.push(function(a){a.annotations=[];a.options.annotations||(a.options.annotations=[]);a.plotBoxClip=this.renderer.clipRect(this.plotBox);a.controlPointsGroup=a.renderer.g("control-points").attr({zIndex:99}).clip(a.plotBoxClip).add();a.options.annotations.forEach(function(b,c){b=a.initAnnotation(b);a.options.annotations[c]=b.options});a.drawAnnotations();
x(a,"redraw",a.drawAnnotations);x(a,"destroy",function(){a.plotBoxClip.destroy();a.controlPointsGroup.destroy()})});e.wrap(e.Pointer.prototype,"onContainerMouseDown",function(a){this.chart.hasDraggedAnnotation||a.apply(this,Array.prototype.slice.call(arguments,1))})});p(e,"mixins/navigation.js",[],function(){return{initUpdate:function(e){e.navigation||(e.navigation={updates:[],update:function(e,l){this.updates.forEach(function(m){m.update.call(m.context,e,l)})}})},addUpdate:function(e,m){m.navigation||
this.initUpdate(m);m.navigation.updates.push({update:e,context:m})}}});p(e,"annotations/navigationBindings.js",[e["parts/Globals.js"],e["parts/Utilities.js"],e["mixins/navigation.js"]],function(e,m,r){function l(a){var b=a.prototype.defaultOptions.events&&a.prototype.defaultOptions.events.click;e.merge(!0,a.prototype.defaultOptions.events,{click:function(a){var c=this,d=c.chart.navigationBindings,e=d.activeAnnotation;b&&b.click.call(c,a);e!==c?(d.deselectAnnotation(),d.activeAnnotation=c,c.setControlPointsVisibility(!0),
t(d,"showPopup",{annotation:c,formType:"annotation-toolbar",options:d.annotationToFields(c),onSubmit:function(a){var b={};"remove"===a.actionType?(d.activeAnnotation=!1,d.chart.removeAnnotation(c)):(d.fieldsToOptions(a.fields,b),d.deselectAnnotation(),a=b.typeOptions,"measure"===c.options.type&&(a.crosshairY.enabled=0!==a.crosshairY.strokeWidth,a.crosshairX.enabled=0!==a.crosshairX.strokeWidth),c.update(b))}})):(d.deselectAnnotation(),t(d,"closePopup"));a.activeAnnotation=!0}})}var f=m.attr,c=m.extend,
a=m.isArray,b=m.isNumber,d=m.isObject,h=m.objectEach,p=m.pick,k=e.doc,g=e.win,q=e.addEvent,v=e.merge,t=e.fireEvent;e.NavigationBindings=function(a,b){this.chart=a;this.options=b;this.eventsToUnbind=[];this.container=k.getElementsByClassName(this.options.bindingsClassName)};e.NavigationBindings.annotationsEditable={nestedOptions:{labelOptions:["style","format","backgroundColor"],labels:["style"],label:["style"],style:["fontSize","color"],background:["fill","strokeWidth","stroke"],innerBackground:["fill",
"strokeWidth","stroke"],outerBackground:["fill","strokeWidth","stroke"],shapeOptions:["fill","strokeWidth","stroke"],shapes:["fill","strokeWidth","stroke"],line:["strokeWidth","stroke"],backgroundColors:[!0],connector:["fill","strokeWidth","stroke"],crosshairX:["strokeWidth","stroke"],crosshairY:["strokeWidth","stroke"]},circle:["shapes"],verticalLine:[],label:["labelOptions"],measure:["background","crosshairY","crosshairX"],fibonacci:[],tunnel:["background","line","height"],pitchfork:["innerBackground",
"outerBackground"],rect:["shapes"],crookedLine:[]};e.NavigationBindings.annotationsNonEditable={rectangle:["crosshairX","crosshairY","label"]};c(e.NavigationBindings.prototype,{initEvents:function(){var a=this,b=a.chart,c=a.container,d=a.options;a.boundClassNames={};h(d.bindings,function(b){a.boundClassNames[b.className]=b});[].forEach.call(c,function(b){a.eventsToUnbind.push(q(b,"click",function(b){var d=a.getButtonEvents(c,b);d&&a.bindingsButtonClick(d.button,d.events,b)}))});h(d.events||{},function(b,
c){e.isFunction(b)&&a.eventsToUnbind.push(q(a,c,b))});a.eventsToUnbind.push(q(b.container,"click",function(c){!b.cancelClick&&b.isInsidePlot(c.chartX-b.plotLeft,c.chartY-b.plotTop)&&a.bindingsChartClick(this,c)}));a.eventsToUnbind.push(q(b.container,"mousemove",function(b){a.bindingsContainerMouseMove(this,b)}))},initUpdate:function(){var a=this;r.addUpdate(function(b){a.update(b)},this.chart)},bindingsButtonClick:function(a,b,c){var d=this.chart;this.selectedButtonElement&&(t(this,"deselectButton",
{button:this.selectedButtonElement}),this.nextEvent&&(this.currentUserDetails&&"annotations"===this.currentUserDetails.coll&&d.removeAnnotation(this.currentUserDetails),this.mouseMoveEvent=this.nextEvent=!1));this.selectedButton=b;this.selectedButtonElement=a;t(this,"selectButton",{button:a});b.init&&b.init.call(this,a,c);(b.start||b.steps)&&d.renderer.boxWrapper.addClass("highcharts-draw-mode")},bindingsChartClick:function(a,b){a=this.selectedButton;var c=this.chart.renderer.boxWrapper,d;if(d=this.activeAnnotation&&
!b.activeAnnotation&&b.target.parentNode){a:{d=b.target;var e=g.Element.prototype,k=e.matches||e.msMatchesSelector||e.webkitMatchesSelector,f=null;if(e.closest)f=e.closest.call(d,".highcharts-popup");else{do{if(k.call(d,".highcharts-popup"))break a;d=d.parentElement||d.parentNode}while(null!==d&&1===d.nodeType)}d=f}d=!d}d&&(t(this,"closePopup"),this.deselectAnnotation());a&&a.start&&(this.nextEvent?(this.nextEvent(b,this.currentUserDetails),this.steps&&(this.stepIndex++,a.steps[this.stepIndex]?this.mouseMoveEvent=
this.nextEvent=a.steps[this.stepIndex]:(t(this,"deselectButton",{button:this.selectedButtonElement}),c.removeClass("highcharts-draw-mode"),a.end&&a.end.call(this,b,this.currentUserDetails),this.mouseMoveEvent=this.nextEvent=!1,this.selectedButton=null))):(this.currentUserDetails=a.start.call(this,b),a.steps?(this.stepIndex=0,this.steps=!0,this.mouseMoveEvent=this.nextEvent=a.steps[this.stepIndex]):(t(this,"deselectButton",{button:this.selectedButtonElement}),c.removeClass("highcharts-draw-mode"),
this.steps=!1,this.selectedButton=null,a.end&&a.end.call(this,b,this.currentUserDetails))))},bindingsContainerMouseMove:function(a,b){this.mouseMoveEvent&&this.mouseMoveEvent(b,this.currentUserDetails)},fieldsToOptions:function(a,c){h(a,function(a,d){var e=parseFloat(a),g=d.split("."),k=c,f=g.length-1;!b(e)||a.match(/px/g)||d.match(/format/g)||(a=e);""!==a&&"undefined"!==a&&g.forEach(function(b,c){var d=p(g[c+1],"");f===c?k[b]=a:(k[b]||(k[b]=d.match(/\d/g)?[]:{}),k=k[b])})});return c},deselectAnnotation:function(){this.activeAnnotation&&
(this.activeAnnotation.setControlPointsVisibility(!1),this.activeAnnotation=!1)},annotationToFields:function(b){function c(g,k,x,l){if(x&&-1===m.indexOf(k)&&(0<=(x.indexOf&&x.indexOf(k))||x[k]||!0===x))if(a(g))l[k]=[],g.forEach(function(a,b){d(a)?(l[k][b]={},h(a,function(a,d){c(a,d,f[k],l[k][b])})):c(a,0,f[k],l[k])});else if(d(g)){var q={};a(l)?(l.push(q),q[k]={},q=q[k]):l[k]=q;h(g,function(a,b){c(a,b,0===k?x:f[k],q)})}else"format"===k?l[k]=[e.format(g,b.labels[0].points[0]).toString(),"text"]:a(l)?
l.push([g,u(g)]):l[k]=[g,u(g)]}var g=b.options,k=e.NavigationBindings.annotationsEditable,f=k.nestedOptions,u=this.utils.getFieldType,l=p(g.type,g.shapes&&g.shapes[0]&&g.shapes[0].type,g.labels&&g.labels[0]&&g.labels[0].itemType,"label"),m=e.NavigationBindings.annotationsNonEditable[g.langKey]||[],q={langKey:g.langKey,type:l};h(g,function(a,b){"typeOptions"===b?(q[b]={},h(g[b],function(a,d){c(a,d,f,q[b],!0)})):c(a,b,k[l],q)});return q},getClickedClassNames:function(a,b){var c=b.target;b=[];for(var d;c&&
((d=f(c,"class"))&&(b=b.concat(d.split(" ").map(function(a){return[a,c]}))),c=c.parentNode,c!==a););return b},getButtonEvents:function(a,b){var c=this,d;this.getClickedClassNames(a,b).forEach(function(a){c.boundClassNames[a[0]]&&!d&&(d={events:c.boundClassNames[a[0]],button:a[1]})});return d},update:function(a){this.options=v(!0,this.options,a);this.removeEvents();this.initEvents()},removeEvents:function(){this.eventsToUnbind.forEach(function(a){a()})},destroy:function(){this.removeEvents()},utils:{updateRectSize:function(a,
b){var c=b.chart,d=b.options.typeOptions,g=c.pointer.getCoordinates(a);a=g.xAxis[0].value-d.point.x;d=d.point.y-g.yAxis[0].value;b.update({typeOptions:{background:{width:c.inverted?d:a,height:c.inverted?a:d}}})},getFieldType:function(a){return{string:"text",number:"number","boolean":"checkbox"}[typeof a]}}});e.Chart.prototype.initNavigationBindings=function(){var a=this.options;a&&a.navigation&&a.navigation.bindings&&(this.navigationBindings=new e.NavigationBindings(this,a.navigation),this.navigationBindings.initEvents(),
this.navigationBindings.initUpdate())};q(e.Chart,"load",function(){this.initNavigationBindings()});q(e.Chart,"destroy",function(){this.navigationBindings&&this.navigationBindings.destroy()});q(e.NavigationBindings,"deselectButton",function(){this.selectedButtonElement=null});q(e.Annotation,"remove",function(){this.chart.navigationBindings&&this.chart.navigationBindings.deselectAnnotation()});e.Annotation&&(l(e.Annotation),h(e.Annotation.types,function(a){l(a)}));e.setOptions({lang:{navigation:{popup:{simpleShapes:"Simple shapes",
lines:"Lines",circle:"Circle",rectangle:"Rectangle",label:"Label",shapeOptions:"Shape options",typeOptions:"Details",fill:"Fill",format:"Text",strokeWidth:"Line width",stroke:"Line color",title:"Title",name:"Name",labelOptions:"Label options",labels:"Labels",backgroundColor:"Background color",backgroundColors:"Background colors",borderColor:"Border color",borderRadius:"Border radius",borderWidth:"Border width",style:"Style",padding:"Padding",fontSize:"Font size",color:"Color",height:"Height",shapes:"Shape options"}}},
navigation:{bindingsClassName:"highcharts-bindings-container",bindings:{circleAnnotation:{className:"highcharts-circle-annotation",start:function(a){a=this.chart.pointer.getCoordinates(a);var b=this.chart.options.navigation;return this.chart.addAnnotation(v({langKey:"circle",shapes:[{type:"circle",point:{xAxis:0,yAxis:0,x:a.xAxis[0].value,y:a.yAxis[0].value},r:5,controlPoints:[{positioner:function(a){var b=e.Annotation.MockPoint.pointToPixels(a.points[0]);a=a.options.r;return{x:b.x+a*Math.cos(Math.PI/
4)-this.graphic.width/2,y:b.y+a*Math.sin(Math.PI/4)-this.graphic.height/2}},events:{drag:function(a,b){var c=b.annotation;a=this.mouseMoveToTranslation(a);b.setRadius(Math.max(b.options.r+a.y/Math.sin(Math.PI/4),5));c.options.shapes[0]=c.userOptions.shapes[0]=b.options;b.redraw(!1)}}}]}]},b.annotationsOptions,b.bindings.circleAnnotation.annotationsOptions))},steps:[function(a,b){var c=b.options.shapes[0].point,d=this.chart.xAxis[0].toPixels(c.x);c=this.chart.yAxis[0].toPixels(c.y);var g=this.chart.inverted;
b.update({shapes:[{r:Math.max(Math.sqrt(Math.pow(g?c-a.chartX:d-a.chartX,2)+Math.pow(g?d-a.chartY:c-a.chartY,2)),5)}]})}]},rectangleAnnotation:{className:"highcharts-rectangle-annotation",start:function(a){var b=this.chart.pointer.getCoordinates(a);a=this.chart.options.navigation;var c=b.xAxis[0].value;b=b.yAxis[0].value;return this.chart.addAnnotation(v({langKey:"rectangle",shapes:[{type:"path",points:[{xAxis:0,yAxis:0,x:c,y:b},{xAxis:0,yAxis:0,x:c,y:b},{xAxis:0,yAxis:0,x:c,y:b},{xAxis:0,yAxis:0,
x:c,y:b}]}],controlPoints:[{positioner:function(a){a=e.Annotation.MockPoint.pointToPixels(a.shapes[0].points[2]);return{x:a.x-4,y:a.y-4}},events:{drag:function(a,b){var c=this.chart.pointer.getCoordinates(a);a=c.xAxis[0].value;c=c.yAxis[0].value;var d=b.options.shapes[0].points;d[1].x=a;d[2].x=a;d[2].y=c;d[3].y=c;b.options.shapes[0].points=d;b.redraw(!1)}}}]},a.annotationsOptions,a.bindings.rectangleAnnotation.annotationsOptions))},steps:[function(a,b){var c=b.options.shapes[0].points,d=this.chart.pointer.getCoordinates(a);
a=d.xAxis[0].value;d=d.yAxis[0].value;c[1].x=a;c[2].x=a;c[2].y=d;c[3].y=d;b.update({shapes:[{points:c}]})}]},labelAnnotation:{className:"highcharts-label-annotation",start:function(a){a=this.chart.pointer.getCoordinates(a);var b=this.chart.options.navigation;return this.chart.addAnnotation(v({langKey:"label",labelOptions:{format:"{y:.2f}"},labels:[{point:{xAxis:0,yAxis:0,x:a.xAxis[0].value,y:a.yAxis[0].value},overflow:"none",crop:!0,controlPoints:[{symbol:"triangle-down",positioner:function(a){if(!a.graphic.placed)return{x:0,
y:-9E7};a=e.Annotation.MockPoint.pointToPixels(a.points[0]);return{x:a.x-this.graphic.width/2,y:a.y-this.graphic.height/2}},events:{drag:function(a,b){a=this.mouseMoveToTranslation(a);b.translatePoint(a.x,a.y);b.annotation.labels[0].options=b.options;b.redraw(!1)}}},{symbol:"square",positioner:function(a){return a.graphic.placed?{x:a.graphic.alignAttr.x-this.graphic.width/2,y:a.graphic.alignAttr.y-this.graphic.height/2}:{x:0,y:-9E7}},events:{drag:function(a,b){a=this.mouseMoveToTranslation(a);b.translate(a.x,
a.y);b.annotation.labels[0].options=b.options;b.redraw(!1)}}}]}]},b.annotationsOptions,b.bindings.labelAnnotation.annotationsOptions))}}},events:{},annotationsOptions:{}}})});p(e,"annotations/popup.js",[e["parts/Globals.js"],e["parts/Utilities.js"]],function(e,m){var l=m.defined,n=m.isArray,f=m.isObject,c=m.isString,a=m.objectEach,b=m.pick,d=e.addEvent,h=e.createElement;m=e.wrap;var p=/\d/g;m(e.Pointer.prototype,"onContainerMouseDown",function(a,b){var d=b.target&&b.target.className;c(d)&&0<=d.indexOf("highcharts-popup-field")||
a.apply(this,Array.prototype.slice.call(arguments,1))});e.Popup=function(a,b){this.init(a,b)};e.Popup.prototype={init:function(a,b){this.container=h("div",{className:"highcharts-popup"},null,a);this.lang=this.getLangpack();this.iconsURL=b;this.addCloseBtn()},addCloseBtn:function(){var a=this;var b=h("div",{className:"highcharts-popup-close"},null,this.container);b.style["background-image"]="url("+this.iconsURL+"close.svg)";["click","touchstart"].forEach(function(c){d(b,c,function(){a.closePopup()})})},
addColsContainer:function(a){var b=h("div",{className:"highcharts-popup-lhs-col"},null,a);a=h("div",{className:"highcharts-popup-rhs-col"},null,a);h("div",{className:"highcharts-popup-rhs-col-wrapper"},null,a);return{lhsCol:b,rhsCol:a}},addInput:function(a,b,c,d){var e=a.split(".");e=e[e.length-1];var g=this.lang;b="highcharts-"+b+"-"+e;b.match(p)||h("label",{innerHTML:g[e]||e,htmlFor:b},null,c);h("input",{name:b,value:d[0],type:d[1],className:"highcharts-popup-field"},null,c).setAttribute("highcharts-data-name",
a)},addButton:function(a,b,c,e,f){var g=this,k=this.closePopup,l=this.getFields;var m=h("button",{innerHTML:b},null,a);["click","touchstart"].forEach(function(a){d(m,a,function(){k.call(g);return e(l(f,c))})});return m},getFields:function(a,b){var c=a.querySelectorAll("input"),d=a.querySelectorAll("#highcharts-select-series > option:checked")[0];a=a.querySelectorAll("#highcharts-select-volume > option:checked")[0];var e,g;var k={actionType:b,linkedTo:d&&d.getAttribute("value"),fields:{}};[].forEach.call(c,
function(a){g=a.getAttribute("highcharts-data-name");(e=a.getAttribute("highcharts-data-series-id"))?k.seriesId=a.value:g?k.fields[g]=a.value:k.type=a.value});a&&(k.fields["params.volumeSeriesID"]=a.getAttribute("value"));return k},showPopup:function(){var a=this.container,b=a.querySelectorAll(".highcharts-popup-close")[0];a.innerHTML="";0<=a.className.indexOf("highcharts-annotation-toolbar")&&(a.classList.remove("highcharts-annotation-toolbar"),a.removeAttribute("style"));a.appendChild(b);a.style.display=
"block"},closePopup:function(){this.popup.container.style.display="none"},showForm:function(a,b,c,d){this.popup=b.navigationBindings.popup;this.showPopup();"indicators"===a&&this.indicators.addForm.call(this,b,c,d);"annotation-toolbar"===a&&this.annotations.addToolbar.call(this,b,c,d);"annotation-edit"===a&&this.annotations.addForm.call(this,b,c,d);"flag"===a&&this.annotations.addForm.call(this,b,c,d,!0)},getLangpack:function(){return e.getOptions().lang.navigation.popup},annotations:{addToolbar:function(a,
c,d){var e=this,g=this.lang,k=this.popup.container,f=this.showForm;-1===k.className.indexOf("highcharts-annotation-toolbar")&&(k.className+=" highcharts-annotation-toolbar");k.style.top=a.plotTop+10+"px";h("span",{innerHTML:b(g[c.langKey]||c.langKey,c.shapes&&c.shapes[0].type)},null,k);var l=this.addButton(k,g.removeButton||"remove","remove",d,k);l.className+=" highcharts-annotation-remove-button";l.style["background-image"]="url("+this.iconsURL+"destroy.svg)";l=this.addButton(k,g.editButton||"edit",
"edit",function(){f.call(e,"annotation-edit",a,c,d)},k);l.className+=" highcharts-annotation-edit-button";l.style["background-image"]="url("+this.iconsURL+"edit.svg)"},addForm:function(a,b,c,d){var e=this.popup.container,g=this.lang;h("h2",{innerHTML:g[b.langKey]||b.langKey,className:"highcharts-popup-main-title"},null,e);var k=h("div",{className:"highcharts-popup-lhs-col highcharts-popup-lhs-full"},null,e);var f=h("div",{className:"highcharts-popup-bottom-row"},null,e);this.annotations.addFormFields.call(this,
k,a,"",b,[],!0);this.addButton(f,d?g.addButton||"add":g.saveButton||"save",d?"add":"save",c,e)},addFormFields:function(b,c,d,e,l,m){var g=this,k=this.annotations.addFormFields,q=this.addInput,u=this.lang,t,v;a(e,function(a,e){t=""!==d?d+"."+e:e;f(a)&&(!n(a)||n(a)&&f(a[0])?(v=u[e]||e,v.match(p)||l.push([!0,v,b]),k.call(g,b,c,t,a,l,!1)):l.push([g,t,"annotation",b,a]))});m&&(l=l.sort(function(a){return a[1].match(/format/g)?-1:1}),l.forEach(function(a){!0===a[0]?h("span",{className:"highcharts-annotation-title",
innerHTML:a[1]},null,a[2]):q.apply(a[0],a.splice(1))}))}},indicators:{addForm:function(a,b,c){var d=this.indicators,e=this.lang;this.tabs.init.call(this,a);b=this.popup.container.querySelectorAll(".highcharts-tab-item-content");this.addColsContainer(b[0]);d.addIndicatorList.call(this,a,b[0],"add");var g=b[0].querySelectorAll(".highcharts-popup-rhs-col")[0];this.addButton(g,e.addButton||"add","add",c,g);this.addColsContainer(b[1]);d.addIndicatorList.call(this,a,b[1],"edit");g=b[1].querySelectorAll(".highcharts-popup-rhs-col")[0];
this.addButton(g,e.saveButton||"save","edit",c,g);this.addButton(g,e.removeButton||"remove","remove",c,g)},addIndicatorList:function(b,c,e){var g=this,f=c.querySelectorAll(".highcharts-popup-lhs-col")[0];c=c.querySelectorAll(".highcharts-popup-rhs-col")[0];var k="edit"===e,l=k?b.series:b.options.plotOptions,m=this.indicators.addFormFields,q;var n=h("ul",{className:"highcharts-indicator-list"},null,f);var p=c.querySelectorAll(".highcharts-popup-rhs-col-wrapper")[0];a(l,function(a,c){var e=a.options;
if(a.params||e&&e.params){var f=g.indicators.getNameType(a,c),t=f.type;q=h("li",{className:"highcharts-indicator-list",innerHTML:f.name},null,n);["click","touchstart"].forEach(function(c){d(q,c,function(){m.call(g,b,k?a:l[t],f.type,p);k&&a.options&&h("input",{type:"hidden",name:"highcharts-id-"+t,value:a.options.id},null,p).setAttribute("highcharts-data-series-id",a.options.id)})})}});0<n.childNodes.length&&n.childNodes[0].click()},getNameType:function(a,b){var c=a.options,d=e.seriesTypes;d=d[b]&&
d[b].prototype.nameBase||b.toUpperCase();c&&c.type&&(b=a.options.type,d=a.name);return{name:d,type:b}},listAllSeries:function(a,b,c,d,e){a="highcharts-"+b+"-type-"+a;var g;h("label",{innerHTML:this.lang[b]||b,htmlFor:a},null,d);var f=h("select",{name:a,className:"highcharts-popup-field"},null,d);f.setAttribute("id","highcharts-select-"+b);c.series.forEach(function(a){g=a.options;!g.params&&g.id&&"highcharts-navigator-series"!==g.id&&h("option",{innerHTML:g.name||g.id,value:g.id},null,f)});l(e)&&(f.value=
e)},addFormFields:function(a,b,c,d){var e=b.params||b.options.params,f=this.indicators.getNameType;d.innerHTML="";h("h3",{className:"highcharts-indicator-title",innerHTML:f(b,c).name},null,d);h("input",{type:"hidden",name:"highcharts-type-"+c,value:c},null,d);this.indicators.listAllSeries.call(this,c,"series",a,d,b.linkedParent&&e.volumeSeriesID);e.volumeSeriesID&&this.indicators.listAllSeries.call(this,c,"volume",a,d,b.linkedParent&&b.linkedParent.options.id);this.indicators.addParamInputs.call(this,
a,"params",e,c,d)},addParamInputs:function(b,c,d,e,h){var g=this,k=this.indicators.addParamInputs,l=this.addInput,m;a(d,function(a,d){m=c+"."+d;f(a)?k.call(g,b,m,a,e,h):"params.volumeSeriesID"!==m&&l.call(g,m,e,h,[a,"text"])})},getAmount:function(){var b=0;a(this.series,function(a){var c=a.options;(a.params||c&&c.params)&&b++});return b}},tabs:{init:function(a){var b=this.tabs;a=this.indicators.getAmount.call(a);var c=b.addMenuItem.call(this,"add");b.addMenuItem.call(this,"edit",a);b.addContentItem.call(this,
"add");b.addContentItem.call(this,"edit");b.switchTabs.call(this,a);b.selectTab.call(this,c,0)},addMenuItem:function(a,b){var c=this.popup.container,d="highcharts-tab-item",e=this.lang;0===b&&(d+=" highcharts-tab-disabled");b=h("span",{innerHTML:e[a+"Button"]||a,className:d},null,c);b.setAttribute("highcharts-data-tab-type",a);return b},addContentItem:function(){return h("div",{className:"highcharts-tab-item-content"},null,this.popup.container)},switchTabs:function(a){var b=this,c;this.popup.container.querySelectorAll(".highcharts-tab-item").forEach(function(e,
f){c=e.getAttribute("highcharts-data-tab-type");"edit"===c&&0===a||["click","touchstart"].forEach(function(a){d(e,a,function(){b.tabs.deselectAll.call(b);b.tabs.selectTab.call(b,this,f)})})})},selectTab:function(a,b){var c=this.popup.container.querySelectorAll(".highcharts-tab-item-content");a.className+=" highcharts-tab-item-active";c[b].className+=" highcharts-tab-item-show"},deselectAll:function(){var a=this.popup.container,b=a.querySelectorAll(".highcharts-tab-item");a=a.querySelectorAll(".highcharts-tab-item-content");
var c;for(c=0;c<b.length;c++)b[c].classList.remove("highcharts-tab-item-active"),a[c].classList.remove("highcharts-tab-item-show")}}};d(e.NavigationBindings,"showPopup",function(a){this.popup||(this.popup=new e.Popup(this.chart.container,this.chart.options.navigation.iconsURL||this.chart.options.stockTools&&this.chart.options.stockTools.gui.iconsURL||"https://code.highcharts.com/7.2.1/gfx/stock-icons/"));this.popup.showForm(a.formType,this.chart,a.options,a.onSubmit)});d(e.NavigationBindings,"closePopup",
function(){this.popup&&this.popup.closePopup()})});p(e,"masters/modules/annotations.src.js",[],function(){})});
//# sourceMappingURL=annotations.js.map