  
"use strict";!function(t){t.fn.circliful=function(e,r){var o=t.extend({foregroundColor:"#3498DB",backgroundColor:"#ccc",pointColor:"none",fillColor:"none",foregroundBorderWidth:15,backgroundBorderWidth:15,pointSize:28.5,fontColor:"#aaa",percent:75,animation:1,animationStep:5,icon:"none",iconSize:"30",iconColor:"#ccc",iconPosition:"top",target:0,start:0,showPercent:1,percentageTextSize:22,percentageX:100,percentageY:113,textAdditionalCss:"",targetPercent:0,targetTextSize:17,targetColor:"#2980B9",text:null,textStyle:null,textColor:"#666",textY:null,textX:null,multiPercentage:0,percentages:null,textBelow:!1,noPercentageSign:!1,replacePercentageByText:null,halfCircle:!1,animateInView:!1,decimals:0,alwaysDecimals:!1,title:"Circle Chart",description:"",progressColor:null},e);return this.each(function(){function e(){var e=window.setInterval(function(){m>=S?(window.clearInterval(e),w=1,"function"==typeof r&&r.call(this)):(m+=k,P+=b),o.halfCircle?2*m/3.6>=s&&1==w&&(m=3.6*s/2):m/3.6>=s&&1==w&&(m=3.6*s),P>o.target&&1==w&&(P=o.target),null==o.replacePercentageByText&&(B=o.halfCircle?parseFloat(100*m/360*2):parseFloat(100*m/360),B=B.toFixed(o.decimals),!o.alwaysDecimals&&(0==s||s>1&&1!=w)&&(B=parseInt(B))),y.attr("stroke-dasharray",m+", 20000"),1==o.showPercent?p.find(".number").text(B):(p.find(".number").text(P),p.find(".percent").text("")),null!=h&&t.each(h,function(t,e){o.halfCircle&&(t/=2),m>=3.6*t&&y.css({stroke:e,transition:"stroke 0.1s linear"})})}.bind(y),C)}function l(){var e=-1!=navigator.userAgent.toLowerCase().indexOf("webkit")?"body":"html",r=t(e).scrollTop(),o=r+t(window).height(),l=Math.round(y.offset().top),n=l+y.height();return l<o&&n>r}function n(){y.hasClass("start")||l(y)&&(y.addClass("start"),setTimeout(e,250))}var a=t(this);!function(e,r){t.each(e,function(t,o){t.toLowerCase()in r&&(e[t]=r[t.toLowerCase()])})}(o,a.data());var i,c,s=o.percent,x=83,d=100,g=o.percentageY,f=o.percentageX,u=o.backgroundBorderWidth,h=o.progressColor;if(o.halfCircle?"left"==o.iconPosition?(d=80,x=100,f=117,g=100):o.halfCircle&&(x=80,g=100):"bottom"==o.iconPosition?(x=124,g=95):"left"==o.iconPosition?(d=80,x=110,f=117):"middle"==o.iconPosition?1==o.multiPercentage?"object"==typeof o.percentages?u=30:(x=110,i='<g stroke="'+("none"!=o.backgroundColor?o.backgroundColor:"#ccc")+'" ><line x1="133" y1="50" x2="140" y2="40" stroke-width="2"  /></g>',i+='<g stroke="'+("none"!=o.backgroundColor?o.backgroundColor:"#ccc")+'" ><line x1="140" y1="40" x2="200" y2="40" stroke-width="2"  /></g>',f=228,g=47):(x=110,i='<g stroke="'+("none"!=o.backgroundColor?o.backgroundColor:"#ccc")+'" ><line x1="133" y1="50" x2="140" y2="40" stroke-width="2"  /></g>',i+='<g stroke="'+("none"!=o.backgroundColor?o.backgroundColor:"#ccc")+'" ><line x1="140" y1="40" x2="200" y2="40" stroke-width="2"  /></g>',f=170,g=35):"right"==o.iconPosition?(d=120,x=110,f=80):"top"==o.iconPosition&&"none"!=o.icon&&(g=120),o.targetPercent>0&&1!=o.halfCircle&&(g=95,i='<g stroke="'+("none"!=o.backgroundColor?o.backgroundColor:"#ccc")+'" ><line x1="75" y1="101" x2="125" y2="101" stroke-width="1"  /></g>',i+='<text text-anchor="middle" x="'+f+'" y="120" style="font-size: '+o.targetTextSize+'px;" fill="'+o.targetColor+'">'+o.targetPercent+(o.noPercentageSign&&null==o.replacePercentageByText?"":"%")+"</text>",i+='<circle cx="100" cy="100" r="69" fill="none" stroke="'+o.backgroundColor+'" stroke-width="3" stroke-dasharray="450" transform="rotate(-90,100,100)" />',i+='<circle cx="100" cy="100" r="69" fill="none" stroke="'+o.targetColor+'" stroke-width="3" stroke-dasharray="'+4.35*o.targetPercent+', 20000" transform="rotate(-90,100,100)" />'),null!=o.text&&(o.halfCircle?o.textBelow?i+='<text text-anchor="middle" x="'+(null!=o.textX?o.textX:"100")+'" y="'+(null!=o.textY?o.textY:"64%")+'" style="'+o.textStyle+'" fill="'+o.textColor+'">'+o.text+"</text>":0==o.multiPercentage?i+='<text text-anchor="middle" x="'+(null!=o.textX?o.textX:"100")+'" y="'+(null!=o.textY?o.textY:"115")+'" style="'+o.textStyle+'" fill="'+o.textColor+'">'+o.text+"</text>":1==o.multiPercentage&&(i+='<text text-anchor="middle" x="'+(null!=o.textX?o.textX:"228")+'" y="'+(null!=o.textY?o.textY:"65")+'" style="'+o.textStyle+'" fill="'+o.textColor+'">'+o.text+"</text>"):o.textBelow?i+='<text text-anchor="middle" x="'+(null!=o.textX?o.textX:"100")+'" y="'+(null!=o.textY?o.textY:"99%")+'" style="'+o.textStyle+'" fill="'+o.textColor+'">'+o.text+"</text>":0==o.multiPercentage?i+='<text text-anchor="middle" x="'+(null!=o.textX?o.textX:"100")+'" y="'+(null!=o.textY?o.textY:"115")+'" style="'+o.textStyle+'" fill="'+o.textColor+'">'+o.text+"</text>":1==o.multiPercentage&&(i+='<text text-anchor="middle" x="'+(null!=o.textX?o.textX:"228")+'" y="'+(null!=o.textY?o.textY:"65")+'" style="'+o.textStyle+'" fill="'+o.textColor+'">'+o.text+"</text>")),"none"!=o.icon&&(c='<text text-anchor="middle" x="'+d+'" y="'+x+'" class="icon" style="font-size: '+o.iconSize+'px" fill="'+o.iconColor+'">&#x'+o.icon+"</text>"),o.halfCircle){a.addClass("svg-container").append(t('<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 194 186" class="circliful">'+i+'<clipPath id="cut-off-bottom"> <rect x="100" y="0" width="100" height="200" /> </clipPath><circle cx="100" cy="100" r="57" class="border" fill="'+o.fillColor+'" stroke="'+o.backgroundColor+'" stroke-width="'+u+'" stroke-dasharray="360" clip-path="url(#cut-off-bottom)" transform="rotate(-90,100,100)" /><circle class="circle" cx="100" cy="100" r="57" class="border" fill="none" stroke="'+o.foregroundColor+'" stroke-width="'+o.foregroundBorderWidth+'" stroke-dasharray="0,20000" transform="rotate(-180,100,100)" /><circle cx="100" cy="100" r="'+o.pointSize+'" fill="'+o.pointColor+'" clip-path="url(#cut-off-bottom)" transform="rotate(-90,100,100)" />'+c+'<text class="timer" text-anchor="middle" x="'+f+'" y="'+g+'" style="font-size: '+o.percentageTextSize+"px; "+void 0+";"+o.textAdditionalCss+'" fill="'+o.fontColor+'"><tspan class="number">'+(null==o.replacePercentageByText?0:o.replacePercentageByText)+'</tspan><tspan class="percent">'+(o.noPercentageSign||null!=o.replacePercentageByText?"":"%")+"</tspan></text>"))}else a.addClass("svg-container").append(t('<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 194 186" class="circliful">'+i+'<circle cx="100" cy="100" r="57" class="border" fill="'+o.fillColor+'" stroke="'+o.backgroundColor+'" stroke-width="'+u+'" stroke-dasharray="360" transform="rotate(-90,100,100)" /><circle class="circle" cx="100" cy="100" r="57" class="border" fill="none" stroke="'+o.foregroundColor+'" stroke-width="'+o.foregroundBorderWidth+'" stroke-dasharray="0,20000" transform="rotate(-90,100,100)" /><circle cx="100" cy="100" r="'+o.pointSize+'" fill="'+o.pointColor+'" />'+c+'<text class="timer" text-anchor="middle" x="'+f+'" y="'+g+'" style="font-size: '+o.percentageTextSize+"px; "+void 0+";"+o.textAdditionalCss+'" fill="'+o.fontColor+'"><tspan class="number">'+(null==o.replacePercentageByText?0:o.replacePercentageByText)+'</tspan><tspan class="percent">'+(o.noPercentageSign||null!=o.replacePercentageByText?"":"%")+"</tspan></text>"));var y=a.find(".circle"),p=a.find(".timer"),C=30,m=0,k=o.animationStep,w=0,P=0,b=0,B=s,S=3.6*s;o.halfCircle&&(S=3.6*s/2),null!=o.replacePercentageByText&&(B=o.replacePercentageByText),o.start>0&&o.target>0&&(s=o.start/(o.target/100),b=o.target/100),1==o.animation?o.animateInView?t(window).scroll(function(){n()}):e():(y.attr("stroke-dasharray",S+", 20000"),1==o.showPercent?p.find(".number").text(B):(p.find(".number").text(o.target),p.find(".percent").text("")))})}}(jQuery);
