import{W as m}from"./WidgetChart-CQnj_aQq.js";import{b as p,k as c,y as f}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 F={__name:"WidgetPaieEffectifParTrancheAge",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 n=a,d=f(()=>{const o=Array.isArray(n.data)?n.data:[],t=new Map;for(const e of o){const i=e.tranche_age||"?";t.has(i)||t.set(i,{tranche_age:i,H:0,F:0});const s=t.get(i);e.type==="H"&&(s.H=e.nb||0),e.type==="F"&&(s.F=e.nb||0)}const r=Array.from(t.values());return{labels:r.map(e=>e.tranche_age),datasets:[{label:"Hommes",data:r.map(e=>e.H),backgroundColor:"#3b82f6",borderWidth:0},{label:"Femmes",data:r.map(e=>e.F),backgroundColor:"#ec4899",borderWidth:0}]}}),l={scales:{x:{grid:{display:!1},ticks:{font:{size:10}}},y:{beginAtZero:!0,ticks:{font:{size:10},precision:0}}}};return(o,t)=>(p(),c(m,{title:"Pyramide des âges",icon:"pi pi-users",type:"bar","chart-data":d.value,options:l,loading:a.loading,error:a.error,editing:a.editing,onRefresh:t[0]||(t[0]=r=>o.$emit("refresh")),onRemove:t[1]||(t[1]=r=>o.$emit("remove"))},null,8,["chart-data","loading","error","editing"]))}};export{F as default};
