/*
 Highcharts JS v9.1.0 (2021-05-03)

 Annotations module

 (c) 2009-2021 Torstein Honsi

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