apexcharts 8.2.0 → 8.3.0
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 +271 -173
- package/dist/apexcharts.core.min.js +2 -2
- package/dist/apexcharts.css +35 -0
- package/dist/apexcharts.esm.js +1722 -1527
- package/dist/apexcharts.full.js +1459 -1075
- package/dist/apexcharts.full.min.js +2 -2
- package/dist/apexcharts.js +994 -715
- package/dist/apexcharts.min.js +2 -2
- package/dist/apexcharts.ssr.common.js +2 -2
- package/dist/apexcharts.ssr.esm.js +994 -715
- package/dist/area.common.js +2 -2
- package/dist/area.esm.js +91 -40
- package/dist/bar.common.js +2 -2
- package/dist/bar.esm.js +433 -394
- package/dist/bar.js +2 -2
- package/dist/boxPlot.common.js +2 -2
- package/dist/boxPlot.esm.js +364 -322
- package/dist/bubble.common.js +2 -2
- package/dist/bubble.esm.js +91 -40
- package/dist/candlestick.common.js +2 -2
- package/dist/candlestick.esm.js +364 -322
- package/dist/candlestick.js +2 -2
- package/dist/column.common.js +2 -2
- package/dist/column.esm.js +433 -394
- package/dist/core.common.js +2 -2
- package/dist/core.esm.js +271 -173
- package/dist/donut.common.js +1 -1
- package/dist/donut.esm.js +1 -1
- package/dist/dumbbell.common.js +2 -2
- package/dist/dumbbell.esm.js +433 -394
- package/dist/features/all.common.js +2 -2
- package/dist/features/all.esm.js +250 -187
- package/dist/features/annotations.common.js +1 -1
- package/dist/features/annotations.esm.js +1 -1
- package/dist/features/annotations.js +1 -1
- 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 +2 -2
- package/dist/features/drilldown.esm.js +4 -2
- package/dist/features/drilldown.js +2 -2
- 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 +1 -1
- package/dist/features/exports.esm.js +1 -1
- package/dist/features/exports.js +1 -1
- 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 +2 -2
- package/dist/features/highlight-filter.esm.js +14 -9
- package/dist/features/highlight-filter.js +2 -2
- 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 +2 -2
- package/dist/features/keyboard.esm.js +97 -145
- package/dist/features/keyboard.js +2 -2
- package/dist/features/legend.common.js +2 -2
- package/dist/features/legend.esm.js +63 -43
- 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 +1 -1
- package/dist/features/morph.esm.js +1 -1
- package/dist/features/morph.js +1 -1
- package/dist/features/perspectives.common.js +1 -1
- package/dist/features/perspectives.esm.js +1 -1
- package/dist/features/perspectives.js +1 -1
- package/dist/features/raincloud.common.js +1 -1
- package/dist/features/raincloud.esm.js +1 -1
- package/dist/features/raincloud.js +1 -1
- package/dist/features/renderer-canvas.common.js +2 -2
- package/dist/features/renderer-canvas.esm.js +2 -1
- package/dist/features/renderer-canvas.js +2 -2
- package/dist/features/stats.common.js +1 -1
- package/dist/features/stats.esm.js +1 -1
- package/dist/features/stats.js +1 -1
- package/dist/features/storyboard.common.js +1 -1
- package/dist/features/storyboard.esm.js +1 -1
- package/dist/features/storyboard.js +1 -1
- package/dist/features/streamgraph.common.js +2 -2
- package/dist/features/streamgraph.esm.js +3 -2
- package/dist/features/streamgraph.js +2 -2
- package/dist/features/toolbar.common.js +2 -2
- package/dist/features/toolbar.esm.js +92 -2
- package/dist/features/toolbar.js +2 -2
- package/dist/features/trellis.common.js +2 -2
- package/dist/features/trellis.esm.js +83 -47
- 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 +1 -1
- package/dist/features/weave.esm.js +1 -1
- package/dist/features/weave.js +1 -1
- package/dist/full.common.js +2 -2
- package/dist/full.esm.js +950 -795
- package/dist/heatmap.common.js +2 -2
- package/dist/heatmap.esm.js +3 -17
- package/dist/heatmap.js +2 -2
- package/dist/histogram.common.js +2 -2
- package/dist/histogram.esm.js +433 -394
- package/dist/icicle.common.js +2 -2
- package/dist/icicle.esm.js +54 -38
- package/dist/icicle.js +2 -2
- package/dist/line.common.js +2 -2
- package/dist/line.esm.js +91 -40
- package/dist/line.js +2 -2
- package/dist/locales/en.json +2 -1
- package/dist/locales/ro.json +3 -2
- 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 +1 -1
- package/dist/pie.esm.js +1 -1
- package/dist/pie.js +1 -1
- package/dist/polarArea.common.js +1 -1
- package/dist/polarArea.esm.js +1 -1
- package/dist/radar.common.js +2 -2
- package/dist/radar.esm.js +5 -4
- package/dist/radar.js +2 -2
- package/dist/radialBar.common.js +1 -1
- package/dist/radialBar.esm.js +1 -1
- package/dist/radialBar.js +1 -1
- package/dist/raincloud.common.js +2 -2
- package/dist/raincloud.esm.js +72 -26
- package/dist/rangeArea.common.js +2 -2
- package/dist/rangeArea.esm.js +91 -40
- package/dist/rangeBar.common.js +2 -2
- package/dist/rangeBar.esm.js +433 -394
- package/dist/scatter.common.js +2 -2
- package/dist/scatter.esm.js +91 -40
- package/dist/streamgraph.common.js +2 -2
- package/dist/streamgraph.esm.js +93 -41
- package/dist/sunburst.common.js +2 -2
- package/dist/sunburst.esm.js +103 -93
- package/dist/sunburst.js +2 -2
- package/dist/treemap.common.js +2 -2
- package/dist/treemap.esm.js +105 -86
- 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 +2 -2
- package/dist/unit.esm.js +280 -202
- package/dist/unit.js +2 -2
- package/dist/violin.common.js +2 -2
- package/dist/violin.esm.js +72 -26
- package/dist/violin.js +2 -2
- package/dist/waterfall.common.js +2 -2
- package/dist/waterfall.esm.js +432 -393
- package/package.json +1 -1
- package/src/apexcharts.js +13 -6
- package/src/assets/apexcharts.css +35 -0
- package/src/charts/Bar.js +62 -55
- package/src/charts/BarStacked.js +80 -88
- package/src/charts/BoxCandleStick.js +28 -31
- package/src/charts/Icicle.js +37 -37
- package/src/charts/Line.js +118 -42
- package/src/charts/Radar.js +5 -7
- package/src/charts/RangeBar.js +47 -43
- package/src/charts/Sunburst.js +101 -98
- package/src/charts/Treemap.js +108 -66
- package/src/charts/Unit.js +368 -250
- package/src/charts/Violin.js +48 -30
- package/src/charts/common/Breadcrumb.js +2 -2
- package/src/charts/common/Hierarchy.js +32 -11
- package/src/charts/common/Jitter.js +32 -7
- package/src/charts/common/bar/DataLabels.js +76 -81
- package/src/charts/common/bar/Helpers.js +43 -7
- package/src/charts/common/line/Helpers.js +12 -15
- package/src/charts/common/partition/NodeTooltip.js +8 -1
- package/src/charts/common/partition/Partition.js +33 -1
- package/src/charts/common/treemap/Helpers.js +3 -11
- package/src/locales/en.json +2 -1
- package/src/locales/ro.json +3 -2
- package/src/modules/Core.js +4 -0
- package/src/modules/CoreUtils.js +18 -42
- package/src/modules/Data.js +23 -24
- package/src/modules/DataLabels.js +6 -6
- package/src/modules/Graphics.js +62 -49
- package/src/modules/Markers.js +3 -1
- package/src/modules/Range.js +44 -29
- package/src/modules/RendererController.js +17 -3
- package/src/modules/Scales.js +32 -9
- package/src/modules/Series.js +39 -18
- package/src/modules/Theme.js +1 -1
- package/src/modules/ZoomPanSelection.js +119 -2
- package/src/modules/accessibility/KeyboardNavigation.js +114 -186
- package/src/modules/animations/LengthTransition.js +22 -2
- package/src/modules/drilldown/Breadcrumb.js +5 -2
- package/src/modules/helpers/Destroy.js +1 -1
- package/src/modules/highlightFilter/HighlightFilter.js +8 -9
- package/src/modules/highlightFilter/TreemapPart.js +2 -2
- package/src/modules/legend/HeatmapGradientLegend.js +76 -45
- package/src/modules/legend/Helpers.js +2 -0
- package/src/modules/legend/Legend.js +11 -12
- package/src/modules/settings/Options.js +7 -0
- package/src/modules/streamgraph/StreamLabels.js +1 -0
- package/src/modules/tooltip/Tooltip.js +20 -4
- package/src/modules/tooltip/Utils.js +8 -0
- package/src/modules/trellis/Trellis.js +6 -0
- package/src/modules/trellis/TrellisChrome.js +18 -7
- package/src/modules/trellis/TrellisSync.js +2 -0
- package/src/renderers/canvas/CanvasGraphics.js +1 -0
- package/src/ssr/DOMShim.js +10 -0
- package/src/types/internal.d.ts +9 -3
- package/types/apexcharts.d.ts +31 -12
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* ApexCharts v8.
|
|
2
|
+
* ApexCharts v8.3.0
|
|
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,r=Object.prototype.propertyIsEnumerable,l=(e,i,s)=>i in e?t(e,i,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[i]=s,a=(t,e)=>{for(var i in e||(e={}))n.call(e,i)&&l(t,i,e[i]);if(s)for(var i of s(e))r.call(e,i)&&l(t,i,e[i]);return t},o=(t,s)=>e(t,i(s)),c=(t,e,i)=>new Promise((s,n)=>{var r=t=>{try{a(i.next(t))}catch(t){n(t)}},l=t=>{try{a(i.throw(t))}catch(t){n(t)}},a=t=>t.done?s(t.value):Promise.resolve(t.value).then(r,l);a((i=i.apply(t,e)).next())});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});function h(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 u=h(require("apexcharts/core")),d=u.__apex_Utils,p=u.__apex_Environment_Environment,f=u.__apex_BrowserAPIs_BrowserAPIs,m=u.__apex_Resize_addResizeListener,g=u.__apex_Resize_removeResizeListener;class y{constructor(t,e){this.w=t,this.ctx=e,this.kind="svg"}beginSeries(){}present(){return null}clear(){}group(t){return this.ctx.graphics.group(t)}drawPath(t){return this.ctx.graphics.drawPath(t)}drawLine(...t){return this.ctx.graphics.drawLine(...t)}drawRect(...t){return this.ctx.graphics.drawRect(...t)}drawCircle(t,e){return this.ctx.graphics.drawCircle(t,e)}drawText(t){return this.ctx.graphics.drawText(t)}renderPaths(t){return this.ctx.graphics.renderPaths(t)}drawMarker(t,e,i={}){return this.ctx.graphics.drawMarker(t,e,i)}supports(t){return!0}hitTest(){return null}restyle(){}toBitmap(){return null}destroy(){}}const x=["none","lighten","darken"];function v(t){const e=t.config.series||[],i=t.config.chart.type,s="scatter"===i||"bubble"===i,n=t.config.markers&&t.config.markers.size,r=Array.isArray(n)?n.some(t=>t>0):(n||0)>0,l=!(!t.config.dataLabels||!t.config.dataLabels.enabled),a="heatmap"===i;let o=0,c=0;e.forEach(t=>{const e=Array.isArray(t.data)?t.data.length:0;e>c&&(c=e),(s||r||a)&&(o+=e),l&&(o+=e)});return c>=5e4&&(o=Math.max(o,c)),o}function b(t){var e,i,s,n;const r=t.config.fill&&t.config.fill.type,l=t=>"pattern"===t||"image"===t||"gradient"===t;if(Array.isArray(r)?r.some(l):l(r))return!0;const a=null==(i=null==(e=t.config.plotOptions)?void 0:e.line)?void 0:i.colors;if(a&&a.colorAboveThreshold&&a.colorBelowThreshold)return!0;if("heatmap"===t.config.chart.type&&"rect"!==((null==(n=null==(s=t.config.plotOptions)?void 0:s.heatmap)?void 0:n.shape)||"rect"))return!0;const o=t.config.states||{},c=o.hover&&o.hover.filter&&o.hover.filter.type,h=o.active&&o.active.filter&&o.active.filter.type;return!(!c||x.includes(c))||!(!h||x.includes(h))}const _="__apexcharts_renderers__";function w(){const t=globalThis;return t[_]||(t[_]=new Map),t[_]}class A{static get _rendererRegistry(){return w()}static registerRenderer(t,e){w().set(t,e)}static unregisterRenderer(t){w().delete(t)}constructor(t,e){this.w=t,this.ctx=e,this.svg=new y(t,e),this.active=this.svg,this._activeKind="svg",this._instances={},this.w.globals.activeRenderer=this.active}_activate(t,e){this.active=e,this._activeKind=t,this.ctx.renderer=e,this.w.globals.activeRenderer=e}_desiredKind(){const t=this.w.config.chart,e=t.renderer||"svg";if(!p.isBrowser())return"svg";if("svg"===e)return"svg";if(b(this.w))return"svg";if("canvas"===e)return"canvas";return v(this.w)>=(t.rendererThreshold||8e3)?"canvas":"svg"}resolve(){const t=this.w.config.chart.renderer||"svg",e=this._desiredKind();if("svg"!==e){const i=w().get(e);if(i)return this._instances[e]||(this._instances[e]=i(this.w,this.ctx)),this._activate(e,this._instances[e]),this._activeKind;t===e&&function(t,e,i={}){const{module:s=`features/${e}`,entry:n,scripts:r=[`features/${e}.js`],tail:l}=i,a=r.map(t=>`<script src='.../dist/${t}'>`).join(" and ");globalThis.console.warn(`ApexCharts: ${t} requires the ${e} feature, which is not in this bundle. Bundler: import 'apexcharts/${s}'`+(n?` (or from 'apexcharts/${n}')`:"")+`. Script tag: add ${a} after the ApexCharts script, or load apexcharts.full.min.js instead.`+(l?` ${l}`:""))}(`\`chart.renderer: '${e}'\``,`renderer-${e}`,{tail:"Falling back to SVG."})}else"canvas"===t&&b(this.w)&&console.warn('[apexcharts] renderer:"canvas" requested but this chart uses a feature the canvas renderer does not render yet (gradient/pattern/image fill or a state color-matrix filter); falling back to SVG.');return this._activate("svg",this.svg),this._activeKind}pendingKind(){const t=this._desiredKind();return"svg"===t||w().has(t)?t:"svg"}getActiveKind(){return this._activeKind}teardown(){for(const t in this._instances){const e=this._instances[t];e&&"function"==typeof e.destroy&&e.destroy()}this._instances={},this.active=this.svg,this._activeKind="svg",this.w.globals.activeRenderer=null}}const E=u.__apex_helpers_InitCtxVariables;function M(t){if(!Array.isArray(t)||0===t.length)return"empty";for(let e=0;e<t.length;e++){const i=t[e];if(null!=i)return Array.isArray(i)?"paired":"object"==typeof i?"object":"plain"}return"empty"}function S(t,e){if(null!=t){if("paired"===e){const e=t[0];return e instanceof Date?e.getTime():e}if("object"===e){const e=t.x;return e instanceof Date?e.getTime():e}}}function k(t,e){return"paired"===e?[t,null]:"object"===e?{x:t,y:null}:null}function C(t,e,i){const s="function"==typeof i?i(t,e):t?t[i]:void 0;return null==s||""===s?null:String(s)}function L(t,e){if(!e||"first-seen"===e)return t.slice();if("asc"===e||"desc"===e){const i=t.slice().sort((t,e)=>{const i=Number(t),s=Number(e);return isFinite(i)&&isFinite(s)?i-s:t<e?-1:t>e?1:0});return"desc"===e?i.reverse():i}if(Array.isArray(e)){const i=e.map(String).filter(e=>-1!==t.indexOf(e)),s=t.filter(t=>-1===i.indexOf(t));return i.concat(s)}return"function"==typeof e?t.slice().sort(e):t.slice()}function F(t,e){const i=[],s=new Set;let n=!1,r=!1,l=0,a="plain";t.forEach(t=>{const e=M(t&&t.data);if("empty"!==e){if("plain"===e)return r=!0,void(l=Math.max(l,t.data.length));n=!0,a=e,t.data.forEach(t=>{const n=S(t,e);if(void 0===n)return;const r=typeof n+":"+String(n);s.has(r)||(s.add(r),i.push(n))})}}),n&&r&&e.push("trellis: mixing x-keyed data ([x,y] / {x,y}) with plain value arrays; plain series are padded by position, not by x");const o=n&&i.every(t=>"number"==typeof t&&isFinite(t));return o&&i.sort((t,e)=>Number(t)-Number(e)),{unionX:i,sawKeyed:n,plainMaxLen:l,xForm:a,xIsNumeric:o}}const N=["scatter","bubble"];function O(t,e,i=!0){const s=[],n=new Set;let r=0;return{align:l=>{const c=M(l&&l.data),h=l&&null!=l.name?String(l.name):`series-${r+1}`;r++,n.has(h)||(n.add(h),s.push(h));const u=o(a({},l),{name:h});if(!i)return u.data=Array.isArray(l.data)?l.data.slice():[],u;if("plain"===c||"empty"===c){const e=t.sawKeyed?t.unionX.length:t.plainMaxLen,i=Array.isArray(l.data)?l.data.slice(0,e):[];for(;i.length<e;)i.push(null);if(u.data=i,Array.isArray(l.highlightData)){const t=l.highlightData.slice(0,e);for(;t.length<e;)t.push(null);u.highlightData=t}return u}const d=new Map,p=new Map,f=Array.isArray(l.highlightData)?l.highlightData:null;return l.data.forEach((t,i)=>{const s=S(t,c);void 0===s||d.has(s)?void 0!==s&&d.has(s)&&e.push(`trellis: duplicate x "${String(s)}" in series "${h}"; keeping the first`):(d.set(s,t),f&&p.set(s,f[i]))}),u.data=t.unionX.map(t=>d.has(t)?d.get(t):k(t,c)),f&&(u.highlightData=t.unionX.map(t=>p.has(t)?p.get(t):null)),u},seriesNames:s}}function H(t,e={}){const i=t.xForm,s={bar:0,column:0,rangeBar:[0,0],candlestick:[0,0,0,0],boxPlot:[0,0,0,0,0]},n=e.chartType&&e.chartType in s?s[e.chartType]:null,r="plain"===i?t.unionX.map(()=>n):t.unionX.map(t=>{if(null===n)return k(t,i);const e=Array.isArray(n)?n.slice():n;return"object"===i?{x:t,y:e}:[t,e]});return{name:e.name||t.seriesNames[0]||"series-1",data:r}}function P(t,e={},i={}){const s=[],n=Array.isArray(t)?t:[],r=(l=i.chartType,!N.includes(l||""));var l;if(e.row||e.column)return e.by&&s.push("trellis: `by` is ignored when `row`/`column` are set (they are mutually exclusive)"),function(t,e,i,s=!0){const n=e.row,r=e.column,l=new Map,a=new Map,o=new Map,c=[],h=[],u=[],d=(t,e)=>{-1===t.indexOf(e)&&t.push(e)};if(t.forEach((t,e)=>{var i,s;const p=n?C(t,e,n):"",f=r?C(t,e,r):"";if(null===p&&null===f)return void c.push(t);if(null===p)return d(u,f),o.has(f)||o.set(f,[]),void(null==(i=o.get(f))||i.push(t));if(null===f)return d(h,p),a.has(p)||a.set(p,[]),void(null==(s=a.get(p))||s.push(t));d(h,p),d(u,f);let m=l.get(p);m||(m=new Map,l.set(p,m));let g=m.get(f);g||(g=[],m.set(f,g)),g.push(t)}),!h.length&&!u.length)return $(["trellis: no series carries the row/column facet keys; nothing to split"]);"number"==typeof e.limit&&e.limit>0&&i.push("trellis: `limit` is not applied to a 2-D grid; ignoring it");const p=L(h.length?h:[""],e.order),f=L(u.length?u:[""],e.order),m=F(t,i),{align:g,seriesNames:y}=O(m,i,s),x=[];return p.forEach(t=>{f.forEach(e=>{var i;const s=((null==(i=l.get(t))?void 0:i.get(e))||[]).concat(a.get(t)||[]).concat(o.get(e)||[]).concat(c).map(g);x.push({key:[t,e].filter(t=>""!==t).join(" / ")||"all",rowKey:t,colKey:e,series:s,seriesNames:s.map(t=>t.name),empty:0===s.length})})}),{mode:"2d",panels:x,rowKeys:p,colKeys:f,seriesNames:y,xForm:m.sawKeyed?m.xForm:"plain",unionX:m.sawKeyed?m.unionX:Array.from({length:m.plainMaxLen},(t,e)=>e),xIsNumeric:m.xIsNumeric,dropped:0,warnings:i}}(n,e,s,r);const a=e.by||"facet",o=new Map,c=[];if(n.forEach((t,e)=>{const i=C(t,e,a);if(null===i)c.push(t);else{o.has(i)||o.set(i,[]);const e=o.get(i);e&&e.push(t)}}),0===o.size)return $(["trellis: no series carries the facet key; nothing to split"]);let h=L(Array.from(o.keys()),e.order),u=0;"number"==typeof e.limit&&e.limit>0&&h.length>e.limit&&(u=h.length-e.limit,h=h.slice(0,e.limit));const d=F(h.reduce((t,e)=>t.concat(o.get(e)||[]),[]).concat(c),s),{align:p,seriesNames:f}=O(d,s,r);return{mode:"1d",panels:h.map(t=>{const e=(o.get(t)||[]).map(p),i=c.map(p),s=e.concat(i);return{key:t,rowKey:null,colKey:null,series:s,seriesNames:s.map(t=>t.name),empty:0===s.length}}),rowKeys:null,colKeys:null,seriesNames:f,xForm:d.sawKeyed?d.xForm:"plain",unionX:d.sawKeyed?d.unionX:Array.from({length:d.plainMaxLen},(t,e)=>e),xIsNumeric:d.xIsNumeric,dropped:u,warnings:s}}function $(t){return{mode:"1d",panels:[],rowKeys:null,colKeys:null,seriesNames:[],xForm:"plain",unionX:[],xIsNumeric:!1,dropped:0,warnings:t}}function W(t,e){const i=t.length;if(0===i)return NaN;if(1===i)return t[0];const s=(i-1)*e,n=Math.floor(s),r=Math.ceil(s);return n===r?t[n]:t[n]+(t[r]-t[n])*(s-n)}function B(t,e={}){if(!Array.isArray(t)||0===t.length)return null;const i=t.slice().sort((t,e)=>t-e);let s=i[0],n=i[i.length-1];const r=e.range;if(Array.isArray(r)&&2===r.length){const t=Number(r[0]),e=Number(r[1]);Number.isFinite(t)&&Number.isFinite(e)&&e>t&&(s=t,n=e)}if(!(n>s)){const t=Math.abs(s)>0?.05*Math.abs(s):.5;return{edges:[s-t,s+t],binWidth:2*t,rule:"single",capped:!1}}const l=n-s;let a,o;if("number"==typeof e.binWidth&&e.binWidth>0)a=e.binWidth,o="binWidth";else if("number"==typeof e.bins&&e.bins>=1)a=l/Math.floor(e.bins),o="count";else{const t=function(t,e,i){const s=t.length,n=t=>e/Math.max(1,Math.ceil(t)),r=()=>n(Math.log2(s)+1);switch(i){case"sqrt":return{width:n(Math.sqrt(s)),rule:"sqrt"};case"rice":return{width:n(2*Math.cbrt(s)),rule:"rice"};case"scott":{const e=function(t){const e=t.length;if(e<2)return 0;let i=0;for(let s=0;s<e;s++)i+=t[s];const s=i/e;let n=0;for(let i=0;i<e;i++){const e=t[i]-s;n+=e*e}return Math.sqrt(n/e)}(t);return e>0?{width:3.49*e*Math.pow(s,-1/3),rule:"scott"}:{width:r(),rule:"sturges"}}case"fd":{const e=W(t,.75)-W(t,.25);return e>0?{width:2*e*Math.pow(s,-1/3),rule:"fd"}:{width:r(),rule:"sturges"}}case"auto":{const e=r(),i=W(t,.75)-W(t,.25);if(i<=0)return{width:e,rule:"sturges"};const n=2*i*Math.pow(s,-1/3);return n<e?{width:n,rule:"fd"}:{width:e,rule:"sturges"}}default:return{width:r(),rule:"sturges"}}}(i,l,"string"==typeof e.bins?e.bins:"auto");a=t.width,o=t.rule}(!Number.isFinite(a)||a<=0)&&(a=l);let c=Math.ceil(l/a);(!Number.isFinite(c)||c<1)&&(c=1);let h=!1;c>1e3&&(c=1e3,h=!0),a=l/c;const u=new Array(c+1);for(let t=0;t<=c;t++)u[t]=s+t*a;return u[c]=Math.max(u[c],n),{edges:u,binWidth:a,rule:o,capped:h}}function z(t,e){const i=e.length-1;if(!(t>=e[0])||t>e[i])return-1;if(t===e[i])return i-1;const s=(e[i]-e[0])/i;if(s>0){let n=Math.floor((t-e[0])/s);return n<0&&(n=0),n>i-1&&(n=i-1),t<e[n]?n--:t>=e[n+1]&&n++,n<0||n>i-1?-1:n}let n=0,r=i-1;for(;n<=r;){const i=n+r>>1;if(t<e[i])r=i-1;else{if(!(t>=e[i+1]))return i;n=i+1}}return-1}function T(t,e={}){if(!Array.isArray(t)||0===t.length)return null;const i=t.slice().sort((t,e)=>t-e),s=i.length;let n=e.bandwidth;if(!("number"==typeof n&&n>0)){const t=function(t){const e=t.length;if(e<2)return 0;let i=0;for(let s=0;s<e;s++)i+=t[s];const s=i/e;let n=0;for(let i=0;i<e;i++){const e=t[i]-s;n+=e*e}return Math.sqrt(n/e)}(i),e=W(i,.75)-W(i,.25);n=.9*(e>0?Math.min(t,e/1.349):t)*Math.pow(s,-.2)}if(!isFinite(n)||n<=0){const t=i[0],e=Math.abs(t)>0?.001*Math.abs(t):.001;return{density:[[t-e,0],[t,1],[t+e,0]],bandwidth:e}}const r=Math.max(8,Math.floor(e.resolution||64)),l=i[0]-2*n,a=(i[s-1]+2*n-l)/(r-1),o=1/(s*n*Math.sqrt(2*Math.PI)),c=[];for(let t=0;t<r;t++){const e=l+t*a;let r=0;for(let t=0;t<s;t++){const s=(e-i[t])/n;r+=Math.exp(-.5*s*s)}c.push([e,r*o])}return{density:c,bandwidth:n}}const I=["heatmap","pie","donut","polarArea","radialBar"],R=["pie","donut","polarArea"];function K(t){const e=[];if(!Array.isArray(t))return e;for(let i=0;i<t.length;i++){const s=t[i];let n=s;Array.isArray(s)?n=1===s.length?s[0]:s[1]:s&&"object"==typeof s&&(n=void 0!==s.y?s.y:s.x);const r=Number(n);null!=n&&isFinite(r)&&e.push(r)}return e}function j(t,e,i,s){var n,r,l,a,o,c;const h={plotOptions:null,yExtentOverride:null,skipYaxisPush:I.includes(s),forceSharedY:!1,pieScaleOf:null,warnings:[]},u=t.panels,d=(null==i?void 0:i.plotOptions)||{};if("histogram"===s){const t=d.histogram||{};let i=[];const s=u.map(t=>t.series.map(t=>{const e=K(t.data);return i=i.concat(e),e})),r=B(i,{bins:t.bins,binWidth:t.binWidth,range:t.range});if(r&&r.edges.length>1){const i=r.edges;h.plotOptions={histogram:{range:[i[0],i[i.length-1]],binWidth:r.binWidth}};let l=0;s.forEach(e=>e.forEach(e=>{if(!e.length)return;(function(t,e={}){let i=t.slice();if(e.cumulative){let t=0;i=i.map(e=>t+=e)}const s=t.reduce((t,e)=>t+e,0);if(s<=0)return i;if("relative"===e.normalize)return i.map(t=>t/s*100);if("density"===e.normalize){const t=e.binWidth;if("number"==typeof t&&t>0)return i.map(e=>e/(s*t))}return i})(function(t,e){const i=new Array(Math.max(0,e.length-1)).fill(0);for(let s=0;s<t.length;s++){const n=z(t[s],e);n>=0&&i[n]++}return i}(e,i),{normalize:t.normalize,cumulative:t.cumulative,binWidth:r.binWidth}).forEach(t=>{isFinite(t)&&t>l&&(l=t)})})),l>0&&(h.yExtentOverride={min:0,max:l});const a=(null==(n=e.scales)?void 0:n.y)||"shared";"independent-row"!==a&&"independent-column"!==a||(h.forceSharedY=!0,h.warnings.push("histogram trellis: group y scales would re-derive counts per group; using scales.y 'shared' (use 'independent' for per-panel count scales)."))}}if("violin"===s){const t=(null==(r=d.violin)?void 0:r.kde)||{};if(!("number"==typeof t.bandwidth&&t.bandwidth>0)){let t=[];u.forEach(e=>e.series.forEach(e=>{t=t.concat(function(t){const e=[];return Array.isArray(t)?(t.forEach(t=>{const i=t&&"object"==typeof t?t.y:null;Array.isArray(i)&&i.forEach(t=>{const i=Number(t);null!=t&&isFinite(i)&&e.push(i)})}),e):e}(e.data))}));const e=t.length?T(t,{resolution:8}):null;e&&isFinite(e.bandwidth)&&e.bandwidth>0&&(h.plotOptions={violin:{kde:{bandwidth:e.bandwidth}}})}}if("heatmap"===s){"independent"===(null==(l=e.scales)?void 0:l.color)&&h.warnings.push("a heatmap trellis must share its color scale (the same color meaning different values per panel is a silent lie); ignoring scales.color 'independent'.");const t=null==(o=null==(a=d.heatmap)?void 0:a.colorScale)?void 0:o.ranges;if(!(Array.isArray(t)&&t.length>0)){let t=1/0,e=-1/0;u.forEach(i=>i.series.forEach(i=>{K(i.data).forEach(i=>{i<t&&(t=i),i>e&&(e=i)})})),isFinite(t)&&isFinite(e)&&(h.plotOptions={heatmap:{colorScale:{min:t,max:e}}})}}if("bubble"===s){"independent"===(null==(c=e.scales)?void 0:c.size)&&h.warnings.push("a bubble trellis must share its size scale; ignoring scales.size 'independent'.");let t=1/0,i=-1/0;u.forEach(e=>e.series.forEach(e=>{(function(t){const e=[];return Array.isArray(t)?(t.forEach(t=>{let i=null;Array.isArray(t)&&t.length>2?i=t[2]:t&&"object"==typeof t&&(i=t.z);const s=Number(i);null!=i&&isFinite(s)&&e.push(s)}),e):e})(e.data).forEach(e=>{e<t&&(t=e),e>i&&(i=e)})})),isFinite(t)&&isFinite(i)&&(h.plotOptions={bubble:{minZ:t,maxZ:i}})}if(R.includes(s)&&e.radiusByTotal){const t=new Map;let e=0;u.forEach(i=>{let s=0;i.series.forEach(t=>{K(t.data).forEach(t=>{s+=Math.abs(t)})}),t.set(i.key,s),s>e&&(e=s)}),e>0&&(h.pieScaleOf=i=>{const s=t.get(i);return"number"!=typeof s||s<=0?null:Math.sqrt(s/e)})}return h}const D=u.__apex_ThemePalettes_getThemePalettes;function X(t,e,i=3){if(!isFinite(t)||!isFinite(e))return{min:0,max:1,tickAmount:1};if(t===e){const i=0===t?1:.1*Math.abs(t);t-=i,e+=i}const s=Math.max(1,i),n=(e-t)/s,r=Math.pow(10,Math.floor(Math.log10(n)));let l={dist:1/0,ticks:0,min:0,max:1};return(r>=10?[1,2,2.5,5,10]:[1,2,5,10]).forEach(i=>{const n=i*r,a=Math.floor(t/n)*n,o=Math.ceil(e/n)*n,c=Math.max(1,Math.round((o-a)/n)),h=Math.abs(c-s);(h<l.dist||h===l.dist&&c<l.ticks)&&(l={dist:h,ticks:c,min:a,max:o})}),{min:l.min,max:l.max,tickAmount:l.ticks}}function q(t,e,i){if(null==t)return;let s=t;if("paired"===e?s=t[1]:"object"===e&&(s=t.y),null==s)return;if(Array.isArray(s)){for(let t=0;t<s.length;t++){const e=Number(s[t]);isFinite(e)&&(e<i.min&&(i.min=e),e>i.max&&(i.max=e))}return}const n=Number(s);isFinite(n)&&(n<i.min&&(i.min=n),n>i.max&&(i.max=n))}function Y(t,e,i){const s=e&&"object"==typeof e&&!Array.isArray(e)&&"highlight"in e?e.highlight:Array.isArray(t.highlightData)?t.highlightData[i]:null;return"number"==typeof s&&isFinite(s)?s:null}function G(t){if("number"!=typeof t||!isFinite(t)||t%1==0)return 0;const e=String(t);return-1!==e.indexOf("e")||-1!==e.indexOf("E")?4:Math.min(4,(e.split(".")[1]||"").length)}function V(t,e,i={}){const s={min:1/0,max:-1/0},n=t=>{isFinite(t)&&(t<s.min&&(s.min=t),t>s.max&&(s.max=t))};return t.forEach(t=>{const r=new Map;t.series.forEach(t=>{var n;if(!Array.isArray(t.data))return;if(!function(t,e){if(!e.stackOnlyBar)return!0;const i=t&&t.type;return null==i||"bar"===i||"column"===i}(t,i))return void t.data.forEach(t=>q(t,e,s));const l=String(null!=(n=t.group)?n:""),a=t=>{const e=r.get(t)||{pos:[],neg:[]};return r.set(t,e),e},o=a(l),c=i.parts?a("~"+l):null;t.data.forEach((i,s)=>{[o,c].forEach((n,r)=>{if(!n)return;void 0===n.pos[s]&&(n.pos[s]=0,n.neg[s]=0);const l=r?Y(t,i,s):(t=>{if(null==t)return null;const i="paired"===e?t[1]:"object"===e?t.y:t;if(null==i||Array.isArray(i))return null;const s=Number(i);return isFinite(s)?s:null})(i);null!==l&&(l>0?n.pos[s]+=l:n.neg[s]+=l)})})}),r.forEach(t=>{t.pos.forEach(n),t.neg.forEach(n)})}),isFinite(s.min)&&isFinite(s.max)?s:null}function U(t,e={},i={}){const s=e.scales||{},n=s.x||"shared",r=s.y||"shared";let l=null;if("shared"===n&&t.xIsNumeric&&t.unionX.length){const e=t.unionX;l={min:e[0],max:e[e.length-1]}}const a=["bar","column","histogram"].includes(i.chartType||""),o=t=>t?(a&&t.min>0&&(t.min=0),X(t.min,t.max,e.targetTicks||3)):null,c=!!i.stacked&&"100%"===i.stackType,h=!!i.stacked&&!c,u=e=>c?{min:0,max:100}:h?V(e,t.xForm,{stackOnlyBar:i.stackOnlyBar,parts:i.parts}):function(t,e,i=!1){const s={min:1/0,max:-1/0};return t.forEach(t=>t.series.forEach(t=>{Array.isArray(t.data)&&t.data.forEach((n,r)=>{q(n,e,s);const l=i?Y(t,n,r):null;null!==l&&q(l,"plain",s)})})),isFinite(s.min)&&isFinite(s.max)?s:null}(e,t.xForm,i.parts);let d=null;"shared"===r&&(d=o(i.yExtentOverride||u(t.panels)));let p=null;if("independent-row"===r){p=new Map;const e=new Map;t.panels.forEach(t=>{var i;const s=null!=(i=t.rowKey)?i:"";e.has(s)||e.set(s,[]),e.get(s).push(t)}),e.forEach((t,e)=>{const i=o(u(t));i&&(null==p||p.set(e,i))})}let f=null;if("independent-column"===r){f=new Map;const e=new Map;t.panels.forEach(t=>{var i;const s=null!=(i=t.colKey)?i:"";e.has(s)||e.set(s,[]),e.get(s).push(t)}),e.forEach((t,e)=>{const i=o(u(t));i&&(null==f||f.set(e,i))})}const m=D().palette1,g=Array.isArray(i.userColors)?i.userColors.filter(t=>"string"==typeof t):[],y=g.length?g:m,x=t.seriesNames;return{x:l,y:d,rowY:p,colY:f,colorOf:t=>{const e=x.indexOf(t);return y[(-1===e?0:e)%y.length]},palette:y}}function Z({panelCount:t,containerWidth:e,cfg:i,hostHeight:s,chromeHeight:n}){var r,l;const a=null!=(r=i.gap)?r:12,o=function(t,e,i={}){var s,n;const r=null!=(s=i.gap)?s:12;if("number"==typeof i.columns&&i.columns>0)return Math.max(1,Math.min(Math.floor(i.columns),e));const l=null!=(n=i.minPanelWidth)?n:220,a=Math.floor((t+r)/(l+r));return Math.max(1,Math.min(a,e))}(e,t,i),c=Math.max(1,Math.ceil(t/o)),h=!i.header||!1!==i.header.show?22:0,u=Math.max(0,n||0),d=c*h+a*(c-1)+u,p="number"==typeof s&&s>0?s:0,f=Math.max(0,(e-a*(o-1))/o);let m;m="number"==typeof i.panelHeight&&i.panelHeight>0?i.panelHeight:p>0?(p-d)/c:f/(null!=(l=i.aspectRatio)?l:1.6);const g="number"==typeof i.minPanelHeight&&i.minPanelHeight>0?i.minPanelHeight:80;m=Math.max(g,Math.round(m));const y=c*(m+h)+a*(c-1),x=p>0?Math.max(0,y+u-p):0,v=i.axes&&i.axes.labels||"edges",b=i.scales||{},_=1===o,w=Array.from({length:t},(e,i)=>{const s=Math.floor(i/o),n=i%o;let r,l;return"none"===v?(r=!1,l=!1):"all"===v||_?(r=!0,l=!0):(r="independent"===b.x||s===function(t,e,i,s){return t<e-(s-1)*i?s-1:s-2}(n,t,o,c),l="independent"===b.y||"independent-column"===b.y||0===n),{i:i,r:s,c:n,showXLabels:r,showYLabels:l}});return{cols:o,rows:c,panelW:f,panelH:m,headerH:h,gap:a,cells:w,gridH:y,overflowH:x}}const J=u.__apex_Series,Q=["#cf4d3f","#8f9499","#26a75b"],tt=(t,e,i)=>t+(e-t)*i;function et(t){return Math.max(0,Math.min(255,Math.round(t))).toString(16).padStart(2,"0")}function it(t,e,i){const s=d.parseHex(st(t)),n=d.parseHex(st(e));return s&&n?"#"+et(tt(s[0],n[0],i))+et(tt(s[1],n[1],i))+et(tt(s[2],n[2],i)):t}function st(t){if("string"!=typeof t)return"#000000";if(d.isColorHex(t))return t;return d.rgb2hex(t)||"#000000"}function nt(t,e,i,s){var n,r,l;if(!e||"object"!=typeof e)return null;const a=null==(l=null==(r=null==(n=t.config.plotOptions)?void 0:n.treemap)?void 0:r.colorScale)?void 0:l.colorValue;let o;if(o="function"==typeof a?a(e,{seriesIndex:i,dataPointIndex:s,w:t}):"string"==typeof a?e[a]:e.colorValue,null==o)return null;const c=Number(o);return Number.isFinite(c)?c:null}function rt(t){var e,i,s;const n=null==(s=null==(i=null==(e=t.config)?void 0:e.plotOptions)?void 0:i.treemap)?void 0:s.colorScale,r=n&&n.gradient;if(!r)return null;if(!1===r.enabled)return null;const l=t.config.series||[];let a=1/0,o=-1/0,c=!1;for(let e=0;e<l.length;e++){const i=l[e]&&l[e].data;if(Array.isArray(i))for(let s=0;s<i.length;s++){const n=nt(t,i[s],e,s);null!=n&&(c=!0,n<a&&(a=n),n>o&&(o=n))}}if(!c&&!0!==r.enabled)return null;Number.isFinite(a)||(a=0,o=0);let h=Number.isFinite(Number(r.min))?Number(r.min):a,u=Number.isFinite(Number(r.max))?Number(r.max):o,d=null;if(null===r.midpoint?d=null:Number.isFinite(Number(r.midpoint))?d=Number(r.midpoint):h<0&&u>0&&(d=0),null!=d&&!1!==r.symmetric&&!Number.isFinite(Number(r.min))&&!Number.isFinite(Number(r.max))){const t=Math.max(Math.abs(h-d),Math.abs(u-d));h=d-t,u=d+t}u===h&&(h-=.5,u+=.5);const p=function(t,e,i,s){if(Array.isArray(t.stops)&&t.stops.length>=2)return t.stops.filter(t=>t&&Number.isFinite(Number(t.value))).map(t=>({value:Number(t.value),color:st(t.color)})).sort((t,e)=>t.value-e.value);const n=(Array.isArray(t.colors)&&t.colors.length>=2?t.colors:Q).map(st),r=n.length;if(null!=s&&r>=3){const t=Math.floor((r-1)/2),l=[];for(let i=0;i<=t;i++)l.push({value:tt(e,s,i/t),color:n[i]});for(let e=t+1;e<r;e++)l.push({value:tt(s,i,(e-t)/(r-1-t)),color:n[e]});return l}return n.map((t,s)=>({value:tt(e,i,s/(r-1)),color:t}))}(r,h,u,d);if(p.length<2)return null;const f=u-h,m=p.map(t=>({percent:0===f?0:(t.value-h)/f,color:t.color}));return{min:h,max:u,midpoint:d,stops:p,at:t=>{if(!Number.isFinite(t))return p[Math.floor(p.length/2)].color;if(t<=p[0].value)return p[0].color;const e=p[p.length-1];if(t>=e.value)return e.color;for(let e=1;e<p.length;e++){const i=p[e];if(t<=i.value){const s=p[e-1],n=i.value-s.value,r=0===n?0:(t-s.value)/n;return it(s.color,i.color,r)}}return e.color},legendStops:m}}const lt=u.__apex_tooltip_Utils,at="http://www.w3.org/2000/svg";class ot{constructor(t,e){this.w=t,this.ctx=e,this.svgEl=null,this.arrowEl=null,this.hoverValueEl=null,this._min=0,this._max=0,this._geom=null,this._bandHitEls=[],this._activeBandIndex=-1,this._targetEl=null,this._onCellEnter=this._onCellEnter.bind(this),this._onCellLeave=this._onCellLeave.bind(this),this._onBandEnter=this._onBandEnter.bind(this),this._onBandLeave=this._onBandLeave.bind(this)}_getFormatter(){const t=this._cfg();return"function"==typeof t.formatter?t.formatter:t=>{if(!Number.isFinite(t))return String(t);const e=Math.abs(t);return e>=1e3?t.toFixed(0):e>=10?t.toFixed(1):t.toFixed(2)}}static colorScaleOf(t){var e,i,s,n,r;const l=null==(i=null==(e=null==t?void 0:t.config)?void 0:e.chart)?void 0:i.type;return l&&(null==(r=null==(n=null==(s=null==t?void 0:t.config)?void 0:s.plotOptions)?void 0:n[l])?void 0:r.colorScale)||null}static configFor(t){const e=ot.colorScaleOf(t);return e&&e.gradientLegend||null}_cfg(){return ot.configFor(this.w)||{}}static isEnabled(t){if(!ot.supports(t))return!1;const e=ot.configFor(t);return!(!e||!e.enabled)}static supports(t){var e,i;const s=null==(i=null==(e=null==t?void 0:t.config)?void 0:e.chart)?void 0:i.type;return"heatmap"===s||"treemap"===s}draw(t=null){var e,i,s,n,r,l,a,o;const c=this.w;this._targetEl=t;const h=t||c.dom.elLegendWrap;if(!h)return;const u=this._cfg(),d=c.config.legend.position,p="left"===d||"right"===d,m=null!=(i=null==(e=u.arrow)?void 0:e.size)?i:8,g=m+4,y=u.showLabels?28:4,x=u.showLabels?20:4,v=u.showLabels?44:0,b=this._resolveStripLength(p?u.height:u.width,p),_=u.thickness,w=p?Math.max(_+g+4,v):b+2*y,A=p?b+2*x:_+g+4,E=(w-(_+g))/2,M=p?"left"===d?E:E+g:y,S=p?x:"top"===d?g:4,k=f.createElementNS(at,"svg");k.setAttribute("class","apexcharts-heatmap-gradient-legend apexcharts-gradient-legend"),k.setAttribute("width",String(w)),k.setAttribute("height",String(A)),k.setAttribute("overflow","visible");const C=f.createElementNS(at,"defs"),L=`apexcharts-heatmap-gradient-${c.globals.cuid}`,F=f.createElementNS(at,"linearGradient");F.setAttribute("id",L),p?(F.setAttribute("x1","0"),F.setAttribute("y1","1"),F.setAttribute("x2","0"),F.setAttribute("y2","0")):(F.setAttribute("x1","0"),F.setAttribute("y1","0"),F.setAttribute("x2","1"),F.setAttribute("y2","0"));const{min:N,max:O,stops:H,bands:P}=this._computeStops();this._min=N,this._max=O,H.forEach(t=>{const e=f.createElementNS(at,"stop");e.setAttribute("offset",`${(100*t.percent).toFixed(2)}%`),e.setAttribute("stop-color",t.color),F.appendChild(e)}),C.appendChild(F),k.appendChild(C);const $=f.createElementNS(at,"rect");if($.setAttribute("x",String(M)),$.setAttribute("y",String(S)),$.setAttribute("width",String(p?_:b)),$.setAttribute("height",String(p?b:_)),$.setAttribute("rx","2"),$.setAttribute("fill",`url(#${L})`),k.appendChild($),u.showLabels){const t=(null==(s=u.labelStyle)?void 0:s.colors)||(Array.isArray(c.config.legend.labels.colors)?c.config.legend.labels.colors[0]:c.config.legend.labels.colors)||c.config.chart.foreColor,e=(null==(n=u.labelStyle)?void 0:n.fontSize)||"11px",i=(null==(r=u.labelStyle)?void 0:r.fontFamily)||c.config.chart.fontFamily,l=this._getFormatter(),a=(s,n,r,l)=>{const a=f.createElementNS(at,"text");return a.setAttribute("x",String(n)),a.setAttribute("y",String(r)),a.setAttribute("text-anchor",l),a.setAttribute("dominant-baseline","middle"),a.setAttribute("fill",t),a.setAttribute("font-size",e),i&&a.setAttribute("font-family",i),a.textContent=String(s),a};if(p){const t=M+_/2;k.appendChild(a(l(N),t,S+b+10,"middle")),k.appendChild(a(l(O),t,S-10,"middle"))}else{const t=S+_/2;k.appendChild(a(l(N),M-6,t,"end")),k.appendChild(a(l(O),M+b+6,t,"start"))}}const W=(null==(l=u.arrow)?void 0:l.color)||c.config.chart.foreColor,B=this._buildArrow(m,W,d);if(k.appendChild(B),this.arrowEl=B,this._bandHitEls=[],c.config.legend.onItemHover.highlightDataSeries&&P.length>0&&P.forEach(t=>{const e=f.createElementNS(at,"rect");if(p){const i=S+b-t.p2*b,s=S+b-t.p1*b;e.setAttribute("x",String(M)),e.setAttribute("y",String(i)),e.setAttribute("width",String(_)),e.setAttribute("height",String(Math.max(0,s-i)))}else e.setAttribute("x",String(M+t.p1*b)),e.setAttribute("y",String(S)),e.setAttribute("width",String(Math.max(0,(t.p2-t.p1)*b))),e.setAttribute("height",String(_));e.setAttribute("fill","transparent"),e.setAttribute("class","apexcharts-heatmap-gradient-band"),e.setAttribute("data:range-index",String(t.index)),e.style.cursor="pointer",k.appendChild(e),this._bandHitEls.push(e)}),this._geom={isVertical:p,position:d,stripX:M,stripY:S,stripLength:b,stripThickness:_,arrowSize:m,svgWidth:w,svgHeight:A},u.showHoverValue){const t=f.createElement("div");t.classList.add("apexcharts-heatmap-gradient-legend-value"),t.style.position="absolute",t.style.fontSize=(null==(a=u.labelStyle)?void 0:a.fontSize)||"11px",t.style.fontFamily=(null==(o=u.labelStyle)?void 0:o.fontFamily)||c.config.chart.fontFamily||"",t.style.color=c.config.chart.foreColor,t.style.background="rgba(0,0,0,0.65)",t.style.color="#fff",t.style.padding="2px 6px",t.style.borderRadius="3px",t.style.pointerEvents="none",t.style.whiteSpace="nowrap",t.style.opacity="0",t.style.transition="opacity 120ms ease",this.hoverValueEl=t}h.classList.add("apexcharts-heatmap-gradient-legend-wrap"),h.classList.add("apx-legend-position-"+d),h.appendChild(k),this.hoverValueEl&&h.appendChild(this.hoverValueEl),this.svgEl=k,t?(h.style.width=w+"px",h.style.height=A+"px",h.style.position="relative",h.style.overflow="visible"):this._applyWrapAlignment(h,d,p,w,A),this._attachHoverListeners(),this._attachBandHoverListeners()}_resolveStripLength(t,e){const i=this.w,s=e?i.globals.svgHeight||i.config.chart.height||300:i.globals.svgWidth||i.config.chart.width||600;if("string"==typeof t){const e=t.trim();if(e.endsWith("%")){const t=parseFloat(e)||0;return Math.max(20,s*t/100)}const i=parseFloat(e);return Number.isFinite(i)?i:200}return"number"==typeof t&&Number.isFinite(t)?t:200}_applyWrapAlignment(t,e,i,s,n){const r=this.w,l=this._cfg().align||"center",a=12,o=r.globals.svgWidth||r.config.chart.width||600,c=r.globals.svgHeight||r.config.chart.height||300,h=r.config.legend.offsetX||0,u=r.config.legend.offsetY||0;if(t.style.position="absolute",t.style.display="block",t.style.overflow="visible",t.style.padding="0",t.style.width=s+"px",t.style.height=n+"px",t.style.right="auto",t.style.bottom="auto",i){const i=c-n-24;let r;r="start"===l?a:"end"===l?a+Math.max(0,i):a+Math.max(0,i)/2,t.style.top=r+u+"px",t.style.left="left"===e?a+h+"px":o-s-a+h+"px"}else{const i=o-s-24;let r;r="start"===l?a:"end"===l?a+Math.max(0,i):a+Math.max(0,i)/2,t.style.left=r+h+"px",t.style.top="top"===e?a+u+"px":c-n-a+u+"px"}}repositionToPlot(){var t,e;if(!p.isBrowser())return;if(this._targetEl)return;const i=this.w,s=i.globals,n=i.dom.elLegendWrap;if(!n||!this._geom)return;if(!Number.isFinite(s.gridWidth)||!Number.isFinite(s.gridHeight))return;const{isVertical:r,position:l,svgWidth:a,svgHeight:o,stripX:c,stripY:h,stripThickness:u}=this._geom,d=this._cfg().align||"center",m=i.config.legend.offsetX||0,g=i.config.legend.offsetY||0,y=null==(e=null==(t=this.ctx)?void 0:t.dimensions)?void 0:e.dimHelpers,x=y?y.getTitleSubtitleCoords("title").height+y.getTitleSubtitleCoords("subtitle").height:0,v=i.layout.xAxisHeight||0,b=(t,e)=>{const i=Math.max(0,t-e);return"start"===d?0:"end"===d?i:i/2};if(r){n.style.top=s.translateY+b(s.gridHeight,o)+g+"px";const t=(("left"===l?0:s.translateX+s.gridWidth)+("left"===l?s.translateX:s.svgWidth))/2;n.style.left=t-c-u/2+m+"px"}else{n.style.left=s.translateX+b(s.gridWidth,a)+m+"px";const t=(("top"===l?x:s.translateY+s.gridHeight+v)+("top"===l?s.translateY:s.svgHeight))/2;n.style.top=t-h-u/2+g+"px"}f.requestAnimationFrame(()=>this._enforceMinPlotGap())}_enforceMinPlotGap(){const t=this.w,e=t.dom.elLegendWrap,i=this.svgEl&&this.svgEl.querySelector("rect");if(!e||!i||!this._geom)return;if(!t.dom.baseEl||!t.dom.baseEl.querySelector(".apexcharts-svg"))return;const s=i.getBoundingClientRect(),n=lt.plotRect(t);if(!(s.width&&s.height&&n.width&&n.height))return;const r=n.left,l=n.left+n.width,a=n.top,o=n.top+n.height,c=n.zoom,{isVertical:h,position:u}=this._geom;if(h){const t=("left"===u?r-s.right:s.left-l)/c;if(t<16){const i=parseFloat(e.style.left)||0,s=16-t;e.style.left=i+("left"===u?-s:s)+"px"}}else{const t=("top"===u?a-s.bottom:s.top-o)/c;if(t<16){const i=parseFloat(e.style.top)||0,s=16-t;e.style.top=i+("top"===u?-s:s)+"px"}}}destroy(){var t,e,i,s,n,r,l;for(let i=0;i<this._bandHitEls.length;i++){const s=this._bandHitEls[i];null==(t=s.removeEventListener)||t.call(s,"mousemove",this._onBandEnter),null==(e=s.removeEventListener)||e.call(s,"mouseout",this._onBandLeave)}if(this._bandHitEls=[],this._activeBandIndex=-1,null==(i=this.ctx)?void 0:i.events)try{null==(n=(s=this.ctx.events).removeEventListener)||n.call(s,"dataPointMouseEnter",this._onCellEnter),null==(l=(r=this.ctx.events).removeEventListener)||l.call(r,"dataPointMouseLeave",this._onCellLeave)}catch(t){}}_attachBandHoverListeners(){if(p.isBrowser())for(let t=0;t<this._bandHitEls.length;t++){const e=this._bandHitEls[t];e.addEventListener("mousemove",this._onBandEnter),e.addEventListener("mouseout",this._onBandLeave)}}_onBandEnter(t){var e,i,s,n;const r=this.w,l=t.currentTarget,a=parseInt(null!=(e=l.getAttribute("data:range-index"))?e:"-1",10);a<0||a===this._activeBandIndex||(this._activeBandIndex=a,null==(n=null==(s=null==(i=this.ctx)?void 0:i.events)?void 0:s.fireEvent)||n.call(s,"legendHover",[this.ctx,a,r]),new J(r).highlightRangeInSeries(a,"highlight"))}_onBandLeave(){if(this._activeBandIndex<0)return;const t=this._activeBandIndex;this._activeBandIndex=-1,new J(this.w).highlightRangeInSeries(t,"reset")}_attachHoverListeners(){var t,e;p.isBrowser()&&(null==(e=null==(t=this.ctx)?void 0:t.events)?void 0:e.addEventListener)&&(this.ctx.events.addEventListener("dataPointMouseEnter",this._onCellEnter),this.ctx.events.addEventListener("dataPointMouseLeave",this._onCellLeave))}_onCellEnter(...t){var e,i,s;const n=this.w;if(!this.arrowEl)return;const r=t[t.length-1];if(!r||"object"!=typeof r)return;const l=r.seriesIndex,a=r.dataPointIndex;if("number"!=typeof l||"number"!=typeof a)return;if(!ot.supports(n))return;let o;o=this._continuous?function(t,e,i){const s=t.config.series[e];return nt(t,s&&Array.isArray(s.data)?s.data[i]:null,e,i)}(n,l,a):null==(s=null==(i=null==(e=n.seriesData)?void 0:e.series)?void 0:i[l])?void 0:s[a],null==o||Number.isNaN(o)||this._positionArrow(o)}_onCellLeave(){this.arrowEl&&(this.arrowEl.setAttribute("opacity","0"),this.hoverValueEl&&(this.hoverValueEl.style.opacity="0"))}_positionArrow(t){if(!this.arrowEl||!this._geom)return;const{isVertical:e,position:i,stripX:s,stripY:n,stripLength:r,stripThickness:l,arrowSize:a}=this._geom,o=this._min,c=this._max-o;let h;if(h=0===c?.5:(t-o)/c,h<0&&(h=0),h>1&&(h=1),e){const t=n+r-h*r;let e,o;"left"===i?(e=s+l,o=e+a):(e=s,o=e-a);const c=[`${e},${t}`,`${o},${t-a/2}`,`${o},${t+a/2}`].join(" ");this.arrowEl.setAttribute("points",c)}else{const t=s+h*r;let e,o;"top"===i?(e=n+l,o=e+a):(e=n,o=e-a);const c=[`${t},${e}`,`${t-a/2},${o}`,`${t+a/2},${o}`].join(" ");this.arrowEl.setAttribute("points",c)}if(this.arrowEl.setAttribute("opacity","1"),this.hoverValueEl){const o=this._getFormatter();if(this.hoverValueEl.textContent=o(t),e){const t=n+r-h*r;"left"===i?this.hoverValueEl.style.left=`${s+l+a+8}px`:(this.hoverValueEl.style.left=s-a-8+"px",this.hoverValueEl.style.transform="translateX(-100%)"),this.hoverValueEl.style.top=t-9+"px"}else{const t=s+h*r;this.hoverValueEl.style.left=`${t}px`,this.hoverValueEl.style.transform="translateX(-50%)",this.hoverValueEl.style.top="top"===i?`${n+l+a+8}px`:n-a-18+"px"}this.hoverValueEl.style.opacity="1"}}_buildArrow(t,e,i){const s=f.createElementNS(at,"polygon");return s.setAttribute("fill",e),s.setAttribute("opacity","0"),s.setAttribute("class","apexcharts-heatmap-gradient-arrow"),s.setAttribute("points","0,0 0,0 0,0"),s.setAttribute("pointer-events","none"),s}_computeStops(){var t,e;const i=this.w,s=ot.colorScaleOf(i)||{},n=this._cfg(),r=rt(i);if(r)return this._continuous=!0,{min:r.min,max:r.max,stops:r.legendStops,bands:[]};this._continuous=!1;let l=1/0,c=-1/0;const h=(null==(t=i.seriesData)?void 0:t.series)||[];for(let t=0;t<h.length;t++){const e=h[t];if(e)for(let t=0;t<e.length;t++){const i=e[t];null==i||Number.isNaN(i)||(i<l&&(l=i),i>c&&(c=i))}}Number.isFinite(l)||(l=0),Number.isFinite(c)||(c=0);let u=l,p=c;void 0!==s.min&&void 0!==s.max&&s.max>s.min?(u=s.min,p=s.max):(void 0!==s.min&&(u=s.min<l?s.min:l),void 0!==s.max&&(p=s.max>c?s.max:c));const f=[],m=[];if(s.ranges&&s.ranges.length>0){const t=s.ranges.map((t,e)=>o(a({},t),{_originalIndex:e})).sort((t,e)=>t.from-e.from),e=t[0].from,i=t[t.length-1].to;u=e,p=i;const n=i-e||1;t.forEach(t=>{const i=(t.from-e)/n,s=(t.to-e)/n;f.push({percent:(i+s)/2,color:t.color}),m.push({index:t._originalIndex,p1:i,p2:s})})}else{const t=i.globals.colors[0]||"#008FFB",s=new d,r=i.config.plotOptions[i.config.chart.type]||{},l=null!=(e=r.shadeIntensity)?e:.5,a=i.globals.hasNegs,o=Math.max(2,n.stops||16);for(let e=0;e<o;e++){const n=e/(o-1),c=u+n*(p-u),h=Math.abs(p)+Math.abs(u),d=0===h?0:100*c/h;let m;m=a?r.reverseNegativeShade?d<0?d/100*(1.25*l):1.25*l*(1-d/100):d<=0?1-(1+d/100)*l:(1-d/100)*l:1-d/100,m>1&&(m=1),m<-1&&(m=-1);const g=r.enableShades?s.shadeColor("dark"===i.config.theme.mode?-1*m:m,t):t;f.push({percent:n,color:g})}}return{min:u,max:p,stops:f,bands:m}}}const ct={zoom:'<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8"><circle cx="10.5" cy="10.5" r="6"/><path d="M15 15l5 5"/><path d="M8 10.5h5M10.5 8v5"/></svg>',pan:'<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8"><path d="M12 3v18M3 12h18"/><path d="M9 6l3-3 3 3M9 18l3 3 3-3M6 9l-3 3 3 3M18 9l3 3-3 3"/></svg>',reset:'<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8"><path d="M4 10a8 8 0 1 1 2 6"/><path d="M4 4v6h6"/></svg>',download:'<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8"><path d="M12 4v11"/><path d="M7 11l5 5 5-5"/><path d="M4 20h16"/></svg>'};class ht{constructor(t){this.trellis=t,this.elLegend=null,this.elToolbar=null,this.elTitle=null,this.elBreadcrumb=null,this.gradientLegend=null,this._gradPending=null}buildHeader(t,e,i){const s=this.trellis,n=s.cfg.header||{};if(!1===n.show)return;const r=f.createElement("div");r.className="apexcharts-trellis-header";let l=e;"function"==typeof n.formatter&&(l=n.formatter(e,{dimension:"string"==typeof s.cfg.by?s.cfg.by:void 0,index:i.index,count:i.count})),r.textContent=null==l?"":String(l);const a=n.style||{};if(a.fontSize&&(r.style.fontSize=a.fontSize),a.fontWeight&&(r.style.fontWeight=String(a.fontWeight)),a.color&&(r.style.color=a.color),!1!==s.cfg.promote){r.classList.add("apexcharts-trellis-header-clickable"),r.setAttribute("role","button"),r.setAttribute("tabindex","0"),r.setAttribute("title","Expand this panel");const t=()=>{s._promotedKey===e?s.restorePromotion():s.promote(e)};r.addEventListener("click",t),r.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),t())})}t.appendChild(r)}stripEl(t,e,i){const s=this.trellis.cfg.header||{},n=f.createElement("div");n.className=`apexcharts-trellis-strip apexcharts-trellis-strip-${t}`;let r=e;"function"==typeof s.formatter&&(r=s.formatter(e,{dimension:t,index:i.index,count:i.count})),n.textContent=null==r?"":String(r);const l=s.style||{};return l.fontSize&&(n.style.fontSize=l.fontSize),l.fontWeight&&(n.style.fontWeight=String(l.fontWeight)),l.color&&(n.style.color=l.color),n}buildBreadcrumb(t,e,i){this.removeBreadcrumb();const s=f.createElement("div");s.className="apexcharts-trellis-breadcrumb";const n=f.createElement("button");n.setAttribute("type","button"),n.className="apexcharts-trellis-breadcrumb-back",n.textContent="All panels",n.addEventListener("click",i);const r=f.createElement("span");r.className="apexcharts-trellis-breadcrumb-sep",r.textContent="/";const l=f.createElement("span");l.className="apexcharts-trellis-breadcrumb-current",l.textContent=e,s.appendChild(n),s.appendChild(r),s.appendChild(l),t.appendChild(s),this.elBreadcrumb=s}removeBreadcrumb(){this.elBreadcrumb&&this.elBreadcrumb.parentNode&&this.elBreadcrumb.parentNode.removeChild(this.elBreadcrumb),this.elBreadcrumb=null}buildTitle(t){const e=this.trellis.w.config.title;if(!e||!e.text)return;const i=f.createElement("div");i.className="apexcharts-trellis-title",i.textContent=e.text;const s=e.style||{};s.fontSize&&(i.style.fontSize=s.fontSize),s.color&&(i.style.color=s.color),t.appendChild(i),this.elTitle=i}buildLegend(t){const e=this.trellis;if("shared"!==(e.cfg.legend||"shared"))return;if("heatmap"===e.w.config.chart.type)return void this.buildGradientLegend(t);const i=e.split?e.split.seriesNames:[];if(i.length<2)return;const s=f.createElement("div");s.className="apexcharts-trellis-legend apexcharts-legend",s.setAttribute("role","list"),i.forEach(t=>{const i=f.createElement("div");i.className="apexcharts-legend-series apexcharts-trellis-legend-item",i.setAttribute("role","listitem"),i.setAttribute("tabindex","0"),i.setAttribute("data:collapsed","false");const n=f.createElement("span");n.className="apexcharts-legend-marker",n.style.background=e.scales?e.scales.colorOf(t):"#008FFB";const r=f.createElement("span");r.className="apexcharts-legend-text",r.textContent=t,i.appendChild(n),i.appendChild(r);const l=()=>{const s=e.sync.toggleSeries(t);i.classList.toggle("apexcharts-inactive-legend",s),i.setAttribute("data:collapsed",String(s))};i.addEventListener("click",l),i.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),l())}),s.appendChild(i)}),t.appendChild(s),this.elLegend=s}refreshLegendColors(){const t=this.trellis,e=this.elLegend,i=t.scales;if(!e||!i)return;e.querySelectorAll(".apexcharts-trellis-legend-item").forEach(t=>{var e;const s=null==(e=t.querySelector(".apexcharts-legend-text"))?void 0:e.textContent,n=t.querySelector(".apexcharts-legend-marker");s&&n&&(n.style.background=i.colorOf(s))})}buildGradientLegend(t){const e=this.trellis,i=e.panels.find(t=>t.chart);if(!i){if(this._gradPending)return;const i=()=>{var s,n;this._gradPending=null,null==(n=(s=e.ctx.events).removeEventListener)||n.call(s,"panelMounted",i),this.buildGradientLegend(t)};return this._gradPending=i,void e.ctx.events.addEventListener("panelMounted",i)}const s=f.createElement("div");s.className="apexcharts-trellis-legend apexcharts-trellis-gradient-legend",t.appendChild(s),this.elLegend=s;const n=i.chart,r=new ot(n.w,n.ctx);r.draw(s),this.gradientLegend=r,e.panels.forEach(t=>{var e;if(!t.chart||t===i)return;const s=null==(e=t.chart.ctx)?void 0:e.events;(null==s?void 0:s.addEventListener)&&(s.addEventListener("dataPointMouseEnter",r._onCellEnter),s.addEventListener("dataPointMouseLeave",r._onCellLeave))})}destroyGradientLegend(){var t,e;const i=this.trellis;if(this._gradPending&&(null==(e=(t=i.ctx.events).removeEventListener)||e.call(t,"panelMounted",this._gradPending),this._gradPending=null),this.gradientLegend){try{this.gradientLegend.destroy()}catch(t){}this.gradientLegend=null}}buildToolbar(t){const e=this.trellis;if("shared"!==(e.cfg.toolbar||"shared"))return;const i=f.createElement("div");i.className="apexcharts-trellis-toolbar";const s={},n=t=>{e.panels.forEach(e=>{if(!e.chart)return;const i=e.chart.w.interact;i.zoomEnabled="zoom"===t,i.panEnabled="pan"===t,i.selectionEnabled=!1}),s.zoom.classList.toggle("apexcharts-selected","zoom"===t),s.pan.classList.toggle("apexcharts-selected","pan"===t),s.zoom.setAttribute("aria-pressed",String("zoom"===t)),s.pan.setAttribute("aria-pressed",String("pan"===t))},r=(t,e,n)=>{const r=f.createElement("button");return r.className=`apexcharts-trellis-tool apexcharts-trellis-tool-${t}`,r.setAttribute("type","button"),r.setAttribute("aria-label",e),r.setAttribute("title",e),r.innerHTML=ct[t],r.addEventListener("click",n),s[t]=r,i.appendChild(r),r};if(r("zoom","Selection zoom",()=>n("zoom")),r("pan","Pan",()=>n("pan")),r("reset","Reset zoom",()=>{e.sync.resetAll()}),e.ctx.exports){const t=f.createElement("div");t.className="apexcharts-trellis-menu",[["png","Download PNG"],["svg","Download SVG"],["csv","Download CSV"]].forEach(([i,s])=>{const n=f.createElement("button");n.setAttribute("type","button"),n.className="apexcharts-trellis-menu-item",n.textContent=s,n.addEventListener("click",()=>{t.classList.remove("apexcharts-trellis-menu-open"),e.exports.download(i)}),t.appendChild(n)}),r("download","Download",()=>{t.classList.toggle("apexcharts-trellis-menu-open")}),i.appendChild(t)}s.zoom.classList.add("apexcharts-selected"),s.zoom.setAttribute("aria-pressed","true"),s.pan.setAttribute("aria-pressed","false"),t.appendChild(i),this.elToolbar=i,t.classList.add("apexcharts-trellis-has-toolbar")}}function ut(t,e){const i=d.clone(t.w.config.yaxis);return(Array.isArray(i)?i:[i]).map(t=>d.extend(t,e))}class dt{constructor(t){this.trellis=t,this._syncing=!1,this._hidden=new Set,this.currentWindow=null}_noteWindow(t,e){const i=t&&t.xaxis;i&&null!=i.min&&null!=i.max?this.currentWindow={x:{min:i.min,max:i.max},y:this.currentWindow&&this.currentWindow.y||null,zoomed:e||!(!this.currentWindow||!this.currentWindow.zoomed)}:e&&(this.currentWindow=null)}makeZoomedHandler(t){return(e,i)=>{"function"==typeof t&&t(e,i),this._noteWindow(i,!0),this.onZoomed(i)}}makeScrolledHandler(t){return(e,i)=>{"function"==typeof t&&t(e,i),this._noteWindow(i,!1)}}onZoomed(t){const e=this.trellis;if(this._syncing)return;const i=e.cfg;if(!i||"shared"!==(i.scales.y||"shared"))return;if(!e.autoScaleYaxis)return;const s=t&&t.xaxis;if(!s||null==s.min||null==s.max)return;if(!e.split||!e.split.xIsNumeric)return;const n=function(t,e,i,s,n=!1){const r={min:1/0,max:-1/0};return t.forEach(t=>t.series.forEach(t=>{Array.isArray(t.data)&&t.data.forEach((l,a)=>{if(null==l)return;const o="paired"===e?l[0]:"object"===e?l.x:null,c=o instanceof Date?o.getTime():Number(o);if(!isFinite(c)||c<i||c>s)return;q(l,e,r);const h=n?Y(t,l,a):null;null!==h&&q(h,"plain",r)})})),isFinite(r.min)&&isFinite(r.max)?r:null}(e.split.panels,e.split.xForm,s.min,s.max,e._stackingHost().parts);if(!n)return;const r=X(n.min,n.max,i.targetTicks||3);this.currentWindow&&(this.currentWindow.y={min:r.min,max:r.max,tickAmount:r.tickAmount}),this._syncing=!0;const l=e.panels.map(t=>t.chart?t.chart.updateOptions({yaxis:ut(t.chart,{min:r.min,max:r.max,tickAmount:r.tickAmount})},!1,!1,!1).catch(()=>{}):Promise.resolve());Promise.all(l).finally(()=>{this._syncing=!1})}resetAll(){const t=this.trellis;this.currentWindow=null;const e=t.scales&&t.scales.x?{min:t.scales.x.min,max:t.scales.x.max}:{min:void 0,max:void 0};this._syncing=!0;const i=t.panels.map(i=>{if(!i.chart)return Promise.resolve();i.chart.w.interact.zoomed=!1;const s={xaxis:e},n=t.split?t._yBoundsFor(t.split.panels[i.index]):null;return n&&(s.yaxis=ut(i.chart,{min:n.min,max:n.max,tickAmount:n.tickAmount})),i.chart.updateOptions(s,!1,!1,!1).catch(()=>{})});return Promise.all(i).finally(()=>{this._syncing=!1})}toggleSeries(t){const e=!this._hidden.has(t);return e?this._hidden.add(t):this._hidden.delete(t),this.trellis.panels.forEach(i=>{const s=i.chart;if(!s)return;if(-1!==(s.w.seriesData.seriesNames||[]).indexOf(t))try{e?s.hideSeries(t):s.showSeries(t)}catch(t){}}),e}isHidden(t){return this._hidden.has(t)}applyHiddenTo(t){if(!this._hidden.size||!t)return;const e=t.w.seriesData&&t.w.seriesData.seriesNames||[];this._hidden.forEach(i=>{if(-1!==e.indexOf(i))try{t.hideSeries(i)}catch(t){}})}wireCrosshairs(t){let e=0,i=null;const s=()=>{const t=i&&i.closest?i.closest(".apexcharts-trellis-cell"):null,e=t?t.querySelector(".apexcharts-xcrosshairs"):null,s=e&&e.classList.contains("apexcharts-active");this.trellis.panels.forEach(i=>{if(!i.cellEl||i.cellEl===t)return;const n=i.cellEl.querySelector(".apexcharts-xcrosshairs");n&&(s?(n.setAttribute("x",e.getAttribute("x")||"0"),n.setAttribute("x1",e.getAttribute("x1")||"0"),n.setAttribute("x2",e.getAttribute("x2")||"0"),n.classList.add("apexcharts-active")):n.classList.remove("apexcharts-active"))})},n=()=>{s(),e=i?requestAnimationFrame(n):0};t.addEventListener("mousemove",t=>{i=t.target,e||(e=requestAnimationFrame(n))},{passive:!0}),t.addEventListener("mouseleave",()=>{i=null,e&&(cancelAnimationFrame(e),e=0),this.trellis.panels.forEach(t=>{const e=t.cellEl&&t.cellEl.querySelector(".apexcharts-xcrosshairs");e&&e.classList.remove("apexcharts-active")})},{passive:!0})}}function pt(t,e){const i=null!=t,s=null!=e;return i||s?{min:i?t:null,max:s?e:null}:null}function ft(t,e){return"function"==typeof t&&e?t===e.addXaxisAnnotation?"xaxis":t===e.addYaxisAnnotation?"yaxis":t===e.addPointAnnotation?"point":null:null}function mt(t,e){const i=t.config.annotations?d.clone(t.config.annotations):null,s=[],n=t.globals.memory&&t.globals.memory.methodsToExec||[];for(const t of n){if(!t||"addAnnotation"!==t.label)continue;const i=ft(t.method,e);i&&s.push({kind:i,params:d.clone(t.params)})}return{static:i,dynamic:s}}function gt(t){const e=t&&t.measure;if(!e||"function"!=typeof e.getPins)return null;const i=e.getPins();return Array.isArray(i)&&i.length?{pins:i}:null}class yt{constructor(t){this.trellis=t,this.active=!1,this._io=null,this._byCell=new Map,this._dirty=new Set,this._raf=null,this._draining=!1,this._gutterFloor=0}static supported(){return"undefined"!=typeof IntersectionObserver}_rootMargin(){const t=this.trellis.layout,e=t?Math.max(0,Math.round(t.panelH+t.headerH+t.gap)):300;return`${e}px 0px ${e}px 0px`}start(){yt.supported()&&(this.active=!0,this._io=new IntersectionObserver(t=>this._onEntries(t),{root:null,rootMargin:this._rootMargin(),threshold:0}),this.trellis.panels.forEach(t=>{var e;t.wantMounted=!1,t.cellEl&&(this._byCell.set(t.cellEl,t),null==(e=this._io)||e.observe(t.cellEl))}))}refresh(){this.active&&this._io&&(this._io.disconnect(),this._io=new IntersectionObserver(t=>this._onEntries(t),{root:null,rootMargin:this._rootMargin(),threshold:0}),this._byCell.forEach((t,e)=>{var i;return null==(i=this._io)?void 0:i.observe(e)}))}_onEntries(t){if(this.active){for(const e of t){const t=this._byCell.get(e.target);t&&(t.wantMounted=e.isIntersecting,this._dirty.add(t))}this._schedule()}}_schedule(){var t;this._raf||this._draining||!this.active||(this._raf=(t=()=>{this._raf=null,this._drain()},"function"==typeof requestAnimationFrame?{kind:"raf",id:requestAnimationFrame(t)}:{kind:"timeout",id:setTimeout(()=>t(0),16)}))}_drain(){return c(this,null,function*(){if(!this._draining&&this.active){this._draining=!0;try{let t=0,e=0;for(;this.active&&this._dirty.size&&t<2&&e<6;){const i=this._dirty.values().next().value;this._dirty.delete(i);const s=!!i.wantMounted;s!==!!i.chart&&(e++,s?(t++,yield this._mount(i)):this._unmount(i))}}finally{this._draining=!1,this.active&&this._dirty.size?this._schedule():this.active&&(this.trellis.w.globals.animationEnded=!0)}}})}_liveWindow(t){const e=this.trellis.panels.find(e=>e!==t&&e.chart);if(!e||!e.chart)return null;const i=e.chart.w,s=i.config.xaxis||{},n=Array.isArray(i.config.yaxis)?i.config.yaxis[0]:i.config.yaxis;return{zoomed:!!i.interact.zoomed,x:null!=s.min||null!=s.max?{min:s.min,max:s.max}:null,y:!n||null==n.min&&null==n.max?null:{min:n.min,max:n.max,tickAmount:n.tickAmount}}}_patchYaxis(t,e){const i=Array.isArray(t.yaxis)?t.yaxis:t.yaxis?[t.yaxis]:[{}];i.forEach(t=>{Object.keys(e).forEach(i=>{"labels"===i?t.labels=a(a({},t.labels||{}),e.labels):t[i]=e[i]})}),t.yaxis=i}_mount(t){return c(this,null,function*(){var e,i,s,n,r,l,c,h;const u=this.trellis;if(!t.el||t.chart||t.noMount)return;const d=t.viewStash,p="shared"===u._yMode(),f=!p,m=u._assemblePanelOptions(t.index,{noAnimation:!!d}),g=d&&d.window;g&&g.xaxis&&(m.xaxis=o(a({},m.xaxis||{}),{min:null!=(e=g.xaxis.min)?e:void 0,max:null!=(i=g.xaxis.max)?i:void 0})),f&&g&&Array.isArray(g.yaxis)&&g.yaxis[0]&&this._patchYaxis(m,{min:null!=(s=g.yaxis[0].min)?s:void 0,max:null!=(n=g.yaxis[0].max)?n:void 0});const y=this._liveWindow(t);y&&y.x&&(m.xaxis=o(a({},m.xaxis||{}),{min:y.x.min,max:y.x.max})),y&&y.y&&p&&this._patchYaxis(m,a({min:y.y.min,max:y.y.max},null!=y.y.tickAmount?{tickAmount:y.y.tickAmount}:{}));const x=u.sync.currentWindow;x&&x.x&&(m.xaxis=o(a({},m.xaxis||{}),{min:x.x.min,max:x.x.max})),x&&x.y&&p&&this._patchYaxis(m,a({min:x.y.min,max:x.y.max},null!=x.y.tickAmount?{tickAmount:x.y.tickAmount}:{})),f&&this._gutterFloor>0&&this._patchYaxis(m,{labels:{minWidth:this._gutterFloor}}),t.el.classList.remove("apexcharts-trellis-skeleton");const v=new u._ApexCharts(t.el,m);t.chart=v;try{yield v.render()}catch(e){return t.chart=null,void t.el.classList.add("apexcharts-trellis-skeleton")}if(this.active){if(v.w.interact.zoomed=x?!!x.zoomed:y?y.zoomed:!(!d||!d.zoomed),u.sync.applyHiddenTo(v),d&&d.annotations&&Array.isArray(d.annotations.dynamic)){const t={xaxis:"addXaxisAnnotation",yaxis:"addYaxisAnnotation",point:"addPointAnnotation"},e=v;d.annotations.dynamic.forEach(i=>{const s=t[i.kind];s&&"function"==typeof e[s]&&e[s](i.params,!0)})}if(t.viewStash=null,f){const t=null==(h=null==(c=null==(l=null==(r=v.w)?void 0:r.globals)?void 0:l.yLabelsCoords)?void 0:c[0])?void 0:h.width;if("number"==typeof t&&isFinite(t)){const e=v.w.globals.isBarHorizontal?0:u._yLabelPad(),i=Math.max(0,t-e);i>this._gutterFloor+.5&&(this._gutterFloor=i,yield u._pushGutterFloor(this._gutterFloor))}}u._fire("panelMounted",{key:t.key,index:t.index,chart:v,remounted:!!d})}})}_unmount(t){if(t.chart){try{t.viewStash=function(t,e){var i,s;const n=t.config.xaxis||{},r=(Array.isArray(t.config.yaxis)?t.config.yaxis:t.config.yaxis?[t.config.yaxis]:[]).map(t=>pt(t&&t.min,t&&t.max)),l=r.some(t=>null!==t),a=t.config.theme,o=e&&e.drilldown;return{v:1,window:{xaxis:pt(n.min,n.max),yaxis:l?r:null},zoomed:!!t.interact.zoomed,collapsed:(t.globals.collapsedSeriesIndices||[]).slice(),ancillaryCollapsed:(t.globals.ancillaryCollapsedSeriesIndices||[]).slice(),selectedDataPoints:(c=t.interact.selectedDataPoints,Array.isArray(c)?c.map(t=>Array.isArray(t)?t.slice():t):[]),theme:a?{mode:null!=(i=a.mode)?i:null,palette:null!=(s=a.palette)?s:null}:null,locale:t.config.chart&&t.config.chart.defaultLocale||null,annotations:mt(t,e),drill:o&&o.depth>0?{path:o.path.slice()}:null,measure:gt(e)};var c}(t.chart.w,t.chart)}catch(e){t.viewStash=null}try{t.chart.destroy()}catch(t){}if(t.chart=null,t.el){t.el.classList.add("apexcharts-trellis-skeleton");const e=this.trellis.layout;e&&(t.el.style.minHeight=`${e.panelH}px`)}}}stop(){var t;this.active=!1,this._io&&(this._io.disconnect(),this._io=null),this._byCell.clear(),this._dirty.clear(),(t=this._raf)&&("raf"===t.kind?cancelAnimationFrame(t.id):clearTimeout(t.id)),this._raf=null,this._gutterFloor=0}}class xt{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)/xt.xRatio(t)}static pxToDataX(t,e){return t.globals.minX+e*xt.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(),r=t.globals.svgWidth?n.width/t.globals.svgWidth:1;return(e-n.left)/(r||1)-t.layout.translateX}}const vt=["bar","column","rangeBar","candlestick","boxPlot","violin"];class bt{constructor(t){this.trellis=t,this.el=null,this._raf=0,this._lastEvent=null}wire(t,e){const i=f.createElement("div");i.className="apexcharts-trellis-tooltip apexcharts-theme-light",i.setAttribute("role","status"),e.appendChild(i),this.el=i;const s=()=>{this._update(e),this._raf=this._lastEvent?requestAnimationFrame(s):0};t.addEventListener("mousemove",t=>{this._lastEvent=t,this._raf||(this._raf=requestAnimationFrame(s))},{passive:!0}),t.addEventListener("mouseleave",()=>{this._lastEvent=null,this._raf&&(cancelAnimationFrame(this._raf),this._raf=0),i.classList.remove("apexcharts-trellis-tooltip-active")},{passive:!0})}_hoverIndex(t,e,i){const s=t.w,n=s.globals.dataPoints;if(!n||n<1)return-1;const r=s.layout.gridWidth;if(!r)return-1;const l=xt.screenXToPlotPx(s,e),a=s.globals.barPadForNumericAxis||0;if(l<-a||l>r+a)return-1;const o=s.dom&&s.dom.baseEl;if(o&&o.querySelector(".apexcharts-svg")){const t=lt.plotRect(s);if(t.height&&(i<t.top||i>t.top+t.height))return-1}const c=(-1!==vt.indexOf(s.config.chart.type)||"between"===s.config.xaxis.tickPlacement)&&!s.config.xaxis.convertedCatToNumeric?Math.ceil(l/(r/n))-1:Math.round(l/(r/Math.max(1,n-1)));return Math.max(0,Math.min(n-1,c))}_valueAt(t,e,i,s){var n,r;const l=t.series.find(t=>t.name===e);if(!l||!Array.isArray(l.data))return null;const a=l.data[s];if(null==a)return null;let o=a;if(Array.isArray(a)?o=a[1]:"object"==typeof a&&(o=a.y),null==o)return null;const c=this.trellis.w.config,h=Array.isArray(null==(n=c.tooltip)?void 0:n.y)?c.tooltip.y[i]:null==(r=c.tooltip)?void 0:r.y,u=Array.isArray(c.yaxis)?c.yaxis[0]:c.yaxis,d=h&&"function"==typeof h.formatter&&h.formatter||u&&u.labels&&"function"==typeof u.labels.formatter&&u.labels.formatter||null,p=t=>{if(d)try{return String(d(t,{seriesIndex:i,dataPointIndex:s,w:null}))}catch(e){return String(t)}return String(t)};return Array.isArray(o)?o.map(p).join(" / "):p(o)}_update(t){const e=this.trellis,i=this.el,s=this._lastEvent;if(!i||!s||!e.split)return;const n=s.target&&s.target.closest?s.target.closest(".apexcharts-trellis-cell"):null,r=n?e.panels.find(t=>t.cellEl===n):void 0,l=r&&r.chart?this._hoverIndex(r.chart,s.clientX,s.clientY):-1;if(!r||-1===l)return void i.classList.remove("apexcharts-trellis-tooltip-active");const a=n?n.querySelector(".apexcharts-tooltip-title"):null,o=a&&a.textContent?a.textContent:"",c=e.split.seriesNames,h=e.scales,u=[];e.split.panels.forEach(t=>{const e=[];c.forEach((i,s)=>{const n=this._valueAt(t,i,s,l);if(null===n)return;const r=h?h.colorOf(i):"#008FFB";e.push(`<span class="apexcharts-trellis-tooltip-val"><span class="apexcharts-trellis-tooltip-marker" style="background:${wt(r)}"></span>${_t(n)}</span>`)});const i=t.key===r.key;u.push(`<div class="apexcharts-trellis-tooltip-row${i?" apexcharts-trellis-tooltip-row-active":""}" data-key="${wt(t.key)}"><span class="apexcharts-trellis-tooltip-key">${_t(t.key)}</span><span class="apexcharts-trellis-tooltip-vals">${e.join("")}</span></div>`)});let d="";o&&(d+=`<div class="apexcharts-tooltip-title">${_t(o)}</div>`),d+=u.join(""),i.innerHTML=d,i.classList.add("apexcharts-trellis-tooltip-active");const p=t.getBoundingClientRect(),f=lt.plotRect(r.chart.w).zoom;let m=(s.clientX-p.left)/f+14,g=(s.clientY-p.top)/f+14;const y=i.offsetWidth,x=i.offsetHeight,v=p.width/f,b=p.height/f;m+y>v-4&&(m=Math.max(4,m-y-28)),g+x>b-4&&(g=Math.max(4,g-x-28)),i.style.left=`${Math.round(m)}px`,i.style.top=`${Math.round(g)}px`}destroy(){this._raf&&(cancelAnimationFrame(this._raf),this._raf=0),this._lastEvent=null,this.el&&this.el.parentNode&&this.el.parentNode.removeChild(this.el),this.el=null}}function _t(t){return String(t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function wt(t){return String(t).replace(/"/g,""")}class At{constructor(t){this.trellis=t}supported(){return!!this.trellis.ctx.exports}_rectIn(t){const e=this.trellis.elWrap.getBoundingClientRect(),i=t.getBoundingClientRect();return{x:i.left-e.left,y:i.top-e.top,w:i.width,h:i.height}}_size(){const t=this.trellis.elWrap.getBoundingClientRect();return{w:Math.ceil(t.width),h:Math.ceil(t.height)}}_background(){const t=this.trellis.panels.find(t=>t.chart),e=t&&t.chart.exports;if(e&&"function"==typeof e.resolveExportBackground){const t=e.resolveExportBackground();if(t&&"transparent"!==t)return t}return"#fff"}_chromeTexts(){const t=this.trellis,e=[],i=(t,i)=>{if(!t||!t.textContent)return;const s=this._rectIn(t),n=getComputedStyle(t);e.push({text:t.textContent,x:"center"===i?s.x+s.w/2:s.x,y:s.y+s.h/2,font:`${n.fontWeight} ${n.fontSize} ${n.fontFamily}`,fontSize:parseFloat(n.fontSize)||12,color:n.color||"#373d3f",align:i})};return i(t.chrome.elTitle,"left"),t.panels.forEach(t=>{t.cellEl&&i(t.cellEl.querySelector(".apexcharts-trellis-header"),"center")}),t.chrome.elLegend&&t.chrome.elLegend.querySelectorAll(".apexcharts-legend-text").forEach(t=>i(t,"left")),e}_legendMarkers(){const t=this.trellis.chrome.elLegend;return t?Array.from(t.querySelectorAll(".apexcharts-legend-marker"),t=>({rect:this._rectIn(t),color:t.style.background||t.style.backgroundColor||"#008FFB"})):[]}dataURI(){return c(this,arguments,function*(t={}){const e=this.trellis,i=t.scale||1,s=this._size(),n=document.createElement("canvas");n.width=s.w*i,n.height=s.h*i;const r=n.getContext("2d");if(!r)return{imgURI:""};const l=r;l.scale(i,i),l.fillStyle=this._background(),l.fillRect(0,0,s.w,s.h);for(const t of e.panels){if(!t.el)continue;const e=this._rectIn(t.el);if(!t.chart){l.fillStyle="rgba(120, 120, 120, 0.06)",l.fillRect(e.x,e.y,e.w,e.h);continue}const{imgURI:s}=yield t.chart.dataURI({scale:i});if(!s)continue;const n=yield Et(s);l.drawImage(n,e.x,e.y,e.w,e.h)}for(const t of this._chromeTexts())l.font=t.font,l.fillStyle=t.color,l.textAlign=t.align,l.textBaseline="middle",l.fillText(t.text,t.x,t.y);for(const t of this._legendMarkers())l.fillStyle=t.color,l.beginPath(),l.arc(t.rect.x+t.rect.w/2,t.rect.y+t.rect.h/2,Math.max(2,t.rect.w/2),0,2*Math.PI),l.fill();return{imgURI:n.toDataURL("image/png")}})}svgString(t=1){return c(this,null,function*(){const e=this.trellis,i=this._size(),s=[];s.push(`<svg xmlns="http://www.w3.org/2000/svg" width="${i.w*t}" height="${i.h*t}" viewBox="0 0 ${i.w} ${i.h}">`),s.push(`<rect width="${i.w}" height="${i.h}" fill="${this._background()}"/>`);for(const t of e.panels){if(!t.el)continue;const e=this._rectIn(t.el);if(!t.chart){s.push(`<rect x="${e.x}" y="${e.y}" width="${e.w}" height="${e.h}" fill="rgba(120,120,120,0.06)" rx="4"/>`);continue}const i=yield t.chart.getSvgString();s.push(`<g transform="translate(${e.x}, ${e.y})">${i}</g>`)}for(const t of this._chromeTexts()){const e="center"===t.align?"middle":"start";s.push(`<text x="${t.x}" y="${t.y}" text-anchor="${e}" dominant-baseline="central" style="font:${kt(t.font)};fill:${kt(t.color)}">${St(t.text)}</text>`)}for(const t of this._legendMarkers())s.push(`<circle cx="${t.rect.x+t.rect.w/2}" cy="${t.rect.y+t.rect.h/2}" r="${Math.max(2,t.rect.w/2)}" fill="${kt(t.color)}"/>`);return s.push("</svg>"),s.join("")})}csv(t={}){var e,i,s;const n=this.trellis,r=n.split;if(!r)return"";const l=n.w,a=t.columnDelimiter||(null==(s=null==(i=null==(e=l.config.chart.toolbar)?void 0:e.export)?void 0:i.csv)?void 0:s.columnDelimiter)||",",o=l.config.xaxis&&"datetime"===l.config.xaxis.type,c=t=>{if(null==t)return"";const e=String(t);return/[",\n]/.test(e)||-1!==e.indexOf(a)?`"${e.replace(/"/g,'""')}"`:e},h=t=>o&&"number"==typeof t?new Date(t).toISOString():t,u=r.seriesNames,d=[["x","facet",...u].map(c).join(a)];return r.panels.forEach(t=>{r.unionX.forEach((e,i)=>{const s=[h(e),t.key];u.forEach(e=>{const n=t.series.find(t=>t.name===e);if(!n||!Array.isArray(n.data))return void s.push("");const r=n.data[i];let l=r;Array.isArray(r)?l=r[1]:r&&"object"==typeof r&&(l=r.y),s.push(Array.isArray(l)?l.join("|"):l)}),d.push(s.map(c).join(a))})}),d.join(t.lineDelimiter||"\n")}download(t){return c(this,arguments,function*(t,e={}){var i;const s=this.trellis,n=(null==(i=s.w.config.chart.toolbar)?void 0:i.export)||{},r=String(s.w.globals.chartID||"trellis");if("png"===t){const{imgURI:t}=yield this.dataURI();Mt(t,n.png&&n.png.filename||r,".png")}else if("svg"===t){const t=yield this.svgString();Mt("data:image/svg+xml;charset=utf-8,"+encodeURIComponent(t),n.svg&&n.svg.filename||r,".svg")}else{Mt("data:text/csv;charset=utf-8,"+encodeURIComponent("\ufeff"+this.csv(e)),e.fileName||n.csv&&n.csv.filename||r,".csv")}})}}function Et(t){return new Promise((e,i)=>{const s=new Image;s.onload=()=>e(s),s.onerror=i,s.src=t})}function Mt(t,e,i){const s=document.createElement("a");s.href=t,s.download=e+i,document.body.appendChild(s),s.click(),document.body.removeChild(s)}function St(t){return String(t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function kt(t){return String(t).replace(/"/g,""")}const Ct=["annotations","colors","dataLabels","fill","forecastDataPoints","grid","markers","noData","states","stroke","tooltip"],Lt={treemap:"trellis does not support treemap: area encoding needs room a panel cannot give. Rendering a single chart.",sunburst:"trellis does not support sunburst: its labels are illegible at panel size. Rendering a single chart.",unit:"the unit type has its own small-multiples mode (plotOptions.unit.grid.split), which beats a trellis of unit charts. Rendering a single chart."};u.default.registerFeatures({trellis:class{constructor(t,e){this.w=t,this.ctx=e,this.panels=[],this._stripEls=[],this.split=null,this.scales=null,this.layout=null,this.cfg={},this.sync=new dt(this),this.chrome=new ht(this),this.virtual=new yt(this),this.exports=new At(this),this.gridTooltip=null,this._promotedKey=null,this._ApexCharts=u.default,this._virtualActive=!1,this._panelRenderer=null,this._yLabelDecimals=0,this.elWrap=null,this.elGrid=null,this._mounted=!1,this._rendering=!1,this._renderPromise=null,this._raf=0,this._lastWidth=0,this._lastHeight=0,this._chromeH=0,this._overflowWarned=!1,this._resizeHandler=this._onContainerResize.bind(this),this.autoScaleYaxis=!1,this._elChromeTop=null,this._vetoWarned=!1,this._noKeyWarned=!1,this._frames=null}isActive(){var t;const e=this.w.config.trellis;if(!e||!(e.by||e.row||e.column))return!1;const i=null==(t=this.w.config.chart)?void 0:t.type;if(i&&Lt[i])return this._vetoWarned||(this._vetoWarned=!0,console.warn(`ApexCharts: ${Lt[i]}`)),!1;if(e.by&&!e.row&&!e.column&&!Array.isArray(e.data)){if(!(this.w.config.series||[]).some((t,i)=>null!==C(t,i,e.by))){if(!this._noKeyWarned){this._noKeyWarned=!0;const t="function"==typeof e.by?"the `trellis.by` function returned no key for any series":`no series carries the \`trellis.by\` key '${e.by}'`;console.warn(`ApexCharts: ${t}; there is nothing to split. Rendering as a single chart.`)}return!1}}return!0}_layoutCfg(){return this.split&&"2d"===this.split.mode&&this.split.colKeys?o(a({},this.cfg),{columns:this.split.colKeys.length}):this.cfg}_stackingHost(){var t,e;const i=this.w.config,s=i.chart||{},n=i.highlightFilter||{};return{stacked:!!s.stacked,stackType:s.stackType,stackOnlyBar:!!s.stackOnlyBar,parts:!!E._featureRegistry.get("highlightFilter")&&!1!==n.enabled&&"clamp"!==n.axis&&["bar","line","area"].includes(s.type)&&!(null==(e=null==(t=i.plotOptions)?void 0:t.bar)?void 0:e.isFunnel)}}_yMode(){var t;return this._frames&&this._frames.forceSharedY?"shared":(null==(t=this.cfg.scales)?void 0:t.y)||"shared"}_yBoundsFor(t){var e,i;const s=this.scales;if(!s)return null;if(this._frames&&this._frames.skipYaxisPush)return null;const n=this._yMode();return"shared"===n?s.y:"independent-row"===n&&s.rowY?s.rowY.get(null!=(e=t.rowKey)?e:"")||null:"independent-column"===n&&s.colY&&s.colY.get(null!=(i=t.colKey)?i:"")||null}_valueAxisIsX(){var t,e;const i=this.w.config;return["bar","boxPlot","violin"].includes(i.chart.type)&&!!(null==(e=null==(t=i.plotOptions)?void 0:t.bar)?void 0:e.horizontal)}_valueAxisXPatch(t){var e,i;const s={min:t.min,max:t.max};return"number"!=typeof(null==(i=null==(e=this.ctx.opts)?void 0:e.xaxis)?void 0:i.tickAmount)&&(s.tickAmount=t.tickAmount),s}_groupId(){return`${this.w.globals.chartID}-tg`}_fire(t,e){var i,s;const n=null==(s=null==(i=this.w.config.chart)?void 0:i.events)?void 0:s[t];"function"==typeof n&&n(this.ctx,e),this.ctx.events.fireEvent(t,[this.ctx,e])}render(){const t=this._render();return this._renderPromise=t,t}whenSettled(){return this._rendering&&this._renderPromise?this._renderPromise.catch(()=>{}):Promise.resolve()}_render(){return c(this,null,function*(){var t,e,i,s;const n=this.w;if(!this._mounted&&!this._rendering)if(p.isBrowser()){this._rendering=!0;try{this.cfg=n.config.trellis||{},this.autoScaleYaxis=!!(null==(e=null==(t=n.config.chart)?void 0:t.zoom)?void 0:e.autoScaleYaxis);let r=n.config.series||[];if(Array.isArray(this.cfg.data)){const t=function(t,e={}){const i=[],s=e.by;if("string"!=typeof s||!s)return{series:[],warnings:["trellis: tidy-row input (trellis.data) needs a string `by` column name"]};const n=e.x,r=e.y;if(!n||!r)return{series:[],warnings:["trellis: tidy-row input (trellis.data) needs `x` and `y` column names"]};const l=Array.isArray(t)?t:[];if(!l.length)return{series:[],warnings:["trellis: trellis.data is empty"]};const a=e.seriesBy;let o=0,c=0;const h=new Map;l.forEach(t=>{if(!t||"object"!=typeof t)return void o++;const e=t[s],i=t[n];if(null==e||null==i)return void o++;const l=a&&void 0!==t[a]&&null!==t[a]?String(t[a]):String(r);let u=h.get(String(e));u||(u=new Map,h.set(String(e),u));let d=u.get(l);d||(d=new Map,u.set(l,d));const p=i instanceof Date?i.getTime():i;d.has(p)&&c++;const f=t[r];d.set(p,void 0===f?null:f)}),o&&i.push(`trellis: ${o} row(s) missing "${s}" or "${n}" were skipped`),c&&i.push(`trellis: ${c} duplicate (panel, series, x) row(s); kept the last. Aggregate the rows first if you want sums or means.`);const u=[];return h.forEach((t,e)=>{t.forEach((t,i)=>{u.push({name:i,[s]:e,data:Array.from(t,([t,e])=>({x:t,y:e}))})})}),{series:u,warnings:i}}(this.cfg.data,this.cfg);t.warnings.forEach(t=>console.warn(`ApexCharts: ${t}`)),t.series.length&&(r.length&&console.warn("ApexCharts: trellis received both `series` and `trellis.data`; using trellis.data."),r=t.series)}const l=P(r,this.cfg,{chartType:n.config.chart.type});if(this.split=l,l.warnings.forEach(t=>console.warn(`ApexCharts: ${t}`)),!l.panels.length)return;l.dropped>0&&console.warn(`ApexCharts: trellis rendered ${l.panels.length} panels; ${l.dropped} more hidden by trellis.limit.`);const c=null!=(i=this.cfg.virtualize)?i:"auto";let h=!0===c||"auto"===c&&l.panels.length>64;h&&!yt.supported()&&(console.warn("ApexCharts: trellis virtualization needs IntersectionObserver; rendering eagerly."),h=!1),this._virtualActive=h,!h&&l.panels.length>64&&console.warn(`ApexCharts: trellis with ${l.panels.length} panels renders eagerly; set trellis.virtualize (or trellis.limit).`),l.panels.length>256&&console.warn(`ApexCharts: ${l.panels.length} trellis panels is a lot to read at once; consider trellis.limit.`);const d="histogram"===n.config.chart.requestedType?"histogram":n.config.chart.type;this._frames=j(l,this.cfg,n.config,d),this._frames.warnings.forEach(t=>console.warn(`ApexCharts: ${t}`)),this._yLabelDecimals=this._frames.yExtentOverride?0:function(t){let e=0;const i=t=>{const i=G(t);i>e&&(e=i)};return t.forEach(t=>t.series.forEach(t=>{Array.isArray(t.data)&&t.data.forEach(t=>{if(null==t)return;let e=t;Array.isArray(t)?e=t[1]:"object"==typeof t&&(e=t.y),Array.isArray(e)?e.forEach(i):i(e)})})),e}(l.panels);const p=this._yMode()!==((null==(s=this.cfg.scales)?void 0:s.y)||"shared")?o(a({},this.cfg),{scales:o(a({},this.cfg.scales||{}),{y:this._yMode()})}):this.cfg;this.scales=U(l,p,a({chartType:n.config.chart.type,userColors:this.ctx.opts&&this.ctx.opts.colors,yExtentOverride:this._frames.yExtentOverride},this._stackingHost())),this._panelRenderer=function(t,e,i,s){if(i&&i.chart&&i.chart.renderer)return null;if(!s)return null;const n={config:{series:t.panels.reduce((t,e)=>t.concat(e.series),[]),chart:{type:e.chart.type},markers:e.markers,dataLabels:e.dataLabels,fill:e.fill,plotOptions:e.plotOptions,states:e.states}};if(b(n))return null;const r=e.chart.rendererThreshold||8e3;return v(n)>=r?"canvas":null}(l,n.config,this.ctx.opts,A._rendererRegistry.has("canvas")),this._buildSkeleton();const f=this._containerWidth();this._lastWidth=f,this._lastHeight=this._hostHeight()||0,this._chromeH=0,this.layout=Z({panelCount:l.panels.length,containerWidth:f,cfg:this._layoutCfg(),hostHeight:this._hostHeight(),chromeHeight:this._chromeH}),this._applyGridStyle(),this._buildCells();const g="shared"!==this._yMode(),y=this.elWrap;if(h)this.virtual.start();else{g&&(y.style.visibility="hidden");for(let t=0;t<this.panels.length;t++){const e=this.panels[t];if(e.noMount)continue;const i=this._assemblePanelOptions(e.index),s=new u.default(e.el,i);e.chart=s,yield s.render(),this._fire("panelMounted",{key:e.key,index:e.index,chart:s})}g&&(yield this._alignGutters(),y.style.visibility="")}this.chrome.buildTitle(this._elChromeTop),this.chrome.buildToolbar(y),this.chrome.buildLegend(y),this.sync.wireCrosshairs(this.elGrid),"grid"===(this.cfg.tooltip||"panel")&&(this.gridTooltip=new bt(this),this.gridTooltip.wire(this.elGrid,y)),this._mounted=!0,this._refitForChrome(),m(this.ctx.el,this._resizeHandler),h||(n.globals.animationEnded=!0),this._fire("trellisMounted",{panels:this.getPanels()})}finally{this._rendering=!1}}else console.warn("ApexCharts: trellis rendering is browser-only in this version; SSR hosts render nothing.")})}_containerWidth(){const t=this.ctx.el;return t.getBoundingClientRect().width||t.clientWidth||800}_hostHeight(){var t;const e=this.w.config.chart&&this.w.config.chart.height;if(null==e||""===e||"auto"===e)return;const i=String(e).trim();if(i.endsWith("%")){const e=parseFloat(i);if(!isFinite(e)||e<=0)return;const s=null==(t=this.ctx.el)?void 0:t.parentNode;if(!s||"function"!=typeof s.getBoundingClientRect)return;const n=(s.getBoundingClientRect().height||s.clientHeight||0)*e/100;return n>0?n:void 0}const s=parseFloat(i);return isFinite(s)&&s>0?s:void 0}_chromeHeight(){const t=this.elWrap,e=this.elGrid;if(!t||!e||"function"!=typeof t.getBoundingClientRect)return 0;const i=t.getBoundingClientRect().height-e.getBoundingClientRect().height;return isFinite(i)&&i>0?i:0}_buildSkeleton(){var t;const e=this.ctx.el,i=f.createElementNS("http://www.w3.org/1999/xhtml","div");i.className="apexcharts-trellis",this.split&&"2d"===this.split.mode&&i.classList.add("apexcharts-trellis-2d"),i.id=`apexcharts-trellis${this.w.globals.chartID}`,i.setAttribute("data-tooltip-mode",this.cfg.tooltip||"panel");const s=null==(t=this.w.config.chart)?void 0:t.foreColor;s&&i.style.setProperty("--apx-trellis-fore",s);const n=f.createElement("div");n.className="apexcharts-trellis-chrome",i.appendChild(n),this._elChromeTop=n;const r=f.createElement("div");r.className="apexcharts-trellis-grid",i.appendChild(r),e.appendChild(i),this.elWrap=i,this.elGrid=r,this.w.dom.baseEl=e,this.w.dom.elWrap=i}_applyGridStyle(){var t;const e=this.elGrid,i=this.layout;e.style.display="grid";const s=this.split&&"2d"===this.split.mode&&!1!==(null==(t=this.cfg.header)?void 0:t.show);e.style.gridTemplateColumns=s?`auto repeat(${i.cols}, minmax(0, 1fr))`:`repeat(${i.cols}, minmax(0, 1fr))`,e.style.gap=`${i.gap}px`}_buildCells(){var t;const e=this.elGrid,i=this.split,s=this.layout,n="2d"===i.mode,r=n&&!1!==(null==(t=this.cfg.header)?void 0:t.show);this._stripEls=[];const l=this.cfg.emptyPanels||"placeholder";if(r){const t=f.createElement("div");t.className="apexcharts-trellis-corner",e.appendChild(t),this._stripEls.push(t),(i.colKeys||[]).forEach((t,s)=>{const n=this.chrome.stripEl("column",t,{index:s,count:(i.colKeys||[]).length});e.appendChild(n),this._stripEls.push(n)})}this.panels=[],i.panels.forEach((t,a)=>{var o;if(r&&a%s.cols===0){const t=Math.floor(a/s.cols),n=this.chrome.stripEl("row",null!=(o=(i.rowKeys||[])[t])?o:"",{index:t,count:(i.rowKeys||[]).length});e.appendChild(n),this._stripEls.push(n)}const c=f.createElement("div");c.className="apexcharts-trellis-cell",c.setAttribute("data-key",t.key),this._applyCellMutes(c,s.cells[a]),n||this.chrome.buildHeader(c,t.key,{index:a,count:i.panels.length});const h=f.createElement("div");h.className="apexcharts-trellis-panel",this._virtualActive&&(h.classList.add("apexcharts-trellis-skeleton"),h.style.minHeight=`${s.panelH}px`),c.appendChild(h);const u=t.empty&&"placeholder"!==l;if(t.empty)if(c.classList.add("apexcharts-trellis-cell-empty"),"hide"===l)c.classList.add("apexcharts-trellis-cell-hidden");else if("skip"===l)h.classList.add("apexcharts-trellis-skeleton"),h.style.minHeight=`${s.panelH}px`;else{const t=f.createElement("div");t.className="apexcharts-trellis-empty-label",t.textContent=this.w.config.noData&&this.w.config.noData.text||"no data",c.appendChild(t)}e.appendChild(c),this.panels.push({key:t.key,index:a,el:h,cellEl:c,chart:null,empty:t.empty,noMount:u})})}_applyCellMutes(t,e){t.classList.toggle("apexcharts-trellis-mute-x",!e.showXLabels),t.classList.toggle("apexcharts-trellis-mute-y",!e.showYLabels)}_assemblePanelOptions(t,{noAnimation:e=!1}={}){var i,s,n,r,l,c,h,u,p,f,m,g,y,x;const v=this.w,b=this.split,_=this.scales,w=this.layout,A=b.panels[t],E=d.clone(this.ctx.opts||{});delete E.trellis,delete E.series,delete E.responsive,E.annotations&&(E.annotations=function(t,e){if(!t||"object"!=typeof t)return t;const i=a({},t);for(const t of["yaxis","xaxis","points","texts","images"]){const s=i[t];Array.isArray(s)&&(i[t]=s.filter(t=>!t||void 0===t.scope||null===t.scope||"trellis"===t.scope||(Array.isArray(t.scope)?-1!==t.scope.map(String).indexOf(e):String(t.scope)===e)).map(t=>{if(!t||void 0===t.scope)return t;const e=a({},t);return delete e.scope,e}))}return i}(E.annotations,A.key));const M=E.chart||{},S=M.events||{},k=v.globals.chartID,C=null==(n=null==(s=null==(i=this.ctx.opts)?void 0:i.chart)?void 0:s.animations)?void 0:n.enabled,L=e||b.panels.length>16&&void 0===C,F=A.empty&&"placeholder"===(this.cfg.emptyPanels||"placeholder");let N=F?[H(b,{chartType:v.config.chart.type})]:A.series;const O=["pie","donut","polarArea","radialBar"].includes(v.config.chart.type);O&&(N=N.flatMap(t=>Array.isArray(t.data)?t.data:[]).map(t=>"number"==typeof t&&isFinite(t)?t:0));const P=a(a(o(a({chart:o(a(a({id:`${k}-tp${t}`,group:this._groupId(),height:w.panelH,width:"100%",redrawOnParentResize:!1,redrawOnWindowResize:!1,print:{enabled:!1},parentHeightOffset:0,toolbar:{show:!1},zoom:{enabled:"none"!==this.cfg.zoom}},L?{animations:{enabled:!1}}:{}),this._panelRenderer?{renderer:this._panelRenderer}:{}),{events:o(a({},S),{zoomed:this.sync.makeZoomedHandler(S.zoomed),scrolled:this.sync.makeScrolledHandler(S.scrolled)})}),series:N},O?{}:{colors:N.map(t=>_.colorOf(t.name))}),{title:{text:"",margin:0,floating:!0},subtitle:{text:"",margin:0,floating:!0},legend:{show:!1}}),F?{tooltip:{enabled:!1}}:{}),w.panelH<120&&"grid"!==this.cfg.tooltip&&"boolean"!=typeof(null==(l=null==(r=this.ctx.opts)?void 0:r.tooltip)?void 0:l.compact)?{tooltip:{compact:!0}}:{});if(!(null==(c=M.sparkline)?void 0:c.enabled)&&!["pie","donut","polarArea","radialBar","radar","treemap"].includes(v.config.chart.type)){const t=E.grid&&E.grid.padding||{},e="datetime"===(null==(u=null==(h=this.ctx.opts)?void 0:h.xaxis)?void 0:u.type)?2:7;P.grid={padding:{top:("number"==typeof t.top?t.top:0)-12,bottom:("number"==typeof t.bottom?t.bottom:0)-e}}}const $=this._valueAxisIsX();_.x&&!$&&(P.xaxis={min:_.x.min,max:_.x.max});const W=this._yBoundsFor(A);if(W){const t=Array.isArray(null==(p=this.ctx.opts)?void 0:p.yaxis)?this.ctx.opts.yaxis[0]:null==(f=this.ctx.opts)?void 0:f.yaxis,e=Array.isArray(E.yaxis)?E.yaxis[0]:E.yaxis;let i={};if("function"!=typeof(null==(m=null==t?void 0:t.labels)?void 0:m.formatter)){const t=(W.max-W.min)/Math.max(1,W.tickAmount),e=Math.max(this._yLabelDecimals,G(t));i={labels:{formatter:t=>"number"==typeof t&&isFinite(t)?t.toFixed(e):t}}}P.yaxis=d.extend(e||{},a({min:W.min,max:W.max,tickAmount:W.tickAmount},i)),delete E.yaxis,$&&(P.xaxis=d.extend(P.xaxis||{},this._valueAxisXPatch(W)))}const B=this._frames;if(B&&B.plotOptions&&(P.plotOptions=d.clone(B.plotOptions)),B&&B.pieScaleOf){const t=B.pieScaleOf(A.key);if(null!==t){const e=null==(x=null==(y=null==(g=this.ctx.opts)?void 0:g.plotOptions)?void 0:y.pie)?void 0:x.customScale;P.plotOptions=d.extend(P.plotOptions||{},{pie:{customScale:t*("number"==typeof e?e:1)}})}}let z=d.extend(E,P);if("function"==typeof this.cfg.panel){const e=this.cfg.panel(A.key,{index:t,seriesNames:A.seriesNames});e&&"object"==typeof e&&(z=d.extend(z,e))}return z}_alignGutters(){return c(this,null,function*(){var t,e,i,s;const n=this.panels.map(t=>{var e,i,s,n,r;return null==(r=null==(n=null==(s=null==(i=null==(e=t.chart)?void 0:e.w)?void 0:i.globals)?void 0:s.yLabelsCoords)?void 0:n[0])?void 0:r.width}).filter(t=>"number"==typeof t&&isFinite(t));if(!n.length)return;const r=!!(null==(s=null==(i=null==(e=null==(t=this.panels[0])?void 0:t.chart)?void 0:e.w)?void 0:i.globals)?void 0:s.isBarHorizontal)?0:10,l=Math.max(0,Math.max(...n)-r);yield this._pushGutterFloor(l)})}_yLabelPad(){return 10}_pushGutterFloor(t){return c(this,null,function*(){for(const e of this.panels)e.chart&&(yield e.chart.updateOptions({yaxis:ut(e.chart,{labels:{minWidth:t}})},!1,!1,!1).catch(()=>{}))})}_refitForChrome(){if(!this._hostHeight())return;const t=this._chromeHeight();t<=0||Math.round(t)===Math.round(this._chromeH)?this._warnIfOverflowing():(this._chromeH=t,this._relayout(this._containerWidth()))}_warnIfOverflowing(){const t=this.layout;t&&t.overflowH&&!this._overflowWarned&&(this._overflowWarned=!0,console.warn(`ApexCharts: trellis needs ${Math.round(t.gridH+this._chromeH)}px but its container gives ${Math.round(this._hostHeight()||0)}px; ${t.rows} rows cannot go below the ${t.panelH}px panel floor. Raise the container, use fewer panels (trellis.limit) or more columns (trellis.columns), or lower trellis.minPanelHeight.`))}_onContainerResize(){this._mounted&&(this._raf||(this._raf=requestAnimationFrame(()=>{this._raf=0;const t=this._containerWidth(),e=this._hostHeight()||0;if(Math.round(t)!==Math.round(this._lastWidth)||Math.round(e)!==Math.round(this._lastHeight)){if(this._lastWidth=t,this._lastHeight=e,this._promotedKey){const t=this.panels.find(t=>t.key===this._promotedKey);return void(t&&t.chart&&t.chart.updateOptions({},!1,!1,!1).catch(()=>{}))}this._relayout(t)}})))}promote(t){return c(this,null,function*(){var e;const i=this.panels.find(e=>e.key===String(t));if(!i||i.noMount||!this._mounted)return;if(this._promotedKey===i.key)return;this._promotedKey&&(yield this.restorePromotion()),this._promotedKey=i.key;const s=this.layout,n=this.elGrid?this.elGrid.getBoundingClientRect().height:0,r=Math.round(Math.max(280,Math.min(560,n||(s?2.4*s.panelH:420))));null==(e=this.elWrap)||e.classList.add("apexcharts-trellis-promoting"),this.panels.forEach(t=>{if(!t.cellEl)return;const e=t===i;t.cellEl.classList.toggle("apexcharts-trellis-cell-promoted",e),t.cellEl.classList.toggle("apexcharts-trellis-cell-parked",!e)}),this._stripEls.forEach(t=>t.classList.add("apexcharts-trellis-cell-parked")),this.chrome.buildBreadcrumb(this._elChromeTop,i.key,()=>this.restorePromotion()),!i.chart&&this._virtualActive&&(i.wantMounted=!0,this.virtual._dirty.add(i),this.virtual._schedule()),i.el&&(i.el.style.minHeight=`${r}px`),i.chart&&(yield i.chart.updateOptions({chart:{height:r}},!1,!1,!1).catch(()=>{})),this._fire("panelPromoted",{key:i.key,chart:i.chart})})}restorePromotion(){return c(this,null,function*(){var t;if(!this._promotedKey)return;const e=this.panels.find(t=>t.key===this._promotedKey);this._promotedKey=null,null==(t=this.elWrap)||t.classList.remove("apexcharts-trellis-promoting"),this.panels.forEach(t=>{t.cellEl&&(t.cellEl.classList.remove("apexcharts-trellis-cell-promoted"),t.cellEl.classList.remove("apexcharts-trellis-cell-parked"))}),this._stripEls.forEach(t=>t.classList.remove("apexcharts-trellis-cell-parked")),this.chrome.removeBreadcrumb();const i=this.layout;e&&e.el&&i&&(e.el.style.minHeight=`${i.panelH}px`),e&&e.chart&&i&&(yield e.chart.updateOptions({chart:{height:i.panelH}},!1,!1,!1).catch(()=>{})),this._lastWidth=0,this._relayout(this._containerWidth()),this._lastWidth=this._containerWidth(),this._fire("panelRestored",{key:e?e.key:null})})}_relayout(t){const e=this.split;if(!e)return;const i=this.layout?this.layout.panelH:0;this.layout=Z({panelCount:e.panels.length,containerWidth:t,cfg:this._layoutCfg(),hostHeight:this._hostHeight(),chromeHeight:this._chromeH}),this._applyGridStyle(),this._warnIfOverflowing();const s=this.layout;this.panels.forEach((t,e)=>{if(t.cellEl&&this._applyCellMutes(t.cellEl,s.cells[e]),t.el&&this._virtualActive&&(t.el.style.minHeight=`${s.panelH}px`),!t.chart)return;const n=s.panelH!==i?{chart:{height:s.panelH}}:{};t.chart.updateOptions(n,!1,!1,!1).catch(()=>{})}),this._virtualActive&&this.virtual.refresh()}canApplyInPlace(t){if(!this._mounted||this._promotedKey)return!1;if(!t||"object"!=typeof t)return!1;const e=Object.keys(t);return!!e.length&&e.every(t=>Ct.includes(t))}applyPanelOptions(t=!0){return c(this,null,function*(){var e,i,s;const n=this.split;if(!n)return;const r=this._yMode()!==((null==(e=this.cfg.scales)?void 0:e.y)||"shared")?o(a({},this.cfg),{scales:o(a({},this.cfg.scales||{}),{y:this._yMode()})}):this.cfg;this.scales=U(n,r,a({chartType:this.w.config.chart.type,userColors:this.ctx.opts&&this.ctx.opts.colors,yExtentOverride:this._frames?this._frames.yExtentOverride:null},this._stackingHost())),yield Promise.all(this.panels.map(e=>{if(!e.chart)return Promise.resolve();const i=this._assemblePanelOptions(e.index);return delete i.series,i.chart&&delete i.chart.height,e.chart.updateOptions(i,!1,t,!1,!1).catch(()=>{})})),null==(s=(i=this.chrome).refreshLegendColors)||s.call(i)})}updateSeries(t,e=!0){return c(this,null,function*(){var i;const s=this.w;if(Array.isArray(this.cfg.data)&&this.cfg.data.length)return console.warn("ApexCharts: this trellis renders from trellis.data; update it via updateOptions({ trellis: { data } })."),Promise.resolve();if(s.config.series=t,this.ctx.opts&&(this.ctx.opts.series=t),!this._mounted)return this.ctx.render();const n=P(t||[],this.cfg,{chartType:s.config.chart.type});if(!(n.panels.length===this.panels.length&&n.panels.every((t,e)=>t.key===this.panels[e].key)))return this.teardown(),this.ctx.render();this.split=n,this._frames=j(n,this.cfg,s.config,"histogram"===s.config.chart.requestedType?"histogram":s.config.chart.type);const r=this._yMode()!==((null==(i=this.cfg.scales)?void 0:i.y)||"shared")?o(a({},this.cfg),{scales:o(a({},this.cfg.scales||{}),{y:this._yMode()})}):this.cfg;this.scales=U(n,r,a({chartType:s.config.chart.type,userColors:this.ctx.opts&&this.ctx.opts.colors,yExtentOverride:this._frames.yExtentOverride},this._stackingHost()));const l=this.scales,c=this._frames,h=["pie","donut","polarArea","radialBar"].includes(s.config.chart.type),u=this.panels.map((t,i)=>{var s,r,a;if(!t.chart)return Promise.resolve();const o={series:h?n.panels[i].series.flatMap(t=>Array.isArray(t.data)?t.data:[]).map(t=>"number"==typeof t&&isFinite(t)?t:0):n.panels[i].series},u=this._valueAxisIsX();l.x&&!u&&(o.xaxis={min:l.x.min,max:l.x.max});const p=this._yBoundsFor(n.panels[i]);if(p&&(o.yaxis=ut(t.chart,{min:p.min,max:p.max,tickAmount:p.tickAmount}),u&&(o.xaxis=d.extend(o.xaxis||{},this._valueAxisXPatch(p)))),c.plotOptions&&(o.plotOptions=d.clone(c.plotOptions)),c.pieScaleOf){const t=c.pieScaleOf(n.panels[i].key);if(null!==t){const e=null==(a=null==(r=null==(s=this.ctx.opts)?void 0:s.plotOptions)?void 0:r.pie)?void 0:a.customScale;o.plotOptions=d.extend(o.plotOptions||{},{pie:{customScale:t*("number"==typeof e?e:1)}})}}return t.chart.updateOptions(o,!1,e,!1).catch(()=>{})});return Promise.all(u)})}getPanels(){return this.panels.map(t=>({key:t.key,index:t.index,chart:t.chart,el:t.cellEl}))}getPanel(t){const e=this.panels.find(e=>e.key===String(t));return e?e.chart:null}teardown(){this.virtual.stop(),this._virtualActive=!1,this._panelRenderer=null,this._promotedKey=null,this._frames=null,this.chrome.destroyGradientLegend(),this.gridTooltip&&(this.gridTooltip.destroy(),this.gridTooltip=null),this._raf&&(cancelAnimationFrame(this._raf),this._raf=0),p.isBrowser()&&this.ctx.el&&g(this.ctx.el,this._resizeHandler),this.panels.forEach(t=>{if(t.chart)try{t.chart.destroy()}catch(t){}t.chart=null}),this.panels=[],this._stripEls=[],this.elWrap&&this.elWrap.parentNode&&this.elWrap.parentNode.removeChild(this.elWrap),this.elWrap=null,this.elGrid=null,this._mounted=!1,this.ctx._renderPromise=null}}}),Object.defineProperty(exports,"default",{enumerable:!0,get:()=>u.default});
|
|
5
|
+
"use strict";var t=Object.defineProperty,e=Object.defineProperties,i=Object.getOwnPropertyDescriptors,s=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable,l=(e,i,s)=>i in e?t(e,i,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[i]=s,a=(t,e)=>{for(var i in e||(e={}))n.call(e,i)&&l(t,i,e[i]);if(s)for(var i of s(e))r.call(e,i)&&l(t,i,e[i]);return t},o=(t,s)=>e(t,i(s)),c=(t,e,i)=>new Promise((s,n)=>{var r=t=>{try{a(i.next(t))}catch(t){n(t)}},l=t=>{try{a(i.throw(t))}catch(t){n(t)}},a=t=>t.done?s(t.value):Promise.resolve(t.value).then(r,l);a((i=i.apply(t,e)).next())});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});function h(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 u=h(require("apexcharts/core")),d=u.__apex_Utils,p=u.__apex_Environment_Environment,f=u.__apex_BrowserAPIs_BrowserAPIs,m=u.__apex_Resize_addResizeListener,g=u.__apex_Resize_removeResizeListener;class y{constructor(t,e){this.w=t,this.ctx=e,this.kind="svg"}beginSeries(){}present(){return null}clear(){}group(t){return this.ctx.graphics.group(t)}drawPath(t){return this.ctx.graphics.drawPath(t)}drawLine(...t){return this.ctx.graphics.drawLine(...t)}drawRect(...t){return this.ctx.graphics.drawRect(...t)}drawCircle(t,e){return this.ctx.graphics.drawCircle(t,e)}drawText(t){return this.ctx.graphics.drawText(t)}renderPaths(t){return this.ctx.graphics.renderPaths(t)}drawMarker(t,e,i={}){return this.ctx.graphics.drawMarker(t,e,i)}supports(t){return!0}hitTest(){return null}restyle(){}toBitmap(){return null}destroy(){}}const x=["none","lighten","darken"];function v(t){const e=t.config.series||[],i=t.config.chart.type,s="scatter"===i||"bubble"===i,n=t.config.markers&&t.config.markers.size,r=Array.isArray(n)?n.some(t=>t>0):(n||0)>0,l=!(!t.config.dataLabels||!t.config.dataLabels.enabled),a="heatmap"===i;let o=0,c=0;e.forEach(t=>{const e=Array.isArray(t.data)?t.data.length:0;e>c&&(c=e),(s||r||a)&&(o+=e),l&&(o+=e)});return c>=5e4&&(o=Math.max(o,c)),o}function b(t){var e,i,s,n;const r=t.config.fill&&t.config.fill.type,l=t=>"pattern"===t||"image"===t||"gradient"===t;if(Array.isArray(r)?r.some(l):l(r))return!0;const a=null==(i=null==(e=t.config.plotOptions)?void 0:e.line)?void 0:i.colors;if(a&&a.colorAboveThreshold&&a.colorBelowThreshold)return!0;if("heatmap"===t.config.chart.type&&"rect"!==((null==(n=null==(s=t.config.plotOptions)?void 0:s.heatmap)?void 0:n.shape)||"rect"))return!0;const o=t.config.states||{},c=o.hover&&o.hover.filter&&o.hover.filter.type,h=o.active&&o.active.filter&&o.active.filter.type;return!(!c||x.includes(c))||!(!h||x.includes(h))}const _="__apexcharts_renderers__";function w(){const t=globalThis;return t[_]||(t[_]=new Map),t[_]}class A{static get _rendererRegistry(){return w()}static registerRenderer(t,e){w().set(t,e)}static unregisterRenderer(t){w().delete(t)}constructor(t,e){this.w=t,this.ctx=e,this.svg=new y(t,e),this.active=this.svg,this._activeKind="svg",this._instances={},this.w.globals.activeRenderer=this.active}_activate(t,e){this.active=e,this._activeKind=t,this.ctx.renderer=e,this.w.globals.activeRenderer=e}_desiredKind(){const t=this.w.config.chart,e=t.renderer||"svg";if(!p.isBrowser())return"svg";if("svg"===e)return"svg";if(b(this.w))return"svg";if("canvas"===e)return"canvas";return v(this.w)>=(t.rendererThreshold||8e3)?"canvas":"svg"}resolve(){const t=this.w.config.chart.renderer||"svg",e=this._desiredKind();if("svg"!==e){const i=w().get(e);if(i)return this._instances[e]||(this._instances[e]=i(this.w,this.ctx)),this._activate(e,this._instances[e]),this._activeKind;t!==e||this._warned||(this._warned=1,function(t,e,i={}){const{module:s=`features/${e}`,entry:n,scripts:r=[`features/${e}.js`],tail:l}=i,a=r.map(t=>`<script src='.../dist/${t}'>`).join(" and ");globalThis.console.warn(`ApexCharts: ${t} requires the ${e} feature, which is not in this bundle. Bundler: import 'apexcharts/${s}'`+(n?` (or from 'apexcharts/${n}')`:"")+`. Script tag: add ${a} after the ApexCharts script, or load apexcharts.full.min.js instead.`+(l?` ${l}`:""))}(`\`chart.renderer: '${e}'\``,`renderer-${e}`,{tail:"Falling back to SVG."}))}else"canvas"===t&&!this._warned&&b(this.w)&&(this._warned=1,console.warn('[apexcharts] renderer:"canvas" requested but this chart uses a feature the canvas renderer does not render yet (gradient/pattern/image fill or a state color-matrix filter); falling back to SVG.'));const i=this._instances[this._activeKind];return i&&(i.destroy(),delete this._instances[this._activeKind]),this._activate("svg",this.svg),this._activeKind}pendingKind(){const t=this._desiredKind();return"svg"===t||w().has(t)?t:"svg"}getActiveKind(){return this._activeKind}teardown(){for(const t in this._instances){const e=this._instances[t];e&&"function"==typeof e.destroy&&e.destroy()}this._instances={},this.active=this.svg,this._activeKind="svg",this.w.globals.activeRenderer=null}}const E=u.__apex_helpers_InitCtxVariables;function M(t){if(!Array.isArray(t)||0===t.length)return"empty";for(let e=0;e<t.length;e++){const i=t[e];if(null!=i)return Array.isArray(i)?"paired":"object"==typeof i?"object":"plain"}return"empty"}function S(t,e){if(null!=t){if("paired"===e){const e=t[0];return e instanceof Date?e.getTime():e}if("object"===e){const e=t.x;return e instanceof Date?e.getTime():e}}}function k(t,e){return"paired"===e?[t,null]:"object"===e?{x:t,y:null}:null}function C(t,e,i){const s="function"==typeof i?i(t,e):t?t[i]:void 0;return null==s||""===s?null:String(s)}function L(t,e){if(!e||"first-seen"===e)return t.slice();if("asc"===e||"desc"===e){const i=t.slice().sort((t,e)=>{const i=Number(t),s=Number(e);return isFinite(i)&&isFinite(s)?i-s:t<e?-1:t>e?1:0});return"desc"===e?i.reverse():i}if(Array.isArray(e)){const i=e.map(String).filter(e=>-1!==t.indexOf(e)),s=t.filter(t=>-1===i.indexOf(t));return i.concat(s)}return"function"==typeof e?t.slice().sort(e):t.slice()}function F(t,e){const i=[],s=new Set;let n=!1,r=!1,l=0,a="plain";t.forEach(t=>{const e=M(t&&t.data);if("empty"!==e){if("plain"===e)return r=!0,void(l=Math.max(l,t.data.length));n=!0,a=e,t.data.forEach(t=>{const n=S(t,e);if(void 0===n)return;const r=typeof n+":"+String(n);s.has(r)||(s.add(r),i.push(n))})}}),n&&r&&e.push("trellis: mixing x-keyed data ([x,y] / {x,y}) with plain value arrays; plain series are padded by position, not by x");const o=n&&i.every(t=>"number"==typeof t&&isFinite(t));return o&&i.sort((t,e)=>Number(t)-Number(e)),{unionX:i,sawKeyed:n,plainMaxLen:l,xForm:a,xIsNumeric:o}}const N=["scatter","bubble"];function H(t,e,i=!0){const s=[],n=new Set;let r=0;return{align:l=>{const c=M(l&&l.data),h=l&&null!=l.name?String(l.name):`series-${r+1}`;r++,n.has(h)||(n.add(h),s.push(h));const u=o(a({},l),{name:h});if(!i)return u.data=Array.isArray(l.data)?l.data.slice():[],u;if("plain"===c||"empty"===c){const e=t.sawKeyed?t.unionX.length:t.plainMaxLen,i=Array.isArray(l.data)?l.data.slice(0,e):[];for(;i.length<e;)i.push(null);if(u.data=i,Array.isArray(l.highlightData)){const t=l.highlightData.slice(0,e);for(;t.length<e;)t.push(null);u.highlightData=t}return u}const d=new Map,p=new Map,f=Array.isArray(l.highlightData)?l.highlightData:null;return l.data.forEach((t,i)=>{const s=S(t,c);void 0===s||d.has(s)?void 0!==s&&d.has(s)&&e.push(`trellis: duplicate x "${String(s)}" in series "${h}"; keeping the first`):(d.set(s,t),f&&p.set(s,f[i]))}),u.data=t.unionX.map(t=>d.has(t)?d.get(t):k(t,c)),f&&(u.highlightData=t.unionX.map(t=>p.has(t)?p.get(t):null)),u},seriesNames:s}}function O(t,e={}){const i=t.xForm,s={bar:0,column:0,rangeBar:[0,0],candlestick:[0,0,0,0],boxPlot:[0,0,0,0,0]},n=e.chartType&&e.chartType in s?s[e.chartType]:null,r="plain"===i?t.unionX.map(()=>n):t.unionX.map(t=>{if(null===n)return k(t,i);const e=Array.isArray(n)?n.slice():n;return"object"===i?{x:t,y:e}:[t,e]});return{name:e.name||t.seriesNames[0]||"series-1",data:r}}function P(t,e={},i={}){const s=[],n=Array.isArray(t)?t:[],r=(l=i.chartType,!N.includes(l||""));var l;if(e.row||e.column)return e.by&&s.push("trellis: `by` is ignored when `row`/`column` are set (they are mutually exclusive)"),function(t,e,i,s=!0){const n=e.row,r=e.column,l=new Map,a=new Map,o=new Map,c=[],h=[],u=[],d=(t,e)=>{-1===t.indexOf(e)&&t.push(e)};if(t.forEach((t,e)=>{var i,s;const p=n?C(t,e,n):"",f=r?C(t,e,r):"";if(null===p&&null===f)return void c.push(t);if(null===p)return d(u,f),o.has(f)||o.set(f,[]),void(null==(i=o.get(f))||i.push(t));if(null===f)return d(h,p),a.has(p)||a.set(p,[]),void(null==(s=a.get(p))||s.push(t));d(h,p),d(u,f);let m=l.get(p);m||(m=new Map,l.set(p,m));let g=m.get(f);g||(g=[],m.set(f,g)),g.push(t)}),!h.length&&!u.length)return W(["trellis: no series carries the row/column facet keys; nothing to split"]);"number"==typeof e.limit&&e.limit>0&&i.push("trellis: `limit` is not applied to a 2-D grid; ignoring it");const p=L(h.length?h:[""],e.order),f=L(u.length?u:[""],e.order),m=F(t,i),{align:g,seriesNames:y}=H(m,i,s),x=[];return p.forEach(t=>{f.forEach(e=>{var i;const s=((null==(i=l.get(t))?void 0:i.get(e))||[]).concat(a.get(t)||[]).concat(o.get(e)||[]).concat(c).map(g);x.push({key:[t,e].filter(t=>""!==t).join(" / ")||"all",rowKey:t,colKey:e,series:s,seriesNames:s.map(t=>t.name),empty:0===s.length})})}),{mode:"2d",panels:x,rowKeys:p,colKeys:f,seriesNames:y,xForm:m.sawKeyed?m.xForm:"plain",unionX:m.sawKeyed?m.unionX:Array.from({length:m.plainMaxLen},(t,e)=>e),xIsNumeric:m.xIsNumeric,dropped:0,warnings:i}}(n,e,s,r);const a=e.by||"facet",o=new Map,c=[];if(n.forEach((t,e)=>{const i=C(t,e,a);if(null===i)c.push(t);else{o.has(i)||o.set(i,[]);const e=o.get(i);e&&e.push(t)}}),0===o.size)return W(["trellis: no series carries the facet key; nothing to split"]);let h=L(Array.from(o.keys()),e.order),u=0;"number"==typeof e.limit&&e.limit>0&&h.length>e.limit&&(u=h.length-e.limit,h=h.slice(0,e.limit));const d=F(h.reduce((t,e)=>t.concat(o.get(e)||[]),[]).concat(c),s),{align:p,seriesNames:f}=H(d,s,r);return{mode:"1d",panels:h.map(t=>{const e=(o.get(t)||[]).map(p),i=c.map(p),s=e.concat(i);return{key:t,rowKey:null,colKey:null,series:s,seriesNames:s.map(t=>t.name),empty:0===s.length}}),rowKeys:null,colKeys:null,seriesNames:f,xForm:d.sawKeyed?d.xForm:"plain",unionX:d.sawKeyed?d.unionX:Array.from({length:d.plainMaxLen},(t,e)=>e),xIsNumeric:d.xIsNumeric,dropped:u,warnings:s}}function W(t){return{mode:"1d",panels:[],rowKeys:null,colKeys:null,seriesNames:[],xForm:"plain",unionX:[],xIsNumeric:!1,dropped:0,warnings:t}}function $(t,e){const i=t.length;if(0===i)return NaN;if(1===i)return t[0];const s=(i-1)*e,n=Math.floor(s),r=Math.ceil(s);return n===r?t[n]:t[n]+(t[r]-t[n])*(s-n)}function z(t,e={}){if(!Array.isArray(t)||0===t.length)return null;const i=t.slice().sort((t,e)=>t-e);let s=i[0],n=i[i.length-1];const r=e.range;if(Array.isArray(r)&&2===r.length){const t=Number(r[0]),e=Number(r[1]);Number.isFinite(t)&&Number.isFinite(e)&&e>t&&(s=t,n=e)}if(!(n>s)){const t=Math.abs(s)>0?.05*Math.abs(s):.5;return{edges:[s-t,s+t],binWidth:2*t,rule:"single",capped:!1}}const l=n-s;let a,o;if("number"==typeof e.binWidth&&e.binWidth>0)a=e.binWidth,o="binWidth";else if("number"==typeof e.bins&&e.bins>=1)a=l/Math.floor(e.bins),o="count";else{const t=function(t,e,i){const s=t.length,n=t=>e/Math.max(1,Math.ceil(t)),r=()=>n(Math.log2(s)+1);switch(i){case"sqrt":return{width:n(Math.sqrt(s)),rule:"sqrt"};case"rice":return{width:n(2*Math.cbrt(s)),rule:"rice"};case"scott":{const e=function(t){const e=t.length;if(e<2)return 0;let i=0;for(let s=0;s<e;s++)i+=t[s];const s=i/e;let n=0;for(let i=0;i<e;i++){const e=t[i]-s;n+=e*e}return Math.sqrt(n/e)}(t);return e>0?{width:3.49*e*Math.pow(s,-1/3),rule:"scott"}:{width:r(),rule:"sturges"}}case"fd":{const e=$(t,.75)-$(t,.25);return e>0?{width:2*e*Math.pow(s,-1/3),rule:"fd"}:{width:r(),rule:"sturges"}}case"auto":{const e=r(),i=$(t,.75)-$(t,.25);if(i<=0)return{width:e,rule:"sturges"};const n=2*i*Math.pow(s,-1/3);return n<e?{width:n,rule:"fd"}:{width:e,rule:"sturges"}}default:return{width:r(),rule:"sturges"}}}(i,l,"string"==typeof e.bins?e.bins:"auto");a=t.width,o=t.rule}(!Number.isFinite(a)||a<=0)&&(a=l);let c=Math.ceil(l/a);(!Number.isFinite(c)||c<1)&&(c=1);let h=!1;c>1e3&&(c=1e3,h=!0),a=l/c;const u=new Array(c+1);for(let t=0;t<=c;t++)u[t]=s+t*a;return u[c]=Math.max(u[c],n),{edges:u,binWidth:a,rule:o,capped:h}}function B(t,e){const i=e.length-1;if(!(t>=e[0])||t>e[i])return-1;if(t===e[i])return i-1;const s=(e[i]-e[0])/i;if(s>0){let n=Math.floor((t-e[0])/s);return n<0&&(n=0),n>i-1&&(n=i-1),t<e[n]?n--:t>=e[n+1]&&n++,n<0||n>i-1?-1:n}let n=0,r=i-1;for(;n<=r;){const i=n+r>>1;if(t<e[i])r=i-1;else{if(!(t>=e[i+1]))return i;n=i+1}}return-1}function T(t,e={}){if(!Array.isArray(t)||0===t.length)return null;const i=t.slice().sort((t,e)=>t-e),s=i.length;let n=e.bandwidth;if(!("number"==typeof n&&n>0)){const t=function(t){const e=t.length;if(e<2)return 0;let i=0;for(let s=0;s<e;s++)i+=t[s];const s=i/e;let n=0;for(let i=0;i<e;i++){const e=t[i]-s;n+=e*e}return Math.sqrt(n/e)}(i),e=$(i,.75)-$(i,.25);n=.9*(e>0?Math.min(t,e/1.349):t)*Math.pow(s,-.2)}if(!isFinite(n)||n<=0){const t=i[0],e=Math.abs(t)>0?.001*Math.abs(t):.001;return{density:[[t-e,0],[t,1],[t+e,0]],bandwidth:e}}const r=Math.max(8,Math.floor(e.resolution||64)),l=i[0]-2*n,a=(i[s-1]+2*n-l)/(r-1),o=1/(s*n*Math.sqrt(2*Math.PI)),c=[];for(let t=0;t<r;t++){const e=l+t*a;let r=0;for(let t=0;t<s;t++){const s=(e-i[t])/n;r+=Math.exp(-.5*s*s)}c.push([e,r*o])}return{density:c,bandwidth:n}}const I=["heatmap","pie","donut","polarArea","radialBar"],R=["pie","donut","polarArea"];function K(t){const e=[];if(!Array.isArray(t))return e;for(let i=0;i<t.length;i++){const s=t[i];let n=s;Array.isArray(s)?n=1===s.length?s[0]:s[1]:s&&"object"==typeof s&&(n=void 0!==s.y?s.y:s.x);const r=Number(n);null!=n&&isFinite(r)&&e.push(r)}return e}function j(t,e,i,s){var n,r,l,a,o,c;const h={plotOptions:null,yExtentOverride:null,skipYaxisPush:I.includes(s),forceSharedY:!1,pieScaleOf:null,warnings:[]},u=t.panels,d=(null==i?void 0:i.plotOptions)||{};if("histogram"===s){const t=d.histogram||{};let i=[];const s=u.map(t=>t.series.map(t=>{const e=K(t.data);return i=i.concat(e),e})),r=z(i,{bins:t.bins,binWidth:t.binWidth,range:t.range});if(r&&r.edges.length>1){const i=r.edges;h.plotOptions={histogram:{range:[i[0],i[i.length-1]],binWidth:r.binWidth}};let l=0;s.forEach(e=>e.forEach(e=>{if(!e.length)return;(function(t,e={}){let i=t.slice();if(e.cumulative){let t=0;i=i.map(e=>t+=e)}const s=t.reduce((t,e)=>t+e,0);if(s<=0)return i;if("relative"===e.normalize)return i.map(t=>t/s*100);if("density"===e.normalize){const t=e.binWidth;if("number"==typeof t&&t>0)return i.map(e=>e/(s*t))}return i})(function(t,e){const i=new Array(Math.max(0,e.length-1)).fill(0);for(let s=0;s<t.length;s++){const n=B(t[s],e);n>=0&&i[n]++}return i}(e,i),{normalize:t.normalize,cumulative:t.cumulative,binWidth:r.binWidth}).forEach(t=>{isFinite(t)&&t>l&&(l=t)})})),l>0&&(h.yExtentOverride={min:0,max:l});const a=(null==(n=e.scales)?void 0:n.y)||"shared";"independent-row"!==a&&"independent-column"!==a||(h.forceSharedY=!0,h.warnings.push("histogram trellis: group y scales would re-derive counts per group; using scales.y 'shared' (use 'independent' for per-panel count scales)."))}}if("violin"===s){const t=(null==(r=d.violin)?void 0:r.kde)||{};if(!("number"==typeof t.bandwidth&&t.bandwidth>0)){let t=[];u.forEach(e=>e.series.forEach(e=>{t=t.concat(function(t){const e=[];return Array.isArray(t)?(t.forEach(t=>{const i=t&&"object"==typeof t?t.y:null;Array.isArray(i)&&i.forEach(t=>{const i=Number(t);null!=t&&isFinite(i)&&e.push(i)})}),e):e}(e.data))}));const e=t.length?T(t,{resolution:8}):null;e&&isFinite(e.bandwidth)&&e.bandwidth>0&&(h.plotOptions={violin:{kde:{bandwidth:e.bandwidth}}})}}if("heatmap"===s){"independent"===(null==(l=e.scales)?void 0:l.color)&&h.warnings.push("a heatmap trellis must share its color scale (the same color meaning different values per panel is a silent lie); ignoring scales.color 'independent'.");const t=null==(o=null==(a=d.heatmap)?void 0:a.colorScale)?void 0:o.ranges;if(!(Array.isArray(t)&&t.length>0)){let t=1/0,e=-1/0;u.forEach(i=>i.series.forEach(i=>{K(i.data).forEach(i=>{i<t&&(t=i),i>e&&(e=i)})})),isFinite(t)&&isFinite(e)&&(h.plotOptions={heatmap:{colorScale:{min:t,max:e}}})}}if("bubble"===s){"independent"===(null==(c=e.scales)?void 0:c.size)&&h.warnings.push("a bubble trellis must share its size scale; ignoring scales.size 'independent'.");let t=1/0,i=-1/0;u.forEach(e=>e.series.forEach(e=>{(function(t){const e=[];return Array.isArray(t)?(t.forEach(t=>{let i=null;Array.isArray(t)&&t.length>2?i=t[2]:t&&"object"==typeof t&&(i=t.z);const s=Number(i);null!=i&&isFinite(s)&&e.push(s)}),e):e})(e.data).forEach(e=>{e<t&&(t=e),e>i&&(i=e)})})),isFinite(t)&&isFinite(i)&&(h.plotOptions={bubble:{minZ:t,maxZ:i}})}if(R.includes(s)&&e.radiusByTotal){const t=new Map;let e=0;u.forEach(i=>{let s=0;i.series.forEach(t=>{K(t.data).forEach(t=>{s+=Math.abs(t)})}),t.set(i.key,s),s>e&&(e=s)}),e>0&&(h.pieScaleOf=i=>{const s=t.get(i);return"number"!=typeof s||s<=0?null:Math.sqrt(s/e)})}return h}const D=u.__apex_ThemePalettes_getThemePalettes;function X(t,e,i=3){if(!isFinite(t)||!isFinite(e))return{min:0,max:1,tickAmount:1};if(t===e){const i=0===t?1:.1*Math.abs(t);t-=i,e+=i}const s=Math.max(1,i),n=(e-t)/s,r=Math.pow(10,Math.floor(Math.log10(n)));let l={dist:1/0,ticks:0,min:0,max:1};return(r>=10?[1,2,2.5,5,10]:[1,2,5,10]).forEach(i=>{const n=i*r,a=Math.floor(t/n)*n,o=Math.ceil(e/n)*n,c=Math.max(1,Math.round((o-a)/n)),h=Math.abs(c-s);(h<l.dist||h===l.dist&&c<l.ticks)&&(l={dist:h,ticks:c,min:a,max:o})}),{min:l.min,max:l.max,tickAmount:l.ticks}}function Y(t,e,i){if(null==t)return;let s=t;if("paired"===e?s=t[1]:"object"===e&&(s=t.y),null==s)return;if(Array.isArray(s)){for(let t=0;t<s.length;t++){const e=Number(s[t]);isFinite(e)&&(e<i.min&&(i.min=e),e>i.max&&(i.max=e))}return}const n=Number(s);isFinite(n)&&(n<i.min&&(i.min=n),n>i.max&&(i.max=n))}function q(t,e,i){const s=e&&"object"==typeof e&&!Array.isArray(e)&&"highlight"in e?e.highlight:Array.isArray(t.highlightData)?t.highlightData[i]:null;return"number"==typeof s&&isFinite(s)?s:null}function G(t){if("number"!=typeof t||!isFinite(t)||t%1==0)return 0;const e=String(t);return-1!==e.indexOf("e")||-1!==e.indexOf("E")?4:Math.min(4,(e.split(".")[1]||"").length)}function V(t,e,i={}){const s={min:1/0,max:-1/0},n=t=>{isFinite(t)&&(t<s.min&&(s.min=t),t>s.max&&(s.max=t))};return t.forEach(t=>{const r=new Map;t.series.forEach(t=>{var n;if(!Array.isArray(t.data))return;if(!function(t,e){if(!e.stackOnlyBar)return!0;const i=t&&t.type;return null==i||"bar"===i||"column"===i}(t,i))return void t.data.forEach(t=>Y(t,e,s));const l=String(null!=(n=t.group)?n:""),a=t=>{const e=r.get(t)||{pos:[],neg:[]};return r.set(t,e),e},o=a(l),c=i.parts?a("~"+l):null;t.data.forEach((i,s)=>{[o,c].forEach((n,r)=>{if(!n)return;void 0===n.pos[s]&&(n.pos[s]=0,n.neg[s]=0);const l=r?q(t,i,s):(t=>{if(null==t)return null;const i="paired"===e?t[1]:"object"===e?t.y:t;if(null==i||Array.isArray(i))return null;const s=Number(i);return isFinite(s)?s:null})(i);null!==l&&(l>0?n.pos[s]+=l:n.neg[s]+=l)})})}),r.forEach(t=>{t.pos.forEach(n),t.neg.forEach(n)})}),isFinite(s.min)&&isFinite(s.max)?s:null}function U(t,e={},i={}){const s=e.scales||{},n=s.x||"shared",r=s.y||"shared";let l=null;if("shared"===n&&t.xIsNumeric&&t.unionX.length){const e=t.unionX;l={min:e[0],max:e[e.length-1]}}const a=["bar","column","histogram"].includes(i.chartType||""),o=t=>t?(a&&t.min>0&&(t.min=0),X(t.min,t.max,e.targetTicks||3)):null,c=!!i.stacked&&"100%"===i.stackType,h=!!i.stacked&&!c,u=e=>c?{min:0,max:100}:h?V(e,t.xForm,{stackOnlyBar:i.stackOnlyBar,parts:i.parts}):function(t,e,i=!1){const s={min:1/0,max:-1/0};return t.forEach(t=>t.series.forEach(t=>{Array.isArray(t.data)&&t.data.forEach((n,r)=>{Y(n,e,s);const l=i?q(t,n,r):null;null!==l&&Y(l,"plain",s)})})),isFinite(s.min)&&isFinite(s.max)?s:null}(e,t.xForm,i.parts);let d=null;"shared"===r&&(d=o(i.yExtentOverride||u(t.panels)));let p=null;if("independent-row"===r){p=new Map;const e=new Map;t.panels.forEach(t=>{var i;const s=null!=(i=t.rowKey)?i:"";e.has(s)||e.set(s,[]),e.get(s).push(t)}),e.forEach((t,e)=>{const i=o(u(t));i&&(null==p||p.set(e,i))})}let f=null;if("independent-column"===r){f=new Map;const e=new Map;t.panels.forEach(t=>{var i;const s=null!=(i=t.colKey)?i:"";e.has(s)||e.set(s,[]),e.get(s).push(t)}),e.forEach((t,e)=>{const i=o(u(t));i&&(null==f||f.set(e,i))})}const m=D().palette1,g=Array.isArray(i.userColors)?i.userColors.filter(t=>"string"==typeof t):[],y=g.length?g:m,x=t.seriesNames;return{x:l,y:d,rowY:p,colY:f,colorOf:t=>{const e=x.indexOf(t);return y[(-1===e?0:e)%y.length]},palette:y}}function Z({panelCount:t,containerWidth:e,cfg:i,hostHeight:s,chromeHeight:n}){var r,l;const a=null!=(r=i.gap)?r:12,o=function(t,e,i={}){var s,n;const r=null!=(s=i.gap)?s:12;if("number"==typeof i.columns&&i.columns>0)return Math.max(1,Math.min(Math.floor(i.columns),e));const l=null!=(n=i.minPanelWidth)?n:220,a=Math.floor((t+r)/(l+r));return Math.max(1,Math.min(a,e))}(e,t,i),c=Math.max(1,Math.ceil(t/o)),h=!i.header||!1!==i.header.show?22:0,u=Math.max(0,n||0),d=c*h+a*(c-1)+u,p="number"==typeof s&&s>0?s:0,f=Math.max(0,(e-a*(o-1))/o);let m;m="number"==typeof i.panelHeight&&i.panelHeight>0?i.panelHeight:p>0?(p-d)/c:f/(null!=(l=i.aspectRatio)?l:1.6);const g="number"==typeof i.minPanelHeight&&i.minPanelHeight>0?i.minPanelHeight:80;m=Math.max(g,Math.round(m));const y=c*(m+h)+a*(c-1),x=p>0?Math.max(0,y+u-p):0,v=i.axes&&i.axes.labels||"edges",b=i.scales||{},_=1===o,w=Array.from({length:t},(e,i)=>{const s=Math.floor(i/o),n=i%o;let r,l;return"none"===v?(r=!1,l=!1):"all"===v||_?(r=!0,l=!0):(r="independent"===b.x||s===function(t,e,i,s){return t<e-(s-1)*i?s-1:s-2}(n,t,o,c),l="independent"===b.y||"independent-column"===b.y||0===n),{i:i,r:s,c:n,showXLabels:r,showYLabels:l}});return{cols:o,rows:c,panelW:f,panelH:m,headerH:h,gap:a,cells:w,gridH:y,overflowH:x}}const J=u.__apex_Series,Q=["#cf4d3f","#8f9499","#26a75b"],tt=(t,e,i)=>t+(e-t)*i;function et(t){return Math.max(0,Math.min(255,Math.round(t))).toString(16).padStart(2,"0")}function it(t,e,i){const s=d.parseHex(st(t)),n=d.parseHex(st(e));return s&&n?"#"+et(tt(s[0],n[0],i))+et(tt(s[1],n[1],i))+et(tt(s[2],n[2],i)):t}function st(t){if("string"!=typeof t)return"#000000";if(d.isColorHex(t))return t;return d.rgb2hex(t)||"#000000"}function nt(t,e,i,s){var n,r,l;if(!e||"object"!=typeof e)return null;const a=null==(l=null==(r=null==(n=t.config.plotOptions)?void 0:n.treemap)?void 0:r.colorScale)?void 0:l.colorValue;let o;if(o="function"==typeof a?a(e,{seriesIndex:i,dataPointIndex:s,w:t}):"string"==typeof a?e[a]:e.colorValue,null==o)return null;const c=Number(o);return Number.isFinite(c)?c:null}function rt(t){var e,i,s;const n=null==(s=null==(i=null==(e=t.config)?void 0:e.plotOptions)?void 0:i.treemap)?void 0:s.colorScale,r=n&&n.gradient;if(!r)return null;if(!1===r.enabled)return null;const l=t.config.series||[];let a=1/0,o=-1/0,c=!1;for(let e=0;e<l.length;e++){const i=l[e]&&l[e].data;if(Array.isArray(i))for(let s=0;s<i.length;s++){const n=nt(t,i[s],e,s);null!=n&&(c=!0,n<a&&(a=n),n>o&&(o=n))}}if(!c&&!0!==r.enabled)return null;Number.isFinite(a)||(a=0,o=0);let h=Number.isFinite(Number(r.min))?Number(r.min):a,u=Number.isFinite(Number(r.max))?Number(r.max):o,d=null;if(null===r.midpoint?d=null:Number.isFinite(Number(r.midpoint))?d=Number(r.midpoint):h<0&&u>0&&(d=0),null!=d&&!1!==r.symmetric&&!Number.isFinite(Number(r.min))&&!Number.isFinite(Number(r.max))){const t=Math.max(Math.abs(h-d),Math.abs(u-d));h=d-t,u=d+t}u===h&&(h-=.5,u+=.5);const p=function(t,e,i,s){if(Array.isArray(t.stops)&&t.stops.length>=2)return t.stops.filter(t=>t&&Number.isFinite(Number(t.value))).map(t=>({value:Number(t.value),color:st(t.color)})).sort((t,e)=>t.value-e.value);const n=(Array.isArray(t.colors)&&t.colors.length>=2?t.colors:Q).map(st),r=n.length;if(null!=s&&r>=3){const t=Math.floor((r-1)/2),l=[];for(let i=0;i<=t;i++)l.push({value:tt(e,s,i/t),color:n[i]});for(let e=t+1;e<r;e++)l.push({value:tt(s,i,(e-t)/(r-1-t)),color:n[e]});return l}return n.map((t,s)=>({value:tt(e,i,s/(r-1)),color:t}))}(r,h,u,d);if(p.length<2)return null;const f=u-h,m=p.map(t=>({percent:0===f?0:(t.value-h)/f,color:t.color}));return{min:h,max:u,midpoint:d,stops:p,at:t=>{if(!Number.isFinite(t))return p[Math.floor(p.length/2)].color;if(t<=p[0].value)return p[0].color;const e=p[p.length-1];if(t>=e.value)return e.color;for(let e=1;e<p.length;e++){const i=p[e];if(t<=i.value){const s=p[e-1],n=i.value-s.value,r=0===n?0:(t-s.value)/n;return it(s.color,i.color,r)}}return e.color},legendStops:m}}const lt=u.__apex_tooltip_Utils,at="http://www.w3.org/2000/svg";class ot{constructor(t,e){this.w=t,this.ctx=e,this.svgEl=null,this.arrowEl=null,this.hoverValueEl=null,this._min=0,this._max=0,this._geom=null,this._grad=null,this._bandHitEls=[],this._activeBandIndex=-1,this._targetEl=null,this.panelsW=null,this._onCellEnter=this._onCellEnter.bind(this),this._onCellLeave=this._onCellLeave.bind(this),this._onBandEnter=this._onBandEnter.bind(this),this._onBandLeave=this._onBandLeave.bind(this)}_getFormatter(){const t=this._cfg();return"function"==typeof t.formatter?t.formatter:t=>{if(!Number.isFinite(t))return String(t);const e=Math.abs(t);return e>=1e3?t.toFixed(0):e>=10?t.toFixed(1):t.toFixed(2)}}static colorScaleOf(t){var e,i,s,n,r;const l=null==(i=null==(e=null==t?void 0:t.config)?void 0:e.chart)?void 0:i.type;return l&&(null==(r=null==(n=null==(s=null==t?void 0:t.config)?void 0:s.plotOptions)?void 0:n[l])?void 0:r.colorScale)||null}static configFor(t){const e=ot.colorScaleOf(t);return e&&e.gradientLegend||null}_cfg(){return ot.configFor(this.w)||{}}static isEnabled(t){if(!ot.supports(t))return!1;const e=ot.configFor(t);return!(!e||!e.enabled)}static supports(t){var e,i;const s=null==(i=null==(e=null==t?void 0:t.config)?void 0:e.chart)?void 0:i.type;return"heatmap"===s||"treemap"===s}draw(t=null){var e,i,s,n,r,l,a,o;const c=this.w;this._targetEl=t;const h=t||c.dom.elLegendWrap;if(!h)return;const u=this._cfg(),d=c.config.legend.position,p="left"===d||"right"===d,m=null!=(i=null==(e=u.arrow)?void 0:e.size)?i:8,g=m+4,y=u.showLabels?28:4,x=u.showLabels?20:4,v=u.showLabels?44:0,b=this._resolveStripLength(p?u.height:u.width,p),_=u.thickness,w=p?Math.max(_+g+4,v):b+2*y,A=p?b+2*x:_+g+4,E=(w-(_+g))/2,M=p?"left"===d?E:E+g:y,S=p?x:"top"===d?g:4,k=f.createElementNS(at,"svg");k.setAttribute("class","apexcharts-heatmap-gradient-legend apexcharts-gradient-legend"),k.setAttribute("width",String(w)),k.setAttribute("height",String(A)),k.setAttribute("overflow","visible");const C=f.createElementNS(at,"defs"),L=`apexcharts-heatmap-gradient-${c.globals.cuid}`,F=f.createElementNS(at,"linearGradient");F.setAttribute("id",L),p?(F.setAttribute("x1","0"),F.setAttribute("y1","1"),F.setAttribute("x2","0"),F.setAttribute("y2","0")):(F.setAttribute("x1","0"),F.setAttribute("y1","0"),F.setAttribute("x2","1"),F.setAttribute("y2","0")),this._grad=F;const{min:N,max:H,bands:O}=this._paintStops();C.appendChild(F),k.appendChild(C);const P=f.createElementNS(at,"rect");if(P.setAttribute("x",String(M)),P.setAttribute("y",String(S)),P.setAttribute("width",String(p?_:b)),P.setAttribute("height",String(p?b:_)),P.setAttribute("rx","2"),P.setAttribute("fill",`url(#${L})`),k.appendChild(P),u.showLabels){const t=(null==(s=u.labelStyle)?void 0:s.colors)||(Array.isArray(c.config.legend.labels.colors)?c.config.legend.labels.colors[0]:c.config.legend.labels.colors)||c.config.chart.foreColor,e=(null==(n=u.labelStyle)?void 0:n.fontSize)||"11px",i=(null==(r=u.labelStyle)?void 0:r.fontFamily)||c.config.chart.fontFamily,l=this._getFormatter(),a=(s,n,r,l)=>{const a=f.createElementNS(at,"text");return a.setAttribute("x",String(n)),a.setAttribute("y",String(r)),a.setAttribute("text-anchor",l),a.setAttribute("dominant-baseline","middle"),a.setAttribute("fill",t),a.setAttribute("font-size",e),i&&a.setAttribute("font-family",i),a.textContent=String(s),a};if(p){const t=M+_/2;k.appendChild(a(l(N),t,S+b+10,"middle")),k.appendChild(a(l(H),t,S-10,"middle"))}else{const t=S+_/2;k.appendChild(a(l(N),M-6,t,"end")),k.appendChild(a(l(H),M+b+6,t,"start"))}}const W=(null==(l=u.arrow)?void 0:l.color)||c.config.chart.foreColor,$=this._buildArrow(m,W,d);if(k.appendChild($),this.arrowEl=$,this._bandHitEls=[],c.config.legend.onItemHover.highlightDataSeries&&O.length>0&&O.forEach(t=>{const e=f.createElementNS(at,"rect");if(p){const i=S+b-t.p2*b,s=S+b-t.p1*b;e.setAttribute("x",String(M)),e.setAttribute("y",String(i)),e.setAttribute("width",String(_)),e.setAttribute("height",String(Math.max(0,s-i)))}else e.setAttribute("x",String(M+t.p1*b)),e.setAttribute("y",String(S)),e.setAttribute("width",String(Math.max(0,(t.p2-t.p1)*b))),e.setAttribute("height",String(_));e.setAttribute("fill","transparent"),e.setAttribute("class","apexcharts-heatmap-gradient-band"),e.setAttribute("data:range-index",String(t.index)),e.style.cursor="pointer",k.appendChild(e),this._bandHitEls.push(e)}),this._geom={isVertical:p,position:d,stripX:M,stripY:S,stripLength:b,stripThickness:_,arrowSize:m,svgWidth:w,svgHeight:A},u.showHoverValue){const t=f.createElement("div");t.classList.add("apexcharts-heatmap-gradient-legend-value"),t.style.position="absolute",t.style.fontSize=(null==(a=u.labelStyle)?void 0:a.fontSize)||"11px",t.style.fontFamily=(null==(o=u.labelStyle)?void 0:o.fontFamily)||c.config.chart.fontFamily||"",t.style.color=c.config.chart.foreColor,t.style.background="rgba(0,0,0,0.65)",t.style.color="#fff",t.style.padding="2px 6px",t.style.borderRadius="3px",t.style.pointerEvents="none",t.style.whiteSpace="nowrap",t.style.opacity="0",t.style.transition="opacity 120ms ease",this.hoverValueEl=t}h.classList.add("apexcharts-heatmap-gradient-legend-wrap"),h.classList.add("apx-legend-position-"+d),h.appendChild(k),this.hoverValueEl&&h.appendChild(this.hoverValueEl),this.svgEl=k,t?(h.style.width=w+"px",h.style.height=A+"px",h.style.position="relative",h.style.overflow="visible"):this._applyWrapAlignment(h,d,p,w,A),this._attachHoverListeners(),this._attachBandHoverListeners()}_resolveStripLength(t,e){const i=this.w,s=e?i.globals.svgHeight||i.config.chart.height||300:i.globals.svgWidth||i.config.chart.width||600;if("string"==typeof t){const e=t.trim();if(e.endsWith("%")){const t=parseFloat(e)||0;return Math.max(20,s*t/100)}const i=parseFloat(e);return Number.isFinite(i)?i:200}return"number"==typeof t&&Number.isFinite(t)?t:200}_applyWrapAlignment(t,e,i,s,n){const r=this.w,l=this._cfg().align||"center",a=12,o=r.globals.svgWidth||r.config.chart.width||600,c=r.globals.svgHeight||r.config.chart.height||300,h=r.config.legend.offsetX||0,u=r.config.legend.offsetY||0;if(t.style.position="absolute",t.style.display="block",t.style.overflow="visible",t.style.padding="0",t.style.width=s+"px",t.style.height=n+"px",t.style.right="auto",t.style.bottom="auto",i){const i=c-n-24;let r;r="start"===l?a:"end"===l?a+Math.max(0,i):a+Math.max(0,i)/2,t.style.top=r+u+"px",t.style.left="left"===e?a+h+"px":o-s-a+h+"px"}else{const i=o-s-24;let r;r="start"===l?a:"end"===l?a+Math.max(0,i):a+Math.max(0,i)/2,t.style.left=r+h+"px",t.style.top="top"===e?a+u+"px":c-n-a+u+"px"}}repositionToPlot(){var t,e;if(this._grad&&this._paintStops(),!p.isBrowser())return;if(this._targetEl)return;const i=this.w,s=i.globals,n=i.dom.elLegendWrap;if(!n||!this._geom)return;if(!Number.isFinite(s.gridWidth)||!Number.isFinite(s.gridHeight))return;const{isVertical:r,position:l,svgWidth:a,svgHeight:o,stripX:c,stripY:h,stripThickness:u}=this._geom,d=this._cfg().align||"center",m=i.config.legend.offsetX||0,g=i.config.legend.offsetY||0,y=null==(e=null==(t=this.ctx)?void 0:t.dimensions)?void 0:e.dimHelpers,x=y?y.getTitleSubtitleCoords("title").height+y.getTitleSubtitleCoords("subtitle").height:0,v=i.layout.xAxisHeight||0,b=(t,e)=>{const i=Math.max(0,t-e);return"start"===d?0:"end"===d?i:i/2};if(r){n.style.top=s.translateY+b(s.gridHeight,o)+g+"px";const t=(("left"===l?0:s.translateX+s.gridWidth)+("left"===l?s.translateX:s.svgWidth))/2;n.style.left=t-c-u/2+m+"px"}else{n.style.left=s.translateX+b(s.gridWidth,a)+m+"px";const t=(("top"===l?x:s.translateY+s.gridHeight+v)+("top"===l?s.translateY:s.svgHeight))/2;n.style.top=t-h-u/2+g+"px"}f.requestAnimationFrame(()=>this._enforceMinPlotGap())}_enforceMinPlotGap(){const t=this.w,e=t.dom.elLegendWrap,i=this.svgEl&&this.svgEl.querySelector("rect");if(!e||!i||!this._geom)return;if(!t.dom.baseEl||!t.dom.baseEl.querySelector(".apexcharts-svg"))return;const s=i.getBoundingClientRect(),n=lt.plotRect(t);if(!(s.width&&s.height&&n.width&&n.height))return;const r=n.left,l=n.left+n.width,a=n.top,o=n.top+n.height,c=n.zoom,{isVertical:h,position:u}=this._geom;if(h){const t=("left"===u?r-s.right:s.left-l)/c;if(t<16){const i=parseFloat(e.style.left)||0,s=16-t;e.style.left=i+("left"===u?-s:s)+"px"}}else{const t=("top"===u?a-s.bottom:s.top-o)/c;if(t<16){const i=parseFloat(e.style.top)||0,s=16-t;e.style.top=i+("top"===u?-s:s)+"px"}}}destroy(){var t,e,i,s,n,r,l;for(let i=0;i<this._bandHitEls.length;i++){const s=this._bandHitEls[i];null==(t=s.removeEventListener)||t.call(s,"mousemove",this._onBandEnter),null==(e=s.removeEventListener)||e.call(s,"mouseout",this._onBandLeave)}if(this._bandHitEls=[],this._activeBandIndex=-1,null==(i=this.ctx)?void 0:i.events)try{null==(n=(s=this.ctx.events).removeEventListener)||n.call(s,"dataPointMouseEnter",this._onCellEnter),null==(l=(r=this.ctx.events).removeEventListener)||l.call(r,"dataPointMouseLeave",this._onCellLeave)}catch(t){}}_attachBandHoverListeners(){if(p.isBrowser())for(let t=0;t<this._bandHitEls.length;t++){const e=this._bandHitEls[t];e.addEventListener("mousemove",this._onBandEnter),e.addEventListener("mouseout",this._onBandLeave)}}_onBandEnter(t){var e,i,s,n;const r=this.w,l=t.currentTarget,a=parseInt(null!=(e=l.getAttribute("data:range-index"))?e:"-1",10);a<0||a===this._activeBandIndex||(this._activeBandIndex=a,null==(n=null==(s=null==(i=this.ctx)?void 0:i.events)?void 0:s.fireEvent)||n.call(s,"legendHover",[this.ctx,a,r]),this._highlightRange(a,"highlight"))}_onBandLeave(){if(this._activeBandIndex<0)return;const t=this._activeBandIndex;this._activeBandIndex=-1,this._highlightRange(t,"reset")}_highlightRange(t,e){var i;((null==(i=this.panelsW)?void 0:i.call(this))||[this.w]).forEach(i=>new J(i).highlightRangeInSeries(t,e))}_attachHoverListeners(){var t,e;p.isBrowser()&&(null==(e=null==(t=this.ctx)?void 0:t.events)?void 0:e.addEventListener)&&(this.ctx.events.addEventListener("dataPointMouseEnter",this._onCellEnter),this.ctx.events.addEventListener("dataPointMouseLeave",this._onCellLeave))}_onCellEnter(...t){var e,i,s;if(!this.arrowEl)return;const n=t[t.length-1];if(!n||"object"!=typeof n)return;const r=n.w||this.w,l=n.seriesIndex,a=n.dataPointIndex;if("number"!=typeof l||"number"!=typeof a)return;if(!ot.supports(r))return;let o;o=this._continuous?function(t,e,i){const s=t.config.series[e];return nt(t,s&&Array.isArray(s.data)?s.data[i]:null,e,i)}(r,l,a):null==(s=null==(i=null==(e=r.seriesData)?void 0:e.series)?void 0:i[l])?void 0:s[a],null==o||Number.isNaN(o)||this._positionArrow(o)}_onCellLeave(){this.arrowEl&&(this.arrowEl.setAttribute("opacity","0"),this.hoverValueEl&&(this.hoverValueEl.style.opacity="0"))}_positionArrow(t){if(!this.arrowEl||!this._geom)return;const{isVertical:e,position:i,stripX:s,stripY:n,stripLength:r,stripThickness:l,arrowSize:a}=this._geom,o=this._min,c=this._max-o;let h;if(h=0===c?.5:(t-o)/c,h<0&&(h=0),h>1&&(h=1),e){const t=n+r-h*r;let e,o;"left"===i?(e=s+l,o=e+a):(e=s,o=e-a);const c=[`${e},${t}`,`${o},${t-a/2}`,`${o},${t+a/2}`].join(" ");this.arrowEl.setAttribute("points",c)}else{const t=s+h*r;let e,o;"top"===i?(e=n+l,o=e+a):(e=n,o=e-a);const c=[`${t},${e}`,`${t-a/2},${o}`,`${t+a/2},${o}`].join(" ");this.arrowEl.setAttribute("points",c)}if(this.arrowEl.setAttribute("opacity","1"),this.hoverValueEl){const o=this._getFormatter();if(this.hoverValueEl.textContent=o(t),e){const t=n+r-h*r;"left"===i?this.hoverValueEl.style.left=`${s+l+a+8}px`:(this.hoverValueEl.style.left=s-a-8+"px",this.hoverValueEl.style.transform="translateX(-100%)"),this.hoverValueEl.style.top=t-9+"px"}else{const t=s+h*r;this.hoverValueEl.style.left=`${t}px`,this.hoverValueEl.style.transform="translateX(-50%)",this.hoverValueEl.style.top="top"===i?`${n+l+a+8}px`:n-a-18+"px"}this.hoverValueEl.style.opacity="1"}}_buildArrow(t,e,i){const s=f.createElementNS(at,"polygon");return s.setAttribute("fill",e),s.setAttribute("opacity","0"),s.setAttribute("class","apexcharts-heatmap-gradient-arrow"),s.setAttribute("points","0,0 0,0 0,0"),s.setAttribute("pointer-events","none"),s}_paintStops(){const t=this._computeStops(),e=this._grad;return this._min=t.min,this._max=t.max,e.innerHTML="",t.stops.forEach(t=>{const i=f.createElementNS(at,"stop");i.setAttribute("offset",`${(100*t.percent).toFixed(2)}%`),i.setAttribute("stop-color",t.color),e.appendChild(i)}),t}_computeStops(){var t,e;const i=this.w,s=ot.colorScaleOf(i)||{},n=this._cfg(),r=rt(i);if(r)return this._continuous=!0,{min:r.min,max:r.max,stops:r.legendStops,bands:[]};this._continuous=!1;let l=1/0,c=-1/0;const h=(null==(t=i.seriesData)?void 0:t.series)||[];for(let t=0;t<h.length;t++){const e=h[t];if(e)for(let t=0;t<e.length;t++){const i=e[t];null==i||Number.isNaN(i)||(i<l&&(l=i),i>c&&(c=i))}}Number.isFinite(l)||(l=0),Number.isFinite(c)||(c=0);let u=l,p=c;const f=void 0!==s.min&&void 0!==s.max&&s.max>s.min;f?(u=s.min,p=s.max):(void 0!==s.min&&(u=s.min<l?s.min:l),void 0!==s.max&&(p=s.max>c?s.max:c));const m=[],g=[];if(s.ranges&&s.ranges.length>0){const t=s.ranges.map((t,e)=>o(a({},t),{_originalIndex:e})).sort((t,e)=>t.from-e.from),e=t[0].from,i=t[t.length-1].to;u=e,p=i;const n=i-e||1;t.forEach(t=>{const i=(t.from-e)/n,s=(t.to-e)/n;m.push({percent:(i+s)/2,color:t.color}),g.push({index:t._originalIndex,p1:i,p2:s})})}else{const t=i.globals.colors[0]||"#008FFB",r=new d,l=i.config.chart.type,a=i.config.plotOptions[l]||{},o=null!=(e=a.shadeIntensity)?e:.5,c=i.globals,h=c.hasNegs,g="heatmap"===l&&!a.distributed&&!f&&c.maxY>=c.minY,y=g?c.maxY:p,x=Math.abs(y)+Math.abs(g?s.min<c.minY?s.min:c.minY:u),v=1.25*o,b=Math.max(2,n.stops||16);for(let e=0;e<b;e++){const s=e/(b-1),n=0===x?0:Math.min(u+s*(p-u),y)/x,c=Math.max(-1,Math.min(1,h?a.reverseNegativeShade?(n<0?n:1-n)*v:n<=0?1-(1+n)*o:(1-n)*o:(1-n)*("treemap"===l?v:1))),d=a.enableShades?r.shadeColor("dark"===i.config.theme.mode?-c:c,t):t;m.push({percent:s,color:d})}}return{min:u,max:p,stops:m,bands:g}}}const ct={zoom:'<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8"><circle cx="10.5" cy="10.5" r="6"/><path d="M15 15l5 5"/><path d="M8 10.5h5M10.5 8v5"/></svg>',pan:'<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8"><path d="M12 3v18M3 12h18"/><path d="M9 6l3-3 3 3M9 18l3 3 3-3M6 9l-3 3 3 3M18 9l3 3-3 3"/></svg>',reset:'<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8"><path d="M4 10a8 8 0 1 1 2 6"/><path d="M4 4v6h6"/></svg>',download:'<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8"><path d="M12 4v11"/><path d="M7 11l5 5 5-5"/><path d="M4 20h16"/></svg>'};class ht{constructor(t){this.trellis=t,this.elLegend=null,this.elToolbar=null,this.elTitle=null,this.elBreadcrumb=null,this.gradientLegend=null,this._gradPending=null,this._gradWire=null}buildHeader(t,e,i){const s=this.trellis,n=s.cfg.header||{};if(!1===n.show)return;const r=f.createElement("div");r.className="apexcharts-trellis-header";let l=e;"function"==typeof n.formatter&&(l=n.formatter(e,{dimension:"string"==typeof s.cfg.by?s.cfg.by:void 0,index:i.index,count:i.count})),r.textContent=null==l?"":String(l);const a=n.style||{};if(a.fontSize&&(r.style.fontSize=a.fontSize),a.fontWeight&&(r.style.fontWeight=String(a.fontWeight)),a.color&&(r.style.color=a.color),!1!==s.cfg.promote){r.classList.add("apexcharts-trellis-header-clickable"),r.setAttribute("role","button"),r.setAttribute("tabindex","0"),r.setAttribute("title","Expand this panel");const t=()=>{s._promotedKey===e?s.restorePromotion():s.promote(e)};r.addEventListener("click",t),r.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),t())})}t.appendChild(r)}stripEl(t,e,i){const s=this.trellis.cfg.header||{},n=f.createElement("div");n.className=`apexcharts-trellis-strip apexcharts-trellis-strip-${t}`;let r=e;"function"==typeof s.formatter&&(r=s.formatter(e,{dimension:t,index:i.index,count:i.count})),n.textContent=null==r?"":String(r);const l=s.style||{};return l.fontSize&&(n.style.fontSize=l.fontSize),l.fontWeight&&(n.style.fontWeight=String(l.fontWeight)),l.color&&(n.style.color=l.color),n}buildBreadcrumb(t,e,i){this.removeBreadcrumb();const s=f.createElement("div");s.className="apexcharts-trellis-breadcrumb";const n=f.createElement("button");n.setAttribute("type","button"),n.className="apexcharts-trellis-breadcrumb-back",n.textContent="All panels",n.addEventListener("click",i);const r=f.createElement("span");r.className="apexcharts-trellis-breadcrumb-sep",r.textContent="/";const l=f.createElement("span");l.className="apexcharts-trellis-breadcrumb-current",l.textContent=e,s.appendChild(n),s.appendChild(r),s.appendChild(l),t.appendChild(s),this.elBreadcrumb=s}removeBreadcrumb(){this.elBreadcrumb&&this.elBreadcrumb.parentNode&&this.elBreadcrumb.parentNode.removeChild(this.elBreadcrumb),this.elBreadcrumb=null}buildTitle(t){const e=this.trellis.w.config.title;if(!e||!e.text)return;const i=f.createElement("div");i.className="apexcharts-trellis-title",i.textContent=e.text;const s=e.style||{};s.fontSize&&(i.style.fontSize=s.fontSize),s.color&&(i.style.color=s.color),t.appendChild(i),this.elTitle=i}buildLegend(t){const e=this.trellis;if("shared"!==(e.cfg.legend||"shared"))return;if("heatmap"===e.w.config.chart.type)return void this.buildGradientLegend(t);const i=e.split?e.split.seriesNames:[];if(i.length<2)return;const s=f.createElement("div");s.className="apexcharts-trellis-legend apexcharts-legend",s.setAttribute("role","list"),i.forEach(t=>{const i=f.createElement("div");i.className="apexcharts-legend-series apexcharts-trellis-legend-item",i.setAttribute("role","listitem"),i.setAttribute("tabindex","0"),i.setAttribute("data:collapsed","false");const n=f.createElement("span");n.className="apexcharts-legend-marker",n.style.background=e.scales?e.scales.colorOf(t):"#008FFB";const r=f.createElement("span");r.className="apexcharts-legend-text",r.textContent=t,i.appendChild(n),i.appendChild(r);const l=()=>{const s=e.sync.toggleSeries(t);i.classList.toggle("apexcharts-inactive-legend",s),i.setAttribute("data:collapsed",String(s))};i.addEventListener("click",l),i.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),l())}),s.appendChild(i)}),t.appendChild(s),this.elLegend=s}refreshLegendColors(){const t=this.trellis,e=this.elLegend,i=t.scales;if(!e||!i)return;e.querySelectorAll(".apexcharts-trellis-legend-item").forEach(t=>{var e;const s=null==(e=t.querySelector(".apexcharts-legend-text"))?void 0:e.textContent,n=t.querySelector(".apexcharts-legend-marker");s&&n&&(n.style.background=i.colorOf(s))})}buildGradientLegend(t){const e=this.trellis,i=e.panels.find(t=>t.chart);if(!i){if(this._gradPending)return;const i=()=>{var s,n;this._gradPending=null,null==(n=(s=e.ctx.events).removeEventListener)||n.call(s,"panelMounted",i),this.buildGradientLegend(t)};return this._gradPending=i,void e.ctx.events.addEventListener("panelMounted",i)}const s=f.createElement("div");s.className="apexcharts-trellis-legend apexcharts-trellis-gradient-legend",t.appendChild(s),this.elLegend=s;const n=i.chart,r=new ot(n.w,n.ctx);r.draw(s),this.gradientLegend=r,r.panelsW=()=>e.panels.filter(t=>t.chart).map(t=>t.chart.w);const l=(t,e)=>{var i;const s=e.chart!==n&&(null==(i=e.chart)?void 0:i.ctx.events);s&&(s.addEventListener("dataPointMouseEnter",r._onCellEnter),s.addEventListener("dataPointMouseLeave",r._onCellLeave))};e.panels.forEach(t=>l(0,t)),e.ctx.events.addEventListener("panelMounted",l),this._gradWire=l}destroyGradientLegend(){var t,e;const i=this.trellis;if(this._gradPending&&(null==(e=(t=i.ctx.events).removeEventListener)||e.call(t,"panelMounted",this._gradPending),this._gradPending=null),i.ctx.events.removeEventListener("panelMounted",this._gradWire),this.gradientLegend){try{this.gradientLegend.destroy()}catch(t){}this.gradientLegend=null}}buildToolbar(t){const e=this.trellis;if("shared"!==(e.cfg.toolbar||"shared"))return;const i=f.createElement("div");i.className="apexcharts-trellis-toolbar";const s={},n=t=>{e.panels.forEach(e=>{if(!e.chart)return;const i=e.chart.w.interact;i.zoomEnabled="zoom"===t,i.panEnabled="pan"===t,i.selectionEnabled=!1}),s.zoom.classList.toggle("apexcharts-selected","zoom"===t),s.pan.classList.toggle("apexcharts-selected","pan"===t),s.zoom.setAttribute("aria-pressed",String("zoom"===t)),s.pan.setAttribute("aria-pressed",String("pan"===t))},r=(t,e,n)=>{const r=f.createElement("button");return r.className=`apexcharts-trellis-tool apexcharts-trellis-tool-${t}`,r.setAttribute("type","button"),r.setAttribute("aria-label",e),r.setAttribute("title",e),r.innerHTML=ct[t],r.addEventListener("click",n),s[t]=r,i.appendChild(r),r};if(r("zoom","Selection zoom",()=>n("zoom")),r("pan","Pan",()=>n("pan")),r("reset","Reset zoom",()=>{e.sync.resetAll()}),e.ctx.exports){const t=f.createElement("div");t.className="apexcharts-trellis-menu",[["png","Download PNG"],["svg","Download SVG"],["csv","Download CSV"]].forEach(([i,s])=>{const n=f.createElement("button");n.setAttribute("type","button"),n.className="apexcharts-trellis-menu-item",n.textContent=s,n.addEventListener("click",()=>{t.classList.remove("apexcharts-trellis-menu-open"),e.exports.download(i)}),t.appendChild(n)}),r("download","Download",()=>{t.classList.toggle("apexcharts-trellis-menu-open")}),i.appendChild(t)}s.zoom.classList.add("apexcharts-selected"),s.zoom.setAttribute("aria-pressed","true"),s.pan.setAttribute("aria-pressed","false"),t.appendChild(i),this.elToolbar=i,t.classList.add("apexcharts-trellis-has-toolbar")}}function ut(t,e){const i=d.clone(t.w.config.yaxis);return(Array.isArray(i)?i:[i]).map(t=>d.extend(t,e))}class dt{constructor(t){this.trellis=t,this._syncing=!1,this._hidden=new Set,this.currentWindow=null}_noteWindow(t,e){const i=t&&t.xaxis;i&&null!=i.min&&null!=i.max?this.currentWindow={x:{min:i.min,max:i.max},y:this.currentWindow&&this.currentWindow.y||null,zoomed:e||!(!this.currentWindow||!this.currentWindow.zoomed)}:e&&(this.currentWindow=null)}makeZoomedHandler(t){return(e,i)=>{"function"==typeof t&&t(e,i),this._noteWindow(i,!0),this.onZoomed(i)}}makeScrolledHandler(t){return(e,i)=>{"function"==typeof t&&t(e,i),this._noteWindow(i,!1)}}onZoomed(t){const e=this.trellis;if(this._syncing)return;const i=e.cfg;if(!i||"shared"!==(i.scales.y||"shared"))return;if(!e.autoScaleYaxis)return;const s=t&&t.xaxis;if(!s||null==s.min||null==s.max)return;if(!e.split||!e.split.xIsNumeric)return;const n=function(t,e,i,s,n=!1){const r={min:1/0,max:-1/0};return t.forEach(t=>t.series.forEach(t=>{Array.isArray(t.data)&&t.data.forEach((l,a)=>{if(null==l)return;const o="paired"===e?l[0]:"object"===e?l.x:null,c=o instanceof Date?o.getTime():Number(o);if(!isFinite(c)||c<i||c>s)return;Y(l,e,r);const h=n?q(t,l,a):null;null!==h&&Y(h,"plain",r)})})),isFinite(r.min)&&isFinite(r.max)?r:null}(e.split.panels,e.split.xForm,s.min,s.max,e._stackingHost().parts);if(!n)return;const r=X(n.min,n.max,i.targetTicks||3);this.currentWindow&&(this.currentWindow.y={min:r.min,max:r.max,tickAmount:r.tickAmount}),this._syncing=!0;const l=e.panels.map(t=>t.chart?t.chart.updateOptions({yaxis:ut(t.chart,{min:r.min,max:r.max,tickAmount:r.tickAmount})},!1,!1,!1).catch(()=>{}):Promise.resolve());Promise.all(l).finally(()=>{this._syncing=!1})}resetAll(){const t=this.trellis;this.currentWindow=null;const e=t.scales&&t.scales.x?{min:t.scales.x.min,max:t.scales.x.max}:{min:void 0,max:void 0};this._syncing=!0;const i=t.panels.map(i=>{if(!i.chart)return Promise.resolve();i.chart.w.interact.zoomed=!1;const s={xaxis:e},n=t.split?t._yBoundsFor(t.split.panels[i.index]):null;return n&&(s.yaxis=ut(i.chart,{min:n.min,max:n.max,tickAmount:n.tickAmount})),i.chart.updateOptions(s,!1,!1,!1).catch(()=>{})});return Promise.all(i).finally(()=>{this._syncing=!1})}toggleSeries(t){const e=!this._hidden.has(t);return e?this._hidden.add(t):this._hidden.delete(t),this.trellis.panels.forEach(i=>{const s=i.chart;if(!s)return;if(-1!==(s.w.seriesData.seriesNames||[]).indexOf(t))try{e?s.hideSeries(t):s.showSeries(t)}catch(t){}}),e}isHidden(t){return this._hidden.has(t)}applyHiddenTo(t){if(!this._hidden.size||!t)return;const e=t.w.seriesData&&t.w.seriesData.seriesNames||[];this._hidden.forEach(i=>{if(-1!==e.indexOf(i))try{t.hideSeries(i)}catch(t){}})}wireCrosshairs(t){let e=0,i=null;const s=()=>{const t=i&&i.closest?i.closest(".apexcharts-trellis-cell"):null,e=t?t.querySelector(".apexcharts-xcrosshairs"):null,s=e&&e.classList.contains("apexcharts-active");this.trellis.panels.forEach(i=>{if(!i.cellEl||i.cellEl===t)return;const n=i.cellEl.querySelector(".apexcharts-xcrosshairs");n&&(s?(n.setAttribute("x",e.getAttribute("x")||"0"),n.setAttribute("x1",e.getAttribute("x1")||"0"),n.setAttribute("x2",e.getAttribute("x2")||"0"),n.classList.add("apexcharts-active")):n.classList.remove("apexcharts-active"))})},n=()=>{if(t!==this.trellis.elGrid)return e=0;s(),e=i?requestAnimationFrame(n):0};t.addEventListener("mousemove",t=>{i=t.target,e||(e=requestAnimationFrame(n))},{passive:!0}),t.addEventListener("mouseleave",()=>{i=null,e&&(cancelAnimationFrame(e),e=0),this.trellis.panels.forEach(t=>{const e=t.cellEl&&t.cellEl.querySelector(".apexcharts-xcrosshairs");e&&e.classList.remove("apexcharts-active")})},{passive:!0})}}function pt(t,e){const i=null!=t,s=null!=e;return i||s?{min:i?t:null,max:s?e:null}:null}function ft(t,e){return"function"==typeof t&&e?t===e.addXaxisAnnotation?"xaxis":t===e.addYaxisAnnotation?"yaxis":t===e.addPointAnnotation?"point":null:null}function mt(t,e){const i=t.config.annotations?d.clone(t.config.annotations):null,s=[],n=t.globals.memory&&t.globals.memory.methodsToExec||[];for(const t of n){if(!t||"addAnnotation"!==t.label)continue;const i=ft(t.method,e);i&&s.push({kind:i,params:d.clone(t.params)})}return{static:i,dynamic:s}}function gt(t){const e=t&&t.measure;if(!e||"function"!=typeof e.getPins)return null;const i=e.getPins();return Array.isArray(i)&&i.length?{pins:i}:null}class yt{constructor(t){this.trellis=t,this.active=!1,this._io=null,this._byCell=new Map,this._dirty=new Set,this._raf=null,this._draining=!1,this._gutterFloor=0}static supported(){return"undefined"!=typeof IntersectionObserver}_rootMargin(){const t=this.trellis.layout,e=t?Math.max(0,Math.round(t.panelH+t.headerH+t.gap)):300;return`${e}px 0px ${e}px 0px`}start(){yt.supported()&&(this.active=!0,this._io=new IntersectionObserver(t=>this._onEntries(t),{root:null,rootMargin:this._rootMargin(),threshold:0}),this.trellis.panels.forEach(t=>{var e;t.wantMounted=!1,t.cellEl&&(this._byCell.set(t.cellEl,t),null==(e=this._io)||e.observe(t.cellEl))}))}refresh(){this.active&&this._io&&(this._io.disconnect(),this._io=new IntersectionObserver(t=>this._onEntries(t),{root:null,rootMargin:this._rootMargin(),threshold:0}),this._byCell.forEach((t,e)=>{var i;return null==(i=this._io)?void 0:i.observe(e)}))}_onEntries(t){if(this.active){for(const e of t){const t=this._byCell.get(e.target);t&&(t.wantMounted=e.isIntersecting,this._dirty.add(t))}this._schedule()}}_schedule(){var t;this._raf||this._draining||!this.active||(this._raf=(t=()=>{this._raf=null,this._drain()},"function"==typeof requestAnimationFrame?{kind:"raf",id:requestAnimationFrame(t)}:{kind:"timeout",id:setTimeout(()=>t(0),16)}))}_drain(){return c(this,null,function*(){if(!this._draining&&this.active){this._draining=!0;try{let t=0,e=0;for(;this.active&&this._dirty.size&&t<2&&e<6;){const i=this._dirty.values().next().value;this._dirty.delete(i);const s=!!i.wantMounted;s!==!!i.chart&&(e++,s?(t++,yield this._mount(i)):this._unmount(i))}}finally{this._draining=!1,this.active&&this._dirty.size?this._schedule():this.active&&(this.trellis.w.globals.animationEnded=!0)}}})}_liveWindow(t){const e=this.trellis.panels.find(e=>e!==t&&e.chart);if(!e||!e.chart)return null;const i=e.chart.w,s=i.config.xaxis||{},n=Array.isArray(i.config.yaxis)?i.config.yaxis[0]:i.config.yaxis;return{zoomed:!!i.interact.zoomed,x:null!=s.min||null!=s.max?{min:s.min,max:s.max}:null,y:!n||null==n.min&&null==n.max?null:{min:n.min,max:n.max,tickAmount:n.tickAmount}}}_patchYaxis(t,e){const i=Array.isArray(t.yaxis)?t.yaxis:t.yaxis?[t.yaxis]:[{}];i.forEach(t=>{Object.keys(e).forEach(i=>{"labels"===i?t.labels=a(a({},t.labels||{}),e.labels):t[i]=e[i]})}),t.yaxis=i}_mount(t){return c(this,null,function*(){var e,i,s,n,r,l,c,h;const u=this.trellis;if(!t.el||t.chart||t.noMount)return;const d=t.viewStash,p="shared"===u._yMode(),f=!p,m=u._assemblePanelOptions(t.index,{noAnimation:!!d}),g=d&&d.window;g&&g.xaxis&&(m.xaxis=o(a({},m.xaxis||{}),{min:null!=(e=g.xaxis.min)?e:void 0,max:null!=(i=g.xaxis.max)?i:void 0})),f&&g&&Array.isArray(g.yaxis)&&g.yaxis[0]&&this._patchYaxis(m,{min:null!=(s=g.yaxis[0].min)?s:void 0,max:null!=(n=g.yaxis[0].max)?n:void 0});const y=this._liveWindow(t);y&&y.x&&(m.xaxis=o(a({},m.xaxis||{}),{min:y.x.min,max:y.x.max})),y&&y.y&&p&&this._patchYaxis(m,a({min:y.y.min,max:y.y.max},null!=y.y.tickAmount?{tickAmount:y.y.tickAmount}:{}));const x=u.sync.currentWindow;x&&x.x&&(m.xaxis=o(a({},m.xaxis||{}),{min:x.x.min,max:x.x.max})),x&&x.y&&p&&this._patchYaxis(m,a({min:x.y.min,max:x.y.max},null!=x.y.tickAmount?{tickAmount:x.y.tickAmount}:{})),f&&this._gutterFloor>0&&this._patchYaxis(m,{labels:{minWidth:this._gutterFloor}}),t.el.classList.remove("apexcharts-trellis-skeleton");const v=new u._ApexCharts(t.el,m);t.chart=v;try{yield v.render()}catch(e){return t.chart=null,void t.el.classList.add("apexcharts-trellis-skeleton")}if(this.active){if(v.w.interact.zoomed=x?!!x.zoomed:y?y.zoomed:!(!d||!d.zoomed),u.sync.applyHiddenTo(v),d&&d.annotations&&Array.isArray(d.annotations.dynamic)){const t={xaxis:"addXaxisAnnotation",yaxis:"addYaxisAnnotation",point:"addPointAnnotation"},e=v;d.annotations.dynamic.forEach(i=>{const s=t[i.kind];s&&"function"==typeof e[s]&&e[s](i.params,!0)})}if(t.viewStash=null,f){const t=null==(h=null==(c=null==(l=null==(r=v.w)?void 0:r.globals)?void 0:l.yLabelsCoords)?void 0:c[0])?void 0:h.width;if("number"==typeof t&&isFinite(t)){const e=v.w.globals.isBarHorizontal?0:u._yLabelPad(),i=Math.max(0,t-e);i>this._gutterFloor+.5&&(this._gutterFloor=i,yield u._pushGutterFloor(this._gutterFloor))}}u._fire("panelMounted",{key:t.key,index:t.index,chart:v,remounted:!!d})}})}_unmount(t){if(t.chart){try{t.viewStash=function(t,e){var i,s;const n=t.config.xaxis||{},r=(Array.isArray(t.config.yaxis)?t.config.yaxis:t.config.yaxis?[t.config.yaxis]:[]).map(t=>pt(t&&t.min,t&&t.max)),l=r.some(t=>null!==t),a=t.config.theme,o=e&&e.drilldown;return{v:1,window:{xaxis:pt(n.min,n.max),yaxis:l?r:null},zoomed:!!t.interact.zoomed,collapsed:(t.globals.collapsedSeriesIndices||[]).slice(),ancillaryCollapsed:(t.globals.ancillaryCollapsedSeriesIndices||[]).slice(),selectedDataPoints:(c=t.interact.selectedDataPoints,Array.isArray(c)?c.map(t=>Array.isArray(t)?t.slice():t):[]),theme:a?{mode:null!=(i=a.mode)?i:null,palette:null!=(s=a.palette)?s:null}:null,locale:t.config.chart&&t.config.chart.defaultLocale||null,annotations:mt(t,e),drill:o&&o.depth>0?{path:o.path.slice()}:null,measure:gt(e)};var c}(t.chart.w,t.chart)}catch(e){t.viewStash=null}try{t.chart.destroy()}catch(t){}if(t.chart=null,t.el){t.el.classList.add("apexcharts-trellis-skeleton");const e=this.trellis.layout;e&&(t.el.style.minHeight=`${e.panelH}px`)}}}stop(){var t;this.active=!1,this._io&&(this._io.disconnect(),this._io=null),this._byCell.clear(),this._dirty.clear(),(t=this._raf)&&("raf"===t.kind?cancelAnimationFrame(t.id):clearTimeout(t.id)),this._raf=null,this._gutterFloor=0}}class xt{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)/xt.xRatio(t)}static pxToDataX(t,e){return t.globals.minX+e*xt.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(),r=t.globals.svgWidth?n.width/t.globals.svgWidth:1;return(e-n.left)/(r||1)-t.layout.translateX}}const vt=["bar","column","rangeBar","candlestick","boxPlot","violin"];class bt{constructor(t){this.trellis=t,this.el=null,this._raf=0,this._lastEvent=null}wire(t,e){const i=f.createElement("div");i.className="apexcharts-trellis-tooltip apexcharts-theme-light",i.setAttribute("role","status"),e.appendChild(i),this.el=i;const s=()=>{this._update(e),this._raf=this._lastEvent?requestAnimationFrame(s):0};t.addEventListener("mousemove",t=>{this._lastEvent=t,this._raf||(this._raf=requestAnimationFrame(s))},{passive:!0}),t.addEventListener("mouseleave",()=>{this._lastEvent=null,this._raf&&(cancelAnimationFrame(this._raf),this._raf=0),i.classList.remove("apexcharts-trellis-tooltip-active")},{passive:!0})}_hoverIndex(t,e,i){const s=t.w,n=s.globals.dataPoints;if(!n||n<1)return-1;const r=s.layout.gridWidth;if(!r)return-1;const l=xt.screenXToPlotPx(s,e),a=s.globals.barPadForNumericAxis||0;if(l<-a||l>r+a)return-1;const o=s.dom&&s.dom.baseEl;if(o&&o.querySelector(".apexcharts-svg")){const t=lt.plotRect(s);if(t.height&&(i<t.top||i>t.top+t.height))return-1}const c=(-1!==vt.indexOf(s.config.chart.type)||"between"===s.config.xaxis.tickPlacement)&&!s.config.xaxis.convertedCatToNumeric?Math.ceil(l/(r/n))-1:Math.round(l/(r/Math.max(1,n-1)));return Math.max(0,Math.min(n-1,c))}_valueAt(t,e,i,s){var n,r;const l=t.series.find(t=>t.name===e);if(!l||!Array.isArray(l.data))return null;const a=l.data[s];if(null==a)return null;let o=a;if(Array.isArray(a)?o=a[1]:"object"==typeof a&&(o=a.y),null==o)return null;const c=this.trellis.w.config,h=Array.isArray(null==(n=c.tooltip)?void 0:n.y)?c.tooltip.y[i]:null==(r=c.tooltip)?void 0:r.y,u=Array.isArray(c.yaxis)?c.yaxis[0]:c.yaxis,d=h&&"function"==typeof h.formatter&&h.formatter||u&&u.labels&&"function"==typeof u.labels.formatter&&u.labels.formatter||null,p=t=>{if(d)try{return String(d(t,{seriesIndex:i,dataPointIndex:s,w:null}))}catch(e){return String(t)}return String(t)};return Array.isArray(o)?o.map(p).join(" / "):p(o)}_update(t){const e=this.trellis,i=this.el,s=this._lastEvent;if(!i||!s||!e.split)return;const n=s.target&&s.target.closest?s.target.closest(".apexcharts-trellis-cell"):null,r=n?e.panels.find(t=>t.cellEl===n):void 0,l=r&&r.chart?this._hoverIndex(r.chart,s.clientX,s.clientY):-1;if(!r||-1===l)return void i.classList.remove("apexcharts-trellis-tooltip-active");const a=n?n.querySelector(".apexcharts-tooltip-title"):null,o=a&&a.textContent?a.textContent:"",c=e.split.seriesNames,h=e.scales,u=[];e.split.panels.forEach(t=>{const e=[];c.forEach((i,s)=>{const n=this._valueAt(t,i,s,l);if(null===n)return;const r=h?h.colorOf(i):"#008FFB";e.push(`<span class="apexcharts-trellis-tooltip-val"><span class="apexcharts-trellis-tooltip-marker" style="background:${wt(r)}"></span>${_t(n)}</span>`)});const i=t.key===r.key;u.push(`<div class="apexcharts-trellis-tooltip-row${i?" apexcharts-trellis-tooltip-row-active":""}" data-key="${wt(t.key)}"><span class="apexcharts-trellis-tooltip-key">${_t(t.key)}</span><span class="apexcharts-trellis-tooltip-vals">${e.join("")}</span></div>`)});let d="";o&&(d+=`<div class="apexcharts-tooltip-title">${_t(o)}</div>`),d+=u.join(""),i.innerHTML=d,i.classList.add("apexcharts-trellis-tooltip-active");const p=t.getBoundingClientRect(),f=lt.plotRect(r.chart.w).zoom;let m=(s.clientX-p.left)/f+14,g=(s.clientY-p.top)/f+14;const y=i.offsetWidth,x=i.offsetHeight,v=p.width/f,b=p.height/f;m+y>v-4&&(m=Math.max(4,m-y-28)),g+x>b-4&&(g=Math.max(4,g-x-28)),i.style.left=`${Math.round(m)}px`,i.style.top=`${Math.round(g)}px`}destroy(){this._raf&&(cancelAnimationFrame(this._raf),this._raf=0),this._lastEvent=null,this.el&&this.el.parentNode&&this.el.parentNode.removeChild(this.el),this.el=null}}function _t(t){return String(t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function wt(t){return String(t).replace(/"/g,""")}class At{constructor(t){this.trellis=t}supported(){return!!this.trellis.ctx.exports}_rectIn(t){const e=this.trellis.elWrap.getBoundingClientRect(),i=t.getBoundingClientRect();return{x:i.left-e.left,y:i.top-e.top,w:i.width,h:i.height}}_size(){const t=this.trellis.elWrap.getBoundingClientRect();return{w:Math.ceil(t.width),h:Math.ceil(t.height)}}_background(){const t=this.trellis.panels.find(t=>t.chart),e=t&&t.chart.exports;if(e&&"function"==typeof e.resolveExportBackground){const t=e.resolveExportBackground();if(t&&"transparent"!==t)return t}return"#fff"}_chromeTexts(){const t=this.trellis,e=[],i=(t,i)=>{if(!t||!t.textContent)return;const s=this._rectIn(t),n=getComputedStyle(t);e.push({text:t.textContent,x:"center"===i?s.x+s.w/2:s.x,y:s.y+s.h/2,font:`${n.fontWeight} ${n.fontSize} ${n.fontFamily}`,fontSize:parseFloat(n.fontSize)||12,color:n.color||"#373d3f",align:i})};return i(t.chrome.elTitle,"left"),t.panels.forEach(t=>{t.cellEl&&i(t.cellEl.querySelector(".apexcharts-trellis-header"),"center")}),t.chrome.elLegend&&t.chrome.elLegend.querySelectorAll(".apexcharts-legend-text").forEach(t=>i(t,"left")),e}_legendMarkers(){const t=this.trellis.chrome.elLegend;return t?Array.from(t.querySelectorAll(".apexcharts-legend-marker"),t=>({rect:this._rectIn(t),color:t.style.background||t.style.backgroundColor||"#008FFB"})):[]}dataURI(){return c(this,arguments,function*(t={}){const e=this.trellis,i=t.scale||1,s=this._size(),n=document.createElement("canvas");n.width=s.w*i,n.height=s.h*i;const r=n.getContext("2d");if(!r)return{imgURI:""};const l=r;l.scale(i,i),l.fillStyle=this._background(),l.fillRect(0,0,s.w,s.h);for(const t of e.panels){if(!t.el)continue;const e=this._rectIn(t.el);if(!t.chart){l.fillStyle="rgba(120, 120, 120, 0.06)",l.fillRect(e.x,e.y,e.w,e.h);continue}const{imgURI:s}=yield t.chart.dataURI({scale:i});if(!s)continue;const n=yield Et(s);l.drawImage(n,e.x,e.y,e.w,e.h)}for(const t of this._chromeTexts())l.font=t.font,l.fillStyle=t.color,l.textAlign=t.align,l.textBaseline="middle",l.fillText(t.text,t.x,t.y);for(const t of this._legendMarkers())l.fillStyle=t.color,l.beginPath(),l.arc(t.rect.x+t.rect.w/2,t.rect.y+t.rect.h/2,Math.max(2,t.rect.w/2),0,2*Math.PI),l.fill();return{imgURI:n.toDataURL("image/png")}})}svgString(t=1){return c(this,null,function*(){const e=this.trellis,i=this._size(),s=[];s.push(`<svg xmlns="http://www.w3.org/2000/svg" width="${i.w*t}" height="${i.h*t}" viewBox="0 0 ${i.w} ${i.h}">`),s.push(`<rect width="${i.w}" height="${i.h}" fill="${this._background()}"/>`);for(const t of e.panels){if(!t.el)continue;const e=this._rectIn(t.el);if(!t.chart){s.push(`<rect x="${e.x}" y="${e.y}" width="${e.w}" height="${e.h}" fill="rgba(120,120,120,0.06)" rx="4"/>`);continue}const i=yield t.chart.getSvgString();s.push(`<g transform="translate(${e.x}, ${e.y})">${i}</g>`)}for(const t of this._chromeTexts()){const e="center"===t.align?"middle":"start";s.push(`<text x="${t.x}" y="${t.y}" text-anchor="${e}" dominant-baseline="central" style="font:${kt(t.font)};fill:${kt(t.color)}">${St(t.text)}</text>`)}for(const t of this._legendMarkers())s.push(`<circle cx="${t.rect.x+t.rect.w/2}" cy="${t.rect.y+t.rect.h/2}" r="${Math.max(2,t.rect.w/2)}" fill="${kt(t.color)}"/>`);return s.push("</svg>"),s.join("")})}csv(t={}){var e,i,s;const n=this.trellis,r=n.split;if(!r)return"";const l=n.w,a=t.columnDelimiter||(null==(s=null==(i=null==(e=l.config.chart.toolbar)?void 0:e.export)?void 0:i.csv)?void 0:s.columnDelimiter)||",",o=l.config.xaxis&&"datetime"===l.config.xaxis.type,c=t=>{if(null==t)return"";const e=String(t);return/[",\n]/.test(e)||-1!==e.indexOf(a)?`"${e.replace(/"/g,'""')}"`:e},h=t=>o&&"number"==typeof t?new Date(t).toISOString():t,u=r.seriesNames,d=[["x","facet",...u].map(c).join(a)];return r.panels.forEach(t=>{r.unionX.forEach((e,i)=>{const s=[h(e),t.key];u.forEach(e=>{const n=t.series.find(t=>t.name===e);if(!n||!Array.isArray(n.data))return void s.push("");const r=n.data[i];let l=r;Array.isArray(r)?l=r[1]:r&&"object"==typeof r&&(l=r.y),s.push(Array.isArray(l)?l.join("|"):l)}),d.push(s.map(c).join(a))})}),d.join(t.lineDelimiter||"\n")}download(t){return c(this,arguments,function*(t,e={}){var i;const s=this.trellis,n=(null==(i=s.w.config.chart.toolbar)?void 0:i.export)||{},r=String(s.w.globals.chartID||"trellis");if("png"===t){const{imgURI:t}=yield this.dataURI();Mt(t,n.png&&n.png.filename||r,".png")}else if("svg"===t){const t=yield this.svgString();Mt("data:image/svg+xml;charset=utf-8,"+encodeURIComponent(t),n.svg&&n.svg.filename||r,".svg")}else{Mt("data:text/csv;charset=utf-8,"+encodeURIComponent("\ufeff"+this.csv(e)),e.fileName||n.csv&&n.csv.filename||r,".csv")}})}}function Et(t){return new Promise((e,i)=>{const s=new Image;s.onload=()=>e(s),s.onerror=i,s.src=t})}function Mt(t,e,i){const s=document.createElement("a");s.href=t,s.download=e+i,document.body.appendChild(s),s.click(),document.body.removeChild(s)}function St(t){return String(t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function kt(t){return String(t).replace(/"/g,""")}const Ct=["annotations","colors","dataLabels","fill","forecastDataPoints","grid","markers","noData","states","stroke","tooltip"],Lt={treemap:"trellis does not support treemap: area encoding needs room a panel cannot give. Rendering a single chart.",sunburst:"trellis does not support sunburst: its labels are illegible at panel size. Rendering a single chart.",unit:"the unit type has its own small-multiples mode (plotOptions.unit.grid.split), which beats a trellis of unit charts. Rendering a single chart."};u.default.registerFeatures({trellis:class{constructor(t,e){this.w=t,this.ctx=e,this.panels=[],this._stripEls=[],this.split=null,this.scales=null,this.layout=null,this.cfg={},this.sync=new dt(this),this.chrome=new ht(this),this.virtual=new yt(this),this.exports=new At(this),this.gridTooltip=null,this._promotedKey=null,this._ApexCharts=u.default,this._virtualActive=!1,this._panelRenderer=null,this._yLabelDecimals=0,this.elWrap=null,this.elGrid=null,this._mounted=!1,this._rendering=!1,this._renderPromise=null,this._raf=0,this._lastWidth=0,this._lastHeight=0,this._chromeH=0,this._overflowWarned=!1,this._resizeHandler=this._onContainerResize.bind(this),this.autoScaleYaxis=!1,this._elChromeTop=null,this._vetoWarned=!1,this._noKeyWarned=!1,this._frames=null}isActive(){var t;const e=this.w.config.trellis;if(!e||!(e.by||e.row||e.column))return!1;const i=null==(t=this.w.config.chart)?void 0:t.type;if(i&&Lt[i])return this._vetoWarned||(this._vetoWarned=!0,console.warn(`ApexCharts: ${Lt[i]}`)),!1;if(e.by&&!e.row&&!e.column&&!Array.isArray(e.data)){if(!(this.w.config.series||[]).some((t,i)=>null!==C(t,i,e.by))){if(!this._noKeyWarned){this._noKeyWarned=!0;const t="function"==typeof e.by?"the `trellis.by` function returned no key for any series":`no series carries the \`trellis.by\` key '${e.by}'`;console.warn(`ApexCharts: ${t}; there is nothing to split. Rendering as a single chart.`)}return!1}}return!0}_layoutCfg(){return this.split&&"2d"===this.split.mode&&this.split.colKeys?o(a({},this.cfg),{columns:this.split.colKeys.length}):this.cfg}_stackingHost(){var t,e;const i=this.w.config,s=i.chart||{},n=i.highlightFilter||{};return{stacked:!!s.stacked,stackType:s.stackType,stackOnlyBar:!!s.stackOnlyBar,parts:!!E._featureRegistry.get("highlightFilter")&&!1!==n.enabled&&"clamp"!==n.axis&&["bar","line","area"].includes(s.type)&&!(null==(e=null==(t=i.plotOptions)?void 0:t.bar)?void 0:e.isFunnel)}}_yMode(){var t;return this._frames&&this._frames.forceSharedY?"shared":(null==(t=this.cfg.scales)?void 0:t.y)||"shared"}_yBoundsFor(t){var e,i;const s=this.scales;if(!s)return null;if(this._frames&&this._frames.skipYaxisPush)return null;const n=this._yMode();return"shared"===n?s.y:"independent-row"===n&&s.rowY?s.rowY.get(null!=(e=t.rowKey)?e:"")||null:"independent-column"===n&&s.colY&&s.colY.get(null!=(i=t.colKey)?i:"")||null}_valueAxisIsX(){var t,e;const i=this.w.config;return["bar","boxPlot","violin"].includes(i.chart.type)&&!!(null==(e=null==(t=i.plotOptions)?void 0:t.bar)?void 0:e.horizontal)}_valueAxisXPatch(t){var e,i;const s={min:t.min,max:t.max};return"number"!=typeof(null==(i=null==(e=this.ctx.opts)?void 0:e.xaxis)?void 0:i.tickAmount)&&(s.tickAmount=t.tickAmount),s}_groupId(){return`${this.w.globals.chartID}-tg`}_fire(t,e){var i,s;const n=null==(s=null==(i=this.w.config.chart)?void 0:i.events)?void 0:s[t];"function"==typeof n&&n(this.ctx,e),this.ctx.events.fireEvent(t,[this.ctx,e])}render(){const t=this._render();return this._renderPromise=t,t}whenSettled(){return this._rendering&&this._renderPromise?this._renderPromise.catch(()=>{}):Promise.resolve()}_render(){return c(this,null,function*(){var t,e,i,s;const n=this.w;if(!this._mounted&&!this._rendering)if(p.isBrowser()){this._rendering=!0;try{this.cfg=n.config.trellis||{},this.autoScaleYaxis=!!(null==(e=null==(t=n.config.chart)?void 0:t.zoom)?void 0:e.autoScaleYaxis);let r=n.config.series||[];if(Array.isArray(this.cfg.data)){const t=function(t,e={}){const i=[],s=e.by;if("string"!=typeof s||!s)return{series:[],warnings:["trellis: tidy-row input (trellis.data) needs a string `by` column name"]};const n=e.x,r=e.y;if(!n||!r)return{series:[],warnings:["trellis: tidy-row input (trellis.data) needs `x` and `y` column names"]};const l=Array.isArray(t)?t:[];if(!l.length)return{series:[],warnings:["trellis: trellis.data is empty"]};const a=e.seriesBy;let o=0,c=0;const h=new Map;l.forEach(t=>{if(!t||"object"!=typeof t)return void o++;const e=t[s],i=t[n];if(null==e||null==i)return void o++;const l=a&&void 0!==t[a]&&null!==t[a]?String(t[a]):String(r);let u=h.get(String(e));u||(u=new Map,h.set(String(e),u));let d=u.get(l);d||(d=new Map,u.set(l,d));const p=i instanceof Date?i.getTime():i;d.has(p)&&c++;const f=t[r];d.set(p,void 0===f?null:f)}),o&&i.push(`trellis: ${o} row(s) missing "${s}" or "${n}" were skipped`),c&&i.push(`trellis: ${c} duplicate (panel, series, x) row(s); kept the last. Aggregate the rows first if you want sums or means.`);const u=[];return h.forEach((t,e)=>{t.forEach((t,i)=>{u.push({name:i,[s]:e,data:Array.from(t,([t,e])=>({x:t,y:e}))})})}),{series:u,warnings:i}}(this.cfg.data,this.cfg);t.warnings.forEach(t=>console.warn(`ApexCharts: ${t}`)),t.series.length&&(r.length&&console.warn("ApexCharts: trellis received both `series` and `trellis.data`; using trellis.data."),r=t.series)}const l=P(r,this.cfg,{chartType:n.config.chart.type});if(this.split=l,l.warnings.forEach(t=>console.warn(`ApexCharts: ${t}`)),!l.panels.length)return;l.dropped>0&&console.warn(`ApexCharts: trellis rendered ${l.panels.length} panels; ${l.dropped} more hidden by trellis.limit.`);const c=null!=(i=this.cfg.virtualize)?i:"auto";let h=!0===c||"auto"===c&&l.panels.length>64;h&&!yt.supported()&&(console.warn("ApexCharts: trellis virtualization needs IntersectionObserver; rendering eagerly."),h=!1),this._virtualActive=h,!h&&l.panels.length>64&&console.warn(`ApexCharts: trellis with ${l.panels.length} panels renders eagerly; set trellis.virtualize (or trellis.limit).`),l.panels.length>256&&console.warn(`ApexCharts: ${l.panels.length} trellis panels is a lot to read at once; consider trellis.limit.`);const d="histogram"===n.config.chart.requestedType?"histogram":n.config.chart.type;this._frames=j(l,this.cfg,n.config,d),this._frames.warnings.forEach(t=>console.warn(`ApexCharts: ${t}`)),this._yLabelDecimals=this._frames.yExtentOverride?0:function(t){let e=0;const i=t=>{const i=G(t);i>e&&(e=i)};return t.forEach(t=>t.series.forEach(t=>{Array.isArray(t.data)&&t.data.forEach(t=>{if(null==t)return;let e=t;Array.isArray(t)?e=t[1]:"object"==typeof t&&(e=t.y),Array.isArray(e)?e.forEach(i):i(e)})})),e}(l.panels);const p=this._yMode()!==((null==(s=this.cfg.scales)?void 0:s.y)||"shared")?o(a({},this.cfg),{scales:o(a({},this.cfg.scales||{}),{y:this._yMode()})}):this.cfg;this.scales=U(l,p,a({chartType:n.config.chart.type,userColors:this.ctx.opts&&this.ctx.opts.colors,yExtentOverride:this._frames.yExtentOverride},this._stackingHost())),this._panelRenderer=function(t,e,i,s){if(i&&i.chart&&i.chart.renderer)return null;if(!s)return null;const n={config:{series:t.panels.reduce((t,e)=>t.concat(e.series),[]),chart:{type:e.chart.type},markers:e.markers,dataLabels:e.dataLabels,fill:e.fill,plotOptions:e.plotOptions,states:e.states}};if(b(n))return null;const r=e.chart.rendererThreshold||8e3;return v(n)>=r?"canvas":null}(l,n.config,this.ctx.opts,A._rendererRegistry.has("canvas")),this._buildSkeleton();const f=this._containerWidth();this._lastWidth=f,this._lastHeight=this._hostHeight()||0,this._chromeH=0,this.layout=Z({panelCount:l.panels.length,containerWidth:f,cfg:this._layoutCfg(),hostHeight:this._hostHeight(),chromeHeight:this._chromeH}),this._applyGridStyle(),this._buildCells();const g="shared"!==this._yMode(),y=this.elWrap;if(h)this.virtual.start();else{g&&(y.style.visibility="hidden");for(let t=0;t<this.panels.length;t++){const e=this.panels[t];if(e.noMount)continue;const i=this._assemblePanelOptions(e.index),s=new u.default(e.el,i);e.chart=s,yield s.render(),this._fire("panelMounted",{key:e.key,index:e.index,chart:s})}g&&(yield this._alignGutters(),y.style.visibility="")}this.chrome.buildTitle(this._elChromeTop),this.chrome.buildToolbar(y),this.chrome.buildLegend(y),this.sync.wireCrosshairs(this.elGrid),"grid"===(this.cfg.tooltip||"panel")&&(this.gridTooltip=new bt(this),this.gridTooltip.wire(this.elGrid,y)),this._mounted=!0,this._refitForChrome(),m(this.ctx.el,this._resizeHandler),h||(n.globals.animationEnded=!0),this._fire("trellisMounted",{panels:this.getPanels()})}finally{this._rendering=!1}}else console.warn("ApexCharts: trellis rendering is browser-only in this version; SSR hosts render nothing.")})}_containerWidth(){const t=this.ctx.el;return t.getBoundingClientRect().width||t.clientWidth||800}_hostHeight(){var t;const e=this.w.config.chart&&this.w.config.chart.height;if(null==e||""===e||"auto"===e)return;const i=String(e).trim();if(i.endsWith("%")){const e=parseFloat(i);if(!isFinite(e)||e<=0)return;const s=null==(t=this.ctx.el)?void 0:t.parentNode;if(!s||"function"!=typeof s.getBoundingClientRect)return;const n=(s.getBoundingClientRect().height||s.clientHeight||0)*e/100;return n>0?n:void 0}const s=parseFloat(i);return isFinite(s)&&s>0?s:void 0}_chromeHeight(){const t=this.elWrap,e=this.elGrid;if(!t||!e||"function"!=typeof t.getBoundingClientRect)return 0;const i=t.getBoundingClientRect().height-e.getBoundingClientRect().height;return isFinite(i)&&i>0?i:0}_buildSkeleton(){var t;const e=this.ctx.el,i=f.createElementNS("http://www.w3.org/1999/xhtml","div");i.className="apexcharts-trellis",this.split&&"2d"===this.split.mode&&i.classList.add("apexcharts-trellis-2d"),i.id=`apexcharts-trellis${this.w.globals.chartID}`,i.setAttribute("data-tooltip-mode",this.cfg.tooltip||"panel");const s=null==(t=this.w.config.chart)?void 0:t.foreColor;s&&i.style.setProperty("--apx-trellis-fore",s);const n=f.createElement("div");n.className="apexcharts-trellis-chrome",i.appendChild(n),this._elChromeTop=n;const r=f.createElement("div");r.className="apexcharts-trellis-grid",i.appendChild(r),e.appendChild(i),this.elWrap=i,this.elGrid=r,this.w.dom.baseEl=e,this.w.dom.elWrap=i}_applyGridStyle(){var t;const e=this.elGrid,i=this.layout;e.style.display="grid";const s=this.split&&"2d"===this.split.mode&&!1!==(null==(t=this.cfg.header)?void 0:t.show);e.style.gridTemplateColumns=s?`auto repeat(${i.cols}, minmax(0, 1fr))`:`repeat(${i.cols}, minmax(0, 1fr))`,e.style.gap=`${i.gap}px`}_buildCells(){var t;const e=this.elGrid,i=this.split,s=this.layout,n="2d"===i.mode,r=n&&!1!==(null==(t=this.cfg.header)?void 0:t.show);this._stripEls=[];const l=this.cfg.emptyPanels||"placeholder";if(r){const t=f.createElement("div");t.className="apexcharts-trellis-corner",e.appendChild(t),this._stripEls.push(t),(i.colKeys||[]).forEach((t,s)=>{const n=this.chrome.stripEl("column",t,{index:s,count:(i.colKeys||[]).length});e.appendChild(n),this._stripEls.push(n)})}this.panels=[],i.panels.forEach((t,a)=>{var o;if(r&&a%s.cols===0){const t=Math.floor(a/s.cols),n=this.chrome.stripEl("row",null!=(o=(i.rowKeys||[])[t])?o:"",{index:t,count:(i.rowKeys||[]).length});e.appendChild(n),this._stripEls.push(n)}const c=f.createElement("div");c.className="apexcharts-trellis-cell",c.setAttribute("data-key",t.key),this._applyCellMutes(c,s.cells[a]),n||this.chrome.buildHeader(c,t.key,{index:a,count:i.panels.length});const h=f.createElement("div");h.className="apexcharts-trellis-panel",this._virtualActive&&(h.classList.add("apexcharts-trellis-skeleton"),h.style.minHeight=`${s.panelH}px`),c.appendChild(h);const u=t.empty&&"placeholder"!==l;if(t.empty)if(c.classList.add("apexcharts-trellis-cell-empty"),"hide"===l)c.classList.add("apexcharts-trellis-cell-hidden");else if("skip"===l)h.classList.add("apexcharts-trellis-skeleton"),h.style.minHeight=`${s.panelH}px`;else{const t=f.createElement("div");t.className="apexcharts-trellis-empty-label",t.textContent=this.w.config.noData&&this.w.config.noData.text||"no data",c.appendChild(t)}e.appendChild(c),this.panels.push({key:t.key,index:a,el:h,cellEl:c,chart:null,empty:t.empty,noMount:u})})}_applyCellMutes(t,e){t.classList.toggle("apexcharts-trellis-mute-x",!e.showXLabels),t.classList.toggle("apexcharts-trellis-mute-y",!e.showYLabels)}_assemblePanelOptions(t,{noAnimation:e=!1}={}){var i,s,n,r,l,c,h,u,p,f,m,g,y,x;const v=this.w,b=this.split,_=this.scales,w=this.layout,A=b.panels[t],E=d.clone(this.ctx.opts||{});delete E.trellis,delete E.series,delete E.responsive,E.annotations&&(E.annotations=function(t,e){if(!t||"object"!=typeof t)return t;const i=a({},t);for(const t of["yaxis","xaxis","points","texts","images"]){const s=i[t];Array.isArray(s)&&(i[t]=s.filter(t=>!t||void 0===t.scope||null===t.scope||"trellis"===t.scope||(Array.isArray(t.scope)?-1!==t.scope.map(String).indexOf(e):String(t.scope)===e)).map(t=>{if(!t||void 0===t.scope)return t;const e=a({},t);return delete e.scope,e}))}return i}(E.annotations,A.key));const M=E.chart||{},S=M.events||{},k=v.globals.chartID,C=null==(n=null==(s=null==(i=this.ctx.opts)?void 0:i.chart)?void 0:s.animations)?void 0:n.enabled,L=e||b.panels.length>16&&void 0===C,F=A.empty&&"placeholder"===(this.cfg.emptyPanels||"placeholder");let N=F?[O(b,{chartType:v.config.chart.type})]:A.series;const H=["pie","donut","polarArea","radialBar"].includes(v.config.chart.type);H&&(N=N.flatMap(t=>Array.isArray(t.data)?t.data:[]).map(t=>"number"==typeof t&&isFinite(t)?t:0));const P=a(a(o(a({chart:o(a(a({id:`${k}-tp${t}`,group:this._groupId(),height:w.panelH,width:"100%",redrawOnParentResize:!1,redrawOnWindowResize:!1,print:{enabled:!1},parentHeightOffset:0,toolbar:{show:!1},zoom:{enabled:"none"!==this.cfg.zoom,resetControl:"none"==this.cfg.toolbar&&!1!==v.config.chart.zoom.resetControl}},L?{animations:{enabled:!1}}:{}),this._panelRenderer?{renderer:this._panelRenderer}:{}),{events:o(a({},S),{zoomed:this.sync.makeZoomedHandler(S.zoomed),scrolled:this.sync.makeScrolledHandler(S.scrolled)})}),series:N},H?{}:{colors:N.map(t=>_.colorOf(t.name))}),{title:{text:"",margin:0,floating:!0},subtitle:{text:"",margin:0,floating:!0},legend:{show:!1}}),F?{tooltip:{enabled:!1}}:{}),w.panelH<120&&"grid"!==this.cfg.tooltip&&"boolean"!=typeof(null==(l=null==(r=this.ctx.opts)?void 0:r.tooltip)?void 0:l.compact)?{tooltip:{compact:!0}}:{});if(!(null==(c=M.sparkline)?void 0:c.enabled)&&!["pie","donut","polarArea","radialBar","radar","treemap"].includes(v.config.chart.type)){const t=E.grid&&E.grid.padding||{},e="datetime"===(null==(u=null==(h=this.ctx.opts)?void 0:h.xaxis)?void 0:u.type)?2:7;P.grid={padding:{top:("number"==typeof t.top?t.top:0)-12,bottom:("number"==typeof t.bottom?t.bottom:0)-e}}}const W=this._valueAxisIsX();_.x&&!W&&(P.xaxis={min:_.x.min,max:_.x.max});const $=this._yBoundsFor(A);if($){const t=Array.isArray(null==(p=this.ctx.opts)?void 0:p.yaxis)?this.ctx.opts.yaxis[0]:null==(f=this.ctx.opts)?void 0:f.yaxis,e=Array.isArray(E.yaxis)?E.yaxis[0]:E.yaxis;let i={};if("function"!=typeof(null==(m=null==t?void 0:t.labels)?void 0:m.formatter)){const t=($.max-$.min)/Math.max(1,$.tickAmount),e=Math.max(this._yLabelDecimals,G(t));i={labels:{formatter:t=>"number"==typeof t&&isFinite(t)?t.toFixed(e):t}}}P.yaxis=d.extend(e||{},a({min:$.min,max:$.max,tickAmount:$.tickAmount},i)),delete E.yaxis,W&&(P.xaxis=d.extend(P.xaxis||{},this._valueAxisXPatch($)))}const z=this._frames;if(z&&z.plotOptions&&(P.plotOptions=d.clone(z.plotOptions)),z&&z.pieScaleOf){const t=z.pieScaleOf(A.key);if(null!==t){const e=null==(x=null==(y=null==(g=this.ctx.opts)?void 0:g.plotOptions)?void 0:y.pie)?void 0:x.customScale;P.plotOptions=d.extend(P.plotOptions||{},{pie:{customScale:t*("number"==typeof e?e:1)}})}}let B=d.extend(E,P);if("function"==typeof this.cfg.panel){const e=this.cfg.panel(A.key,{index:t,seriesNames:A.seriesNames});e&&"object"==typeof e&&(B=d.extend(B,e))}return B}_alignGutters(){return c(this,null,function*(){var t,e,i,s;const n=this.panels.map(t=>{var e,i,s,n,r;return null==(r=null==(n=null==(s=null==(i=null==(e=t.chart)?void 0:e.w)?void 0:i.globals)?void 0:s.yLabelsCoords)?void 0:n[0])?void 0:r.width}).filter(t=>"number"==typeof t&&isFinite(t));if(!n.length)return;const r=!!(null==(s=null==(i=null==(e=null==(t=this.panels[0])?void 0:t.chart)?void 0:e.w)?void 0:i.globals)?void 0:s.isBarHorizontal)?0:10,l=Math.max(0,Math.max(...n)-r);yield this._pushGutterFloor(l)})}_yLabelPad(){return 10}_pushGutterFloor(t){return c(this,null,function*(){for(const e of this.panels)e.chart&&(yield e.chart.updateOptions({yaxis:ut(e.chart,{labels:{minWidth:t}})},!1,!1,!1).catch(()=>{}))})}_refitForChrome(){if(!this._hostHeight())return;const t=this._chromeHeight();t<=0||Math.round(t)===Math.round(this._chromeH)?this._warnIfOverflowing():(this._chromeH=t,this._relayout(this._containerWidth()))}_warnIfOverflowing(){const t=this.layout;t&&t.overflowH&&!this._overflowWarned&&(this._overflowWarned=!0,console.warn(`ApexCharts: trellis needs ${Math.round(t.gridH+this._chromeH)}px but its container gives ${Math.round(this._hostHeight()||0)}px; ${t.rows} rows cannot go below the ${t.panelH}px panel floor. Raise the container, use fewer panels (trellis.limit) or more columns (trellis.columns), or lower trellis.minPanelHeight.`))}_onContainerResize(){this._mounted&&(this._raf||(this._raf=requestAnimationFrame(()=>{this._raf=0;const t=this._containerWidth(),e=this._hostHeight()||0;if(Math.round(t)!==Math.round(this._lastWidth)||Math.round(e)!==Math.round(this._lastHeight)){if(this._lastWidth=t,this._lastHeight=e,this._promotedKey){const t=this.panels.find(t=>t.key===this._promotedKey);return void(t&&t.chart&&t.chart.updateOptions({},!1,!1,!1).catch(()=>{}))}this._relayout(t)}})))}promote(t){return c(this,null,function*(){var e;const i=this.panels.find(e=>e.key===String(t));if(!i||i.noMount||!this._mounted)return;if(this._promotedKey===i.key)return;this._promotedKey&&(yield this.restorePromotion()),this._promotedKey=i.key;const s=this.layout,n=this.elGrid?this.elGrid.getBoundingClientRect().height:0,r=Math.round(Math.max(280,Math.min(560,n||(s?2.4*s.panelH:420))));null==(e=this.elWrap)||e.classList.add("apexcharts-trellis-promoting"),this.panels.forEach(t=>{if(!t.cellEl)return;const e=t===i;t.cellEl.classList.toggle("apexcharts-trellis-cell-promoted",e),t.cellEl.classList.toggle("apexcharts-trellis-cell-parked",!e)}),this._stripEls.forEach(t=>t.classList.add("apexcharts-trellis-cell-parked")),this.chrome.buildBreadcrumb(this._elChromeTop,i.key,()=>this.restorePromotion()),!i.chart&&this._virtualActive&&(i.wantMounted=!0,this.virtual._dirty.add(i),this.virtual._schedule()),i.el&&(i.el.style.minHeight=`${r}px`),i.chart&&(yield i.chart.updateOptions({chart:{height:r}},!1,!1,!1).catch(()=>{})),this._fire("panelPromoted",{key:i.key,chart:i.chart})})}restorePromotion(){return c(this,null,function*(){var t;if(!this._promotedKey)return;const e=this.panels.find(t=>t.key===this._promotedKey);this._promotedKey=null,null==(t=this.elWrap)||t.classList.remove("apexcharts-trellis-promoting"),this.panels.forEach(t=>{t.cellEl&&(t.cellEl.classList.remove("apexcharts-trellis-cell-promoted"),t.cellEl.classList.remove("apexcharts-trellis-cell-parked"))}),this._stripEls.forEach(t=>t.classList.remove("apexcharts-trellis-cell-parked")),this.chrome.removeBreadcrumb();const i=this.layout;e&&e.el&&i&&(e.el.style.minHeight=`${i.panelH}px`),e&&e.chart&&i&&(yield e.chart.updateOptions({chart:{height:i.panelH}},!1,!1,!1).catch(()=>{})),this._lastWidth=0,this._relayout(this._containerWidth()),this._lastWidth=this._containerWidth(),this._fire("panelRestored",{key:e?e.key:null})})}_relayout(t){const e=this.split;if(!e)return;const i=this.layout?this.layout.panelH:0;this.layout=Z({panelCount:e.panels.length,containerWidth:t,cfg:this._layoutCfg(),hostHeight:this._hostHeight(),chromeHeight:this._chromeH}),this._applyGridStyle(),this._warnIfOverflowing();const s=this.layout;this.panels.forEach((t,e)=>{if(t.cellEl&&this._applyCellMutes(t.cellEl,s.cells[e]),t.el&&this._virtualActive&&(t.el.style.minHeight=`${s.panelH}px`),!t.chart)return;const n=s.panelH!==i?{chart:{height:s.panelH}}:{};t.chart.updateOptions(n,!1,!1,!1).catch(()=>{})}),this._virtualActive&&this.virtual.refresh()}canApplyInPlace(t){if(!this._mounted||this._promotedKey)return!1;if(!t||"object"!=typeof t)return!1;const e=Object.keys(t);return!!e.length&&e.every(t=>Ct.includes(t))}applyPanelOptions(t=!0){return c(this,null,function*(){var e,i,s;const n=this.split;if(!n)return;const r=this._yMode()!==((null==(e=this.cfg.scales)?void 0:e.y)||"shared")?o(a({},this.cfg),{scales:o(a({},this.cfg.scales||{}),{y:this._yMode()})}):this.cfg;this.scales=U(n,r,a({chartType:this.w.config.chart.type,userColors:this.ctx.opts&&this.ctx.opts.colors,yExtentOverride:this._frames?this._frames.yExtentOverride:null},this._stackingHost())),yield Promise.all(this.panels.map(e=>{if(!e.chart)return Promise.resolve();const i=this._assemblePanelOptions(e.index);return delete i.series,i.chart&&delete i.chart.height,e.chart.updateOptions(i,!1,t,!1,!1).catch(()=>{})})),null==(s=(i=this.chrome).refreshLegendColors)||s.call(i)})}updateSeries(t,e=!0){return c(this,null,function*(){var i;const s=this.w;if(Array.isArray(this.cfg.data)&&this.cfg.data.length)return console.warn("ApexCharts: this trellis renders from trellis.data; update it via updateOptions({ trellis: { data } })."),Promise.resolve();if(s.config.series=t,this.ctx.opts&&(this.ctx.opts.series=t),!this._mounted)return this.ctx.render();const n=P(t||[],this.cfg,{chartType:s.config.chart.type});if(!(n.panels.length===this.panels.length&&n.panels.every((t,e)=>t.key===this.panels[e].key)))return this.teardown(),this.ctx.render();this.split=n,this._frames=j(n,this.cfg,s.config,"histogram"===s.config.chart.requestedType?"histogram":s.config.chart.type);const r=this._yMode()!==((null==(i=this.cfg.scales)?void 0:i.y)||"shared")?o(a({},this.cfg),{scales:o(a({},this.cfg.scales||{}),{y:this._yMode()})}):this.cfg;this.scales=U(n,r,a({chartType:s.config.chart.type,userColors:this.ctx.opts&&this.ctx.opts.colors,yExtentOverride:this._frames.yExtentOverride},this._stackingHost()));const l=this.scales,c=this._frames,h=["pie","donut","polarArea","radialBar"].includes(s.config.chart.type),u=this.panels.map((t,i)=>{var s,r,a;if(!t.chart)return Promise.resolve();const o={series:h?n.panels[i].series.flatMap(t=>Array.isArray(t.data)?t.data:[]).map(t=>"number"==typeof t&&isFinite(t)?t:0):n.panels[i].series},u=this._valueAxisIsX();l.x&&!u&&(o.xaxis={min:l.x.min,max:l.x.max});const p=this._yBoundsFor(n.panels[i]);if(p&&(o.yaxis=ut(t.chart,{min:p.min,max:p.max,tickAmount:p.tickAmount}),u&&(o.xaxis=d.extend(o.xaxis||{},this._valueAxisXPatch(p)))),c.plotOptions&&(o.plotOptions=d.clone(c.plotOptions)),c.pieScaleOf){const t=c.pieScaleOf(n.panels[i].key);if(null!==t){const e=null==(a=null==(r=null==(s=this.ctx.opts)?void 0:s.plotOptions)?void 0:r.pie)?void 0:a.customScale;o.plotOptions=d.extend(o.plotOptions||{},{pie:{customScale:t*("number"==typeof e?e:1)}})}}return t.chart.updateOptions(o,!1,e,!1).catch(()=>{})});return Promise.all(u)})}getPanels(){return this.panels.map(t=>({key:t.key,index:t.index,chart:t.chart,el:t.cellEl}))}getPanel(t){const e=this.panels.find(e=>e.key===String(t));return e?e.chart:null}teardown(){this.virtual.stop(),this._virtualActive=!1,this._panelRenderer=null,this._promotedKey=null,this._frames=null,this.chrome.destroyGradientLegend(),this.gridTooltip&&(this.gridTooltip.destroy(),this.gridTooltip=null),this._raf&&(cancelAnimationFrame(this._raf),this._raf=0),p.isBrowser()&&this.ctx.el&&g(this.ctx.el,this._resizeHandler),this.panels.forEach(t=>{if(t.chart)try{t.chart.destroy()}catch(t){}t.chart=null}),this.panels=[],this._stripEls=[],this.elWrap&&this.elWrap.parentNode&&this.elWrap.parentNode.removeChild(this.elWrap),this.elWrap=null,this.elGrid=null,this._mounted=!1,this.ctx._renderPromise=null}}}),Object.defineProperty(exports,"default",{enumerable:!0,get:()=>u.default});
|