apexcharts
Version:
A JavaScript Chart Library
6 lines (5 loc) • 22 kB
JavaScript
/*!
* ApexCharts v7.0.0
* (c) 2018-2026 ApexCharts
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ApexStoryboard={})}(this,function(e){"use strict";var t=Object.defineProperty,n=Object.defineProperties,i=Object.getOwnPropertyDescriptors,s=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable,o=(e,n,i)=>n in e?t(e,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[n]=i,l=(e,t)=>{for(var n in t||(t={}))r.call(t,n)&&o(e,n,t[n]);if(s)for(var n of s(t))a.call(t,n)&&o(e,n,t[n]);return e},c=(e,t)=>n(e,i(t));const d=globalThis.ApexCharts,u=globalThis.ApexCharts.__internals.__apex_Environment_Environment,h=globalThis.ApexCharts.__internals;h.__apex_Animations,h.__apex_Animations_computeStagger,h.__apex_Animations_applyAnimationPolicy;const p=h.__apex_Animations_prefersReducedMotion;h.__apex_Animations_applyProgressiveReveal;const f=globalThis.console;function v(e){f.error(e)}function y(e){f.warn(e)}const m="APEX-",g=new Date("2027-07-31T00:00:00Z"),b="__apex_license_v1__";function x(){const e=globalThis;let t=e[b];return t||(t={key:null,listeners:new Set,result:null},e[b]=t),t}const w=class{static get licenseKey(){return x().key}static set licenseKey(e){x().key=e}static get listeners(){return x().listeners}static get validationResult(){return x().result}static set validationResult(e){x().result=e}static getKey(){return this.licenseKey}static getLicenseStatus(){return this.licenseKey?(this.validationResult=this.validateKey(this.licenseKey),this.validationResult):{expired:!1,signatureVerified:!1,valid:!1}}static isKeyValid(e){return!!e&&this.validateKey(e).valid}static isLicenseValid(){return this.getLicenseStatus().valid}static onChange(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}static setLicense(e){var t,n;if(!e)return this.licenseKey=null,void this.publish({expired:!1,signatureVerified:!1,valid:!1});const i=this.validateKey(e);i.valid||e===this.licenseKey||!(null==(n=this.validationResult)?void 0:n.valid)?(this.licenseKey=e,this.publish(i),i.valid||v(`[Apex] ${i.message}`)):y(`[Apex] Ignoring license key: ${null!=(t=i.message)?t:"it is not valid"} A valid license is already active on this page.`)}static validateKey(e){const t=this.parseKey(e),n=this.validateStructure(e,t);if(!n.valid||!(null==t?void 0:t.signature))return n;const i=this.verdicts.get(e);return!1===i?{data:t.data,expired:!1,message:"Invalid license key. The license signature does not verify.",signatureVerified:!0,valid:!1}:(void 0===i&&this.verifySignature(e,t,n),c(l({},n),{signatureVerified:!0===i}))}static _resetSignatureState(){this.verdicts.clear(),this.verifying.clear(),this.warnedUnverifiable=!1,this.epoch++}static base64ToBytes(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n=t.padEnd(4*Math.ceil(t.length/4),"="),i=globalThis.atob;if("function"!=typeof i)throw new Error("no base64 decoder available");const s=i(n),r=new Uint8Array(s.length);for(let e=0;e<s.length;e++)r[e]=s.charCodeAt(e);return r}static canonicalPayload(e){const t=e.domains&&e.domains.length>0?e.domains.join(","):"";return`v1|${e.issueDate}|${e.expiryDate}|${e.plan}|${t}`}static notify(e){for(const t of this.listeners)try{t(e)}catch(e){}}static parseKey(e){if("string"!=typeof e||!e.startsWith(m))return null;const t=e.slice(5);if(!t)return null;try{const e=(new TextDecoder).decode(this.base64ToBytes(t)),n=JSON.parse(e);return n.issueDate&&n.expiryDate&&n.plan?{data:{domains:Array.isArray(n.domains)?n.domains:void 0,expiryDate:n.expiryDate,issueDate:n.issueDate,plan:n.plan,valid:!0},signature:"string"==typeof n.sig&&n.sig?n.sig:null}:null}catch(e){return null}}static publish(e){this.validationResult=e,this.notify(e)}static validateStructure(e,t){const n=e=>({expired:!1,message:e,signatureVerified:!1,valid:!1});if("string"!=typeof e||!e.startsWith(m))return n('Invalid license key format. License key must start with "APEX-".');if(!t)return n("Invalid license key. Unable to decode license data.");const{data:i,signature:s}=t;if(!s&&new Date>=g)return n("This license key is in the old unsigned format, which is no longer accepted. Please request a replacement key.");if(new Date(i.expiryDate)<new Date)return{data:i,expired:!0,message:`License expired on ${i.expiryDate}. Please renew your license.`,signatureVerified:!1,valid:!1};if(i.domains&&i.domains.length>0){const e="undefined"==typeof location?"":location.hostname;if(!i.domains.some(t=>e===t||e.endsWith(`.${t}`)))return{data:i,expired:!1,message:`License is not valid for this domain (${e}). Allowed domains: ${i.domains.join(", ")}.`,signatureVerified:!1,valid:!1}}return{data:i,expired:!1,signatureVerified:!1,valid:!0}}static verifySignature(e,t,n){return i=this,s=null,r=function*(){var i;if(this.verifying.has(e)||this.verdicts.has(e))return;this.verifying.add(e);const s=this.epoch,r=null==(i=globalThis.crypto)?void 0:i.subtle;if(!r||0===this.publicKeysSpki.length)return this.verifying.delete(e),void(this.warnedUnverifiable||(this.warnedUnverifiable=!0,y(r?"[Apex] No license signing key is configured in this build, so license signatures cannot be verified.":"[Apex] Web Crypto is unavailable (a secure context is required), so the license signature cannot be verified.")));const a=(new TextEncoder).encode(this.canonicalPayload(t.data));let o=!1;for(const e of this.publicKeysSpki){try{const n=yield r.importKey("spki",this.base64ToBytes(e),{name:"ECDSA",namedCurve:"P-256"},!1,["verify"]);o=yield r.verify({hash:"SHA-256",name:"ECDSA"},n,this.base64ToBytes(t.signature),a)}catch(e){o=!1}if(o)break}if(this.verifying.delete(e),this.epoch!==s)return;if(this.verdicts.set(e,o),o){const t=c(l({},n),{signatureVerified:!0});return void(this.licenseKey===e?this.publish(t):this.notify(t))}const d="Invalid license key. The license signature does not verify.",u={data:t.data,expired:!1,message:d,signatureVerified:!0,valid:!1};this.licenseKey===e?this.publish(u):this.notify(u),v(`[Apex] ${d}`)},new Promise((e,t)=>{var n=e=>{try{o(r.next(e))}catch(e){t(e)}},a=e=>{try{o(r.throw(e))}catch(e){t(e)}},o=t=>t.done?e(t.value):Promise.resolve(t.value).then(n,a);o((r=r.apply(i,s)).next())});var i,s,r}};w.publicKeysSpki=["MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEQIaK9UMD6n0oR/FIy8QdL0uSzKMQlf1BB+tOrji4/WuHsyRNxeDhVykoSsNURozMi1xhmqWvBH1L//xIfugTPA=="],w.verdicts=new Map,w.verifying=new Set,w.warnedUnverifiable=!1,w.epoch=0;let _=w;const A=class{static applyStyles(e){Object.assign(e.style,this.CRITICAL_STYLES,{backgroundImage:this.createWatermarkPattern(),backgroundRepeat:"repeat"})}static node(e){return e?e.querySelector(`[${this.WATERMARK_ATTR}]`):null}static add(e,t){return e&&"undefined"!=typeof document?(this.setManaged(e,t),this.paint(e)):null}static exists(e){return!!this.node(e)}static remove(e,t){e&&(this.setManaged(e,t),this.erase(e))}static untrack(e){this.managed.delete(e)}static createWatermarkPattern(){const e=this.WATERMARK_TEXT;return`url("data:image/svg+xml,${encodeURIComponent(`\n <svg xmlns="http://www.w3.org/2000/svg" width="300" height="200">\n <text\n x="50%"\n y="50%"\n dominant-baseline="middle"\n text-anchor="middle"\n font-family="-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Arial, sans-serif"\n font-size="18"\n font-weight="600"\n fill="rgba(134, 134, 134, 0.1)"\n transform="rotate(-35, 100, 60)"\n >${e}</text>\n </svg>\n `.trim())}")`}static erase(e){var t;null==(t=this.node(e))||t.remove()}static paint(e){let t=this.node(e);return t||(t=document.createElement("div"),t.setAttribute(this.WATERMARK_ATTR,""),e.appendChild(t)),this.applyStyles(t),"function"==typeof getComputedStyle&&"static"===getComputedStyle(e).position&&(e.style.position="relative"),t}static reconcile(){const e=_.isLicenseValid();for(const t of this.managed)t.isConnected?e?this.erase(t):this.paint(t):this.managed.delete(t)}static setManaged(e,t){!1!==(null==t?void 0:t.manage)?this.track(e):this.managed.delete(e)}static track(e){this.managed.add(e),this.subscribed||(this.subscribed=!0,_.onChange(()=>{this.reconcile()}))}};A.WATERMARK_ATTR="data-apexcharts-watermark",A.WATERMARK_TEXT="APEXCHARTS",A.ATTR="data-apexcharts-watermark",A.CRITICAL_STYLES={bottom:"0",display:"block",left:"0",msUserSelect:"none",opacity:"1",pointerEvents:"none",position:"absolute",right:"0",top:"0",userSelect:"none",visibility:"visible",webkitUserSelect:"none",zIndex:"10000"},A.managed=new Set,A.subscribed=!1;let S=A;const k="https://apexcharts.com/pricing";let O=!1;const T=new Set;function E(){O=!0,K()}const I=new Set(["premium","enterprise"]);function C(e,t){const n=S.add(t,{manage:!1});if(!n||"undefined"==typeof MutationObserver)return;if(e._wmNodeObserver&&e._wmObservedNode===n)return;e._wmNodeObserver&&e._wmNodeObserver.disconnect();const i=new MutationObserver(()=>{const e=S.node(t);e&&(i.disconnect(),S.applyStyles(e),i.takeRecords(),i.observe(e,{attributes:!0,attributeFilter:["style"]}))});i.observe(n,{attributes:!0,attributeFilter:["style"]}),e._wmNodeObserver=i,e._wmObservedNode=n}function R(e,t){e._wmWrapObserver&&(e._wmWrapObserver.disconnect(),e._wmWrapObserver=null),e._wmNodeObserver&&(e._wmNodeObserver.disconnect(),e._wmNodeObserver=null),e._wmObservedNode=null;const n=t||e.w&&e.w.dom&&e.w.dom.elWrap;n&&S.remove(n,{manage:!1})}function P(e,t){try{if(!u.isBrowser())return;if(e&&e.globals&&e.globals.isDestroyed)return void T.delete(t);const n=e&&e.dom&&e.dom.elWrap;if(!n)return;const i=function(e,t){const n=e&&e.config&&e.config.chart||{},i=[];"unit"===n.type&&i.push("unit"),t.trellis&&"function"==typeof t.trellis.isActive&&t.trellis.isActive()&&i.push("trellis"),t.storyboard&&t.storyboard._used&&i.push("storyboard");const s=n.link;return t.linkedViews&&s&&(!0===s.enabled||"function"==typeof s.dimension)&&i.push("link"),t.ink&&n.ink&&!0===n.ink.enabled&&i.push("ink"),t.measure&&n.measure&&!0===n.measure.enabled&&i.push("measure"),t.contextMenu&&n.contextMenu&&!0===n.contextMenu.enabled&&i.push("context-menu"),t.perspectives&&(t.perspectives._used||O)&&i.push("perspectives"),t.history&&n.history&&!0===n.history.enabled&&i.push("history"),i}(e,t);if(0===i.length)return T.delete(t),void R(t,n);T.add(t);const s=function(e){const t=e&&e.config&&e.config.chart&&e.config.chart.license;if(t)return t;const n=_.getKey();if(n)return n;const i=u.getApex();return i&&i.license?i.license:null}(e);if(function(e){if(!e)return!1;const t=_.validateKey(e);if(!t.valid)return!1;const n=t.data&&t.data.plan;return"string"==typeof n&&I.has(n.toLowerCase())}(s))return void R(t,n);!function(e,t){if(C(e,t),"undefined"==typeof MutationObserver||e._wmWrapObserver)return;const n=new MutationObserver(()=>{S.node(t)||C(e,t)});n.observe(t,{childList:!0}),e._wmWrapObserver=n}(t,n),function(e,t,n){if(e._premiumLicenseNotified)return;e._premiumLicenseNotified=!0;const i=n.length>1;if(!t)return void console.warn(`[ApexCharts] Premium feature${i?"s":""} in use (${n.join(", ")}) without a license. Running in trial mode with a watermark. Get a license: ${k}`);const s=_.validateKey(t);if(s.valid){const e=s.data&&s.data.plan||"current";return void console.warn(`[ApexCharts] Premium feature${i?"s":""} in use (${n.join(", ")}) require a Premium or Enterprise license; the ${e} plan does not include ${i?"them":"it"}. Running in trial mode with a watermark. Upgrade: ${k}`)}t!==_.getKey()&&console.error(`[Apex] ${s.message}`)}(t,s,i)}catch(e){}}function K(){if(!u.isBrowser())return;const e=new Set,t=u.getApex(),n=t&&t._chartInstances;Array.isArray(n)&&n.forEach(t=>{const n=t&&t.chart;n&&n.w&&!n.w.globals.isDestroyed&&(e.add(n),P(n.w,n))}),Array.from(T).forEach(t=>{const n=t&&t.w,i=n&&n.dom&&n.dom.elWrap;n&&!n.globals.isDestroyed&&i&&!1!==i.isConnected?e.has(t)||P(n,t):T.delete(t)})}_.onChange(K);const D=globalThis.ApexCharts.__internals.__apex_Utils;function $(e,t){const n=null!=e,i=null!=t;return n||i?{min:n?e:null,max:i?t:null}:null}function M(e){return Array.isArray(e)?e.map(e=>Array.isArray(e)?e.slice():e):[]}function L(e,t){return"function"==typeof e&&t?e===t.addXaxisAnnotation?"xaxis":e===t.addYaxisAnnotation?"yaxis":e===t.addPointAnnotation?"point":null:null}function N(e,t){const n=e.config.annotations?D.clone(e.config.annotations):null,i=[],s=e.globals.memory&&e.globals.memory.methodsToExec||[];for(const e of s){if(!e||"addAnnotation"!==e.label)continue;const n=L(e.method,t);n&&i.push({kind:n,params:D.clone(e.params)})}return{static:n,dynamic:i}}function j(e){const t=e&&e.measure;if(!t||"function"!=typeof t.getPins)return null;const n=t.getPins();return Array.isArray(n)&&n.length?{pins:n}:null}function U(e,t,{animate:n=!0,mergeOptions:i}={}){var s,r;if(!e||!t)return;"number"==typeof t.v&&t.v>1&&console.warn(`[apexcharts] ViewState v${t.v} is newer than this build understands (v1); applying best-effort.`),e.clearAnnotations();const a=i?D.clone(i):{},o=t.window&&t.window.xaxis;a.xaxis=Object.assign({},a.xaxis,o?{min:null!=(s=o.min)?s:void 0,max:null!=(r=o.max)?r:void 0}:{min:void 0,max:void 0});const l=t.window&&t.window.yaxis;if(Array.isArray(l)&&(a.yaxis=l.map(e=>{var t,n;return e?{min:null!=(t=e.min)?t:void 0,max:null!=(n=e.max)?n:void 0}:{}})),t.theme){const e={};null!=t.theme.mode&&(e.mode=t.theme.mode),null!=t.theme.palette&&(e.palette=t.theme.palette),Object.keys(e).length&&(a.theme=Object.assign({},a.theme,e))}t.annotations&&t.annotations.static&&(a.annotations=D.clone(t.annotations.static)),e.updateOptions(a,!1,n,!1,!1),function(e,t){if(!e||!t)return;const n=e.w;n.interact.zoomed=!!t.zoomed,function(e,t,n){const i=e.w;if(null==t&&null==n)return;const s=i.globals.seriesNames||[],r=new Set([...t||[],...n||[]]),a=new Set([...i.globals.collapsedSeriesIndices||[],...i.globals.ancillaryCollapsedSeriesIndices||[]]);for(let t=0;t<s.length;t++){const n=s[t];if(null==n)continue;const i=r.has(t),o=a.has(t);i&&!o?e.hideSeries(n):!i&&o&&e.showSeries(n)}}(e,t.collapsed,t.ancillaryCollapsed),t.annotations&&Array.isArray(t.annotations.dynamic)&&t.annotations.dynamic.forEach(t=>{const n=function(e){switch(e){case"xaxis":return"addXaxisAnnotation";case"yaxis":return"addYaxisAnnotation";case"point":return"addPointAnnotation";default:return null}}(t.kind);n&&"function"==typeof e[n]&&e[n](t.params,!0)});(function(e,t){Array.isArray(t)&&(e.w.interact.selectedDataPoints=M(t))})(e,t.selectedDataPoints),t.locale&&t.locale!==n.config.chart.defaultLocale&&e.setLocale(t.locale);e.measure&&"function"==typeof e.measure.setPins&&e.measure.setPins(t.measure&&t.measure.pins||[])}(e,t)}const B="apex";function W(e){return function(e){if("undefined"!=typeof Buffer)return Buffer.from(e,"utf-8").toString("base64");const t=(new TextEncoder).encode(e);let n="";for(let e=0;e<t.length;e++)n+=String.fromCharCode(t[e]);return btoa(n)}(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function V(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");for(;t.length%4;)t+="=";return function(e){if("undefined"!=typeof Buffer)return Buffer.from(e,"base64").toString("utf-8");const t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return(new TextDecoder).decode(n)}(t)}class z{constructor(e,t){this.w=e,this.ctx=t,this._saved=[],this._counter=0,this._used=!1}capture(){const e={v:1,view:function(e,t){var n,i;const s=e.config.xaxis||{},r=(Array.isArray(e.config.yaxis)?e.config.yaxis:e.config.yaxis?[e.config.yaxis]:[]).map(e=>$(e&&e.min,e&&e.max)),a=r.some(e=>null!==e),o=e.config.theme,l=t&&t.drilldown;return{v:1,window:{xaxis:$(s.min,s.max),yaxis:a?r:null},zoomed:!!e.interact.zoomed,collapsed:(e.globals.collapsedSeriesIndices||[]).slice(),ancillaryCollapsed:(e.globals.ancillaryCollapsedSeriesIndices||[]).slice(),selectedDataPoints:M(e.interact.selectedDataPoints),theme:o?{mode:null!=(n=o.mode)?n:null,palette:null!=(i=o.palette)?i:null}:null,locale:e.config.chart&&e.config.chart.defaultLocale||null,annotations:N(e,t),drill:l&&l.depth>0?{path:l.path.slice()}:null,measure:j(t)}}(this.w,this.ctx)},t=this._serializableDelta();return t&&Object.keys(t).length&&(e.options=t),e}_serializableDelta(){const e=this.w.config,t=e.chart&&e.chart.perspectives&&e.chart.perspectives.serializeOptions||["theme","xaxis","yaxis","title","subtitle"],n={};return t.forEach(t=>{if(void 0!==e[t]){const i=function(e){try{return JSON.parse(JSON.stringify(e))}catch(e){return}}(e[t]);void 0!==i&&(n[t]=i)}}),n}encode(e){const t=e||this.capture();return W(JSON.stringify(t))}decode(e){return z.decode(e)}toURL(){if(!u.isBrowser())return"";const e=this.encode(this.capture()),t=new URL(window.location.href);return t.hash=`${B}=${e}`,t.toString()}apply(e,t={}){const n="string"==typeof e?z.decode(e):e;if(!n||!n.view)return;this._used=!0,P(this.w,this.ctx);const i=void 0===t.animate||t.animate,s=D.extend(n.options?D.clone(n.options):{},t.mergeOptions||{}),r=Object.keys(s).length?s:void 0;(this.w.config.chart.group?this.ctx.getSyncedCharts():[this.ctx]).forEach(e=>{U(e,n.view,{animate:i,mergeOptions:r})})}save(e){const t="perspective-"+ ++this._counter;return this._saved.push({id:t,name:e||t,token:this.capture()}),this._used=!0,P(this.w,this.ctx),t}list(){return this._saved.map(e=>({id:e.id,name:e.name,token:e.token}))}delete(e){const t=this._saved.findIndex(t=>t.id===e);t>-1&&this._saved.splice(t,1)}teardown(){this._saved=[],this._counter=0}static decode(e){if("string"!=typeof e||!e)return null;try{const t=JSON.parse(V(e));return t&&"object"==typeof t?1!==t.v?(console.warn(`apexcharts: unsupported perspective version ${t.v} (expected 1).`),null):t:null}catch(e){return console.warn("apexcharts: failed to decode perspective token.",e),null}}static fromURL(e){try{const t=e||(u.isBrowser()?window.location.href:"");if(!t)return null;const n=new URL(t).hash.replace(/^#/,"");if(!n)return null;const i=n.split("&").map(e=>e.split("=")).find(e=>e[0]===B);return i&&null!=i[1]?z.decode(decodeURIComponent(i[1])):null}catch(e){return null}}}d.registerFeatures({perspectives:z}),d.perspectives={decode:e=>(E(),z.decode(e)),fromURL:e=>(E(),z.fromURL(e))},d.registerFeatures({storyboard:class{constructor(e,t){this.w=e,this.ctx=t,this._beats=[],this._observer=null,this._activeIndex=-1,this._animate=!0,this._warnedNoPerspectives=!1,this._used=!1}bind(e={}){var t;if(this.unbind(),!u.isBrowser())return 0;const n=this.ctx.el&&this.ctx.el.ownerDocument;if(!n||"undefined"==typeof IntersectionObserver)return 0;let i=null;if(e.scroller&&(i="string"==typeof e.scroller?n.querySelector(e.scroller):e.scroller),this._beats=this._resolveBeats(n,i,e.beats),!this._beats.length)return 0;this._animate=!1!==e.animate;const s=Math.min(Math.max(null!=(t=e.offset)?t:.5,0),1),r=+(100*s).toFixed(3),a=+(100-100*s).toFixed(3);return this._observer=new IntersectionObserver(e=>this._onIntersect(e),{root:i,rootMargin:`-${r}% 0px -${a}%`,threshold:0}),this._beats.forEach(e=>{var t;return null==(t=this._observer)?void 0:t.observe(e.el)}),this._used=!0,P(this.w,this.ctx),this._beats.length}_resolveBeats(e,t,n){const i=[];if(Array.isArray(n))return n.forEach((t,n)=>{var s,r;if(!t)return;const a=t.el&&"object"==typeof t.el?t.el:t.selector?e.querySelector(t.selector):null;a?i.push({el:a,key:null!=(r=null!=(s=t.key)?s:a.getAttribute("data-apex-beat"))?r:String(n),view:t.view,options:t.options,announce:t.announce,onEnter:"function"==typeof t.onEnter?t.onEnter:void 0}):console.warn(`apexcharts: storyboard beat ${n} has no resolvable element; skipped.`)}),i;return(t||e).querySelectorAll("[data-apex-beat]").forEach((e,t)=>{i.push({el:e,key:e.getAttribute("data-apex-beat")||String(t),view:e.getAttribute("data-apex-view")||void 0,options:void 0,announce:e.getAttribute("data-apex-announce")||void 0,onEnter:void 0})}),i}_onIntersect(e){e.forEach(e=>{const t=this._beats.findIndex(t=>t.el===e.target);t<0||(e.isIntersecting?this._activate(t):t===this._activeIndex&&e.rootBounds&&e.boundingClientRect.top>=e.rootBounds.bottom&&t>0&&this._activate(t-1))})}_activate(e,t={}){var n,i;if(e===this._activeIndex)return;const s=this._beats[e];if(!s)return;const r=e>this._activeIndex?"down":"up";this._activeIndex=e;const a=(void 0!==t.animate?t.animate:this._animate)&&!p();if(null!=s.view||s.options)if(this.ctx.perspectives){const e=null!=(n=s.view)?n:{},t="string"==typeof e||e.view?e:{view:this._normalizeView(e)};this.ctx.perspectives.apply(t,{animate:a,mergeOptions:s.options})}else this._warnedNoPerspectives||(this._warnedNoPerspectives=!0,console.warn('apexcharts: storyboard beats carry views but the perspectives feature is not bundled. import "apexcharts/features/storyboard" (which includes it) or drive beats via onEnter.'));const o={index:e,key:s.key,el:s.el,direction:r};s.onEnter&&s.onEnter(this.ctx,o),s.announce&&this._announce(s.announce),"function"==typeof this.w.config.chart.events.beatChange&&this.w.config.chart.events.beatChange(this.ctx,o),null==(i=this.ctx.events)||i.fireEvent("beatChange",[this.ctx,o])}_normalizeView(e){const t=e.annotations&&e.annotations.static||{};return c(l({},e),{annotations:{static:l({points:[],xaxis:[],yaxis:[],texts:[],images:[]},t),dynamic:e.annotations&&e.annotations.dynamic||[]}})}goTo(e,t={}){const n="number"==typeof e?e:this._beats.findIndex(t=>t.key===e);n>=0&&n<this._beats.length&&this._activate(n,t)}current(){if(this._activeIndex<0)return null;const e=this._beats[this._activeIndex];return{index:this._activeIndex,key:e?e.key:null}}unbind(){this._observer&&(this._observer.disconnect(),this._observer=null),this._beats=[],this._activeIndex=-1,this._used=!1,P(this.w,this.ctx)}teardown(){this.unbind()}_announce(e){const t=this.w;if(!t.config.chart.accessibility.announcements.enabled)return;const n=t.dom.baseEl;if(!n)return;const i=n.querySelector(".apexcharts-sr-status");i&&(i.textContent="",setTimeout(()=>{i.textContent=e},0))}}}),e.default=d,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});