apexcharts
Version:
A JavaScript Chart Library
5 lines • 231 kB
JavaScript
/*!
* ApexCharts v6.6.1
* (c) 2018-2026 ApexCharts
*/
"use strict";var t=Object.defineProperty,e=Object.defineProperties,i=Object.getOwnPropertyDescriptors,s=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable,r=(e,i,s)=>i in e?t(e,i,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[i]=s,o=(t,e)=>{for(var i in e||(e={}))n.call(e,i)&&r(t,i,e[i]);if(s)for(var i of s(e))a.call(e,i)&&r(t,i,e[i]);return t},l=(t,s)=>e(t,i(s)),c=(t,e,i)=>r(t,"symbol"!=typeof e?e+"":e,i),h=(t,e,i)=>new Promise((s,n)=>{var a=t=>{try{o(i.next(t))}catch(t){n(t)}},r=t=>{try{o(i.throw(t))}catch(t){n(t)}},o=t=>t.done?s(t.value):Promise.resolve(t.value).then(a,r);o((i=i.apply(t,e)).next())});const d=require("apexcharts/core");function u(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t)for(const i in t)if("default"!==i){const s=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:()=>t[i]})}return e.default=t,Object.freeze(e)}const p=u(d),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} ",f=p.__apex_axes_AxesUtils,m=p.__apex_Data,x=p.__apex_Series,y=p.__apex_Utils,_=p.__apex_Environment_Environment,b=p.__apex_math_SVGNS;class w{constructor(t,e){this.w=t,this.ctx=e}svgStringToNode(t){return(new DOMParser).parseFromString(t,"image/svg+xml").documentElement}scaleSvgNode(t,e){const i=parseFloat(t.getAttributeNS(null,"width")),s=parseFloat(t.getAttributeNS(null,"height"));t.setAttributeNS(null,"width",i*e),t.setAttributeNS(null,"height",s*e),t.setAttributeNS(null,"viewBox","0 0 "+i+" "+s)}inlineCanvasLayers(t){const e=this.w.dom.elWrap.querySelectorAll(".apexcharts-series-canvas");if(!e.length)return;const i=t.querySelectorAll(".apexcharts-canvas-series");for(let t=0;t<e.length&&t<i.length;t++){let s;try{s=e[t].toDataURL()}catch(t){continue}const n=i[t],a=document.createElementNS(b,"image");a.setAttribute("x",n.getAttribute("x")||"0"),a.setAttribute("y",n.getAttribute("y")||"0"),a.setAttribute("width",n.getAttribute("width")||"0"),a.setAttribute("height",n.getAttribute("height")||"0"),a.setAttribute("href",s),a.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",s),n.parentNode&&n.parentNode.replaceChild(a,n)}}getSvgString(t){return new Promise(e=>{const i=this.w;let s=t||i.config.chart.toolbar.export.scale||i.config.chart.toolbar.export.width/i.globals.svgWidth;s||(s=1);const n=i.globals.svgWidth*s,a=i.globals.svgHeight*s,r=i.dom.elWrap.cloneNode(!0);r.style.width=n+"px",r.style.height=a+"px",this.inlineCanvasLayers(r);const o=(new XMLSerializer).serializeToString(r);let l="\n .apexcharts-tooltip, .apexcharts-toolbar, .apexcharts-xaxistooltip, .apexcharts-yaxistooltip, .apexcharts-xcrosshairs, .apexcharts-ycrosshairs, .apexcharts-zoom-rect, .apexcharts-selection-rect {\n display: none;\n }\n ";i.config.legend.show&&i.dom.elLegendWrap&&i.dom.elLegendWrap.children.length>0&&(l+=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="${i.globals.svgWidth}px" height="${i.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 ${l}\n </style>\n ${o}\n </div>\n </foreignObject>\n </svg>\n `;const h=this.svgStringToNode(c);1!==s&&this.scaleSvgNode(h,s),this.convertImagesToBase64(h).then(()=>{c=(new XMLSerializer).serializeToString(h),e(c.replace(/ /g," "))})})}convertImagesToBase64(t){const e=t.getElementsByTagName("image"),i=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(i)}getBase64FromUrl(t){return _.isSSR()?Promise.resolve(t):new Promise((e,i)=>{const s=new Image;s.crossOrigin="Anonymous",s.onload=()=>{const t=document.createElement("canvas");t.width=s.width,t.height=s.height;const i=t.getContext("2d");i&&i.drawImage(s,0,0),e(t.toDataURL())},s.onerror=i,s.src=t})}svgUrl(){return new Promise(t=>{this.getSvgString().then(e=>{const i=new Blob([e],{type:"image/svg+xml;charset=utf-8"});t(URL.createObjectURL(i))})})}dataURI(t){return _.isSSR()?Promise.resolve({imgURI:""}):new Promise(e=>{const i=this.w,s=t?t.scale||t.width/i.globals.svgWidth:1,n=document.createElement("canvas");n.width=i.globals.svgWidth*s,n.height=parseInt(i.dom.elWrap.style.height,10)*s;const a="transparent"!==i.config.chart.background&&i.config.chart.background?i.config.chart.background:"#fff",r=n.getContext("2d");r&&(r.fillStyle=a,r.fillRect(0,0,n.width*s,n.height*s),this.getSvgString(s).then(t=>{const i="data:image/svg+xml,"+encodeURIComponent(t),s=new Image;s.crossOrigin="anonymous",s.onload=()=>{r.drawImage(s,0,0);const t=n;if(t.msToBlob){const i=t.msToBlob();e({blob:i})}else{const t=n.toDataURL("image/png");e({imgURI:t})}},s.src=i}))})}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,i=t?{scale:t}:e?{width:e}:void 0;this.dataURI(i).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:i=",",lineDelimiter:s="\n"}){const n=this.w;t||(t=n.config.series);let a=[];const r=[];let o="";const l=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():y.isNumber(t)?t:t.split(i).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)),u=new m(this.w),p=new f(this.w,{theme:this.ctx.theme,timeScale:this.ctx.timeScale}),g=t=>{let e="";if(n.globals.axisCharts){if("category"===n.config.xaxis.type||n.config.xaxis.convertedCatToNumeric)if(n.globals.isBarHorizontal){const i=n.formatters.yLabelFormatters[0],s=new x(this.ctx.w).getActiveConfigSeriesIndex();e=i(n.labelData.labels[t],{seriesIndex:s,dataPointIndex:t,w:n})}else e=p.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(" ")),y.isNumber(e)?e:e.split(i).join(""))},_=(e,s)=>{var o,p,f,m,x,y;if(a.length&&0===s&&r.push(a.join(i)),e.data){e.data=e.data.length&&e.data||[...Array(d)].map(()=>"");for(let d=0;d<e.data.length;d++){a=[];let _=g(d);if("nullvalue"!==_){if(_||(u.isFormatXY()?_=t[s].data[d].x:u.isFormat2DArray()&&(_=t[s].data[d]?t[s].data[d][0]:"")),0===s){a.push(c(_));for(let e=0;e<n.seriesData.series.length;e++){const i=u.isFormatXY()?null==(o=t[e].data[d])?void 0:o.y:l[e][d];a.push(h(i))}}("candlestick"===n.config.chart.type||e.type&&"candlestick"===e.type)&&(a.pop(),a.push(n.candleData.seriesCandleO[s][d]),a.push(n.candleData.seriesCandleH[s][d]),a.push(n.candleData.seriesCandleL[s][d]),a.push(n.candleData.seriesCandleC[s][d])),("boxPlot"===n.config.chart.type||e.type&&"boxPlot"===e.type)&&(a.pop(),a.push(n.candleData.seriesCandleO[s][d]),a.push(n.candleData.seriesCandleH[s][d]),a.push(n.candleData.seriesCandleM[s][d]),a.push(n.candleData.seriesCandleL[s][d]),a.push(n.candleData.seriesCandleC[s][d])),"rangeBar"===n.config.chart.type&&(a.pop(),a.push(n.rangeData.seriesRangeStart[s][d]),a.push(n.rangeData.seriesRangeEnd[s][d])),("violin"===n.config.chart.type||e.type&&"violin"===e.type)&&(a.pop(),a.push(null==(p=n.violinData.seriesViolinMin[s])?void 0:p[d]),a.push(null==(f=n.violinData.seriesViolinMax[s])?void 0:f[d]),a.push(null!=(y=null==(x=null==(m=n.violinData.seriesViolinPoints[s])?void 0:m[d])?void 0:x.length)?y:0)),a.length&&r.push(a.join(i))}}}};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 s=(t.name?t.name:`series-${e}`)+"";n.globals.axisCharts&&a.push(s.split(i).join("")?s.split(i).join(""):`series-${e}`)}),n.globals.axisCharts||(a.push(n.config.chart.toolbar.export.csv.headerValue),r.push(a.join(i))),n.globals.allSeriesHasEqualX||!n.globals.axisCharts||n.config.xaxis.categories.length||n.config.labels.length?t.map((t,e)=>{n.globals.axisCharts?_(t,e):(a=[],a.push(c(n.labelData.labels[e])),a.push(h(l[e])),r.push(a.join(i)))}):(()=>{const e=new Set,s={};t.forEach((i,n)=>{null==i||i.data.forEach(i=>{let a,r;if(u.isFormatXY())a=i.x,r=i.y;else{if(!u.isFormat2DArray())return;a=i[0],r=i[1]}s[a]||(s[a]=Array(t.length).fill("")),s[a][n]=h(r),e.add(a)})}),a.length&&r.push(a.join(i)),Array.from(e).sort().forEach(t=>{r.push([c(t),s[t].join(i)])})})(),o+=r.join(s),this.triggerDownload("data:text/csv; charset=utf-8,"+encodeURIComponent("\ufeff"+o),e||n.config.chart.toolbar.export.csv.filename,".csv")}triggerDownload(t,e,i){if(_.isSSR())return;const s=document.createElement("a");s.href=t,s.download=(e||this.w.globals.chartID)+i,document.body.appendChild(s),s.click(),document.body.removeChild(s)}}d.registerFeatures({exports:w});const v=p.__apex_CoreUtils,A=p.__apex_dimensions_Dimensions,S=p.__apex_Graphics;let k=class{constructor(t){this.w=t.w,this.lgCtx=t}getLegendStyles(){if(_.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 i=document.createTextNode(g);return t.appendChild(i),t}getLegendDimensions(){const t=this.w.dom.baseEl.querySelector(".apexcharts-legend");if(!t)return{clwh:0,clww:0};const{width:e,height:i}=t.getBoundingClientRect();return{clwh:i,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 i,s,n;const a=this.w;if(a.globals.axisCharts||"radialBar"===a.config.chart.type){a.globals.resized=!0;let r=null,o=null;if(a.globals.risingSeries=[],a.globals.axisCharts){if(r=null!=(i=Array.prototype.find.call(a.dom.baseEl.querySelectorAll(".apexcharts-series"),e=>e.getAttribute("data:realIndex")===String(t)))?i:null,!r)return;o=parseInt(null!=(s=r.getAttribute("data:realIndex"))?s:"",10)}else{if(r=a.dom.baseEl.querySelector(`.apexcharts-series[rel='${t+1}']`),!r)return;o=parseInt(null!=(n=r.getAttribute("rel"))?n:"",10)-1}if(e){[{cs:a.globals.collapsedSeries,csi:a.globals.collapsedSeriesIndices},{cs:a.globals.ancillaryCollapsedSeries,csi:a.globals.ancillaryCollapsedSeriesIndices}].forEach(t=>{const e=t.cs,i=t.csi;this.riseCollapsedSeries(e,i,o)})}else this.hideSeries({seriesEl:r,realIndex:o});if(a.config.chart.accessibility.enabled){const e=a.dom.baseEl.querySelector(`.apexcharts-legend-series[rel="${t+1}"]`);if(e){const i=a.globals.collapsedSeriesIndices.includes(o)||a.globals.ancillaryCollapsedSeriesIndices.includes(o);e.setAttribute("aria-pressed",i?"true":"false");const s=e.querySelector(".apexcharts-legend-text"),n=s?s.textContent:a.seriesData.seriesNames[t],r=i?"hidden":"visible";e.setAttribute("aria-label",`${n}, ${r}. Press Enter or Space to toggle.`)}}}else{const i=a.config.chart.type;if("unit"===i)if(a.globals.resized=!0,a.globals.risingSeries=[],e)this.riseCollapsedSeries(a.globals.collapsedSeries,a.globals.collapsedSeriesIndices,t);else{const e=this.getSeriesAfterCollapsing({realIndex:t});this.lgCtx.updateSeries(e,a.config.chart.animations.dynamicAnimation.enabled)}else{const e=a.dom.Paper.findOne(` .apexcharts-series[rel='${t+1}'] path`);if("pie"===i||"polarArea"===i||"donut"===i){const t=a.config.plotOptions.pie.donut.labels;new S(this.w).pathMouseDown(e,null),this.lgCtx.printDataLabelsInner(e.node,t)}}if(a.config.chart.accessibility.enabled){const e=a.dom.baseEl.querySelector(`.apexcharts-legend-series[rel="${t+1}"]`);if(e){const i=a.globals.collapsedSeriesIndices.includes(t);e.setAttribute("aria-pressed",i?"true":"false");const s=e.querySelector(".apexcharts-legend-text"),n=s?s.textContent:a.seriesData.seriesNames[t],r=i?"hidden":"visible";e.setAttribute("aria-label",`${n}, ${r}. Press Enter or Space to toggle.`)}}}}getSeriesAfterCollapsing({realIndex:t}){var e;const i=this.w,s=i.globals,n=y.clone(i.config.series);if(s.axisCharts){const e=i.config.yaxis[s.seriesYAxisReverseMap[t]],a={index:t,data:n[t].data.slice(),type:n[t].type||i.config.chart.type,name:(s.seriesNames||[])[t]};if(e&&e.show&&e.showAlways)s.ancillaryCollapsedSeriesIndices.indexOf(t)<0&&(s.ancillaryCollapsedSeries.push(a),s.ancillaryCollapsedSeriesIndices.push(t));else if(s.collapsedSeriesIndices.indexOf(t)<0){s.collapsedSeries.push(a),s.collapsedSeriesIndices.push(t);const e=s.risingSeries.indexOf(t);s.risingSeries.splice(e,1)}}else s.collapsedSeries.push({index:t,data:n[t],type:null!=(e=i.config.series[t].type)?e:"line",name:(s.seriesNames||[])[t]}),s.collapsedSeriesIndices.push(t);return s.allSeriesCollapsed=s.collapsedSeries.length+s.ancillaryCollapsedSeries.length===i.config.series.length,this._getSeriesBasedOnCollapsedState(n)}hideSeries({seriesEl:t,realIndex:e}){const i=this.w,s=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(s,i.config.chart.animations.dynamicAnimation.enabled)}riseCollapsedSeries(t,e,i){const s=this.w;let n=y.clone(s.config.series);if(t.length>0){for(let a=0;a<t.length;a++)t[a].index===i&&(s.globals.axisCharts?n[i].data=t[a].data.slice():n[i]=t[a].data,"number"!=typeof n[i]&&(n[i].hidden=!1),t.splice(a,1),e.splice(a,1),s.globals.risingSeries.push(i),a--);n=this._getSeriesBasedOnCollapsedState(n),this.lgCtx.updateSeries(n,s.config.chart.animations.dynamicAnimation.enabled)}}_getSeriesBasedOnCollapsedState(t){const e=this.w;let i=0;return e.globals.axisCharts?t.forEach((s,n)=>{e.globals.collapsedSeriesIndices.indexOf(n)<0&&e.globals.ancillaryCollapsedSeriesIndices.indexOf(n)<0||(t[n].data=[],i++)}):t.forEach((s,n)=>{e.globals.collapsedSeriesIndices.indexOf(n)<0||(t[n]=0,i++)}),e.globals.allSeriesCollapsed=i===t.length,t}};const C=p.__apex_BrowserAPIs_BrowserAPIs,E="http://www.w3.org/2000/svg";class L{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,i,s,n;const a=null==(n=null==(s=null==(i=null==(e=null==t?void 0:t.config)?void 0:e.plotOptions)?void 0:i.heatmap)?void 0:s.colorScale)?void 0:n.gradientLegend;return!(!a||!a.enabled)}draw(){var t,e,i,s,n,a,r,o;const l=this.w,c=l.dom.elLegendWrap;if(!c)return;const h=l.config.plotOptions.heatmap.colorScale.gradientLegend,d=l.config.legend.position,u="left"===d||"right"===d,p=null!=(e=null==(t=h.arrow)?void 0:t.size)?e:8,g=p+4,f=h.showLabels?28:4,m=h.showLabels?20:4,x=h.showLabels?44:0,y=this._resolveStripLength(u?h.height:h.width,u),_=h.thickness,b=u?Math.max(_+g+4,x):y+2*f,w=u?y+2*m:_+g+4,v=(b-(_+g))/2,A=u?"left"===d?v:v+g:f,S=u?m:"top"===d?g:4,k=C.createElementNS(E,"svg");k.setAttribute("class","apexcharts-heatmap-gradient-legend"),k.setAttribute("width",String(b)),k.setAttribute("height",String(w)),k.setAttribute("overflow","visible");const L=C.createElementNS(E,"defs"),M=`apexcharts-heatmap-gradient-${l.globals.cuid}`,D=C.createElementNS(E,"linearGradient");D.setAttribute("id",M),u?(D.setAttribute("x1","0"),D.setAttribute("y1","1"),D.setAttribute("x2","0"),D.setAttribute("y2","0")):(D.setAttribute("x1","0"),D.setAttribute("y1","0"),D.setAttribute("x2","1"),D.setAttribute("y2","0"));const{min:I,max:P,stops:R,bands:X}=this._computeStops();this._min=I,this._max=P,R.forEach(t=>{const e=C.createElementNS(E,"stop");e.setAttribute("offset",`${(100*t.percent).toFixed(2)}%`),e.setAttribute("stop-color",t.color),D.appendChild(e)}),L.appendChild(D),k.appendChild(L);const F=C.createElementNS(E,"rect");if(F.setAttribute("x",String(A)),F.setAttribute("y",String(S)),F.setAttribute("width",String(u?_:y)),F.setAttribute("height",String(u?y:_)),F.setAttribute("rx","2"),F.setAttribute("fill",`url(#${M})`),k.appendChild(F),h.showLabels){const t=(null==(i=h.labelStyle)?void 0:i.colors)||(Array.isArray(l.config.legend.labels.colors)?l.config.legend.labels.colors[0]:l.config.legend.labels.colors)||l.config.chart.foreColor,e=(null==(s=h.labelStyle)?void 0:s.fontSize)||"11px",a=(null==(n=h.labelStyle)?void 0:n.fontFamily)||l.config.chart.fontFamily,r=this._getFormatter(),o=(i,s,n,r)=>{const o=C.createElementNS(E,"text");return o.setAttribute("x",String(s)),o.setAttribute("y",String(n)),o.setAttribute("text-anchor",r),o.setAttribute("dominant-baseline","middle"),o.setAttribute("fill",t),o.setAttribute("font-size",e),a&&o.setAttribute("font-family",a),o.textContent=String(i),o};if(u){const t=A+_/2;k.appendChild(o(r(I),t,S+y+10,"middle")),k.appendChild(o(r(P),t,S-10,"middle"))}else{const t=S+_/2;k.appendChild(o(r(I),A-6,t,"end")),k.appendChild(o(r(P),A+y+6,t,"start"))}}const T=(null==(a=h.arrow)?void 0:a.color)||l.config.chart.foreColor,B=this._buildArrow(p,T,d);if(k.appendChild(B),this.arrowEl=B,this._bandHitEls=[],l.config.legend.onItemHover.highlightDataSeries&&X.length>0&&X.forEach(t=>{const e=C.createElementNS(E,"rect");if(u){const i=S+y-t.p2*y,s=S+y-t.p1*y;e.setAttribute("x",String(A)),e.setAttribute("y",String(i)),e.setAttribute("width",String(_)),e.setAttribute("height",String(Math.max(0,s-i)))}else e.setAttribute("x",String(A+t.p1*y)),e.setAttribute("y",String(S)),e.setAttribute("width",String(Math.max(0,(t.p2-t.p1)*y))),e.setAttribute("height",String(_));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:u,position:d,stripX:A,stripY:S,stripLength:y,stripThickness:_,arrowSize:p,svgWidth:b,svgHeight:w},h.showHoverValue){const t=C.createElement("div");t.classList.add("apexcharts-heatmap-gradient-legend-value"),t.style.position="absolute",t.style.fontSize=(null==(r=h.labelStyle)?void 0:r.fontSize)||"11px",t.style.fontFamily=(null==(o=h.labelStyle)?void 0:o.fontFamily)||l.config.chart.fontFamily||"",t.style.color=l.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,u,b,w),this._attachHoverListeners(),this._attachBandHoverListeners()}_resolveStripLength(t,e){const i=this.w,s=e?i.globals.svgHeight||i.config.chart.height||300:i.globals.svgWidth||i.config.chart.width||600;if("string"==typeof t){const e=t.trim();if(e.endsWith("%")){const t=parseFloat(e)||0;return Math.max(20,s*t/100)}const i=parseFloat(e);return Number.isFinite(i)?i:200}return"number"==typeof t&&Number.isFinite(t)?t:200}_applyWrapAlignment(t,e,i,s,n){const a=this.w,r=a.config.plotOptions.heatmap.colorScale.gradientLegend.align||"center",o=12,l=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=s+"px",t.style.height=n+"px",t.style.right="auto",t.style.bottom="auto",i){const i=c-n-24;let a;a="start"===r?o:"end"===r?o+Math.max(0,i):o+Math.max(0,i)/2,t.style.top=a+d+"px",t.style.left="left"===e?o+h+"px":l-s-o+h+"px"}else{const i=l-s-24;let a;a="start"===r?o:"end"===r?o+Math.max(0,i):o+Math.max(0,i)/2,t.style.left=a+h+"px",t.style.top="top"===e?o+d+"px":c-n-o+d+"px"}}repositionToPlot(){var t,e;if(!_.isBrowser())return;const i=this.w,s=i.globals,n=i.dom.elLegendWrap;if(!n||!this._geom)return;if(!Number.isFinite(s.gridWidth)||!Number.isFinite(s.gridHeight))return;const{isVertical:a,position:r,svgWidth:o,svgHeight:l,stripX:c,stripY:h,stripThickness:d}=this._geom,u=i.config.plotOptions.heatmap.colorScale.gradientLegend.align||"center",p=i.config.legend.offsetX||0,g=i.config.legend.offsetY||0,f=null==(e=null==(t=this.ctx)?void 0:t.dimensions)?void 0:e.dimHelpers,m=f?f.getTitleSubtitleCoords("title").height+f.getTitleSubtitleCoords("subtitle").height:0,x=i.layout.xAxisHeight||0,y=(t,e)=>{const i=Math.max(0,t-e);return"start"===u?0:"end"===u?i:i/2};if(a){n.style.top=s.translateY+y(s.gridHeight,l)+g+"px";const t=(("left"===r?0:s.translateX+s.gridWidth)+("left"===r?s.translateX:s.svgWidth))/2;n.style.left=t-c-d/2+p+"px"}else{n.style.left=s.translateX+y(s.gridWidth,o)+p+"px";const t=(("top"===r?m:s.translateY+s.gridHeight+x)+("top"===r?s.translateY:s.svgHeight))/2;n.style.top=t-h-d/2+g+"px"}C.requestAnimationFrame(()=>this._enforceMinPlotGap())}_enforceMinPlotGap(){const t=this.w,e=t.dom.elLegendWrap,i=this.svgEl&&this.svgEl.querySelector("rect"),s=t.dom.baseEl.querySelector(".apexcharts-grid");if(!(e&&i&&s&&this._geom))return;const n=i.getBoundingClientRect(),a=s.getBoundingClientRect();if(!(n.width&&n.height&&a.width&&a.height))return;const{isVertical:r,position:o}=this._geom;if(r){const t="left"===o?a.left-n.right:n.left-a.right;if(t<16){const i=parseFloat(e.style.left)||0,s=16-t;e.style.left=i+("left"===o?-s:s)+"px"}}else{const t="top"===o?a.top-n.bottom:n.top-a.bottom;if(t<16){const i=parseFloat(e.style.top)||0,s=16-t;e.style.top=i+("top"===o?-s:s)+"px"}}}destroy(){var t,e,i,s,n,a,r;for(let i=0;i<this._bandHitEls.length;i++){const s=this._bandHitEls[i];null==(t=s.removeEventListener)||t.call(s,"mousemove",this._onBandEnter),null==(e=s.removeEventListener)||e.call(s,"mouseout",this._onBandLeave)}if(this._bandHitEls=[],this._activeBandIndex=-1,null==(i=this.ctx)?void 0:i.events)try{null==(n=(s=this.ctx.events).removeEventListener)||n.call(s,"dataPointMouseEnter",this._onCellEnter),null==(r=(a=this.ctx.events).removeEventListener)||r.call(a,"dataPointMouseLeave",this._onCellLeave)}catch(t){}}_attachBandHoverListeners(){if(_.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,i,s,n;const a=this.w,r=t.currentTarget,o=parseInt(null!=(e=r.getAttribute("data:range-index"))?e:"-1",10);o<0||o===this._activeBandIndex||(this._activeBandIndex=o,null==(n=null==(s=null==(i=this.ctx)?void 0:i.events)?void 0:s.fireEvent)||n.call(s,"legendHover",[this.ctx,o,a]),new x(a).highlightRangeInSeries(o,"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;_.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,i;const s=this.w;if(!this.arrowEl)return;const n=t[t.length-1];if(!n||"object"!=typeof n)return;const a=n.seriesIndex,r=n.dataPointIndex;if("number"!=typeof a||"number"!=typeof r)return;if("heatmap"!==s.config.chart.type)return;const o=null==(i=null==(e=s.seriesData)?void 0:e.series)?void 0:i[a],l=null==o?void 0:o[r];null==l||Number.isNaN(l)||this._positionArrow(l)}_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:i,stripX:s,stripY:n,stripLength:a,stripThickness:r,arrowSize:o}=this._geom,l=this._min,c=this._max-l;let h;if(h=0===c?.5:(t-l)/c,h<0&&(h=0),h>1&&(h=1),e){const t=n+a-h*a;let e,l;"left"===i?(e=s+r,l=e+o):(e=s,l=e-o);const c=[`${e},${t}`,`${l},${t-o/2}`,`${l},${t+o/2}`].join(" ");this.arrowEl.setAttribute("points",c)}else{const t=s+h*a;let e,l;"top"===i?(e=n+r,l=e+o):(e=n,l=e-o);const c=[`${t},${e}`,`${t-o/2},${l}`,`${t+o/2},${l}`].join(" ");this.arrowEl.setAttribute("points",c)}if(this.arrowEl.setAttribute("opacity","1"),this.hoverValueEl){const l=this._getFormatter();if(this.hoverValueEl.textContent=l(t),e){const t=n+a-h*a;"left"===i?this.hoverValueEl.style.left=`${s+r+o+8}px`:(this.hoverValueEl.style.left=s-o-8+"px",this.hoverValueEl.style.transform="translateX(-100%)"),this.hoverValueEl.style.top=t-9+"px"}else{const t=s+h*a;this.hoverValueEl.style.left=`${t}px`,this.hoverValueEl.style.transform="translateX(-50%)",this.hoverValueEl.style.top="top"===i?`${n+r+o+8}px`:n-o-18+"px"}this.hoverValueEl.style.opacity="1"}}_buildArrow(t,e,i){const s=C.createElementNS(E,"polygon");return s.setAttribute("fill",e),s.setAttribute("opacity","0"),s.setAttribute("class","apexcharts-heatmap-gradient-arrow"),s.setAttribute("points","0,0 0,0 0,0"),s.setAttribute("pointer-events","none"),s}_computeStops(){var t,e;const i=this.w,s=i.config.plotOptions.heatmap.colorScale,n=s.gradientLegend;let a=1/0,r=-1/0;const c=(null==(t=i.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 i=e[t];null==i||Number.isNaN(i)||(i<a&&(a=i),i>r&&(r=i))}}Number.isFinite(a)||(a=0),Number.isFinite(r)||(r=0);let h=a,d=r;void 0!==s.min&&(h=s.min<a?s.min:a),void 0!==s.max&&(d=s.max>r?s.max:r);const u=[],p=[];if(s.ranges&&s.ranges.length>0){const t=s.ranges.map((t,e)=>l(o({},t),{_originalIndex:e})).sort((t,e)=>t.from-e.from),e=t[0].from,i=t[t.length-1].to;h=e,d=i;const n=i-e||1;t.forEach(t=>{const i=(t.from-e)/n,s=(t.to-e)/n;u.push({percent:(i+s)/2,color:t.color}),p.push({index:t._originalIndex,p1:i,p2:s})})}else{const t=i.globals.colors[0]||"#008FFB",s=new y,a=null!=(e=i.config.plotOptions.heatmap.shadeIntensity)?e:.5,r=i.globals.hasNegs,o=Math.max(2,n.stops||16);for(let e=0;e<o;e++){const n=e/(o-1),l=h+n*(d-h),c=Math.abs(d)+Math.abs(h),p=0===c?0:100*l/c;let g;g=r?i.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,g>1&&(g=1),g<-1&&(g=-1);const f=i.config.plotOptions.heatmap.enableShades?s.shadeColor("dark"===i.config.theme.mode?-1*g:g,t):t;u.push({percent:n,color:f})}}return{min:h,max:d,stops:u,bands:p}}}const M=p.__apex_Markers;d.registerFeatures({legend:class{constructor(t,e){this.w=t,this.ctx=e,this.printDataLabelsInner=(...t)=>{var i;return null==(i=e.pie)?void 0:i.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 k(this)}init(){const t=this.w,e=t.globals,i=t.config;this.isBarsDistributed="bar"===i.chart.type&&i.plotOptions.bar.distributed&&1===i.series.length;const s=i.legend.showForSingleSeries&&1===this.w.seriesData.series.length||this.isBarsDistributed||"heatmap"===i.chart.type||this.w.seriesData.series.length>1;if(this.legendHelpers.appendToForeignObject(),(s||!e.axisCharts)&&i.legend.show){const e=t.dom.elLegendWrap;for(;e.firstChild;)e.removeChild(e.firstChild);this.heatmapGradientLegend&&(this.heatmapGradientLegend.destroy(),this.heatmapGradientLegend=null),"heatmap"===i.chart.type&&L.isEnabled(t)?(this.heatmapGradientLegend=new L(t,this.ctx),this.heatmapGradientLegend.draw()):(this.drawLegends(),"bottom"===i.legend.position||"top"===i.legend.position?this.legendAlignHorizontal():"right"!==i.legend.position&&"left"!==i.legend.position||this.legendAlignVertical())}}createLegendMarker({i:t,fillcolor:e}){const i=this.w,s=C.createElement("span");s.classList.add("apexcharts-legend-marker");const n=i.config.legend.markers.shape||i.config.markers.shape;let a=n;Array.isArray(n)&&(a=n[t]);const r=Array.isArray(i.config.legend.markers.size)?parseFloat(i.config.legend.markers.size[t]):parseFloat(i.config.legend.markers.size),c=Array.isArray(i.config.legend.markers.offsetX)?parseFloat(i.config.legend.markers.offsetX[t]):parseFloat(i.config.legend.markers.offsetX),h=Array.isArray(i.config.legend.markers.offsetY)?parseFloat(i.config.legend.markers.offsetY[t]):parseFloat(i.config.legend.markers.offsetY),d=Array.isArray(i.config.legend.markers.strokeWidth)?parseFloat(i.config.legend.markers.strokeWidth[t]):parseFloat(i.config.legend.markers.strokeWidth),u=s.style;if(u.height=2*(r+d)+"px",u.width=2*(r+d)+"px",u.left=c+"px",u.top=h+"px",i.config.legend.markers.customHTML)u.background="transparent",u.color=e[t],Array.isArray(i.config.legend.markers.customHTML)?i.config.legend.markers.customHTML[t]&&(s.innerHTML=i.config.legend.markers.customHTML[t]()):s.innerHTML=i.config.legend.markers.customHTML();else{const n=new M(this.ctx.w,this.ctx).getMarkerConfig({cssClass:`apexcharts-legend-marker apexcharts-marker apexcharts-marker-${a}`,seriesIndex:t,strokeWidth:d,size:r}),c=(_.isBrowser()?window.SVG:global.SVG)().addTo(s).size("100%","100%"),h=new S(this.w).drawMarker(0,0,l(o({},n),{pointFillColor:Array.isArray(e)?e[t]:n.pointFillColor,shape:a}));i.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 s}drawLegends(){var t;const e=this,i=this.w,s=i.dom.elLegendWrap,n=i.config.legend.fontFamily;let a=i.seriesData.seriesNames,r=i.config.legend.markers.fillColors?i.config.legend.markers.fillColors.slice():i.globals.colors.slice();if("heatmap"===i.config.chart.type){const t=i.config.plotOptions.heatmap.colorScale.ranges;a=t.map(t=>t.name?t.name:t.from+" - "+t.to),r=t.map(t=>t.color)}else this.isBarsDistributed&&(a=i.labelData.labels.slice());i.config.legend.customLegendItems.length&&(a=i.config.legend.customLegendItems);const o=i.formatters.legendFormatter,l=i.config.legend.inverseOrder,c=[];i.labelData.seriesGroups.length>1&&i.config.legend.clusterGroupedSeries&&i.labelData.seriesGroups.forEach((t,e)=>{c[e]=C.createElement("div"),c[e].classList.add("apexcharts-legend-group",`apexcharts-legend-group-${e}`),"horizontal"===i.config.legend.clusterGroupedSeriesOrientation?s.classList.add("apexcharts-legend-group-horizontal"):c[e].classList.add("apexcharts-legend-group-vertical")});for(let e=l?a.length-1:0;l?e>=0:e<=a.length-1;l?e--:e++){const l=o(a[e],{seriesIndex:e,w:i});let h=!1,d=!1;if(i.globals.collapsedSeries.length>0)for(let t=0;t<i.globals.collapsedSeries.length;t++)i.globals.collapsedSeries[t].index===e&&(h=!0);if(i.globals.ancillaryCollapsedSeriesIndices.length>0)for(let t=0;t<i.globals.ancillaryCollapsedSeriesIndices.length;t++)i.globals.ancillaryCollapsedSeriesIndices[t]===e&&(d=!0);const u=this.createLegendMarker({i:e,fillcolor:r});S.setAttrs(u,{rel:e+1,"data:collapsed":h||d}),(h||d)&&u.classList.add("apexcharts-inactive-legend");const p=C.createElement("div");if(i.config.chart.accessibility.enabled&&i.config.chart.accessibility.keyboard.enabled){p.setAttribute("role","button"),p.setAttribute("tabindex","0");const t=Array.isArray(l)?l.join(" "):l,e=h||d,i=e?"hidden":"visible";p.setAttribute("aria-label",`${t}, ${i}. Press Enter or Space to toggle.`),p.setAttribute("aria-pressed",e?"true":"false")}const g=C.createElement("span");g.classList.add("apexcharts-legend-text"),g.innerHTML=Array.isArray(l)?l.join(" "):l;let f=i.config.legend.labels.useSeriesColors?i.globals.colors[e]:Array.isArray(i.config.legend.labels.colors)?null==(t=i.config.legend.labels.colors)?void 0:t[e]:i.config.legend.labels.colors;f||(f=i.config.chart.foreColor),g.style.color=f,g.style.fontSize=i.config.legend.fontSize,g.style.fontWeight=i.config.legend.fontWeight,g.style.fontFamily=n||i.config.chart.fontFamily,S.setAttrs(g,{rel:e+1,i:e,"data:default-text":encodeURIComponent(l),"data:collapsed":h||d}),p.appendChild(u),p.appendChild(g);const m=new v(this.w);if(!i.config.legend.showForZeroSeries){0===m.getSeriesTotalByIndex(e)&&m.seriesHaveSameValues(e)&&!m.isSeriesNull(e)&&-1===i.globals.collapsedSeriesIndices.indexOf(e)&&-1===i.globals.ancillaryCollapsedSeriesIndices.indexOf(e)&&p.classList.add("apexcharts-hidden-zero-series")}i.config.legend.showForNullSeries||m.isSeriesNull(e)&&-1===i.globals.collapsedSeriesIndices.indexOf(e)&&-1===i.globals.ancillaryCollapsedSeriesIndices.indexOf(e)&&p.classList.add("apexcharts-hidden-null-series"),c.length?i.labelData.seriesGroups.forEach((t,n)=>{var a,r;t.includes(null!=(r=null==(a=i.config.series[e])?void 0:a.name)?r:"")&&(s.appendChild(c[n]),c[n].appendChild(p))}):s.appendChild(p),s.classList.add(`apexcharts-align-${i.config.legend.horizontalAlign}`),s.classList.add("apx-legend-position-"+i.config.legend.position),p.classList.add("apexcharts-legend-series"),p.style.margin=`${i.config.legend.itemMargin.vertical}px ${i.config.legend.itemMargin.horizontal}px`,s.style.width=i.config.legend.width?i.config.legend.width+"px":"",s.style.height=i.config.legend.height?i.config.legend.height+"px":"",S.setAttrs(p,{rel:e+1,seriesName:y.escapeString(a[e]),"data:collapsed":h||d}),(h||d)&&p.classList.add("apexcharts-inactive-legend"),i.config.legend.onItemClick.toggleDataSeries||p.classList.add("apexcharts-no-click")}i.dom.elWrap.addEventListener("click",e.onLegendClick,!0),i.config.legend.onItemHover.highlightDataSeries&&0===i.config.legend.customLegendItems.length&&(i.dom.elWrap.addEventListener("mousemove",e.onLegendHovered,!0),i.dom.elWrap.addEventListener("mouseout",e.onLegendHovered,!0)),i.config.chart.accessibility.enabled&&i.config.chart.accessibility.keyboard.enabled&&i.dom.elWrap.addEventListener("keydown",e.onLegendKeyDown.bind(e),!0)}setLegendWrapXY(t,e){const i=this.w,s=i.dom.elLegendWrap,n=s.clientHeight;let a=0,r=0;if("bottom"===i.config.legend.position)r=i.globals.svgHeight-Math.min(n,i.globals.svgHeight/2)-5;else if("top"===i.config.legend.position){const t=new A(this.w,this.ctx),e=t.dimHelpers.getTitleSubtitleCoords("title").height,i=t.dimHelpers.getTitleSubtitleCoords("subtitle").height;r=(e>0?e-10:0)+(i>0?i-10:0)}s.style.position="absolute",a=a+t+i.config.legend.offsetX,r=r+e+i.config.legend.offsetY,s.style.left=a+"px",s.style.top=r+"px","right"===i.config.legend.position&&(s.style.left="auto",s.style.right=25+i.config.legend.offsetX+"px");["width","height"].forEach(t=>{s&&s.style[t]&&(s.style[t]=parseInt(String(i.config.legend[t]),10)+"px")})}legendAlignHorizontal(){const t=this.w;t.dom.elLegendWrap.style.right="0";const e=new A(this.w,this.ctx),i=e.dimHelpers.getTitleSubtitleCoords("title"),s=e.dimHelpers.getTitleSubtitleCoords("subtitle");let n=0;"top"===t.config.legend.position&&(n=i.height+s.height+t.config.title.margin+t.config.subtitle.margin-10),this.setLegendWrapXY(20,n)}legendAlignVertical(){const t=this.w,e=this.legendHelpers.getLegendDimensions();let i=0;"left"===t.config.legend.position&&(i=20),"right"===t.config.legend.position&&(i=t.globals.svgWidth-e.clww-10),this.setLegendWrapXY(i,20)}onLegendHovered(t){var e;const i=this.w,s=t.target,n=s.classList.contains("apexcharts-legend-series")||s.classList.contains("apexcharts-legend-text")||s.classList.contains("apexcharts-legend-marker");if("heatmap"===i.config.chart.type||this.isBarsDistributed){if(n){const i=parseInt(null!=(e=s.getAttribute("rel"))?e:"0",10)-1;this.ctx.events.fireEvent("legendHover",[this.ctx,i,this.w]);const n=new x(this.ctx.w);"mousemove"===t.type?n.highlightRangeInSeries(i,"highlight"):"mouseout"===t.type&&n.highlightRangeInSeries(i,"reset")}}else if(!s.classList.contains("apexcharts-inactive-legend")&&n){new x(this.ctx.w).toggleSeriesOnHover(t,s)}}onLegendKeyDown(t){const e=this,i=this.w,s=t.target;if((s.classList.contains("apexcharts-legend-series")||s.classList.contains("apexcharts-legend-text")||s.classList.contains("apexcharts-legend-marker"))&&("Enter"===t.key||" "===t.key)){t.preventDefault();const n=s.getAttribute("rel");e.onLegendClick(t),null!==n&&i.config.legend.onItemClick.toggleDataSeries&&requestAnimationFrame(()=>{const t=i.dom.baseEl.querySelector(`.apexcharts-legend-series[rel="${n}"]`);t&&t.focus()})}}onLegendClick(t){var e;const i=this.w,s=t.target;if(!i.config.legend.customLegendItems.length&&(s.classList.contains("apexcharts-legend-series")||s.classList.contains("apexcharts-legend-text")||s.classList.contains("apexcharts-legend-marker"))){const t=parseInt(null!=(e=s.getAttribute("rel"))?e:"0",10)-1,n="true"===s.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 r=this.w.config.legend.markers.onClick;"function"==typeof r&&s.classList.contains("apexcharts-legend-marker")&&(r(this.ctx,t,this.w),this.ctx.events.fireEvent("legendMarkerClick",[this.ctx,t,this.w]));"treemap"!==i.config.chart.type&&"heatmap"!==i.config.chart.type&&!this.isBarsDistributed&&i.config.legend.onItemClick.toggleDataSeries&&this.legendHelpers.toggleDataSeries(t,n)}}}});class D{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.elMeasure=null,this.elZoomReset=null,this.elMenuIcon=null,this.elMenu=null,this.elMenuItems=[],this.t=null}createToolbar(){var t,e;const i=this.w,s=()=>C.createElementNS("http://www.w3.org/1999/xhtml","div"),n=()=>{const t=C.createElementNS("http://www.w3.org/1999/xhtml","button");return t.setAttribute("type","button"),t},a=s();if(a.setAttribute("class","apexcharts-toolbar"),a.style.top=i.config.chart.toolbar.offsetY+"px",a.style.right=3-i.config.chart.toolbar.offsetX+"px",i.dom.elWrap.appendChild(a),this.elZoom=n(),this.elZoomIn=n(),this.elZoomOut=n(),this.elPan=n(),this.elSelection=n(),this.elMeasure=n(),this.elZoomReset=n(),this.elMenuIcon=n(),this.elMenu=s(),this.elCustomIcons=[],this.t=i.config.chart.toolbar.tools,Array.isArray(this.t.customIcons))for(let t=0;t<this.t.customIcons.length;t++)this.elCustomIcons.push(n());const r=[],o=(t,e,s)=>{const n=t.toLowerCase();this.t[n]&&i.config.chart.zoom.enabled&&r.push({el:e,icon:"string"==typeof this.t[n]?this.t[n]:s,title:this.localeValues[t],class:`apexcharts-${n}-icon`})};o("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'),o("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 l=t=>{this.t[t]&&i.config.chart[t].enabled&&r.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" 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"===t?"selectionZoom":"selection"],class:`apexcharts-${t}-icon`})};l("zoom"),l("selection"),this.t.pan&&i.config.chart.zoom.enabled&&r.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"}),this.t.measure&&i.config.chart.measure&&i.config.chart.measure.enabled&&r.push({el:this.elMeasure,icon:"string"==typeof this.t.measure?this.t.measure:'<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="M21.3 15.3a2.4 2.4 0 0 1 0 3.4l-2.6 2.6a2.4 2.4 0 0 1-3.4 0L2.7 8.7a2.4 2.4 0 0 1 0-3.4l2.6-2.6a2.4 2.4 0 0 1 3.4 0Z"/>\n <path d="m14.5 12.5 2-2"/>\n <path d="m11.5 9.5 2-2"/>\n <path d="m8.5 6.5 2-2"/>\n <path d="m17.5 15.5 2-2"/>\n</svg>\n',title:this.localeValues.measure||"Measure",class:"apexcharts-measure-icon"}),o("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&&r.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++)r.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});r.forEach((t,e)=>{t.index&&y.moveIndexInArray(r,e,t.index)});for(let t=0;t<r.length;t++)S.setAttrs(r[t].el,{class:r[t].class,title:r[t].title,"aria-label":r[t].title}),r[t].el.innerHTML=r[t].icon,a.appendChild(r[t].el);this.elZoom.parentNode&&this.elZoom.setAttribute("aria-pressed",String(!!i.interact.zoomEnabled)),this.elSelection.parentNode&&this.elSelection.setAttribute("aria-pressed",String(!!i.interact.selectionEnabled)),this.elPan.parentNode&&this.elPan.setAttribute("aria-pressed",String(!!i.interact.panEnabled)),this.elMeasure.parentNode&&this.elMeasure.setAttribute("aria-pressed",String(!!i.interact.measureEnabled)),this.elMenuIcon.parentNode&&(this.elMenuIcon.setAttribute("aria-haspopup","true"),this.elMenuIcon.setAttribute("aria-expanded","false")),this._createHamburgerMenu(a),i.interact.zoomEnabled?this.elZoom.classList.add(this.selectedClass):i.interact.panEnabled?this.elPan.classList.add(this.selectedClass):i.interact.selectionEnabled?this.elSelection.classList.add(this.selectedClass):i.interact.measureEnabled&&this.elMeasure&&(this.elMeasure.classList.add(this.selectedClass),null==(e=null==(t=this.ctx.measure)?void 0:t.startMeasure)||e.call(t)),this.addToolbarEventListeners()}_createHamburgerMenu(t){this.elMenuItems=[],t.appendChild(this.elMenu),S.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(C.createElementNS("http://www.w3.org/1999/xhtml","div")),this.elMenuItems[t].innerHTML=e[t].title,S.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,i,s,n,a,r,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==(i=this.elZoom)||i.addEventListener("click",this.toggleZoomSelection.bind(this,"zoom")),null==(s=this.elZoomIn)||s.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==(r=this.elMeasure)||r.addEventListener("click",this.toggleMeasure.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.elMeasure,this.elMenuIcon,...this.elCustomIcons].forEach(t=>{t.addEventListener("keydown",e=>{if("Enter"===e.key||" "===e.key){e.preventDefault();const i=t.className;t.click(),requestAnimationFrame(()=>{const t=this.w.dom.baseEl;if(!t)return;const e=i.split(" ").find(t=>t.startsWith("apexcharts-"));if(!e)return;const s=t.querySelector(`.${e}`);s&&s.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",i=>{var s;if("ArrowDown"===i.key){i.preventDefault();(this.elMenuItems[e+1]||this.elMenuItems[0]).focus()}else if("ArrowUp"===i.key){i.preventDefault();(this.elMenuItems[e-1]||this.elMenuItems[this.elMenuItems.length-1]).focus