import{W as s}from"./WidgetChart-CQnj_aQq.js";import{b as d,k as p,y as g}from"./vue-core-Di3IuVqe.js";import"./WidgetCard-CLnTgmXL.js";import"./primevue-CfIk0_DY.js";import"./index-BxIwIJfy.js";import"./cjs-helpers-psZwOBky.js";import"./vue-cal-DKMVGERa.js";import"./moment-BeHQNF8T.js";const $={__name:"WidgetDepensesParCategorie",props:{data:{type:[Array,Object,null],default:null},loading:{type:Boolean,default:!1},error:{type:String,default:""},editing:{type:Boolean,default:!1}},emits:["refresh","remove"],setup(a){const o=a,i=["#ef4444","#f59e0b","#10b981","#3b82f6","#8b5cf6","#ec4899","#14b8a6","#f97316","#84cc16","#6366f1"],n=g(()=>{const e=Array.isArray(o.data)?o.data:[];return{labels:e.map(t=>t.charge||"Sans catégorie"),datasets:[{data:e.map(t=>t.pourcentage||0),backgroundColor:e.map((t,r)=>i[r%i.length]),borderWidth:0}]}}),l={plugins:{legend:{position:"right",labels:{font:{size:10},boxWidth:12,padding:6}},tooltip:{callbacks:{label:e=>`${e.label}: ${e.parsed.toFixed(2)} %`}}}};return(e,t)=>(d(),p(s,{title:"Dépenses par catégorie",icon:"pi pi-chart-pie",type:"doughnut","chart-data":n.value,options:l,loading:a.loading,error:a.error,editing:a.editing,onRefresh:t[0]||(t[0]=r=>e.$emit("refresh")),onRemove:t[1]||(t[1]=r=>e.$emit("remove"))},null,8,["chart-data","loading","error","editing"]))}};export{$ as default};
