apexcharts
Version:
A JavaScript Chart Library
6 lines • 80.5 kB
JavaScript
/*!
* ApexCharts v7.0.0
* (c) 2018-2026 ApexCharts
*/
"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;const s=t.config.fill&&t.config.fill.type,n=t=>"pattern"===t||"image"===t||"gradient"===t;if(Array.isArray(s)?s.some(n):n(s))return!0;const r=null==(i=null==(e=t.config.plotOptions)?void 0:e.line)?void 0:i.colors;if(r&&r.colorAboveThreshold&&r.colorBelowThreshold)return!0;const l=t.config.states||{},a=l.hover&&l.hover.filter&&l.hover.filter.type,o=l.active&&l.active.filter&&l.active.filter.type;return!(!a||x.includes(a))||!(!o||x.includes(o))}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={}}_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 t=w().get(e);if(t)return this._instances[e]||(this._instances[e]=t(this.w,this.ctx)),this.active=this._instances[e],this._activeKind=e,this.ctx.renderer=this.active,this.w.globals.activeRenderer=this.active,this._activeKind}else"canvas"===t&&b(this.w);return this.active=this.svg,this._activeKind="svg",this.ctx.renderer=this.active,this.w.globals.activeRenderer=this.active,this._activeKind}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"}}function E(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 M(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 S(t,e){return"paired"===e?[t,null]:"object"===e?{x:t,y:null}:null}function k(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 C(t,e){const i=[],s=new Set;let n=!1,r=!1,l=0,a="plain";t.forEach(t=>{const e=E(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=M(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}}function F(t,e){const i=[],s=new Set;let n=0;return{align:r=>{const l=E(r&&r.data),c=r&&null!=r.name?String(r.name):`series-${n+1}`;n++,s.has(c)||(s.add(c),i.push(c));const h=o(a({},r),{name:c});if("plain"===l||"empty"===l){const e=t.sawKeyed?t.unionX.length:t.plainMaxLen,i=Array.isArray(r.data)?r.data.slice(0,e):[];for(;i.length<e;)i.push(null);return h.data=i,h}const u=new Map;return r.data.forEach(t=>{const i=M(t,l);void 0===i||u.has(i)?void 0!==i&&u.has(i)&&e.push(`trellis: duplicate x "${String(i)}" in series "${c}"; keeping the first`):u.set(i,t)}),h.data=t.unionX.map(t=>u.has(t)?u.get(t):S(t,l)),h},seriesNames:i}}function N(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 S(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 O(t,e={}){const i=[],s=Array.isArray(t)?t:[];if(e.row||e.column)return e.by&&i.push("trellis: `by` is ignored when `row`/`column` are set (they are mutually exclusive)"),function(t,e,i){const s=e.row,n=e.column,r=new Map,l=new Map,a=new Map,o=[],c=[],h=[],u=(t,e)=>{-1===t.indexOf(e)&&t.push(e)};if(t.forEach((t,e)=>{var i,d;const p=s?k(t,e,s):"",f=n?k(t,e,n):"";if(null===p&&null===f)return void o.push(t);if(null===p)return u(h,f),a.has(f)||a.set(f,[]),void(null==(i=a.get(f))||i.push(t));if(null===f)return u(c,p),l.has(p)||l.set(p,[]),void(null==(d=l.get(p))||d.push(t));u(c,p),u(h,f);let m=r.get(p);m||(m=new Map,r.set(p,m));let g=m.get(f);g||(g=[],m.set(f,g)),g.push(t)}),!c.length&&!h.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 d=L(c.length?c:[""],e.order),p=L(h.length?h:[""],e.order),f=C(t,i),{align:m,seriesNames:g}=F(f,i),y=[];return d.forEach(t=>{p.forEach(e=>{var i;const s=((null==(i=r.get(t))?void 0:i.get(e))||[]).concat(l.get(t)||[]).concat(a.get(e)||[]).concat(o).map(m);y.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:y,rowKeys:d,colKeys:p,seriesNames:g,xForm:f.sawKeyed?f.xForm:"plain",unionX:f.sawKeyed?f.unionX:Array.from({length:f.plainMaxLen},(t,e)=>e),xIsNumeric:f.xIsNumeric,dropped:0,warnings:i}}(s,e,i);const n=e.by||"facet",r=new Map,l=[];if(s.forEach((t,e)=>{const i=k(t,e,n);if(null===i)l.push(t);else{r.has(i)||r.set(i,[]);const e=r.get(i);e&&e.push(t)}}),0===r.size)return W(["trellis: no series carries the facet key; nothing to split"]);let a=L(Array.from(r.keys()),e.order),o=0;"number"==typeof e.limit&&e.limit>0&&a.length>e.limit&&(o=a.length-e.limit,a=a.slice(0,e.limit));const c=C(a.reduce((t,e)=>t.concat(r.get(e)||[]),[]).concat(l),i),{align:h,seriesNames:u}=F(c,i);return{mode:"1d",panels:a.map(t=>{const e=(r.get(t)||[]).map(h),i=l.map(h),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:u,xForm:c.sawKeyed?c.xForm:"plain",unionX:c.sawKeyed?c.unionX:Array.from({length:c.plainMaxLen},(t,e)=>e),xIsNumeric:c.xIsNumeric,dropped:o,warnings:i}}function W(t){return{mode:"1d",panels:[],rowKeys:null,colKeys:null,seriesNames:[],xForm:"plain",unionX:[],xIsNumeric:!1,dropped:0,warnings:t}}function P(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){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)}function $(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]);isFinite(t)&&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));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=z(t);return e>0?{width:3.49*e*Math.pow(s,-1/3),rule:"scott"}:{width:n(Math.log2(s)+1),rule:"sturges"}}case"fd":{const e=P(t,.75)-P(t,.25);return e>0?{width:2*e*Math.pow(s,-1/3),rule:"fd"}:{width:n(Math.log2(s)+1),rule:"sturges"}}case"auto":{const e=n(Math.log2(s)+1),i=P(t,.75)-P(t,.25);if(i<=0)return{width:e,rule:"sturges"};const r=2*i*Math.pow(s,-1/3);return r<e?{width:r,rule:"fd"}:{width:e,rule:"sturges"}}default:return{width:n(Math.log2(s)+1),rule:"sturges"}}}(i,l,"string"==typeof e.bins?e.bins:"auto");a=t.width,o=t.rule}(!isFinite(a)||a<=0)&&(a=l);let c=Math.ceil(l/a);(!isFinite(c)||c<1)&&(c=1);let h=!1;c>1e3&&(c=1e3,a=l/c,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}const H=["heatmap","pie","donut","polarArea","radialBar"],T=["pie","donut","polarArea"];function I(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 R(t,e,i,s){var n,r,l,a,o,c;const h={plotOptions:null,yExtentOverride:null,skipYaxisPush:H.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=I(t.data);return i=i.concat(e),e})),r=$(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;const s=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});s.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?function(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=z(i),e=P(i,.75)-P(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}}(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=>{I(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(T.includes(s)&&e.radiusByTotal){const t=new Map;let e=0;u.forEach(i=>{let s=0;i.series.forEach(t=>{I(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 K=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 j(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 D(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 Y(t,e){const i={min:1/0,max:-1/0};return t.forEach(t=>t.series.forEach(t=>{Array.isArray(t.data)&&t.data.forEach(t=>j(t,e,i))})),isFinite(i.min)&&isFinite(i.max)?i:null}function q(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;let c=null;"shared"===r&&(c=o(i.yExtentOverride||Y(t.panels,t.xForm)));let h=null;if("independent-row"===r){h=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((e,i)=>{const s=o(Y(e,t.xForm));s&&(null==h||h.set(i,s))})}let u=null;if("independent-column"===r){u=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((e,i)=>{const s=o(Y(e,t.xForm));s&&(null==u||u.set(i,s))})}const d=K().palette1,p=Array.isArray(i.userColors)?i.userColors.filter(t=>"string"==typeof t):[],f=p.length?p:d,m=t.seriesNames;return{x:l,y:c,rowY:h,colY:u,colorOf:t=>{const e=m.indexOf(t);return f[(-1===e?0:e)%f.length]},palette:f}}function G({panelCount:t,containerWidth:e,cfg:i,hostHeight:s}){var n,r;const l=null!=(n=i.gap)?n:12,a=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),o=Math.max(1,Math.ceil(t/a)),c=!i.header||!1!==i.header.show?22:0,h=Math.max(0,(e-l*(a-1))/a);let u;u="number"==typeof i.panelHeight&&i.panelHeight>0?i.panelHeight:"number"==typeof s&&s>0?(s-o*c-l*(o-1))/o:h/(null!=(r=i.aspectRatio)?r:1.6),u=Math.max(80,Math.round(u));const d=i.axes&&i.axes.labels||"edges",p=i.scales||{},f=1===a,m=Array.from({length:t},(e,i)=>{const s=Math.floor(i/a),n=i%a;let r,l;return"none"===d?(r=!1,l=!1):"all"===d||f?(r=!0,l=!0):(r="independent"===p.x||s===function(t,e,i,s){return t<e-(s-1)*i?s-1:s-2}(n,t,a,o),l="independent"===p.y||"independent-column"===p.y||0===n),{i:i,r:s,c:n,showXLabels:r,showYLabels:l}});return{cols:a,rows:o,panelW:h,panelH:u,headerH:c,gap:l,cells:m}}const V=u.__apex_Series,U=["#cf4d3f","#8f9499","#26a75b"],Z=(t,e,i)=>t+(e-t)*i;function J(t){return Math.max(0,Math.min(255,Math.round(t))).toString(16).padStart(2,"0")}function Q(t,e,i){const s=d.parseHex(tt(t)),n=d.parseHex(tt(e));return s&&n?"#"+J(Z(s[0],n[0],i))+J(Z(s[1],n[1],i))+J(Z(s[2],n[2],i)):t}function tt(t){if("string"!=typeof t)return"#000000";if(d.isColorHex(t))return t;return d.rgb2hex(t)||"#000000"}function et(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 it(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=et(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:tt(t.color)})).sort((t,e)=>t.value-e.value);const n=(Array.isArray(t.colors)&&t.colors.length>=2?t.colors:U).map(tt),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:Z(e,s,i/t),color:n[i]});for(let e=t+1;e<r;e++)l.push({value:Z(s,i,(e-t)/(r-1-t)),color:n[e]});return l}return n.map((t,s)=>({value:Z(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 Q(s.color,i.color,r)}}return e.color},legendStops:m}}const st="http://www.w3.org/2000/svg";class nt{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=nt.colorScaleOf(t);return e&&e.gradientLegend||null}_cfg(){return nt.configFor(this.w)||{}}static isEnabled(t){if(!nt.supports(t))return!1;const e=nt.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(st,"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 L=f.createElementNS(st,"defs"),C=`apexcharts-heatmap-gradient-${c.globals.cuid}`,F=f.createElementNS(st,"linearGradient");F.setAttribute("id",C),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:W,bands:P}=this._computeStops();this._min=N,this._max=O,W.forEach(t=>{const e=f.createElementNS(st,"stop");e.setAttribute("offset",`${(100*t.percent).toFixed(2)}%`),e.setAttribute("stop-color",t.color),F.appendChild(e)}),L.appendChild(F),k.appendChild(L);const z=f.createElementNS(st,"rect");if(z.setAttribute("x",String(M)),z.setAttribute("y",String(S)),z.setAttribute("width",String(p?_:b)),z.setAttribute("height",String(p?b:_)),z.setAttribute("rx","2"),z.setAttribute("fill",`url(#${C})`),k.appendChild(z),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(st,"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 $=(null==(l=u.arrow)?void 0:l.color)||c.config.chart.foreColor,B=this._buildArrow(m,$,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(st,"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"),s=t.dom.baseEl.querySelector(".apexcharts-grid");if(!(e&&i&&s&&this._geom))return;const n=i.getBoundingClientRect(),r=s.getBoundingClientRect();if(!(n.width&&n.height&&r.width&&r.height))return;const{isVertical:l,position:a}=this._geom;if(l){const t="left"===a?r.left-n.right:n.left-r.right;if(t<16){const i=parseFloat(e.style.left)||0,s=16-t;e.style.left=i+("left"===a?-s:s)+"px"}}else{const t="top"===a?r.top-n.bottom:n.top-r.bottom;if(t<16){const i=parseFloat(e.style.top)||0,s=16-t;e.style.top=i+("top"===a?-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 V(r).highlightRangeInSeries(a,"highlight"))}_onBandLeave(){if(this._activeBandIndex<0)return;const t=this._activeBandIndex;this._activeBandIndex=-1,new V(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(!nt.supports(n))return;let o;o=this._continuous?function(t,e,i){const s=t.config.series[e];return et(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(st,"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=nt.colorScaleOf(i)||{},n=this._cfg(),r=it(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 rt={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 lt{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}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 nt(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=rt[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 at(t,e){const i=d.clone(t.w.config.yaxis);return(Array.isArray(i)?i:[i]).map(t=>d.extend(t,e))}class ot{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){const n={min:1/0,max:-1/0};return t.forEach(t=>t.series.forEach(t=>{Array.isArray(t.data)&&t.data.forEach(t=>{if(null==t)return;const r="paired"===e?t[0]:"object"===e?t.x:null,l=r instanceof Date?r.getTime():Number(r);!isFinite(l)||l<i||l>s||j(t,e,n)})})),isFinite(n.min)&&isFinite(n.max)?n:null}(e.split.panels,e.split.xForm,s.min,s.max);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:at(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=at(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 ct(t,e){const i=null!=t,s=null!=e;return i||s?{min:i?t:null,max:s?e:null}:null}function ht(t,e){return"function"==typeof t&&e?t===e.addXaxisAnnotation?"xaxis":t===e.addYaxisAnnotation?"yaxis":t===e.addPointAnnotation?"point":null:null}function ut(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=ht(t.method,e);i&&s.push({kind:i,params:d.clone(t.params)})}return{static:i,dynamic:s}}function dt(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 pt{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(){pt.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.ctx.events.fireEvent("panelMounted",[u.ctx,{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=>ct(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:ct(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:ut(t,e),drill:o&&o.depth>0?{path:o.path.slice()}:null,measure:dt(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 ft{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)/ft.xRatio(t)}static pxToDataX(t,e){return t.globals.minX+e*ft.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 mt=["bar","column","rangeBar","candlestick","boxPlot"];class gt{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=ft.screenXToPlotPx(s,e),a=s.globals.barPadForNumericAxis||0;if(l<-a||l>r+a)return-1;const o=s.dom&&s.dom.elGridRect?s.dom.elGridRect:t.el&&t.el.querySelector?t.el.querySelector(".apexcharts-grid"):null;if(o&&o.getBoundingClientRect){const t=o.getBoundingClientRect();if(t.height&&(i<t.top||i>t.bottom))return-1}let c;return c=-1!==mt.indexOf(s.config.chart.type)&&!s.config.xaxis.convertedCatToNumeric?Math.ceil(l/(r/n))-1:Math.round(l/(r/Math.max(1,n-1))),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:${xt(r)}"></span>${yt(n)}</span>`)});const i=t.key===r.key;u.push(`<div class="apexcharts-trellis-tooltip-row${i?" apexcharts-trellis-tooltip-row-active":""}" data-key="${xt(t.key)}"><span class="apexcharts-trellis-tooltip-key">${yt(t.key)}</span><span class="apexcharts-trellis-tooltip-vals">${e.join("")}</span></div>`)});let d="";o&&(d+=`<div class="apexcharts-tooltip-title">${yt(o)}</div>`),d+=u.join(""),i.innerHTML=d,i.classList.add("apexcharts-trellis-tooltip-active");const p=t.getBoundingClientRect();let f=s.clientX-p.left+14,m=s.clientY-p.top+14;const g=i.offsetWidth,y=i.offsetHeight;f+g>p.width-4&&(f=Math.max(4,f-g-28)),m+y>p.height-4&&(m=Math.max(4,m-y-28)),i.style.left=`${Math.round(f)}px`,i.style.top=`${Math.round(m)}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 yt(t){return String(t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function xt(t){return String(t).replace(/"/g,""")}class vt{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 bt(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(){return c(this,null,function*(){const t=this.trellis,e=this._size(),i=[];i.push(`<svg xmlns="http://www.w3.org/2000/svg" width="${e.w}" height="${e.h}" viewBox="0 0 ${e.w} ${e.h}">`),i.push(`<rect width="${e.w}" height="${e.h}" fill="${this._background()}"/>`);for(const e of t.panels){if(!e.el)continue;const t=this._rectIn(e.el);if(!e.chart){i.push(`<rect x="${t.x}" y="${t.y}" width="${t.w}" height="${t.h}" fill="rgba(120,120,120,0.06)" rx="4"/>`);continue}const s=yield e.chart.getSvgString();i.push(`<g transform="translate(${t.x}, ${t.y})">${s}</g>`)}for(const t of this._chromeTexts()){const e="center"===t.align?"middle":"start";i.push(`<text x="${t.x}" y="${t.y}" text-anchor="${e}" dominant-baseline="central" style="font:${At(t.font)};fill:${At(t.color)}">${wt(t.text)}</text>`)}for(const t of this._legendMarkers())i.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="${At(t.color)}"/>`);return i.push("</svg>"),i.join("")})}csv(){var t,e,i;const s=this.trellis,n=s.split;if(!n)return"";const r=s.w,l=(null==(i=null==(e=null==(t=r.config.chart.toolbar)?void 0:t.export)?void 0:e.csv)?void 0:i.columnDelimiter)||",",a=r.config.xaxis&&"datetime"===r.config.xaxis.type,o=t=>{if(null==t)return"";const e=String(t);return/[",\n]/.test(e)||-1!==e.indexOf(l)?`"${e.replace(/"/g,'""')}"`:e},c=t=>a&&"number"==typeof t?new Date(t).toISOString():t,h=n.seriesNames,u=[["x","facet",...h].map(o).join(l)];return n.panels.forEach(t=>{n.unionX.forEach((e,i)=>{const s=[c(e),t.key];h.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)}),u.push(s.map(o).join(l))})}),u.join("\n")}download(t){return c(this,null,function*(){var e;const i=this.trellis,s=(null==(e=i.w.config.chart.toolbar)?void 0:e.export)||{},n=String(i.w.globals.chartID||"trellis");if("png"===t){const{imgURI:t}=yield this.dataURI();_t(t,s.png&&s.png.filename||n,".png")}else if("svg"===t){const t=yield this.svgString();_t("data:image/svg+xml;charset=utf-8,"+encodeURIComponent(t),s.svg&&s.svg.filename||n,".svg")}else{_t("data:text/csv;charset=utf-8,"+encodeURIComponent("\ufeff"+this.csv()),s.csv&&s.csv.filename||n,".csv")}})}}function bt(t){return new Promise((e,i)=>{const s=new Image;s.onload=()=>e(s),s.onerror=i,s.src=t})}function _t(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 wt(t){return String(t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function At(t){return String(t).replace(/"/g,""")}const Et={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 ot(this),this.chrome=new lt(this),this.virtual=new pt(this),this.exports=new vt(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._raf=0,this._lastWidth=0,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&&Et[i])return this._vetoWarned||(this._vetoWarned=!0),!1;if(e.by&&!e.row&&!e.column&&!Array.isArray(e.data)){if(!(this.w.config.series||[]).some((t,i)=>null!==k(t,i,e.by))){if(!this._noKeyWarned){this._noKeyWarned=!0;"function"==typeof e.by||e.by}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}_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`}render(){return c(this,null,function*(){var t,e,i,s;const n=this.w;if(!this._mounted&&!this._rendering&&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=>{}),t.series.length&&(r.length,r=t.series)}const l=O(r,this.cfg);if(this.split=l,l.warnings.forEach(t=>{}),!l.panels.length)return;l.dropped;const c=null!=(i=this.cfg.virtualize)?i:"auto";let h=!0===c||"auto"===c&&l.panels.length>64;h&&!pt.supported()&&(h=!1),this._virtualActive=h,!h&&l.panels.length,l.panels.length;const d="histogram"===n.config.chart.requestedType?"histogram":n.config.chart.type;this._frames=R(l,this.cfg,n.config,d),this._frames.warnings.forEach(t=>{}),this._yLabelDecimals=this._frames.yExtentOverride?0:function(t){let e=0;const i=t=>{const i=D(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=q(l,p,{chartType:n.config.chart.type,userColors:this.ctx.opts&&this.ctx.opts.colors,yExtentOverride:this._frames.yExtentOverride}),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.layout=G({panelCount:l.panels.length,containerWidth:f,cfg:this._layoutCfg(),hostHeight:this._hostHeight()}),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.ctx.events.fireEvent("panelMounted",[this.ctx,{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 gt(this),this.gridTooltip.wire(this.elGrid,y)),m(this.ctx.el,this._resizeHandler),this._mounted=!0,h||(n.globals.animationEnded=!0),this.ctx.events.fireEvent("trellisMounted",[this.ctx,{panels:this.getPanels()}])}finally{this._rendering=!1}}})}_containerWidth(){const t=this.ctx.el;return t.getBoundingClientRect().width||t.clientWidth||800}_hostHeight(){const t=this.w.config.chart&&this.w.config.chart.height,e="string"==typeof t?parseFloat(t):t;return"number"==typeof e&&isFinite(e)&&e>0&&"auto"!==String(t)?e:void 0}_buildSkeleton(){const t=this.ctx.el,e=f.createElementNS("http://www.w3.org/1999/xhtml","div");e.className="apexcharts-trellis",this.split&&"2d"===this.split.mode&&e.classList.add("apexcharts-trellis-2d"),e.id=`apexcharts-trellis${this.w.globals.chartID}`,e.setAttribute("data-tooltip-mode",this.cfg.tooltip||"panel");const i=f.createElement("div");i.className="apexcharts-trellis-chrome",e.appendChild(i),this._elChromeTop=i;const s=f.createElement("div");s.className="apexcharts-trellis-grid",e.appendChild(s),t.appendChild(e),this.elWrap=e,this.elGrid=s,this.w.dom.baseEl=t,this.w.dom.elWrap=e}_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,L=null==(n=null==(s=null==(i=this.ctx.opts)?void 0:i.chart)?void 0:s.animations)?void 0:n.enabled,C=e||b.panels.length>16&&void 0===L,F=A.empty&&"placeholder"===(this.cfg.emptyPanels||"placeholder");let O=F?[N(b,{chartType:v.config.chart.type})]:A.series;const W=["pie","donut","polarArea","radialBar"].includes(v.config.chart.type);W&&(O=O.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,parentHeightOffset:0,toolbar:{show:!1},zoom:{enabled:"none"!==this.cfg.zoom}},C?{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:O},W?{}:{colors:O.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 z=this._valueAxisIsX();_.x&&!z&&(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,D(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,z&&(P.xaxis=d.extend(P.xaxis||{},this._valueAxisXPatch($)))}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 H=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&&(H=d.extend(H,e))}return H}_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:at(e.chart,{labels:{minWidth:t}})},!1,!1,!1).catch(()=>{}))})}_onContainerResize(){this._mounted&&(this._raf||(this._raf=requestAnimationFrame(()=>{this._raf=0;const t=this._containerWidth();if(Math.round(t)!==Math.round(this._lastWidth)){if(this._lastWidth=t,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.ctx.events.fireEvent("panelPromoted",[this.ctx,{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.ctx.events.fireEvent("panelRestored",[this.ctx,{key:e?e.key:null}])})}_relayout(t){const e=this.split;if(!e)return;const i=this.layout?this.layout.panelH:0;this.layout=G({panelCount:e.panels.length,containerWidth:t,cfg:this._layoutCfg(),hostHeight:this._hostHeight()}),this._applyGridStyle();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()}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 Promise.resolve();if(s.config.series=t,this.ctx.opts&&(this.ctx.opts.series=t),!this._mounted)return this.ctx.render();const n=O(t||[],this.cfg);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=R(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=q(n,r,{chartType:s.config.chart.type,userColors:this.ctx.opts&&this.ctx.opts.colors,yExtentOverride:this._frames.yExtentOverride});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=at(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});