/*
Copyright 2013, KISSY UI Library v1.40dev
MIT Licensed
build time: Aug 14 23:51
*/
KISSY.add("anim/timer/easing",function(){function k(a){return a}function m(a,b,h,c){var e=3*a-3*h+1,r=3*h-6*a,f=3*a,d=3*b-3*c+1,j=3*c-6*b,k=3*b;return function(a){a:{for(var b=a,h,c,i=0;8>i;i++){c=((e*b+r)*b+f)*b-a;if(o(c)<g){a=b;break a}h=(3*e*b+2*r)*b+f;if(o(h)<g)break;b-=c/h}h=1;i=0;for(b=a;h>i;){c=((e*b+r)*b+f)*b-a;if(o(c)<g)break;0<c?h=b:i=b;b=(h+i)/2}a=b}return((d*a+j)*a+k)*a}}var l=Math.PI,j=Math.pow,n=Math.sin,b=parseFloat,d=/^cubic-bezier\(([^,]+),([^,]+),([^,]+),([^,]+)\)$/i,f={swing:function(a){return-Math.cos(a*
l)/2+0.5},easeNone:k,linear:k,easeIn:function(a){return a*a},ease:m(0.25,0.1,0.25,1),"ease-in":m(0.42,0,1,1),"ease-out":m(0,0,0.58,1),"ease-in-out":m(0.42,0,0.58,1),"ease-out-in":m(0,0.42,1,0.58),toFn:function(a){var i;return(i=a.match(d))?m(b(i[1]),b(i[2]),b(i[3]),b(i[4])):f[a]||k},easeOut:function(a){return(2-a)*a},easeBoth:function(a){return 1>(a*=2)?0.5*a*a:0.5*(1- --a*(a-2))},easeInStrong:function(a){return a*a*a*a},easeOutStrong:function(a){return 1- --a*a*a*a},easeBothStrong:function(a){return 1>
(a*=2)?0.5*a*a*a*a:0.5*(2-(a-=2)*a*a*a)},elasticIn:function(a){return 0===a||1===a?a:-(j(2,10*(a-=1))*n((a-0.075)*2*l/0.3))},elasticOut:function(a){return 0===a||1===a?a:j(2,-10*a)*n((a-0.075)*2*l/0.3)+1},elasticBoth:function(a){return 0===a||2===(a*=2)?a:1>a?-0.5*j(2,10*(a-=1))*n((a-0.1125)*2*l/0.45):0.5*j(2,-10*(a-=1))*n((a-0.1125)*2*l/0.45)+1},backIn:function(a){1===a&&(a-=0.001);return a*a*(2.70158*a-1.70158)},backOut:function(a){return(a-=1)*a*(2.70158*a+1.70158)+1},backBoth:function(a){var b,
h=(b=2.5949095)+1;return 1>(a*=2)?0.5*a*a*(h*a-b):0.5*((a-=2)*a*(h*a+b)+2)},bounceIn:function(a){return 1-f.bounceOut(1-a)},bounceOut:function(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+0.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+0.9375:7.5625*(a-=2.625/2.75)*a+0.984375},bounceBoth:function(a){return 0.5>a?0.5*f.bounceIn(2*a):0.5*f.bounceOut(2*a-1)+0.5}},g=1.0E-6,o=Math.abs;return f});
KISSY.add("anim/timer/manager",function(k,m){var l=k.stamp,j,n;j=function(b){return setTimeout(b,15)};n=function(b){clearTimeout(b)};return{runnings:{},timer:null,start:function(b){var d=l(b);this.runnings[d]||(this.runnings[d]=b,this.startTimer())},stop:function(b){this.notRun(b)},notRun:function(b){delete this.runnings[l(b)];k.isEmptyObject(this.runnings)&&this.stopTimer()},pause:function(b){this.notRun(b)},resume:function(b){this.start(b)},startTimer:function(){var b=this;b.timer||(b.timer=j(function f(){b.runFrames()?
b.stopTimer():b.timer=j(f)}))},stopTimer:function(){var b=this.timer;b&&(n(b),this.timer=0)},runFrames:function(){var b,d,f=this.runnings;for(b in f)f[b].frame(),d=0;return d===m}}});
KISSY.add("anim/timer/fx",function(k,m,l){function j(b){k.mix(this,b);this.pos=0;this.unit=this.unit||""}function n(b,d){return(!b.style||null==b.style[d])&&null!=m.attr(b,d,l,1)?1:0}j.prototype={isBasicFx:1,constructor:j,load:function(b){k.mix(this,b);this.pos=0;this.unit=this.unit||""},frame:function(b){this.pos=b;this.update();this.finished=this.finished||1==b},interpolate:function(b,d,f){return"number"===typeof b&&"number"===typeof d?Math.round(1E5*(b+(d-b)*f))/1E5:l},update:function(){var b=
this.prop,d=this.anim.node,f=this.to,g=this.interpolate(this.from,f,this.pos);g===l?this.finished||(this.finished=1,m.css(d,b,f)):(g+=this.unit,n(d,b)?m.attr(d,b,g,1):m.css(d,b,g))},cur:function(){var b=this.prop,d=this.anim.node;if(n(d,b))return m.attr(d,b,l,1);var f,b=m.css(d,b);return isNaN(f=parseFloat(b))?!b||"auto"===b?0:b:f}};j.Factories={};j.getPos=function(b,d){var f=k.now(),g=d.duration,f=f-b.startTime-d.delay;return 0>=f?0:f>=g?1:d.easing(f/g)};j.getFx=function(b){return new (j.Factories[b.prop]||
j)(b)};return j},{requires:["dom"]});KISSY.add("anim/timer/short-hand",function(){return{background:[],border:["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth"],borderBottom:["borderBottomWidth"],borderLeft:["borderLeftWidth"],borderTop:["borderTopWidth"],borderRight:["borderRightWidth"],font:["fontSize","fontWeight"],margin:["marginBottom","marginLeft","marginRight","marginTop"],padding:["paddingBottom","paddingLeft","paddingRight","paddingTop"]}});
KISSY.add("anim/timer/color",function(k,m,l,j){function n(b){var b=b+"",c;if(c=b.match(o))return[parseInt(c[1]),parseInt(c[2]),parseInt(c[3])];if(c=b.match(a))return[parseInt(c[1]),parseInt(c[2]),parseInt(c[3]),parseInt(c[4])];if(c=b.match(i)){for(b=1;b<c.length;b++)2>c[b].length&&(c[b]+=c[b]);return[parseInt(c[1],d),parseInt(c[2],d),parseInt(c[3],d)]}return g[b=b.toLowerCase()]?g[b]:[255,255,255]}function b(){b.superclass.constructor.apply(this,arguments)}var d=16,f=Math.floor,g={black:[0,0,0],silver:[192,
192,192],gray:[128,128,128],white:[255,255,255],maroon:[128,0,0],red:[255,0,0],purple:[128,0,128],fuchsia:[255,0,255],green:[0,128,0],lime:[0,255,0],olive:[128,128,0],yellow:[255,255,0],navy:[0,0,128],blue:[0,0,255],teal:[0,128,128],aqua:[0,255,255]},o=/^rgb\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\)$/i,a=/^rgba\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+),\s*([0-9]+)\)$/i,i=/^#?([0-9A-F]{1,2})([0-9A-F]{1,2})([0-9A-F]{1,2})$/i;j.background.push("backgroundColor");j.borderColor=["borderBottomColor","borderLeftColor",
"borderRightColor","borderTopColor"];j.border.push("borderBottomColor","borderLeftColor","borderRightColor","borderTopColor");j.borderBottom.push("borderBottomColor");j.borderLeft.push("borderLeftColor");j.borderRight.push("borderRightColor");j.borderTop.push("borderTopColor");k.extend(b,l,{load:function(){b.superclass.load.apply(this,arguments);this.from&&(this.from=n(this.from));this.to&&(this.to=n(this.to))},interpolate:function(a,c,e){var i=b.superclass.interpolate;return 3==a.length&&3==c.length?
"rgb("+[f(i(a[0],c[0],e)),f(i(a[1],c[1],e)),f(i(a[2],c[2],e))].join(", ")+")":4==a.length||4==c.length?"rgba("+[f(i(a[0],c[0],e)),f(i(a[1],c[1],e)),f(i(a[2],c[2],e)),f(i(a[3]||1,c[3]||1,e))].join(", ")+")":k.log("anim/color unknown value : "+a)}});k.each("backgroundColor,borderBottomColor,borderLeftColor,borderRightColor,borderTopColor,color,outlineColor".split(","),function(a){l.Factories[a]=b});return b},{requires:["dom","./fx","./short-hand"]});
KISSY.add("anim/timer/transform",function(k,m,l){function j(g){g=g.split(/,/);return g=k.map(g,function(g){return b(g)})}function n(){return{translateX:0,translateY:0,rotate:0,skewX:0,skewY:0,scaleX:1,scaleY:1}}function b(b){return Math.round(1E5*parseFloat(b))/1E5}function d(g){for(var g=g.split(")"),f=k.trim,a=-1,i=g.length-1,h,c,e=n();++a<i;)switch(h=g[a].split("("),c=f(h[0]),h=h[1],c){case "translateX":case "translateY":case "scaleX":case "scaleY":e[c]=b(h);break;case "rotate":case "skewX":case "skewY":var d=
b(h);k.endsWith(h,"deg")||(d=180*d/Math.PI);e[c]=d;break;case "translate":case "translate3d":h=h.split(",");e.translateX=b(h[0]);e.translateY=b(h[1]||0);break;case "scale":h=h.split(",");e.scaleX=b(h[0]);e.scaleY=b(h[1]||h[0]);break;case "matrix":return g=h,g=j(g),i=a=f=void 0,c=g[0],e=g[1],h=g[2],d=g[3],c*d-e*h?(f=Math.sqrt(c*c+e*e),c/=f,e/=f,i=c*h+e*d,h-=c*i,d-=e*i,a=Math.sqrt(h*h+d*d),h/=a,d/=a,i/=a,c*d<e*h&&(c=-c,e=-e,i=-i,f=-f)):f=a=i=0,{translateX:b(g[4]),translateY:b(g[5]),rotate:b(180*Math.atan2(e,
c)/Math.PI),skewX:b(180*Math.atan(i)/Math.PI),skewY:0,scaleX:b(f),scaleY:b(a)}}return e}function f(){f.superclass.constructor.apply(this,arguments)}k.extend(f,l,{load:function(){f.superclass.load.apply(this,arguments);this.from=(this.from=m.style(this.anim.node,"transform")||this.from)&&"none"!=this.from?d(this.from):n();this.to=this.to?d(this.to):n()},interpolate:function(b,d,a){var i=f.superclass.interpolate,h={};h.translateX=i(b.translateX,d.translateX,a);h.translateY=i(b.translateY,d.translateY,
a);h.rotate=i(b.rotate,d.rotate,a);h.skewX=i(b.skewX,d.skewX,a);h.skewY=i(b.skewY,d.skewY,a);h.scaleX=i(b.scaleX,d.scaleX,a);h.scaleY=i(b.scaleY,d.scaleY,a);return k.substitute("translate3d({translateX}px,{translateY}px,0) rotate({rotate}deg) skewX({skewX}deg) skewY({skewY}deg) scale({scaleX},{scaleY})",h)}});return l.Factories.transform=f},{requires:["dom","./fx"]});
KISSY.add("anim/timer",function(k,m,l,j,n,b,d,f){function g(){var a;g.superclass.constructor.apply(this,arguments);k.each(a=this.to,function(b,c){var e=o(c);c!=e&&(a[e]=a[c],delete a[c])})}var o=m._camelCase,a=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i;k.extend(g,j,{prepareFx:function(){var b=this.node,h=this._propsData;k.each(h,function(a){a.duration*=1E3;a.delay*=1E3;"string"==typeof a.easing&&(a.easing=n.toFn(a.easing))});k.each(f,function(a,c){var e,d=h[c],f;d&&!d.fx&&(f=d.value,e={},k.each(a,function(a){e[a]=
m.css(b,a)}),m.css(b,c,f),k.each(e,function(a,c){c in h||(h[c]=k.merge(d,{value:m.css(b,c)}));m.css(b,c,a)}),delete h[c])});var c,e,g,j,l,o,q,p;for(c in h)if(e=h[c],e.fx)e.fx.prop=c;else{g=e.value;o={prop:c,anim:this,propData:e};q=d.getFx(o);j=g;l=q.cur();g+="";p="";if(g=g.match(a)){j=parseFloat(g[2]);if((p=g[3])&&"px"!==p&&l){var s=0,t=j;do++t,m.css(b,c,t+p),s=q.cur();while(0==s);l*=t/s;m.css(b,c,l+p)}g[1]&&(j=("-="===g[1]?-1:1)*j+l)}o.from=l;o.to=j;o.unit=p;q.load(o);e.fx=q}},frame:function(){var a,
b=1,c,e,f,g,j=this._propsData;for(a in j)if(g=j[a],e=g.fx,!e.finished)if(f=d.getPos(this,g),0==f)b=0;else{e.pos=f;if(e.isBasicFx){if(e.from==e.to){e.finished=e.finished||1==f;b=0;continue}c=0;if(g.frame&&(c=g.frame(this,e),!this.isRunning()))return;!1!==c&&e.frame(e.finished||f)}else if(e.finished=e.finished||1==f,e.frame(this,e),!this.isRunning())return;b&=e.finished}(!1===this.fire("step")||b)&&this.stop(b)},doStop:function(a){var d,c,e,f=this._propsData;b.stop(this);if(a)for(d in f)if(e=f[d],(a=
e.fx)&&!a.finished)a.pos=1,a.isBasicFx?(c=0,e.frame&&(c=e.frame(this,a)),!1!==c&&a.frame(1)):a.frame(this,a),a.finished=1},doStart:function(){b.start(this)}});g.Easing=n;g.Fx=d;return g},{requires:"dom,event,./base,./timer/easing,./timer/manager,./timer/fx,./timer/short-hand,./timer/color,./timer/transform".split(",")});
