ProgressBar.OPTION_NAME={};ProgressBar.OPTION_NAME.ITEM_ID="itemID";ProgressBar.OPTION_NAME.TYPE="type";ProgressBar.OPTION_NAME.PERCENT="percent";ProgressBar.OPTION_NAME.COLOR_ID="colorID";ProgressBar.OPTION_NAME.OPACITY="opacity";ProgressBar.OPTION_NAME.ALIGN="align";ProgressBar.OPTION_NAME.SPACE="space";ProgressBar.OPTION_NAME.POSITION="position";ProgressBar.OPTION_VALUE={};ProgressBar.OPTION_VALUE.COLOR_ID={};ProgressBar.OPTION_VALUE.COLOR_ID.BLUE="blue";
ProgressBar.OPTION_VALUE.COLOR_ID.GREEN="green";ProgressBar.OPTION_VALUE.COLOR_ID.YELLOW="yellow";ProgressBar.OPTION_VALUE.COLOR_ID.ORANGE="orange";ProgressBar.OPTION_VALUE.COLOR_ID.RED="red";ProgressBar.OPTION_VALUE.COLOR_ID.WHITE="white";ProgressBar.OPTION_VALUE.COLOR_ID.BLACK="black";ProgressBar.OPTION_VALUE.TYPE={};ProgressBar.OPTION_VALUE.TYPE.BAR="bar";ProgressBar.OPTION_VALUE.TYPE.LINE="line";ProgressBar.OPTION_VALUE.TYPE.TEXT="text";ProgressBar.OPTION_VALUE.ALIGN={};
ProgressBar.OPTION_VALUE.ALIGN.LEFT="left";ProgressBar.OPTION_VALUE.ALIGN.RIGHT="right";ProgressBar.OPTION_VALUE.POSITION={};ProgressBar.OPTION_VALUE.POSITION.ABSOLUTE="absolute";ProgressBar.OPTION_VALUE.POSITION.RELATIVE="relative";ProgressBar.DEFAULT_VALUE={};ProgressBar.DEFAULT_VALUE.WIDTH="100px";ProgressBar.DEFAULT_VALUE.HEIGHT="6px";ProgressBar.DEFAULT_VALUE.TYPE=ProgressBar.OPTION_VALUE.TYPE.BAR;ProgressBar.DEFAULT_VALUE.PERCENT=0;ProgressBar.DEFAULT_VALUE.COLOR_ID=ProgressBar.OPTION_VALUE.COLOR_ID.BLUE;
ProgressBar.DEFAULT_VALUE.OPACITY=1;ProgressBar.DEFAULT_VALUE.ALIGN="left";ProgressBar.DEFAULT_VALUE.SPACE=0;ProgressBar.DEFAULT_VALUE.POSITION="relative";ProgressBar.DEFAULT_VALUE.LINE_COLOR_ID=ProgressBar.OPTION_VALUE.COLOR_ID.RED;ProgressBar.DEFAULT_VALUE.LINE_OPACITY=0.5;ProgressBar.EVENT={};ProgressBar.EVENT.STARTING="starting";ProgressBar.EVENT.CHANGED="changed";ProgressBar.EVENT.COMPLETED="completed";ProgressBar.getVersion=function(){return"1.2"};
function ProgressBar(u,p){var a=ProgressBar.OPTION_NAME,g=ProgressBar.OPTION_VALUE,h=ProgressBar.DEFAULT_VALUE,q=ProgressBar.EVENT,l=document.getElementById(u),k=[],n=[],v="",w="",x="",y="",r=100,s=1,z={},m=this,A=function(){if(1==k.length){var b=A,c=k[0],d=0==m.getOptionValue(a.SPACE)?100-m.getOptionValue(a.PERCENT):0;m.setOptionValue(a.SPACE,d,c[a.ITEM_ID]);_initialModeTimer=setTimeout(function(){b()},700)}},t=function(b){if(b&&b==x)return y;if(1!=k.length)if(0==k.length)m.createItem({itemID:b});
else if(1<k.length){if(!b)return 0;for(var c=0,d=k.length;c<d;c++)if(k[c][a.ITEM_ID]==b)return x=b,y=c}return 0},B=function(b,c){if(0>b)return 0;var d=k[c],h=0,e=0;switch(d[a.POSITION]){case g.POSITION.RELATIVE:for(var e=0,f=k.length;e<f;e++)e!=c&&k[e][a.POSITION]==g.POSITION.RELATIVE&&(h+=k[e][a.PERCENT]);e=100-h;b>=e&&setTimeout(function(){l.dispatchEvent(new CustomEvent(q.COMPLETED,{detail:{itemID:d.itemID,me:m}}))},500);break;case g.POSITION.ABSOLUTE:e=100-d[a.SPACE]}return b<=e?b:e};this.getElement=
function(){return l};this.getWidth=function(){return v};this.setWidth=function(b){v=l.style.width=b;return!0};this.getHeight=function(){return w};this.setHeight=function(b){w=l.style.height=b;return!0};this.createItem=function(b){if("string"==typeof b){var c=b;b={};b[a.ITEM_ID]=c}b=b||{};var d=l.appendChild(document.createElement("div")),c=b[a.ITEM_ID]=b[a.ITEM_ID]||"";if(0<k.length&&""==c)return!1;b[a.TYPE]=b[a.TYPE]||h.TYPE;b[a.PERCENT]=b[a.PERCENT]||h.PERCENT;b[a.ALIGN]=b[a.ALIGN]||h.ALIGN;b[a.SPACE]?
b[a.POSITION]=g.POSITION.ABSOLUTE:(b[a.SPACE]=h.SPACE,b[a.POSITION]=b[a.POSITION]||g.POSITION.RELATIVE);switch(b[a.TYPE]){case g.TYPE.BAR:b[a.COLOR_ID]=b[a.COLOR_ID]||h.COLOR_ID;b[a.OPACITY]=b[a.OPACITY]||h.OPACITY;break;case g.TYPE.LINE:b[a.COLOR_ID]=b[a.COLOR_ID]||h.LINE_COLOR_ID,b[a.OPACITY]=b[a.OPACITY]||h.LINE_OPACITY,b[a.POSITION]=g.POSITION.ABSOLUTE,b[a.SPACE]=b[a.PERCENT]}k.push(b);n.push(d);d.style.opacity=0;d.classList.add("item-"+b[a.TYPE]);this.setOptionValue(a.COLOR_ID,b[a.COLOR_ID],
c);this.setOptionValue(a.ALIGN,b[a.ALIGN],c);this.setOptionValue(a.POSITION,b[a.POSITION],c);this.setOptionValue(a.PERCENT,b[a.PERCENT],c);return!0};this.removeItem=function(b){b=t(b);var a=n[b];return null!=a?(a.parentNode.removeChild(a),k.splice(b,1),n.splice(b,1),!0):!1};this.removeAll=function(){return l?(l.innerHTML="",k=[],n=[],!0):!1};this.getMaxValue=function(){return r};this.setMaxValue=function(b){r!=b&&b&&(s=100/b,r=b);return s};this.getExValue=function(b){return z[b||"first"]||0};this.getPercentByValue=
function(b,a,d){d&&d!=this.getMaxValue()&&this.setMaxValue(d);0>b&&(b=0);b>this.getMaxValue()&&(b=this.getMaxValue());z[a||"first"]=b;b=d?b*this.getMaxValue(d):b*s;return parseInt(b)};this.getOptionValue=function(b,a){var d=t(a);return k[d][b]};this.setOptionValue=function(b,c,d){var h=t(d),e=n[h],f=k[h];switch(b){case a.ITEM_ID:return!1;case a.TYPE:return!1;case a.PERCENT:var m=this;setTimeout(function(){c=parseInt(c)||0;switch(f[a.TYPE]){case g.TYPE.BAR:c=B(c,h);e.style.width=c+"%";f[a.PERCENT]=
c;break;case g.TYPE.LINE:m.setOptionValue(a.SPACE,c,d)}e.style.opacity=0==c?0:f[a.OPACITY];setTimeout(function(){l.dispatchEvent(new CustomEvent(q.CHANGED,{detail:{itemID:d,me:m}}));switch(c){case 0:l.dispatchEvent(new CustomEvent(q.STARTING,{detail:{itemID:d,me:m}}));break;case 100:l.dispatchEvent(new CustomEvent(q.COMPLETED,{detail:{itemID:d,me:m}}))}},240)},10);break;case a.COLOR_ID:e.classList.remove(f[a.COLOR_ID]);e.classList.add(c);f[a.COLOR_ID]=c;break;case a.OPACITY:f[a.PERCENT]&&(e.style.opacity=
c);f[a.OPACITY]=c;break;case a.ALIGN:e.style.cssFloat=c;f[a.ALIGN]=c;f[a.POSITION]==g.POSITION.ABSOLUTE&&this.setOptionValue(a.SPACE,f[a.SPACE],d);break;case a.SPACE:f[a.TYPE]==g.TYPE.LINE&&(0>c&&(c=0),100<c&&(c=100),f[a.PERCENT]=c);f[a.POSITION]!=g.POSITION.ABSOLUTE&&this.setOptionValue(a.POSITION,g.POSITION.ABSOLUTE,d);e.style.left="";e.style.right="";e.style[f[a.ALIGN]]=c+"%";f[a.SPACE]=c;f[a.TYPE]==g.TYPE.BAR&&this.setOptionValue(a.PERCENT,f[a.PERCENT],d);break;case a.POSITION:switch(f[a.TYPE]){case g.TYPE.BAR:c==
g.POSITION.RELATIVE&&(e.style.left="",e.style.right="",f[a.SPACE]=0);e.style.position=c;f[a.POSITION]=c;break;case g.TYPE.LINE:c=g.POSITION.ABSOLUTE,e.style.position=c,f[a.POSITION]=c}}return!0};this.getPercent=function(b){return this.getOptionValue(a.PERCENT,b)};this.setPercent=function(b,c){return this.setOptionValue(a.PERCENT,b,c)};this.initialMode=function(b){b?(this.removeAll(),this.setPercent(25),this.setOptionValue(a.COLOR_ID,g.COLOR_ID.WHITE),setTimeout(function(){A()},50)):(clearTimeout(_initialModeTimer),
this.removeAll())};p=p||{};u&&(m.setWidth(p.width||h.WIDTH),m.setHeight(p.height||h.HEIGHT),l.innerHTML="",l.setAttribute("class","progressbar-control"))};