(function(o,z){var t="backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color outlineColor".split(" "),w=/^([\-+])=\s*(\d+\.?\d*)/,x=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/,parse:function(a){return[a[1],a[2],a[3],a[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/,parse:function(a){return[2.55*a[1],2.55*a[2],2.55*a[3],a[4]]}},{re:/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/,parse:function(a){return[parseInt(a[1],16),parseInt(a[2],16),parseInt(a[3],16)]}},{re:/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/,parse:function(a){return[parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16),parseInt(a[3]+a[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(a){return[a[1],a[2]/100,a[3]/100,a[4]]}}],y=o.Color=function(c,b,d,a){return new o.Color.fn.parse(c,b,d,a)},u={rgba:{cache:"_rgba",props:{red:{idx:0,type:"byte",empty:true},green:{idx:1,type:"byte",empty:true},blue:{idx:2,type:"byte",empty:true},alpha:{idx:3,type:"percent",def:1}}},hsla:{cache:"_hsla",props:{hue:{idx:0,type:"degrees",empty:true},saturation:{idx:1,type:"percent",empty:true},lightness:{idx:2,type:"percent",empty:true}}}},p={"byte":{floor:true,min:0,max:255},percent:{min:0,max:1},degrees:{mod:360,floor:true}},r=u.rgba.props,q=y.support={},B,s=o.each;u.hsla.props.alpha=r.alpha;function v(c,a,d){var e=p[a.type]||{},b=a.empty||d;if(b&&c==null){return null}if(a.def&&c==null){return a.def}if(e.floor){c=~~c}else{c=parseFloat(c)}if(c==null||isNaN(c)){return a.def}if(e.mod){c=c%e.mod;return c<0?e.mod+c:c}return e.min>c?e.min:e.max<c?e.max:c}y.fn=y.prototype={constructor:y,parse:function(a,c,h,b){if(a===z){this._rgba=[null,null,null,null];return this}if(a instanceof o||a.nodeType){a=a instanceof o?a.css(c):o(a).css(c);c=z}var d=this,f=o.type(a),g=this._rgba=[],e;if(c!==z){a=[a,c,h,b];f="array"}if(f==="string"){a=a.toLowerCase();s(x,function(D,m){var j=m.re.exec(a),l=j&&m.parse(j),n,i=m.space||"rgba",k=u[i].cache;if(l){n=d[i](l);d[k]=n[k];g=d._rgba=n._rgba;return false}});if(g.length!==0){if(Math.max.apply(Math,g)===0){o.extend(g,B.transparent)}return this}a=B[a]||B._default;return this.parse(a)}if(f==="array"){s(r,function(j,i){g[i.idx]=v(a[i.idx],i)});return this}if(f==="object"){if(a instanceof y){s(u,function(j,i){if(a[i.cache]){d[i.cache]=a[i.cache].slice()}})}else{s(u,function(j,i){s(i.props,function(l,k){var m=i.cache;if(!d[m]&&i.to){if(a[l]==null||l==="alpha"){return}d[m]=i.to(d._rgba)}d[m][k.idx]=v(a[l],k,true)})})}return this}},is:function(b){var c=y(b),a=true,d=this;s(u,function(h,f){var g=c[f.cache],e;if(g){e=d[f.cache]||f.to&&f.to(d._rgba)||[];s(f.props,function(j,i){if(g[i.idx]!=null){a=(g[i.idx]==e[i.idx]);return a}})}return a});return a},_space:function(){var b=[],a=this;s(u,function(d,c){if(a[c.cache]){b.push(d)}});return b.pop()},transition:function(f,a){var e=y(f),d=e._space(),c=u[d],b=this[c.cache]||c.to(this._rgba),g=b.slice();e=e[c.cache];s(c.props,function(m,i){var h=i.idx,j=b[h],k=e[h],l=p[i.type]||{};if(k===null){return}if(j===null){g[h]=k}else{if(l.mod){if(k-j>l.mod/2){j+=l.mod}else{if(j-k>l.mod/2){j-=l.mod}}}g[i.idx]=v((k-j)*a+j,i)}});return this[d](g)},blend:function(a){if(this._rgba[3]===1){return this}var b=this._rgba.slice(),c=b.pop(),d=y(a)._rgba;return y(o.map(b,function(f,e){return(1-c)*d[e]+c*f}))},toRgbaString:function(){var a="rgba(",b=o.map(this._rgba,function(d,c){return d==null?(c>2?1:0):d});if(b[3]===1){b.pop();a="rgb("}return a+b.join(",")+")"},toHslaString:function(){var a="hsla(",b=o.map(this.hsla(),function(d,c){if(d==null){d=c>2?1:0}if(c&&c<3){d=Math.round(d*100)+"%"}return d});if(b[3]==1){b.pop();a="hsl("}return a+b.join(",")+")"},toHexString:function(c){var b=this._rgba.slice(),a=b.pop();if(c){b.push(~~(a*255))}return"#"+o.map(b,function(e,d){e=(e||0).toString(16);return e.length==1?"0"+e:e}).join("")},toString:function(){return this._rgba[3]===0?"transparent":this.toRgbaString()}};y.fn.parse.prototype=y.fn;function A(a,b,c){c=(c+1)%1;if(c*6<1){return a+(b-a)*6*c}if(c*2<1){return b}if(c*3<2){return a+(b-a)*((2/3)-c)*6}return a}u.hsla.to=function(a){if(a[0]==null||a[1]==null||a[2]==null){return[null,null,null,a[3]]}var e=a[0]/255,j=a[1]/255,i=a[2]/255,g=a[3],h=Math.max(e,j,i),l=Math.min(e,j,i),f=h-l,d=h+l,c=d*0.5,k,b;if(l===h){k=0}else{if(e===h){k=(60*(j-i)/f)+360}else{if(j===h){k=(60*(i-e)/f)+120}else{k=(60*(e-j)/f)+240}}}if(c===0||c===1){b=c}else{if(c<=0.5){b=f/d}else{b=f/(2-d)}}return[Math.round(k)%360,b,c,g==null?1:g]};u.hsla.from=function(i){if(i[0]==null||i[1]==null||i[2]==null){return[null,null,null,i[3]]}var f=i[0]/360,a=i[1],g=i[2],c=i[3],j=g<=0.5?g*(1+a):g+a-g*a,h=2*g-j,b,e,d;return[Math.round(A(h,j,f+(1/3))*255),Math.round(A(h,j,f)*255),Math.round(A(h,j,f-(1/3))*255),c]};s(u,function(e,c){var d=c.props,f=c.cache,a=c.to,b=c.from;y.fn[e]=function(k){if(a&&!this[f]){this[f]=a(this._rgba)}if(k===z){return this[f].slice()}var g=o.type(k),j=(g==="array"||g==="object")?k:arguments,h=this[f].slice(),i;s(d,function(m,n){var l=j[g==="object"?m:n.idx];if(l==null){l=h[n.idx]}h[n.idx]=v(l,n)});if(b){i=y(b(h));i[f]=h;return i}else{return y(h)}};s(d,function(h,g){if(y.fn[h]){return}y.fn[h]=function(l){var n=o.type(l),m=(h==="alpha"?(this._hsla?"hsla":"rgba"):e),j=this[m](),i=j[g.idx],k;if(n==="undefined"){return i}if(n==="function"){l=l.call(this,i);n=o.type(l)}if(l==null&&g.empty){return this}if(n==="string"){k=w.exec(l);if(k){l=i+parseFloat(k[2])*(k[1]==="+"?1:-1)}}j[g.idx]=l;return this[m](j)}})});s(t,function(b,a){o.cssHooks[a]={set:function(d,c){c=y(c);if(!q.rgba&&c._rgba[3]!==1){var f,e=a==="backgroundColor"?d.parentNode:d;do{f=o.curCSS(e,"backgroundColor")}while((f===""||f==="transparent")&&(e=e.parentNode)&&e.style);c=c.blend(f&&f!=="transparent"?f:"_default")}c=c.toRgbaString();d.style[a]=c}};o.fx.step[a]=function(c){if(!c.colorInit){c.start=y(c.elem,a);c.end=y(c.end);c.colorInit=true}o.cssHooks[a].set(c.elem,c.start.transition(c.end,c.pos))}});o(function(){var a=document.createElement("div"),b=a.style;b.cssText="background-color:rgba(1,1,1,.5)";q.rgba=b.backgroundColor.indexOf("rgba")>-1});B=o.Color.names={aqua:"#00ffff",azure:"#f0ffff",beige:"#f5f5dc",black:"#000000",blue:"#0000ff",brown:"#a52a2a",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgrey:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkviolet:"#9400d3",fuchsia:"#ff00ff",gold:"#ffd700",green:"#008000",indigo:"#4b0082",khaki:"#f0e68c",lightblue:"#add8e6",lightcyan:"#e0ffff",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightyellow:"#ffffe0",lime:"#00ff00",magenta:"#ff00ff",maroon:"#800000",navy:"#000080",olive:"#808000",orange:"#ffa500",pink:"#ffc0cb",purple:"#800080",violet:"#800080",red:"#ff0000",silver:"#c0c0c0",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}})(jQuery);
