UNPKG

apexcharts

Version:

A JavaScript Chart Library

6 lines (5 loc) 42.7 kB
/*! * ApexCharts v7.0.0 * (c) 2018-2026 ApexCharts */ "use strict";var t=Object.defineProperty,e=Object.defineProperties,i=Object.getOwnPropertyDescriptors,a=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable,n=(e,i,a)=>i in e?t(e,i,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[i]=a,o=(t,e)=>{for(var i in e||(e={}))s.call(e,i)&&n(t,i,e[i]);if(a)for(var i of a(e))r.call(e,i)&&n(t,i,e[i]);return t},l=(t,a)=>e(t,i(a));Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});function c(t){if(t&&t.__esModule)return t;const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t)for(const i in t)if("default"!==i){const a=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,a.get?a:{enumerable:!0,get:()=>t[i]})}return e.default=t,Object.freeze(e)}const u=c(require("apexcharts/core")),h=1/45;function d(t,e,i,a){return{value:t,velocity:0,target:t,stiffness:e,damping:i}}function m(t,e){if(e<=0)return p(t);let i=e;for(;i>0;){const e=Math.min(i,h),a=-t.stiffness*(t.value-t.target)-t.damping*t.velocity;t.velocity+=a*e,t.value+=t.velocity*e,i-=e}return!!p(t)&&(t.value=t.target,t.velocity=0,!0)}function f(t,e){t.target=e}function p(t){var e,i;const a=null!=(e=t.restVelocity)?e:.05,s=null!=(i=t.restDisplacement)?i:.05;return Math.abs(t.velocity)<a&&Math.abs(t.value-t.target)<s}const x={crisp:[210,26],gentle:[120,20],snappy:[320,30]};const g=u.__apex_Graphics,y="__apexcharts_unit_layouts__";function b(t){return t&&globalThis[y][t]||null}globalThis[y]||(globalThis[y]={});const M="__apexcharts_unit_marks__";function _(t,e){if("string"==typeof t){const e=t.trim();return e?Object.freeze({name:"anonymous",path:e,viewBox:[0,0,100,100]}):null}if(!t||"object"!=typeof t)return null;if("string"!=typeof t.path||!t.path.trim())return null;const i=Array.isArray(t.viewBox)&&4===t.viewBox.length?t.viewBox.map(Number):[0,0,100,100];return!i.every(t=>isFinite(t))||i[2]<=0||i[3]<=0?null:Object.freeze(l(o({},t),{name:t.name||"anonymous",path:t.path.trim(),viewBox:i,fillRule:"evenodd"===t.fillRule?"evenodd":void 0}))}function A(t){return t&&globalThis[M][t]||null}globalThis[M]||(globalThis[M]={});const w=u.__apex_Utils,S=u.__apex_Environment_Environment,R=u.__apex_BrowserAPIs_BrowserAPIs,k=u.__apex_Animations_prefersReducedMotion;const F=Math.PI*(3-Math.sqrt(5));function v(t){return 1-Math.pow(1-t,3)}function E(t){return t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2}function D(t,e){const[i,a]=null!=(r=x[null!=(s=t)?s:"crisp"])?r:x.crisp;var s,r;const n=800/Math.max(1,e);return[i*n*n,a*n]}u.default.use({unit:class{constructor(t,e){this.ctx=e,this.w=t,this._lastDotR=1,this._gridTrack=null,this._gridDenom=1,this._scatterAxis=null,this._specCache=new Map,this._markWarned=null}draw(t){const e=this.w,i=new g(e,this.ctx),a=i.group({class:"apexcharts-unit"});if(e.globals.noData||!Array.isArray(t)||0===t.length)return a;const s=e.config.plotOptions.unit,r="packed"===s.layout?"packed":"columns"===s.layout?"columns":"grid"===s.layout?"grid":"scatter"===s.layout?"scatter":"arc"===s.layout?"arc":"custom"===s.layout?"custom":"grouped",n=s.transition,o="flow"===n,l="identity"===n,c=s.unitValue>0?s.unitValue:1;let u=t.map(t=>{const e=Math.abs(w.parseNumber(t))/c;return e>0?Math.max(1,Math.round(e)):0});u=this._applyMaxUnits(u,s.maxUnits);const h=u.reduce((t,e)=>t+e,0),d="packed"===r?this._layoutPacked(u,s):"columns"===r?this._layoutColumns(u,s):"grid"===r?this._layoutGrid(u,s):"scatter"===r?this._layoutScatter(s):"arc"===r?this._layoutArc(u,s):"custom"===r?this._layoutCustom(u,s):this._layoutGrouped(u,s),m="grid"===r&&!(!s.grid||!s.grid.split);m&&this._drawGridTrack(a,i,s),"scatter"===r&&this._drawScatterAxes(a,i);const f=this._lastDotR,p=this._shouldAnimate(),x=this.ctx&&this.ctx.morphTypeChange,y=p&&!!x&&"function"==typeof x.isActive&&x.isActive()&&"function"==typeof x.getInitialCenterFor,b=y&&"function"==typeof x.getInitialSlotFor,M=y&&"function"==typeof x.usesPieceTakeover&&x.usesPieceTakeover(),_=p&&!y&&this.ctx?this.ctx._unitPrevDots:null,A=new Map,S=[],R=e.seriesData.unitData||[],k=this._bubbleStats(R,s,f);let F=0;if(d.forEach(t=>{const n=e.globals.colors[t.i]||e.globals.colors[0]||"#008FFB",c=i.group({class:"apexcharts-series",seriesName:w.escapeString(e.seriesData.seriesNames[t.i]||`series-${t.i+1}`),rel:t.i+1,"data:realIndex":t.i}),d=y&&!b?x.getInitialCenterFor(t.i):null,g=t.dots.length,v=R[t.i];if(t.dots.forEach((e,a)=>{const r=null!=e.j?e.j:a,u=v?v[r]:void 0,h=u&&"object"==typeof u&&u.fillColor?u.fillColor:n,y=null!=e.r?e.r:k?this._radiusForValue(this._unitValueOf(u),k):f,w=this._markSpecFor(s,u,t.i,y),R=this._drawDot(i,s,y,h,t.i,r,w);let E;if(c.add(R),l){const t=u&&"object"==typeof u?null!=u.id?u.id:u.name:void 0;E=null!=t?`id:${t}`:`g:${F}`}else E=o?String(F):null!=e.slot?`slot:${e.slot}`:`${t.i}:${r}`;if(F++,A.set(E,{x:e.x,y:e.y,fill:h,r:y,spec:w}),M)this._place(R.node,w,e.x,e.y),R.node.setAttribute("opacity","0"),R.node.setAttribute("data-piece-hidden","1");else if(p){const i=_&&_.get(E),a=i||(b?x.getInitialSlotFor(t.i,r,g):d),n=s.gather&&s.gather.enter||"burst",o=m||"fade"===n||"rise"===n,l=a?a.x:o?e.x:t.cx,c=a?a.y:"rise"!==n||m?o?e.y:t.cy:e.y+14;R.node.style.opacity=a?"1":"0",this._place(R.node,w,l,c),S.push({node:R.node,spec:w,x:e.x,y:e.y,cx0:l,cy0:c,key:E,r0:i&&null!=i.r?i.r:y,r1:y,fill0:i?i.fill:h,fill1:h,delay:0,isEnter:!a})}else this._place(R.node,w,e.x,e.y)}),("grouped"===r||"columns"===r||m)&&s.clusterLabels&&s.clusterLabels.show&&u[t.i]>0){const e=m?this._gridDenom:h;this._drawClusterLabel(c,t,u[t.i],e,s,n)}a.add(c)}),this._outerLabelsOn(s)&&this._drawOuterLabels(a,d,u,h,s,p&&!_),_){const t=this._collectExits(_,A,s);if(t.length){const e=i.group({class:"apexcharts-unit-exits"});a.add(e),this._runExits(e,t,s)}}return this.ctx&&(this.ctx._unitPrevDots=A),!this.ctx||p&&!y||(this.ctx._unitSprings=null),p&&S.length?this._runGather(S):e.globals.animationEnded=!0,a}_applyMaxUnits(t,e){const i=t.reduce((t,e)=>t+e,0);if(!e||e<=0||i<=e)return t;const a=e/i;return t.map(t=>t>0?Math.max(1,Math.round(t*a)):0)}_layoutCustom(t,e){const i=this.w,a=i.layout.gridWidth,s=i.layout.gridHeight,r=t.reduce((t,e)=>t+e,0),n=this._resolveLayoutProvider(e);if(!n)return this._layoutGrouped(t,e);const o=this._outerLabelsOn(e)?this._outerLabelGutter(t,e):0;this._lastOuterGutter=o;const l={x:o,y:0,width:Math.max(1,a-2*o),height:s},c=Math.sqrt(l.width*l.height/Math.PI),u=this._resolveStep(e,c,r);this._lastDotR=this._dotRadiusFromStep(u,e);const h=this._lastDotR,d=this._layoutObjects(t,h);let m;try{m=n(d,l)}catch(i){return this._layoutGrouped(t,e)}if(!Array.isArray(m))return this._layoutGrouped(t,e);const f=new Map;m.forEach(t=>{t&&isFinite(t.x)&&isFinite(t.y)&&f.set(String(t.id),{x:t.x,y:t.y,r:"number"==typeof t.r&&t.r>0?t.r:void 0})});const p=t.map((t,e)=>({i:e,cx:a/2,cy:s/2,outerR:h,dots:[]}));return d.forEach(t=>{const e=f.get(t.id);e&&p[t.seriesIndex].dots.push({x:e.x,y:e.y,r:e.r,j:t.dataPointIndex})}),p.forEach(t=>{if(!t.dots.length)return;let e=0,i=0;t.dots.forEach(t=>{e+=t.x,i+=t.y}),t.cx=e/t.dots.length,t.cy=i/t.dots.length;let a=0;t.dots.forEach(e=>{a=Math.max(a,Math.hypot(e.x-t.cx,e.y-t.cy))}),t.outerR=a+h}),p}_layoutObjects(t,e){const i=this.w,a=i.seriesData.unitData||[],s=i.seriesData.seriesNames||[],r=[];let n=0;return t.forEach((t,i)=>{var o;const l=a[i];for(let a=0;a<t;a++){const t=l?l[a]:void 0,c=!t||"object"!=typeof t||null==t.id&&null==t.name?`${i}:${a}`:String(null!=t.id?t.id:t.name);r.push({id:c,index:n,seriesIndex:i,dataPointIndex:a,label:s[i],value:null!=(o=this._unitValueOf(t))?o:void 0,datum:t,r:e}),n++}}),r}_resolveLayoutProvider(t){const e=t.positions;if("function"==typeof e)return e;if("string"==typeof e&&e){const t=b(e);if(t)return t}return null}_layoutGrouped(t,e){const i=this.w,a=i.layout.gridWidth,s=i.layout.gridHeight,r=e.clusterLabels&&e.clusterLabels.show?30:6,n=t.map((t,e)=>e).filter(e=>t[e]>0),o=Math.max(1,n.length),l=new Array(t.length).fill(-1);n.forEach((t,e)=>l[t]=e);const c=a/o,u=s-r,h=Math.max(1,...t),d=.08*Math.min(c,u),m=Math.max(4,Math.min(c,u)/2-d),f=this._resolveStep(e,m,h);this._lastDotR=this._dotRadiusFromStep(f,e);const p=this._lastDotR,x=r+u/2,g=t.map(t=>f*Math.sqrt(Math.max(1,t))+p);let y=t.map((t,e)=>(t=>l[t]>=0?c*(l[t]+.5):a/2)(e));const b=n.map(t=>g[t]);let M=!1;for(let t=1;t<o;t++)if(y[n[t]]-y[n[t-1]]<b[t]+b[t-1]){M=!0;break}if(M){const e=Math.max(2*p,8),i=b.reduce((t,e)=>t+2*e,0)+e*(o-1);let s;if(i<=a){let t=(a-i)/2;s=b.map(i=>{const a=t+i;return t+=2*i+e,a})}else if(1===o)s=[a/2];else{const t=b[0],e=a-b[o-1];s=b.map((i,a)=>t+(e-t)*a/(o-1))}y=t.map((t,e)=>l[e]>=0?s[l[e]]:a/2)}return t.map((t,e)=>({i:e,cx:y[e],cy:x,outerR:g[e],dots:this._spiral(y[e],x,t,f,0)}))}_layoutPacked(t,e){const i=this.w,a=i.layout.gridWidth,s=i.layout.gridHeight,r=Math.max(1,t.reduce((t,e)=>t+e,0)),n=Math.max(4,Math.min(a,s-6)/2-.06*Math.min(a,s)),o=this._resolveStep(e,n,r);this._lastDotR=this._dotRadiusFromStep(o,e);const l=a/2,c=6+(s-6)/2,u=t.map((t,e)=>e);!1!==e.sortByGroup&&u.sort((e,i)=>t[e]-t[i]);const h=t.map((t,e)=>({i:e,cx:l,cy:c,outerR:o*Math.sqrt(r)+this._lastDotR,dots:[]}));let d=0;return u.forEach(e=>{for(let i=0;i<t[e];i++){const t=o*Math.sqrt(d+.5),i=d*F;h[e].dots.push({x:l+t*Math.cos(i),y:c+t*Math.sin(i),slot:d}),d++}}),h}_layoutArc(t,e){const i=this.w,a=i.layout.gridWidth,s=i.layout.gridHeight,r=Math.max(1,t.reduce((t,e)=>t+e,0)),n=e.arc||{},o="number"==typeof n.startAngle?n.startAngle:-90,l="number"==typeof n.endAngle?n.endAngle:90,c=o*Math.PI/180,u=l*Math.PI/180,h=u-c||Math.PI,d=Math.max(0,Math.min(.95,"number"==typeof n.innerRadiusRatio?n.innerRadiusRatio:.4)),m=t=>Math.sin(t),f=t=>-Math.cos(t),p=this._arcBounds(c,u),x=.04*Math.min(a,s),g=Math.max(1e-6,p.maxX-p.minX),y=Math.max(1e-6,p.maxY-p.minY),b=Math.max(4,Math.min((a-2*x)/g,(s-2*x)/y)),M=b*d,_=a/2-(p.minX+p.maxX)/2*b,A=s/2-(p.minY+p.maxY)/2*b,w=this._arcAllocate(r,M,b,h,e);this._lastDotR=w.dotR;const S=[];for(let t=0;t<w.R;t++){const e=w.radii[t],i=w.seatsPerRow[t];for(let t=0;t<i;t++){const a=1===i?(c+u)/2:c+h*(t+.5)/i;S.push({a:a,x:_+e*m(a),y:A+e*f(a)})}}S.sort((t,e)=>t.a-e.a);const R=t.map((t,e)=>({i:e,cx:_,cy:A,outerR:b,dots:[]}));let k=0,F=0;return S.forEach((e,i)=>{for(;k<t.length&&F>=t[k];)k++,F=0;k>=t.length||(R[k].dots.push({x:e.x,y:e.y,slot:i}),F++)}),R}_arcBounds(t,e){const i=t=>Math.sin(t),a=t=>-Math.cos(t),s=Math.min(t,e),r=Math.max(t,e),n=[0,i(t),i(e)],o=[0,a(t),a(e)],l=Math.PI/2;for(let t=Math.ceil(s/l);t*l<=r;t++)n.push(i(t*l)),o.push(a(t*l));return{minX:Math.min(...n),maxX:Math.max(...n),minY:Math.min(...o),maxY:Math.max(...o)}}_arcAllocate(t,e,i,a,s){const r=s.spacing>0?s.spacing:1.05,n=Math.abs(a)||Math.PI,o=this._fixedRadius(s),l=a=>{a=Math.max(1,Math.round(a));const s=[];for(let t=0;t<a;t++)s.push(1===a?(e+i)/2:e+t/(a-1)*(i-e));const o=s.reduce((t,e)=>t+e,0)||1,l=s.map(e=>t*e/o),c=l.map(t=>Math.floor(t));let u=t-c.reduce((t,e)=>t+e,0);for(l.map((t,e)=>({idx:e,frac:t-Math.floor(t)})).sort((t,e)=>e.frac-t.frac).forEach(t=>{u>0&&(c[t.idx]++,u--)});u>0;)c[a-1]++,u--;const h=1===a?i-e||i:(i-e)/(a-1);let d=1/0;for(let t=0;t<a;t++){const e=c[t];if(e<=0)continue;const i=s[t]*n/e;i<d&&(d=i)}const m=Math.min(h,d);return{R:a,radii:s,seatsPerRow:c,dotR:Math.max(1,m/(2*r))}},c=s.arc&&s.arc.rows;let u;if("number"==typeof c&&c>=1)u=l(c);else if(o){u=l((i-e)/(2*o*r)+1)}else{const e=Math.max(1,Math.min(40,Math.ceil(Math.sqrt(t))+6));u=l(1);for(let t=2;t<=e;t++){const e=l(t);e.dotR>u.dotR&&(u=e)}}return o&&(u.dotR=o),u}_layoutColumns(t,e){const i=this.w,a=i.layout.gridWidth,s=i.layout.gridHeight,r=!(!e.clusterLabels||!e.clusterLabels.show),n=r&&"bottom"===e.clusterLabels.position,o=r&&!n?30:6,l=t.map((t,e)=>e).filter(e=>t[e]>0),c=Math.max(1,l.length),u=new Array(t.length).fill(-1);l.forEach((t,e)=>u[t]=e);const h=a/c,d=.62*h,m=Math.max(8,.04*s)+(n?30:0),f=Math.max(4,s-o-m),p=Math.max(1,...t),x=e.spacing>0?e.spacing:1,g=e.columns?e.columns.size:void 0;let y;y="image"!==e.shape&&"auto"===g?null:"image"!==e.shape&&"number"==typeof g&&g>0?g:this._fixedRadius(e);let b=1,M=0;if(y){M=2*y*x,this._lastDotR=y;const t=Math.max(1,Math.floor(f/M)),e=Math.max(1,Math.floor(d/M));b=Math.max(1,Math.min(e,Math.ceil(p/t)))}else{let t=0;const e=Math.max(1,Math.min(40,Math.round(d/4)));for(let i=1;i<=e;i++){const e=Math.ceil(p/i),a=Math.min(d/i,f/e);a>t&&(t=a,b=i)}M=t,this._lastDotR=Math.max(1,M/(2*x))}const _=this._lastDotR,A=Math.ceil(p/b),w=o+(f+Math.min(f,A*M))/2;return t.map((t,e)=>{const i=u[e]>=0?h*(u[e]+.5):a/2,s=Math.ceil(Math.max(1,t)/b)*M,r=i-b*M/2+M/2,n=[];for(let e=0;e<t;e++){const t=Math.floor(e/b),i=e%b;n.push({x:r+i*M,y:w-_-t*M})}return{i:e,cx:i,cy:w-s/2,outerR:s/2,flat:!0,dots:n}})}_layoutGrid(t,e){if(e.grid&&e.grid.split)return this._layoutGridSplit(t,e);this._gridTrack=null;const i=this.w,a=i.layout.gridWidth,s=i.layout.gridHeight,r=e.grid||{},n=Math.max(1,Math.round(r.columns>0?r.columns:10)),o="top"===r.fillFrom?"top":"bottom",l=r.total>0?this._largestRemainder(t,Math.round(r.total)):t.slice(),c=l.reduce((t,e)=>t+e,0),u=Math.max(1,Math.ceil(Math.max(1,c)/n)),h=e.spacing>0?e.spacing:1,d=Math.max(4,a),m=Math.max(4,s-6),f=this._fixedRadius(e);let p=0;f?(p=2*f*h,this._lastDotR=f):(p=Math.min(d/n,m/u),this._lastDotR=Math.max(1,p/(2*h)));const x=n*p,g=u*p,y=(a-x)/2+p/2,b=6+(m-g)/2,M=t=>"bottom"===o?b+g-p/2-t*p:b+p/2+t*p,_=t.map((t,e)=>({i:e,cx:a/2,cy:6+m/2,outerR:Math.max(x,g)/2,dots:[]}));let A=0;for(let t=0;t<l.length;t++)for(let e=0;e<l[t];e++){const e=A%n,i=Math.floor(A/n);_[t].dots.push({x:y+e*p,y:M(i),slot:A}),A++}return _}_layoutGridSplit(t,e){const i=this.w,a=i.layout.gridWidth,s=i.layout.gridHeight,r=e.grid||{},n=Math.max(1,Math.round(r.columns>0?r.columns:10)),o="top"===r.fillFrom?"top":"bottom",l=Math.max(1,Math.round(r.total>0?r.total:100)),c=Math.max(1,Math.ceil(l/n)),u=t.map((t,e)=>e).filter(e=>t[e]>0),h=Math.max(1,u.length),d=r.max>0?r.max:Math.max(1,...t),m=Math.max(1,Math.round(r.tileColumns>0?r.tileColumns:Math.ceil(Math.sqrt(h)))),f=Math.max(1,Math.ceil(h/m)),p=!(e.clusterLabels&&!1===e.clusterLabels.show),x=p&&e.clusterLabels&&"bottom"===e.clusterLabels.position,g=p&&!x?22:4,y=p&&x?22:4,b=a/m,M=s/f,_=Math.max(4,.86*b),A=Math.max(4,M-g-y),w=e.spacing>0?e.spacing:1,S=this._fixedRadius(e);let R=0;S?(R=2*S*w,this._lastDotR=S):(R=Math.min(_/n,A/c),this._lastDotR=Math.max(1,R/(2*w)));const k=n*R,F=c*R,v=(t,e)=>"bottom"===o?t+F-R/2-e*R:t+R/2+e*R,E=[],D=[];return u.forEach((e,i)=>{const a=i%m,s=Math.floor(i/m),r=a*b,o=r+(b-k)/2+R/2,c=s*M+g+(A-F)/2,u=t=>({x:o+t%n*R,y:v(c,Math.floor(t/n))});for(let t=0;t<l;t++)E.push(u(t));const h=Math.max(0,Math.min(l,Math.round(t[e]/d*l))),f=[];for(let t=0;t<h;t++){const e=u(t);f.push({x:e.x,y:e.y,slot:i*l+t})}D.push({i:e,cx:r+b/2,cy:c+F/2,outerR:F/2,flat:!0,split:!0,dots:f})}),this._gridDenom=d,this._gridTrack={cells:E},D}_drawGridTrack(t,e,i){const a=this._gridTrack;if(!a||!a.cells||!a.cells.length)return;const s=this._lastDotR,r=(i.grid||{}).trackColor||"rgba(128,128,128,0.14)",n=e.group({class:"apexcharts-unit-track"});a.cells.forEach(t=>{let a;if("square"===i.shape){const n=2*s;a=e.drawRect(0,0,n,n,i.borderRadius||0,r,1,0,"none"),a.node.setAttribute("fill",r),a.node.setAttribute("x",String(t.x-s)),a.node.setAttribute("y",String(t.y-s))}else a=e.drawCircle(s,{fill:r,"stroke-width":0,stroke:"none"}),a.node.setAttribute("fill",r),a.node.setAttribute("cx",String(t.x)),a.node.setAttribute("cy",String(t.y));a.node.classList.add("apexcharts-unit-track-cell"),n.add(a)}),t.add(n)}_layoutScatter(t){const e=this.w,i=t.scatter||{};if("value"===i.y)return this._layoutScatter2D(t);if("vertical"===i.orientation)return this._layoutScatterVertical(t);const a=e.layout.gridWidth,s=e.layout.gridHeight,r=e.seriesData.unitData||[],n=e.seriesData.seriesNames||[],o=t=>this._unitValueOf(t),l=this._scatterSizeStats(i,r),c=r.map(t=>Array.isArray(t)?t.map(o):[]),u=t=>null!=t&&isFinite(t),h=c.map((t,e)=>e).filter(t=>c[t].some(u)),d=Math.max(1,h.length);let m=1/0,f=-1/0;c.forEach(t=>t.forEach(t=>{null!=t&&isFinite(t)&&(t<m&&(m=t),t>f&&(f=t))})),m===1/0&&(m=0,f=1);const p=Math.max(2,Math.round(i.tickAmount>0?i.tickAmount:5)),x=this._scatterValueDomain(i,m,f,p),g=x.min,y=x.max,b=y-g||1,M=null!=i.laneLabelWidth?Math.max(0,i.laneLabelWidth):d>1?92:8,_=30+(i.xTitle?20:0),A=M,w=a-8,S=s-_,R=Math.max(4,w-A),k=Math.max(4,S-10),F=t=>A+(t-g)/b*R,v=k/d;let E=0;const D=this._fixedRadius(t);if(D)E=D;else{const t=Math.max(1,...h.map(t=>c[t].filter(u).length));E=Math.max(2,Math.min(6,.12*v,R/(2.5*Math.sqrt(t))))}this._lastDotR=E;const L=t.spacing>0?t.spacing:1,T=Math.max(.5,E*L),C="jitter"===i.spread,$=[],B=[],z=l?l.rMax:E;h.forEach((t,e)=>{const i=(t=>10+v*(t+.5))(e);B.push({i:t,cy:i,name:n[t]||`series-${t+1}`});const a=(r[t]||[]).map((t,e)=>{const a=o(t),s={j:e,px:F(u(a)?a:g),y:i};return l&&(s.r=this._scatterRadius(t,l,E)),s});if(C){const t=Math.max(z,v/2-z);a.forEach((e,a)=>{const s=(9301*a+49297)%233280/233280;e.y=i+(2*s-1)*t})}else this._beeswarm(a,i,E,T,z);$.push({i:t,cx:(A+w)/2,cy:i,outerR:v/2,dots:a.map(t=>({x:t.px,y:t.y,r:t.r}))})});const O=x.ticks;return this._scatterAxis={mode:"1d",plotL:A,plotR:w,plotT:10,plotB:S,xMin:g,xMax:y,plotX:F,ticks:O,lanes:B,xTitle:i.xTitle,formatter:"function"==typeof i.xFormatter?i.xFormatter:null,gridlines:!1!==i.gridlines},$}_layoutScatterVertical(t){const e=this.w,i=t.scatter||{},a=e.layout.gridWidth,s=e.layout.gridHeight,r=e.seriesData.unitData||[],n=e.seriesData.seriesNames||[],o=t=>this._unitValueOf(t),l=this._scatterSizeStats(i,r),c=r.map(t=>Array.isArray(t)?t.map(o):[]),u=t=>null!=t&&isFinite(t),h=c.map((t,e)=>e).filter(t=>c[t].some(u)),d=Math.max(1,h.length);let m=1/0,f=-1/0;c.forEach(t=>t.forEach(t=>{null!=t&&isFinite(t)&&(t<m&&(m=t),t>f&&(f=t))})),m===1/0&&(m=0,f=1);const p=Math.max(2,Math.round(i.tickAmount>0?i.tickAmount:5)),x=this._scatterValueDomain(i,m,f,p),g=x.min,y=x.max,b=y-g||1,M=46+(i.xTitle?18:0),_=a-10,A=s-(d>1?26:10),w=Math.max(4,_-M),S=Math.max(4,A-10),R=t=>A-(t-g)/b*S,k=w/d;let F=0;const v=this._fixedRadius(t);if(v)F=v;else{const t=Math.max(1,...h.map(t=>c[t].filter(u).length));F=Math.max(2,Math.min(6,.12*k,S/(2.5*Math.sqrt(t))))}this._lastDotR=F;const E=t.spacing>0?t.spacing:1,D=Math.max(.5,F*E),L="jitter"===i.spread,T=[],C=[],$=l?l.rMax:F;h.forEach((t,e)=>{const i=(t=>M+k*(t+.5))(e);C.push({i:t,cx:i,name:n[t]||`series-${t+1}`});const a=(r[t]||[]).map((t,e)=>{const a=o(t),s={j:e,py:R(u(a)?a:g),x:i};return l&&(s.r=this._scatterRadius(t,l,F)),s});if(L){const t=Math.max($,k/2-$);a.forEach((e,a)=>{const s=(9301*a+49297)%233280/233280;e.x=i+(2*s-1)*t})}else this._beeswarm(a,i,F,D,$,!0);T.push({i:t,cx:i,cy:(10+A)/2,outerR:k/2,dots:a.map(t=>({x:t.x,y:t.py,r:t.r}))})});const B=x.ticks;return this._scatterAxis={mode:"1d",orientation:"vertical",plotL:M,plotR:_,plotT:10,plotB:A,vMin:g,vMax:y,plotY:R,ticks:B,lanes:C,valueTitle:i.xTitle,formatter:"function"==typeof i.xFormatter?i.xFormatter:null,gridlines:!1!==i.gridlines},T}_layoutScatter2D(t){const e=this.w,i=e.layout.gridWidth,a=e.layout.gridHeight,s=t.scatter||{},r=e.seriesData.unitData||[],n=t=>"number"==typeof t&&isFinite(t),o=t=>t&&"object"==typeof t?t.x:null,l=t=>t&&"object"==typeof t?null!=t.y?t.y:t.value:null,c=r.map((t,e)=>e).filter(t=>(r[t]||[]).some(t=>n(o(t))&&n(l(t))));let u=1/0,h=-1/0,d=1/0,m=-1/0;r.forEach(t=>(t||[]).forEach(t=>{const e=o(t),i=l(t);n(e)&&n(i)&&(e<u&&(u=e),e>h&&(h=e),i<d&&(d=i),i>m&&(m=i))})),u===1/0&&(u=0,h=1,d=0,m=1);const f=Math.max(2,Math.round(s.tickAmount>0?s.tickAmount:5)),p=Math.max(2,Math.round(s.yTickAmount>0?s.yTickAmount:5)),x=this._niceScale(null!=s.xMin?s.xMin:u,null!=s.xMax?s.xMax:h,f),g=this._niceScale(null!=s.yMin?s.yMin:d,null!=s.yMax?s.yMax:m,p),y=null!=s.xMin?s.xMin:x.min,b=null!=s.xMax?s.xMax:x.max,M=null!=s.yMin?s.yMin:g.min,_=null!=s.yMax?s.yMax:g.max,A=b-y||1,w=_-M||1,S=46+(s.yTitle?18:0),R=30+(s.xTitle?20:0),k=S,F=i-12,v=a-R,E=Math.max(4,F-k),D=Math.max(4,v-10),L=t=>k+(t-y)/A*E,T=t=>v-(t-M)/w*D,C=this._scatterSizeStats(s,r),$=this._fixedRadius(t)||5;this._lastDotR=$;const B=[];c.forEach(t=>{const e=(r[t]||[]).map(t=>{const e=o(t),i=l(t);return{x:L(n(e)?e:y),y:T(n(i)?i:M),r:C?this._scatterRadius(t,C,$):void 0}});B.push({i:t,cx:(k+F)/2,cy:(10+v)/2,outerR:D/2,dots:e})});const z=(t,e,i,a,s,r)=>{const n=[];if(s)for(let e=0;e<r;e++)n.push(t+i*e/(r-1));else{const s=a||i/Math.max(1,r-1);for(let i=t;i<=e+.5*s;i+=s)n.push(Math.abs(i)<1e-9*s?0:i)}return n};return this._scatterAxis={mode:"2d",plotL:k,plotR:F,plotT:10,plotB:v,plotX:L,plotY:T,xTicks:z(y,b,A,x.spacing,null!=s.xMin||null!=s.xMax,f),yTicks:z(M,_,w,g.spacing,null!=s.yMin||null!=s.yMax,p),xTitle:s.xTitle,yTitle:s.yTitle,xFormatter:"function"==typeof s.xFormatter?s.xFormatter:null,yFormatter:"function"==typeof s.yFormatter?s.yFormatter:null,gridlines:!1!==s.gridlines},B}_scatterSizeStats(t,e){const i=t&&t.sizeRange;if(!Array.isArray(i)||i.length<2)return null;const a=Math.max(.5,+i[0]),s=Math.max(a,+i[1]),r=t.sizeField||"z";let n=1/0,o=-1/0;return e.forEach(t=>(t||[]).forEach(t=>{const e=t&&"object"==typeof t?t[r]:null;"number"==typeof e&&isFinite(e)&&(e<n&&(n=e),e>o&&(o=e))})),n===1/0?null:{zmin:n,zmax:o,rMin:a,rMax:s,field:r}}_scatterRadius(t,e,i){if(!e)return i;const a=t&&"object"==typeof t?t[e.field]:null;if("number"!=typeof a||!isFinite(a))return e.rMin;const s=e.zmax>e.zmin?(a-e.zmin)/(e.zmax-e.zmin):1,r=Math.max(0,Math.min(1,s)),n=e.rMin*e.rMin,o=e.rMax*e.rMax;return Math.sqrt(n+r*(o-n))}_beeswarm(t,e,i,a,s,r=!1){const n=r?"py":"px",o=r?"x":"y",l=t.slice().sort((t,e)=>t[n]-e[n]),c=[],u=null!=s?s:i;l.forEach(t=>{const s=null!=t.r?t.r:i;let r=0;for(let i=0;i<2e3;i++){const o=0===i?0:Math.ceil(i/2)*a*(i%2?1:-1),l=e+o;let h=!0;for(let e=c.length-1;e>=0;e--){const i=c[e],a=t[n]-i.f;if(a>s+u)break;const r=s+i.r,o=l-i.s;if(a*a+o*o<r*r){h=!1;break}}if(h){r=o;break}}t[o]=e+r,c.push({f:t[n],s:t[o],r:s})})}_scatterValueDomain(t,e,i,a){const s=(t,e,i)=>{const a=[];for(let s=t;s<=e+.5*i;s+=i)a.push(Math.abs(s)<1e-9*i?0:s);return a};if(null!=t.xMin||null!=t.xMax){let r=null!=t.xMin?t.xMin:e,n=null!=t.xMax?t.xMax:i;n>r||(n=r+1);const o=(n-r)/Math.max(1,a-1);return e<r&&(r-=Math.ceil((r-e)/o)*o),i>n&&(n+=Math.ceil((i-n)/o)*o),{min:r,max:n,ticks:s(r,n,o)}}const r=this._niceScale(e,i,a),n=r.spacing||(r.max-r.min)/Math.max(1,a-1);return{min:r.min,max:r.max,ticks:s(r.min,r.max,n)}}_niceScale(t,e,i){const a=t;let s=e;s>a||(s=a+1);const r=this._niceNum(s-a,!1),n=this._niceNum(r/Math.max(1,i-1),!0);return{min:Math.floor(a/n)*n,max:Math.ceil(s/n)*n,spacing:n}}_niceNum(t,e){const i=t>0?t:1,a=Math.floor(Math.log(i)/Math.LN10),s=i/Math.pow(10,a);let r;return r=e?s<1.5?1:s<3?2:s<7?5:10:s<=1?1:s<=2?2:s<=5?5:10,r*Math.pow(10,a)}_drawScatterAxes(t,e){const i=this.w;if(!S.isBrowser())return;const a=this._scatterAxis;if(!a)return;const s="http://www.w3.org/2000/svg",r=e.group({class:"apexcharts-unit-axis"}),n=i.config.grid&&i.config.grid.borderColor||"rgba(128,128,128,0.18)",o="rgba(128,128,128,0.5)",l=i.config.xaxis&&i.config.xaxis.labels&&i.config.xaxis.labels.style&&i.config.xaxis.labels.style.colors,c=Array.isArray(l)?l[0]:l,u=c||"rgba(120,130,140,0.9)",h=(t,e,i,a,n)=>{const o=R.createElementNS(s,"line");o.setAttribute("x1",String(t)),o.setAttribute("y1",String(e)),o.setAttribute("x2",String(i)),o.setAttribute("y2",String(a)),o.setAttribute("stroke",n),o.setAttribute("shape-rendering","crispEdges"),r.node.appendChild(o)},d=(t,e,a,n,o,l,c,u)=>{const h=R.createElementNS(s,"text");h.setAttribute("class",u),h.setAttribute("x",String(e)),h.setAttribute("y",String(a)),h.setAttribute("text-anchor",n),h.setAttribute("dominant-baseline","middle"),h.setAttribute("font-size",`${l}px`),h.setAttribute("font-family",i.config.chart.fontFamily||"inherit"),h.setAttribute("font-weight",String(c)),h.setAttribute("fill",o),h.textContent=t,r.node.appendChild(h)};if("2d"!==a.mode){if("vertical"===a.orientation){if(a.ticks.forEach(t=>{const e=a.plotY(t);a.gridlines&&h(a.plotL,e,a.plotR,e,n);const i=a.formatter?String(a.formatter(t)):this._formatTick(t);d(i,a.plotL-8,e,"end",u,11,400,"apexcharts-unit-tick")}),h(a.plotL,a.plotT,a.plotL,a.plotB,o),a.valueTitle){const t=R.createElementNS(s,"text");t.setAttribute("class","apexcharts-unit-axis-title");const e=14,n=(a.plotT+a.plotB)/2;t.setAttribute("x",String(e)),t.setAttribute("y",String(n)),t.setAttribute("text-anchor","middle"),t.setAttribute("font-size","12px"),t.setAttribute("font-family",i.config.chart.fontFamily||"inherit"),t.setAttribute("font-weight","600"),t.setAttribute("fill",u),t.setAttribute("transform",`rotate(-90 ${e} ${n})`),t.textContent=String(a.valueTitle),r.node.appendChild(t)}return a.lanes.forEach(t=>{const e=c||i.globals.colors[t.i]||i.globals.colors[0]||"#008FFB";d(t.name,t.cx,a.plotB+16,"middle",e,12,600,"apexcharts-unit-lane-label")}),void t.add(r)}a.ticks.forEach((t,e)=>{const i=a.plotX(t);a.gridlines&&h(i,a.plotT,i,a.plotB,n);const s=a.formatter?String(a.formatter(t)):this._formatTick(t),r=0===e?"start":e===a.ticks.length-1?"end":"middle";d(s,i,a.plotB+14,r,u,11,400,"apexcharts-unit-tick")}),h(a.plotL,a.plotB,a.plotR,a.plotB,o),a.xTitle&&d(String(a.xTitle),(a.plotL+a.plotR)/2,a.plotB+32,"middle",u,12,600,"apexcharts-unit-axis-title"),a.plotL>12&&a.lanes.forEach(t=>{const e=c||i.globals.colors[t.i]||i.globals.colors[0]||"#008FFB";d(t.name,a.plotL-8,t.cy,"end",e,12,600,"apexcharts-unit-lane-label")}),t.add(r)}else{if(a.yTicks.forEach(t=>{const e=a.plotY(t);a.gridlines&&h(a.plotL,e,a.plotR,e,n);const i=a.yFormatter?String(a.yFormatter(t)):this._formatTick(t);d(i,a.plotL-8,e,"end",u,11,400,"apexcharts-unit-tick")}),a.xTicks.forEach(t=>{const e=a.plotX(t);a.gridlines&&h(e,a.plotT,e,a.plotB,n);const i=a.xFormatter?String(a.xFormatter(t)):this._formatTick(t);d(i,e,a.plotB+14,"middle",u,11,400,"apexcharts-unit-tick")}),h(a.plotL,a.plotB,a.plotR,a.plotB,o),h(a.plotL,a.plotT,a.plotL,a.plotB,o),a.xTitle&&d(String(a.xTitle),(a.plotL+a.plotR)/2,a.plotB+32,"middle",u,12,600,"apexcharts-unit-axis-title"),a.yTitle){const t=R.createElementNS(s,"text");t.setAttribute("class","apexcharts-unit-axis-title");const e=14,n=(a.plotT+a.plotB)/2;t.setAttribute("x",String(e)),t.setAttribute("y",String(n)),t.setAttribute("text-anchor","middle"),t.setAttribute("font-size","12px"),t.setAttribute("font-family",i.config.chart.fontFamily||"inherit"),t.setAttribute("font-weight","600"),t.setAttribute("fill",u),t.setAttribute("transform",`rotate(-90 ${e} ${n})`),t.textContent=String(a.yTitle),r.node.appendChild(t)}t.add(r)}}_formatTick(t){if(!isFinite(t))return"";const e=Math.abs(t);return e>=1e6?+(t/1e6).toFixed(1)+"M":e>=1e4?+(t/1e3).toFixed(1)+"k":Number.isInteger(t)?String(t):String(+t.toFixed(2))}_largestRemainder(t,e){const i=t.reduce((t,e)=>t+e,0);if(i<=0||e<=0)return t.map(()=>0);const a=t.map(t=>t/i*e),s=a.map(t=>Math.floor(t)),r=s.reduce((t,e)=>t+e,0),n=Math.max(0,e-r),o=a.map((t,e)=>({i:e,frac:t-Math.floor(t)})).sort((t,e)=>e.frac-t.frac),l=s.slice();for(let t=0;t<n&&t<o.length;t++)l[o[t].i]++;return l}_spiral(t,e,i,a,s){const r=[];for(let n=0;n<i;n++){const i=s+n,o=a*Math.sqrt(i+.5),l=i*F;r.push({x:t+o*Math.cos(l),y:e+o*Math.sin(l)})}return r}_fixedRadius(t){return"image"===t.shape&&t.image?Math.max(t.image.width||20,t.image.height||20)/2:this._bubbleActive(t)&&"number"==typeof t.sizeByValue.maxRadius?t.sizeByValue.maxRadius>0?t.sizeByValue.maxRadius:null:"number"==typeof t.size&&t.size>0?t.size:null}_bubbleActive(t){const e=t.sizeByValue;return!(!e||!e.enabled||"image"===t.shape||"square"===t.shape)}_unitValueOf(t){if("number"==typeof t)return t;if(t&&"object"==typeof t){const e=null!=t.value?t.value:t.y;return"number"==typeof e?e:null}return null}_radiusForValue(t,e){if(null==t||!isFinite(t))return e.minR;const i=e.max>e.min?(t-e.min)/(e.max-e.min):1,a=Math.max(0,Math.min(1,i));if("linear"===e.scale)return e.minR+a*(e.maxR-e.minR);const s=e.minR*e.minR,r=e.maxR*e.maxR;return Math.sqrt(s+a*(r-s))}_bubbleStats(t,e,i){if(!this._bubbleActive(e))return null;let a=1/0,s=-1/0;if(t.forEach(t=>{t&&t.forEach(t=>{const e=this._unitValueOf(t);null!=e&&isFinite(e)&&(e<a&&(a=e),e>s&&(s=e))})}),a===1/0||s<a)return null;const r=e.sizeByValue,n=i,o=Math.max(1,Math.min(n,"number"==typeof r.minRadius?r.minRadius:.35*n));return{min:a,max:s,minR:o,maxR:n,scale:"linear"===r.scale?"linear":"area"}}_resolveStep(t,e,i){const a=t.spacing>0?t.spacing:1,s=this._fixedRadius(t);return s?2*s*a:e/(Math.sqrt(Math.max(1,i))+.5)}_dotRadiusFromStep(t,e){const i=e.spacing>0?e.spacing:1,a=this._fixedRadius(e);return a||Math.max(1,t/(2*i))}_isCorner(t){return"square"===t.shape||"image"===t.shape}_halfExtent(t,e){if("image"===t.shape&&t.image)return{hx:(t.image.width||20)/2,hy:(t.image.height||20)/2};const i=null!=e?e:this._lastDotR;return{hx:i,hy:i}}_place(t,e,i,a){const s=e;2===s.pk?t.setAttribute("transform","translate("+(i-s.ox)+","+(a-s.oy)+s.tail):1===s.pk?(t.setAttribute("x",String(i-s.hx)),t.setAttribute("y",String(a-s.hy))):(t.setAttribute("cx",String(i)),t.setAttribute("cy",String(a)))}_baseSpec(t,e){const i=null!=e?e:this._lastDotR;if(!this._isCorner(t))return{pk:0,r:i};const{hx:a,hy:s}=this._halfExtent(t,i);return{pk:1,hx:a,hy:s,r:i}}_resolveMark(t){if(null==t)return null;if("object"==typeof t)return _(t);if("string"!=typeof t||!t)return null;const e=t.trim();if("M"===e[0]||"m"===e[0])return _(e);const i=A(e);return i||(this._markWarned||(this._markWarned=new Set),this._markWarned.has(e)||this._markWarned.add(e),null)}_glyphSpec(t,e,i){const a=Math.round(10*e)/10,s=t.name+"|"+t.path.length+"|"+a,r=this._specCache.get(s);if(r)return r;const n=t.viewBox||[0,0,100,100],o=2*a*(1-Math.max(0,Math.min(.9,i.padding||0)))*("number"==typeof i.scale&&i.scale>0?i.scale:1),l="width"===i.fit?o/n[2]:"height"===i.fit?o/n[3]:o/Math.max(n[2],n[3]),c=Object.freeze({pk:2,mark:t,d:t.path,fillRule:t.fillRule,s:l,ox:(n[0]+n[2]/2)*l,oy:(n[1]+n[3]/2)*l,tail:") scale("+l+")",r:a});return this._specCache.set(s,c),c}_markSpecFor(t,e,i,a){if("pictogram"!==t.shape)return this._baseSpec(t,a);const s=t.pictogram||{},r=e&&"object"==typeof e?e.mark:void 0,n=Array.isArray(s.mark)?s.mark[i%s.mark.length]:s.mark,c=this._resolveMark(null!=r?r:n);return c?this._glyphSpec(c,a,s):this._baseSpec(l(o({},t),{shape:"square"===s.fallback?"square":"circle"}),a)}_drawDot(t,e,i,a,s,r,n){const o=this.w,l=o.config.stroke.show?o.config.stroke.width:0,c=Array.isArray(o.globals.stroke.colors)&&o.globals.stroke.colors[s]||"none",u="number"==typeof o.config.fill.opacity?o.config.fill.opacity:1;let h;if(n&&2===n.pk)h=o.dom.Paper.path(n.d),h.node.setAttribute("fill",a),"evenodd"===n.fillRule&&h.node.setAttribute("fill-rule","evenodd"),u<1&&h.node.setAttribute("fill-opacity",String(u)),h.node.setAttribute("data:r",String(n.r));else if("image"===e.shape&&e.image&&e.image.src){const t=e.image.width||20,i=e.image.height||20;h=o.dom.Paper.image(e.image.src),h.node.setAttribute("width",String(t)),h.node.setAttribute("height",String(i)),h.node.setAttribute("preserveAspectRatio","xMidYMid meet"),e.image.tint&&h.node.setAttribute("filter",`url(#${this._tintFilter(a)})`)}else if("square"===e.shape){const s=2*i;h=t.drawRect(0,0,s,s,e.borderRadius||0,a,1,l,c),h.node.setAttribute("fill",a),u<1&&h.node.setAttribute("fill-opacity",String(u))}else h=t.drawCircle(i,{fill:a,"stroke-width":l,stroke:c}),h.node.setAttribute("fill",a),u<1&&h.node.setAttribute("fill-opacity",String(u));return h.node.classList.add("apexcharts-unit-area"),h.node.setAttribute("i",String(s)),h.node.setAttribute("j",String(r)),h}_tintFilter(t){const e=this.w,i="http://www.w3.org/2000/svg",a=String(t).replace(/[^a-zA-Z0-9]/g,""),s=`apexcharts-unit-tint-${e.globals.chartID}-${a}`,r=e.dom.Paper.node;if(r.querySelector(`#${s}`))return s;let n=r.querySelector("defs");n||(n=R.createElementNS(i,"defs"),r.insertBefore(n,r.firstChild));const o=R.createElementNS(i,"filter");o.setAttribute("id",s),o.setAttribute("x","0%"),o.setAttribute("y","0%"),o.setAttribute("width","100%"),o.setAttribute("height","100%");const l=R.createElementNS(i,"feFlood");l.setAttribute("flood-color",t),l.setAttribute("result","flood");const c=R.createElementNS(i,"feComposite");return c.setAttribute("in","flood"),c.setAttribute("in2","SourceAlpha"),c.setAttribute("operator","in"),o.appendChild(l),o.appendChild(c),n.appendChild(o),s}_placeDot(t,e,i,a,s){this._place(t,s||this._baseSpec(e),i,a)}_rgb(t){if("string"!=typeof t)return null;let e=t.trim();if("#"===e[0]){4===e.length&&(e="#"+e[1]+e[1]+e[2]+e[2]+e[3]+e[3]);const t=parseInt(e.slice(1,7),16);return isNaN(t)?null:[t>>16&255,t>>8&255,255&t]}const i=e.match(/rgba?\(([^)]+)\)/);if(i){const t=i[1].split(",").map(t=>parseFloat(t));if(t.length>=3&&t.every(t=>!isNaN(t)))return[t[0],t[1],t[2]]}return null}_shouldAnimate(){const t=this.w,e=t.config.chart.animations;return!!S.isBrowser()&&(!(!e||!1===e.enabled)&&(!1!==t.globals.shouldAnimate&&(!(t.globals.resized&&!t.globals.dataChanged)&&(!e.respectReducedMotion||!k()))))}_seedSprings(t,e,i){const[a,s]=D(e.spring,i),r=this.ctx?this.ctx._unitSprings:null,n=new Map;for(let e=0;e<t.length;e++){const i=t[e],o=r&&!i.isEnter&&null!=i.key?r.get(i.key):null,l=o?o.x:d(i.cx0,a,s),c=o?o.y:d(i.cy0,a,s);o&&(l.stiffness=a,c.stiffness=a,l.damping=s,c.damping=s,i.cx0=l.value,i.cy0=c.value,this._place(i.node,i.spec,i.cx0,i.cy0),0===l.velocity&&0===c.velocity||(i.delay=0)),i.sx=l,i.sy=c,null!=i.key&&n.set(i.key,{x:l,y:c})}this.ctx&&(this.ctx._unitSprings=n)}_runGather(t){const e=this.w,i=e.config.plotOptions.unit,a=Math.max(1,e.config.chart.animations.speed||800),s=Math.min(.6*a,450),r=t.length;for(let e=0;e<r;e++)t[e].delay=r>1?e/(r-1)*s:0;const n=i.gather||{},o=n.motion||"auto";"spring"===o||"auto"===o&&(!n.easing||"outCubic"===n.easing)?this._seedSprings(t,n,a):this.ctx&&(this.ctx._unitSprings=null);for(let e=0;e<r;e++){const i=t[e];0===i.spec.pk&&null!=i.r0&&null!=i.r1&&i.r0!==i.r1&&i.node.setAttribute("r",String(i.r0))}for(let e=0;e<r;e++){const i=t[e];i.fill0&&i.fill1&&i.fill0!==i.fill1&&(i._c0=this._rgb(i.fill0),i._c1=this._rgb(i.fill1))}const l="outBack"===n.easing?(c="number"==typeof n.overshoot?n.overshoot:1.70158,t=>1+(c+1)*Math.pow(t-1,3)+c*Math.pow(t-1,2)):"inOutCubic"===n.easing?E:v;var c;null!=this.w.globals.unitGatherRAF&&(R.cancelAnimationFrame(this.w.globals.unitGatherRAF),this.w.globals.unitGatherRAF=null);const u=performance.now();let h=u;const d=e=>{if(this.w.globals.isDestroyed)return this.w.globals.unitGatherRAF=null,void(this.w.globals.animationEnded=!0);const i=Math.min(.25,Math.max(0,(e-h)/1e3));h=e;let s=!0;for(let n=0;n<r;n++){const r=t[n],o=e-u-r.delay,c=Math.max(0,Math.min(1,o/a)),h=v(c);let d,p;if(r.sx&&r.sy){o>=0&&!r.released&&(f(r.sx,r.x),f(r.sy,r.y),r.released=!0);const t=m(r.sx,i),e=m(r.sy,i);r.released&&t&&e||(s=!1),d=r.sx.value,p=r.sy.value}else{const t=l(c);d=r.cx0+(r.x-r.cx0)*t,p=r.cy0+(r.y-r.cy0)*t}if(this._place(r.node,r.spec,d,p),r.isEnter&&(r.node.style.opacity=String(Math.min(1,2.5*c))),r._c0&&r._c1){const t=Math.round(r._c0[0]+(r._c1[0]-r._c0[0])*h),e=Math.round(r._c0[1]+(r._c1[1]-r._c0[1])*h),i=Math.round(r._c0[2]+(r._c1[2]-r._c0[2])*h);r.node.setAttribute("fill",`rgb(${t},${e},${i})`)}0===r.spec.pk&&null!=r.r0&&null!=r.r1&&r.r0!==r.r1&&r.node.setAttribute("r",String(r.r0+(r.r1-r.r0)*h)),c<1&&(s=!1)}if(s){for(let e=0;e<r;e++){const i=t[e];i.node.style.opacity="",i._c1&&i.fill1&&i.node.setAttribute("fill",i.fill1),0===i.spec.pk&&null!=i.r0&&null!=i.r1&&i.r0!==i.r1&&i.node.setAttribute("r",String(i.r1))}this.w.globals.unitGatherRAF=null,this.w.globals.animationEnded=!0}else this.w.globals.unitGatherRAF=R.requestAnimationFrame(d)};this.w.globals.unitGatherRAF=R.requestAnimationFrame(d)}_collectExits(t,e,i){const a=Math.max(0,i.maxUnits||5e3),s=[];for(const[i,r]of t)if(!e.has(i)&&(s.push(r),s.length>=a))break;return s}_runExits(t,e,i){const a=this.w,s=new g(a,this.ctx),r=this._lastDotR,n=a.layout.gridWidth/2,o=a.layout.gridHeight/2,l="grid"===i.layout||"scatter"===i.layout||"arc"===i.layout||"custom"===i.layout?0:.35,c=[];if(e.forEach(e=>{const a=null!=e.r?e.r:r,n=e.spec||this._baseSpec(i,a),o=this._drawDot(s,i,a,e.fill,0,0,n);o.node.classList.add("apexcharts-unit-exit"),this._place(o.node,n,e.x,e.y),t.add(o),c.push({node:o.node,x0:e.x,y0:e.y,spec:n})}),!this._shouldAnimate())return void c.forEach(t=>t.node.remove());const u=Math.max(1,a.config.chart.animations.speed||800);null!=this.w.globals.unitExitRAF&&(R.cancelAnimationFrame(this.w.globals.unitExitRAF),this.w.globals.unitExitRAF=null);const h=performance.now(),d=e=>{if(this.w.globals.isDestroyed)return void(this.w.globals.unitExitRAF=null);const i=Math.max(0,Math.min(1,(e-h)/u)),a=v(i);for(let t=0;t<c.length;t++){const e=c[t];if(l){const t=e.x0+(n-e.x0)*a*l,i=e.y0+(o-e.y0)*a*l;this._place(e.node,e.spec,t,i)}e.node.style.opacity=String(1-a)}i<1?this.w.globals.unitExitRAF=R.requestAnimationFrame(d):(this.w.globals.unitExitRAF=null,t.node&&t.node.remove())};this.w.globals.unitExitRAF=R.requestAnimationFrame(d)}_outerLabelsOn(t){const e=t.clusterLabels;return!!("custom"===t.layout&&e&&!1!==e.show&&e.external&&e.external.show)}_outerLabelLines(t,e,i,a){const s=this.w,r=s.seriesData.seriesNames[t]||`series-${t+1}`,n=i>0?e/i*100:0,o=a.clusterLabels,l="function"==typeof o.formatter?o.formatter(r,{seriesIndex:t,value:e,percent:n,w:s}):`${r}\n${n.toFixed(1)}%`;return String(l).split("\n")}_outerLabelGutter(t,e){const i=this.w,a=e.clusterLabels,s=a.external.connector||{},r=t.reduce((t,e)=>t+e,0),n=[];if(t.forEach((t,i)=>{t>0&&n.push(...this._outerLabelLines(i,t,r,e))}),!n.length)return 0;const o=function(t,e,i={}){const a=new g(t),s=i.fontSize||"12px",r=parseFloat(s)||12;let n=0;return e.forEach(t=>{if(null==t||""===t)return;const e=`${t}`,o=a.getTextRects(e,s,i.fontFamily,"").width;n=Math.max(n,o>0?o:e.length*r*.58)}),n}(i,n,{fontSize:a.fontSize,fontFamily:a.fontFamily||i.config.chart.fontFamily}),l=o+(null!=s.gap?s.gap:8)+(null!=s.length?s.length:22)+8+Math.abs(parseFloat(a.external.offsetX)||0);return Math.min(l,.25*i.layout.gridWidth)}_drawOuterLabels(t,e,i,a,s,r){const n=this.w;if(!S.isBrowser())return;const o=s.clusterLabels,l=o.external,c=l.connector||{},u=null!=c.gap?c.gap:8,h=null!=c.length?c.length:22,d=parseFloat(l.offsetX)||0,m=parseFloat(l.offsetY)||0,f=n.layout.gridWidth,p=n.layout.gridHeight,x=this._lastDotR,y=e.filter(t=>t.dots.length>0);if(!y.length)return;let b=0,M=0;if(y.length>1){const t=y.map(t=>t.cx),e=y.map(t=>t.cy);b=Math.max(...t)-Math.min(...t),M=Math.max(...e)-Math.min(...e)}const _=b>M,A=parseFloat(o.fontSize)||13,w=Math.round(1.35*A),R=[];if(y.slice().sort((t,e)=>t.cy-e.cy).forEach((t,e)=>{const r=this._outerLabelLines(t.i,i[t.i],a,s);if(!r.some(t=>""!==t))return;const n=_?t.cx>=f/2?"right":"left":e%2==0?"right":"left",o="right"===n?1:-1;let l=t.dots[0],c=-1/0;t.dots.forEach(e=>{const i=o*e.x-.75*Math.abs(e.y-t.cy);i>c&&(c=i,l=e)});const p={x:l.x+o*(l.r||x),y:l.y},g={x:p.x+o*u,y:p.y};R.push({i:t.i,lines:r,anchor:p,elbow:g,labelX:g.x+o*h+d,idealY:p.y+m,labelY:p.y+m,side:n})}),!R.length)return;const k=R.reduce((t,e)=>Math.max(t,e.lines.length),1)*w,F=k/2;["left","right"].forEach(t=>{!function(t,e,i,a){const s=t.slice().sort((t,e)=>t.idealY-e.idealY);s.forEach(t=>{t.labelY=t.idealY});for(let t=1;t<s.length;t++)s[t].labelY-s[t-1].labelY<e&&(s[t].labelY=s[t-1].labelY+e);const r=s[s.length-1],n=r?r.labelY-i:0;if(n>0)for(let t=s.length-1;t>=0;t--)s[t].labelY-=n,t<s.length-1&&s[t+1].labelY-s[t].labelY<e&&(s[t].labelY=s[t+1].labelY-e);if(null!=a&&s.length&&s[0].labelY<a){const t=a-s[0].labelY;for(let e=0;e<s.length;e++)s[e].labelY+=t}}(R.filter(e=>e.side===t),k+2,p-F,F)});const v=new g(n,this.ctx).group({class:"apexcharts-unit-outer-labels"});if(r){const t=Math.max(1,n.config.chart.animations.speed||800);v.node.classList.add("apexcharts-unit-label-delay"),v.node.style.animationDelay=Math.min(.45*t,600)/1e3+"s"}R.forEach(t=>{const e=n.globals.colors[t.i]||n.globals.colors[0]||"#008FFB";v.add(function(t,e){const{lines:i,lineHeight:a,anchor:s,elbow:r,labelX:n,labelY:o,side:l,connector:c,style:u,foreColor:h}=e,d=new g(t),m=d.group({class:e.groupClass||"apexcharts-outer-label-group"});if(c.show){const t=`M ${s.x} ${s.y} L ${r.x} ${r.y} L ${n} ${o}`,i=d.drawPath({d:t,stroke:c.color,strokeWidth:c.width,fill:"none",strokeLinecap:"round"});i.node.classList.add(e.connectorClass||"apexcharts-outer-label-connector"),m.add(i)}const f="right"===l?n+4:n-4,p=i.length,x=o-(p-1)*a/2,y=d.drawText({x:f,y:x,text:1===p?i[0]:i,textAnchor:"right"===l?"start":"end",fontSize:u.fontSize,fontFamily:u.fontFamily,fontWeight:u.fontWeight,foreColor:h,dominantBaseline:"central",cssClass:e.textClass||"apexcharts-outer-label"});if(p>1){const t=y.node.getElementsByTagName("tspan");for(let e=0;e<t.length;e++)t[e].setAttribute("x",`${f}`),t[e].setAttribute("dy",0===e?"0":`${a}`)}return m.add(y),m}(n,{lines:t.lines,lineHeight:w,anchor:t.anchor,elbow:t.elbow,labelX:t.labelX,labelY:t.labelY,side:t.side,connector:{show:!1!==c.show,width:null!=c.width?c.width:1.5,color:c.color||e},style:{fontSize:o.fontSize,fontFamily:o.fontFamily||n.config.chart.fontFamily,fontWeight:o.fontWeight},foreColor:o.color||n.config.chart.foreColor,groupClass:"apexcharts-unit-outer-label-group",textClass:"apexcharts-unit-outer-label",connectorClass:"apexcharts-unit-label-connector"}))}),t.add(v)}_drawClusterLabel(t,e,i,a,s,r){const n=this.w;if(!S.isBrowser())return;const o="http://www.w3.org/2000/svg",l=n.seriesData.seriesNames[e.i]||`series-${e.i+1}`,c=a>0?i/a*100:0,u=s.clusterLabels,h=parseFloat(u.fontSize)||13;let d;d="function"==typeof u.formatter?u.formatter(l,{seriesIndex:e.i,value:i,percent:c,w:n}):`${l} (${c.toFixed(1)}%)`;const m="string"==typeof d?d:String(d),f=R.createElementNS(o,"text");f.setAttribute("class","apexcharts-unit-label"),f.setAttribute("text-anchor","middle"),f.setAttribute("font-size",`${h}px`),f.setAttribute("font-family",u.fontFamily||n.config.chart.fontFamily||"inherit"),f.setAttribute("font-weight",String(u.fontWeight||600)),f.setAttribute("fill",u.color||r);const p="bottom"===u.position,x=e.outerR+.6*h+3+(u.offsetY||0),g=m.length*h*.55;if(!p&&!e.flat&&!1!==u.curved&&g<=Math.PI*x*.95){const i=e.cy,a=`M ${e.cx-x} ${i} A ${x} ${x} 0 0 1 ${e.cx+x} ${i}`,s=`apexcharts-unit-label-${n.globals.chartID}-${e.i}`,r=R.createElementNS(o,"path");r.setAttribute("id",s),r.setAttribute("d",a),r.setAttribute("fill","none"),r.setAttribute("stroke","none");const l=R.createElementNS(o,"textPath");l.setAttribute("href",`#${s}`),l.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",`#${s}`),l.setAttribute("startOffset","50%"),l.textContent=m,f.appendChild(l),t.node.appendChild(r)}else{f.setAttribute("x",String(e.cx));const t=p?e.cy+e.outerR+h+6+(u.offsetY||0):e.cy-e.outerR-6-(u.offsetY||0);f.setAttribute("y",String(t)),f.textContent=m}t.node.appendChild(f)}}}),Object.defineProperty(exports,"default",{enumerable:!0,get:()=>u.default});