import{U as g}from"./AnimatedNumber.97e7e241.js";import{_ as m}from"./_plugin-vue_export-helper.eefbdd86.js";import{o as n,c as s,a3 as b,a6 as u,a4 as r,F as d,af as k,_ as a,l as x,a2 as w,a1 as v,$ as C,ae as h}from"./runtime-core.esm-bundler.ce5add0b.js";const L={emits:["resize"],props:{targetLineCount:{default:1,type:Number},unit:{default:"px",type:String},min:{default:12,type:Number},max:{default:36,type:Number},constrainToElement:{type:[Boolean,Element],default(){return!1}},elementPadding:{type:Number,default(){return 0}}},data(){return{observer:null}},methods:{calculate(){const e=this.$el,i=this.unit==="px"?1:.05;let t=this.max;if(e.style.display="inline-block",e.style.lineHeight="1px",e.style.fontSize=t+this.unit,this.constrainToElement)for(;e.offsetWidth>this.constrainToElement.offsetWidth-this.elementPadding&&t>this.min;)t-=i,e.style.fontSize=t+this.unit;else for(;e.offsetHeight>this.targetLineCount&&t>this.min;)t-=i,e.style.fontSize=t+this.unit;this.$emit("resize",{size:t,unit:this.unit}),e.style.display=null,e.style.lineHeight=null}},mounted(){this.calculate(),"MutationObserver"in window&&this.observer===null&&(this.observer=new MutationObserver(this.calculate),this.observer.observe(this.$el,{subtree:!0,characterData:!0})),window.addEventListener("resize",this.calculate)},beforeUnmount:function(){this.observer.disconnect(),window.removeEventListener("resize",this.calculate)}};function M(e,i,t,_,f,l){return n(),s("span",null,[b(e.$slots,"default")])}const T=m(L,[["render",M]]),z={components:{UtilAnimatedNumber:g,UtilFitText:T},props:{parts:{type:Array,required:!0},label:{type:String,required:!0},total:{type:Number,required:!0},animatedNumber:{type:Boolean,default(){return!0}},maxTotal:{type:String,required:!1},isLabelColored:{type:Boolean,default(){return!1}}},computed:{getColorClass(){if(!this.maxTotal)return"";switch(!0){case 33>=this.total:return"red";case 66>=this.total:return"orange";default:return"green"}},getClass(){return`total-container-large ${this.getColorClass}`}}},N={class:"aioseo-donut-chart"},F={key:0,viewBox:"0 0 33.83098862 33.83098862",xmlns:"http://www.w3.org/2000/svg"},S=a("circle",{class:"aioseo-donut-chart-score__circle",stroke:"#e8e8eb","stroke-dasharray":"100","stroke-linecap":"round","stroke-width":2,fill:"none",cx:"16.91549431",cy:"16.91549431",r:"15.91549431"},null,-1),B=[S],$={key:1,viewBox:"0 0 33.83098862 33.83098862",xmlns:"http://www.w3.org/2000/svg"},E=["stroke-dasharray"],H=["stroke","stroke-dasharray"],A={class:"total-amount-wrapper"},U={class:"total-amount"},q={class:"total"},D=["innerHTML"],I={key:2,class:"total-max"},P=["innerHTML"];function V(e,i,t,_,f,l){const y=u("util-animated-number"),p=u("util-fit-text");return n(),s("div",N,[t.total===0?(n(),s("svg",F,B)):r("",!0),0<t.total?(n(),s("svg",$,[(n(!0),s(d,null,k(t.parts,(o,c)=>(n(),s(d,{key:c},[Math.round(o.ratio)&&c!==0?(n(),s("circle",{key:0,class:"aioseo-donut-chart-score__circle",stroke:"#FFFFFF","stroke-dasharray":`${Math.round(o.ratio)} ${parseFloat(99-Math.round(o.ratio))}`,"stroke-linecap":"round","stroke-width":2.5,fill:"none",cx:"16.91549431",cy:"16.91549431",r:"15.91549431"},null,8,E)):r("",!0),Math.round(o.ratio)?(n(),s("circle",{key:1,class:"aioseo-donut-chart-score__circle",stroke:o.color,"stroke-dasharray":`${Math.round(o.ratio)===100?100:Math.round(o.ratio)-1} 100`,"stroke-linecap":"round","stroke-width":2,fill:"none",cx:"16.91549431",cy:"16.91549431",r:"15.91549431"},null,8,H)):r("",!0)],64))),128))])):r("",!0),a("div",A,[a("div",U,[a("div",q,[x(p,{max:32,"constrain-to-element":e.$el,class:h(["total-container",l.getClass])},{default:w(()=>[t.animatedNumber?(n(),v(y,{key:0,number:parseInt(t.total)},null,8,["number"])):(n(),s("div",{key:1,innerHTML:parseInt(t.total)},null,8,D)),t.maxTotal?(n(),s("span",I," / "+C(parseInt(t.maxTotal)),1)):r("",!0)]),_:1},8,["constrain-to-element","class"])]),a("div",{class:h(["label",{[l.getColorClass]:t.isLabelColored}]),innerHTML:t.label},null,10,P)])])])}const j=m(z,[["render",V]]);export{j as C};
