apexcharts
Version:
A JavaScript Chart Library
5 lines • 104 kB
JavaScript
/*!
* ApexCharts v5.15.0
* (c) 2018-2026 ApexCharts
*/
"use strict";var t=Object.defineProperty,e=Object.defineProperties,s=Object.getOwnPropertyDescriptors,i=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable,o=(e,s,i)=>s in e?t(e,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[s]=i,l=(t,e)=>{for(var s in e||(e={}))n.call(e,s)&&o(t,s,e[s]);if(i)for(var s of i(e))a.call(e,s)&&o(t,s,e[s]);return t},r=(t,i)=>e(t,s(i));const c=require("apexcharts/core");function h(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t)for(const s in t)if("default"!==s){const i=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(e,s,i.get?i:{enumerable:!0,get:()=>t[s]})}return e.default=t,Object.freeze(e)}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,u=d.__apex_Data,x=d.__apex_Series,m=d.__apex_Utils,f=d.__apex_Environment_Environment;class b{constructor(t,e){this.w=t,this.ctx=e}svgStringToNode(t){return(new DOMParser).parseFromString(t,"image/svg+xml").documentElement}scaleSvgNode(t,e){const s=parseFloat(t.getAttributeNS(null,"width")),i=parseFloat(t.getAttributeNS(null,"height"));t.setAttributeNS(null,"width",s*e),t.setAttributeNS(null,"height",i*e),t.setAttributeNS(null,"viewBox","0 0 "+s+" "+i)}getSvgString(t){return new Promise(e=>{const s=this.w;let i=t||s.config.chart.toolbar.export.scale||s.config.chart.toolbar.export.width/s.globals.svgWidth;i||(i=1);const n=s.globals.svgWidth*i,a=s.globals.svgHeight*i,o=s.dom.elWrap.cloneNode(!0);o.style.width=n+"px",o.style.height=a+"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:${n}px; height:${a}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),e(c.replace(/ /g," "))})})}convertImagesToBase64(t){const e=t.getElementsByTagName("image"),s=Array.from(e).map(t=>{const e=t.getAttributeNS("http://www.w3.org/1999/xlink","href");return e&&!e.startsWith("data:")?this.getBase64FromUrl(e).then(e=>{t.setAttributeNS("http://www.w3.org/1999/xlink","href",e)}).catch(t=>{}):Promise.resolve()});return Promise.all(s)}getBase64FromUrl(t){return f.isSSR()?Promise.resolve(t):new Promise((e,s)=>{const i=new Image;i.crossOrigin="Anonymous",i.onload=()=>{const t=document.createElement("canvas");t.width=i.width,t.height=i.height;const s=t.getContext("2d");s&&s.drawImage(i,0,0),e(t.toDataURL())},i.onerror=s,i.src=t})}svgUrl(){return new Promise(t=>{this.getSvgString().then(e=>{const s=new Blob([e],{type:"image/svg+xml;charset=utf-8"});t(URL.createObjectURL(s))})})}dataURI(t){return f.isSSR()?Promise.resolve({imgURI:""}):new Promise(e=>{const s=this.w,i=t?t.scale||t.width/s.globals.svgWidth:1,n=document.createElement("canvas");n.width=s.globals.svgWidth*i,n.height=parseInt(s.dom.elWrap.style.height,10)*i;const a="transparent"!==s.config.chart.background&&s.config.chart.background?s.config.chart.background:"#fff",o=n.getContext("2d");o&&(o.fillStyle=a,o.fillRect(0,0,n.width*i,n.height*i),this.getSvgString(i).then(t=>{const s="data:image/svg+xml,"+encodeURIComponent(t),i=new Image;i.crossOrigin="anonymous",i.onload=()=>{o.drawImage(i,0,0);const t=n;if(t.msToBlob){const s=t.msToBlob();e({blob:s})}else{const t=n.toDataURL("image/png");e({imgURI:t})}},i.src=s}))})}exportToSVG(){this.svgUrl().then(t=>{this.triggerDownload(t,this.w.config.chart.toolbar.export.svg.filename,".svg")})}exportToPng(){const t=this.w.config.chart.toolbar.export.scale,e=this.w.config.chart.toolbar.export.width,s=t?{scale:t}:e?{width:e}:void 0;this.dataURI(s).then(({imgURI:t,blob:e})=>{e?navigator.msSaveOrOpenBlob(e,this.w.globals.chartID+".png"):this.triggerDownload(t,this.w.config.chart.toolbar.export.png.filename,".png")})}exportToCSV({series:t,fileName:e,columnDelimiter:s=",",lineDelimiter:i="\n"}){const n=this.w;t||(t=n.config.series);let a=[];const o=[];let l="";const r=n.seriesData.series.map((t,e)=>-1===n.globals.collapsedSeriesIndices.indexOf(e)?t:[]),c=t=>"function"==typeof n.config.chart.toolbar.export.csv.categoryFormatter?n.config.chart.toolbar.export.csv.categoryFormatter(t):"datetime"===n.config.xaxis.type&&String(t).length>=10?new Date(t).toDateString():m.isNumber(t)?t:t.split(s).join(""),h=t=>"function"==typeof n.config.chart.toolbar.export.csv.valueFormatter?n.config.chart.toolbar.export.csv.valueFormatter(t):t,d=Math.max(...t.map(t=>t.data?t.data.length:0)),g=new u(this.w),f=new p(this.w,{theme:this.ctx.theme,timeScale:this.ctx.timeScale}),b=t=>{let e="";if(n.globals.axisCharts){if("category"===n.config.xaxis.type||n.config.xaxis.convertedCatToNumeric)if(n.globals.isBarHorizontal){const s=n.formatters.yLabelFormatters[0],i=new x(this.ctx.w).getActiveConfigSeriesIndex();e=s(n.labelData.labels[t],{seriesIndex:i,dataPointIndex:t,w:n})}else e=f.getLabel(n.labelData.labels,n.labelData.timescaleLabels,0,t).text;"datetime"===n.config.xaxis.type&&(n.config.xaxis.categories.length?e=n.config.xaxis.categories[t]:n.config.labels.length&&(e=n.config.labels[t]))}else e=n.config.labels[t];return null===e?"nullvalue":(Array.isArray(e)&&(e=e.join(" ")),m.isNumber(e)?e:e.split(s).join(""))},y=(e,i)=>{var l,p,u,x,m,f;if(a.length&&0===i&&o.push(a.join(s)),e.data){e.data=e.data.length&&e.data||[...Array(d)].map(()=>"");for(let d=0;d<e.data.length;d++){a=[];let y=b(d);if("nullvalue"!==y){if(y||(g.isFormatXY()?y=t[i].data[d].x:g.isFormat2DArray()&&(y=t[i].data[d]?t[i].data[d][0]:"")),0===i){a.push(c(y));for(let e=0;e<n.seriesData.series.length;e++){const s=g.isFormatXY()?null==(l=t[e].data[d])?void 0:l.y:r[e][d];a.push(h(s))}}("candlestick"===n.config.chart.type||e.type&&"candlestick"===e.type)&&(a.pop(),a.push(n.candleData.seriesCandleO[i][d]),a.push(n.candleData.seriesCandleH[i][d]),a.push(n.candleData.seriesCandleL[i][d]),a.push(n.candleData.seriesCandleC[i][d])),("boxPlot"===n.config.chart.type||e.type&&"boxPlot"===e.type)&&(a.pop(),a.push(n.candleData.seriesCandleO[i][d]),a.push(n.candleData.seriesCandleH[i][d]),a.push(n.candleData.seriesCandleM[i][d]),a.push(n.candleData.seriesCandleL[i][d]),a.push(n.candleData.seriesCandleC[i][d])),"rangeBar"===n.config.chart.type&&(a.pop(),a.push(n.rangeData.seriesRangeStart[i][d]),a.push(n.rangeData.seriesRangeEnd[i][d])),("violin"===n.config.chart.type||e.type&&"violin"===e.type)&&(a.pop(),a.push(null==(p=n.violinData.seriesViolinMin[i])?void 0:p[d]),a.push(null==(u=n.violinData.seriesViolinMax[i])?void 0:u[d]),a.push(null!=(f=null==(m=null==(x=n.violinData.seriesViolinPoints[i])?void 0:x[d])?void 0:m.length)?f:0)),a.length&&o.push(a.join(s))}}}};a.push(n.config.chart.toolbar.export.csv.headerCategory),"boxPlot"===n.config.chart.type?(a.push("minimum"),a.push("q1"),a.push("median"),a.push("q3"),a.push("maximum")):"candlestick"===n.config.chart.type?(a.push("open"),a.push("high"),a.push("low"),a.push("close")):"rangeBar"===n.config.chart.type?(a.push("minimum"),a.push("maximum")):"violin"===n.config.chart.type?(a.push("minimum"),a.push("maximum"),a.push("observations")):t.map((t,e)=>{const i=(t.name?t.name:`series-${e}`)+"";n.globals.axisCharts&&a.push(i.split(s).join("")?i.split(s).join(""):`series-${e}`)}),n.globals.axisCharts||(a.push(n.config.chart.toolbar.export.csv.headerValue),o.push(a.join(s))),n.globals.allSeriesHasEqualX||!n.globals.axisCharts||n.config.xaxis.categories.length||n.config.labels.length?t.map((t,e)=>{n.globals.axisCharts?y(t,e):(a=[],a.push(c(n.labelData.labels[e])),a.push(h(r[e])),o.push(a.join(s)))}):(()=>{const e=new Set,i={};t.forEach((s,n)=>{null==s||s.data.forEach(s=>{let a,o;if(g.isFormatXY())a=s.x,o=s.y;else{if(!g.isFormat2DArray())return;a=s[0],o=s[1]}i[a]||(i[a]=Array(t.length).fill("")),i[a][n]=h(o),e.add(a)})}),a.length&&o.push(a.join(s)),Array.from(e).sort().forEach(t=>{o.push([c(t),i[t].join(s)])})})(),l+=o.join(i),this.triggerDownload("data:text/csv; charset=utf-8,"+encodeURIComponent("\ufeff"+l),e||n.config.chart.toolbar.export.csv.filename,".csv")}triggerDownload(t,e,s){if(f.isSSR())return;const i=document.createElement("a");i.href=t,i.download=(e||this.w.globals.chartID)+s,document.body.appendChild(i),i.click(),document.body.removeChild(i)}}c.registerFeatures({exports:b});const y=d.__apex_CoreUtils,v=d.__apex_dimensions_Dimensions,w=d.__apex_Graphics;let A=class{constructor(t){this.w=t.w,this.lgCtx=t}getLegendStyles(){if(f.isSSR())return null;const t=document.createElement("style");t.setAttribute("type","text/css");const e=this.w.config.chart.nonce;e&&t.setAttribute("nonce",e);const s=document.createTextNode(g);return t.appendChild(s),t}getLegendDimensions(){const t=this.w.dom.baseEl.querySelector(".apexcharts-legend");if(!t)return{clwh:0,clww:0};const{width:e,height:s}=t.getBoundingClientRect();return{clwh:s,clww:e}}appendToForeignObject(){var t;const e=this.getLegendStyles();!1!==this.w.config.chart.injectStyleSheet&&e&&(null==(t=this.w.dom.elLegendForeign)||t.appendChild(e))}toggleDataSeries(t,e){var s,i;const n=this.w;if(n.globals.axisCharts||"radialBar"===n.config.chart.type){n.globals.resized=!0;let a=null,o=null;if(n.globals.risingSeries=[],n.globals.axisCharts){if(a=n.dom.baseEl.querySelector(`.apexcharts-series[data\\:realIndex='${t}']`),!a)return;o=parseInt(null!=(s=a.getAttribute("data:realIndex"))?s:"",10)}else{if(a=n.dom.baseEl.querySelector(`.apexcharts-series[rel='${t+1}']`),!a)return;o=parseInt(null!=(i=a.getAttribute("rel"))?i:"",10)-1}if(e){[{cs:n.globals.collapsedSeries,csi:n.globals.collapsedSeriesIndices},{cs:n.globals.ancillaryCollapsedSeries,csi:n.globals.ancillaryCollapsedSeriesIndices}].forEach(t=>{const e=t.cs,s=t.csi;this.riseCollapsedSeries(e,s,o)})}else this.hideSeries({seriesEl:a,realIndex:o});if(n.config.chart.accessibility.enabled){const e=n.dom.baseEl.querySelector(`.apexcharts-legend-series[rel="${t+1}"]`);if(e){const s=n.globals.collapsedSeriesIndices.includes(o)||n.globals.ancillaryCollapsedSeriesIndices.includes(o);e.setAttribute("aria-pressed",s?"true":"false");const i=e.querySelector(".apexcharts-legend-text"),a=i?i.textContent:n.seriesData.seriesNames[t],l=s?"hidden":"visible";e.setAttribute("aria-label",`${a}, ${l}. Press Enter or Space to toggle.`)}}}else{const e=n.dom.Paper.findOne(` .apexcharts-series[rel='${t+1}'] path`),s=n.config.chart.type;if("pie"===s||"polarArea"===s||"donut"===s){const t=n.config.plotOptions.pie.donut.labels;new w(this.w).pathMouseDown(e,null),this.lgCtx.printDataLabelsInner(e.node,t)}if(n.config.chart.accessibility.enabled){const e=n.dom.baseEl.querySelector(`.apexcharts-legend-series[rel="${t+1}"]`);if(e){const s=n.globals.collapsedSeriesIndices.includes(t);e.setAttribute("aria-pressed",s?"true":"false");const i=e.querySelector(".apexcharts-legend-text"),a=i?i.textContent:n.seriesData.seriesNames[t],o=s?"hidden":"visible";e.setAttribute("aria-label",`${a}, ${o}. Press Enter or Space to toggle.`)}}}}getSeriesAfterCollapsing({realIndex:t}){var e;const s=this.w,i=s.globals,n=m.clone(s.config.series);if(i.axisCharts){const e=s.config.yaxis[i.seriesYAxisReverseMap[t]],a={index:t,data:n[t].data.slice(),type:n[t].type||s.config.chart.type};if(e&&e.show&&e.showAlways)i.ancillaryCollapsedSeriesIndices.indexOf(t)<0&&(i.ancillaryCollapsedSeries.push(a),i.ancillaryCollapsedSeriesIndices.push(t));else if(i.collapsedSeriesIndices.indexOf(t)<0){i.collapsedSeries.push(a),i.collapsedSeriesIndices.push(t);const e=i.risingSeries.indexOf(t);i.risingSeries.splice(e,1)}}else i.collapsedSeries.push({index:t,data:n[t],type:null!=(e=s.config.series[t].type)?e:"line"}),i.collapsedSeriesIndices.push(t);return i.allSeriesCollapsed=i.collapsedSeries.length+i.ancillaryCollapsedSeries.length===s.config.series.length,this._getSeriesBasedOnCollapsedState(n)}hideSeries({seriesEl:t,realIndex:e}){const s=this.w,i=this.getSeriesAfterCollapsing({realIndex:e}),n=t.childNodes;for(let t=0;t<n.length;t++)n[t].classList.contains("apexcharts-series-markers-wrap")&&(n[t].classList.contains("apexcharts-hide")?n[t].classList.remove("apexcharts-hide"):n[t].classList.add("apexcharts-hide"));this.lgCtx.updateSeries(i,s.config.chart.animations.dynamicAnimation.enabled)}riseCollapsedSeries(t,e,s){const i=this.w;let n=m.clone(i.config.series);if(t.length>0){for(let a=0;a<t.length;a++)t[a].index===s&&(i.globals.axisCharts?n[s].data=t[a].data.slice():n[s]=t[a].data,"number"!=typeof n[s]&&(n[s].hidden=!1),t.splice(a,1),e.splice(a,1),i.globals.risingSeries.push(s),a--);n=this._getSeriesBasedOnCollapsedState(n),this.lgCtx.updateSeries(n,i.config.chart.animations.dynamicAnimation.enabled)}}_getSeriesBasedOnCollapsedState(t){const e=this.w;let s=0;return e.globals.axisCharts?t.forEach((i,n)=>{e.globals.collapsedSeriesIndices.indexOf(n)<0&&e.globals.ancillaryCollapsedSeriesIndices.indexOf(n)<0||(t[n].data=[],s++)}):t.forEach((i,n)=>{e.globals.collapsedSeriesIndices.indexOf(n)<0||(t[n]=0,s++)}),e.globals.allSeriesCollapsed=s===t.length,t}};const S=d.__apex_BrowserAPIs_BrowserAPIs,C="http://www.w3.org/2000/svg";class E{constructor(t,e){this.w=t,this.ctx=e,this.svgEl=null,this.arrowEl=null,this.hoverValueEl=null,this._min=0,this._max=0,this._geom=null,this._bandHitEls=[],this._activeBandIndex=-1,this._onCellEnter=this._onCellEnter.bind(this),this._onCellLeave=this._onCellLeave.bind(this),this._onBandEnter=this._onBandEnter.bind(this),this._onBandLeave=this._onBandLeave.bind(this)}_getFormatter(){const t=this.w.config.plotOptions.heatmap.colorScale.gradientLegend;return"function"==typeof t.formatter?t.formatter:t=>{if(!Number.isFinite(t))return String(t);const e=Math.abs(t);return e>=1e3?t.toFixed(0):e>=10?t.toFixed(1):t.toFixed(2)}}static isEnabled(t){var e,s,i,n;const a=null==(n=null==(i=null==(s=null==(e=null==t?void 0:t.config)?void 0:e.plotOptions)?void 0:s.heatmap)?void 0:i.colorScale)?void 0:n.gradientLegend;return!(!a||!a.enabled)}draw(){var t,e,s,i,n,a,o,l;const r=this.w,c=r.dom.elLegendWrap;if(!c)return;const h=r.config.plotOptions.heatmap.colorScale.gradientLegend,d=r.config.legend.position,g="left"===d||"right"===d,p=null!=(e=null==(t=h.arrow)?void 0:t.size)?e:8,u=p+4,x=h.showLabels?28:4,m=h.showLabels?20:4,f=h.showLabels?44:0,b=this._resolveStripLength(g?h.height:h.width,g),y=h.thickness,v=g?Math.max(y+u+4,f):b+2*x,w=g?b+2*m:y+u+4,A=(v-(y+u))/2,E=g?"left"===d?A:A+u:x,_=g?m:"top"===d?u:4,k=S.createElementNS(C,"svg");k.setAttribute("class","apexcharts-heatmap-gradient-legend"),k.setAttribute("width",String(v)),k.setAttribute("height",String(w)),k.setAttribute("overflow","visible");const L=S.createElementNS(C,"defs"),I=`apexcharts-heatmap-gradient-${r.globals.cuid}`,M=S.createElementNS(C,"linearGradient");M.setAttribute("id",I),g?(M.setAttribute("x1","0"),M.setAttribute("y1","1"),M.setAttribute("x2","0"),M.setAttribute("y2","0")):(M.setAttribute("x1","0"),M.setAttribute("y1","0"),M.setAttribute("x2","1"),M.setAttribute("y2","0"));const{min:D,max:R,stops:P,bands:X}=this._computeStops();this._min=D,this._max=R,P.forEach(t=>{const e=S.createElementNS(C,"stop");e.setAttribute("offset",`${(100*t.percent).toFixed(2)}%`),e.setAttribute("stop-color",t.color),M.appendChild(e)}),L.appendChild(M),k.appendChild(L);const $=S.createElementNS(C,"rect");if($.setAttribute("x",String(E)),$.setAttribute("y",String(_)),$.setAttribute("width",String(g?y:b)),$.setAttribute("height",String(g?b:y)),$.setAttribute("rx","2"),$.setAttribute("fill",`url(#${I})`),k.appendChild($),h.showLabels){const t=(null==(s=h.labelStyle)?void 0:s.colors)||(Array.isArray(r.config.legend.labels.colors)?r.config.legend.labels.colors[0]:r.config.legend.labels.colors)||r.config.chart.foreColor,e=(null==(i=h.labelStyle)?void 0:i.fontSize)||"11px",a=(null==(n=h.labelStyle)?void 0:n.fontFamily)||r.config.chart.fontFamily,o=this._getFormatter(),l=(s,i,n,o)=>{const l=S.createElementNS(C,"text");return l.setAttribute("x",String(i)),l.setAttribute("y",String(n)),l.setAttribute("text-anchor",o),l.setAttribute("dominant-baseline","middle"),l.setAttribute("fill",t),l.setAttribute("font-size",e),a&&l.setAttribute("font-family",a),l.textContent=String(s),l};if(g){const t=E+y/2;k.appendChild(l(o(D),t,_+b+10,"middle")),k.appendChild(l(o(R),t,_-10,"middle"))}else{const t=_+y/2;k.appendChild(l(o(D),E-6,t,"end")),k.appendChild(l(o(R),E+b+6,t,"start"))}}const F=(null==(a=h.arrow)?void 0:a.color)||r.config.chart.foreColor,B=this._buildArrow(p,F,d);if(k.appendChild(B),this.arrowEl=B,this._bandHitEls=[],r.config.legend.onItemHover.highlightDataSeries&&X.length>0&&X.forEach(t=>{const e=S.createElementNS(C,"rect");if(g){const s=_+b-t.p2*b,i=_+b-t.p1*b;e.setAttribute("x",String(E)),e.setAttribute("y",String(s)),e.setAttribute("width",String(y)),e.setAttribute("height",String(Math.max(0,i-s)))}else e.setAttribute("x",String(E+t.p1*b)),e.setAttribute("y",String(_)),e.setAttribute("width",String(Math.max(0,(t.p2-t.p1)*b))),e.setAttribute("height",String(y));e.setAttribute("fill","transparent"),e.setAttribute("class","apexcharts-heatmap-gradient-band"),e.setAttribute("data:range-index",String(t.index)),e.style.cursor="pointer",k.appendChild(e),this._bandHitEls.push(e)}),this._geom={isVertical:g,position:d,stripX:E,stripY:_,stripLength:b,stripThickness:y,arrowSize:p,svgWidth:v,svgHeight:w},h.showHoverValue){const t=S.createElement("div");t.classList.add("apexcharts-heatmap-gradient-legend-value"),t.style.position="absolute",t.style.fontSize=(null==(o=h.labelStyle)?void 0:o.fontSize)||"11px",t.style.fontFamily=(null==(l=h.labelStyle)?void 0:l.fontFamily)||r.config.chart.fontFamily||"",t.style.color=r.config.chart.foreColor,t.style.background="rgba(0,0,0,0.65)",t.style.color="#fff",t.style.padding="2px 6px",t.style.borderRadius="3px",t.style.pointerEvents="none",t.style.whiteSpace="nowrap",t.style.opacity="0",t.style.transition="opacity 120ms ease",this.hoverValueEl=t}c.classList.add("apexcharts-heatmap-gradient-legend-wrap"),c.classList.add("apx-legend-position-"+d),c.appendChild(k),this.hoverValueEl&&c.appendChild(this.hoverValueEl),this.svgEl=k,this._applyWrapAlignment(c,d,g,v,w),this._attachHoverListeners(),this._attachBandHoverListeners()}_resolveStripLength(t,e){const s=this.w,i=e?s.globals.svgHeight||s.config.chart.height||300:s.globals.svgWidth||s.config.chart.width||600;if("string"==typeof t){const e=t.trim();if(e.endsWith("%")){const t=parseFloat(e)||0;return Math.max(20,i*t/100)}const s=parseFloat(e);return Number.isFinite(s)?s:200}return"number"==typeof t&&Number.isFinite(t)?t:200}_applyWrapAlignment(t,e,s,i,n){const a=this.w,o=a.config.plotOptions.heatmap.colorScale.gradientLegend.align||"center",l=12,r=a.globals.svgWidth||a.config.chart.width||600,c=a.globals.svgHeight||a.config.chart.height||300,h=a.config.legend.offsetX||0,d=a.config.legend.offsetY||0;if(t.style.position="absolute",t.style.display="block",t.style.overflow="visible",t.style.padding="0",t.style.width=i+"px",t.style.height=n+"px",t.style.right="auto",t.style.bottom="auto",s){const s=c-n-24;let a;a="start"===o?l:"end"===o?l+Math.max(0,s):l+Math.max(0,s)/2,t.style.top=a+d+"px",t.style.left="left"===e?l+h+"px":r-i-l+h+"px"}else{const s=r-i-24;let a;a="start"===o?l:"end"===o?l+Math.max(0,s):l+Math.max(0,s)/2,t.style.left=a+h+"px",t.style.top="top"===e?l+d+"px":c-n-l+d+"px"}}repositionToPlot(){var t,e;if(!f.isBrowser())return;const s=this.w,i=s.globals,n=s.dom.elLegendWrap;if(!n||!this._geom)return;if(!Number.isFinite(i.gridWidth)||!Number.isFinite(i.gridHeight))return;const{isVertical:a,position:o,svgWidth:l,svgHeight:r,stripX:c,stripY:h,stripThickness:d}=this._geom,g=s.config.plotOptions.heatmap.colorScale.gradientLegend.align||"center",p=s.config.legend.offsetX||0,u=s.config.legend.offsetY||0,x=null==(e=null==(t=this.ctx)?void 0:t.dimensions)?void 0:e.dimHelpers,m=x?x.getTitleSubtitleCoords("title").height+x.getTitleSubtitleCoords("subtitle").height:0,b=s.layout.xAxisHeight||0,y=(t,e)=>{const s=Math.max(0,t-e);return"start"===g?0:"end"===g?s:s/2};if(a){n.style.top=i.translateY+y(i.gridHeight,r)+u+"px";const t=(("left"===o?0:i.translateX+i.gridWidth)+("left"===o?i.translateX:i.svgWidth))/2;n.style.left=t-c-d/2+p+"px"}else{n.style.left=i.translateX+y(i.gridWidth,l)+p+"px";const t=(("top"===o?m:i.translateY+i.gridHeight+b)+("top"===o?i.translateY:i.svgHeight))/2;n.style.top=t-h-d/2+u+"px"}S.requestAnimationFrame(()=>this._enforceMinPlotGap())}_enforceMinPlotGap(){const t=this.w,e=t.dom.elLegendWrap,s=this.svgEl&&this.svgEl.querySelector("rect"),i=t.dom.baseEl.querySelector(".apexcharts-grid");if(!(e&&s&&i&&this._geom))return;const n=s.getBoundingClientRect(),a=i.getBoundingClientRect();if(!(n.width&&n.height&&a.width&&a.height))return;const{isVertical:o,position:l}=this._geom;if(o){const t="left"===l?a.left-n.right:n.left-a.right;if(t<16){const s=parseFloat(e.style.left)||0,i=16-t;e.style.left=s+("left"===l?-i:i)+"px"}}else{const t="top"===l?a.top-n.bottom:n.top-a.bottom;if(t<16){const s=parseFloat(e.style.top)||0,i=16-t;e.style.top=s+("top"===l?-i:i)+"px"}}}destroy(){var t,e,s,i,n,a,o;for(let s=0;s<this._bandHitEls.length;s++){const i=this._bandHitEls[s];null==(t=i.removeEventListener)||t.call(i,"mousemove",this._onBandEnter),null==(e=i.removeEventListener)||e.call(i,"mouseout",this._onBandLeave)}if(this._bandHitEls=[],this._activeBandIndex=-1,null==(s=this.ctx)?void 0:s.events)try{null==(n=(i=this.ctx.events).removeEventListener)||n.call(i,"dataPointMouseEnter",this._onCellEnter),null==(o=(a=this.ctx.events).removeEventListener)||o.call(a,"dataPointMouseLeave",this._onCellLeave)}catch(t){}}_attachBandHoverListeners(){if(f.isBrowser())for(let t=0;t<this._bandHitEls.length;t++){const e=this._bandHitEls[t];e.addEventListener("mousemove",this._onBandEnter),e.addEventListener("mouseout",this._onBandLeave)}}_onBandEnter(t){var e,s,i,n;const a=this.w,o=t.currentTarget,l=parseInt(null!=(e=o.getAttribute("data:range-index"))?e:"-1",10);l<0||l===this._activeBandIndex||(this._activeBandIndex=l,null==(n=null==(i=null==(s=this.ctx)?void 0:s.events)?void 0:i.fireEvent)||n.call(i,"legendHover",[this.ctx,l,a]),new x(a).highlightRangeInSeries(l,"highlight"))}_onBandLeave(){if(this._activeBandIndex<0)return;const t=this._activeBandIndex;this._activeBandIndex=-1,new x(this.w).highlightRangeInSeries(t,"reset")}_attachHoverListeners(){var t,e;f.isBrowser()&&(null==(e=null==(t=this.ctx)?void 0:t.events)?void 0:e.addEventListener)&&(this.ctx.events.addEventListener("dataPointMouseEnter",this._onCellEnter),this.ctx.events.addEventListener("dataPointMouseLeave",this._onCellLeave))}_onCellEnter(...t){var e,s;const i=this.w;if(!this.arrowEl)return;const n=t[t.length-1];if(!n||"object"!=typeof n)return;const a=n.seriesIndex,o=n.dataPointIndex;if("number"!=typeof a||"number"!=typeof o)return;if("heatmap"!==i.config.chart.type)return;const l=null==(s=null==(e=i.seriesData)?void 0:e.series)?void 0:s[a],r=null==l?void 0:l[o];null==r||Number.isNaN(r)||this._positionArrow(r)}_onCellLeave(){this.arrowEl&&(this.arrowEl.setAttribute("opacity","0"),this.hoverValueEl&&(this.hoverValueEl.style.opacity="0"))}_positionArrow(t){if(!this.arrowEl||!this._geom)return;const{isVertical:e,position:s,stripX:i,stripY:n,stripLength:a,stripThickness:o,arrowSize:l}=this._geom,r=this._min,c=this._max-r;let h;if(h=0===c?.5:(t-r)/c,h<0&&(h=0),h>1&&(h=1),e){const t=n+a-h*a;let e,r;"left"===s?(e=i+o,r=e+l):(e=i,r=e-l);const c=[`${e},${t}`,`${r},${t-l/2}`,`${r},${t+l/2}`].join(" ");this.arrowEl.setAttribute("points",c)}else{const t=i+h*a;let e,r;"top"===s?(e=n+o,r=e+l):(e=n,r=e-l);const c=[`${t},${e}`,`${t-l/2},${r}`,`${t+l/2},${r}`].join(" ");this.arrowEl.setAttribute("points",c)}if(this.arrowEl.setAttribute("opacity","1"),this.hoverValueEl){const r=this._getFormatter();if(this.hoverValueEl.textContent=r(t),e){const t=n+a-h*a;"left"===s?this.hoverValueEl.style.left=`${i+o+l+8}px`:(this.hoverValueEl.style.left=i-l-8+"px",this.hoverValueEl.style.transform="translateX(-100%)"),this.hoverValueEl.style.top=t-9+"px"}else{const t=i+h*a;this.hoverValueEl.style.left=`${t}px`,this.hoverValueEl.style.transform="translateX(-50%)",this.hoverValueEl.style.top="top"===s?`${n+o+l+8}px`:n-l-18+"px"}this.hoverValueEl.style.opacity="1"}}_buildArrow(t,e,s){const i=S.createElementNS(C,"polygon");return i.setAttribute("fill",e),i.setAttribute("opacity","0"),i.setAttribute("class","apexcharts-heatmap-gradient-arrow"),i.setAttribute("points","0,0 0,0 0,0"),i.setAttribute("pointer-events","none"),i}_computeStops(){var t,e;const s=this.w,i=s.config.plotOptions.heatmap.colorScale,n=i.gradientLegend;let a=1/0,o=-1/0;const c=(null==(t=s.seriesData)?void 0:t.series)||[];for(let t=0;t<c.length;t++){const e=c[t];if(e)for(let t=0;t<e.length;t++){const s=e[t];null==s||Number.isNaN(s)||(s<a&&(a=s),s>o&&(o=s))}}Number.isFinite(a)||(a=0),Number.isFinite(o)||(o=0);let h=a,d=o;void 0!==i.min&&(h=i.min<a?i.min:a),void 0!==i.max&&(d=i.max>o?i.max:o);const g=[],p=[];if(i.ranges&&i.ranges.length>0){const t=i.ranges.map((t,e)=>r(l({},t),{_originalIndex:e})).sort((t,e)=>t.from-e.from),e=t[0].from,s=t[t.length-1].to;h=e,d=s;const n=s-e||1;t.forEach(t=>{const s=(t.from-e)/n,i=(t.to-e)/n;g.push({percent:(s+i)/2,color:t.color}),p.push({index:t._originalIndex,p1:s,p2:i})})}else{const t=s.globals.colors[0]||"#008FFB",i=new m,a=null!=(e=s.config.plotOptions.heatmap.shadeIntensity)?e:.5,o=s.globals.hasNegs,l=Math.max(2,n.stops||16);for(let e=0;e<l;e++){const n=e/(l-1),r=h+n*(d-h),c=Math.abs(d)+Math.abs(h),p=0===c?0:100*r/c;let u;u=o?s.config.plotOptions.heatmap.reverseNegativeShade?p<0?p/100*(1.25*a):1.25*a*(1-p/100):p<=0?1-(1+p/100)*a:(1-p/100)*a:1-p/100,u>1&&(u=1),u<-1&&(u=-1);const x=s.config.plotOptions.heatmap.enableShades?i.shadeColor("dark"===s.config.theme.mode?-1*u:u,t):t;g.push({percent:n,color:x})}}return{min:h,max:d,stops:g,bands:p}}}const _=d.__apex_Markers;c.registerFeatures({legend:class{constructor(t,e){this.w=t,this.ctx=e,this.printDataLabelsInner=(...t)=>{var s;return null==(s=e.pie)?void 0:s.printDataLabelsInner(...t)},this.updateSeries=(...t)=>e.updateHelpers._updateSeries(...t),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 A(this)}init(){const t=this.w,e=t.globals,s=t.config,i=s.legend.showForSingleSeries&&1===this.w.seriesData.series.length||this.isBarsDistributed||"heatmap"===s.chart.type||this.w.seriesData.series.length>1;if(this.legendHelpers.appendToForeignObject(),(i||!e.axisCharts)&&s.legend.show){const e=t.dom.elLegendWrap;for(;e.firstChild;)e.removeChild(e.firstChild);this.heatmapGradientLegend&&(this.heatmapGradientLegend.destroy(),this.heatmapGradientLegend=null),"heatmap"===s.chart.type&&E.isEnabled(t)?(this.heatmapGradientLegend=new E(t,this.ctx),this.heatmapGradientLegend.draw()):(this.drawLegends(),"bottom"===s.legend.position||"top"===s.legend.position?this.legendAlignHorizontal():"right"!==s.legend.position&&"left"!==s.legend.position||this.legendAlignVertical())}}createLegendMarker({i:t,fillcolor:e}){const s=this.w,i=S.createElement("span");i.classList.add("apexcharts-legend-marker");const n=s.config.legend.markers.shape||s.config.markers.shape;let a=n;Array.isArray(n)&&(a=n[t]);const o=Array.isArray(s.config.legend.markers.size)?parseFloat(s.config.legend.markers.size[t]):parseFloat(s.config.legend.markers.size),c=Array.isArray(s.config.legend.markers.offsetX)?parseFloat(s.config.legend.markers.offsetX[t]):parseFloat(s.config.legend.markers.offsetX),h=Array.isArray(s.config.legend.markers.offsetY)?parseFloat(s.config.legend.markers.offsetY[t]):parseFloat(s.config.legend.markers.offsetY),d=Array.isArray(s.config.legend.markers.strokeWidth)?parseFloat(s.config.legend.markers.strokeWidth[t]):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=e[t],Array.isArray(s.config.legend.markers.customHTML)?s.config.legend.markers.customHTML[t]&&(i.innerHTML=s.config.legend.markers.customHTML[t]()):i.innerHTML=s.config.legend.markers.customHTML();else{const n=new _(this.ctx.w,this.ctx).getMarkerConfig({cssClass:`apexcharts-legend-marker apexcharts-marker apexcharts-marker-${a}`,seriesIndex:t,strokeWidth:d,size:o}),c=(f.isBrowser()?window.SVG:global.SVG)().addTo(i).size("100%","100%"),h=new w(this.w).drawMarker(0,0,r(l({},n),{pointFillColor:Array.isArray(e)?e[t]:n.pointFillColor,shape:a}));s.dom.Paper.find(".apexcharts-legend-marker.apexcharts-marker").forEach(t=>{t.node.classList.contains("apexcharts-marker-triangle")?t.node.style.transform="translate(50%, 45%)":t.node.style.transform="translate(50%, 50%)"}),c.add(h)}return i}drawLegends(){var t;const e=this,s=this.w,i=s.dom.elLegendWrap,n=s.config.legend.fontFamily;let a=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 t=s.config.plotOptions.heatmap.colorScale.ranges;a=t.map(t=>t.name?t.name:t.from+" - "+t.to),o=t.map(t=>t.color)}else this.isBarsDistributed&&(a=s.labelData.labels.slice());s.config.legend.customLegendItems.length&&(a=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((t,e)=>{c[e]=S.createElement("div"),c[e].classList.add("apexcharts-legend-group",`apexcharts-legend-group-${e}`),"horizontal"===s.config.legend.clusterGroupedSeriesOrientation?i.classList.add("apexcharts-legend-group-horizontal"):c[e].classList.add("apexcharts-legend-group-vertical")});for(let e=r?a.length-1:0;r?e>=0:e<=a.length-1;r?e--:e++){const r=l(a[e],{seriesIndex:e,w:s});let h=!1,d=!1;if(s.globals.collapsedSeries.length>0)for(let t=0;t<s.globals.collapsedSeries.length;t++)s.globals.collapsedSeries[t].index===e&&(h=!0);if(s.globals.ancillaryCollapsedSeriesIndices.length>0)for(let t=0;t<s.globals.ancillaryCollapsedSeriesIndices.length;t++)s.globals.ancillaryCollapsedSeriesIndices[t]===e&&(d=!0);const g=this.createLegendMarker({i:e,fillcolor:o});w.setAttrs(g,{rel:e+1,"data:collapsed":h||d}),(h||d)&&g.classList.add("apexcharts-inactive-legend");const p=S.createElement("div");if(s.config.chart.accessibility.enabled&&s.config.chart.accessibility.keyboard.enabled){p.setAttribute("role","button"),p.setAttribute("tabindex","0");const t=Array.isArray(r)?r.join(" "):r,e=h||d,s=e?"hidden":"visible";p.setAttribute("aria-label",`${t}, ${s}. Press Enter or Space to toggle.`),p.setAttribute("aria-pressed",e?"true":"false")}const u=S.createElement("span");u.classList.add("apexcharts-legend-text"),u.innerHTML=Array.isArray(r)?r.join(" "):r;let x=s.config.legend.labels.useSeriesColors?s.globals.colors[e]:Array.isArray(s.config.legend.labels.colors)?null==(t=s.config.legend.labels.colors)?void 0:t[e]:s.config.legend.labels.colors;x||(x=s.config.chart.foreColor),u.style.color=x,u.style.fontSize=s.config.legend.fontSize,u.style.fontWeight=s.config.legend.fontWeight,u.style.fontFamily=n||s.config.chart.fontFamily,w.setAttrs(u,{rel:e+1,i:e,"data:default-text":encodeURIComponent(r),"data:collapsed":h||d}),p.appendChild(g),p.appendChild(u);const f=new y(this.w);if(!s.config.legend.showForZeroSeries){0===f.getSeriesTotalByIndex(e)&&f.seriesHaveSameValues(e)&&!f.isSeriesNull(e)&&-1===s.globals.collapsedSeriesIndices.indexOf(e)&&-1===s.globals.ancillaryCollapsedSeriesIndices.indexOf(e)&&p.classList.add("apexcharts-hidden-zero-series")}s.config.legend.showForNullSeries||f.isSeriesNull(e)&&-1===s.globals.collapsedSeriesIndices.indexOf(e)&&-1===s.globals.ancillaryCollapsedSeriesIndices.indexOf(e)&&p.classList.add("apexcharts-hidden-null-series"),c.length?s.labelData.seriesGroups.forEach((t,n)=>{var a,o;t.includes(null!=(o=null==(a=s.config.series[e])?void 0:a.name)?o:"")&&(i.appendChild(c[n]),c[n].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":"",w.setAttrs(p,{rel:e+1,seriesName:m.escapeString(a[e]),"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",e.onLegendClick,!0),s.config.legend.onItemHover.highlightDataSeries&&0===s.config.legend.customLegendItems.length&&(s.dom.elWrap.addEventListener("mousemove",e.onLegendHovered,!0),s.dom.elWrap.addEventListener("mouseout",e.onLegendHovered,!0)),s.config.chart.accessibility.enabled&&s.config.chart.accessibility.keyboard.enabled&&s.dom.elWrap.addEventListener("keydown",e.onLegendKeyDown.bind(e),!0)}setLegendWrapXY(t,e){const s=this.w,i=s.dom.elLegendWrap,n=i.clientHeight;let a=0,o=0;if("bottom"===s.config.legend.position)o=s.globals.svgHeight-Math.min(n,s.globals.svgHeight/2)-5;else if("top"===s.config.legend.position){const t=new v(this.w,this.ctx),e=t.dimHelpers.getTitleSubtitleCoords("title").height,s=t.dimHelpers.getTitleSubtitleCoords("subtitle").height;o=(e>0?e-10:0)+(s>0?s-10:0)}i.style.position="absolute",a=a+t+s.config.legend.offsetX,o=o+e+s.config.legend.offsetY,i.style.left=a+"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(t=>{i&&i.style[t]&&(i.style[t]=parseInt(String(s.config.legend[t]),10)+"px")})}legendAlignHorizontal(){const t=this.w;t.dom.elLegendWrap.style.right="0";const e=new v(this.w,this.ctx),s=e.dimHelpers.getTitleSubtitleCoords("title"),i=e.dimHelpers.getTitleSubtitleCoords("subtitle");let n=0;"top"===t.config.legend.position&&(n=s.height+i.height+t.config.title.margin+t.config.subtitle.margin-10),this.setLegendWrapXY(20,n)}legendAlignVertical(){const t=this.w,e=this.legendHelpers.getLegendDimensions();let s=0;"left"===t.config.legend.position&&(s=20),"right"===t.config.legend.position&&(s=t.globals.svgWidth-e.clww-10),this.setLegendWrapXY(s,20)}onLegendHovered(t){var e;const s=this.w,i=t.target,n=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(n){const s=parseInt(null!=(e=i.getAttribute("rel"))?e:"0",10)-1;this.ctx.events.fireEvent("legendHover",[this.ctx,s,this.w]);const n=new x(this.ctx.w);"mousemove"===t.type?n.highlightRangeInSeries(s,"highlight"):"mouseout"===t.type&&n.highlightRangeInSeries(s,"reset")}}else if(!i.classList.contains("apexcharts-inactive-legend")&&n){new x(this.ctx.w).toggleSeriesOnHover(t,i)}}onLegendKeyDown(t){const e=this,s=this.w,i=t.target;if((i.classList.contains("apexcharts-legend-series")||i.classList.contains("apexcharts-legend-text")||i.classList.contains("apexcharts-legend-marker"))&&("Enter"===t.key||" "===t.key)){t.preventDefault();const n=i.getAttribute("rel");e.onLegendClick(t),null!==n&&s.config.legend.onItemClick.toggleDataSeries&&requestAnimationFrame(()=>{const t=s.dom.baseEl.querySelector(`.apexcharts-legend-series[rel="${n}"]`);t&&t.focus()})}}onLegendClick(t){var e;const s=this.w,i=t.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 t=parseInt(null!=(e=i.getAttribute("rel"))?e:"0",10)-1,n="true"===i.getAttribute("data:collapsed"),a=this.w.config.chart.events.legendClick;"function"==typeof a&&a(this.ctx,t,this.w),this.ctx.events.fireEvent("legendClick",[this.ctx,t,this.w]);const o=this.w.config.legend.markers.onClick;"function"==typeof o&&i.classList.contains("apexcharts-legend-marker")&&(o(this.ctx,t,this.w),this.ctx.events.fireEvent("legendMarkerClick",[this.ctx,t,this.w]));"treemap"!==s.config.chart.type&&"heatmap"!==s.config.chart.type&&!this.isBarsDistributed&&s.config.legend.onItemClick.toggleDataSeries&&this.legendHelpers.toggleDataSeries(t,n)}}}});class k{constructor(t,e){this.w=t,this.ctx=e,this.ev=this.w.config.chart.events,this.selectedClass="apexcharts-selected",this.localeValues=this.w.globals.locale.toolbar,this.minX=t.globals.minX,this.maxX=t.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 t=this.w,e=()=>S.createElementNS("http://www.w3.org/1999/xhtml","div"),s=()=>{const t=S.createElementNS("http://www.w3.org/1999/xhtml","button");return t.setAttribute("type","button"),t},i=e();if(i.setAttribute("class","apexcharts-toolbar"),i.style.top=t.config.chart.toolbar.offsetY+"px",i.style.right=3-t.config.chart.toolbar.offsetX+"px",t.dom.elWrap.appendChild(i),this.elZoom=s(),this.elZoomIn=s(),this.elZoomOut=s(),this.elPan=s(),this.elSelection=s(),this.elZoomReset=s(),this.elMenuIcon=s(),this.elMenu=e(),this.elCustomIcons=[],this.t=t.config.chart.toolbar.tools,Array.isArray(this.t.customIcons))for(let t=0;t<this.t.customIcons.length;t++)this.elCustomIcons.push(s());const n=[],a=(e,s,i)=>{const a=e.toLowerCase();this.t[a]&&t.config.chart.zoom.enabled&&n.push({el:s,icon:"string"==typeof this.t[a]?this.t[a]:i,title:this.localeValues[e],class:`apexcharts-${a}-icon`})};a("zoomIn",this.elZoomIn,'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <path d="M12 5v14M5 12h14"/>\n</svg>\n'),a("zoomOut",this.elZoomOut,'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <path d="M5 12h14"/>\n</svg>\n');const o=e=>{this.t[e]&&t.config.chart[e].enabled&&n.push({el:"zoom"===e?this.elZoom:this.elSelection,icon:"string"==typeof this.t[e]?this.t[e]:"zoom"===e?'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <circle cx="11" cy="11" r="7"/>\n <path d="m21 21-4.3-4.3M8 11h6M11 8v6"/>\n</svg>\n':'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <path d="M5 3a2 2 0 0 0-2 2"/>\n <path d="M19 3a2 2 0 0 1 2 2"/>\n <path d="M21 19a2 2 0 0 1-2 2"/>\n <path d="M5 21a2 2 0 0 1-2-2"/>\n <path d="M9 3h1M14 3h1M9 21h1M14 21h1M3 9v1M3 14v1M21 9v1M21 14v1"/>\n</svg>\n',title:this.localeValues["zoom"===e?"selectionZoom":"selection"],class:`apexcharts-${e}-icon`})};o("zoom"),o("selection"),this.t.pan&&t.config.chart.zoom.enabled&&n.push({el:this.elPan,icon:"string"==typeof this.t.pan?this.t.pan:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <path d="M5 9 2 12l3 3"/>\n <path d="M9 5l3-3 3 3"/>\n <path d="M15 19l-3 3-3-3"/>\n <path d="M19 9l3 3-3 3"/>\n <path d="M2 12h20"/>\n <path d="M12 2v20"/>\n</svg>\n',title:this.localeValues.pan,class:"apexcharts-pan-icon"}),a("reset",this.elZoomReset,'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/>\n <path d="M3 3v5h5"/>\n</svg>\n'),this.t.download&&n.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" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <path d="M4 6h16M4 12h16M4 18h16"/>\n</svg>\n',title:this.localeValues.menu,class:"apexcharts-menu-icon"});for(let t=0;t<this.elCustomIcons.length;t++)n.push({el:this.elCustomIcons[t],icon:this.t.customIcons[t].icon,title:this.t.customIcons[t].title,index:this.t.customIcons[t].index,class:"apexcharts-toolbar-custom-icon "+this.t.customIcons[t].class});n.forEach((t,e)=>{t.index&&m.moveIndexInArray(n,e,t.index)});for(let t=0;t<n.length;t++)w.setAttrs(n[t].el,{class:n[t].class,title:n[t].title,"aria-label":n[t].title}),n[t].el.innerHTML=n[t].icon,i.appendChild(n[t].el);this.elZoom.parentNode&&this.elZoom.setAttribute("aria-pressed",String(!!t.interact.zoomEnabled)),this.elSelection.parentNode&&this.elSelection.setAttribute("aria-pressed",String(!!t.interact.selectionEnabled)),this.elPan.parentNode&&this.elPan.setAttribute("aria-pressed",String(!!t.interact.panEnabled)),this.elMenuIcon.parentNode&&(this.elMenuIcon.setAttribute("aria-haspopup","true"),this.elMenuIcon.setAttribute("aria-expanded","false")),this._createHamburgerMenu(i),t.interact.zoomEnabled?this.elZoom.classList.add(this.selectedClass):t.interact.panEnabled?this.elPan.classList.add(this.selectedClass):t.interact.selectionEnabled&&this.elSelection.classList.add(this.selectedClass),this.addToolbarEventListeners()}_createHamburgerMenu(t){this.elMenuItems=[],t.appendChild(this.elMenu),w.setAttrs(this.elMenu,{class:"apexcharts-menu",role:"menu"});const e=[{name:"exportSVG",title:this.localeValues.exportToSVG},{name:"exportPNG",title:this.localeValues.exportToPNG},{name:"exportCSV",title:this.localeValues.exportToCSV}];for(let t=0;t<e.length;t++)this.elMenuItems.push(S.createElementNS("http://www.w3.org/1999/xhtml","div")),this.elMenuItems[t].innerHTML=e[t].title,w.setAttrs(this.elMenuItems[t],{class:`apexcharts-menu-item ${e[t].name}`,title:e[t].title,role:"menuitem",tabindex:"-1"}),this.elMenu.appendChild(this.elMenuItems[t])}addToolbarEventListeners(){var t,e,s,i,n,a,o,l;null==(t=this.elZoomReset)||t.addEventListener("click",this.handleZoomReset.bind(this)),null==(e=this.elSelection)||e.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==(n=this.elZoomOut)||n.addEventListener("click",this.handleZoomOut.bind(this)),null==(a=this.elPan)||a.addEventListener("click",this.togglePanning.bind(this)),null==(o=this.elMenuIcon)||o.addEventListener("click",this.toggleMenu.bind(this)),this.elMenuItems.forEach(t=>{t.classList.contains("exportSVG")?t.addEventListener("click",this.handleDownload.bind(this,"svg")):t.classList.contains("exportPNG")?t.addEventListener("click",this.handleDownload.bind(this,"png")):t.classList.contains("exportCSV")&&t.addEventListener("click",this.handleDownload.bind(this,"csv"))});for(let t=0;t<this.t.customIcons.length;t++)this.elCustomIcons[t].addEventListener("click",this.t.customIcons[t].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(t=>{t.addEventListener("keydown",e=>{if("Enter"===e.key||" "===e.key){e.preventDefault();const s=t.className;t.click(),requestAnimationFrame(()=>{const t=this.w.dom.baseEl;if(!t)return;const e=s.split(" ").find(t=>t.startsWith("apexcharts-"));if(!e)return;const i=t.querySelector(`.${e}`);i&&i.focus()})}})}),null==(l=this.elMenuIcon)||l.addEventListener("keydown",t=>{var e;"ArrowDown"!==t.key&&"ArrowUp"!==t.key||(t.preventDefault(),(null==(e=this.elMenu)?void 0:e.classList.contains("apexcharts-menu-open"))||this.toggleMenu(),window.setTimeout(()=>{const e="ArrowDown"===t.key?0:this.elMenuItems.length-1;this.elMenuItems[e]&&this.elMenuItems[e].focus()},20))}),this.elMenuItems.forEach((t,e)=>{t.addEventListener("keydown",s=>{var i;if("ArrowDown"===s.key){s.preventDefault();(this.elMenuItems[e+1]||this.elMenuItems[0]).focus()}else if("ArrowUp"===s.key){s.preventDefault();(this.elMenuItems[e-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(),t.click())})})}toggleZoomSelection(t){this.ctx.getSyncedCharts().forEach(e=>{e.ctx.toolbar.toggleOtherControls();const s="selection"===t?e.ctx.toolbar.elSelection:e.ctx.toolbar.elZoom,i="selection"===t?"selectionEnabled":"zoomEnabled";e.w.globals[i]=!e.w.globals[i],s.classList.contains(e.ctx.toolbar.selectedClass)?s.classList.remove(e.ctx.toolbar.selectedClass):s.classList.add(e.ctx.toolbar.selectedClass),s.setAttribute("aria-pressed",String(e.w.globals[i]))})}getToolbarIconsReference(){const t=this.w;this.elZoom||(this.elZoom=t.dom.baseEl.querySelector(".apexcharts-zoom-icon")),this.elPan||(this.elPan=t.dom.baseEl.querySelector(".apexcharts-pan-icon")),this.elSelection||(this.elSelection=t.dom.baseEl.querySelector(".apexcharts-selection-icon"))}enableZoomPanFromToolbar(t){this.toggleOtherControls(),"pan"===t?this.w.interact.panEnabled=!0:this.w.interact.zoomEnabled=!0;const e="pan"===t?this.elPan:this.elZoom,s="pan"===t?this.elZoom:this.elPan;e&&e.classList.add(this.selectedClass),s&&s.classList.remove(this.selectedClass)}togglePanning(){this.ctx.getSyncedCharts().forEach(t=>{t.ctx.toolbar.toggleOtherControls(),t.w.interact.panEnabled=!t.w.interact.panEnabled,t.ctx.toolbar.elPan.classList.contains(t.ctx.toolbar.selectedClass)?t.ctx.toolbar.elPan.classList.remove(t.ctx.toolbar.selectedClass):t.ctx.toolbar.elPan.classList.add(t.ctx.toolbar.selectedClass),t.ctx.toolbar.elPan.setAttribute("aria-pressed",String(t.w.interact.panEnabled))})}toggleOtherControls(){const t=this.w;t.interact.panEnabled=!1,t.interact.zoomEnabled=!1,t.interact.selectionEnabled=!1,this.getToolbarIconsReference();[this.elPan,this.elSelection,this.elZoom].forEach(t=>{t&&t.classList.remove(this.selectedClass)})}_currentXRange(){const t=this.w;return t.axisFlags.isRangeBar?{minX:t.globals.minY,maxX:t.globals.maxY}:{minX:t.globals.minX,maxX:t.globals.maxX}}handleZoomIn(){const t=this.w,{minX:e,maxX:s}=this._currentXRange();this.minX=e,this.maxX=s;const i=(e+s)/2,n=(e+i)/2,a=(s+i)/2,o=this._getNewMinXMaxX(n,a);t.interact.disableZoomIn||this.zoomUpdateOptions(o.minX,o.maxX)}handleZoomOut(){const t=this.w,{minX:e,maxX:s}=this._currentXRange();if(this.minX=e,this.maxX=s,"datetime"===t.config.xaxis.type&&new Date(e).getUTCFullYear()<1e3)return;const i=(e+s)/2,n=e-(i-e),a=s-(i-s),o=this._getNewMinXMaxX(n,a);t.interact.disableZoomOut||this.zoomUpdateOptions(o.minX,o.maxX)}_getNewMin