UNPKG

apexcharts

Version:

A JavaScript Chart Library

5 lines 80.9 kB
/*! * ApexCharts v5.10.5 * (c) 2018-2026 ApexCharts */ "use strict";var e=Object.defineProperty,t=Object.defineProperties,s=Object.getOwnPropertyDescriptors,i=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable,o=(t,s,i)=>s in t?e(t,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[s]=i,l=(e,t)=>{for(var s in t||(t={}))a.call(t,s)&&o(e,s,t[s]);if(i)for(var s of i(t))n.call(t,s)&&o(e,s,t[s]);return e},r=(e,i)=>t(e,s(i));const c=require("apexcharts/core");function h(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e)for(const s in e)if("default"!==s){const i=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,i.get?i:{enumerable:!0,get:()=>e[s]})}return t.default=e,Object.freeze(t)}const d=h(c),g=".apexcharts-flip-y {\n transform: scaleY(-1) translateY(-100%);\n transform-origin: top;\n transform-box: fill-box;\n}\n.apexcharts-flip-x {\n transform: scaleX(-1);\n transform-origin: center;\n transform-box: fill-box;\n}\n.apexcharts-legend {\n display: flex;\n overflow: auto;\n padding: 0 10px;\n}\n.apexcharts-legend.apexcharts-legend-group-horizontal {\n flex-direction: column;\n}\n.apexcharts-legend-group {\n display: flex;\n}\n.apexcharts-legend-group-vertical {\n flex-direction: column-reverse;\n}\n.apexcharts-legend.apx-legend-position-bottom, .apexcharts-legend.apx-legend-position-top {\n flex-wrap: wrap\n}\n.apexcharts-legend.apx-legend-position-right, .apexcharts-legend.apx-legend-position-left {\n flex-direction: column;\n bottom: 0;\n}\n.apexcharts-legend.apx-legend-position-bottom.apexcharts-align-left, .apexcharts-legend.apx-legend-position-top.apexcharts-align-left, .apexcharts-legend.apx-legend-position-right, .apexcharts-legend.apx-legend-position-left {\n justify-content: flex-start;\n align-items: flex-start;\n}\n.apexcharts-legend.apx-legend-position-bottom.apexcharts-align-center, .apexcharts-legend.apx-legend-position-top.apexcharts-align-center {\n justify-content: center;\n align-items: center;\n}\n.apexcharts-legend.apx-legend-position-bottom.apexcharts-align-right, .apexcharts-legend.apx-legend-position-top.apexcharts-align-right {\n justify-content: flex-end;\n align-items: flex-end;\n}\n.apexcharts-legend-series {\n cursor: pointer;\n line-height: normal;\n display: flex;\n align-items: center;\n}\n.apexcharts-legend-text {\n position: relative;\n font-size: 14px;\n}\n.apexcharts-legend-text *, .apexcharts-legend-marker * {\n pointer-events: none;\n}\n.apexcharts-legend-marker {\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n margin-right: 1px;\n}\n\n.apexcharts-legend-series.apexcharts-no-click {\n cursor: auto;\n}\n.apexcharts-legend .apexcharts-hidden-zero-series, .apexcharts-legend .apexcharts-hidden-null-series {\n display: none !important;\n}\n.apexcharts-inactive-legend {\n opacity: 0.45;\n} ",p=d.__apex_axes_AxesUtils,x=d.__apex_Data,u=d.__apex_Series,m=d.__apex_Utils,f=d.__apex_Environment_Environment;class b{constructor(e,t){this.w=e,this.ctx=t}svgStringToNode(e){return(new DOMParser).parseFromString(e,"image/svg+xml").documentElement}scaleSvgNode(e,t){const s=parseFloat(e.getAttributeNS(null,"width")),i=parseFloat(e.getAttributeNS(null,"height"));e.setAttributeNS(null,"width",s*t),e.setAttributeNS(null,"height",i*t),e.setAttributeNS(null,"viewBox","0 0 "+s+" "+i)}getSvgString(e){return new Promise(t=>{const s=this.w;let i=e||s.config.chart.toolbar.export.scale||s.config.chart.toolbar.export.width/s.globals.svgWidth;i||(i=1);const a=s.globals.svgWidth*i,n=s.globals.svgHeight*i,o=s.dom.elWrap.cloneNode(!0);o.style.width=a+"px",o.style.height=n+"px";const l=(new XMLSerializer).serializeToString(o);let r="\n .apexcharts-tooltip, .apexcharts-toolbar, .apexcharts-xaxistooltip, .apexcharts-yaxistooltip, .apexcharts-xcrosshairs, .apexcharts-ycrosshairs, .apexcharts-zoom-rect, .apexcharts-selection-rect {\n display: none;\n }\n ";s.config.legend.show&&s.dom.elLegendWrap&&s.dom.elLegendWrap.children.length>0&&(r+=g);let c=`\n <svg xmlns="http://www.w3.org/2000/svg"\n version="1.1"\n xmlns:xlink="http://www.w3.org/1999/xlink"\n class="apexcharts-svg"\n xmlns:data="ApexChartsNS"\n transform="translate(0, 0)"\n width="${s.globals.svgWidth}px" height="${s.globals.svgHeight}px">\n <foreignObject width="100%" height="100%">\n <div xmlns="http://www.w3.org/1999/xhtml" style="width:${a}px; height:${n}px;">\n <style type="text/css">\n ${r}\n </style>\n ${l}\n </div>\n </foreignObject>\n </svg>\n `;const h=this.svgStringToNode(c);1!==i&&this.scaleSvgNode(h,i),this.convertImagesToBase64(h).then(()=>{c=(new XMLSerializer).serializeToString(h),t(c.replace(/&nbsp;/g,"&#160;"))})})}convertImagesToBase64(e){const t=e.getElementsByTagName("image"),s=Array.from(t).map(e=>{const t=e.getAttributeNS("http://www.w3.org/1999/xlink","href");return t&&!t.startsWith("data:")?this.getBase64FromUrl(t).then(t=>{e.setAttributeNS("http://www.w3.org/1999/xlink","href",t)}).catch(e=>{}):Promise.resolve()});return Promise.all(s)}getBase64FromUrl(e){return f.isSSR()?Promise.resolve(e):new Promise((t,s)=>{const i=new Image;i.crossOrigin="Anonymous",i.onload=()=>{const e=document.createElement("canvas");e.width=i.width,e.height=i.height;const s=e.getContext("2d");s&&s.drawImage(i,0,0),t(e.toDataURL())},i.onerror=s,i.src=e})}svgUrl(){return new Promise(e=>{this.getSvgString().then(t=>{const s=new Blob([t],{type:"image/svg+xml;charset=utf-8"});e(URL.createObjectURL(s))})})}dataURI(e){return f.isSSR()?Promise.resolve({imgURI:""}):new Promise(t=>{const s=this.w,i=e?e.scale||e.width/s.globals.svgWidth:1,a=document.createElement("canvas");a.width=s.globals.svgWidth*i,a.height=parseInt(s.dom.elWrap.style.height,10)*i;const n="transparent"!==s.config.chart.background&&s.config.chart.background?s.config.chart.background:"#fff",o=a.getContext("2d");o&&(o.fillStyle=n,o.fillRect(0,0,a.width*i,a.height*i),this.getSvgString(i).then(e=>{const s="data:image/svg+xml,"+encodeURIComponent(e),i=new Image;i.crossOrigin="anonymous",i.onload=()=>{o.drawImage(i,0,0);const e=a;if(e.msToBlob){const s=e.msToBlob();t({blob:s})}else{const e=a.toDataURL("image/png");t({imgURI:e})}},i.src=s}))})}exportToSVG(){this.svgUrl().then(e=>{this.triggerDownload(e,this.w.config.chart.toolbar.export.svg.filename,".svg")})}exportToPng(){const e=this.w.config.chart.toolbar.export.scale,t=this.w.config.chart.toolbar.export.width,s=e?{scale:e}:t?{width:t}:void 0;this.dataURI(s).then(({imgURI:e,blob:t})=>{t?navigator.msSaveOrOpenBlob(t,this.w.globals.chartID+".png"):this.triggerDownload(e,this.w.config.chart.toolbar.export.png.filename,".png")})}exportToCSV({series:e,fileName:t,columnDelimiter:s=",",lineDelimiter:i="\n"}){const a=this.w;e||(e=a.config.series);let n=[];const o=[];let l="";const r=a.seriesData.series.map((e,t)=>-1===a.globals.collapsedSeriesIndices.indexOf(t)?e:[]),c=e=>"function"==typeof a.config.chart.toolbar.export.csv.categoryFormatter?a.config.chart.toolbar.export.csv.categoryFormatter(e):"datetime"===a.config.xaxis.type&&String(e).length>=10?new Date(e).toDateString():m.isNumber(e)?e:e.split(s).join(""),h=e=>"function"==typeof a.config.chart.toolbar.export.csv.valueFormatter?a.config.chart.toolbar.export.csv.valueFormatter(e):e,d=Math.max(...e.map(e=>e.data?e.data.length:0)),g=new x(this.w),f=new p(this.w,{theme:this.ctx.theme,timeScale:this.ctx.timeScale}),b=e=>{let t="";if(a.globals.axisCharts){if("category"===a.config.xaxis.type||a.config.xaxis.convertedCatToNumeric)if(a.globals.isBarHorizontal){const s=a.formatters.yLabelFormatters[0],i=new u(this.ctx.w).getActiveConfigSeriesIndex();t=s(a.labelData.labels[e],{seriesIndex:i,dataPointIndex:e,w:a})}else t=f.getLabel(a.labelData.labels,a.labelData.timescaleLabels,0,e).text;"datetime"===a.config.xaxis.type&&(a.config.xaxis.categories.length?t=a.config.xaxis.categories[e]:a.config.labels.length&&(t=a.config.labels[e]))}else t=a.config.labels[e];return null===t?"nullvalue":(Array.isArray(t)&&(t=t.join(" ")),m.isNumber(t)?t:t.split(s).join(""))},y=(t,i)=>{var l;if(n.length&&0===i&&o.push(n.join(s)),t.data){t.data=t.data.length&&t.data||[...Array(d)].map(()=>"");for(let d=0;d<t.data.length;d++){n=[];let p=b(d);if("nullvalue"!==p){if(p||(g.isFormatXY()?p=e[i].data[d].x:g.isFormat2DArray()&&(p=e[i].data[d]?e[i].data[d][0]:"")),0===i){n.push(c(p));for(let t=0;t<a.seriesData.series.length;t++){const s=g.isFormatXY()?null==(l=e[t].data[d])?void 0:l.y:r[t][d];n.push(h(s))}}("candlestick"===a.config.chart.type||t.type&&"candlestick"===t.type)&&(n.pop(),n.push(a.candleData.seriesCandleO[i][d]),n.push(a.candleData.seriesCandleH[i][d]),n.push(a.candleData.seriesCandleL[i][d]),n.push(a.candleData.seriesCandleC[i][d])),("boxPlot"===a.config.chart.type||t.type&&"boxPlot"===t.type)&&(n.pop(),n.push(a.candleData.seriesCandleO[i][d]),n.push(a.candleData.seriesCandleH[i][d]),n.push(a.candleData.seriesCandleM[i][d]),n.push(a.candleData.seriesCandleL[i][d]),n.push(a.candleData.seriesCandleC[i][d])),"rangeBar"===a.config.chart.type&&(n.pop(),n.push(a.rangeData.seriesRangeStart[i][d]),n.push(a.rangeData.seriesRangeEnd[i][d])),n.length&&o.push(n.join(s))}}}};n.push(a.config.chart.toolbar.export.csv.headerCategory),"boxPlot"===a.config.chart.type?(n.push("minimum"),n.push("q1"),n.push("median"),n.push("q3"),n.push("maximum")):"candlestick"===a.config.chart.type?(n.push("open"),n.push("high"),n.push("low"),n.push("close")):"rangeBar"===a.config.chart.type?(n.push("minimum"),n.push("maximum")):e.map((e,t)=>{const i=(e.name?e.name:`series-${t}`)+"";a.globals.axisCharts&&n.push(i.split(s).join("")?i.split(s).join(""):`series-${t}`)}),a.globals.axisCharts||(n.push(a.config.chart.toolbar.export.csv.headerValue),o.push(n.join(s))),a.globals.allSeriesHasEqualX||!a.globals.axisCharts||a.config.xaxis.categories.length||a.config.labels.length?e.map((e,t)=>{a.globals.axisCharts?y(e,t):(n=[],n.push(c(a.labelData.labels[t])),n.push(h(r[t])),o.push(n.join(s)))}):(()=>{const t=new Set,i={};e.forEach((s,a)=>{null==s||s.data.forEach(s=>{let n,o;if(g.isFormatXY())n=s.x,o=s.y;else{if(!g.isFormat2DArray())return;n=s[0],o=s[1]}i[n]||(i[n]=Array(e.length).fill("")),i[n][a]=h(o),t.add(n)})}),n.length&&o.push(n.join(s)),Array.from(t).sort().forEach(e=>{o.push([c(e),i[e].join(s)])})})(),l+=o.join(i),this.triggerDownload("data:text/csv; charset=utf-8,"+encodeURIComponent("\ufeff"+l),t||a.config.chart.toolbar.export.csv.filename,".csv")}triggerDownload(e,t,s){if(f.isSSR())return;const i=document.createElement("a");i.href=e,i.download=(t||this.w.globals.chartID)+s,document.body.appendChild(i),i.click(),document.body.removeChild(i)}}c.registerFeatures({exports:b});const y=d.__apex_CoreUtils,w=d.__apex_dimensions_Dimensions,v=d.__apex_Graphics;let C=class{constructor(e){this.w=e.w,this.lgCtx=e}getLegendStyles(){if(f.isSSR())return null;const e=document.createElement("style");e.setAttribute("type","text/css");const t=this.w.config.chart.nonce;t&&e.setAttribute("nonce",t);const s=document.createTextNode(g);return e.appendChild(s),e}getLegendDimensions(){const e=this.w.dom.baseEl.querySelector(".apexcharts-legend");if(!e)return{clwh:0,clww:0};const{width:t,height:s}=e.getBoundingClientRect();return{clwh:s,clww:t}}appendToForeignObject(){var e;const t=this.getLegendStyles();!1!==this.w.config.chart.injectStyleSheet&&t&&(null==(e=this.w.dom.elLegendForeign)||e.appendChild(t))}toggleDataSeries(e,t){var s,i;const a=this.w;if(a.globals.axisCharts||"radialBar"===a.config.chart.type){a.globals.resized=!0;let n=null,o=null;if(a.globals.risingSeries=[],a.globals.axisCharts){if(n=a.dom.baseEl.querySelector(`.apexcharts-series[data\\:realIndex='${e}']`),!n)return;o=parseInt(null!=(s=n.getAttribute("data:realIndex"))?s:"",10)}else{if(n=a.dom.baseEl.querySelector(`.apexcharts-series[rel='${e+1}']`),!n)return;o=parseInt(null!=(i=n.getAttribute("rel"))?i:"",10)-1}if(t){[{cs:a.globals.collapsedSeries,csi:a.globals.collapsedSeriesIndices},{cs:a.globals.ancillaryCollapsedSeries,csi:a.globals.ancillaryCollapsedSeriesIndices}].forEach(e=>{const t=e.cs,s=e.csi;this.riseCollapsedSeries(t,s,o)})}else this.hideSeries({seriesEl:n,realIndex:o});if(a.config.chart.accessibility.enabled){const t=a.dom.baseEl.querySelector(`.apexcharts-legend-series[rel="${e+1}"]`);if(t){const s=a.globals.collapsedSeriesIndices.includes(o)||a.globals.ancillaryCollapsedSeriesIndices.includes(o);t.setAttribute("aria-pressed",s?"true":"false");const i=t.querySelector(".apexcharts-legend-text"),n=i?i.textContent:a.seriesData.seriesNames[e],l=s?"hidden":"visible";t.setAttribute("aria-label",`${n}, ${l}. Press Enter or Space to toggle.`)}}}else{const t=a.dom.Paper.findOne(` .apexcharts-series[rel='${e+1}'] path`),s=a.config.chart.type;if("pie"===s||"polarArea"===s||"donut"===s){const e=a.config.plotOptions.pie.donut.labels;new v(this.w).pathMouseDown(t,null),this.lgCtx.printDataLabelsInner(t.node,e)}if(a.config.chart.accessibility.enabled){const t=a.dom.baseEl.querySelector(`.apexcharts-legend-series[rel="${e+1}"]`);if(t){const s=a.globals.collapsedSeriesIndices.includes(e);t.setAttribute("aria-pressed",s?"true":"false");const i=t.querySelector(".apexcharts-legend-text"),n=i?i.textContent:a.seriesData.seriesNames[e],o=s?"hidden":"visible";t.setAttribute("aria-label",`${n}, ${o}. Press Enter or Space to toggle.`)}}}}getSeriesAfterCollapsing({realIndex:e}){var t;const s=this.w,i=s.globals,a=m.clone(s.config.series);if(i.axisCharts){const t=s.config.yaxis[i.seriesYAxisReverseMap[e]],n={index:e,data:a[e].data.slice(),type:a[e].type||s.config.chart.type};if(t&&t.show&&t.showAlways)i.ancillaryCollapsedSeriesIndices.indexOf(e)<0&&(i.ancillaryCollapsedSeries.push(n),i.ancillaryCollapsedSeriesIndices.push(e));else if(i.collapsedSeriesIndices.indexOf(e)<0){i.collapsedSeries.push(n),i.collapsedSeriesIndices.push(e);const t=i.risingSeries.indexOf(e);i.risingSeries.splice(t,1)}}else i.collapsedSeries.push({index:e,data:a[e],type:null!=(t=s.config.series[e].type)?t:"line"}),i.collapsedSeriesIndices.push(e);return i.allSeriesCollapsed=i.collapsedSeries.length+i.ancillaryCollapsedSeries.length===s.config.series.length,this._getSeriesBasedOnCollapsedState(a)}hideSeries({seriesEl:e,realIndex:t}){const s=this.w,i=this.getSeriesAfterCollapsing({realIndex:t}),a=e.childNodes;for(let e=0;e<a.length;e++)a[e].classList.contains("apexcharts-series-markers-wrap")&&(a[e].classList.contains("apexcharts-hide")?a[e].classList.remove("apexcharts-hide"):a[e].classList.add("apexcharts-hide"));this.lgCtx.updateSeries(i,s.config.chart.animations.dynamicAnimation.enabled)}riseCollapsedSeries(e,t,s){const i=this.w;let a=m.clone(i.config.series);if(e.length>0){for(let n=0;n<e.length;n++)e[n].index===s&&(i.globals.axisCharts?a[s].data=e[n].data.slice():a[s]=e[n].data,"number"!=typeof a[s]&&(a[s].hidden=!1),e.splice(n,1),t.splice(n,1),i.globals.risingSeries.push(s),n--);a=this._getSeriesBasedOnCollapsedState(a),this.lgCtx.updateSeries(a,i.config.chart.animations.dynamicAnimation.enabled)}}_getSeriesBasedOnCollapsedState(e){const t=this.w;let s=0;return t.globals.axisCharts?e.forEach((i,a)=>{t.globals.collapsedSeriesIndices.indexOf(a)<0&&t.globals.ancillaryCollapsedSeriesIndices.indexOf(a)<0||(e[a].data=[],s++)}):e.forEach((i,a)=>{t.globals.collapsedSeriesIndices.indexOf(a)<0||(e[a]=0,s++)}),t.globals.allSeriesCollapsed=s===e.length,e}};const S=d.__apex_Markers,A=d.__apex_BrowserAPIs_BrowserAPIs;c.registerFeatures({legend:class{constructor(e,t){this.w=e,this.ctx=t,this.printDataLabelsInner=(...e)=>{var s;return null==(s=t.pie)?void 0:s.printDataLabelsInner(...e)},this.updateSeries=(...e)=>t.updateHelpers._updateSeries(...e),this.onLegendClick=this.onLegendClick.bind(this),this.onLegendHovered=this.onLegendHovered.bind(this),this.isBarsDistributed="bar"===this.w.config.chart.type&&this.w.config.plotOptions.bar.distributed&&1===this.w.config.series.length,this.legendHelpers=new C(this)}init(){const e=this.w,t=e.globals,s=e.config,i=s.legend.showForSingleSeries&&1===this.w.seriesData.series.length||this.isBarsDistributed||this.w.seriesData.series.length>1;if(this.legendHelpers.appendToForeignObject(),(i||!t.axisCharts)&&s.legend.show){const t=e.dom.elLegendWrap;for(;t.firstChild;)t.removeChild(t.firstChild);this.drawLegends(),"bottom"===s.legend.position||"top"===s.legend.position?this.legendAlignHorizontal():"right"!==s.legend.position&&"left"!==s.legend.position||this.legendAlignVertical()}}createLegendMarker({i:e,fillcolor:t}){const s=this.w,i=A.createElement("span");i.classList.add("apexcharts-legend-marker");const a=s.config.legend.markers.shape||s.config.markers.shape;let n=a;Array.isArray(a)&&(n=a[e]);const o=Array.isArray(s.config.legend.markers.size)?parseFloat(s.config.legend.markers.size[e]):parseFloat(s.config.legend.markers.size),c=Array.isArray(s.config.legend.markers.offsetX)?parseFloat(s.config.legend.markers.offsetX[e]):parseFloat(s.config.legend.markers.offsetX),h=Array.isArray(s.config.legend.markers.offsetY)?parseFloat(s.config.legend.markers.offsetY[e]):parseFloat(s.config.legend.markers.offsetY),d=Array.isArray(s.config.legend.markers.strokeWidth)?parseFloat(s.config.legend.markers.strokeWidth[e]):parseFloat(s.config.legend.markers.strokeWidth),g=i.style;if(g.height=2*(o+d)+"px",g.width=2*(o+d)+"px",g.left=c+"px",g.top=h+"px",s.config.legend.markers.customHTML)g.background="transparent",g.color=t[e],Array.isArray(s.config.legend.markers.customHTML)?s.config.legend.markers.customHTML[e]&&(i.innerHTML=s.config.legend.markers.customHTML[e]()):i.innerHTML=s.config.legend.markers.customHTML();else{const a=new S(this.ctx.w,this.ctx).getMarkerConfig({cssClass:`apexcharts-legend-marker apexcharts-marker apexcharts-marker-${n}`,seriesIndex:e,strokeWidth:d,size:o}),c=(f.isBrowser()?window.SVG:global.SVG)().addTo(i).size("100%","100%"),h=new v(this.w).drawMarker(0,0,r(l({},a),{pointFillColor:Array.isArray(t)?t[e]:a.pointFillColor,shape:n}));s.dom.Paper.find(".apexcharts-legend-marker.apexcharts-marker").forEach(e=>{e.node.classList.contains("apexcharts-marker-triangle")?e.node.style.transform="translate(50%, 45%)":e.node.style.transform="translate(50%, 50%)"}),c.add(h)}return i}drawLegends(){var e;const t=this,s=this.w,i=s.dom.elLegendWrap,a=s.config.legend.fontFamily;let n=s.seriesData.seriesNames,o=s.config.legend.markers.fillColors?s.config.legend.markers.fillColors.slice():s.globals.colors.slice();if("heatmap"===s.config.chart.type){const e=s.config.plotOptions.heatmap.colorScale.ranges;n=e.map(e=>e.name?e.name:e.from+" - "+e.to),o=e.map(e=>e.color)}else this.isBarsDistributed&&(n=s.labelData.labels.slice());s.config.legend.customLegendItems.length&&(n=s.config.legend.customLegendItems);const l=s.formatters.legendFormatter,r=s.config.legend.inverseOrder,c=[];s.labelData.seriesGroups.length>1&&s.config.legend.clusterGroupedSeries&&s.labelData.seriesGroups.forEach((e,t)=>{c[t]=A.createElement("div"),c[t].classList.add("apexcharts-legend-group",`apexcharts-legend-group-${t}`),"horizontal"===s.config.legend.clusterGroupedSeriesOrientation?i.classList.add("apexcharts-legend-group-horizontal"):c[t].classList.add("apexcharts-legend-group-vertical")});for(let t=r?n.length-1:0;r?t>=0:t<=n.length-1;r?t--:t++){const r=l(n[t],{seriesIndex:t,w:s});let h=!1,d=!1;if(s.globals.collapsedSeries.length>0)for(let e=0;e<s.globals.collapsedSeries.length;e++)s.globals.collapsedSeries[e].index===t&&(h=!0);if(s.globals.ancillaryCollapsedSeriesIndices.length>0)for(let e=0;e<s.globals.ancillaryCollapsedSeriesIndices.length;e++)s.globals.ancillaryCollapsedSeriesIndices[e]===t&&(d=!0);const g=this.createLegendMarker({i:t,fillcolor:o});v.setAttrs(g,{rel:t+1,"data:collapsed":h||d}),(h||d)&&g.classList.add("apexcharts-inactive-legend");const p=A.createElement("div");if(s.config.chart.accessibility.enabled&&s.config.chart.accessibility.keyboard.enabled){p.setAttribute("role","button"),p.setAttribute("tabindex","0");const e=Array.isArray(r)?r.join(" "):r,t=h||d,s=t?"hidden":"visible";p.setAttribute("aria-label",`${e}, ${s}. Press Enter or Space to toggle.`),p.setAttribute("aria-pressed",t?"true":"false")}const x=A.createElement("span");x.classList.add("apexcharts-legend-text"),x.innerHTML=Array.isArray(r)?r.join(" "):r;let u=s.config.legend.labels.useSeriesColors?s.globals.colors[t]:Array.isArray(s.config.legend.labels.colors)?null==(e=s.config.legend.labels.colors)?void 0:e[t]:s.config.legend.labels.colors;u||(u=s.config.chart.foreColor),x.style.color=u,x.style.fontSize=s.config.legend.fontSize,x.style.fontWeight=s.config.legend.fontWeight,x.style.fontFamily=a||s.config.chart.fontFamily,v.setAttrs(x,{rel:t+1,i:t,"data:default-text":encodeURIComponent(r),"data:collapsed":h||d}),p.appendChild(g),p.appendChild(x);const f=new y(this.w);if(!s.config.legend.showForZeroSeries){0===f.getSeriesTotalByIndex(t)&&f.seriesHaveSameValues(t)&&!f.isSeriesNull(t)&&-1===s.globals.collapsedSeriesIndices.indexOf(t)&&-1===s.globals.ancillaryCollapsedSeriesIndices.indexOf(t)&&p.classList.add("apexcharts-hidden-zero-series")}s.config.legend.showForNullSeries||f.isSeriesNull(t)&&-1===s.globals.collapsedSeriesIndices.indexOf(t)&&-1===s.globals.ancillaryCollapsedSeriesIndices.indexOf(t)&&p.classList.add("apexcharts-hidden-null-series"),c.length?s.labelData.seriesGroups.forEach((e,a)=>{var n,o;e.includes(null!=(o=null==(n=s.config.series[t])?void 0:n.name)?o:"")&&(i.appendChild(c[a]),c[a].appendChild(p))}):i.appendChild(p),i.classList.add(`apexcharts-align-${s.config.legend.horizontalAlign}`),i.classList.add("apx-legend-position-"+s.config.legend.position),p.classList.add("apexcharts-legend-series"),p.style.margin=`${s.config.legend.itemMargin.vertical}px ${s.config.legend.itemMargin.horizontal}px`,i.style.width=s.config.legend.width?s.config.legend.width+"px":"",i.style.height=s.config.legend.height?s.config.legend.height+"px":"",v.setAttrs(p,{rel:t+1,seriesName:m.escapeString(n[t]),"data:collapsed":h||d}),(h||d)&&p.classList.add("apexcharts-inactive-legend"),s.config.legend.onItemClick.toggleDataSeries||p.classList.add("apexcharts-no-click")}s.dom.elWrap.addEventListener("click",t.onLegendClick,!0),s.config.legend.onItemHover.highlightDataSeries&&0===s.config.legend.customLegendItems.length&&(s.dom.elWrap.addEventListener("mousemove",t.onLegendHovered,!0),s.dom.elWrap.addEventListener("mouseout",t.onLegendHovered,!0)),s.config.chart.accessibility.enabled&&s.config.chart.accessibility.keyboard.enabled&&s.dom.elWrap.addEventListener("keydown",t.onLegendKeyDown.bind(t),!0)}setLegendWrapXY(e,t){const s=this.w,i=s.dom.elLegendWrap,a=i.clientHeight;let n=0,o=0;if("bottom"===s.config.legend.position)o=s.globals.svgHeight-Math.min(a,s.globals.svgHeight/2)-5;else if("top"===s.config.legend.position){const e=new w(this.w,this.ctx),t=e.dimHelpers.getTitleSubtitleCoords("title").height,s=e.dimHelpers.getTitleSubtitleCoords("subtitle").height;o=(t>0?t-10:0)+(s>0?s-10:0)}i.style.position="absolute",n=n+e+s.config.legend.offsetX,o=o+t+s.config.legend.offsetY,i.style.left=n+"px",i.style.top=o+"px","right"===s.config.legend.position&&(i.style.left="auto",i.style.right=25+s.config.legend.offsetX+"px");["width","height"].forEach(e=>{i&&i.style[e]&&(i.style[e]=parseInt(String(s.config.legend[e]),10)+"px")})}legendAlignHorizontal(){const e=this.w;e.dom.elLegendWrap.style.right="0";const t=new w(this.w,this.ctx),s=t.dimHelpers.getTitleSubtitleCoords("title"),i=t.dimHelpers.getTitleSubtitleCoords("subtitle");let a=0;"top"===e.config.legend.position&&(a=s.height+i.height+e.config.title.margin+e.config.subtitle.margin-10),this.setLegendWrapXY(20,a)}legendAlignVertical(){const e=this.w,t=this.legendHelpers.getLegendDimensions();let s=0;"left"===e.config.legend.position&&(s=20),"right"===e.config.legend.position&&(s=e.globals.svgWidth-t.clww-10),this.setLegendWrapXY(s,20)}onLegendHovered(e){var t;const s=this.w,i=e.target,a=i.classList.contains("apexcharts-legend-series")||i.classList.contains("apexcharts-legend-text")||i.classList.contains("apexcharts-legend-marker");if("heatmap"===s.config.chart.type||this.isBarsDistributed){if(a){const s=parseInt(null!=(t=i.getAttribute("rel"))?t:"0",10)-1;this.ctx.events.fireEvent("legendHover",[this.ctx,s,this.w]);new u(this.ctx.w).highlightRangeInSeries(e,i)}}else if(!i.classList.contains("apexcharts-inactive-legend")&&a){new u(this.ctx.w).toggleSeriesOnHover(e,i)}}onLegendKeyDown(e){const t=this,s=this.w,i=e.target;if((i.classList.contains("apexcharts-legend-series")||i.classList.contains("apexcharts-legend-text")||i.classList.contains("apexcharts-legend-marker"))&&("Enter"===e.key||" "===e.key)){e.preventDefault();const a=i.getAttribute("rel");t.onLegendClick(e),null!==a&&s.config.legend.onItemClick.toggleDataSeries&&requestAnimationFrame(()=>{const e=s.dom.baseEl.querySelector(`.apexcharts-legend-series[rel="${a}"]`);e&&e.focus()})}}onLegendClick(e){var t;const s=this.w,i=e.target;if(!s.config.legend.customLegendItems.length&&(i.classList.contains("apexcharts-legend-series")||i.classList.contains("apexcharts-legend-text")||i.classList.contains("apexcharts-legend-marker"))){const e=parseInt(null!=(t=i.getAttribute("rel"))?t:"0",10)-1,a="true"===i.getAttribute("data:collapsed"),n=this.w.config.chart.events.legendClick;"function"==typeof n&&n(this.ctx,e,this.w),this.ctx.events.fireEvent("legendClick",[this.ctx,e,this.w]);const o=this.w.config.legend.markers.onClick;"function"==typeof o&&i.classList.contains("apexcharts-legend-marker")&&(o(this.ctx,e,this.w),this.ctx.events.fireEvent("legendMarkerClick",[this.ctx,e,this.w]));"treemap"!==s.config.chart.type&&"heatmap"!==s.config.chart.type&&!this.isBarsDistributed&&s.config.legend.onItemClick.toggleDataSeries&&this.legendHelpers.toggleDataSeries(e,a)}}}});class k{constructor(e,t){this.w=e,this.ctx=t,this.ev=this.w.config.chart.events,this.selectedClass="apexcharts-selected",this.localeValues=this.w.globals.locale.toolbar,this.minX=e.globals.minX,this.maxX=e.globals.maxX,this.elZoom=null,this.elZoomIn=null,this.elZoomOut=null,this.elPan=null,this.elSelection=null,this.elZoomReset=null,this.elMenuIcon=null,this.elMenu=null,this.elMenuItems=[],this.t=null}createToolbar(){const e=this.w,t=()=>A.createElementNS("http://www.w3.org/1999/xhtml","div"),s=t();if(s.setAttribute("class","apexcharts-toolbar"),s.style.top=e.config.chart.toolbar.offsetY+"px",s.style.right=3-e.config.chart.toolbar.offsetX+"px",e.dom.elWrap.appendChild(s),this.elZoom=t(),this.elZoomIn=t(),this.elZoomOut=t(),this.elPan=t(),this.elSelection=t(),this.elZoomReset=t(),this.elMenuIcon=t(),this.elMenu=t(),this.elCustomIcons=[],this.t=e.config.chart.toolbar.tools,Array.isArray(this.t.customIcons))for(let e=0;e<this.t.customIcons.length;e++)this.elCustomIcons.push(t());const i=[],a=(t,s,a)=>{const n=t.toLowerCase();this.t[n]&&e.config.chart.zoom.enabled&&i.push({el:s,icon:"string"==typeof this.t[n]?this.t[n]:a,title:this.localeValues[t],class:`apexcharts-${n}-icon`})};a("zoomIn",this.elZoomIn,'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">\n <path d="M0 0h24v24H0z" fill="none"/>\n <path d="M13 7h-2v4H7v2h4v4h2v-4h4v-2h-4V7zm-1-5C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"/>\n</svg>\n'),a("zoomOut",this.elZoomOut,'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">\n <path d="M0 0h24v24H0z" fill="none"/>\n <path d="M7 11v2h10v-2H7zm5-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"/>\n</svg>\n');const n=t=>{this.t[t]&&e.config.chart[t].enabled&&i.push({el:"zoom"===t?this.elZoom:this.elSelection,icon:"string"==typeof this.t[t]?this.t[t]:"zoom"===t?'<svg xmlns="http://www.w3.org/2000/svg" fill="#000000" height="24" viewBox="0 0 24 24" width="24">\n <path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"/>\n <path d="M0 0h24v24H0V0z" fill="none"/>\n <path d="M12 10h-2v2H9v-2H7V9h2V7h1v2h2v1z"/>\n</svg>':'<svg fill="#6E8192" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">\n <path d="M0 0h24v24H0z" fill="none"/>\n <path d="M3 5h2V3c-1.1 0-2 .9-2 2zm0 8h2v-2H3v2zm4 8h2v-2H7v2zM3 9h2V7H3v2zm10-6h-2v2h2V3zm6 0v2h2c0-1.1-.9-2-2-2zM5 21v-2H3c0 1.1.9 2 2 2zm-2-4h2v-2H3v2zM9 3H7v2h2V3zm2 18h2v-2h-2v2zm8-8h2v-2h-2v2zm0 8c1.1 0 2-.9 2-2h-2v2zm0-12h2V7h-2v2zm0 8h2v-2h-2v2zm-4 4h2v-2h-2v2zm0-16h2V3h-2v2z"/>\n</svg>',title:this.localeValues["zoom"===t?"selectionZoom":"selection"],class:`apexcharts-${t}-icon`})};n("zoom"),n("selection"),this.t.pan&&e.config.chart.zoom.enabled&&i.push({el:this.elPan,icon:"string"==typeof this.t.pan?this.t.pan:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="#000000" height="24" viewBox="0 0 24 24" width="24">\n <defs>\n <path d="M0 0h24v24H0z" id="a"/>\n </defs>\n <clipPath id="b">\n <use overflow="visible" xlink:href="#a"/>\n </clipPath>\n <path clip-path="url(#b)" d="M23 5.5V20c0 2.2-1.8 4-4 4h-7.3c-1.08 0-2.1-.43-2.85-1.19L1 14.83s1.26-1.23 1.3-1.25c.22-.19.49-.29.79-.29.22 0 .42.06.6.16.04.01 4.31 2.46 4.31 2.46V4c0-.83.67-1.5 1.5-1.5S11 3.17 11 4v7h1V1.5c0-.83.67-1.5 1.5-1.5S15 .67 15 1.5V11h1V2.5c0-.83.67-1.5 1.5-1.5s1.5.67 1.5 1.5V11h1V5.5c0-.83.67-1.5 1.5-1.5s1.5.67 1.5 1.5z"/>\n</svg>',title:this.localeValues.pan,class:"apexcharts-pan-icon"}),a("reset",this.elZoomReset,'<svg fill="#000000" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">\n <path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"/>\n <path d="M0 0h24v24H0z" fill="none"/>\n</svg>'),this.t.download&&i.push({el:this.elMenuIcon,icon:"string"==typeof this.t.download?this.t.download:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0V0z"/><path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z"/></svg>',title:this.localeValues.menu,class:"apexcharts-menu-icon"});for(let e=0;e<this.elCustomIcons.length;e++)i.push({el:this.elCustomIcons[e],icon:this.t.customIcons[e].icon,title:this.t.customIcons[e].title,index:this.t.customIcons[e].index,class:"apexcharts-toolbar-custom-icon "+this.t.customIcons[e].class});i.forEach((e,t)=>{e.index&&m.moveIndexInArray(i,t,e.index)});for(let e=0;e<i.length;e++)v.setAttrs(i[e].el,{class:i[e].class,title:i[e].title,tabindex:"0",role:"button","aria-label":i[e].title}),i[e].el.innerHTML=i[e].icon,s.appendChild(i[e].el);this.elZoom.parentNode&&this.elZoom.setAttribute("aria-pressed",String(!!e.interact.zoomEnabled)),this.elSelection.parentNode&&this.elSelection.setAttribute("aria-pressed",String(!!e.interact.selectionEnabled)),this.elPan.parentNode&&this.elPan.setAttribute("aria-pressed",String(!!e.interact.panEnabled)),this.elMenuIcon.parentNode&&(this.elMenuIcon.setAttribute("aria-haspopup","true"),this.elMenuIcon.setAttribute("aria-expanded","false")),this._createHamburgerMenu(s),e.interact.zoomEnabled?this.elZoom.classList.add(this.selectedClass):e.interact.panEnabled?this.elPan.classList.add(this.selectedClass):e.interact.selectionEnabled&&this.elSelection.classList.add(this.selectedClass),this.addToolbarEventListeners()}_createHamburgerMenu(e){this.elMenuItems=[],e.appendChild(this.elMenu),v.setAttrs(this.elMenu,{class:"apexcharts-menu",role:"menu"});const t=[{name:"exportSVG",title:this.localeValues.exportToSVG},{name:"exportPNG",title:this.localeValues.exportToPNG},{name:"exportCSV",title:this.localeValues.exportToCSV}];for(let e=0;e<t.length;e++)this.elMenuItems.push(A.createElementNS("http://www.w3.org/1999/xhtml","div")),this.elMenuItems[e].innerHTML=t[e].title,v.setAttrs(this.elMenuItems[e],{class:`apexcharts-menu-item ${t[e].name}`,title:t[e].title,role:"menuitem",tabindex:"-1"}),this.elMenu.appendChild(this.elMenuItems[e])}addToolbarEventListeners(){var e,t,s,i,a,n,o,l;null==(e=this.elZoomReset)||e.addEventListener("click",this.handleZoomReset.bind(this)),null==(t=this.elSelection)||t.addEventListener("click",this.toggleZoomSelection.bind(this,"selection")),null==(s=this.elZoom)||s.addEventListener("click",this.toggleZoomSelection.bind(this,"zoom")),null==(i=this.elZoomIn)||i.addEventListener("click",this.handleZoomIn.bind(this)),null==(a=this.elZoomOut)||a.addEventListener("click",this.handleZoomOut.bind(this)),null==(n=this.elPan)||n.addEventListener("click",this.togglePanning.bind(this)),null==(o=this.elMenuIcon)||o.addEventListener("click",this.toggleMenu.bind(this)),this.elMenuItems.forEach(e=>{e.classList.contains("exportSVG")?e.addEventListener("click",this.handleDownload.bind(this,"svg")):e.classList.contains("exportPNG")?e.addEventListener("click",this.handleDownload.bind(this,"png")):e.classList.contains("exportCSV")&&e.addEventListener("click",this.handleDownload.bind(this,"csv"))});for(let e=0;e<this.t.customIcons.length;e++)this.elCustomIcons[e].addEventListener("click",this.t.customIcons[e].click.bind(this,this.ctx,this.ctx.w));[this.elZoomReset,this.elSelection,this.elZoom,this.elZoomIn,this.elZoomOut,this.elPan,this.elMenuIcon,...this.elCustomIcons].forEach(e=>{e.addEventListener("keydown",t=>{if("Enter"===t.key||" "===t.key){t.preventDefault();const s=e.className;e.click(),requestAnimationFrame(()=>{const e=this.w.dom.baseEl;if(!e)return;const t=s.split(" ").find(e=>e.startsWith("apexcharts-"));if(!t)return;const i=e.querySelector(`.${t}`);i&&i.focus()})}})}),null==(l=this.elMenuIcon)||l.addEventListener("keydown",e=>{var t;"ArrowDown"!==e.key&&"ArrowUp"!==e.key||(e.preventDefault(),(null==(t=this.elMenu)?void 0:t.classList.contains("apexcharts-menu-open"))||this.toggleMenu(),window.setTimeout(()=>{const t="ArrowDown"===e.key?0:this.elMenuItems.length-1;this.elMenuItems[t]&&this.elMenuItems[t].focus()},20))}),this.elMenuItems.forEach((e,t)=>{e.addEventListener("keydown",s=>{var i;if("ArrowDown"===s.key){s.preventDefault();(this.elMenuItems[t+1]||this.elMenuItems[0]).focus()}else if("ArrowUp"===s.key){s.preventDefault();(this.elMenuItems[t-1]||this.elMenuItems[this.elMenuItems.length-1]).focus()}else"Escape"===s.key||"Tab"===s.key?(this._closeMenu(),null==(i=this.elMenuIcon)||i.focus(),"Tab"===s.key||s.preventDefault()):"Enter"!==s.key&&" "!==s.key||(s.preventDefault(),e.click())})})}toggleZoomSelection(e){this.ctx.getSyncedCharts().forEach(t=>{t.ctx.toolbar.toggleOtherControls();const s="selection"===e?t.ctx.toolbar.elSelection:t.ctx.toolbar.elZoom,i="selection"===e?"selectionEnabled":"zoomEnabled";t.w.globals[i]=!t.w.globals[i],s.classList.contains(t.ctx.toolbar.selectedClass)?s.classList.remove(t.ctx.toolbar.selectedClass):s.classList.add(t.ctx.toolbar.selectedClass),s.setAttribute("aria-pressed",String(t.w.globals[i]))})}getToolbarIconsReference(){const e=this.w;this.elZoom||(this.elZoom=e.dom.baseEl.querySelector(".apexcharts-zoom-icon")),this.elPan||(this.elPan=e.dom.baseEl.querySelector(".apexcharts-pan-icon")),this.elSelection||(this.elSelection=e.dom.baseEl.querySelector(".apexcharts-selection-icon"))}enableZoomPanFromToolbar(e){this.toggleOtherControls(),"pan"===e?this.w.interact.panEnabled=!0:this.w.interact.zoomEnabled=!0;const t="pan"===e?this.elPan:this.elZoom,s="pan"===e?this.elZoom:this.elPan;t&&t.classList.add(this.selectedClass),s&&s.classList.remove(this.selectedClass)}togglePanning(){this.ctx.getSyncedCharts().forEach(e=>{e.ctx.toolbar.toggleOtherControls(),e.w.interact.panEnabled=!e.w.interact.panEnabled,e.ctx.toolbar.elPan.classList.contains(e.ctx.toolbar.selectedClass)?e.ctx.toolbar.elPan.classList.remove(e.ctx.toolbar.selectedClass):e.ctx.toolbar.elPan.classList.add(e.ctx.toolbar.selectedClass),e.ctx.toolbar.elPan.setAttribute("aria-pressed",String(e.w.interact.panEnabled))})}toggleOtherControls(){const e=this.w;e.interact.panEnabled=!1,e.interact.zoomEnabled=!1,e.interact.selectionEnabled=!1,this.getToolbarIconsReference();[this.elPan,this.elSelection,this.elZoom].forEach(e=>{e&&e.classList.remove(this.selectedClass)})}handleZoomIn(){const e=this.w;e.axisFlags.isRangeBar&&(this.minX=e.globals.minY,this.maxX=e.globals.maxY);const t=(this.minX+this.maxX)/2,s=(this.minX+t)/2,i=(this.maxX+t)/2,a=this._getNewMinXMaxX(s,i);e.interact.disableZoomIn||this.zoomUpdateOptions(a.minX,a.maxX)}handleZoomOut(){const e=this.w;if(e.axisFlags.isRangeBar&&(this.minX=e.globals.minY,this.maxX=e.globals.maxY),"datetime"===e.config.xaxis.type&&new Date(this.minX).getUTCFullYear()<1e3)return;const t=(this.minX+this.maxX)/2,s=this.minX-(t-this.minX),i=this.maxX-(t-this.maxX),a=this._getNewMinXMaxX(s,i);e.interact.disableZoomOut||this.zoomUpdateOptions(a.minX,a.maxX)}_getNewMinXMaxX(e,t){const s=this.w.config.xaxis.convertedCatToNumeric;return{minX:s?Math.floor(e):e,maxX:s?Math.floor(t):t}}zoomUpdateOptions(e,t){const s=this.w;if(void 0===e&&void 0===t)return void this.handleZoomReset();if(s.config.xaxis.convertedCatToNumeric&&(e<1&&(e=1,t=s.globals.dataPoints),t-e<2))return;let i={min:e,max:t};const a=this.getBeforeZoomRange(i,void 0);a&&(i=a.xaxis);const n={xaxis:i};if(!s.globals.initialConfig)return;const o=m.clone(s.globals.initialConfig.yaxis);s.config.chart.group||(n.yaxis=o),this.w.interact.zoomed=!0,this.ctx.updateHelpers._updateOptions(n,!1,this.w.config.chart.animations.dynamicAnimation.enabled),this.zoomCallback(i,o)}zoomCallback(e,t){"function"==typeof this.ev.zoomed&&(this.ev.zoomed(this.ctx,{xaxis:e,yaxis:t}),this.ctx.events.fireEvent("zoomed",{xaxis:e,yaxis:t}))}getBeforeZoomRange(e,t){let s=null;return"function"==typeof this.ev.beforeZoom&&(s=this.ev.beforeZoom(this,{xaxis:e,yaxis:t})),s}toggleMenu(){window.setTimeout(()=>{var e,t,s;(null==(e=this.elMenu)?void 0:e.classList.contains("apexcharts-menu-open"))?this._closeMenu():(null==(t=this.elMenu)||t.classList.add("apexcharts-menu-open"),null==(s=this.elMenuIcon)||s.setAttribute("aria-expanded","true"))},0)}_closeMenu(){var e,t;null==(e=this.elMenu)||e.classList.remove("apexcharts-menu-open"),null==(t=this.elMenuIcon)||t.setAttribute("aria-expanded","false")}handleDownload(e){const t=this.w,s=new b(this.w,this.ctx);switch(e){case"svg":s.exportToSVG();break;case"png":s.exportToPng();break;case"csv":s.exportToCSV({series:t.config.series,columnDelimiter:t.config.chart.toolbar.export.csv.columnDelimiter})}}handleZoomReset(){this.ctx.getSyncedCharts().forEach(e=>{const t=e.w;if(!t.interact.zoomed)return;if(t.globals.lastXAxis.min=t.globals.initialConfig.xaxis.min,t.globals.lastXAxis.max=t.globals.initialConfig.xaxis.max,e.updateHelpers.revertDefaultAxisMinMax(),"function"==typeof t.config.chart.events.beforeResetZoom){const s=t.config.chart.events.beforeResetZoom(e,t);s&&e.updateHelpers.revertDefaultAxisMinMax(s)}"function"==typeof t.config.chart.events.zoomed&&e.ctx.toolbar.zoomCallback({min:t.config.xaxis.min,max:t.config.xaxis.max});const s=e.ctx.series.emptyCollapsedSeries(m.clone(t.globals.initialSeries));e.updateHelpers._updateSeries(s,t.config.chart.animations.dynamicAnimation.enabled),t.interact.zoomed=!1})}destroy(){this.elZoom=null,this.elZoomIn=null,this.elZoomOut=null,this.elPan=null,this.elSelection=null,this.elZoomReset=null,this.elMenuIcon=null}}const E=d.__apex_index_Box;c.registerFeatures({toolbar:k,zoomPanSelection:class extends k{constructor(e,t){super(e,t),this.w=e,this.ctx=t,this.dragged=!1,this.graphics=new v(this.w),this.eventList=["mousedown","mouseleave","mousemove","touchstart","touchmove","mouseup","touchend","wheel"],this.clientX=0,this.clientY=0,this.startX=0,this.endX=0,this.dragX=0,this.startY=0,this.endY=0,this.dragY=0,this.moveDirection="none",this.debounceTimer=null,this.debounceDelay=100,this.wheelDelay=400}init({xyRatios:e}){const t=this.w,s=this;this.xyRatios=e,this.zoomRect=this.graphics.drawRect(0,0,0,0),this.selectionRect=this.graphics.drawRect(0,0,0,0),this.gridRect=t.dom.baseEl.querySelector(".apexcharts-grid"),this.constraints=new E(0,0,t.layout.gridWidth,t.layout.gridHeight),this.zoomRect.node.classList.add("apexcharts-zoom-rect"),this.selectionRect.node.classList.add("apexcharts-selection-rect"),t.dom.Paper.add(this.zoomRect),t.dom.Paper.add(this.selectionRect),"x"===t.config.chart.selection.type?this.slDraggableRect=this.selectionRect.draggable({minX:0,minY:0,maxX:t.layout.gridWidth,maxY:t.layout.gridHeight}).on("dragmove.namespace",this.selectionDragging.bind(this,"dragging")):"y"===t.config.chart.selection.type?this.slDraggableRect=this.selectionRect.draggable({minX:0,maxX:t.layout.gridWidth}).on("dragmove.namespace",this.selectionDragging.bind(this,"dragging")):this.slDraggableRect=this.selectionRect.draggable().on("dragmove.namespace",this.selectionDragging.bind(this,"dragging")),this.preselectedSelection(),this.hoverArea=t.dom.baseEl.querySelector(`${t.globals.chartClass} .apexcharts-svg`),this.hoverArea&&(this.hoverArea.classList.add("apexcharts-zoomable"),this.eventList.forEach(t=>{var i;null==(i=this.hoverArea)||i.addEventListener(t,s.svgMouseEvents.bind(s,e),{capture:!1,passive:!0})}),t.config.chart.zoom.enabled&&t.config.chart.zoom.allowMouseWheelZoom&&this.hoverArea.addEventListener("wheel",s.mouseWheelEvent.bind(s),{capture:!1,passive:!1}))}destroy(){this.slDraggableRect&&(this.slDraggableRect.draggable(!1),this.slDraggableRect.off(),this.selectionRect.off()),this.selectionRect=null,this.zoomRect=null,this.gridRect=null}svgMouseEvents(e,t){var s;const i=this.w,a=this.ctx.toolbar,n=i.interact.zoomEnabled?i.config.chart.zoom.type:i.config.chart.selection.type,o=i.config.chart.toolbar.autoSelected;if(t.shiftKey?(this.shiftWasPressed=!0,a.enableZoomPanFromToolbar("pan"===o?"zoom":"pan")):this.shiftWasPressed&&(a.enableZoomPanFromToolbar(o),this.shiftWasPressed=!1),!t.target)return;const l=t.target.classList;let r;t.target.parentNode&&null!==t.target.parentNode&&(r=t.target.parentNode.classList);if(!(l.contains("apexcharts-legend-marker")||l.contains("apexcharts-legend-text")||r&&r.contains("apexcharts-toolbar"))){if(this.clientX="touchmove"===t.type||"touchstart"===t.type?t.touches[0].clientX:"touchend"===t.type?t.changedTouches[0].clientX:t.clientX,this.clientY="touchmove"===t.type||"touchstart"===t.type?t.touches[0].clientY:"touchend"===t.type?t.changedTouches[0].clientY:t.clientY,"mousedown"===t.type&&1===t.which||"touchstart"===t.type){const e=null==(s=this.gridRect)?void 0:s.getBoundingClientRect();if(!e)return;this.startX=this.clientX-e.left-i.globals.barPadForNumericAxis,this.startY=this.clientY-e.top,this.dragged=!1,this.w.interact.mousedown=!0}("mousemove"===t.type&&1===t.which||"touchmove"===t.type)&&(this.dragged=!0,i.interact.panEnabled?(i.interact.selection=null,this.w.interact.mousedown&&this.panDragging({context:this,zoomtype:n,xyRatios:e})):(this.w.interact.mousedown&&i.interact.zoomEnabled||this.w.interact.mousedown&&i.interact.selectionEnabled)&&(this.selection=this.selectionDrawing({context:this,zoomtype:n}))),"mouseup"!==t.type&&"touchend"!==t.type&&"mouseleave"!==t.type||this.handleMouseUp({zoomtype:n}),this.makeSelectionRectDraggable()}}handleMouseUp({zoomtype:e,isResized:t}){var s;const i=this.w,a=null==(s=this.gridRect)?void 0:s.getBoundingClientRect();a&&(this.w.interact.mousedown||t)&&(this.endX=this.clientX-a.left-i.globals.barPadForNumericAxis,this.endY=this.clientY-a.top,this.dragX=Math.abs(this.endX-this.startX),this.dragY=Math.abs(this.endY-this.startY),(i.interact.zoomEnabled||i.interact.selectionEnabled)&&this.selectionDrawn({context:this,zoomtype:e})),i.interact.zoomEnabled&&this.hideSelectionRect(this.selectionRect),this.dragged=!1,this.w.interact.mousedown=!1}mouseWheelEvent(e){const t=this.w;e.preventDefault();const s=Date.now();s-t.interact.lastWheelExecution>this.wheelDelay&&(this.executeMouseWheelZoom(e),t.interact.lastWheelExecution=s),this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(()=>{s-t.interact.lastWheelExecution>this.wheelDelay&&(this.executeMouseWheelZoom(e),t.interact.lastWheelExecution=s)},this.debounceDelay)}executeMouseWheelZoom(e){var t;const s=this.w;this.minX=s.axisFlags.isRangeBar?s.globals.minY:s.globals.minX,this.maxX=s.axisFlags.isRangeBar?s.globals.maxY:s.globals.maxX;const i=null==(t=this.gridRect)?void 0:t.getBoundingClientRect();if(!i)return;const a=(e.clientX-i.left)/i.width,n=this.minX,o=this.maxX,l=o-n;let r,c,h;if(e.deltaY<0){r=.5*l;const e=n+a*l;c=e-r/2,h=e+r/2}else r=1.5*l,c=n-r/2,h=o+r/2;if(!s.axisFlags.isRangeBar){c=Math.max(c,s.globals.initialMinX),h=Math.min(h,s.globals.initialMaxX);const e=.01*(s.globals.initialMaxX-s.globals.initialMinX);if(h-c<e){const t=(c+h)/2;c=t-e/2,h=t+e/2}}const d=this._getNewMinXMaxX(c,h);isNaN(d.minX)||isNaN(d.maxX)||this.zoomUpdateOptions(d.minX,d.maxX)}makeSelectionRectDraggable(){const e=this.w;if(!this.selectionRect)return;const t=this.selectionRect.node.getBoundingClientRect();t.width>0&&t.height>0&&(this.selectionRect.select(!1).resize(!1),this.selectionRect.select({createRot:()=>{},updateRot:()=>{},createHandle:(e,t,s,i,a)=>"l"===a||"r"===a?e.circle(8).css({"stroke-width":1,stroke:"#333",fill:"#fff"}):e.circle(0),updateHandle:(e,t)=>e.center(t[0],t[1])}).resize().on("resize",()=>{const t=e.interact.zoomEnabled?e.config.chart.zoom.type:e.config.chart.selection.type;this.handleMouseUp({zoomtype:t,isResized:!0})}))}preselectedSelection(){const e=this.w,t=this.xyRatios;if(!e.interact.zoomEnabled)if(void 0!==e.interact.selection&&null!==e.interact.selection)this.drawSelectionRect(r(l({},e.interact.selection),{translateX:e.layout.translateX,translateY:e.layout.translateY}));else if(void 0!==e.config.chart.selection.xaxis.min&&void 0!==e.config.chart.selection.xaxis.max){let s=(e.config.chart.selection.xaxis.min-e.globals.minX)/t.xRatio,i=e.layout.gridWidth-(e.globals.maxX-e.config.chart.selection.xaxis.max)/t.xRatio-s;e.axisFlags.isRangeBar&&(s=(e.config.chart.selection.xaxis.min-e.globals.yAxisScale[0].niceMin)/t.invertedYRatio,i=(e.config.chart.selection.xaxis.max-e.config.chart.selection.xaxis.min)/t.invertedYRatio);const a={x:s,y:0,width:i,height:e.layout.gridHeight,translateX:e.layout.translateX,translateY:e.layout.translateY,selectionEnabled:!0};this.drawSelectionRect(a),this.makeSelectionRectDraggable(),"function"==typeof e.config.chart.events.selection&&e.config.chart.events.selection(this.ctx,{xaxis:{min:e.config.chart.selection.xaxis.min,max:e.config.chart.selection.xaxis.max},yaxis:{}})}}drawSelectionRect({x:e,y:t,width:s,height:i,translateX:a=0,translateY:n=0}){const o=this.w,l=this.zoomRect,r=this.selectionRect;if(this.dragged||null!==o.interact.selection){const c={transform:"translate("+a+", "+n+")"};o.interact.zoomEnabled&&this.dragged&&(s<0&&(s=1),l.attr({x:e,y:t,width:s,height:i,fill:o.config.chart.zoom.zoomedArea.fill.color,"fill-opacity":o.config.chart.zoom.zoomedArea.fill.opacity,stroke:o.config.chart.zoom.zoomedArea.stroke.color,"stroke-width":o.config.chart.zoom.zoomedArea.stroke.width,"stroke-opacity":o.config.chart.zoom.zoomedArea.stroke.opacity}),v.setAttrs(l.node,c)),o.interact.selectionEnabled&&(r.attr({x:e,y:t,width:s>0?s:0,height:i>0?i:0,fill:o.config.chart.selection.fill.color,"fill-opacity":o.config.chart.selection.fill.opacity,stroke:o.config.chart.selection.stroke.color,"stroke-width":o.config.chart.selection.stroke.width,"stroke-dasharray":o.config.chart.selection.stroke.dashArray,"stroke-opacity":o.config.chart.selection.stroke.opacity}),v.setAttrs(r.node,c))}}hideSelectionRect(e){e&&e.attr({x:0,y:0,width:0,height:0})}selectionDrawing({context:e,zoomtype:t}){var s;const i=this.w,a=e,n=null==(s=this.gridRect)?void 0:s.getBoundingClientRect();if(!n)return;const o=a.startX-1,c=a.startY;let h=!1,d=!1;const g=a.clientX-n.left-i.globals.barPadForNumericAxis,p=a.clientY-n.top;let x=g-o,u=p-c,m={translateX:i.layout.translateX,translateY:i.layout.translateY};return Math.abs(x+o)>i.layout.gridWidth?x=i.layout.gridWidth-o:g<0&&(x=o),o>g&&(h=!0,x=Math.abs(x)),c>p&&(d=!0,u=Math.abs(u)),m="x"===t?{x:h?o-x:o,y:0,width:x,height:i.layout.gridHeight}:"y"===t?{x:0,y:d?c-u:c,width:i.layout.gridWidth,height:u}:{x:h?o-x:o,y:d?c-u:c,width:x,height:u},m=r(l({},m),{translateX:i.layout.translateX,translateY:i.layout.translateY}),a.drawSelectionRect(m),a.selectionDragging("resizing"),m}selectionDragging(e,t){var s;const i=this.w;if(!t)return;t.preventDefault();const{handler:a,box:n}=t.detail,o=this.constraints;let{x:l,y:r}=n;l<o.x&&(l=o.x),r<o.y&&(r=o.y),n.x2>o.x2&&(l=o.x2-n.w),n.y2>o.y2&&(r=o.y2-n.h),a.move(l,r);const c=this.xyRatios,h=this.selectionRect;let d=0;"resizing"===e&&(d=30);const g=e=>parseFloat(h.node.getAttribute(e)),p={x:g("x"),y:g("y"),width:g("width"),height:g("height")};i.interact.selection=p,"function"==typeof i.config.chart.events.selection&&i.interact.selectionEnabled&&(clearTimeout(null!=(s=this.w.globals.selectionResizeTimer)?s:void 0),this.w.globals.selectionResizeTimer=window.setTimeout(()=>{var e;const t=null==(e=this.gridRect)?void 0:e.getBoundingClientRect();if(!t)return;const s=h.node.getBoundingClientRect();let a,n,o,l;if(i.axisFlags.isRangeBar)a=i.globals.yAxisScale[0].niceMin+(s.left-t.left)*c.invertedYRatio,n=i.globals.yAxisScale[0].niceMin+(s.right-t.left)*c.invertedYRatio,o=0,l=1;else{if(!i.globals.xAxisScale)return;a=i.globals.xAxisScale.niceMin+(s.left-t.left)*c.xRatio,n=i.globals.xAxisScale.niceMin+(s.right-t.left)*c.xRatio,o=i.globals.yAxisScale[0].niceMin+(t.bottom-s.bottom)*c.yRatio[0],l=i.globals.yAxisScale[0].niceMax-(s.top-t.top)*c.yRatio[0]}const r={xaxis:{min:a,max:n},yaxis:{min:o,max:l}};i.config.chart.events.selection(this.ctx,r),i.config.chart.brush.enabled&&void 0!==i.config.chart.events.brushScrolled&&i.config.chart.events.brushScrolled(this.ctx,r)},d))}selectionDrawn({context:e,zoomtype:t}){var s,i;const a=this.w,n=e,o=this.xyRatios,l=this.ctx.toolbar,r=a.inter