import{C as y}from"./DonutChart.e50d2c5a.js";import{U as k}from"./AnimatedNumber.fefc164a.js";import{S as b}from"./Loading.798be42a.js";import{_ as p}from"./_plugin-vue_export-helper.eefbdd86.js";import{as as r,f as t,i as l,j as s,a0 as C,U as u,M as d,Q as i,O as v,ad as x,V as L,R as S,ae as T,P as N,S as q}from"./vendor-vue-ui.33864987.js";const V={emits:["onLabelClick"],components:{CoreDonutChart:y,UtilAnimatedNumber:k,SvgSeoSiteScoreLoading:b},props:{parts:{type:Array,required:!0},total:{type:Number,required:!0},label:{type:String,required:!0},link:{type:String,required:!1},animatedNumber:{type:Boolean,default(){return!0}},maxTotal:{type:String,required:!1},loading:{type:Boolean,required:!1},loadingText:{type:String,required:!1}},computed:{sortedParts(){const n=this.parts.map(o=>o);return n.forEach(function(o,e){o.last&&(n.push(n[e]),n.splice(e,1))}),n}},methods:{handleLabelClick(n,o){o?.emitValue&&(n.preventDefault(),this.$emit("onLabelClick",o.emitValue))}}},B={class:"aioseo-donut-chart-with-legend"},A={class:"chart-left"},D={key:0,class:"aioseo-donut-chart-with-legend__loading"},M={key:0,class:"aioseo-donut-chart-with-legend__loading-text"},P={class:"chart-right"},w={class:"legend-amount"},H=["innerHTML"],U={key:0,class:"chart-more"},z=["innerHTML"];function E(n,o,e,I,R,c){const m=r("svg-seo-site-score-loading"),_=r("core-donut-chart"),h=r("util-animated-number");return t(),l("div",B,[s("div",A,[e.loading?(t(),l("div",D,[C(m),e.loadingText?(t(),l("div",M,u(e.loadingText),1)):d("",!0)])):(t(),i(_,{key:1,parts:e.parts,total:e.total,label:e.label,animatedNumber:e.animatedNumber,maxTotal:e.maxTotal,"is-label-colored":""},null,8,["parts","total","label","animatedNumber","maxTotal"]))]),s("div",P,[(t(!0),l(v,null,x(c.sortedParts,(a,g)=>(t(),l("div",{class:"legend",key:g},[s("div",{class:"legend-bullet",style:L(`background-color: ${a.color}`)},null,4),s("span",w,[e.animatedNumber?(t(),i(h,{key:0,number:parseInt(a.count)},null,8,["number"])):(t(),l("div",{key:1,innerHTML:parseInt(a.count)},null,8,H))]),(t(),i(q(a.link?"a":"span"),{href:a.link||null,class:N(["legend-label",{"is-link":a.link}]),onClick:f=>c.handleLabelClick(f,a)},{default:S(()=>[T(u(a.name),1)]),_:2},1032,["href","class","onClick"]))]))),128)),e.link&&e.total>0?(t(),l("div",U,[s("span",{innerHTML:e.link},null,8,z)])):d("",!0)])])}const G=p(V,[["render",E]]);export{G as C};
