"use strict";!function(t){t.fn.circliful=function(e,r){var o=t.extend({percentSign:"",display:100,displayPrefix:"",displaySuffix:"",foregroundColor:"#3498DB",backgroundColor:"#ccc",fillColor:"none",foregroundBorderWidth:15,backgroundBorderWidth:15,fontColor:"#aaa",percent:100,animation:1,animationStep:5,icon:"none",iconSize:"30",iconColor:"#ccc",iconPosition:"top",target:0,start:0,showPercent:1,percentageTextSize:22,textAdditionalCss:"",targetPercent:0,targetTextSize:17,targetColor:"#2980B9",text:null,textStyle:null,textColor:"#666",multiPercentage:0,percentages:null},e);return this.each(function(){var e,r,n,i=t(this),c=o.percent,a=o.display,l=83,s=100,d=110,x=100,g=o.backgroundBorderWidth;"bottom"==o.iconPosition?(l=124,d=95):"left"==o.iconPosition?(s=80,l=110,x=117):"middle"==o.iconPosition?1==o.multiPercentage?(console.log("object"==typeof o.percentages),"object"==typeof o.percentages?g=30:(l=110,r='<g stroke="'+("none"!=o.backgroundColor?o.backgroundColor:"#ccc")+'" ><line x1="133" y1="50" x2="140" y2="40" stroke-width="2"  /></g>',r+='<g stroke="'+("none"!=o.backgroundColor?o.backgroundColor:"#ccc")+'" ><line x1="140" y1="40" x2="200" y2="40" stroke-width="2"  /></g>',x=228,d=47)):(l=110,r='<g stroke="'+("none"!=o.backgroundColor?o.backgroundColor:"#ccc")+'" ><line x1="133" y1="50" x2="140" y2="40" stroke-width="2"  /></g>',r+='<g stroke="'+("none"!=o.backgroundColor?o.backgroundColor:"#ccc")+'" ><line x1="140" y1="40" x2="200" y2="40" stroke-width="2"  /></g>',x=175,d=35):"right"==o.iconPosition&&(s=120,l=110,x=80),o.targetPercent>0&&(d=95,r='<g stroke="'+("none"!=o.backgroundColor?o.backgroundColor:"#ccc")+'" ><line x1="75" y1="101" x2="125" y2="101" stroke-width="1"  /></g>',r+='<text text-anchor="middle" x="'+x+'" y="120" style="font-size: '+o.targetTextSize+'px;" fill="'+o.targetColor+'">'+o.targetPercent+o.percentSign+"</text>",r+='<circle cx="100" cy="100" r="69" fill="none" stroke="'+o.backgroundColor+'" stroke-width="3" stroke-dasharray="450" transform="rotate(-90,100,100)" />',r+='<circle cx="100" cy="100" r="69" fill="none" stroke="'+o.targetColor+'" stroke-width="3" stroke-dasharray="'+3.6*o.targetPercent+', 20000" transform="rotate(-90,100,100)" />'),null!=o.text&&0==o.multiPercentage?r+='<text text-anchor="middle" x="100" y="125" style="'+o.textStyle+'" fill="'+o.textColor+'">'+o.text+"</text>":null!=o.text&&1==o.multiPercentage&&(r+='<text text-anchor="middle" x="228" y="65" style="'+o.textStyle+'" fill="'+o.textColor+'">'+o.text+"</text>"),"none"!=o.icon&&(n='<text text-anchor="middle" x="'+s+'" y="'+l+'" class="icon" style="font-size: '+o.iconSize+'px" fill="'+o.iconColor+'">&#x'+o.icon+"</text>"),i.addClass("svg-container").append(t('<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 194 186" class="circliful">'+r+'<circle cx="100" cy="100" r="57" class="border" fill="'+o.fillColor+'" stroke="'+o.backgroundColor+'" stroke-width="'+g+'" 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)" />'+n+'<text class="timer" text-anchor="middle" x="'+x+'" y="'+d+'" style="font-size: '+o.percentageTextSize+"px; "+e+";"+o.textAdditionalCss+'" fill="'+o.fontColor+'">0'+o.percentSign+"</text>"));var f=i.find(".circle"),y=i.find(".timer"),u=30,k=0,p=o.animationStep,h=0,C=0,m=0;if(o.start>0&&o.target>0&&(c=o.start/(o.target/100),m=o.target/100),1==o.animation)var b=window.setInterval(function(){k>=3.6*c?(window.clearInterval(b),h=1):(k+=p,C+=m),k/3.6>=c&&1==h&&(k=3.6*c),C>o.target&&1==h&&(C=o.target),f.attr("stroke-dasharray",k+", 20000"),1==o.showPercent?o.percentSign?y.text(parseInt(k/360*100)+o.percentSign):y.text(o.displayPrefix+parseInt(k/(3.6*c)*o.display)+o.displaySuffix):y.text(C)}.bind(f),u);else f.attr("stroke-dasharray",3.6*c+", 20000"),1==o.showPercent?o.percentSign?y.text(a+o.percentSign):y.text(o.displayPrefix+a+o.displaySuffix):y.text(o.target)})}}(jQuery);