import{W as u}from"./WidgetCard-CLnTgmXL.js";import{X as g}from"./primevue-CfIk0_DY.js";import{_ as f}from"./index-BxIwIJfy.js";import{b as n,k as m,l as y,c as o,v as h,a7 as v,d as s,y as l}from"./vue-core-Di3IuVqe.js";const b={key:0,class:"widget-chart"},k={key:1,class:"widget-chart__nodata"},A={__name:"WidgetChart",props:{title:{type:String,required:!0},icon:{type:String,default:"pi pi-chart-line"},type:{type:String,default:"line"},chartData:{type:Object,required:!0},options:{type:Object,default:()=>({})},loading:{type:Boolean,default:!1},error:{type:String,default:""},editing:{type:Boolean,default:!1}},emits:["refresh","remove"],setup(e){const i=e,d=l(()=>{const a=i.chartData?.datasets;return!Array.isArray(a)||a.length===0?!1:a.some(t=>Array.isArray(t.data)&&t.data.length>0)}),r={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{position:"bottom",labels:{boxWidth:12,font:{size:10},padding:8}},tooltip:{enabled:!0}}},p=l(()=>({...r,...i.options||{},plugins:{...r.plugins,...i.options?.plugins||{}}}));return(a,t)=>(n(),m(u,{title:e.title,icon:e.icon,loading:e.loading,error:e.error,editing:e.editing,onRefresh:t[0]||(t[0]=c=>a.$emit("refresh")),onRemove:t[1]||(t[1]=c=>a.$emit("remove"))},{default:y(()=>[d.value?(n(),o("div",b,[h(v(g),{type:e.type,data:e.chartData,options:p.value,class:"widget-chart__canvas"},null,8,["type","data","options"])])):(n(),o("div",k,[...t[2]||(t[2]=[s("i",{class:"pi pi-chart-line"},null,-1),s("span",null,"Aucune donnée",-1)])]))]),_:1},8,["title","icon","loading","error","editing"]))}},D=f(A,[["__scopeId","data-v-420bb479"]]);export{D as W};
