text: "use strict";import H from"../parts/Globals.js";import U from"../parts/Utilities.js";var arrayMax=U.arrayMax,arrayMin=U.arrayMin,defined=U.defined,isNumber=U.isNumber,objectEach=U.objectEach,pick=U.pick,addEvent=H.addEvent,LegendSymbolMixin=H.LegendSymbolMixin,TrackerMixin=H.TrackerMixin,merge=H.merge,Point=H.Point,Series=H.Series,seriesType=H.seriesType,seriesTypes=H.seriesTypes;seriesType("timeline","line",{colorByPoint:!0,stickyTracking:!1,ignoreHiddenPoint:!0,legendType:"point",lineWidth:4,tooltip:{headerFormat:'<span style="color:{point.color}">●</span> <span style="font-size: 10px"> {point.key}</span><br/>',pointFormat:"{point.description}"},states:{hover:{lineWidthPlus:0}},dataLabels:{enabled:!0,allowOverlap:!0,connectorWidth:1,backgroundColor:"#ffffff",formatter:function(){var t;return t=this.series.chart.styledMode?"<span>● </span>":'<span style="color:'+this.point.color+'">● </span>',t+='<span class="highcharts-strong">'+(this.key||"")+"</span><br/>"+(this.point.label||"")},borderWidth:1,borderColor:"#999999",borderRadius:3,distance:100,alternate:!0,verticalAlign:"middle",color:"#333333",style:{textOutline:"none",fontWeight:"normal",fontSize:"12px"},shadow:!1},marker:{enabledThreshold:0,symbol:"square",radius:6,lineWidth:2,height:15},showInLegend:!1,colorKey:"x"},{trackerGroups:["markerGroup","dataLabelsGroup"],drawLegendSymbol:LegendSymbolMixin.drawRectangle,drawTracker:TrackerMixin.drawTrackerPoint,init:function(){var t=this;Series.prototype.init.apply(t,arguments),addEvent(t,"afterTranslate",function(){var i,e=Number.MAX_VALUE;t.points.forEach(function(t){t.isInside=t.isInside&&t.visible,t.visible&&!t.isNull&&(defined(i)&&(e=Math.min(e,Math.abs(t.plotX-i))),i=t.plotX)}),t.closestPointRangePx=e}),addEvent(t,"drawDataLabels",function(){t.distributeDL()}),addEvent(t,"afterDrawDataLabels",function(){var i;t.points.forEach(function(t){if(i=t.dataLabel)return i.animate=function(t){return this.targetPosition&&(this.targetPosition=t),H.SVGElement.prototype.animate.apply(this,arguments)},i.targetPosition||(i.targetPosition={}),t.drawConnector()})}),addEvent(t.chart,"afterHideOverlappingLabels",function(){t.points.forEach(function(t){t.connector&&t.dataLabel&&t.dataLabel.oldOpacity!==t.dataLabel.newOpacity&&t.alignConnector()})})},alignDataLabel:function(t,i,e,a){var s,n,r,o=this.chart.inverted,l=this.visibilityMap.filter(function(t){return t}),h=this.visiblePointsCount,p=l.indexOf(t),c=!p||p===h-1,d=this.options.dataLabels,y=t.userDLOptions||{},u=d.alternate?c?1.5:2:1,b=Math.floor(this.xAxis.len/h),f=i.padding;t.visible&&(s=Math.abs(y.x||t.options.dataLabels.x),r=o?{width:n=2*(s-f)-t.itemHeight/2,textOverflow:i.width/n*i.height/2>b*u?"ellipsis":"none"}:{width:y.width||d.width||b*u-2*f},i.css(r),this.chart.styledMode||i.shadow(d.shadow)),Series.prototype.alignDataLabel.apply(this,arguments)},processData:function(){var t,i=0;for(this.visibilityMap=this.getVisibilityMap(),this.visibilityMap.forEach(function(t){t&&i++}),this.visiblePointsCount=i,t=0;t<this.xData.length;t++)this.yData[t]=1;Series.prototype.processData.call(this,arguments)},getXExtremes:function(t){var i=this,e=t.filter(function(t,e){return i.points[e].isValid()&&i.points[e].visible});return{min:arrayMin(e),max:arrayMax(e)}},generatePoints:function(){var t=this;Series.prototype.generatePoints.apply(t),t.points.forEach(function(i,e){i.applyOptions({x:t.xData[e]},t.xData[e])})},getVisibilityMap:function(){return(this.data.length?this.data:this.userOptions.data).map(function(t){return!(!t||!1===t.visible||t.isNull)&&t})},distributeDL:function(){var t,i,e=this,a=e.options.dataLabels,s={},n=1,r=a.distance;e.points.forEach(function(o){o.visible&&!o.isNull&&(t=o.options,i=o.options.dataLabels,e.hasRendered||(o.userDLOptions=merge({},i)),s[e.chart.inverted?"x":"y"]=a.alternate&&n%2?-r:r,t.dataLabels=merge(s,o.userDLOptions),n++)})},markerAttribs:function(t,i){var e,a,s=this.options.marker,n=t.marker||{},r=n.symbol||s.symbol,o=pick(n.width,s.width,this.closestPointRangePx),l=pick(n.height,s.height),h=0;return this.xAxis.isDatetimeAxis?seriesTypes.line.prototype.markerAttribs.call(this,t,i):(i&&(e=s.states[i]||{},a=n.states&&n.states[i]||{},h=pick(a.radius,e.radius,h+(e.radiusPlus||0))),t.hasImage=r&&0===r.indexOf("url"),{x:Math.floor(t.plotX)-o/2-h/2,y:t.plotY-l/2-h/2,width:o+h,height:l+h})},bindAxes:function(){var t=this;Series.prototype.bindAxes.call(t),["xAxis","yAxis"].forEach(function(i){"xAxis"!==i||t[i].userOptions.type||(t[i].categories=t[i].hasNames=!0)})}},{init:function(){var t=Point.prototype.init.apply(this,arguments);return t.name=pick(t.name,"Event"),t.y=1,t},isValid:function(){return null!==this.options.y},setVisible:function(t,i){var e=this.series;i=pick(i,e.options.ignoreHiddenPoint),seriesTypes.pie.prototype.pointClass.prototype.setVisible.call(this,t,!1),e.processData(),i&&e.chart.redraw()},setState:function(){var t=Series.prototype.pointClass.prototype.setState;this.isNull||t.apply(this,arguments)},getConnectorPath:function(){var t=this.series.chart,i=this.series.xAxis.len,e=t.inverted,a=e?"x2":"y2",s=this.dataLabel,n=s.targetPosition,r={x1:this.plotX,y1:this.plotY,x2:this.plotX,y2:isNumber(n.y)?n.y:s.y},o=(s.alignAttr||s)[a[0]]<this.series.yAxis.len/2;return e&&(r={x1:this.plotY,y1:i-this.plotX,x2:n.x||s.x,y2:i-this.plotX}),o&&(r[a]+=s[e?"width":"height"]),objectEach(r,function(t,i){r[i]-=(s.alignAttr||s)[i[0]]}),t.renderer.crispLine(["M",r.x1,r.y1,"L",r.x2,r.y2],s.options.connectorWidth)},drawConnector:function(){var t=this.series;this.connector||(this.connector=t.chart.renderer.path(this.getConnectorPath()).attr({zIndex:-1}).add(this.dataLabel)),this.series.chart.isInsidePlot(this.dataLabel.x,this.dataLabel.y)&&this.alignConnector()},alignConnector:function(){var t=this.series,i=this.connector,e=this.dataLabel,a=this.dataLabel.options=merge(t.options.dataLabels,this.options.dataLabels),s=this.series.chart,n=i.getBBox(),r={x:n.x+e.translateX,y:n.y+e.translateY};s.inverted?r.y-=e.options.connectorWidth/2:r.x+=e.options.connectorWidth/2,i[s.isInsidePlot(r.x,r.y)?"animate":"attr"]({d:this.getConnectorPath()}),t.chart.styledMode||i.attr({stroke:a.connectorColor||this.color,"stroke-width":a.connectorWidth,opacity:e[defined(e.newOpacity)?"newOpacity":"opacity"]})}});