(function(o,c){typeof exports=="object"&&typeof module<"u"?module.exports=c(require("vue"),require("apexcharts/core")):typeof define=="function"&&define.amd?define(["vue","apexcharts/core"],c):(o=typeof globalThis<"u"?globalThis:o||self,o.VueApexChartsCore=c(o.Vue,o.ApexCharts))})(this,function(o,c){"use strict";const x=["animationEnd","beforeMount","mounted","updated","click","mouseMove","mouseLeave","legendClick","markerClick","selection","dataPointSelection","dataPointMouseEnter","dataPointMouseLeave","beforeZoom","beforeResetZoom","zoomed","scrolled","brushScrolled"],p=o.defineComponent({name:"apexchart",props:{options:{type:Object},type:{type:String},series:{type:Array,required:!0},width:{default:"100%"},height:{default:"auto"}},emits:x,setup(i,{emit:j}){const y=o.ref(null),n=o.ref(null),w=e=>e&&typeof e=="object"&&!Array.isArray(e)&&e!=null,O=(e,t)=>{typeof Object.assign!="function"&&function(){Object.assign=function(s){if(s==null)throw new TypeError("Cannot convert undefined or null to object");let m=Object(s);for(let r=1;r<arguments.length;r++){let f=arguments[r];if(f!=null)for(let g in f)f.hasOwnProperty(g)&&(m[g]=f[g])}return m}}();let a=Object.assign({},e);return w(e)&&w(t)&&Object.keys(t).forEach(s=>{w(t[s])?s in e?a[s]=O(e[s],t[s]):Object.assign(a,{[s]:t[s]}):Object.assign(a,{[s]:t[s]})}),a},l=e=>JSON.parse(JSON.stringify(e)),h=async()=>{if(await o.nextTick(),n.value)return;const e={chart:{type:i.type||i.options.chart&&i.options.chart.type||"line",height:i.height,width:i.width,events:{}},series:l(i.series)},t=i.options.chart?i.options.chart.events:null;x.forEach(s=>{let m=(...r)=>j(s,...r);e.chart.events[s]=(...r)=>{m(...r),t&&t.hasOwnProperty(s)&&t[s](...r)}});const a=O(i.options,e);return n.value=new c(y.value,a),n.value.render()},v=()=>(S(),h()),S=()=>{n.value.destroy(),n.value=null},P=(e,t)=>n.value.updateSeries(e,t),C=(e,t,a,s)=>n.value.updateOptions(e,t,a,s),E=e=>n.value.toggleSeries(e),M=e=>{n.value.showSeries(e)},D=e=>{n.value.hideSeries(e)},T=(e,t)=>n.value.appendSeries(e,t),U=()=>{n.value.resetSeries()},L=(e,t)=>{n.value.toggleDataPointSelection(e,t)},R=e=>n.value.appendData(e),X=(e,t)=>n.value.zoomX(e,t),q=e=>n.value.dataURI(e),z=e=>n.value.setLocale(e),I=(e,t)=>{n.value.addXaxisAnnotation(e,t)},_=(e,t)=>{n.value.addYaxisAnnotation(e,t)},B=(e,t)=>{n.value.addPointAnnotation(e,t)},J=(e,t)=>{n.value.removeAnnotation(e,t)},N=()=>{n.value.clearAnnotations()};o.onBeforeMount(()=>{window.ApexCharts=c}),o.onMounted(()=>{y.value=o.getCurrentInstance().proxy.$el,h()}),o.onBeforeUnmount(()=>{n.value&&S()});const u=o.toRefs(i);let d=null;const A=e=>{d||(d={options:!1,series:!1},o.nextTick(()=>{const t=d;if(d=null,!n.value){h();return}if(t.options&&t.series){const a=l(i.options);a.series=l(i.series),n.value.updateOptions(a)}else t.options?n.value.updateOptions(l(i.options)):t.series&&n.value.updateSeries(l(i.series))})),d[e]=!0};return o.watch(u.options,()=>{A("options")}),o.watch(u.series,()=>{A("series")},{deep:!0}),o.watch(u.type,()=>{v()}),o.watch(u.width,()=>{v()}),o.watch(u.height,()=>{v()}),{chart:n,init:h,refresh:v,destroy:S,updateOptions:C,updateSeries:P,toggleSeries:E,showSeries:M,hideSeries:D,resetSeries:U,zoomX:X,toggleDataPointSelection:L,appendData:R,appendSeries:T,addXaxisAnnotation:I,addYaxisAnnotation:_,addPointAnnotation:B,removeAnnotation:J,clearAnnotations:N,setLocale:z,dataURI:q}},render(){return o.h("div",{class:"vue-apexcharts"})}}),b=i=>{i.component(p.name,p)};return p.install=b,p});
