apexcharts 8.3.0 → 8.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -7
- package/dist/apexcharts.common.js +2 -2
- package/dist/apexcharts.core.js +19754 -19772
- package/dist/apexcharts.core.min.js +2 -2
- package/dist/apexcharts.css +3 -8
- package/dist/apexcharts.esm.js +233 -171
- package/dist/apexcharts.full.js +20740 -20714
- package/dist/apexcharts.full.min.js +2 -2
- package/dist/apexcharts.js +20664 -20653
- package/dist/apexcharts.min.js +2 -2
- package/dist/apexcharts.ssr.common.js +2 -2
- package/dist/apexcharts.ssr.esm.js +20664 -20653
- package/dist/area.common.js +1 -1
- package/dist/area.esm.js +1 -1
- package/dist/bar.common.js +2 -2
- package/dist/bar.esm.js +46 -13
- package/dist/bar.js +2 -2
- package/dist/boxPlot.common.js +2 -2
- package/dist/boxPlot.esm.js +46 -13
- package/dist/bubble.common.js +1 -1
- package/dist/bubble.esm.js +1 -1
- package/dist/candlestick.common.js +2 -2
- package/dist/candlestick.esm.js +46 -13
- package/dist/candlestick.js +2 -2
- package/dist/column.common.js +2 -2
- package/dist/column.esm.js +46 -13
- package/dist/core.common.js +2 -2
- package/dist/core.esm.js +19754 -19772
- package/dist/donut.common.js +2 -2
- package/dist/donut.esm.js +3 -9
- package/dist/dumbbell.common.js +2 -2
- package/dist/dumbbell.esm.js +46 -13
- package/dist/features/all.common.js +2 -2
- package/dist/features/all.esm.js +193 -138
- package/dist/features/annotations.common.js +2 -2
- package/dist/features/annotations.esm.js +65 -48
- package/dist/features/annotations.js +2 -2
- package/dist/features/context-menu.common.js +1 -1
- package/dist/features/context-menu.esm.js +1 -1
- package/dist/features/context-menu.js +1 -1
- package/dist/features/drilldown.common.js +1 -1
- package/dist/features/drilldown.esm.js +1 -1
- package/dist/features/drilldown.js +1 -1
- package/dist/features/dumbbell.common.js +1 -1
- package/dist/features/dumbbell.esm.js +1 -1
- package/dist/features/dumbbell.js +1 -1
- package/dist/features/exports.common.js +2 -2
- package/dist/features/exports.esm.js +10 -4
- package/dist/features/exports.js +2 -2
- package/dist/features/facet.common.js +1 -1
- package/dist/features/facet.esm.js +1 -1
- package/dist/features/facet.js +1 -1
- package/dist/features/highlight-filter.common.js +1 -1
- package/dist/features/highlight-filter.esm.js +1 -1
- package/dist/features/highlight-filter.js +1 -1
- package/dist/features/history.common.js +1 -1
- package/dist/features/history.esm.js +1 -1
- package/dist/features/history.js +1 -1
- package/dist/features/ink.common.js +1 -1
- package/dist/features/ink.esm.js +1 -1
- package/dist/features/ink.js +1 -1
- package/dist/features/keyboard.common.js +1 -1
- package/dist/features/keyboard.esm.js +1 -1
- package/dist/features/keyboard.js +1 -1
- package/dist/features/legend.common.js +2 -2
- package/dist/features/legend.esm.js +2 -2
- package/dist/features/legend.js +2 -2
- package/dist/features/link.common.js +1 -1
- package/dist/features/link.esm.js +1 -1
- package/dist/features/link.js +1 -1
- package/dist/features/marks.common.js +1 -1
- package/dist/features/marks.esm.js +1 -1
- package/dist/features/marks.js +1 -1
- package/dist/features/measure.common.js +1 -1
- package/dist/features/measure.esm.js +1 -1
- package/dist/features/measure.js +1 -1
- package/dist/features/morph.common.js +2 -2
- package/dist/features/morph.esm.js +9 -5
- package/dist/features/morph.js +2 -2
- package/dist/features/perspectives.common.js +2 -2
- package/dist/features/perspectives.esm.js +4 -1
- package/dist/features/perspectives.js +2 -2
- package/dist/features/raincloud.common.js +2 -2
- package/dist/features/raincloud.esm.js +26 -27
- package/dist/features/raincloud.js +2 -2
- package/dist/features/renderer-canvas.common.js +1 -1
- package/dist/features/renderer-canvas.esm.js +1 -1
- package/dist/features/renderer-canvas.js +1 -1
- package/dist/features/stats.common.js +2 -2
- package/dist/features/stats.esm.js +52 -59
- package/dist/features/stats.js +2 -2
- package/dist/features/storyboard.common.js +2 -2
- package/dist/features/storyboard.esm.js +4 -1
- package/dist/features/storyboard.js +2 -2
- package/dist/features/streamgraph.common.js +2 -2
- package/dist/features/streamgraph.esm.js +46 -13
- package/dist/features/streamgraph.js +2 -2
- package/dist/features/toolbar.common.js +2 -2
- package/dist/features/toolbar.esm.js +57 -17
- package/dist/features/toolbar.js +2 -2
- package/dist/features/trellis.common.js +2 -2
- package/dist/features/trellis.esm.js +68 -17
- package/dist/features/trellis.js +2 -2
- package/dist/features/waterfall.common.js +1 -1
- package/dist/features/waterfall.esm.js +1 -1
- package/dist/features/waterfall.js +1 -1
- package/dist/features/weave.common.js +2 -2
- package/dist/features/weave.esm.js +13 -12
- package/dist/features/weave.js +2 -2
- package/dist/full.common.js +2 -2
- package/dist/full.esm.js +125 -54
- package/dist/heatmap.common.js +1 -1
- package/dist/heatmap.esm.js +1 -1
- package/dist/heatmap.js +1 -1
- package/dist/histogram.common.js +2 -2
- package/dist/histogram.esm.js +97 -71
- package/dist/icicle.common.js +2 -2
- package/dist/icicle.esm.js +30 -12
- package/dist/icicle.js +2 -2
- package/dist/line.common.js +1 -1
- package/dist/line.esm.js +1 -1
- package/dist/line.js +1 -1
- package/dist/pictograms.common.js +1 -1
- package/dist/pictograms.esm.js +1 -1
- package/dist/pictograms.js +1 -1
- package/dist/pie.common.js +2 -2
- package/dist/pie.esm.js +3 -9
- package/dist/pie.js +2 -2
- package/dist/polarArea.common.js +2 -2
- package/dist/polarArea.esm.js +3 -9
- package/dist/radar.common.js +1 -1
- package/dist/radar.esm.js +1 -1
- package/dist/radar.js +1 -1
- package/dist/radialBar.common.js +2 -2
- package/dist/radialBar.esm.js +5 -12
- package/dist/radialBar.js +2 -2
- package/dist/raincloud.common.js +2 -2
- package/dist/raincloud.esm.js +26 -27
- package/dist/rangeArea.common.js +1 -1
- package/dist/rangeArea.esm.js +1 -1
- package/dist/rangeBar.common.js +2 -2
- package/dist/rangeBar.esm.js +46 -13
- package/dist/scatter.common.js +1 -1
- package/dist/scatter.esm.js +1 -1
- package/dist/streamgraph.common.js +2 -2
- package/dist/streamgraph.esm.js +46 -13
- package/dist/sunburst.common.js +2 -2
- package/dist/sunburst.esm.js +15 -3
- package/dist/sunburst.js +2 -2
- package/dist/treemap.common.js +2 -2
- package/dist/treemap.esm.js +38 -23
- package/dist/treemap.js +2 -2
- package/dist/unit-shapes.common.js +1 -1
- package/dist/unit-shapes.esm.js +1 -1
- package/dist/unit-shapes.js +1 -1
- package/dist/unit.common.js +1 -1
- package/dist/unit.esm.js +1 -1
- package/dist/unit.js +1 -1
- package/dist/violin.common.js +1 -1
- package/dist/violin.esm.js +1 -1
- package/dist/violin.js +1 -1
- package/dist/waterfall.common.js +2 -2
- package/dist/waterfall.esm.js +46 -13
- package/package.json +1 -1
- package/src/apexcharts.js +27 -53
- package/src/assets/apexcharts.css +3 -8
- package/src/charts/Icicle.js +33 -12
- package/src/charts/Pie.js +2 -8
- package/src/charts/Radial.js +2 -6
- package/src/charts/Treemap.js +50 -30
- package/src/charts/common/Stats.js +30 -23
- package/src/charts/common/partition/NodeTooltip.js +21 -6
- package/src/charts/common/treemap/Nested.js +2 -3
- package/src/features/raincloud.js +16 -10
- package/src/features/stats.js +67 -62
- package/src/modules/Animations.js +102 -95
- package/src/modules/AxisMapping.js +47 -12
- package/src/modules/Exports.js +12 -5
- package/src/modules/Fill.js +17 -8
- package/src/modules/Filters.js +50 -50
- package/src/modules/Graphics.js +7 -2
- package/src/modules/MorphTypeChange.js +13 -7
- package/src/modules/Series.js +2 -1
- package/src/modules/Toolbar.js +3 -2
- package/src/modules/UnitMarkRegistry.js +0 -5
- package/src/modules/ZoomPanSelection.js +4 -0
- package/src/modules/animations/Easing.js +2 -1
- package/src/modules/annotations/Helpers.js +68 -52
- package/src/modules/axes/Grid.js +21 -7
- package/src/modules/axes/YAxis.js +8 -9
- package/src/modules/dimensions/Dimensions.js +9 -3
- package/src/modules/dimensions/Grid.js +2 -2
- package/src/modules/dimensions/XAxis.js +2 -5
- package/src/modules/helpers/UpdateHelpers.js +33 -15
- package/src/modules/legend/Helpers.js +6 -1
- package/src/modules/license/LicenseEnforcer.js +5 -0
- package/src/modules/settings/Defaults.js +28 -56
- package/src/modules/settings/Globals.js +5 -0
- package/src/modules/settings/Options.js +0 -7
- package/src/modules/settings/TypeAliases.js +33 -16
- package/src/modules/tooltip/Labels.js +73 -76
- package/src/modules/tooltip/Marker.js +25 -21
- package/src/modules/tooltip/Position.js +88 -51
- package/src/modules/tooltip/Tooltip.js +222 -251
- package/src/modules/tooltip/Utils.js +64 -131
- package/src/modules/tooltip/constants.js +5 -5
- package/src/modules/trellis/TrellisTooltip.js +2 -11
- package/src/modules/weave/WeaveHost.js +18 -12
- package/src/svg/SVGFilter.js +26 -17
- package/src/utils/Utils.js +0 -14
- package/types/apexcharts.d.ts +2 -0
|
@@ -30,7 +30,7 @@ var __objRest = (source, exclude) => {
|
|
|
30
30
|
return target;
|
|
31
31
|
};
|
|
32
32
|
/*!
|
|
33
|
-
* ApexCharts v8.3.
|
|
33
|
+
* ApexCharts v8.3.1
|
|
34
34
|
* (c) 2018-2026 ApexCharts
|
|
35
35
|
*/
|
|
36
36
|
import * as _core from "apexcharts/core";
|
|
@@ -68,22 +68,55 @@ class AxisMapping {
|
|
|
68
68
|
return w.globals.minX + px * AxisMapping.xRatio(w);
|
|
69
69
|
}
|
|
70
70
|
/**
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
71
|
+
* The plot area on screen, in client px: its corner is where the plot's
|
|
72
|
+
* group is translated to (translateX, translateY into the svg), and it is
|
|
73
|
+
* gridWidth by gridHeight. The one screen-to-plot measurement: the tooltip,
|
|
74
|
+
* zoom, selection and every other pointer reader map through it, so x and y
|
|
75
|
+
* cannot disagree under CSS zoom.
|
|
76
|
+
*
|
|
77
|
+
* Never the `.apexcharts-grid` group's box: a group measures to the union
|
|
78
|
+
* of what it happens to draw (fact 2 above). The plot's outline starts a
|
|
79
|
+
* pixel down (`Grid.drawGridArea`), so unless gridlines or row bands reach
|
|
80
|
+
* the top edge the box starts a pixel below the plot, and on a numeric-x bar
|
|
81
|
+
* chart the horizontal gridlines run `barPadForNumericAxis` out past both
|
|
82
|
+
* sides.
|
|
83
|
+
*
|
|
84
|
+
* `zoom` is the CSS zoom of any container the chart sits in (screen px per
|
|
85
|
+
* plot px): the measured svg width over `svgWidth`, the unscaled width it
|
|
86
|
+
* was drawn at. A distance measured on screen from this corner is divided
|
|
87
|
+
* by it to land in plot px, the space the series are laid out and painted in.
|
|
88
|
+
* With nothing mounted to measure, screen px are taken as svg px.
|
|
89
|
+
*
|
|
90
|
+
* @param {import('../types/internal').ChartStateW} w
|
|
91
|
+
* @returns {{ left: number, top: number, width: number, height: number, zoom: number }}
|
|
92
|
+
*/
|
|
93
|
+
static plotRect(w) {
|
|
94
|
+
var _a, _b, _c;
|
|
95
|
+
const svg = ((_a = w.dom.Paper) == null ? void 0 : _a.node) || ((_b = w.dom.baseEl) == null ? void 0 : _b.querySelector(".apexcharts-svg"));
|
|
96
|
+
const box = ((_c = svg || w.dom.elWrap) == null ? void 0 : _c.getBoundingClientRect()) || {
|
|
97
|
+
left: 0,
|
|
98
|
+
top: 0,
|
|
99
|
+
width: 0
|
|
100
|
+
};
|
|
101
|
+
const zoom = (svg && w.globals.svgWidth ? box.width / w.globals.svgWidth : 1) || 1;
|
|
102
|
+
return {
|
|
103
|
+
left: box.left + w.layout.translateX * zoom,
|
|
104
|
+
top: box.top + w.layout.translateY * zoom,
|
|
105
|
+
width: w.layout.gridWidth * zoom,
|
|
106
|
+
height: w.layout.gridHeight * zoom,
|
|
107
|
+
zoom
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Client (screen) x -> pixels from the plot origin of {@link plotRect}.
|
|
112
|
+
* Pass the rect when the caller has already measured it.
|
|
76
113
|
* @param {import('../types/internal').ChartStateW} w
|
|
77
114
|
* @param {number} screenX
|
|
115
|
+
* @param {{ left: number, zoom: number }} [plot]
|
|
78
116
|
* @returns {number}
|
|
79
117
|
*/
|
|
80
|
-
static screenXToPlotPx(w, screenX) {
|
|
81
|
-
|
|
82
|
-
const svg = baseEl && baseEl.querySelector(".apexcharts-svg");
|
|
83
|
-
if (!svg) return screenX - w.layout.translateX;
|
|
84
|
-
const svgRect = svg.getBoundingClientRect();
|
|
85
|
-
const zoom = w.globals.svgWidth ? svgRect.width / w.globals.svgWidth : 1;
|
|
86
|
-
return (screenX - svgRect.left) / (zoom || 1) - w.layout.translateX;
|
|
118
|
+
static screenXToPlotPx(w, screenX, plot = AxisMapping.plotRect(w)) {
|
|
119
|
+
return (screenX - plot.left) / plot.zoom;
|
|
87
120
|
}
|
|
88
121
|
}
|
|
89
122
|
const Environment = _core.__apex_Environment_Environment;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* ApexCharts v8.3.
|
|
2
|
+
* ApexCharts v8.3.1
|
|
3
3
|
* (c) 2018-2026 ApexCharts
|
|
4
4
|
*/
|
|
5
|
-
!function(t){var e="undefined"!=typeof globalThis?globalThis:self,r=e.ApexCharts;if(r&&r.__internals)return t.call(e);if(r)throw new Error("ApexCharts: dist/features/streamgraph.js cannot register: the ApexCharts on this page has no add-on surface (a script before 7.0, or a bundled apexcharts/core class). Load apexcharts.min.js, apexcharts.core.min.js or apexcharts.full.min.js.");if("function"==typeof define&&define.amd)return t.call(e);if("object"==typeof exports&&"undefined"!=typeof module||"undefined"==typeof window||"undefined"==typeof document)throw new Error("ApexCharts: dist/features/streamgraph.js is a script-tag add-on and needs the ApexCharts script on the page. A bundler imports the matching apexcharts/ sub-path instead.");var s={file:"dist/features/streamgraph.js",run:t,done:!1},a=e.__apexcharts_pending_addons__||(e.__apexcharts_pending_addons__=[]);a.push(s),"complete"!==document.readyState&&window.addEventListener("load",function(){if(!s.done){var r=e.ApexCharts;if(r)if(r.__internals){s.done=!0;var n=a.indexOf(s);-1!==n&&a.splice(n,1);try{t.call(e),r.__drainsAddons||e.console.warn("ApexCharts: dist/features/streamgraph.js loaded before the ApexCharts script, which is older than 8.0 and does not pick up add-ons loaded first, so it registered only when the page finished loading. Put its tag after the ApexCharts script.")}catch(t){e.console.error("ApexCharts: dist/features/streamgraph.js could not register with the ApexCharts script on this page: "+(t&&t.message))}}else e.console.error("ApexCharts: dist/features/streamgraph.js cannot register: the ApexCharts on this page has no add-on surface (a script before 7.0, or a bundled apexcharts/core class). Load apexcharts.min.js, apexcharts.core.min.js or apexcharts.full.min.js.");else e.console.warn("ApexCharts: dist/features/streamgraph.js is waiting for the ApexCharts script, which had not loaded when the page finished loading. It registers when an ApexCharts 8.0 or later script loads; if the page has none, add apexcharts.min.js (or apexcharts.core.min.js, or apexcharts.full.min.js).")}})}(function(){var t,e;t=this,e=function(t){"use strict";var e=Object.defineProperty,r=Object.defineProperties,s=Object.getOwnPropertyDescriptors,a=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable,i=(t,r,s)=>r in t?e(t,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[r]=s,l=(t,e)=>{for(var r in e||(e={}))n.call(e,r)&&i(t,r,e[r]);if(a)for(var r of a(e))o.call(e,r)&&i(t,r,e[r]);return t},h=(t,e)=>r(t,s(e));const c=globalThis.ApexCharts,d=globalThis.ApexCharts.__internals.__apex_Graphics,f=globalThis.ApexCharts.__internals.__apex_Utils;class u{static xRatio(t){const e=t.layout.gridWidth||1;return(t.globals.maxX-t.globals.minX)/e}static dataXToPx(t,e){return(e-t.globals.minX)/u.xRatio(t)}static pxToDataX(t,e){return t.globals.minX+e*u.xRatio(t)}static screenXToPlotPx(t,e){const r=t.dom.baseEl,s=r&&r.querySelector(".apexcharts-svg");if(!s)return e-t.layout.translateX;const a=s.getBoundingClientRect(),n=t.globals.svgWidth?a.width/t.globals.svgWidth:1;return(e-a.left)/(n||1)-t.layout.translateX}}const p=globalThis.ApexCharts.__internals.__apex_Environment_Environment;function g(t,e){const r=(e.collapsedSeries||[]).concat(e.ancillaryCollapsedSeries||[]);return t.map((t,e)=>{const s=t||{},{hidden:i}=s,c=((t,e)=>{var r={};for(var s in t)n.call(t,s)&&e.indexOf(s)<0&&(r[s]=t[s]);if(null!=t&&a)for(var s of a(t))e.indexOf(s)<0&&o.call(t,s)&&(r[s]=t[s]);return r})(s,["hidden"]);let d=c.data;if(Array.isArray(d)&&!d.length){const t=r.find(t=>t.index===e);t&&Array.isArray(t.data)&&(d=t.data)}return h(l({},c),{data:Array.isArray(d)?d.slice():d})})}const m=["wiggle","silhouette","zero","expand"],x=["inside-out","inverse","none"];function y(t,e,r){const s=r&&void 0!==r[e]?r[e]:e+1;return null==t?{x:s,y:null,rest:{}}:Array.isArray(t)?{x:void 0!==t[0]?t[0]:s,y:t[1],rest:{}}:"object"==typeof t?{x:void 0!==t.x?t.x:s,y:t.y,rest:t}:{x:s,y:t,rest:{}}}function b(t,e){var r,s;const a=e.config,n=e.globals;if(!Array.isArray(t))return t;n.streamgraphRawSeries||(n.streamgraphRawSeries=g(t,n));const o=n.streamgraphRawSeries;if(o.some(t=>function(t){for(let e=0;e<t.length;e++){const r=t[e],s=Array.isArray(r)?r[1]:r&&"object"==typeof r?r.y:r;if(Array.isArray(s)&&2===s.length)return!0}return!1}(Array.isArray(null==t?void 0:t.data)?t.data:[])))return e.streamgraphData=null,t;const i=(null==(r=a.plotOptions)?void 0:r.streamgraph)||{},c=-1!==m.indexOf(i.offset)?i.offset:"wiggle",d=-1!==x.indexOf(i.order)?i.order:"inside-out",u=null==(s=a.xaxis)?void 0:s.categories,p=function(t){return(t.collapsedSeriesIndices||[]).concat(t.ancillaryCollapsedSeriesIndices||[])}(n),{xs:b,rows:v,grids:w}=function(t,e){var r;const s=[],a=[],n=new Map,o=[];for(let i=0;i<t.length;i++){const h=Array.isArray(null==(r=t[i])?void 0:r.data)?t[i].data:[],c=new Map;for(let t=0;t<h.length;t++){const{x:r,y:o,rest:i}=y(h[t],t,e),d=r instanceof Date?r.getTime():r;n.has(d)||(n.set(d,s.length),s.push(r),a.push(l({},i))),c.set(n.get(d),f.parseNumber(o))}o.push(c)}return{xs:s,rows:a,grids:o}}(o,u),_=function(t){const e=[];for(let r=0;r<t.length;r++){const s=t[r]instanceof Date?t[r].getTime():t[r];if("number"!=typeof s||!isFinite(s))return null;e.push(r)}const r=e.map(e=>({j:e,v:t[e]instanceof Date?t[e].getTime():t[e]}));r.sort((t,e)=>t.v-e.v);const s=r.map(t=>t.j);for(let t=0;t<s.length;t++)if(s[t]!==t)return s;return null}(b),A=_?_.map(t=>b[t]):b,S=_?_.map(t=>v[t]):v,C=A.length;let j=!1;const T=[];for(let t=0;t<o.length;t++){const e=new Array(C);for(let r=0;r<C;r++){const s=w[t].get(_?_[r]:r);let a=null==s?0:Number(s);isFinite(a)||(a=0),a<0&&(j=!0,a=0),e[r]=a}T.push(e)}j&&!n.streamgraphWarnedNegative&&(n.streamgraphWarnedNegative=!0,console.warn('ApexCharts: a streamgraph stacks parts of a whole, so negative values have no band to draw and were treated as 0. Use a stacked area (chart.type: "area", chart.stacked: true) for data that goes below zero.'));const O=[];for(let t=0;t<o.length;t++)-1===p.indexOf(t)&&O.push(t);let F=T;if("expand"===c){F=T.map(t=>t.slice());for(let t=0;t<C;t++){let e=0;for(let r=0;r<O.length;r++)e+=F[O[r]][t];if(e)for(let r=0;r<O.length;r++)F[O[r]][t]/=e}}const E=function(t,e,r){if("none"===t)return e.slice();if("inverse"===t)return e.slice().reverse();const s={},a={};for(let t=0;t<e.length;t++){const n=e[t],o=r[n];let i=0,l=-1/0,h=0;for(let t=0;t<o.length;t++)i+=o[t],o[t]>l&&(l=o[t],h=t);s[n]=i,a[n]=h}const n=e.slice().sort((t,e)=>a[t]-a[e]||t-e);let o=0,i=0;const l=[],h=[];for(let t=0;t<n.length;t++){const e=n[t];o<i?(o+=s[e],l.push(e)):(i+=s[e],h.push(e))}return h.reverse().concat(l)}(d,O,F),P=function(t,e,r,s){const a=new Array(s).fill(0);if(0===s||0===e.length)return a;if("zero"===t||"expand"===t)return a;if("silhouette"===t){for(let t=0;t<s;t++){let s=0;for(let a=0;a<e.length;a++)s+=r[e[a]][t];a[t]=-s/2}return a}let n=0;for(let t=1;t<s;t++){let s=0,o=0;for(let a=0;a<e.length;a++){const n=r[e[a]],i=n[t];let l=(i-n[t-1])/2;for(let s=0;s<a;s++){const a=r[e[s]];l+=a[t]-a[t-1]}s+=i,o+=l*i}s&&(n-=o/s),a[t]=n}return a}(c,E,F,C),W=o.map(()=>null),L=o.map(()=>null);for(let t=0;t<E.length;t++)W[E[t]]=new Array(C),L[E[t]]=new Array(C);for(let t=0;t<C;t++){let e=P[t];for(let r=0;r<E.length;r++){const s=E[r],a=W[s],n=L[s];a[t]=e,e+=F[s][t],n[t]=e}}return e.streamgraphData={names:o.map((t,e)=>{var r;return null!=(r=null==t?void 0:t.name)?r:`Series ${e+1}`}),xs:A,values:T,lows:W,highs:L,order:E,offset:c,hidden:o.map((t,e)=>e).filter(t=>-1!==p.indexOf(t))},o.map((t,e)=>{const r=W[e],s=L[e];if(!r||!s)return h(l({},t),{data:[]});const a=new Array(C);for(let t=0;t<C;t++)a[t]=h(l({},S[t]),{x:A[t],y:[r[t],s[t]]});return h(l({},t),{data:a})})}const v="__apexcharts_series_transforms__";var w,_;globalThis[v]||(globalThis[v]={}),w="streamgraph","function"==typeof(_=b)?globalThis[v][w]=_:console.warn(`ApexCharts: registerSeriesTransform("${w}") expects a function (series, w) => series.`),c.registerFeatures({streamgraph:class{constructor(t,e){this.w=t,this.ctx=e,this._hovered=-1}isActive(){return"streamgraph"===this.w.config.chart.requestedType}_yPx(t){var e;const r=this.w,s=r.globals,a=r.layout.gridHeight,n=s.maxY-s.minY;if(!n||!isFinite(n))return a/2;const o=(t-s.minY)/n;return(null==(e=r.config.yaxis[0])?void 0:e.reversed)?o*a:a-o*a}draw(){this.isActive()&&(this.clearDim(),this.bindHover(),this.drawLabels())}drawLabels(){var t,e,r,s,a,n,o;const i=this.w;if(!this.isActive())return;const l=null==(e=null==(t=i.config.plotOptions)?void 0:t.streamgraph)?void 0:e.labels;if(!l||!1===l.show)return;const h=i.dom.elGraphical,c=i.streamgraphData;if(!h||!c)return;this.removeLabels();const f=new d(i,this.ctx),u=f.group({class:"apexcharts-streamgraph-labels"}),p=(null==(r=l.style)?void 0:r.fontSize)||"auto",g=(null==(s=l.style)?void 0:s.fontFamily)||i.config.chart.fontFamily,m=(null==(a=l.style)?void 0:a.fontWeight)||600,x=null==l.minWidth?24:l.minWidth,y=[];for(let t=0;t<c.order.length;t++){const e=c.order[t],r=this._placeLabel(e,{fontSize:p,fontFamily:g,fontWeight:m,minWidth:x,graphics:f});r&&y.push(r)}let b=0;for(const t of this._deconflict(y)){const e=t.k,r=f.drawText({x:t.x,y:t.y,text:t.text,textAnchor:"middle",dominantBaseline:"middle",fontSize:t.fontSize,fontFamily:g,fontWeight:m,foreColor:(null==(o=null==(n=l.style)?void 0:n.colors)?void 0:o[e])||t.color,cssClass:"apexcharts-streamgraph-label"});r.node.setAttribute("data:realIndex",String(e)),u.add(r),b++}if(!b)return;const v=h.node.querySelector(".apexcharts-xaxis");v?h.node.insertBefore(u.node,v):h.add(u),this.holdUntilBandsLand(u)}_placeLabel(t,{fontSize:e,fontFamily:r,fontWeight:s,minWidth:a,graphics:n}){const o=this.w,i=o.streamgraphData,l=i.lows[t],h=i.highs[t];if(!l||!h)return null;const c=o.globals.seriesXvalues[t],d=l.length;if(!Array.isArray(c)||c.length<d||0===d)return null;const f=new Array(d);let u=0;for(let t=0;t<d;t++){const e=Math.abs(this._yPx(h[t])-this._yPx(l[t]));f[t]=e,e>u&&(u=e)}if(u<=0)return null;const p=this._resolveFontSize(e,u),g=String(i.names[t]);let m=p,x=n.getTextRects(g,`${m}px`,r,"",!0,s);if(u<x.height+6)return null;const y=this._widestRun(f,c,x.height+6,d);if(!y)return null;if(x.width>y.width&&"auto"===e){const t=Math.floor(m*(y.width/x.width));if(t<this._autoBounds().min)return null;if(m=t,x=n.getTextRects(g,`${m}px`,r,"",!0,s),u<x.height+6)return null}const b=x.height+6,v=[];for(const e of this._runs(f,b,d)){const o=Number(c[e.l]),i=Number(c[e.r]);if(!isFinite(o)||!isFinite(i))continue;let f=i-o;if(f<=0&&d>1){const t=Math.abs(Number(c[Math.min(e.r+1,d-1)])-Number(c[Math.max(e.l-1,0)]));f=isFinite(t)?t:0}if(f<a||f<.35*x.width)continue;const u=x.width<=f?g:n.getTextBasedOnMaxWidth({text:g,maxWidth:f,fontSize:`${m}px`,fontFamily:r,fontWeight:s});if(!u||"..."===u)continue;const p=u===g?x.width:x.width*(u.length/g.length),y=[o+f/2];f>2.2*p&&y.push(o+p/2+2,i-p/2-2);for(const r of y){let s=e.l,a=1/0;for(let t=e.l;t<=e.r;t++){const e=Math.abs(Number(c[t])-r);e<a&&(a=e,s=t)}v.push({x:r,y:(this._yPx(l[s])+this._yPx(h[s]))/2,text:u,color:this._contrastOn(t),fontSize:`${m}px`,width:p,height:x.height})}if(v.length>=6)break}return v.length?{k:t,weight:u,candidates:v}:null}_runs(t,e,r){const s=[];let a=0;for(;a<r;){if(t[a]<e){a++;continue}let n=a,o=t[a];for(;n+1<r&&t[n+1]>=e;)n++,t[n]>o&&(o=t[n]);s.push({l:a,r:n,maxT:o}),a=n+1}return s.sort((t,e)=>e.maxT-t.maxT)}_widestRun(t,e,r,s){let a=-1;for(const n of this._runs(t,r,s)){const t=Number(e[n.r])-Number(e[n.l]);isFinite(t)&&t>a&&(a=t)}return a>=0?{width:a}:null}_deconflict(t){const e=t.slice().sort((t,e)=>e.weight-t.weight),r=[],s=t=>!r.some(e=>t.left<e.box.right&&t.right>e.box.left&&t.top<e.box.bottom&&t.bottom>e.box.top);for(const t of e)for(const e of t.candidates){const a={left:e.x-e.width/2,right:e.x+e.width/2,top:e.y-e.height/2,bottom:e.y+e.height/2};if(s(a)){r.push(h(l({k:t.k},e),{box:a}));break}}return r}_autoBounds(){var t,e;const r=(null==(e=null==(t=this.w.config.plotOptions)?void 0:t.streamgraph)?void 0:e.labels)||{};return{min:null==r.minFontSize?9:r.minFontSize,max:null==r.maxFontSize?30:r.maxFontSize}}_resolveFontSize(t,e){if("auto"!==t){const e=parseFloat(t);return isFinite(e)&&e>0?e:12}const{min:r,max:s}=this._autoBounds();return Math.max(r,Math.min(s,Math.round(.36*e)))}_contrastOn(t){var e;const r=this.w,s=null==(e=r.globals.colors)?void 0:e[t],a="string"==typeof s?f.parseHex(s):null;return a?f.relativeLuminance(a)>.45?"#000000":"#ffffff":r.config.chart.foreColor}removeLabels(){const t=this.w.dom.elGraphical,e=t&&t.node.querySelector(".apexcharts-streamgraph-labels");e&&e.parentNode&&e.parentNode.removeChild(e)}bindHover(){const t=this.w;if(!p.isBrowser())return;if(!1===this._hoverCfg().show)return;const e=t.dom.baseEl&&t.dom.baseEl.querySelector(".apexcharts-svg");e&&!e.__apexStreamHover&&(e.__apexStreamHover=!0,e.addEventListener("mousemove",t=>{this.isActive()&&this.w.streamgraphData&&this._dim(this._bandAt(t))}),e.addEventListener("mouseleave",()=>{this._dim(-1)}))}_hoverCfg(){var t,e;return(null==(e=null==(t=this.w.config.plotOptions)?void 0:t.streamgraph)?void 0:e.hover)||{}}_bandAt(t){const e=this.w,r=e.streamgraphData;if(!r||!r.order.length)return-1;const s=e.dom.baseEl&&e.dom.baseEl.querySelector(".apexcharts-svg");if(!s)return-1;const a=s.getBoundingClientRect(),n=e.globals.svgWidth?a.width/e.globals.svgWidth:1,o=u.screenXToPlotPx(e,t.clientX),i=(t.clientY-a.top)/(n||1)-e.layout.translateY;if(o<0||o>e.layout.gridWidth)return-1;if(i<0||i>e.layout.gridHeight)return-1;const l=e.globals.seriesXvalues[r.order[0]];if(!Array.isArray(l)||!l.length)return-1;const h=e.interact?e.interact.capturedDataPointIndex:-1;let c=-1;if(h>=0&&h<l.length)c=h;else{let t=1/0;for(let e=0;e<l.length;e++){const r=Math.abs(Number(l[e])-o);r<t&&(t=r,c=e)}}if(c<0)return-1;let d=-1,f=1/0;for(let t=0;t<r.order.length;t++){const e=r.order[t],s=this._yPx(r.highs[e][c]),a=this._yPx(r.lows[e][c]),n=Math.min(s,a),o=Math.max(s,a);if(i>=n&&i<=o)return e;const l=i<n?n-i:i-o;l<f&&(f=l,d=e)}return d}_dim(t){const e=this.w;if(t===this._hovered)return;this._hovered=t;const r=this._hoverCfg(),s=null==r.opacity?.35:r.opacity,a=e.dom.baseEl.querySelectorAll(".apexcharts-series"),n=e.dom.baseEl.querySelectorAll(".apexcharts-streamgraph-label"),o=(e,r)=>t<0||r===t;for(let t=0;t<a.length;t++){const e=a[t];e.style.transition="opacity .15s ease",e.style.opacity=o(0,Number(e.getAttribute("data:realIndex")))?"":String(s)}for(let t=0;t<n.length;t++){const r=n[t];r.style.transition="opacity .15s ease, fill .15s ease",o(0,Number(r.getAttribute("data:realIndex")))?this._restoreLabel(r):(r.getAttribute("data:fill")||r.setAttribute("data:fill",r.getAttribute("fill")||""),r.setAttribute("fill",e.config.chart.foreColor),r.style.opacity="0.65")}}_restoreLabel(t){const e=t.getAttribute("data:fill");e&&t.setAttribute("fill",e),t.style.opacity=""}clearDim(){this._hovered=-1;const t=this.w;if(!t.dom.baseEl)return;const e=t.dom.baseEl.querySelectorAll(".apexcharts-series");for(let t=0;t<e.length;t++)e[t].style.opacity="";const r=t.dom.baseEl.querySelectorAll(".apexcharts-streamgraph-label");for(let t=0;t<r.length;t++)this._restoreLabel(r[t])}holdUntilBandsLand(t){const e=this.w;p.isBrowser()&&e.globals.shouldAnimate&&!e.globals.animationEnded&&(t.node.classList.add("apexcharts-element-hidden"),e.globals.delayedElements.push({el:t.node,holdUntilComplete:!0}))}}}),t.default=c,t.streamgraphTransform=b,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})},"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ApexStreamgraph={})});
|
|
5
|
+
!function(t){var e="undefined"!=typeof globalThis?globalThis:self,r=e.ApexCharts;if(r&&r.__internals)return t.call(e);if(r)throw new Error("ApexCharts: dist/features/streamgraph.js cannot register: the ApexCharts on this page has no add-on surface (a script before 7.0, or a bundled apexcharts/core class). Load apexcharts.min.js, apexcharts.core.min.js or apexcharts.full.min.js.");if("function"==typeof define&&define.amd)return t.call(e);if("object"==typeof exports&&"undefined"!=typeof module||"undefined"==typeof window||"undefined"==typeof document)throw new Error("ApexCharts: dist/features/streamgraph.js is a script-tag add-on and needs the ApexCharts script on the page. A bundler imports the matching apexcharts/ sub-path instead.");var s={file:"dist/features/streamgraph.js",run:t,done:!1},a=e.__apexcharts_pending_addons__||(e.__apexcharts_pending_addons__=[]);a.push(s),"complete"!==document.readyState&&window.addEventListener("load",function(){if(!s.done){var r=e.ApexCharts;if(r)if(r.__internals){s.done=!0;var n=a.indexOf(s);-1!==n&&a.splice(n,1);try{t.call(e),r.__drainsAddons||e.console.warn("ApexCharts: dist/features/streamgraph.js loaded before the ApexCharts script, which is older than 8.0 and does not pick up add-ons loaded first, so it registered only when the page finished loading. Put its tag after the ApexCharts script.")}catch(t){e.console.error("ApexCharts: dist/features/streamgraph.js could not register with the ApexCharts script on this page: "+(t&&t.message))}}else e.console.error("ApexCharts: dist/features/streamgraph.js cannot register: the ApexCharts on this page has no add-on surface (a script before 7.0, or a bundled apexcharts/core class). Load apexcharts.min.js, apexcharts.core.min.js or apexcharts.full.min.js.");else e.console.warn("ApexCharts: dist/features/streamgraph.js is waiting for the ApexCharts script, which had not loaded when the page finished loading. It registers when an ApexCharts 8.0 or later script loads; if the page has none, add apexcharts.min.js (or apexcharts.core.min.js, or apexcharts.full.min.js).")}})}(function(){var t,e;t=this,e=function(t){"use strict";var e=Object.defineProperty,r=Object.defineProperties,s=Object.getOwnPropertyDescriptors,a=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable,i=(t,r,s)=>r in t?e(t,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[r]=s,l=(t,e)=>{for(var r in e||(e={}))n.call(e,r)&&i(t,r,e[r]);if(a)for(var r of a(e))o.call(e,r)&&i(t,r,e[r]);return t},h=(t,e)=>r(t,s(e));const c=globalThis.ApexCharts,d=globalThis.ApexCharts.__internals.__apex_Graphics,u=globalThis.ApexCharts.__internals.__apex_Utils;class f{static xRatio(t){const e=t.layout.gridWidth||1;return(t.globals.maxX-t.globals.minX)/e}static dataXToPx(t,e){return(e-t.globals.minX)/f.xRatio(t)}static pxToDataX(t,e){return t.globals.minX+e*f.xRatio(t)}static plotRect(t){var e,r,s;const a=(null==(e=t.dom.Paper)?void 0:e.node)||(null==(r=t.dom.baseEl)?void 0:r.querySelector(".apexcharts-svg")),n=(null==(s=a||t.dom.elWrap)?void 0:s.getBoundingClientRect())||{left:0,top:0,width:0},o=(a&&t.globals.svgWidth?n.width/t.globals.svgWidth:1)||1;return{left:n.left+t.layout.translateX*o,top:n.top+t.layout.translateY*o,width:t.layout.gridWidth*o,height:t.layout.gridHeight*o,zoom:o}}static screenXToPlotPx(t,e,r=f.plotRect(t)){return(e-r.left)/r.zoom}}const p=globalThis.ApexCharts.__internals.__apex_Environment_Environment;function g(t,e){const r=(e.collapsedSeries||[]).concat(e.ancillaryCollapsedSeries||[]);return t.map((t,e)=>{const s=t||{},{hidden:i}=s,c=((t,e)=>{var r={};for(var s in t)n.call(t,s)&&e.indexOf(s)<0&&(r[s]=t[s]);if(null!=t&&a)for(var s of a(t))e.indexOf(s)<0&&o.call(t,s)&&(r[s]=t[s]);return r})(s,["hidden"]);let d=c.data;if(Array.isArray(d)&&!d.length){const t=r.find(t=>t.index===e);t&&Array.isArray(t.data)&&(d=t.data)}return h(l({},c),{data:Array.isArray(d)?d.slice():d})})}const m=["wiggle","silhouette","zero","expand"],x=["inside-out","inverse","none"];function y(t,e,r){const s=r&&void 0!==r[e]?r[e]:e+1;return null==t?{x:s,y:null,rest:{}}:Array.isArray(t)?{x:void 0!==t[0]?t[0]:s,y:t[1],rest:{}}:"object"==typeof t?{x:void 0!==t.x?t.x:s,y:t.y,rest:t}:{x:s,y:t,rest:{}}}function b(t,e){var r,s;const a=e.config,n=e.globals;if(!Array.isArray(t))return t;n.streamgraphRawSeries||(n.streamgraphRawSeries=g(t,n));const o=n.streamgraphRawSeries;if(o.some(t=>function(t){for(let e=0;e<t.length;e++){const r=t[e],s=Array.isArray(r)?r[1]:r&&"object"==typeof r?r.y:r;if(Array.isArray(s)&&2===s.length)return!0}return!1}(Array.isArray(null==t?void 0:t.data)?t.data:[])))return e.streamgraphData=null,t;const i=(null==(r=a.plotOptions)?void 0:r.streamgraph)||{},c=-1!==m.indexOf(i.offset)?i.offset:"wiggle",d=-1!==x.indexOf(i.order)?i.order:"inside-out",f=null==(s=a.xaxis)?void 0:s.categories,p=function(t){return(t.collapsedSeriesIndices||[]).concat(t.ancillaryCollapsedSeriesIndices||[])}(n),{xs:b,rows:v,grids:w}=function(t,e){var r;const s=[],a=[],n=new Map,o=[];for(let i=0;i<t.length;i++){const h=Array.isArray(null==(r=t[i])?void 0:r.data)?t[i].data:[],c=new Map;for(let t=0;t<h.length;t++){const{x:r,y:o,rest:i}=y(h[t],t,e),d=r instanceof Date?r.getTime():r;n.has(d)||(n.set(d,s.length),s.push(r),a.push(l({},i))),c.set(n.get(d),u.parseNumber(o))}o.push(c)}return{xs:s,rows:a,grids:o}}(o,f),_=function(t){const e=[];for(let r=0;r<t.length;r++){const s=t[r]instanceof Date?t[r].getTime():t[r];if("number"!=typeof s||!isFinite(s))return null;e.push(r)}const r=e.map(e=>({j:e,v:t[e]instanceof Date?t[e].getTime():t[e]}));r.sort((t,e)=>t.v-e.v);const s=r.map(t=>t.j);for(let t=0;t<s.length;t++)if(s[t]!==t)return s;return null}(b),A=_?_.map(t=>b[t]):b,S=_?_.map(t=>v[t]):v,C=A.length;let j=!1;const T=[];for(let t=0;t<o.length;t++){const e=new Array(C);for(let r=0;r<C;r++){const s=w[t].get(_?_[r]:r);let a=null==s?0:Number(s);isFinite(a)||(a=0),a<0&&(j=!0,a=0),e[r]=a}T.push(e)}j&&!n.streamgraphWarnedNegative&&(n.streamgraphWarnedNegative=!0,console.warn('ApexCharts: a streamgraph stacks parts of a whole, so negative values have no band to draw and were treated as 0. Use a stacked area (chart.type: "area", chart.stacked: true) for data that goes below zero.'));const O=[];for(let t=0;t<o.length;t++)-1===p.indexOf(t)&&O.push(t);let F=T;if("expand"===c){F=T.map(t=>t.slice());for(let t=0;t<C;t++){let e=0;for(let r=0;r<O.length;r++)e+=F[O[r]][t];if(e)for(let r=0;r<O.length;r++)F[O[r]][t]/=e}}const P=function(t,e,r){if("none"===t)return e.slice();if("inverse"===t)return e.slice().reverse();const s={},a={};for(let t=0;t<e.length;t++){const n=e[t],o=r[n];let i=0,l=-1/0,h=0;for(let t=0;t<o.length;t++)i+=o[t],o[t]>l&&(l=o[t],h=t);s[n]=i,a[n]=h}const n=e.slice().sort((t,e)=>a[t]-a[e]||t-e);let o=0,i=0;const l=[],h=[];for(let t=0;t<n.length;t++){const e=n[t];o<i?(o+=s[e],l.push(e)):(i+=s[e],h.push(e))}return h.reverse().concat(l)}(d,O,F),W=function(t,e,r,s){const a=new Array(s).fill(0);if(0===s||0===e.length)return a;if("zero"===t||"expand"===t)return a;if("silhouette"===t){for(let t=0;t<s;t++){let s=0;for(let a=0;a<e.length;a++)s+=r[e[a]][t];a[t]=-s/2}return a}let n=0;for(let t=1;t<s;t++){let s=0,o=0;for(let a=0;a<e.length;a++){const n=r[e[a]],i=n[t];let l=(i-n[t-1])/2;for(let s=0;s<a;s++){const a=r[e[s]];l+=a[t]-a[t-1]}s+=i,o+=l*i}s&&(n-=o/s),a[t]=n}return a}(c,P,F,C),E=o.map(()=>null),z=o.map(()=>null);for(let t=0;t<P.length;t++)E[P[t]]=new Array(C),z[P[t]]=new Array(C);for(let t=0;t<C;t++){let e=W[t];for(let r=0;r<P.length;r++){const s=P[r],a=E[s],n=z[s];a[t]=e,e+=F[s][t],n[t]=e}}return e.streamgraphData={names:o.map((t,e)=>{var r;return null!=(r=null==t?void 0:t.name)?r:`Series ${e+1}`}),xs:A,values:T,lows:E,highs:z,order:P,offset:c,hidden:o.map((t,e)=>e).filter(t=>-1!==p.indexOf(t))},o.map((t,e)=>{const r=E[e],s=z[e];if(!r||!s)return h(l({},t),{data:[]});const a=new Array(C);for(let t=0;t<C;t++)a[t]=h(l({},S[t]),{x:A[t],y:[r[t],s[t]]});return h(l({},t),{data:a})})}const v="__apexcharts_series_transforms__";var w,_;globalThis[v]||(globalThis[v]={}),w="streamgraph","function"==typeof(_=b)?globalThis[v][w]=_:console.warn(`ApexCharts: registerSeriesTransform("${w}") expects a function (series, w) => series.`),c.registerFeatures({streamgraph:class{constructor(t,e){this.w=t,this.ctx=e,this._hovered=-1}isActive(){return"streamgraph"===this.w.config.chart.requestedType}_yPx(t){var e;const r=this.w,s=r.globals,a=r.layout.gridHeight,n=s.maxY-s.minY;if(!n||!isFinite(n))return a/2;const o=(t-s.minY)/n;return(null==(e=r.config.yaxis[0])?void 0:e.reversed)?o*a:a-o*a}draw(){this.isActive()&&(this.clearDim(),this.bindHover(),this.drawLabels())}drawLabels(){var t,e,r,s,a,n,o;const i=this.w;if(!this.isActive())return;const l=null==(e=null==(t=i.config.plotOptions)?void 0:t.streamgraph)?void 0:e.labels;if(!l||!1===l.show)return;const h=i.dom.elGraphical,c=i.streamgraphData;if(!h||!c)return;this.removeLabels();const u=new d(i,this.ctx),f=u.group({class:"apexcharts-streamgraph-labels"}),p=(null==(r=l.style)?void 0:r.fontSize)||"auto",g=(null==(s=l.style)?void 0:s.fontFamily)||i.config.chart.fontFamily,m=(null==(a=l.style)?void 0:a.fontWeight)||600,x=null==l.minWidth?24:l.minWidth,y=[];for(let t=0;t<c.order.length;t++){const e=c.order[t],r=this._placeLabel(e,{fontSize:p,fontFamily:g,fontWeight:m,minWidth:x,graphics:u});r&&y.push(r)}let b=0;for(const t of this._deconflict(y)){const e=t.k,r=u.drawText({x:t.x,y:t.y,text:t.text,textAnchor:"middle",dominantBaseline:"middle",fontSize:t.fontSize,fontFamily:g,fontWeight:m,foreColor:(null==(o=null==(n=l.style)?void 0:n.colors)?void 0:o[e])||t.color,cssClass:"apexcharts-streamgraph-label"});r.node.setAttribute("data:realIndex",String(e)),f.add(r),b++}if(!b)return;const v=h.node.querySelector(".apexcharts-xaxis");v?h.node.insertBefore(f.node,v):h.add(f),this.holdUntilBandsLand(f)}_placeLabel(t,{fontSize:e,fontFamily:r,fontWeight:s,minWidth:a,graphics:n}){const o=this.w,i=o.streamgraphData,l=i.lows[t],h=i.highs[t];if(!l||!h)return null;const c=o.globals.seriesXvalues[t],d=l.length;if(!Array.isArray(c)||c.length<d||0===d)return null;const u=new Array(d);let f=0;for(let t=0;t<d;t++){const e=Math.abs(this._yPx(h[t])-this._yPx(l[t]));u[t]=e,e>f&&(f=e)}if(f<=0)return null;const p=this._resolveFontSize(e,f),g=String(i.names[t]);let m=p,x=n.getTextRects(g,`${m}px`,r,"",!0,s);if(f<x.height+6)return null;const y=this._widestRun(u,c,x.height+6,d);if(!y)return null;if(x.width>y.width&&"auto"===e){const t=Math.floor(m*(y.width/x.width));if(t<this._autoBounds().min)return null;if(m=t,x=n.getTextRects(g,`${m}px`,r,"",!0,s),f<x.height+6)return null}const b=x.height+6,v=[];for(const e of this._runs(u,b,d)){const o=Number(c[e.l]),i=Number(c[e.r]);if(!isFinite(o)||!isFinite(i))continue;let u=i-o;if(u<=0&&d>1){const t=Math.abs(Number(c[Math.min(e.r+1,d-1)])-Number(c[Math.max(e.l-1,0)]));u=isFinite(t)?t:0}if(u<a||u<.35*x.width)continue;const f=x.width<=u?g:n.getTextBasedOnMaxWidth({text:g,maxWidth:u,fontSize:`${m}px`,fontFamily:r,fontWeight:s});if(!f||"..."===f)continue;const p=f===g?x.width:x.width*(f.length/g.length),y=[o+u/2];u>2.2*p&&y.push(o+p/2+2,i-p/2-2);for(const r of y){let s=e.l,a=1/0;for(let t=e.l;t<=e.r;t++){const e=Math.abs(Number(c[t])-r);e<a&&(a=e,s=t)}v.push({x:r,y:(this._yPx(l[s])+this._yPx(h[s]))/2,text:f,color:this._contrastOn(t),fontSize:`${m}px`,width:p,height:x.height})}if(v.length>=6)break}return v.length?{k:t,weight:f,candidates:v}:null}_runs(t,e,r){const s=[];let a=0;for(;a<r;){if(t[a]<e){a++;continue}let n=a,o=t[a];for(;n+1<r&&t[n+1]>=e;)n++,t[n]>o&&(o=t[n]);s.push({l:a,r:n,maxT:o}),a=n+1}return s.sort((t,e)=>e.maxT-t.maxT)}_widestRun(t,e,r,s){let a=-1;for(const n of this._runs(t,r,s)){const t=Number(e[n.r])-Number(e[n.l]);isFinite(t)&&t>a&&(a=t)}return a>=0?{width:a}:null}_deconflict(t){const e=t.slice().sort((t,e)=>e.weight-t.weight),r=[],s=t=>!r.some(e=>t.left<e.box.right&&t.right>e.box.left&&t.top<e.box.bottom&&t.bottom>e.box.top);for(const t of e)for(const e of t.candidates){const a={left:e.x-e.width/2,right:e.x+e.width/2,top:e.y-e.height/2,bottom:e.y+e.height/2};if(s(a)){r.push(h(l({k:t.k},e),{box:a}));break}}return r}_autoBounds(){var t,e;const r=(null==(e=null==(t=this.w.config.plotOptions)?void 0:t.streamgraph)?void 0:e.labels)||{};return{min:null==r.minFontSize?9:r.minFontSize,max:null==r.maxFontSize?30:r.maxFontSize}}_resolveFontSize(t,e){if("auto"!==t){const e=parseFloat(t);return isFinite(e)&&e>0?e:12}const{min:r,max:s}=this._autoBounds();return Math.max(r,Math.min(s,Math.round(.36*e)))}_contrastOn(t){var e;const r=this.w,s=null==(e=r.globals.colors)?void 0:e[t],a="string"==typeof s?u.parseHex(s):null;return a?u.relativeLuminance(a)>.45?"#000000":"#ffffff":r.config.chart.foreColor}removeLabels(){const t=this.w.dom.elGraphical,e=t&&t.node.querySelector(".apexcharts-streamgraph-labels");e&&e.parentNode&&e.parentNode.removeChild(e)}bindHover(){const t=this.w;if(!p.isBrowser())return;if(!1===this._hoverCfg().show)return;const e=t.dom.baseEl&&t.dom.baseEl.querySelector(".apexcharts-svg");e&&!e.__apexStreamHover&&(e.__apexStreamHover=!0,e.addEventListener("mousemove",t=>{this.isActive()&&this.w.streamgraphData&&this._dim(this._bandAt(t))}),e.addEventListener("mouseleave",()=>{this._dim(-1)}))}_hoverCfg(){var t,e;return(null==(e=null==(t=this.w.config.plotOptions)?void 0:t.streamgraph)?void 0:e.hover)||{}}_bandAt(t){const e=this.w,r=e.streamgraphData;if(!r||!r.order.length)return-1;const s=e.dom.baseEl&&e.dom.baseEl.querySelector(".apexcharts-svg");if(!s)return-1;const a=s.getBoundingClientRect(),n=e.globals.svgWidth?a.width/e.globals.svgWidth:1,o=f.screenXToPlotPx(e,t.clientX),i=(t.clientY-a.top)/(n||1)-e.layout.translateY;if(o<0||o>e.layout.gridWidth)return-1;if(i<0||i>e.layout.gridHeight)return-1;const l=e.globals.seriesXvalues[r.order[0]];if(!Array.isArray(l)||!l.length)return-1;const h=e.interact?e.interact.capturedDataPointIndex:-1;let c=-1;if(h>=0&&h<l.length)c=h;else{let t=1/0;for(let e=0;e<l.length;e++){const r=Math.abs(Number(l[e])-o);r<t&&(t=r,c=e)}}if(c<0)return-1;let d=-1,u=1/0;for(let t=0;t<r.order.length;t++){const e=r.order[t],s=this._yPx(r.highs[e][c]),a=this._yPx(r.lows[e][c]),n=Math.min(s,a),o=Math.max(s,a);if(i>=n&&i<=o)return e;const l=i<n?n-i:i-o;l<u&&(u=l,d=e)}return d}_dim(t){const e=this.w;if(t===this._hovered)return;this._hovered=t;const r=this._hoverCfg(),s=null==r.opacity?.35:r.opacity,a=e.dom.baseEl.querySelectorAll(".apexcharts-series"),n=e.dom.baseEl.querySelectorAll(".apexcharts-streamgraph-label"),o=(e,r)=>t<0||r===t;for(let t=0;t<a.length;t++){const e=a[t];e.style.transition="opacity .15s ease",e.style.opacity=o(0,Number(e.getAttribute("data:realIndex")))?"":String(s)}for(let t=0;t<n.length;t++){const r=n[t];r.style.transition="opacity .15s ease, fill .15s ease",o(0,Number(r.getAttribute("data:realIndex")))?this._restoreLabel(r):(r.getAttribute("data:fill")||r.setAttribute("data:fill",r.getAttribute("fill")||""),r.setAttribute("fill",e.config.chart.foreColor),r.style.opacity="0.65")}}_restoreLabel(t){const e=t.getAttribute("data:fill");e&&t.setAttribute("fill",e),t.style.opacity=""}clearDim(){this._hovered=-1;const t=this.w;if(!t.dom.baseEl)return;const e=t.dom.baseEl.querySelectorAll(".apexcharts-series");for(let t=0;t<e.length;t++)e[t].style.opacity="";const r=t.dom.baseEl.querySelectorAll(".apexcharts-streamgraph-label");for(let t=0;t<r.length;t++)this._restoreLabel(r[t])}holdUntilBandsLand(t){const e=this.w;p.isBrowser()&&e.globals.shouldAnimate&&!e.globals.animationEnded&&(t.node.classList.add("apexcharts-element-hidden"),e.globals.delayedElements.push({el:t.node,holdUntilComplete:!0}))}}}),t.default=c,t.streamgraphTransform=b,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})},"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ApexStreamgraph={})});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* ApexCharts v8.3.
|
|
2
|
+
* ApexCharts v8.3.1
|
|
3
3
|
* (c) 2018-2026 ApexCharts
|
|
4
4
|
*/
|
|
5
|
-
"use strict";var t=Object.defineProperty,e=Object.defineProperties,i=Object.getOwnPropertyDescriptors,s=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable,a=(e,i,s)=>i in e?t(e,i,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[i]=s,l=(t,e)=>{for(var i in e||(e={}))n.call(e,i)&&a(t,i,e[i]);if(s)for(var i of s(e))o.call(e,i)&&a(t,i,e[i]);return t},r=(t,s)=>e(t,i(s));Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});function c(t){if(t&&t.__esModule)return 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 h=c(require("apexcharts/core")),d=h.__apex_Graphics,u=h.__apex_axes_AxesUtils,m=h.__apex_Series,g=h.__apex_Utils,p=h.__apex_Environment_Environment,f=h.__apex_BrowserAPIs_BrowserAPIs,x=h.__apex_math_SVGNS;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 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],o=document.createElementNS(x,"image");o.setAttribute("x",n.getAttribute("x")||"0"),o.setAttribute("y",n.getAttribute("y")||"0"),o.setAttribute("width",n.getAttribute("width")||"0"),o.setAttribute("height",n.getAttribute("height")||"0"),o.setAttribute("href",s),o.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",s),n.parentNode&&n.parentNode.replaceChild(o,n)}}queryStyleable(t,e){return Array.prototype.slice.call(t.querySelectorAll(e))}setStyleDefaults(t,e){Object.keys(e).forEach(i=>{""===t.style.getPropertyValue(i)&&t.style.setProperty(i,e[i])})}applyExportStyles(t){const e=this.w;this.queryStyleable(t,"style").forEach(t=>t.remove()),this.queryStyleable(t,[".apexcharts-tooltip",".apexcharts-toolbar",".apexcharts-xaxistooltip",".apexcharts-yaxistooltip",".apexcharts-xcrosshairs",".apexcharts-ycrosshairs",".apexcharts-zoom-rect",".apexcharts-selection-rect"].join(", ")).forEach(t=>{t.style.setProperty("display","none","important")}),this.queryStyleable(t,".apexcharts-flip-y").forEach(t=>{this.setStyleDefaults(t,{transform:"scaleY(-1) translateY(-100%)","transform-origin":"top","transform-box":"fill-box"})}),this.queryStyleable(t,".apexcharts-flip-x").forEach(t=>{this.setStyleDefaults(t,{transform:"scaleX(-1)","transform-origin":"center","transform-box":"fill-box"})}),e.config.legend.show&&e.dom.elLegendWrap&&e.dom.elLegendWrap.children.length&&(this.queryStyleable(t,".apexcharts-legend").forEach(t=>{this.setStyleDefaults(t,{display:"flex",overflow:"auto",padding:"0 10px"});const e=t.classList,i=e.contains("apx-legend-position-left")||e.contains("apx-legend-position-right"),s=e.contains("apx-legend-position-top")||e.contains("apx-legend-position-bottom");e.contains("apexcharts-legend-group-horizontal")&&this.setStyleDefaults(t,{"flex-direction":"column"}),i&&this.setStyleDefaults(t,{"flex-direction":"column",bottom:"0"}),s&&this.setStyleDefaults(t,{"flex-wrap":"wrap"}),i||s&&e.contains("apexcharts-align-left")?this.setStyleDefaults(t,{"justify-content":"flex-start","align-items":"flex-start"}):s&&e.contains("apexcharts-align-center")?this.setStyleDefaults(t,{"justify-content":"center","align-items":"center"}):s&&e.contains("apexcharts-align-right")&&this.setStyleDefaults(t,{"justify-content":"flex-end","align-items":"flex-end"})}),this.queryStyleable(t,".apexcharts-legend-group").forEach(t=>{this.setStyleDefaults(t,{display:"flex"})}),this.queryStyleable(t,".apexcharts-legend-group-vertical").forEach(t=>{this.setStyleDefaults(t,{"flex-direction":"column-reverse"})}),this.queryStyleable(t,".apexcharts-legend-series").forEach(t=>{this.setStyleDefaults(t,{cursor:t.classList.contains("apexcharts-no-click")?"auto":"pointer","line-height":"normal",display:"flex","align-items":"center"})}),this.queryStyleable(t,".apexcharts-legend-text").forEach(t=>{this.setStyleDefaults(t,{position:"relative","font-size":"14px"})}),this.queryStyleable(t,".apexcharts-legend-marker").forEach(t=>{this.setStyleDefaults(t,{position:"relative",display:"flex","align-items":"center","justify-content":"center",cursor:"pointer","margin-right":"1px"})}),this.queryStyleable(t,".apexcharts-inactive-legend").forEach(t=>{this.setStyleDefaults(t,{opacity:"0.45"})}),this.queryStyleable(t,".apexcharts-legend .apexcharts-hidden-zero-series, .apexcharts-legend .apexcharts-hidden-null-series").forEach(t=>{t.style.setProperty("display","none","important")}))}resolveExportBackground(){const t=this.w,e=t.config.chart.background;return e&&"transparent"!==e?e:"dark"===t.config.theme.mode?"#343A3F":"#fff"}collectFontFamilies(){const t=new Set,e=this.w;if(!p.isBrowser()||!e.dom.elWrap)return t;const i=this.queryStyleable(e.dom.elWrap,"text, tspan, .apexcharts-legend-text, .apexcharts-title-text, .apexcharts-subtitle-text");return[e.dom.elWrap,...i].forEach(e=>{const i=f.getComputedStyle(e),s=i&&i.fontFamily;s&&s.split(",").forEach(e=>{const i=e.trim().replace(/^['"]|['"]$/g,"");i&&t.add(i.toLowerCase())})}),t}collectFontFaceRules(){if(!p.isBrowser())return Promise.resolve([]);const t=[],e=[],i=(e,i)=>{(e.match(/@font-face\s*\{[^}]*\}/gi)||[]).forEach(e=>{const s=e.match(/font-family\s*:\s*([^;}]+)/i);if(!s)return;const n=s[1].trim().replace(/^['"]|['"]$/g,"");t.push({family:n.toLowerCase(),css:e,base:i})})},s=(t,e)=>{Array.from(t).forEach(t=>{5===t.type?t.cssText&&i(t.cssText,e):t.styleSheet?n(t.styleSheet):t.cssRules&&s(t.cssRules,e)})},n=t=>{let n=null;try{n=t.cssRules}catch(t){}n?s(n,t.href||document.baseURI):t.href&&e.push(fetch(t.href).then(t=>t.ok?t.text():"").then(e=>i(e,t.href)).catch(()=>{}))};return Array.from(document.styleSheets||[]).forEach(n),Promise.all(e).then(()=>t)}embedFonts(t){const e=this.w;if(!p.isBrowser()||!e.config.chart.toolbar.export.embedFonts||"function"!=typeof fetch)return Promise.resolve();const i=this.collectFontFamilies();return i.size?this.collectFontFaceRules().then(t=>{const e=t.filter(t=>i.has(t.family));return e.length?Promise.all(e.map(t=>this.inlineFontFaceUrls(t.css,t.base).catch(()=>null))):Promise.resolve([])}).then(e=>{const i=(e||[]).filter(Boolean).join("\n");if(!i)return;const s=document.createElementNS(x,"style");s.textContent=i,t.insertBefore(s,t.firstChild)}).catch(()=>{}):Promise.resolve()}inlineFontFaceUrls(t,e){const i=[],s=/url\(\s*(['"]?)([^'")]+)\1\s*\)/gi;let n;for(;null!==(n=s.exec(t));)n[2].startsWith("data:")||i.push(n[2]);return i.length?Promise.all(i.map(t=>this.fetchAsDataUri(e?new URL(t,e).href:t).then(e=>({url:t,dataUri:e})).catch(()=>({url:t,dataUri:null})))).then(e=>{let i=t,s=0;return e.forEach(({url:t,dataUri:e})=>{e&&(i=i.split(t).join(e),s++)}),s?i:null}):Promise.resolve(t.includes("data:")?t:null)}fetchAsDataUri(t){return"function"!=typeof fetch||"function"!=typeof btoa?Promise.reject(new Error("fetch unavailable")):fetch(t).then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status} for ${t}`);const i=e.headers.get("content-type")||"application/octet-stream";return e.arrayBuffer().then(t=>{const e=new Uint8Array(t);let s="";for(let t=0;t<e.length;t+=32768)s+=String.fromCharCode.apply(null,e.subarray(t,t+32768));return`data:${i};base64,${btoa(s)}`})})}getSvgString(t){return new Promise(e=>{var i,s,n;const o=this.w;let a=t||o.config.chart.toolbar.export.scale||o.config.chart.toolbar.export.width/o.globals.svgWidth;a||(a=1);const l=o.globals.svgWidth*a,r=o.globals.svgHeight*a;null==(i=o.globals.layoutTween)||i.finish(),null==(s=o.globals.circleTween)||s.finish(),null==(n=o.globals.highlightTween)||n.finish(),[...o.globals.chromeTweens||[]].forEach(t=>t());const c=o.dom.elWrap.cloneNode(!0);c.style.width=l+"px",c.style.height=r+"px",this.inlineCanvasLayers(c),this.applyExportStyles(c);const h=(new XMLSerializer).serializeToString(c);let d=`\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="${o.globals.svgWidth}px" height="${o.globals.svgHeight}px">\n <foreignObject width="100%" height="100%">\n <div xmlns="http://www.w3.org/1999/xhtml" style="width:${l}px; height:${r}px;">\n ${h}\n </div>\n </foreignObject>\n </svg>\n `;const u=this.svgStringToNode(d);1!==a&&this.scaleSvgNode(u,a),Promise.all([this.convertImagesToBase64(u),this.embedFonts(u)]).then(()=>{d=(new XMLSerializer).serializeToString(u),e(d.replace(/ /g," "))})})}convertImagesToBase64(t){const e="http://www.w3.org/1999/xlink",i=t.getElementsByTagName("image"),s=Array.from(i).map(t=>{const i=t.getAttributeNS(e,"href"),s=t.getAttribute("href"),n=i||s;if(!n||n.startsWith("data:"))return Promise.resolve();const o=n=>{i&&t.setAttributeNS(e,"href",n),!s&&i||t.setAttribute("href",n)};return this.fetchAsDataUri(n).then(o).catch(()=>this.getBase64FromUrl(n).then(o).catch(t=>{console.error("Error converting image to base64:",t)}))});return Promise.all(s)}getBase64FromUrl(t){return p.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 p.isSSR()?Promise.resolve({imgURI:""}):new Promise(e=>{const i=this.w,s=()=>{console.warn("ApexCharts: the PNG export could not be rendered"),e({imgURI:""})},n=t?t.scale||t.width/i.globals.svgWidth:1,o=document.createElement("canvas");o.width=i.globals.svgWidth*n,o.height=parseInt(i.dom.elWrap.style.height,10)*n;const a=this.resolveExportBackground(),l=o.getContext("2d");if(!l)return s();l.fillStyle=a,l.fillRect(0,0,o.width,o.height),this.getSvgString(n).then(t=>{const i="data:image/svg+xml,"+encodeURIComponent(t),n=new Image;n.crossOrigin="anonymous",n.onload=()=>{try{l.drawImage(n,0,0);const t=o;if(t.msToBlob){const i=t.msToBlob();e({blob:i})}else{const t=o.toDataURL("image/png");e({imgURI:t})}}catch(t){s()}},n.onerror=s,n.src=i}).catch(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,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"):t&&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,o=n.globals,a=n.config.chart.toolbar.export.csv,l=!t&&(o.streamgraphRawSeries||o.waterfallRawSeries||o.dumbbellRawSeries);t||(t=l||n.config.series);const r=new Set(l&&l===o.dumbbellRawSeries?n.dumbbellData.hidden:o.collapsedSeriesIndices),c=[],h=[],d="datetime"===n.config.xaxis.type,p=n.config.xaxis.labels.datetimeUTC,f=t=>{if(null==t||g.isNumber(t))return t;const e=String(t);return/^[=+\-@\t\r]/.test(e)&&isNaN(+e)?`'${e}`:e},x=t=>d&&String(t).length>=10&&!isNaN(new Date(t).getTime()),b=(t,e)=>{const i=new Date(t);if(p||i.setTime(i.getTime()-6e4*i.getTimezoneOffset()),e)return i.toISOString().slice(0,23).replace("T"," ").replace(".000","");const[s,n,o,a]=i.toUTCString().split(" ");return`${s.slice(0,3)} ${o} ${n} ${a}`},w=(t,e)=>"function"==typeof a.categoryFormatter?a.categoryFormatter(t):null==t?"":x(t)?b(t,e):g.isNumber(t)?t:f(String(t).split(i).join("")),y=t=>"function"==typeof a.valueFormatter?a.valueFormatter(t):f(t),v=new u(this.w,{theme:this.ctx.theme,timeScale:this.ctx.timeScale}),S=t=>{let e="";if(o.axisCharts){if("category"===n.config.xaxis.type||n.config.xaxis.convertedCatToNumeric)if(o.isBarHorizontal){const i=n.formatters.yLabelFormatters[0],s=new m(this.ctx.w).getActiveConfigSeriesIndex();e=i(n.labelData.labels[t],{seriesIndex:s,dataPointIndex:t,w:n})}else e=v.getLabel(n.labelData.labels,n.labelData.timescaleLabels,0,t).text;d&&(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 Array.isArray(e)?e.join(" "):e},M=n.candleData,R=n.rangeData,_=n.violinData,E=t.length>1,X=t.map((t,e)=>{const s=l?"":t.type||n.config.chart.type,o="candlestick"===s?{open:M.seriesCandleO,high:M.seriesCandleH,low:M.seriesCandleL,close:M.seriesCandleC}:"boxPlot"===s?{minimum:M.seriesCandleO,q1:M.seriesCandleH,median:M.seriesCandleM,q3:M.seriesCandleL,maximum:M.seriesCandleC}:"rangeBar"===s||"rangeArea"===s?{minimum:R.seriesRangeStart,maximum:R.seriesRangeEnd}:"violin"===s?{minimum:_.seriesViolinMin,maximum:_.seriesViolinMax,observations:_.seriesViolinPoints}:null,a=String(t.name||`series-${e}`).split(i).join("")||`series-${e}`,c=o?Object.keys(o):[a];return{head:o&&E?c.map(t=>`${a} ${t}`):c,cells:i=>{var s;const n=r.has(e);if(!o){const e=n||null==(s=t.data)?void 0:s[i];return[y(e&&"object"==typeof e?Array.isArray(e)?e[1]:e.y:e)]}return Object.values(o).map(t=>{var s;const o=n||null==(s=null==t?void 0:t[e])?void 0:s[i];return y(Array.isArray(o)?o.length:o)})}}});if(o.axisCharts)if(c.push([a.headerCategory,...X.flatMap(t=>t.head)].join(i)),o.allSeriesHasEqualX||n.config.xaxis.categories.length||n.config.labels.length){const e=Math.max(0,...t.map(t=>{var e;return(null==(e=t.data)?void 0:e.length)||0}));for(let i=0;i<e;i++){let e=S(i);if(null!==e){if(!e){const s=t.map(t=>{var e;return null==(e=t.data)?void 0:e[i]}).find(t=>null!=t);e=null==s?"":Array.isArray(s)?s[0]:s.x}h.push([e,...X.flatMap(t=>t.cells(i))])}}}else{const e=new Map;t.forEach((t,i)=>{var s;null==(s=null==t?void 0:t.data)||s.forEach((t,s)=>{if(!t||"object"!=typeof t)return;const n=Array.isArray(t)?t[0]:t.x,o=String(n);let a=e.get(o);a||(a={cat:n,values:X.map(t=>t.head.map(()=>""))},e.set(o,a)),a.values[i]=X[i].cells(s)})}),Array.from(e.values()).sort((t,e)=>{const i="string"==typeof t.cat;return i!==("string"==typeof e.cat)?i?1:-1:i?n.axisFlags.isXNumeric?t.cat<e.cat?-1:1:0:t.cat-e.cat}).forEach(({cat:t,values:e})=>h.push([t,...e.flat()]))}else c.push([a.headerCategory,a.headerValue].join(i)),t.forEach((t,e)=>{c.push([w(n.labelData.labels[e]),y(r.has(e)?"":n.seriesData.series[e])].join(i))});const P=h.map(t=>t[0]).filter(x),A=new Set(P.map(t=>b(t))).size<P.length;h.forEach(t=>c.push([w(t[0],A),...t.slice(1)].join(i))),this.triggerDownload("data:text/csv; charset=utf-8,"+encodeURIComponent("\ufeff"+c.join(s)),e||a.filename,".csv")}triggerDownload(t,e,i){if(p.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)}}class w{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.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,this._drawnForZoom=null}resetControlAllowed(){const t=this.w.config.chart;if(!t.zoom||!t.zoom.enabled)return!1;const e=void 0===t.zoom.resetControl?"auto":t.zoom.resetControl;if("auto"!==e)return!!e;return!(t.toolbar&&t.toolbar.show&&t.toolbar.tools&&t.toolbar.tools.reset)}resetControlDue(){return!!this.w.interact.zoomed&&this.resetControlAllowed()}createToolbar(t={}){var e,i,s;const n=this.w,o=!!t.resetOnly,a=()=>f.createElementNS("http://www.w3.org/1999/xhtml","div"),c=()=>{const t=f.createElementNS("http://www.w3.org/1999/xhtml","button");return t.setAttribute("type","button"),t},h=a();if(h.setAttribute("class","apexcharts-toolbar"),h.style.top=n.config.chart.toolbar.offsetY+"px",h.style.right=3-n.config.chart.toolbar.offsetX+"px",n.dom.elWrap.appendChild(h),this.elZoom=c(),this.elZoomIn=c(),this.elZoomOut=c(),this.elPan=c(),this.elSelection=c(),this.elMeasure=c(),this.elZoomReset=c(),this.elMenuIcon=c(),this.elMenu=a(),this.elCustomIcons=[],this.t=n.config.chart.toolbar.tools,this._drawnForZoom=null,o?(this.t={zoom:!1,zoomin:!1,zoomout:!1,selection:!1,pan:!1,measure:!1,download:!1,customIcons:[],reset:!0},this._drawnForZoom="wrap"):!this.t.reset&&this.resetControlDue()&&(this.t=r(l({},this.t),{reset:!0}),this._drawnForZoom="control"),Array.isArray(this.t.customIcons))for(let t=0;t<this.t.customIcons.length;t++)this.elCustomIcons.push(c());const u=[],m=(t,e,i)=>{const s=t.toLowerCase();this.t[s]&&n.config.chart.zoom.enabled&&u.push({el:e,icon:"string"==typeof this.t[s]?this.t[s]:i,title:this.localeValues[t],class:`apexcharts-${s}-icon`})};m("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'),m("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 p=t=>{this.t[t]&&n.config.chart[t].enabled&&u.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`})};p("zoom"),p("selection"),this.t.pan&&n.config.chart.zoom.enabled&&u.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&&n.config.chart.measure&&n.config.chart.measure.enabled&&u.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"}),m("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&&u.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++)u.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});u.forEach((t,e)=>{t.index&&g.moveIndexInArray(u,e,t.index)});for(let t=0;t<u.length;t++)d.setAttrs(u[t].el,{class:u[t].class,title:u[t].title,"aria-label":u[t].title}),u[t].el.innerHTML=u[t].icon,h.appendChild(u[t].el);this.elZoom.parentNode&&this.elZoom.setAttribute("aria-pressed",String(!!n.interact.zoomEnabled)),this.elSelection.parentNode&&this.elSelection.setAttribute("aria-pressed",String(!!n.interact.selectionEnabled)),this.elPan.parentNode&&this.elPan.setAttribute("aria-pressed",String(!!n.interact.panEnabled)),this.elMeasure.parentNode&&this.elMeasure.setAttribute("aria-pressed",String(!!n.interact.measureEnabled)),this.elMenuIcon.parentNode&&(this.elMenuIcon.setAttribute("aria-haspopup","true"),this.elMenuIcon.setAttribute("aria-expanded","false")),o||this._createHamburgerMenu(h),o?null==(e=this.elZoomReset)||e.addEventListener("click",this.handleZoomReset.bind(this)):(n.interact.zoomEnabled?this.elZoom.classList.add(this.selectedClass):n.interact.panEnabled?this.elPan.classList.add(this.selectedClass):n.interact.selectionEnabled?this.elSelection.classList.add(this.selectedClass):n.interact.measureEnabled&&this.elMeasure&&(this.elMeasure.classList.add(this.selectedClass),null==(s=null==(i=this.ctx.measure)?void 0:i.startMeasure)||s.call(i)),this.addToolbarEventListeners())}_createHamburgerMenu(t){this.elMenuItems=[],t.appendChild(this.elMenu),d.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(f.createElementNS("http://www.w3.org/1999/xhtml","div")),this.elMenuItems[t].innerHTML=e[t].title,d.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,o,a,l,r;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==(o=this.elPan)||o.addEventListener("click",this.togglePanning.bind(this)),null==(a=this.elMeasure)||a.addEventListener("click",this.toggleMeasure.bind(this)),null==(l=this.elMenuIcon)||l.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==(r=this.elMenuIcon)||r.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()}else"Escape"===i.key||"Tab"===i.key?(this._closeMenu(),null==(s=this.elMenuIcon)||s.focus(),"Tab"===i.key||i.preventDefault()):"Enter"!==i.key&&" "!==i.key||(i.preventDefault(),t.click())})})}toggleZoomSelection(t){this.ctx.getSyncedCharts().forEach(e=>{const i=e.ctx.toolbar,s="selection"===t?"selectionEnabled":"zoomEnabled",n=!!e.w.interact[s];i.toggleOtherControls();const o="selection"===t?i.elSelection:i.elZoom;n||(e.w.interact[s]=!0,null==o||o.classList.add(i.selectedClass)),null==o||o.setAttribute("aria-pressed",String(!!e.w.interact[s]))})}toggleMeasure(){var t,e,i,s;const n=this.w,o=!n.interact.measureEnabled;this.toggleOtherControls(),o&&(n.interact.measureEnabled=!0,null==(t=this.elMeasure)||t.classList.add(this.selectedClass),null==(i=null==(e=this.ctx.measure)?void 0:e.startMeasure)||i.call(e)),null==(s=this.elMeasure)||s.setAttribute("aria-pressed",String(n.interact.measureEnabled))}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")),this.elMeasure||(this.elMeasure=t.dom.baseEl.querySelector(".apexcharts-measure-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,i="pan"===t?this.elZoom:this.elPan;e&&e.classList.add(this.selectedClass),i&&i.classList.remove(this.selectedClass)}togglePanning(){this.ctx.getSyncedCharts().forEach(t=>{var e,i;const s=t.ctx.toolbar,n=!!t.w.interact.panEnabled;s.toggleOtherControls(),n||(t.w.interact.panEnabled=!0,null==(e=s.elPan)||e.classList.add(s.selectedClass)),null==(i=s.elPan)||i.setAttribute("aria-pressed",String(!!t.w.interact.panEnabled))})}toggleOtherControls(){var t,e,i;const s=this.w;s.interact.panEnabled=!1,s.interact.zoomEnabled=!1,s.interact.selectionEnabled=!1,s.interact.measureEnabled&&(s.interact.measureEnabled=!1,null==(e=null==(t=this.ctx.measure)?void 0:t.stopMeasure)||e.call(t),null==(i=this.elMeasure)||i.setAttribute("aria-pressed","false")),this.getToolbarIconsReference();[this.elPan,this.elSelection,this.elZoom,this.elMeasure].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:i}=this._currentXRange(),s=(e+i)/2,n=(e+s)/2,o=(i+s)/2,a=this._getNewMinXMaxX(n,o);t.interact.disableZoomIn||this.zoomUpdateOptions(a.minX,a.maxX)}handleZoomOut(){const t=this.w,{minX:e,maxX:i}=this._currentXRange();if("datetime"===t.config.xaxis.type&&new Date(e).getUTCFullYear()<1e3)return;const s=(e+i)/2,n=e-(s-e),o=i-(s-i),a=this._getNewMinXMaxX(n,o);t.interact.disableZoomOut||this.zoomUpdateOptions(a.minX,a.maxX)}_getNewMinXMaxX(t,e){const i=this.w.config.xaxis.convertedCatToNumeric;return{minX:i?Math.floor(t):t,maxX:i?Math.floor(e):e}}zoomUpdateOptions(t,e){const i=this.w;if(void 0===t&&void 0===e)return void this.handleZoomReset();if(i.config.xaxis.convertedCatToNumeric&&(t<1&&(t=1,e=i.globals.dataPoints),e-t<2))return;let s={min:t,max:e};const n=this.getBeforeZoomRange(s,void 0);n&&(s=n.xaxis);const o={xaxis:s};if(!i.globals.initialConfig)return;const a=g.clone(i.globals.initialConfig.yaxis);i.config.chart.group||(o.yaxis=a),this.w.interact.zoomed=!0,this.ctx.updateHelpers._updateOptions(o,!1,this.w.config.chart.animations.dynamicAnimation.enabled),this.zoomCallback(s,a)}zoomCallback(t,e){"function"==typeof this.ev.zoomed&&(this.ev.zoomed(this.ctx,{xaxis:t,yaxis:e}),this.ctx.events.fireEvent("zoomed",{xaxis:t,yaxis:e}))}getBeforeZoomRange(t,e){let i=null;return"function"==typeof this.ev.beforeZoom&&(i=this.ev.beforeZoom(this,{xaxis:t,yaxis:e})),i}toggleMenu(){window.setTimeout(()=>{var t,e,i;(null==(t=this.elMenu)?void 0:t.classList.contains("apexcharts-menu-open"))?this._closeMenu():(null==(e=this.elMenu)||e.classList.add("apexcharts-menu-open"),null==(i=this.elMenuIcon)||i.setAttribute("aria-expanded","true"))},0)}_closeMenu(){var t,e;null==(t=this.elMenu)||t.classList.remove("apexcharts-menu-open"),null==(e=this.elMenuIcon)||e.setAttribute("aria-expanded","false")}handleDownload(t){const e=this.w,i=new b(this.w,this.ctx);switch(t){case"svg":i.exportToSVG();break;case"png":i.exportToPng();break;case"csv":i.exportToCSV({series:e.config.series,columnDelimiter:e.config.chart.toolbar.export.csv.columnDelimiter})}}clearZoomAffordance(){const t=this._drawnForZoom;if(this._drawnForZoom=null,!t||!this.elZoomReset)return;const e=this.elZoomReset.parentNode,i="wrap"===t?e:this.elZoomReset;i&&i.parentNode&&i.parentNode.removeChild(i)}handleZoomReset(){this.ctx.getSyncedCharts().forEach(t=>{var e;const i=t.w;if(!i.interact.zoomed)return;if(i.globals.lastXAxis.min=i.globals.initialConfig.xaxis.min,i.globals.lastXAxis.max=i.globals.initialConfig.xaxis.max,t.updateHelpers.revertDefaultAxisMinMax(),"function"==typeof i.config.chart.events.beforeResetZoom){const e=i.config.chart.events.beforeResetZoom(t,i);e&&t.updateHelpers.revertDefaultAxisMinMax(e)}"function"==typeof i.config.chart.events.zoomed&&t.ctx.toolbar.zoomCallback({min:i.config.xaxis.min,max:i.config.xaxis.max});const s=t.ctx.series.emptyCollapsedSeries(g.clone(i.globals.initialSeries));t.updateHelpers._updateSeries(s,i.config.chart.animations.dynamicAnimation.enabled),i.interact.zoomed=!1,null==(e=t.ctx.toolbar)||e.clearZoomAffordance()})}destroy(){this.elZoom=null,this.elZoomIn=null,this.elZoomOut=null,this.elPan=null,this.elSelection=null,this.elMeasure=null,this.elZoomReset=null,this.elMenuIcon=null}}class y{static xRatio(t){const e=t.layout.gridWidth||1;return(t.globals.maxX-t.globals.minX)/e}static dataXToPx(t,e){return(e-t.globals.minX)/y.xRatio(t)}static pxToDataX(t,e){return t.globals.minX+e*y.xRatio(t)}static screenXToPlotPx(t,e){const i=t.dom.baseEl,s=i&&i.querySelector(".apexcharts-svg");if(!s)return e-t.layout.translateX;const n=s.getBoundingClientRect(),o=t.globals.svgWidth?n.width/t.globals.svgWidth:1;return(e-n.left)/(o||1)-t.layout.translateX}}const v=h.__apex_tooltip_Utils,S=h.__apex_index_Box;h.default.registerFeatures({toolbar:w,zoomPanSelection:class extends w{constructor(t,e){super(t,e),this.w=t,this.ctx=e,this.dragged=!1,this.graphics=new d(this.w),this.eventList=["mousedown","mouseleave","mousemove","touchstart","touchmove","mouseup","touchend"],this.clientX=0,this.clientY=0,this.startX=0,this.endX=0,this.dragX=0,this.startY=0,this.endY=0,this.dragY=0,this.moveDirection="none"}init({xyRatios:t}){const e=this.w,i=this;this.xyRatios=t,this.zoomRect=this.graphics.drawRect(0,0,0,0),this.selectionRect=this.graphics.drawRect(0,0,0,0),this.constraints=new S(0,0,e.layout.gridWidth,e.layout.gridHeight),this.zoomRect.node.classList.add("apexcharts-zoom-rect"),this.selectionRect.node.classList.add("apexcharts-selection-rect"),e.dom.Paper.add(this.zoomRect),e.dom.Paper.add(this.selectionRect),"x"===e.config.chart.selection.type?this.slDraggableRect=this.selectionRect.draggable({minX:0,minY:0,maxX:e.layout.gridWidth,maxY:e.layout.gridHeight}).on("dragmove.namespace",this.selectionDragging.bind(this,"dragging")):"y"===e.config.chart.selection.type?this.slDraggableRect=this.selectionRect.draggable({minX:0,maxX:e.layout.gridWidth}).on("dragmove.namespace",this.selectionDragging.bind(this,"dragging")):this.slDraggableRect=this.selectionRect.draggable().on("dragmove.namespace",this.selectionDragging.bind(this,"dragging")),this.preselectedSelection(),this.hoverArea=e.dom.baseEl.querySelector(`${e.globals.chartClass} .apexcharts-svg`),this.hoverArea&&(this.hoverArea.classList.add("apexcharts-zoomable"),this.eventList.forEach(e=>{var s;null==(s=this.hoverArea)||s.addEventListener(e,i.svgMouseEvents.bind(i,t),{capture:!1,passive:!0})}),this._wheelZoomEnabled()&&this.hoverArea.addEventListener("wheel",i.mouseWheelEvent.bind(i),{capture:!1,passive:!1}),this.hoverArea.addEventListener("keydown",i.escapeResetEvent.bind(i),{capture:!1,passive:!0}),this._momentumEnabled()&&["touchstart","touchmove","touchend","touchcancel"].forEach(t=>{var e;null==(e=this.hoverArea)||e.addEventListener(t,i.momentumTouch.bind(i),{capture:!1,passive:!1})}))}destroy(){this.slDraggableRect&&(this.slDraggableRect.draggable(!1),this.slDraggableRect.off(),this.selectionRect.off()),this.selectionRect=null,this.zoomRect=null}svgMouseEvents(t,e){const i=this.w,s=this.ctx.toolbar;if(i.interact.momentum&&i.interact.momentum.busy)return;if(this._momentumEnabled()&&e.touches&&e.touches.length>1)return;const n=i.interact.zoomEnabled?i.config.chart.zoom.type:i.config.chart.selection.type,o=i.config.chart.toolbar.autoSelected;if("measure"!==o&&(e.shiftKey?(i.interact.shiftWasPressed=!0,s.enableZoomPanFromToolbar("pan"===o?"zoom":"pan")):i.interact.shiftWasPressed&&(s.enableZoomPanFromToolbar(o),i.interact.shiftWasPressed=!1)),!e.target)return;const a=e.target.classList;let l;e.target.parentNode&&null!==e.target.parentNode&&(l=e.target.parentNode.classList);if(!(a.contains("apexcharts-legend-marker")||a.contains("apexcharts-legend-text")||l&&l.contains("apexcharts-toolbar"))){if(this.clientX="touchmove"===e.type||"touchstart"===e.type?e.touches[0].clientX:"touchend"===e.type?e.changedTouches[0].clientX:e.clientX,this.clientY="touchmove"===e.type||"touchstart"===e.type?e.touches[0].clientY:"touchend"===e.type?e.changedTouches[0].clientY:e.clientY,"mousedown"===e.type&&1===e.which||"touchstart"===e.type){if(!this._hasPlot())return;this.startX=this._screenXToPlotPx(this.clientX),this.startY=this._screenYToPlotPx(this.clientY),this.dragged=!1,this.w.interact.mousedown=!0}("mousemove"===e.type&&1===e.which||"touchmove"===e.type)&&(this.dragged=!0,i.interact.panEnabled?(i.interact.selection=null,this.w.interact.mousedown&&this.panDragging({context:this,zoomtype:n,xyRatios:this.xyRatios})):(this.w.interact.mousedown&&i.interact.zoomEnabled||this.w.interact.mousedown&&i.interact.selectionEnabled)&&(this.selection=this.selectionDrawing({context:this,zoomtype:n}))),"mouseup"!==e.type&&"touchend"!==e.type&&"mouseleave"!==e.type||this.handleMouseUp({zoomtype:n}),this.makeSelectionRectDraggable()}}handleMouseUp({zoomtype:t,isResized:e}){const i=this.w;this._hasPlot()&&(this.w.interact.mousedown||e)&&(this.endX=this._screenXToPlotPx(this.clientX),this.endY=this._screenYToPlotPx(this.clientY),this.dragX=Math.abs(this.endX-this.startX),this.dragY=Math.abs(this.endY-this.startY),(i.interact.zoomEnabled||i.interact.selectionEnabled)&&this.selectionDrawn({context:this,zoomtype:t})),i.interact.zoomEnabled&&this.hideSelectionRect(this.selectionRect),this.dragged=!1,this.w.interact.mousedown=!1}_incidentalZoomEnabled(t){var e,i,s;const n=this.w.config.chart;return!(!n.zoom||!n.zoom.enabled)&&("auto"!==t?!!t:!(!(null==(e=n.toolbar)?void 0:e.show)||!(null==(s=null==(i=n.toolbar)?void 0:i.tools)?void 0:s.reset)))}_wheelZoomEnabled(){const{zoom:t}=this.w.config.chart;return this._incidentalZoomEnabled(t&&t.allowMouseWheelZoom)}_wheelZoomGreedy(){return!0===this.w.config.chart.zoom.allowMouseWheelZoom}_showWheelHint(t){const e=this.w;if(!1===e.config.chart.zoom.wheelHint)return;if(Math.abs(t.deltaY)<=Math.abs(t.deltaX))return;const i=e.dom.elWrap;if(!i)return;let s=i.querySelector(".apexcharts-wheel-hint");if(!s){const t=f.getWindow(),n=t&&t.navigator,o=!!n&&/Mac|iPhone|iPad/.test(n.platform||n.userAgent),a=(e.globals.locale.toolbar.wheelZoomHint||"").replace("{key}",o?"\u2318":"Ctrl");s=f.createElement("div"),s.className="apexcharts-wheel-hint",s.setAttribute("aria-hidden","true");const l=f.createElement("span");l.textContent=a,l.style.fontFamily=e.config.chart.fontFamily,s.appendChild(l),i.appendChild(s),s.offsetWidth}s.classList.add("apexcharts-wheel-hint-visible");const n=e.interact;n.wheelHintTimer&&clearTimeout(n.wheelHintTimer),n.wheelHintTimer=setTimeout(()=>this._hideWheelHint(),1200)}_hideWheelHint(){var t;const e=this.w,i=e.interact;i.wheelHintTimer&&(clearTimeout(i.wheelHintTimer),i.wheelHintTimer=null);const s=null==(t=e.dom.elWrap)?void 0:t.querySelector(".apexcharts-wheel-hint");s&&s.classList.remove("apexcharts-wheel-hint-visible")}_focusForKeyboard(){var t,e;const i=this.w.dom.Paper&&this.w.dom.Paper.node;if(i&&"function"==typeof i.focus&&null!==i.getAttribute("tabindex")){null==(e=null==(t=this.ctx.keyboardNavigation)?void 0:t.notePointerFocus)||e.call(t);try{i.focus({preventScroll:!0})}catch(t){i.focus()}}}escapeResetEvent(t){if("Escape"!==t.key&&"Esc"!==t.key)return;if(!this.w.interact.zoomed)return;const e=this.ctx.keyboardNavigation;e&&e.active||this.resetControlAllowed()&&this.handleZoomReset()}_wheel(){const t=this.w.interact;return t.wheel||(t.wheel={factor:1,clientX:0,rafId:null,endTimer:null}),t.wheel}mouseWheelEvent(t){const e=this._wheel();if(!this._wheelZoomGreedy()&&!t.ctrlKey&&!t.metaKey&&null==e.endTimer)return void this._showWheelHint(t);t.preventDefault(),this._hideWheelHint();let i=t.deltaY;1===t.deltaMode?i*=33:2===t.deltaMode&&(i*=330),e.factor*=Math.pow(2,i/240),e.clientX=t.clientX,null==e.rafId&&(e.rafId=requestAnimationFrame(()=>this._applyWheelZoom())),e.endTimer&&clearTimeout(e.endTimer),e.endTimer=setTimeout(()=>this._endWheelZoom(),150)}_applyWheelZoom(){const t=this.w,e=this._wheel();e.rafId=null;const i=e.factor;if(e.factor=1,1===i||t.globals.isDestroyed)return;const s=t.layout.gridWidth;if(!this._hasPlot()||!s)return;const{min:n,max:o}=this._currentXWindow(),a=o-n,l=Math.min(Math.max(this._screenXToPlotPx(e.clientX)/s,0),1);let r=a*i;const c=this._clampBounds();if(c){const e=t.globals.minXDiff>0&&isFinite(t.globals.minXDiff)?t.globals.minXDiff:0,i=Math.max(2*e,1e-6*(c.max-c.min));r<i&&(r=i),r>c.max-c.min&&(r=c.max-c.min)}let h=n+l*a-l*r,d=h+r;const u=1e-9*a;if(Math.abs(h-n)<u&&Math.abs(d-o)<u)return;if(isNaN(h)||isNaN(d))return;const m=this.getBeforeZoomRange({min:h,max:d},void 0);m&&m.xaxis&&(h=m.xaxis.min,d=m.xaxis.max),this._applyXRange(h,d,!0)}_endWheelZoom(){const t=this.w;if(this._wheel().endTimer=null,t.globals.isDestroyed||!t.interact.zoomed)return;const{min:e,max:i}=this._currentXWindow(),s=t.globals.initialConfig?g.clone(t.globals.initialConfig.yaxis):[],n=this.ctx.toolbar;n&&n.zoomCallback({min:e,max:i},s)}makeSelectionRectDraggable(){const t=this.w;if(!this.selectionRect)return;const e=this.selectionRect.node.getBoundingClientRect();e.width>0&&e.height>0&&(this.selectionRect.select(!1).resize(!1),this.selectionRect.select({createRot:()=>{},updateRot:()=>{},createHandle:(t,e,i,s,n)=>"l"===n||"r"===n?t.circle(8).css({"stroke-width":1,stroke:"#333",fill:"#fff"}):t.circle(0),updateHandle:(t,e)=>t.center(e[0],e[1])}).resize().on("resize",()=>{var e;if(this._clampSelectionRectToPlot(),t.interact.selectionEnabled)t.interact.selection={x:parseFloat(this.selectionRect.node.getAttribute("x")),y:parseFloat(this.selectionRect.node.getAttribute("y")),width:parseFloat(this.selectionRect.node.getAttribute("width")),height:parseFloat(this.selectionRect.node.getAttribute("height"))},clearTimeout(null!=(e=this.w.globals.selectionResizeTimer)?e:void 0),this.w.globals.selectionResizeTimer=window.setTimeout(()=>{this._emitSelectionFromRect()},30);else{const e=t.interact.zoomEnabled?t.config.chart.zoom.type:t.config.chart.selection.type;this.handleMouseUp({zoomtype:e,isResized:!0})}}))}preselectedSelection(){const t=this.w,e=this.xyRatios;if(!t.interact.zoomEnabled)if(void 0!==t.interact.selection&&null!==t.interact.selection)this.drawSelectionRect(r(l({},t.interact.selection),{translateX:t.layout.translateX,translateY:t.layout.translateY}));else if(void 0!==t.config.chart.selection.xaxis.min&&void 0!==t.config.chart.selection.xaxis.max){let i=y.dataXToPx(t,t.config.chart.selection.xaxis.min),s=y.dataXToPx(t,t.config.chart.selection.xaxis.max)-i;t.axisFlags.isRangeBar&&(i=(t.config.chart.selection.xaxis.min-t.globals.yAxisScale[0].niceMin)/e.invertedYRatio,s=(t.config.chart.selection.xaxis.max-t.config.chart.selection.xaxis.min)/e.invertedYRatio);const n={x:i,y:0,width:s,height:t.layout.gridHeight,translateX:t.layout.translateX,translateY:t.layout.translateY,selectionEnabled:!0};this.drawSelectionRect(n),this.makeSelectionRectDraggable(),"function"==typeof t.config.chart.events.selection&&t.config.chart.events.selection(this.ctx,{xaxis:{min:t.config.chart.selection.xaxis.min,max:t.config.chart.selection.xaxis.max},yaxis:{}})}}drawSelectionRect({x:t,y:e,width:i,height:s,translateX:n=0,translateY:o=0}){const a=this.w,l=this.zoomRect,r=this.selectionRect;if(this.dragged||null!==a.interact.selection){const c={transform:"translate("+n+", "+o+")"};a.interact.zoomEnabled&&this.dragged&&(i<0&&(i=1),l.attr({x:t,y:e,width:i,height:s,fill:a.config.chart.zoom.zoomedArea.fill.color,"fill-opacity":a.config.chart.zoom.zoomedArea.fill.opacity,stroke:a.config.chart.zoom.zoomedArea.stroke.color,"stroke-width":a.config.chart.zoom.zoomedArea.stroke.width,"stroke-opacity":a.config.chart.zoom.zoomedArea.stroke.opacity}),d.setAttrs(l.node,c)),a.interact.selectionEnabled&&(r.attr({x:t,y:e,width:i>0?i:0,height:s>0?s:0,fill:a.config.chart.selection.fill.color,"fill-opacity":a.config.chart.selection.fill.opacity,stroke:a.config.chart.selection.stroke.color,"stroke-width":a.config.chart.selection.stroke.width,"stroke-dasharray":a.config.chart.selection.stroke.dashArray,"stroke-opacity":a.config.chart.selection.stroke.opacity}),d.setAttrs(r.node,c))}}_clampSelectionRectToPlot(){const t=this.selectionRect;if(!t||!t.node)return;const e=this.w.layout.gridWidth;if(!(e>0))return;const i=parseFloat(t.node.getAttribute("x"))||0,s=parseFloat(t.node.getAttribute("width"))||0,n=t=>Math.min(Math.max(t,0),e),o=n(i),a=n(i+s);o===i&&a===i+s||(t.attr({x:o,width:a-o}),t._updateSelectPositions&&t._updateSelectPositions())}hideSelectionRect(t){t&&t.attr({x:0,y:0,width:0,height:0})}selectionDrawing({context:t,zoomtype:e}){const i=this.w,s=t;if(!this._hasPlot())return;const n=s.startX,o=s.startY;let a=!1,c=!1;const h=this._screenXToPlotPx(s.clientX),d=this._screenYToPlotPx(s.clientY);let u=h-n,m=d-o,g={translateX:i.layout.translateX,translateY:i.layout.translateY};return Math.abs(u+n)>i.layout.gridWidth?u=i.layout.gridWidth-n:h<0&&(u=n),n>h&&(a=!0,u=Math.abs(u)),o>d&&(c=!0,m=Math.abs(m)),g="x"===e?{x:a?n-u:n,y:0,width:u,height:i.layout.gridHeight}:"y"===e?{x:0,y:c?o-m:o,width:i.layout.gridWidth,height:m}:{x:a?n-u:n,y:c?o-m:o,width:u,height:m},g=r(l({},g),{translateX:i.layout.translateX,translateY:i.layout.translateY}),s.drawSelectionRect(g),s.selectionDragging("resizing"),g}selectionDragging(t,e){var i;const s=this.w;if(!e)return;e.preventDefault();const{handler:n,box:o}=e.detail,a=this.constraints;let{x:l,y:r}=o;l<a.x&&(l=a.x),r<a.y&&(r=a.y),o.x2>a.x2&&(l=a.x2-o.w),o.y2>a.y2&&(r=a.y2-o.h),n.move(l,r);const c=this.selectionRect;let h=0;"resizing"===t&&(h=30);const d=t=>parseFloat(c.node.getAttribute(t)),u={x:d("x"),y:d("y"),width:d("width"),height:d("height")};s.interact.selection=u;const m=s.config.chart.link,g=!(!m||!m.enabled&&"function"!=typeof m.dimension);("function"==typeof s.config.chart.events.selection||g)&&s.interact.selectionEnabled&&(clearTimeout(null!=(i=this.w.globals.selectionResizeTimer)?i:void 0),this.w.globals.selectionResizeTimer=window.setTimeout(()=>{this._emitSelectionFromRect()},h))}_emitSelectionFromRect(){var t;const e=this.w;if(!e.interact.selectionEnabled)return;const i=e.config.chart.link,s=!(!i||!i.enabled&&"function"!=typeof i.dimension);if("function"!=typeof e.config.chart.events.selection&&!s)return;if(!this._hasPlot())return;const n=this.selectionRect.node.getBoundingClientRect(),o=this.xyRatios;let a,l,r,c;const h=this._screenXToPlotPx(n.left),d=this._screenXToPlotPx(n.right);if(e.axisFlags.isRangeBar)a=e.globals.yAxisScale[0].niceMin+h*o.invertedYRatio,l=e.globals.yAxisScale[0].niceMin+d*o.invertedYRatio,r=0,c=1;else{if(!e.globals.xAxisScale)return;a=y.pxToDataX(e,h),l=y.pxToDataX(e,d),r=e.globals.yAxisScale[0].niceMin+(e.layout.gridHeight-this._screenYToPlotPx(n.bottom))*o.yRatio[0],c=e.globals.yAxisScale[0].niceMax-this._screenYToPlotPx(n.top)*o.yRatio[0]}const u={xaxis:{min:a,max:l},yaxis:{min:r,max:c}};"function"==typeof e.config.chart.events.selection&&e.config.chart.events.selection(this.ctx,u),e.config.chart.brush.enabled&&void 0!==e.config.chart.events.brushScrolled&&e.config.chart.events.brushScrolled(this.ctx,u),null==(t=this.ctx.linkedViews)||t.onSourceSelection(u.xaxis)}selectionDrawn({context:t,zoomtype:e}){var i;const s=this.w,n=t,o=this.xyRatios,a=this.ctx.toolbar,l=s.interact.zoomEnabled?n.zoomRect.node.getBoundingClientRect():n.selectionRect.node.getBoundingClientRect();if(!n._hasPlot())return;const r=this._screenXToPlotPx(l.left),c=this._screenXToPlotPx(l.right),h=this._screenYToPlotPx(l.top),d=this._screenYToPlotPx(l.bottom);let u,m;s.axisFlags.isRangeBar?(u=s.globals.yAxisScale[0].niceMin+r*o.invertedYRatio,m=s.globals.yAxisScale[0].niceMin+c*o.invertedYRatio):(u=y.pxToDataX(s,r),m=y.pxToDataX(s,c));const p=[],f=[];if(s.config.yaxis.forEach((t,e)=>{const i=s.globals.seriesYAxisMap[e][0],n=s.globals.yAxisScale[e].niceMax-o.yRatio[i]*h,a=s.globals.yAxisScale[e].niceMax-o.yRatio[i]*d;p.push(n),f.push(a)}),n.dragged&&(n.dragX>10||n.dragY>10)&&u!==m)if(s.interact.zoomEnabled){if(!s.globals.initialConfig)return;let t=g.clone(s.globals.initialConfig.yaxis),i=g.clone(s.globals.initialConfig.xaxis);if(s.interact.zoomed=!0,s.config.xaxis.convertedCatToNumeric&&(u=Math.floor(u),m=Math.floor(m),u<1&&(u=1,m=s.globals.dataPoints),m-u<2&&(m=u+1)),"xy"!==e&&"x"!==e||(i={min:u,max:m}),"xy"!==e&&"y"!==e||t.forEach((e,i)=>{t[i].min=f[i],t[i].max=p[i]}),a){const e=a.getBeforeZoomRange(i,t);e&&(i=e.xaxis?e.xaxis:i,t=e.yaxis?e.yaxis:t)}const o={xaxis:i};s.config.chart.group||(o.yaxis=t);const l=n.ctx.updateHelpers._updateOptions(o,!1,n.w.config.chart.animations.dynamicAnimation.enabled);l&&"function"==typeof l.then?l.then(()=>n._focusForKeyboard()):n._focusForKeyboard(),"function"==typeof s.config.chart.events.zoomed&&a.zoomCallback(i,t)}else if(s.interact.selectionEnabled){let t=null,o=null;if(o={min:u,max:m},"xy"===e||"y"===e){const e=g.clone(s.config.yaxis);t=e,e.forEach((t,i)=>{e[i].min=f[i],e[i].max=p[i]})}s.interact.selection=n.selection,"function"==typeof s.config.chart.events.selection&&s.config.chart.events.selection(n.ctx,{xaxis:o,yaxis:t}),null==(i=n.ctx.linkedViews)||i.onSourceSelection(o)}}panDragging({context:t}){var e;const i=this.w,s=t;if(void 0!==i.interact.lastClientPosition.x){const t=i.interact.lastClientPosition.x-s.clientX,n=(null!=(e=i.interact.lastClientPosition.y)?e:0)-s.clientY;Math.abs(t)>Math.abs(n)&&t>0?this.moveDirection="left":Math.abs(t)>Math.abs(n)&&t<0?this.moveDirection="right":Math.abs(n)>Math.abs(t)&&n>0?this.moveDirection="up":Math.abs(n)>Math.abs(t)&&n<0&&(this.moveDirection="down")}i.interact.lastClientPosition={x:s.clientX,y:s.clientY};const n=i.axisFlags.isRangeBar?i.globals.minY:i.globals.minX,o=i.axisFlags.isRangeBar?i.globals.maxY:i.globals.maxX;s.panScrolled(n,o)}panScrolled(t,e){var i,s;const n=this.w,o=this.xyRatios;if(!n.globals.initialConfig)return;const a=g.clone(n.globals.initialConfig.yaxis);let l=o.xRatio,r=n.globals.minX,c=n.globals.maxX;if(n.axisFlags.isRangeBar&&(l=o.invertedYRatio,r=n.globals.minY,c=n.globals.maxY),"left"===this.moveDirection?(t=r+n.layout.gridWidth/15*l,e=c+n.layout.gridWidth/15*l):"right"===this.moveDirection&&(t=r-n.layout.gridWidth/15*l,e=c-n.layout.gridWidth/15*l),!n.axisFlags.isRangeBar){const o=null!=(i=n.globals.dataReducerRawMinX)?i:n.globals.initialMinX,a=null!=(s=n.globals.dataReducerRawMaxX)?s:n.globals.initialMaxX;(t<o||e>a)&&(t=r,e=c)}const h={xaxis:{min:t,max:e}};n.config.chart.group||(h.yaxis=a),this.updateScrolledChart(h,t,e)}updateScrolledChart(t,e,i){const s=this.w;if(this.ctx.updateHelpers._updateOptions(t,!1,!1),"function"==typeof s.config.chart.events.scrolled){const t={xaxis:{min:e,max:i}};s.config.chart.events.scrolled(this.ctx,t),this.ctx.events.fireEvent("scrolled",t)}}_momentumEnabled(){return this._pinchEnabled()||this._panInertiaEnabled()}_pinchEnabled(){return this._incidentalZoomEnabled(this.w.config.chart.zoom.pinch)}_panInertiaEnabled(){const t=this.w.config.chart;return!(!t.pan||!t.pan.inertia)}_m(){const t=this.w.interact;return t.momentum||(t.momentum={busy:!1,pinch:null,panState:null,samples:[],inertiaRAF:null}),t.momentum}_currentXWindow(){const t=this.w;return t.axisFlags.isRangeBar?{min:t.globals.minY,max:t.globals.maxY}:{min:t.globals.minX,max:t.globals.maxX}}_hasPlot(){const t=this.w.dom.baseEl;return!(!t||!t.querySelector(".apexcharts-svg"))}_screenYToPlotPx(t){const e=v.plotRect(this.w);return(t-e.top)/e.zoom}_screenXToPlotPx(t){return y.screenXToPlotPx(this.w,t)}_clampBounds(){var t,e;const i=this.w;return i.axisFlags.isRangeBar?null:{min:null!=(t=i.globals.dataReducerRawMinX)?t:i.globals.initialMinX,max:null!=(e=i.globals.dataReducerRawMaxX)?e:i.globals.initialMaxX}}_applyXRange(t,e,i){const s=this.w;if(!s.globals.initialConfig)return!1;const n=this._currentXWindow(),o=i&&e-t>n.max-n.min,a=this._clampBounds();if(a){const i=e-t;t<a.min&&(e=(t=a.min)+i),e>a.max&&(t=(e=a.max)-i),t<a.min&&(t=a.min)}if(s.config.xaxis.convertedCatToNumeric&&(t=Math.floor(t),e=o?Math.ceil(e):Math.floor(e),t<1&&(t=1),a&&e>a.max&&(e=Math.floor(a.max)),e-t<2))return!1;if(!(e>t))return!1;const l={xaxis:{min:t,max:e}};return s.config.chart.group||(l.yaxis=g.clone(s.globals.initialConfig.yaxis)),i&&(s.interact.zoomed=!0),this.ctx.updateHelpers._updateOptions(l,!1,!1),{minX:t,maxX:e}}_cancelInertia(){const t=this._m();null!=t.inertiaRAF&&(cancelAnimationFrame(t.inertiaRAF),t.inertiaRAF=null)}_fireScrolled(){const t=this.w;if("function"!=typeof t.config.chart.events.scrolled)return;const{min:e,max:i}=this._currentXWindow(),s={xaxis:{min:e,max:i}};t.config.chart.events.scrolled(this.ctx,s),this.ctx.events.fireEvent("scrolled",s)}panBy(t){const e=this.w;if(!e.interact.zoomed)return;const{min:i,max:s}=this._currentXWindow();let n=(s-i)*t;if(e.config.xaxis.convertedCatToNumeric&&(n=n>0?Math.ceil(n):Math.floor(n)),e.axisFlags.isRangeBar){const t=e.rangeData;let o=1/0,a=-1/0;if(t.seriesRangeStart.concat(t.seriesRangeEnd).flat().forEach(t=>{null!=t&&(o=Math.min(o,t),a=Math.max(a,t))}),n=n>0?Math.min(n,Math.max(0,a-s)):Math.max(n,Math.min(0,o-i)),!n)return}this._applyXRange(i+n,s+n,!1)&&this._fireScrolled()}_pushSample(t,e){const i=this._m().samples;for(i.push({x:t,t:e});i.length>6;)i.shift()}momentumTouch(t){const e=this.w,i=this._m(),s=t.type;if("touchstart"!==s)"touchmove"!==s?(i.pinch?t.touches.length<2&&this._endPinch():i.panState&&0===t.touches.length&&this._endPan(),0===t.touches.length&&(e.interact.mousedown=!1,this.dragged=!1,null!=i.inertiaRAF||i.pinch||i.panState||(i.busy=!1))):i.pinch&&t.touches.length>=2?(t.preventDefault(),this._movePinch(t)):i.panState&&1===t.touches.length&&this._movePan(t);else{if(this._cancelInertia(),!this._hasPlot())return;if(t.touches.length>=2&&this._pinchEnabled())t.preventDefault(),i.busy=!0,i.panState=null,this._beginPinch(t);else if(1===t.touches.length&&this._panInertiaEnabled()&&e.interact.panEnabled){i.busy=!0,i.pinch=null;const s=t.touches[0],n=this._currentXWindow(),o=e.layout.gridWidth||1,a=v.plotRect(e).zoom;i.panState={startX:s.clientX,startY:s.clientY,axis:null,minX0:n.min,maxX0:n.max,zoom:a,ratio0:(n.max-n.min)/o/a},i.samples=[{x:s.clientX,t:t.timeStamp}]}}}_beginPinch(t){const e=this.w,i=t.touches[0],s=t.touches[1],n=Math.hypot(s.clientX-i.clientX,s.clientY-i.clientY)||1,o=this._screenXToPlotPx((i.clientX+s.clientX)/2),{min:a,max:l}=this._currentXWindow();this._m().pinch={d0:n,cx0:o,minX0:a,maxX0:l,gridWidth:e.layout.gridWidth||1}}_movePinch(t){const e=this.w,i=this._m().pinch;if(!i||!this._hasPlot())return;const s=t.touches[0],n=t.touches[1],o=Math.hypot(n.clientX-s.clientX,n.clientY-s.clientY)||1,a=this._screenXToPlotPx((s.clientX+n.clientX)/2),l=i.maxX0-i.minX0,r=l*(i.d0/o);let c=i.minX0+i.cx0/i.gridWidth*l-a/i.gridWidth*r,h=c+r;const d=this._clampBounds();if(d){const t=e.globals.minXDiff>0&&isFinite(e.globals.minXDiff)?e.globals.minXDiff:0,i=Math.max(2*t,1e-6*(d.max-d.min));if(h-c<i){const t=(c+h)/2;c=t-i/2,h=t+i/2}}this._applyXRange(c,h,!0)}_endPinch(){const t=this.w;this._m().pinch=null;const{min:e,max:i}=this._currentXWindow(),s={min:e,max:i},n=t.globals.initialConfig?g.clone(t.globals.initialConfig.yaxis):[],o=this.ctx.toolbar;o&&o.zoomCallback(s,n)}_movePan(t){const e=this._m(),i=e.panState,s=t.touches[0];if(!i.axis){const n=Math.abs(s.clientX-i.startX),o=Math.abs(s.clientY-i.startY);if(n<6&&o<6)return void this._pushSample(s.clientX,t.timeStamp);if(o>n)return e.busy=!1,void(e.panState=null);i.axis="x"}if("x"!==i.axis)return;t.preventDefault();const n=(s.clientX-i.startX)*i.ratio0;this._pushSample(s.clientX,t.timeStamp),this._applyXRange(i.minX0-n,i.maxX0-n,!1)}_endPan(){const t=this._m(),e=t.panState;t.panState=null;let i=0;const s=t.samples;if(s.length>=2){const t=s[0],e=s[s.length-1],n=e.t-t.t;n>0&&(i=(e.x-t.x)/n)}t.samples=[],e&&"x"===e.axis&&this._panInertiaEnabled()&&Math.abs(i)>.05?this._startInertia(i/e.zoom):(t.busy=!1,this._fireScrolled())}_startInertia(t){const e=this.w,i=this._m(),s=e.config.chart.pan&&e.config.chart.pan.friction,n="number"==typeof s?Math.min(Math.max(s,.5),.999):.92;let o=t,a=null;i.busy=!0;const l=t=>{if(e.globals.isDestroyed)return i.inertiaRAF=null,void(i.busy=!1);if(null==a)return a=t,void(i.inertiaRAF=requestAnimationFrame(l));const s=t-a;if(a=t,o*=Math.pow(n,s/16.6667),Math.abs(o)<.02)return i.inertiaRAF=null,i.busy=!1,void this._fireScrolled();const r=this._currentXWindow(),c=e.layout.gridWidth||1,h=(r.max-r.min)/c,d=o*s*h,u=this._applyXRange(r.min-d,r.max-d,!1),m=this._clampBounds();if(!u||m&&(d>0&&u.minX<=m.min+1e-6*(m.max-m.min)||d<0&&u.maxX>=m.max-1e-6*(m.max-m.min)))return i.inertiaRAF=null,i.busy=!1,void this._fireScrolled();i.inertiaRAF=requestAnimationFrame(l)};i.inertiaRAF=requestAnimationFrame(l)}}}),Object.defineProperty(exports,"default",{enumerable:!0,get:()=>h.default});
|
|
5
|
+
"use strict";var t=Object.defineProperty,e=Object.defineProperties,i=Object.getOwnPropertyDescriptors,s=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable,a=(e,i,s)=>i in e?t(e,i,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[i]=s,l=(t,e)=>{for(var i in e||(e={}))n.call(e,i)&&a(t,i,e[i]);if(s)for(var i of s(e))o.call(e,i)&&a(t,i,e[i]);return t},r=(t,s)=>e(t,i(s));Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});function c(t){if(t&&t.__esModule)return 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 h=c(require("apexcharts/core")),d=h.__apex_Graphics,u=h.__apex_axes_AxesUtils,m=h.__apex_Series,g=h.__apex_Utils,p=h.__apex_Environment_Environment,f=h.__apex_BrowserAPIs_BrowserAPIs,x=h.__apex_math_SVGNS;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 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],o=document.createElementNS(x,"image");o.setAttribute("x",n.getAttribute("x")||"0"),o.setAttribute("y",n.getAttribute("y")||"0"),o.setAttribute("width",n.getAttribute("width")||"0"),o.setAttribute("height",n.getAttribute("height")||"0"),o.setAttribute("href",s),o.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",s),n.parentNode&&n.parentNode.replaceChild(o,n)}}queryStyleable(t,e){return Array.prototype.slice.call(t.querySelectorAll(e))}setStyleDefaults(t,e){Object.keys(e).forEach(i=>{""===t.style.getPropertyValue(i)&&t.style.setProperty(i,e[i])})}applyExportStyles(t){const e=this.w;this.queryStyleable(t,"style").forEach(t=>t.remove()),this.queryStyleable(t,[".apexcharts-tooltip",".apexcharts-toolbar",".apexcharts-xaxistooltip",".apexcharts-yaxistooltip",".apexcharts-xcrosshairs",".apexcharts-ycrosshairs",".apexcharts-zoom-rect",".apexcharts-selection-rect"].join(", ")).forEach(t=>{t.style.setProperty("display","none","important")}),this.queryStyleable(t,".apexcharts-flip-y").forEach(t=>{this.setStyleDefaults(t,{transform:"scaleY(-1) translateY(-100%)","transform-origin":"top","transform-box":"fill-box"})}),this.queryStyleable(t,".apexcharts-flip-x").forEach(t=>{this.setStyleDefaults(t,{transform:"scaleX(-1)","transform-origin":"center","transform-box":"fill-box"})}),e.config.legend.show&&e.dom.elLegendWrap&&e.dom.elLegendWrap.children.length&&(this.queryStyleable(t,".apexcharts-legend").forEach(t=>{this.setStyleDefaults(t,{display:"flex",overflow:"auto",padding:"0 10px"});const e=t.classList,i=e.contains("apx-legend-position-left")||e.contains("apx-legend-position-right"),s=e.contains("apx-legend-position-top")||e.contains("apx-legend-position-bottom");e.contains("apexcharts-legend-group-horizontal")&&this.setStyleDefaults(t,{"flex-direction":"column"}),i&&this.setStyleDefaults(t,{"flex-direction":"column",bottom:"0"}),s&&this.setStyleDefaults(t,{"flex-wrap":"wrap"}),i||s&&e.contains("apexcharts-align-left")?this.setStyleDefaults(t,{"justify-content":"flex-start","align-items":"flex-start"}):s&&e.contains("apexcharts-align-center")?this.setStyleDefaults(t,{"justify-content":"center","align-items":"center"}):s&&e.contains("apexcharts-align-right")&&this.setStyleDefaults(t,{"justify-content":"flex-end","align-items":"flex-end"})}),this.queryStyleable(t,".apexcharts-legend-group").forEach(t=>{this.setStyleDefaults(t,{display:"flex"})}),this.queryStyleable(t,".apexcharts-legend-group-vertical").forEach(t=>{this.setStyleDefaults(t,{"flex-direction":"column-reverse"})}),this.queryStyleable(t,".apexcharts-legend-series").forEach(t=>{this.setStyleDefaults(t,{cursor:t.classList.contains("apexcharts-no-click")?"auto":"pointer","line-height":"normal",display:"flex","align-items":"center"})}),this.queryStyleable(t,".apexcharts-legend-text").forEach(t=>{this.setStyleDefaults(t,{position:"relative","font-size":"14px"})}),this.queryStyleable(t,".apexcharts-legend-marker").forEach(t=>{this.setStyleDefaults(t,{position:"relative",display:"flex","align-items":"center","justify-content":"center",cursor:"pointer","margin-right":"1px"})}),this.queryStyleable(t,".apexcharts-inactive-legend").forEach(t=>{this.setStyleDefaults(t,{opacity:"0.45"})}),this.queryStyleable(t,".apexcharts-legend .apexcharts-hidden-zero-series, .apexcharts-legend .apexcharts-hidden-null-series").forEach(t=>{t.style.setProperty("display","none","important")}))}resolveExportBackground(){const t=this.w,e=t.config.chart.background;return e&&"transparent"!==e?e:"dark"===t.config.theme.mode?"#343A3F":"#fff"}collectFontFamilies(){const t=new Set,e=this.w;if(!p.isBrowser()||!e.dom.elWrap)return t;const i=this.queryStyleable(e.dom.elWrap,"text, tspan, .apexcharts-legend-text, .apexcharts-title-text, .apexcharts-subtitle-text");return[e.dom.elWrap,...i].forEach(e=>{const i=f.getComputedStyle(e),s=i&&i.fontFamily;s&&s.split(",").forEach(e=>{const i=e.trim().replace(/^['"]|['"]$/g,"");i&&t.add(i.toLowerCase())})}),t}collectFontFaceRules(){if(!p.isBrowser())return Promise.resolve([]);const t=[],e=[],i=(e,i)=>{(e.match(/@font-face\s*\{[^}]*\}/gi)||[]).forEach(e=>{const s=e.match(/font-family\s*:\s*([^;}]+)/i);if(!s)return;const n=s[1].trim().replace(/^['"]|['"]$/g,"");t.push({family:n.toLowerCase(),css:e,base:i})})},s=(t,e)=>{Array.from(t).forEach(t=>{5===t.type?t.cssText&&i(t.cssText,e):t.styleSheet?n(t.styleSheet):t.cssRules&&s(t.cssRules,e)})},n=t=>{let n=null;try{n=t.cssRules}catch(t){}n?s(n,t.href||document.baseURI):t.href&&e.push(fetch(t.href).then(t=>t.ok?t.text():"").then(e=>i(e,t.href)).catch(()=>{}))};return Array.from(document.styleSheets||[]).forEach(n),Promise.all(e).then(()=>t)}embedFonts(t){const e=this.w;if(!p.isBrowser()||!e.config.chart.toolbar.export.embedFonts||"function"!=typeof fetch)return Promise.resolve();const i=this.collectFontFamilies();return i.size?this.collectFontFaceRules().then(t=>{const e=t.filter(t=>i.has(t.family));return e.length?Promise.all(e.map(t=>this.inlineFontFaceUrls(t.css,t.base).catch(()=>null))):Promise.resolve([])}).then(e=>{const i=(e||[]).filter(Boolean).join("\n");if(!i)return;const s=document.createElementNS(x,"style");s.textContent=i,t.insertBefore(s,t.firstChild)}).catch(()=>{}):Promise.resolve()}inlineFontFaceUrls(t,e){const i=[],s=/url\(\s*(['"]?)([^'")]+)\1\s*\)/gi;let n;for(;null!==(n=s.exec(t));)n[2].startsWith("data:")||i.push(n[2]);return i.length?Promise.all(i.map(t=>this.fetchAsDataUri(e?new URL(t,e).href:t).then(e=>({url:t,dataUri:e})).catch(()=>({url:t,dataUri:null})))).then(e=>{let i=t,s=0;return e.forEach(({url:t,dataUri:e})=>{e&&(i=i.split(t).join(e),s++)}),s?i:null}):Promise.resolve(t.includes("data:")?t:null)}fetchAsDataUri(t){return"function"!=typeof fetch||"function"!=typeof btoa?Promise.reject(new Error("fetch unavailable")):fetch(t).then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status} for ${t}`);const i=e.headers.get("content-type")||"application/octet-stream";return e.arrayBuffer().then(t=>{const e=new Uint8Array(t);let s="";for(let t=0;t<e.length;t+=32768)s+=String.fromCharCode.apply(null,e.subarray(t,t+32768));return`data:${i};base64,${btoa(s)}`})})}getSvgString(t){return new Promise(e=>{var i,s,n;const o=this.w;let a=t||o.config.chart.toolbar.export.scale||o.config.chart.toolbar.export.width/o.globals.svgWidth;a||(a=1);const l=o.globals.svgWidth*a,r=o.globals.svgHeight*a;null==(i=o.globals.layoutTween)||i.finish(),null==(s=o.globals.circleTween)||s.finish(),null==(n=o.globals.highlightTween)||n.finish(),[...o.globals.chromeTweens||[]].forEach(t=>t());const c=o.dom.elWrap.cloneNode(!0);c.style.width=l+"px",c.style.height=r+"px",this.inlineCanvasLayers(c),this.applyExportStyles(c);const h=(new XMLSerializer).serializeToString(c);let d=`\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="${o.globals.svgWidth}px" height="${o.globals.svgHeight}px">\n <foreignObject width="100%" height="100%">\n <div xmlns="http://www.w3.org/1999/xhtml" style="width:${l}px; height:${r}px;">\n ${h}\n </div>\n </foreignObject>\n </svg>\n `;const u=this.svgStringToNode(d);1!==a&&this.scaleSvgNode(u,a),Promise.all([this.convertImagesToBase64(u),this.embedFonts(u)]).then(()=>{d=(new XMLSerializer).serializeToString(u),e(d.replace(/ /g," "))})})}convertImagesToBase64(t){const e="http://www.w3.org/1999/xlink",i=t.getElementsByTagName("image"),s=Array.from(i).map(t=>{const i=t.getAttributeNS(e,"href"),s=t.getAttribute("href"),n=i||s;if(!n||n.startsWith("data:"))return Promise.resolve();const o=n=>{i&&t.setAttributeNS(e,"href",n),!s&&i||t.setAttribute("href",n)};return this.fetchAsDataUri(n).then(o).catch(()=>this.getBase64FromUrl(n).then(o).catch(t=>{console.error("Error converting image to base64:",t)}))});return Promise.all(s)}getBase64FromUrl(t){return p.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 p.isSSR()?Promise.resolve({imgURI:""}):new Promise(e=>{const i=this.w,s=()=>{console.warn("ApexCharts: the PNG export could not be rendered"),e({imgURI:""})},n=t?t.scale||t.width/i.globals.svgWidth:1,o=document.createElement("canvas");o.width=i.globals.svgWidth*n,o.height=parseInt(i.dom.elWrap.style.height,10)*n;const a=this.resolveExportBackground(),l=o.getContext("2d");if(!l)return s();l.fillStyle=a,l.fillRect(0,0,o.width,o.height),this.getSvgString(n).then(t=>{const i="data:image/svg+xml,"+encodeURIComponent(t),n=new Image;n.crossOrigin="anonymous",n.onload=()=>{try{l.drawImage(n,0,0);const t=o;if(t.msToBlob){const i=t.msToBlob();e({blob:i})}else{const t=o.toDataURL("image/png");e({imgURI:t})}}catch(t){s()}},n.onerror=s,n.src=i}).catch(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,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"):t&&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,o=n.globals,a=n.config.chart.toolbar.export.csv,l=!t&&(o.streamgraphRawSeries||o.waterfallRawSeries||o.dumbbellRawSeries);t||(t=l||n.config.series);const r=new Set(l&&l===o.dumbbellRawSeries?n.dumbbellData.hidden:o.collapsedSeriesIndices),c=[],h=[],d="datetime"===n.config.xaxis.type,p=n.config.xaxis.labels.datetimeUTC,f=t=>{if(null==t||g.isNumber(t))return t;const e=String(t);return/^[=+\-@\t\r]/.test(e)&&isNaN(+e)?`'${e}`:e},x=t=>d&&String(t).length>=10&&!isNaN(new Date(t).getTime()),b=(t,e)=>{const i=new Date(t);if(p||i.setTime(i.getTime()-6e4*i.getTimezoneOffset()),e)return i.toISOString().slice(0,23).replace("T"," ").replace(".000","");const[s,n,o,a]=i.toUTCString().split(" ");return`${s.slice(0,3)} ${o} ${n} ${a}`},w=(t,e)=>"function"==typeof a.categoryFormatter?a.categoryFormatter(t):null==t?"":x(t)?b(t,e):g.isNumber(t)?t:f(String(t).split(i).join("")),y=t=>"function"==typeof a.valueFormatter?a.valueFormatter(t):f(t),v=new u(this.w,{theme:this.ctx.theme,timeScale:this.ctx.timeScale}),S=t=>{let e="";if(o.axisCharts){if("category"===n.config.xaxis.type||n.config.xaxis.convertedCatToNumeric)if(o.isBarHorizontal){const i=n.formatters.yLabelFormatters[0],s=new m(this.ctx.w).getActiveConfigSeriesIndex();e=i(n.labelData.labels[t],{seriesIndex:s,dataPointIndex:t,w:n})}else e=v.getLabel(n.labelData.labels,n.labelData.timescaleLabels,0,t).text;d&&(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 Array.isArray(e)?e.join(" "):e},M=n.candleData,R=n.rangeData,_=n.violinData,E=t.length>1,X=t.map((t,e)=>{const s=l?"":t.type||n.config.chart.type,o="candlestick"===s?{open:M.seriesCandleO,high:M.seriesCandleH,low:M.seriesCandleL,close:M.seriesCandleC}:"boxPlot"===s?{minimum:M.seriesCandleO,q1:M.seriesCandleH,median:M.seriesCandleM,q3:M.seriesCandleL,maximum:M.seriesCandleC}:"rangeBar"===s||"rangeArea"===s?{minimum:R.seriesRangeStart,maximum:R.seriesRangeEnd}:"violin"===s?{minimum:_.seriesViolinMin,maximum:_.seriesViolinMax,observations:_.seriesViolinPoints}:null,a=String(t.name||`series-${e}`).split(i).join("")||`series-${e}`,c=o?Object.keys(o):[a];return{head:o&&E?c.map(t=>`${a} ${t}`):c,cells:i=>{var s;const n=r.has(e);if(!o){const e=n||null==(s=t.data)?void 0:s[i];return[y(e&&"object"==typeof e?Array.isArray(e)?e[1]:e.y:e)]}return Object.values(o).map(t=>{var s;const o=n||null==(s=null==t?void 0:t[e])?void 0:s[i];return y(Array.isArray(o)?o.length:o)})}}});if(o.axisCharts)if(c.push([a.headerCategory,...X.flatMap(t=>t.head)].join(i)),o.allSeriesHasEqualX||n.config.xaxis.categories.length||n.config.labels.length){const e=Math.max(0,...t.map(t=>{var e;return(null==(e=t.data)?void 0:e.length)||0}));for(let i=0;i<e;i++){let e=S(i);if(null!==e){if(!e){const s=t.map(t=>{var e;return null==(e=t.data)?void 0:e[i]}).find(t=>null!=t);e=null==s?"":Array.isArray(s)?s[0]:s.x}h.push([e,...X.flatMap(t=>t.cells(i))])}}}else{const e=new Map;t.forEach((t,i)=>{var s;const n=new Map;null==(s=null==t?void 0:t.data)||s.forEach((t,s)=>{if(!t||"object"!=typeof t)return;const o=Array.isArray(t)?t[0]:t.x,a=String(o),l=n.get(a)||0;n.set(a,l+1);const r=`${l}:${a}`;let c=e.get(r);c||(c={cat:o,values:X.map(t=>t.head.map(()=>""))},e.set(r,c)),c.values[i]=X[i].cells(s)})}),Array.from(e.values()).sort((t,e)=>{const i="string"==typeof t.cat;return i!==("string"==typeof e.cat)?i?1:-1:i?n.axisFlags.isXNumeric?t.cat<e.cat?-1:t.cat>e.cat?1:0:0:t.cat-e.cat}).forEach(({cat:t,values:e})=>h.push([t,...e.flat()]))}else c.push([a.headerCategory,a.headerValue].join(i)),t.forEach((t,e)=>{c.push([w(n.labelData.labels[e]),y(r.has(e)?"":n.seriesData.series[e])].join(i))});const P=h.map(t=>t[0]).filter(x),A=new Set(P.map(t=>+new Date(t))),C=new Set([...A].map(t=>b(t))).size<A.size;h.forEach(t=>c.push([w(t[0],C),...t.slice(1)].join(i))),this.triggerDownload("data:text/csv; charset=utf-8,"+encodeURIComponent("\ufeff"+c.join(s)),e||a.filename,".csv")}triggerDownload(t,e,i){if(p.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)}}class w{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.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,this._drawnForZoom=null}resetControlAllowed(){const t=this.w.config.chart;if(!t.zoom||!t.zoom.enabled)return!1;const e=void 0===t.zoom.resetControl?"auto":t.zoom.resetControl;if("auto"!==e)return!!e;return!(t.toolbar&&t.toolbar.show&&t.toolbar.tools&&t.toolbar.tools.reset)}resetControlDue(){return!!this.w.interact.zoomed&&this.resetControlAllowed()}createToolbar(t={}){var e,i,s;const n=this.w,o=!!t.resetOnly,a=()=>f.createElementNS("http://www.w3.org/1999/xhtml","div"),c=()=>{const t=f.createElementNS("http://www.w3.org/1999/xhtml","button");return t.setAttribute("type","button"),t},h=a();if(h.setAttribute("class","apexcharts-toolbar"),h.style.top=n.config.chart.toolbar.offsetY+"px",h.style.right=3-n.config.chart.toolbar.offsetX+"px",n.dom.elWrap.appendChild(h),this.elZoom=c(),this.elZoomIn=c(),this.elZoomOut=c(),this.elPan=c(),this.elSelection=c(),this.elMeasure=c(),this.elZoomReset=c(),this.elMenuIcon=c(),this.elMenu=a(),this.elCustomIcons=[],this.t=n.config.chart.toolbar.tools,this._drawnForZoom=null,o?(this.t={zoom:!1,zoomin:!1,zoomout:!1,selection:!1,pan:!1,measure:!1,download:!1,customIcons:[],reset:!0},this._drawnForZoom="wrap"):!this.t.reset&&this.resetControlDue()&&(this.t=r(l({},this.t),{reset:!0}),this._drawnForZoom="control"),Array.isArray(this.t.customIcons))for(let t=0;t<this.t.customIcons.length;t++)this.elCustomIcons.push(c());const u=[],m=(t,e,i)=>{const s=t.toLowerCase();this.t[s]&&n.config.chart.zoom.enabled&&u.push({el:e,icon:"string"==typeof this.t[s]?this.t[s]:i,title:this.localeValues[t],class:`apexcharts-${s}-icon`})};m("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'),m("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 p=t=>{this.t[t]&&n.config.chart[t].enabled&&u.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`})};p("zoom"),p("selection"),this.t.pan&&n.config.chart.zoom.enabled&&u.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&&n.config.chart.measure&&n.config.chart.measure.enabled&&u.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"}),m("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&&u.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++)u.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});u.forEach((t,e)=>{t.index&&g.moveIndexInArray(u,e,t.index)});for(let t=0;t<u.length;t++)d.setAttrs(u[t].el,{class:u[t].class,title:u[t].title,"aria-label":u[t].title}),u[t].el.innerHTML=u[t].icon,h.appendChild(u[t].el);this.elZoom.parentNode&&this.elZoom.setAttribute("aria-pressed",String(!!n.interact.zoomEnabled)),this.elSelection.parentNode&&this.elSelection.setAttribute("aria-pressed",String(!!n.interact.selectionEnabled)),this.elPan.parentNode&&this.elPan.setAttribute("aria-pressed",String(!!n.interact.panEnabled)),this.elMeasure.parentNode&&this.elMeasure.setAttribute("aria-pressed",String(!!n.interact.measureEnabled)),this.elMenuIcon.parentNode&&(this.elMenuIcon.setAttribute("aria-haspopup","true"),this.elMenuIcon.setAttribute("aria-expanded","false")),o||this._createHamburgerMenu(h),o?null==(e=this.elZoomReset)||e.addEventListener("click",this.handleZoomReset.bind(this)):(n.interact.zoomEnabled?this.elZoom.classList.add(this.selectedClass):n.interact.panEnabled?this.elPan.classList.add(this.selectedClass):n.interact.selectionEnabled?this.elSelection.classList.add(this.selectedClass):n.interact.measureEnabled&&this.elMeasure&&(this.elMeasure.classList.add(this.selectedClass),null==(s=null==(i=this.ctx.measure)?void 0:i.startMeasure)||s.call(i)),this.addToolbarEventListeners())}_createHamburgerMenu(t){this.elMenuItems=[],t.appendChild(this.elMenu),d.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(f.createElementNS("http://www.w3.org/1999/xhtml","div")),this.elMenuItems[t].innerHTML=e[t].title,d.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,o,a,l,r;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==(o=this.elPan)||o.addEventListener("click",this.togglePanning.bind(this)),null==(a=this.elMeasure)||a.addEventListener("click",this.toggleMeasure.bind(this)),null==(l=this.elMenuIcon)||l.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==(r=this.elMenuIcon)||r.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()}else"Escape"===i.key||"Tab"===i.key?(this._closeMenu(),null==(s=this.elMenuIcon)||s.focus(),"Tab"===i.key||i.preventDefault()):"Enter"!==i.key&&" "!==i.key||(i.preventDefault(),t.click())})})}toggleZoomSelection(t){this.ctx.getSyncedCharts().forEach(e=>{const i=e.ctx.toolbar,s="selection"===t?"selectionEnabled":"zoomEnabled",n=!!e.w.interact[s];i.toggleOtherControls();const o="selection"===t?i.elSelection:i.elZoom;n||(e.w.interact[s]=!0,null==o||o.classList.add(i.selectedClass)),null==o||o.setAttribute("aria-pressed",String(!!e.w.interact[s]))})}toggleMeasure(){var t,e,i,s;const n=this.w,o=!n.interact.measureEnabled;this.toggleOtherControls(),o&&(n.interact.measureEnabled=!0,null==(t=this.elMeasure)||t.classList.add(this.selectedClass),null==(i=null==(e=this.ctx.measure)?void 0:e.startMeasure)||i.call(e)),null==(s=this.elMeasure)||s.setAttribute("aria-pressed",String(n.interact.measureEnabled))}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")),this.elMeasure||(this.elMeasure=t.dom.baseEl.querySelector(".apexcharts-measure-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,i="pan"===t?this.elZoom:this.elPan;e&&e.classList.add(this.selectedClass),i&&i.classList.remove(this.selectedClass)}togglePanning(){this.ctx.getSyncedCharts().forEach(t=>{var e,i;const s=t.ctx.toolbar,n=!!t.w.interact.panEnabled;s.toggleOtherControls(),n||(t.w.interact.panEnabled=!0,null==(e=s.elPan)||e.classList.add(s.selectedClass)),null==(i=s.elPan)||i.setAttribute("aria-pressed",String(!!t.w.interact.panEnabled))})}toggleOtherControls(){var t,e,i;const s=this.w;s.interact.panEnabled=!1,s.interact.zoomEnabled=!1,s.interact.selectionEnabled=!1,s.interact.measureEnabled&&(s.interact.measureEnabled=!1,null==(e=null==(t=this.ctx.measure)?void 0:t.stopMeasure)||e.call(t),null==(i=this.elMeasure)||i.setAttribute("aria-pressed","false")),this.getToolbarIconsReference();[this.elPan,this.elSelection,this.elZoom,this.elMeasure].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:i}=this._currentXRange(),s=(e+i)/2,n=(e+s)/2,o=(i+s)/2,a=this._getNewMinXMaxX(n,o);t.interact.disableZoomIn||this.zoomUpdateOptions(a.minX,a.maxX)}handleZoomOut(){const t=this.w,{minX:e,maxX:i}=this._currentXRange();if("datetime"===t.config.xaxis.type&&new Date(e).getUTCFullYear()<1e3)return;const s=(e+i)/2,n=e-(s-e),o=i-(s-i),a=this._getNewMinXMaxX(n,o);t.interact.disableZoomOut||this.zoomUpdateOptions(a.minX,a.maxX)}_getNewMinXMaxX(t,e){const i=this.w.config.xaxis.convertedCatToNumeric;return{minX:i?Math.floor(t):t,maxX:i?Math.floor(e):e}}zoomUpdateOptions(t,e){const i=this.w;if(void 0===t&&void 0===e)return void this.handleZoomReset();if(i.config.xaxis.convertedCatToNumeric&&(t<1&&(t=1,e=i.globals.dataPoints),e-t<2))return;let s={min:t,max:e};const n=this.getBeforeZoomRange(s,void 0);n&&(s=n.xaxis);const o={xaxis:s};if(!i.globals.initialConfig)return;const a=g.clone(i.globals.initialConfig.yaxis);i.config.chart.group||(o.yaxis=a),this.w.interact.zoomed=!0,this.ctx.updateHelpers._updateOptions(o,!1,this.w.config.chart.animations.dynamicAnimation.enabled),this.zoomCallback(s,a)}zoomCallback(t,e){"function"==typeof this.ev.zoomed&&(this.ev.zoomed(this.ctx,{xaxis:t,yaxis:e}),this.ctx.events.fireEvent("zoomed",{xaxis:t,yaxis:e}))}getBeforeZoomRange(t,e){let i=null;return"function"==typeof this.ev.beforeZoom&&(i=this.ev.beforeZoom(this,{xaxis:t,yaxis:e})),i}toggleMenu(){window.setTimeout(()=>{var t,e,i;(null==(t=this.elMenu)?void 0:t.classList.contains("apexcharts-menu-open"))?this._closeMenu():(null==(e=this.elMenu)||e.classList.add("apexcharts-menu-open"),null==(i=this.elMenuIcon)||i.setAttribute("aria-expanded","true"))},0)}_closeMenu(){var t,e;null==(t=this.elMenu)||t.classList.remove("apexcharts-menu-open"),null==(e=this.elMenuIcon)||e.setAttribute("aria-expanded","false")}handleDownload(t){const e=this.w,i=new b(this.w,this.ctx);switch(t){case"svg":i.exportToSVG();break;case"png":i.exportToPng();break;case"csv":i.exportToCSV({series:e.config.series,columnDelimiter:e.config.chart.toolbar.export.csv.columnDelimiter})}}clearZoomAffordance(){const t=this._drawnForZoom;if(this._drawnForZoom=null,!t||!this.elZoomReset)return;const e=this.elZoomReset.parentNode,i="wrap"===t?e:this.elZoomReset;i&&i.parentNode&&i.parentNode.removeChild(i)}handleZoomReset(){this.ctx.getSyncedCharts().forEach(t=>{var e;const i=t.w;if(!i.interact.zoomed)return;if(i.globals.lastXAxis.min=i.globals.initialConfig.xaxis.min,i.globals.lastXAxis.max=i.globals.initialConfig.xaxis.max,t.updateHelpers.revertDefaultAxisMinMax(),"function"==typeof i.config.chart.events.beforeResetZoom){const e=i.config.chart.events.beforeResetZoom(t,i);e&&t.updateHelpers.revertDefaultAxisMinMax(e)}"function"==typeof i.config.chart.events.zoomed&&t.ctx.toolbar.zoomCallback({min:i.config.xaxis.min,max:i.config.xaxis.max});const s=t.ctx.series.emptyCollapsedSeries(g.clone(i.globals._initialSeriesPeek));t.updateHelpers._updateSeries(s,i.config.chart.animations.dynamicAnimation.enabled),i.interact.zoomed=!1,null==(e=t.ctx.toolbar)||e.clearZoomAffordance()})}destroy(){this.elZoom=null,this.elZoomIn=null,this.elZoomOut=null,this.elPan=null,this.elSelection=null,this.elMeasure=null,this.elZoomReset=null,this.elMenuIcon=null}}class y{static xRatio(t){const e=t.layout.gridWidth||1;return(t.globals.maxX-t.globals.minX)/e}static dataXToPx(t,e){return(e-t.globals.minX)/y.xRatio(t)}static pxToDataX(t,e){return t.globals.minX+e*y.xRatio(t)}static plotRect(t){var e,i,s;const n=(null==(e=t.dom.Paper)?void 0:e.node)||(null==(i=t.dom.baseEl)?void 0:i.querySelector(".apexcharts-svg")),o=(null==(s=n||t.dom.elWrap)?void 0:s.getBoundingClientRect())||{left:0,top:0,width:0},a=(n&&t.globals.svgWidth?o.width/t.globals.svgWidth:1)||1;return{left:o.left+t.layout.translateX*a,top:o.top+t.layout.translateY*a,width:t.layout.gridWidth*a,height:t.layout.gridHeight*a,zoom:a}}static screenXToPlotPx(t,e,i=y.plotRect(t)){return(e-i.left)/i.zoom}}const v=h.__apex_tooltip_Utils,S=h.__apex_index_Box;h.default.registerFeatures({toolbar:w,zoomPanSelection:class extends w{constructor(t,e){super(t,e),this.w=t,this.ctx=e,this.dragged=!1,this.graphics=new d(this.w),this.eventList=["mousedown","mouseleave","mousemove","touchstart","touchmove","mouseup","touchend"],this.clientX=0,this.clientY=0,this.startX=0,this.endX=0,this.dragX=0,this.startY=0,this.endY=0,this.dragY=0,this.moveDirection="none"}init({xyRatios:t}){const e=this.w,i=this;this.xyRatios=t,this.zoomRect=this.graphics.drawRect(0,0,0,0),this.selectionRect=this.graphics.drawRect(0,0,0,0),this.constraints=new S(0,0,e.layout.gridWidth,e.layout.gridHeight),this.zoomRect.node.classList.add("apexcharts-zoom-rect"),this.selectionRect.node.classList.add("apexcharts-selection-rect"),e.dom.Paper.add(this.zoomRect),e.dom.Paper.add(this.selectionRect),"x"===e.config.chart.selection.type?this.slDraggableRect=this.selectionRect.draggable({minX:0,minY:0,maxX:e.layout.gridWidth,maxY:e.layout.gridHeight}).on("dragmove.namespace",this.selectionDragging.bind(this,"dragging")):"y"===e.config.chart.selection.type?this.slDraggableRect=this.selectionRect.draggable({minX:0,maxX:e.layout.gridWidth}).on("dragmove.namespace",this.selectionDragging.bind(this,"dragging")):this.slDraggableRect=this.selectionRect.draggable().on("dragmove.namespace",this.selectionDragging.bind(this,"dragging")),this.preselectedSelection(),this.hoverArea=e.dom.baseEl.querySelector(`${e.globals.chartClass} .apexcharts-svg`),this.hoverArea&&(this.hoverArea.classList.add("apexcharts-zoomable"),this.eventList.forEach(e=>{var s;null==(s=this.hoverArea)||s.addEventListener(e,i.svgMouseEvents.bind(i,t),{capture:!1,passive:!0})}),this._wheelZoomEnabled()&&this.hoverArea.addEventListener("wheel",i.mouseWheelEvent.bind(i),{capture:!1,passive:!1}),this.hoverArea.addEventListener("keydown",i.escapeResetEvent.bind(i),{capture:!1,passive:!0}),this._momentumEnabled()&&["touchstart","touchmove","touchend","touchcancel"].forEach(t=>{var e;null==(e=this.hoverArea)||e.addEventListener(t,i.momentumTouch.bind(i),{capture:!1,passive:!1})}))}destroy(){this.slDraggableRect&&(this.slDraggableRect.draggable(!1),this.slDraggableRect.off(),this.selectionRect.off()),this.selectionRect=null,this.zoomRect=null}svgMouseEvents(t,e){const i=this.w,s=this.ctx.toolbar;if(i.interact.momentum&&i.interact.momentum.busy)return;if(this._momentumEnabled()&&e.touches&&e.touches.length>1)return;const n=i.interact.zoomEnabled?i.config.chart.zoom.type:i.config.chart.selection.type,o=i.config.chart.toolbar.autoSelected;if("measure"!==o&&(e.shiftKey?(i.interact.shiftWasPressed=!0,s.enableZoomPanFromToolbar("pan"===o?"zoom":"pan")):i.interact.shiftWasPressed&&(s.enableZoomPanFromToolbar(o),i.interact.shiftWasPressed=!1)),!e.target)return;const a=e.target.classList;let l;e.target.parentNode&&null!==e.target.parentNode&&(l=e.target.parentNode.classList);if(!(a.contains("apexcharts-legend-marker")||a.contains("apexcharts-legend-text")||l&&l.contains("apexcharts-toolbar"))){if(this.clientX="touchmove"===e.type||"touchstart"===e.type?e.touches[0].clientX:"touchend"===e.type?e.changedTouches[0].clientX:e.clientX,this.clientY="touchmove"===e.type||"touchstart"===e.type?e.touches[0].clientY:"touchend"===e.type?e.changedTouches[0].clientY:e.clientY,"mousedown"===e.type&&1===e.which||"touchstart"===e.type){if(!this._hasPlot())return;this.startX=this._screenXToPlotPx(this.clientX),this.startY=this._screenYToPlotPx(this.clientY),this.dragged=!1,this.w.interact.mousedown=!0}("mousemove"===e.type&&1===e.which||"touchmove"===e.type)&&(this.dragged=!0,i.interact.panEnabled?(i.interact.selection=null,this.w.interact.mousedown&&this.panDragging({context:this,zoomtype:n,xyRatios:this.xyRatios})):(this.w.interact.mousedown&&i.interact.zoomEnabled||this.w.interact.mousedown&&i.interact.selectionEnabled)&&(this.selection=this.selectionDrawing({context:this,zoomtype:n}))),"mouseup"!==e.type&&"touchend"!==e.type&&"mouseleave"!==e.type||this.handleMouseUp({zoomtype:n}),this.makeSelectionRectDraggable()}}handleMouseUp({zoomtype:t,isResized:e}){const i=this.w;this._hasPlot()&&(this.w.interact.mousedown||e)&&(this.endX=this._screenXToPlotPx(this.clientX),this.endY=this._screenYToPlotPx(this.clientY),this.dragX=Math.abs(this.endX-this.startX),this.dragY=Math.abs(this.endY-this.startY),(i.interact.zoomEnabled||i.interact.selectionEnabled)&&this.selectionDrawn({context:this,zoomtype:t})),i.interact.zoomEnabled&&this.hideSelectionRect(this.selectionRect),this.dragged=!1,this.w.interact.mousedown=!1}_incidentalZoomEnabled(t){var e,i,s;const n=this.w.config.chart;return!(!n.zoom||!n.zoom.enabled)&&("auto"!==t?!!t:!(!(null==(e=n.toolbar)?void 0:e.show)||!(null==(s=null==(i=n.toolbar)?void 0:i.tools)?void 0:s.reset)))}_wheelZoomEnabled(){const{zoom:t}=this.w.config.chart;return this._incidentalZoomEnabled(t&&t.allowMouseWheelZoom)}_wheelZoomGreedy(){return!0===this.w.config.chart.zoom.allowMouseWheelZoom}_showWheelHint(t){const e=this.w;if(!1===e.config.chart.zoom.wheelHint)return;if(Math.abs(t.deltaY)<=Math.abs(t.deltaX))return;const i=e.dom.elWrap;if(!i)return;let s=i.querySelector(".apexcharts-wheel-hint");if(!s){const t=f.getWindow(),n=t&&t.navigator,o=!!n&&/Mac|iPhone|iPad/.test(n.platform||n.userAgent),a=(e.globals.locale.toolbar.wheelZoomHint||"").replace("{key}",o?"\u2318":"Ctrl");s=f.createElement("div"),s.className="apexcharts-wheel-hint",s.setAttribute("aria-hidden","true");const l=f.createElement("span");l.textContent=a,l.style.fontFamily=e.config.chart.fontFamily,s.appendChild(l),i.appendChild(s),s.offsetWidth}s.classList.add("apexcharts-wheel-hint-visible");const n=e.interact;n.wheelHintTimer&&clearTimeout(n.wheelHintTimer),n.wheelHintTimer=setTimeout(()=>this._hideWheelHint(),1200)}_hideWheelHint(){var t;const e=this.w,i=e.interact;i.wheelHintTimer&&(clearTimeout(i.wheelHintTimer),i.wheelHintTimer=null);const s=null==(t=e.dom.elWrap)?void 0:t.querySelector(".apexcharts-wheel-hint");s&&s.classList.remove("apexcharts-wheel-hint-visible")}_focusForKeyboard(){var t,e;const i=this.w.dom.Paper&&this.w.dom.Paper.node;if(i&&"function"==typeof i.focus&&null!==i.getAttribute("tabindex")){null==(e=null==(t=this.ctx.keyboardNavigation)?void 0:t.notePointerFocus)||e.call(t);try{i.focus({preventScroll:!0})}catch(t){i.focus()}}}escapeResetEvent(t){if("Escape"!==t.key&&"Esc"!==t.key)return;if(!this.w.interact.zoomed)return;const e=this.ctx.keyboardNavigation;e&&e.active||this.resetControlAllowed()&&this.handleZoomReset()}_wheel(){const t=this.w.interact;return t.wheel||(t.wheel={factor:1,clientX:0,rafId:null,endTimer:null}),t.wheel}mouseWheelEvent(t){const e=this._wheel();if(!this._wheelZoomGreedy()&&!t.ctrlKey&&!t.metaKey&&null==e.endTimer)return void this._showWheelHint(t);t.preventDefault(),this._hideWheelHint();let i=t.deltaY;1===t.deltaMode?i*=33:2===t.deltaMode&&(i*=330),e.factor*=Math.pow(2,i/240),e.clientX=t.clientX,null==e.rafId&&(e.rafId=requestAnimationFrame(()=>this._applyWheelZoom())),e.endTimer&&clearTimeout(e.endTimer),e.endTimer=setTimeout(()=>this._endWheelZoom(),150)}_applyWheelZoom(){const t=this.w,e=this._wheel();e.rafId=null;const i=e.factor;if(e.factor=1,1===i||t.globals.isDestroyed)return;const s=t.layout.gridWidth;if(!this._hasPlot()||!s)return;const{min:n,max:o}=this._currentXWindow(),a=o-n,l=Math.min(Math.max(this._screenXToPlotPx(e.clientX)/s,0),1);let r=a*i;const c=this._clampBounds();if(c){const e=t.globals.minXDiff>0&&isFinite(t.globals.minXDiff)?t.globals.minXDiff:0,i=Math.max(2*e,1e-6*(c.max-c.min));r<i&&(r=i),r>c.max-c.min&&(r=c.max-c.min)}let h=n+l*a-l*r,d=h+r;const u=1e-9*a;if(Math.abs(h-n)<u&&Math.abs(d-o)<u)return;if(isNaN(h)||isNaN(d))return;const m=this.getBeforeZoomRange({min:h,max:d},void 0);m&&m.xaxis&&(h=m.xaxis.min,d=m.xaxis.max),this._applyXRange(h,d,!0)}_endWheelZoom(){const t=this.w;if(this._wheel().endTimer=null,t.globals.isDestroyed||!t.interact.zoomed)return;const{min:e,max:i}=this._currentXWindow(),s=t.globals.initialConfig?g.clone(t.globals.initialConfig.yaxis):[],n=this.ctx.toolbar;n&&n.zoomCallback({min:e,max:i},s)}makeSelectionRectDraggable(){const t=this.w;if(!this.selectionRect)return;const e=this.selectionRect.node.getBoundingClientRect();e.width>0&&e.height>0&&(this.selectionRect.select(!1).resize(!1),this.selectionRect.select({createRot:()=>{},updateRot:()=>{},createHandle:(t,e,i,s,n)=>"l"===n||"r"===n?t.circle(8).css({"stroke-width":1,stroke:"#333",fill:"#fff"}):t.circle(0),updateHandle:(t,e)=>t.center(e[0],e[1])}).resize().on("resize",()=>{var e;if(this._clampSelectionRectToPlot(),t.interact.selectionEnabled)t.interact.selection={x:parseFloat(this.selectionRect.node.getAttribute("x")),y:parseFloat(this.selectionRect.node.getAttribute("y")),width:parseFloat(this.selectionRect.node.getAttribute("width")),height:parseFloat(this.selectionRect.node.getAttribute("height"))},clearTimeout(null!=(e=this.w.globals.selectionResizeTimer)?e:void 0),this.w.globals.selectionResizeTimer=window.setTimeout(()=>{this._emitSelectionFromRect()},30);else{const e=t.interact.zoomEnabled?t.config.chart.zoom.type:t.config.chart.selection.type;this.handleMouseUp({zoomtype:e,isResized:!0})}}))}preselectedSelection(){const t=this.w,e=this.xyRatios;if(!t.interact.zoomEnabled)if(void 0!==t.interact.selection&&null!==t.interact.selection)this.drawSelectionRect(r(l({},t.interact.selection),{translateX:t.layout.translateX,translateY:t.layout.translateY}));else if(void 0!==t.config.chart.selection.xaxis.min&&void 0!==t.config.chart.selection.xaxis.max){let i=y.dataXToPx(t,t.config.chart.selection.xaxis.min),s=y.dataXToPx(t,t.config.chart.selection.xaxis.max)-i;t.axisFlags.isRangeBar&&(i=(t.config.chart.selection.xaxis.min-t.globals.yAxisScale[0].niceMin)/e.invertedYRatio,s=(t.config.chart.selection.xaxis.max-t.config.chart.selection.xaxis.min)/e.invertedYRatio);const n={x:i,y:0,width:s,height:t.layout.gridHeight,translateX:t.layout.translateX,translateY:t.layout.translateY,selectionEnabled:!0};this.drawSelectionRect(n),this.makeSelectionRectDraggable(),"function"==typeof t.config.chart.events.selection&&t.config.chart.events.selection(this.ctx,{xaxis:{min:t.config.chart.selection.xaxis.min,max:t.config.chart.selection.xaxis.max},yaxis:{}})}}drawSelectionRect({x:t,y:e,width:i,height:s,translateX:n=0,translateY:o=0}){const a=this.w,l=this.zoomRect,r=this.selectionRect;if(this.dragged||null!==a.interact.selection){const c={transform:"translate("+n+", "+o+")"};a.interact.zoomEnabled&&this.dragged&&(i<0&&(i=1),l.attr({x:t,y:e,width:i,height:s,fill:a.config.chart.zoom.zoomedArea.fill.color,"fill-opacity":a.config.chart.zoom.zoomedArea.fill.opacity,stroke:a.config.chart.zoom.zoomedArea.stroke.color,"stroke-width":a.config.chart.zoom.zoomedArea.stroke.width,"stroke-opacity":a.config.chart.zoom.zoomedArea.stroke.opacity}),d.setAttrs(l.node,c)),a.interact.selectionEnabled&&(r.attr({x:t,y:e,width:i>0?i:0,height:s>0?s:0,fill:a.config.chart.selection.fill.color,"fill-opacity":a.config.chart.selection.fill.opacity,stroke:a.config.chart.selection.stroke.color,"stroke-width":a.config.chart.selection.stroke.width,"stroke-dasharray":a.config.chart.selection.stroke.dashArray,"stroke-opacity":a.config.chart.selection.stroke.opacity}),d.setAttrs(r.node,c))}}_clampSelectionRectToPlot(){const t=this.selectionRect;if(!t||!t.node)return;const e=this.w.layout.gridWidth;if(!(e>0))return;const i=parseFloat(t.node.getAttribute("x"))||0,s=parseFloat(t.node.getAttribute("width"))||0,n=t=>Math.min(Math.max(t,0),e),o=n(i),a=n(i+s);o===i&&a===i+s||(t.attr({x:o,width:a-o}),t._updateSelectPositions&&t._updateSelectPositions())}hideSelectionRect(t){t&&t.attr({x:0,y:0,width:0,height:0})}selectionDrawing({context:t,zoomtype:e}){const i=this.w,s=t;if(!this._hasPlot())return;const n=s.startX,o=s.startY;let a=!1,c=!1;const h=this._screenXToPlotPx(s.clientX),d=this._screenYToPlotPx(s.clientY);let u=h-n,m=d-o,g={translateX:i.layout.translateX,translateY:i.layout.translateY};return Math.abs(u+n)>i.layout.gridWidth?u=i.layout.gridWidth-n:h<0&&(u=n),n>h&&(a=!0,u=Math.abs(u)),o>d&&(c=!0,m=Math.abs(m)),g="x"===e?{x:a?n-u:n,y:0,width:u,height:i.layout.gridHeight}:"y"===e?{x:0,y:c?o-m:o,width:i.layout.gridWidth,height:m}:{x:a?n-u:n,y:c?o-m:o,width:u,height:m},g=r(l({},g),{translateX:i.layout.translateX,translateY:i.layout.translateY}),s.drawSelectionRect(g),s.selectionDragging("resizing"),g}selectionDragging(t,e){var i;const s=this.w;if(!e)return;e.preventDefault();const{handler:n,box:o}=e.detail,a=this.constraints;let{x:l,y:r}=o;l<a.x&&(l=a.x),r<a.y&&(r=a.y),o.x2>a.x2&&(l=a.x2-o.w),o.y2>a.y2&&(r=a.y2-o.h),n.move(l,r);const c=this.selectionRect;let h=0;"resizing"===t&&(h=30);const d=t=>parseFloat(c.node.getAttribute(t)),u={x:d("x"),y:d("y"),width:d("width"),height:d("height")};s.interact.selection=u;const m=s.config.chart.link,g=!(!m||!m.enabled&&"function"!=typeof m.dimension);("function"==typeof s.config.chart.events.selection||g)&&s.interact.selectionEnabled&&(clearTimeout(null!=(i=this.w.globals.selectionResizeTimer)?i:void 0),this.w.globals.selectionResizeTimer=window.setTimeout(()=>{this._emitSelectionFromRect()},h))}_emitSelectionFromRect(){var t;const e=this.w;if(!e.interact.selectionEnabled)return;const i=e.config.chart.link,s=!(!i||!i.enabled&&"function"!=typeof i.dimension);if("function"!=typeof e.config.chart.events.selection&&!s)return;if(!this._hasPlot())return;const n=this.selectionRect.node.getBoundingClientRect(),o=this.xyRatios;let a,l,r,c;const h=this._screenXToPlotPx(n.left),d=this._screenXToPlotPx(n.right);if(e.axisFlags.isRangeBar)a=e.globals.yAxisScale[0].niceMin+h*o.invertedYRatio,l=e.globals.yAxisScale[0].niceMin+d*o.invertedYRatio,r=0,c=1;else{if(!e.globals.xAxisScale)return;a=y.pxToDataX(e,h),l=y.pxToDataX(e,d),r=e.globals.yAxisScale[0].niceMin+(e.layout.gridHeight-this._screenYToPlotPx(n.bottom))*o.yRatio[0],c=e.globals.yAxisScale[0].niceMax-this._screenYToPlotPx(n.top)*o.yRatio[0]}const u={xaxis:{min:a,max:l},yaxis:{min:r,max:c}};"function"==typeof e.config.chart.events.selection&&e.config.chart.events.selection(this.ctx,u),e.config.chart.brush.enabled&&void 0!==e.config.chart.events.brushScrolled&&e.config.chart.events.brushScrolled(this.ctx,u),null==(t=this.ctx.linkedViews)||t.onSourceSelection(u.xaxis)}selectionDrawn({context:t,zoomtype:e}){var i;const s=this.w,n=t,o=this.xyRatios,a=this.ctx.toolbar,l=s.interact.zoomEnabled?n.zoomRect.node.getBoundingClientRect():n.selectionRect.node.getBoundingClientRect();if(!n._hasPlot())return;const r=this._screenXToPlotPx(l.left),c=this._screenXToPlotPx(l.right),h=this._screenYToPlotPx(l.top),d=this._screenYToPlotPx(l.bottom);let u,m;s.axisFlags.isRangeBar?(u=s.globals.yAxisScale[0].niceMin+r*o.invertedYRatio,m=s.globals.yAxisScale[0].niceMin+c*o.invertedYRatio):(u=y.pxToDataX(s,r),m=y.pxToDataX(s,c));const p=[],f=[];if(s.config.yaxis.forEach((t,e)=>{const i=s.globals.seriesYAxisMap[e][0],n=s.globals.yAxisScale[e].niceMax-o.yRatio[i]*h,a=s.globals.yAxisScale[e].niceMax-o.yRatio[i]*d;p.push(n),f.push(a)}),n.dragged&&(n.dragX>10||n.dragY>10)&&u!==m)if(s.interact.zoomEnabled){if(!s.globals.initialConfig)return;let t=g.clone(s.globals.initialConfig.yaxis),i=g.clone(s.globals.initialConfig.xaxis);if(s.interact.zoomed=!0,s.config.xaxis.convertedCatToNumeric&&(u=Math.floor(u),m=Math.floor(m),u<1&&(u=1,m=s.globals.dataPoints),m-u<2&&(m=u+1)),"xy"!==e&&"x"!==e||(i={min:u,max:m}),"xy"!==e&&"y"!==e||t.forEach((e,i)=>{t[i].min=f[i],t[i].max=p[i]}),a){const e=a.getBeforeZoomRange(i,t);e&&(i=e.xaxis?e.xaxis:i,t=e.yaxis?e.yaxis:t)}const o={xaxis:i};s.config.chart.group||(o.yaxis=t);const l=n.ctx.updateHelpers._updateOptions(o,!1,n.w.config.chart.animations.dynamicAnimation.enabled);l&&"function"==typeof l.then?l.then(()=>n._focusForKeyboard()):n._focusForKeyboard(),"function"==typeof s.config.chart.events.zoomed&&a.zoomCallback(i,t)}else if(s.interact.selectionEnabled){let t=null,o=null;if(o={min:u,max:m},"xy"===e||"y"===e){const e=g.clone(s.config.yaxis);t=e,e.forEach((t,i)=>{e[i].min=f[i],e[i].max=p[i]})}s.interact.selection=n.selection,"function"==typeof s.config.chart.events.selection&&s.config.chart.events.selection(n.ctx,{xaxis:o,yaxis:t}),null==(i=n.ctx.linkedViews)||i.onSourceSelection(o)}}panDragging({context:t}){var e;const i=this.w,s=t;if(void 0!==i.interact.lastClientPosition.x){const t=i.interact.lastClientPosition.x-s.clientX,n=(null!=(e=i.interact.lastClientPosition.y)?e:0)-s.clientY;Math.abs(t)>Math.abs(n)&&t>0?this.moveDirection="left":Math.abs(t)>Math.abs(n)&&t<0?this.moveDirection="right":Math.abs(n)>Math.abs(t)&&n>0?this.moveDirection="up":Math.abs(n)>Math.abs(t)&&n<0&&(this.moveDirection="down")}i.interact.lastClientPosition={x:s.clientX,y:s.clientY};const n=i.axisFlags.isRangeBar?i.globals.minY:i.globals.minX,o=i.axisFlags.isRangeBar?i.globals.maxY:i.globals.maxX;s.panScrolled(n,o)}panScrolled(t,e){var i,s;const n=this.w,o=this.xyRatios;if(!n.globals.initialConfig)return;const a=g.clone(n.globals.initialConfig.yaxis);let l=o.xRatio,r=n.globals.minX,c=n.globals.maxX;if(n.axisFlags.isRangeBar&&(l=o.invertedYRatio,r=n.globals.minY,c=n.globals.maxY),"left"===this.moveDirection?(t=r+n.layout.gridWidth/15*l,e=c+n.layout.gridWidth/15*l):"right"===this.moveDirection&&(t=r-n.layout.gridWidth/15*l,e=c-n.layout.gridWidth/15*l),!n.axisFlags.isRangeBar){const o=null!=(i=n.globals.dataReducerRawMinX)?i:n.globals.initialMinX,a=null!=(s=n.globals.dataReducerRawMaxX)?s:n.globals.initialMaxX;(t<o||e>a)&&(t=r,e=c)}if(t===r&&e===c)return;const h={xaxis:{min:t,max:e}};n.config.chart.group||(h.yaxis=a),this.updateScrolledChart(h,t,e)}updateScrolledChart(t,e,i){const s=this.w;if(this.ctx.updateHelpers._updateOptions(t,!1,!1),"function"==typeof s.config.chart.events.scrolled){const t={xaxis:{min:e,max:i}};s.config.chart.events.scrolled(this.ctx,t),this.ctx.events.fireEvent("scrolled",t)}}_momentumEnabled(){return this._pinchEnabled()||this._panInertiaEnabled()}_pinchEnabled(){return this._incidentalZoomEnabled(this.w.config.chart.zoom.pinch)}_panInertiaEnabled(){const t=this.w.config.chart;return!(!t.pan||!t.pan.inertia)}_m(){const t=this.w.interact;return t.momentum||(t.momentum={busy:!1,pinch:null,panState:null,samples:[],inertiaRAF:null}),t.momentum}_currentXWindow(){const t=this.w;return t.axisFlags.isRangeBar?{min:t.globals.minY,max:t.globals.maxY}:{min:t.globals.minX,max:t.globals.maxX}}_hasPlot(){const t=this.w.dom.baseEl;return!(!t||!t.querySelector(".apexcharts-svg"))}_screenYToPlotPx(t){const e=v.plotRect(this.w);return(t-e.top)/e.zoom}_screenXToPlotPx(t){return y.screenXToPlotPx(this.w,t)}_clampBounds(){var t,e;const i=this.w;return i.axisFlags.isRangeBar?null:{min:null!=(t=i.globals.dataReducerRawMinX)?t:i.globals.initialMinX,max:null!=(e=i.globals.dataReducerRawMaxX)?e:i.globals.initialMaxX}}_applyXRange(t,e,i){const s=this.w;if(!s.globals.initialConfig)return!1;const n=this._currentXWindow(),o=i&&e-t>n.max-n.min,a=this._clampBounds();if(a){const i=e-t;t<a.min&&(e=(t=a.min)+i),e>a.max&&(t=(e=a.max)-i),t<a.min&&(t=a.min)}if(s.config.xaxis.convertedCatToNumeric&&(t=Math.floor(t),e=o?Math.ceil(e):Math.floor(e),t<1&&(t=1),a&&e>a.max&&(e=Math.floor(a.max)),e-t<2))return!1;if(!(e>t))return!1;const l={xaxis:{min:t,max:e}};return s.config.chart.group||(l.yaxis=g.clone(s.globals.initialConfig.yaxis)),i&&(s.interact.zoomed=!0),this.ctx.updateHelpers._updateOptions(l,!1,!1),{minX:t,maxX:e}}_cancelInertia(){const t=this._m();null!=t.inertiaRAF&&(cancelAnimationFrame(t.inertiaRAF),t.inertiaRAF=null)}_fireScrolled(){const t=this.w;if("function"!=typeof t.config.chart.events.scrolled)return;const{min:e,max:i}=this._currentXWindow(),s={xaxis:{min:e,max:i}};t.config.chart.events.scrolled(this.ctx,s),this.ctx.events.fireEvent("scrolled",s)}panBy(t){const e=this.w;if(!e.interact.zoomed)return;const{min:i,max:s}=this._currentXWindow();let n=(s-i)*t;if(e.config.xaxis.convertedCatToNumeric&&(n=n>0?Math.ceil(n):Math.floor(n)),e.axisFlags.isRangeBar){const t=e.rangeData;let o=1/0,a=-1/0;if(t.seriesRangeStart.concat(t.seriesRangeEnd).flat().forEach(t=>{null!=t&&(o=Math.min(o,t),a=Math.max(a,t))}),n=n>0?Math.min(n,Math.max(0,a-s)):Math.max(n,Math.min(0,o-i)),!n)return}this._applyXRange(i+n,s+n,!1)&&this._fireScrolled()}_pushSample(t,e){const i=this._m().samples;for(i.push({x:t,t:e});i.length>6;)i.shift()}momentumTouch(t){const e=this.w,i=this._m(),s=t.type;if("touchstart"!==s)"touchmove"!==s?(i.pinch?t.touches.length<2&&this._endPinch():i.panState&&0===t.touches.length&&this._endPan(),0===t.touches.length&&(e.interact.mousedown=!1,this.dragged=!1,null!=i.inertiaRAF||i.pinch||i.panState||(i.busy=!1))):i.pinch&&t.touches.length>=2?(t.preventDefault(),this._movePinch(t)):i.panState&&1===t.touches.length&&this._movePan(t);else{if(this._cancelInertia(),!this._hasPlot())return;if(t.touches.length>=2&&this._pinchEnabled())t.preventDefault(),i.busy=!0,i.panState=null,this._beginPinch(t);else if(1===t.touches.length&&this._panInertiaEnabled()&&e.interact.panEnabled){i.busy=!0,i.pinch=null;const s=t.touches[0],n=this._currentXWindow(),o=e.layout.gridWidth||1,a=v.plotRect(e).zoom;i.panState={startX:s.clientX,startY:s.clientY,axis:null,minX0:n.min,maxX0:n.max,zoom:a,ratio0:(n.max-n.min)/o/a},i.samples=[{x:s.clientX,t:t.timeStamp}]}}}_beginPinch(t){const e=this.w,i=t.touches[0],s=t.touches[1],n=Math.hypot(s.clientX-i.clientX,s.clientY-i.clientY)||1,o=this._screenXToPlotPx((i.clientX+s.clientX)/2),{min:a,max:l}=this._currentXWindow();this._m().pinch={d0:n,cx0:o,minX0:a,maxX0:l,gridWidth:e.layout.gridWidth||1}}_movePinch(t){const e=this.w,i=this._m().pinch;if(!i||!this._hasPlot())return;const s=t.touches[0],n=t.touches[1],o=Math.hypot(n.clientX-s.clientX,n.clientY-s.clientY)||1,a=this._screenXToPlotPx((s.clientX+n.clientX)/2),l=i.maxX0-i.minX0,r=l*(i.d0/o);let c=i.minX0+i.cx0/i.gridWidth*l-a/i.gridWidth*r,h=c+r;const d=this._clampBounds();if(d){const t=e.globals.minXDiff>0&&isFinite(e.globals.minXDiff)?e.globals.minXDiff:0,i=Math.max(2*t,1e-6*(d.max-d.min));if(h-c<i){const t=(c+h)/2;c=t-i/2,h=t+i/2}}this._applyXRange(c,h,!0)}_endPinch(){const t=this.w;this._m().pinch=null;const{min:e,max:i}=this._currentXWindow(),s={min:e,max:i},n=t.globals.initialConfig?g.clone(t.globals.initialConfig.yaxis):[],o=this.ctx.toolbar;o&&o.zoomCallback(s,n)}_movePan(t){const e=this._m(),i=e.panState,s=t.touches[0];if(!i.axis){const n=Math.abs(s.clientX-i.startX),o=Math.abs(s.clientY-i.startY);if(n<6&&o<6)return void this._pushSample(s.clientX,t.timeStamp);if(o>n)return e.busy=!1,void(e.panState=null);i.axis="x"}if("x"!==i.axis)return;t.preventDefault();const n=(s.clientX-i.startX)*i.ratio0;this._pushSample(s.clientX,t.timeStamp),this._applyXRange(i.minX0-n,i.maxX0-n,!1)}_endPan(){const t=this._m(),e=t.panState;t.panState=null;let i=0;const s=t.samples;if(s.length>=2){const t=s[0],e=s[s.length-1],n=e.t-t.t;n>0&&(i=(e.x-t.x)/n)}t.samples=[],e&&"x"===e.axis&&this._panInertiaEnabled()&&Math.abs(i)>.05?this._startInertia(i/e.zoom):(t.busy=!1,this._fireScrolled())}_startInertia(t){const e=this.w,i=this._m(),s=e.config.chart.pan&&e.config.chart.pan.friction,n="number"==typeof s?Math.min(Math.max(s,.5),.999):.92;let o=t,a=null;i.busy=!0;const l=t=>{if(e.globals.isDestroyed)return i.inertiaRAF=null,void(i.busy=!1);if(null==a)return a=t,void(i.inertiaRAF=requestAnimationFrame(l));const s=t-a;if(a=t,o*=Math.pow(n,s/16.6667),Math.abs(o)<.02)return i.inertiaRAF=null,i.busy=!1,void this._fireScrolled();const r=this._currentXWindow(),c=e.layout.gridWidth||1,h=(r.max-r.min)/c,d=o*s*h,u=this._applyXRange(r.min-d,r.max-d,!1),m=this._clampBounds();if(!u||m&&(d>0&&u.minX<=m.min+1e-6*(m.max-m.min)||d<0&&u.maxX>=m.max-1e-6*(m.max-m.min)))return i.inertiaRAF=null,i.busy=!1,void this._fireScrolled();i.inertiaRAF=requestAnimationFrame(l)};i.inertiaRAF=requestAnimationFrame(l)}}}),Object.defineProperty(exports,"default",{enumerable:!0,get:()=>h.default});
|
|
@@ -18,7 +18,7 @@ var __spreadValues = (a, b) => {
|
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
20
|
/*!
|
|
21
|
-
* ApexCharts v8.3.
|
|
21
|
+
* ApexCharts v8.3.1
|
|
22
22
|
* (c) 2018-2026 ApexCharts
|
|
23
23
|
*/
|
|
24
24
|
import * as _core from "apexcharts/core";
|
|
@@ -827,10 +827,14 @@ class Exports {
|
|
|
827
827
|
const byCategory = /* @__PURE__ */ new Map();
|
|
828
828
|
series.forEach((s, sI) => {
|
|
829
829
|
var _a;
|
|
830
|
+
const seen = /* @__PURE__ */ new Map();
|
|
830
831
|
(_a = s == null ? void 0 : s.data) == null ? void 0 : _a.forEach((d, i) => {
|
|
831
832
|
if (!d || typeof d !== "object") return;
|
|
832
833
|
const cat = Array.isArray(d) ? d[0] : d.x;
|
|
833
|
-
const
|
|
834
|
+
const x = String(cat);
|
|
835
|
+
const n = seen.get(x) || 0;
|
|
836
|
+
seen.set(x, n + 1);
|
|
837
|
+
const key = `${n}:${x}`;
|
|
834
838
|
let row = byCategory.get(key);
|
|
835
839
|
if (!row) {
|
|
836
840
|
row = { cat, values: cols.map((c) => c.head.map(() => "")) };
|
|
@@ -844,7 +848,8 @@ class Exports {
|
|
|
844
848
|
const bText = typeof b.cat === "string";
|
|
845
849
|
if (aText !== bText) return aText ? 1 : -1;
|
|
846
850
|
if (!aText) return a.cat - b.cat;
|
|
847
|
-
|
|
851
|
+
if (!w.axisFlags.isXNumeric) return 0;
|
|
852
|
+
return a.cat < b.cat ? -1 : a.cat > b.cat ? 1 : 0;
|
|
848
853
|
}).forEach(({ cat, values }) => body.push([cat, ...values.flat()]));
|
|
849
854
|
} else {
|
|
850
855
|
const len = Math.max(
|
|
@@ -869,7 +874,8 @@ class Exports {
|
|
|
869
874
|
}
|
|
870
875
|
}
|
|
871
876
|
const dates = body.map((r) => r[0]).filter(isDateCat);
|
|
872
|
-
const
|
|
877
|
+
const stamps = new Set(dates.map((c) => +new Date(c)));
|
|
878
|
+
const withTime = new Set([...stamps].map((t) => datetimeText(t))).size < stamps.size;
|
|
873
879
|
body.forEach(
|
|
874
880
|
(r) => rows.push(
|
|
875
881
|
[getFormattedCategory(r[0], withTime), ...r.slice(1)].join(
|
|
@@ -1585,7 +1591,7 @@ class Toolbar {
|
|
|
1585
1591
|
});
|
|
1586
1592
|
}
|
|
1587
1593
|
const series = ch.ctx.series.emptyCollapsedSeries(
|
|
1588
|
-
Utils.clone(w.globals.
|
|
1594
|
+
Utils.clone(w.globals._initialSeriesPeek)
|
|
1589
1595
|
);
|
|
1590
1596
|
ch.updateHelpers._updateSeries(
|
|
1591
1597
|
series,
|
|
@@ -1636,22 +1642,55 @@ class AxisMapping {
|
|
|
1636
1642
|
return w.globals.minX + px * AxisMapping.xRatio(w);
|
|
1637
1643
|
}
|
|
1638
1644
|
/**
|
|
1639
|
-
*
|
|
1640
|
-
*
|
|
1641
|
-
*
|
|
1642
|
-
*
|
|
1643
|
-
*
|
|
1645
|
+
* The plot area on screen, in client px: its corner is where the plot's
|
|
1646
|
+
* group is translated to (translateX, translateY into the svg), and it is
|
|
1647
|
+
* gridWidth by gridHeight. The one screen-to-plot measurement: the tooltip,
|
|
1648
|
+
* zoom, selection and every other pointer reader map through it, so x and y
|
|
1649
|
+
* cannot disagree under CSS zoom.
|
|
1650
|
+
*
|
|
1651
|
+
* Never the `.apexcharts-grid` group's box: a group measures to the union
|
|
1652
|
+
* of what it happens to draw (fact 2 above). The plot's outline starts a
|
|
1653
|
+
* pixel down (`Grid.drawGridArea`), so unless gridlines or row bands reach
|
|
1654
|
+
* the top edge the box starts a pixel below the plot, and on a numeric-x bar
|
|
1655
|
+
* chart the horizontal gridlines run `barPadForNumericAxis` out past both
|
|
1656
|
+
* sides.
|
|
1657
|
+
*
|
|
1658
|
+
* `zoom` is the CSS zoom of any container the chart sits in (screen px per
|
|
1659
|
+
* plot px): the measured svg width over `svgWidth`, the unscaled width it
|
|
1660
|
+
* was drawn at. A distance measured on screen from this corner is divided
|
|
1661
|
+
* by it to land in plot px, the space the series are laid out and painted in.
|
|
1662
|
+
* With nothing mounted to measure, screen px are taken as svg px.
|
|
1663
|
+
*
|
|
1664
|
+
* @param {import('../types/internal').ChartStateW} w
|
|
1665
|
+
* @returns {{ left: number, top: number, width: number, height: number, zoom: number }}
|
|
1666
|
+
*/
|
|
1667
|
+
static plotRect(w) {
|
|
1668
|
+
var _a, _b, _c;
|
|
1669
|
+
const svg = ((_a = w.dom.Paper) == null ? void 0 : _a.node) || ((_b = w.dom.baseEl) == null ? void 0 : _b.querySelector(".apexcharts-svg"));
|
|
1670
|
+
const box = ((_c = svg || w.dom.elWrap) == null ? void 0 : _c.getBoundingClientRect()) || {
|
|
1671
|
+
left: 0,
|
|
1672
|
+
top: 0,
|
|
1673
|
+
width: 0
|
|
1674
|
+
};
|
|
1675
|
+
const zoom = (svg && w.globals.svgWidth ? box.width / w.globals.svgWidth : 1) || 1;
|
|
1676
|
+
return {
|
|
1677
|
+
left: box.left + w.layout.translateX * zoom,
|
|
1678
|
+
top: box.top + w.layout.translateY * zoom,
|
|
1679
|
+
width: w.layout.gridWidth * zoom,
|
|
1680
|
+
height: w.layout.gridHeight * zoom,
|
|
1681
|
+
zoom
|
|
1682
|
+
};
|
|
1683
|
+
}
|
|
1684
|
+
/**
|
|
1685
|
+
* Client (screen) x -> pixels from the plot origin of {@link plotRect}.
|
|
1686
|
+
* Pass the rect when the caller has already measured it.
|
|
1644
1687
|
* @param {import('../types/internal').ChartStateW} w
|
|
1645
1688
|
* @param {number} screenX
|
|
1689
|
+
* @param {{ left: number, zoom: number }} [plot]
|
|
1646
1690
|
* @returns {number}
|
|
1647
1691
|
*/
|
|
1648
|
-
static screenXToPlotPx(w, screenX) {
|
|
1649
|
-
|
|
1650
|
-
const svg = baseEl && baseEl.querySelector(".apexcharts-svg");
|
|
1651
|
-
if (!svg) return screenX - w.layout.translateX;
|
|
1652
|
-
const svgRect = svg.getBoundingClientRect();
|
|
1653
|
-
const zoom = w.globals.svgWidth ? svgRect.width / w.globals.svgWidth : 1;
|
|
1654
|
-
return (screenX - svgRect.left) / (zoom || 1) - w.layout.translateX;
|
|
1692
|
+
static screenXToPlotPx(w, screenX, plot = AxisMapping.plotRect(w)) {
|
|
1693
|
+
return (screenX - plot.left) / plot.zoom;
|
|
1655
1694
|
}
|
|
1656
1695
|
}
|
|
1657
1696
|
const TooltipUtils = _core.__apex_tooltip_Utils;
|
|
@@ -2614,6 +2653,7 @@ class ZoomPanSelection extends Toolbar {
|
|
|
2614
2653
|
xHighestValue = maxX;
|
|
2615
2654
|
}
|
|
2616
2655
|
}
|
|
2656
|
+
if (xLowestValue === minX && xHighestValue === maxX) return;
|
|
2617
2657
|
const xaxis = {
|
|
2618
2658
|
min: xLowestValue,
|
|
2619
2659
|
max: xHighestValue
|