1.5.0
authorDmitry Baranovskiy <Dmitry@Baranovskiy.com>
Tue, 17 Aug 2010 03:18:08 +0000 (13:18 +1000)
committerDmitry Baranovskiy <Dmitry@Baranovskiy.com>
Tue, 17 Aug 2010 03:18:08 +0000 (13:18 +1000)
• fixed IE8 issue with the HTML element named Raphael
• fixed precision for arcs in IE
• added caching to getPointAtSegmentLength function
• added ability to do more than one animation of an element at the same time
• added "cubic-bezier()" as an easing method
• added new syntax for animation (keyframes)
• hsl2rgb now accept h as degree (0..360), s and b as % (0..100)
• show="new" instead of target="blank" for SVG
• added angle method
• added snapTo method
• cached popup || activeX for IE
• fixed insertAfter
• fixed timeouts for animation
• added customAttributes

raphael-min.js
raphael.js
reference.html

index 33e620e..89d6acb 100644 (file)
@@ -1,116 +1,7 @@
 /*
- * Raphael 1.4.7 - JavaScript Vector Library
+ * Raphael 1.5.0 - JavaScript Vector Library
  *
  * Copyright (c) 2010 Dmitry Baranovskiy (http://raphaeljs.com)
  * Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license.
  */
-Raphael=function(){function l(){if(l.is(arguments[0],U)){for(var a=arguments[0],b=Ca[K](l,a.splice(0,3+l.is(a[0],P))),c=b.set(),d=0,f=a[o];d<f;d++){var e=a[d]||{};sb.test(e.type)&&c[F](b[e.type]().attr(e))}return c}return Ca[K](l,arguments)}l.version="1.4.7";var V=/[, ]+/,sb=/^(circle|rect|path|ellipse|text|image)$/,p="prototype",z="hasOwnProperty",C=document,aa=window,Qa={was:Object[p][z].call(aa,"Raphael"),is:aa.Raphael};function H(){}var x="appendChild",K="apply",M="concat",Da="createTouch"in C,
-A="",N=" ",D=String,G="split",Ra="click dblclick mousedown mousemove mouseout mouseover mouseup touchstart touchmove touchend orientationchange touchcancel gesturestart gesturechange gestureend"[G](N),Ea={mousedown:"touchstart",mousemove:"touchmove",mouseup:"touchend"},R="join",o="length",fa=String[p].toLowerCase,v=Math,Y=v.max,ba=v.min,P="number",ga="string",U="array",O="toString",ca="fill",tb=Object[p][O],E=v.pow,F="push",ja=/^(?=[\da-f]$)/,Sa=/^url\(['"]?([^\)]+?)['"]?\)$/i,ub=/^\s*((#[a-f\d]{6})|(#[a-f\d]{3})|rgba?\(\s*([\d\.]+\s*,\s*[\d\.]+\s*,\s*[\d\.]+(?:\s*,\s*[\d\.]+)?)\s*\)|rgba?\(\s*([\d\.]+%\s*,\s*[\d\.]+%\s*,\s*[\d\.]+%(?:\s*,\s*[\d\.]+%)?)\s*\)|hsb\(\s*([\d\.]+(?:deg|\xb0)?\s*,\s*[\d\.]+\s*,\s*[\d\.]+)\s*\)|hsb\(\s*([\d\.]+(?:deg|\xb0|%)\s*,\s*[\d\.]+%\s*,\s*[\d\.]+%)\s*\)|hsl\(\s*([\d\.]+(?:deg|\xb0)?\s*,\s*[\d\.]+\s*,\s*[\d\.]+)\s*\)|hsl\(\s*([\d\.]+(?:deg|\xb0|%)\s*,\s*[\d\.]+%\s*,\s*[\d\.]+%)\s*\))\s*$/i,
-Q=v.round,W="setAttribute",y=parseFloat,ha=parseInt,Fa=" progid:DXImageTransform.Microsoft",sa=String[p].toUpperCase,ta={blur:0,"clip-rect":"0 0 1e9 1e9",cursor:"default",cx:0,cy:0,fill:"#fff","fill-opacity":1,font:'10px "Arial"',"font-family":'"Arial"',"font-size":"10","font-style":"normal","font-weight":400,gradient:0,height:0,href:"http://raphaeljs.com/",opacity:1,path:"M0,0",r:0,rotation:0,rx:0,ry:0,scale:"1 1",src:"",stroke:"#000","stroke-dasharray":"","stroke-linecap":"butt","stroke-linejoin":"butt",
-"stroke-miterlimit":0,"stroke-opacity":1,"stroke-width":1,target:"_blank","text-anchor":"middle",title:"Raphael",translation:"0 0",width:0,x:0,y:0},Ga={along:"along",blur:P,"clip-rect":"csv",cx:P,cy:P,fill:"colour","fill-opacity":P,"font-size":P,height:P,opacity:P,path:"path",r:P,rotation:"csv",rx:P,ry:P,scale:"csv",stroke:"colour","stroke-opacity":P,"stroke-width":P,translation:"csv",width:P,x:P,y:P},I="replace";l.type=aa.SVGAngle||C.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure",
-"1.1")?"SVG":"VML";if(l.type=="VML"){var da=C.createElement("div");da.innerHTML='<v:shape adj="1"/>';da=da.firstChild;da.style.behavior="url(#default#VML)";if(!(da&&typeof da.adj=="object"))return l.type=null;da=null}l.svg=!(l.vml=l.type=="VML");H[p]=l[p];l._id=0;l._oid=0;l.fn={};l.is=function(a,b){b=fa.call(b);return b=="object"&&a===Object(a)||b=="undefined"&&typeof a==b||b=="null"&&a==null||b=="array"&&Array.isArray&&Array.isArray(a)||fa.call(tb.call(a).slice(8,-1))==b};l.setWindow=function(a){aa=
-a;C=aa.document};function ua(a){if(l.vml){var b=/^\s+|\s+$/g;ua=Z(function(d){var f;d=D(d)[I](b,A);try{var e=new aa.ActiveXObject("htmlfile");e.write("<body>");e.close();f=e.body}catch(g){f=aa.createPopup().document.body}e=f.createTextRange();try{f.style.color=d;var h=e.queryCommandValue("ForeColor");h=(h&255)<<16|h&65280|(h&16711680)>>>16;return"#"+("000000"+h[O](16)).slice(-6)}catch(i){return"none"}})}else{var c=C.createElement("i");c.title="Rapha\u00ebl Colour Picker";c.style.display="none";C.body[x](c);
-ua=Z(function(d){c.style.color=d;return C.defaultView.getComputedStyle(c,A).getPropertyValue("color")})}return ua(a)}function Ta(){return"hsb("+[this.h,this.s,this.b]+")"}function vb(){return"hsl("+[this.h,this.s,this.l]+")"}function wb(){return this.hex}l.hsb2rgb=function(a,b,c){if(l.is(a,"object")&&"h"in a&&"s"in a&&"b"in a){c=a.b;b=a.s;a=a.h}return l.hsl2rgb(a,b,c/2)};l.hsl2rgb=function(a,b,c){if(l.is(a,"object")&&"h"in a&&"s"in a&&"l"in a){c=a.l;b=a.s;a=a.h}if(a>1||b>1||c>1){a/=255;b/=255;c/=
-255}var d={},f=["r","g","b"],e;if(b){b=c<0.5?c*(1+b):c+b-c*b;c=2*c-b;for(var g=0,h=f.length;g<h;g++){e=a+1/3*-(g-1);e<0&&e++;e>1&&e--;d[f[g]]=e*6<1?c+(b-c)*6*e:e*2<1?b:e*3<2?c+(b-c)*(2/3-e)*6:c}}else d={r:c,g:c,b:c};d.r*=255;d.g*=255;d.b*=255;a=(~~d.r)[O](16);f=(~~d.g)[O](16);b=(~~d.b)[O](16);a=a[I](ja,"0");f=f[I](ja,"0");b=b[I](ja,"0");d.hex="#"+a+f+b;d.toString=wb;return d};l.rgb2hsb=function(a,b,c){if(b==null&&l.is(a,"object")&&"r"in a&&"g"in a&&"b"in a){c=a.b;b=a.g;a=a.r}if(b==null&&l.is(a,ga)){var d=
-l.getRGB(a);a=d.r;b=d.g;c=d.b}if(a>1||b>1||c>1){a/=255;b/=255;c/=255}var f=Y(a,b,c),e=ba(a,b,c);d=f;if(e==f)return{h:0,s:0,b:f,toString:Ta};else{var g=f-e;e=g/f;a=a==f?(b-c)/g:b==f?2+(c-a)/g:4+(a-b)/g;a/=6;a<0&&a++;a>1&&a--}return{h:a,s:e,b:d,toString:Ta}};l.rgb2hsl=function(a,b,c){if(b==null&&l.is(a,"object")&&"r"in a&&"g"in a&&"b"in a){c=a.b;b=a.g;a=a.r}if(b==null&&l.is(a,ga)){var d=l.getRGB(a);a=d.r;b=d.g;c=d.b}if(a>1||b>1||c>1){a/=255;b/=255;c/=255}var f=Y(a,b,c),e=ba(a,b,c);d=(f+e)/2;if(e==f)a=
-{h:0,s:0,l:d};else{var g=f-e;e=d<0.5?g/(f+e):g/(2-f-e);a=a==f?(b-c)/g:b==f?2+(c-a)/g:4+(a-b)/g;a/=6;a<0&&a++;a>1&&a--;a={h:a,s:e,l:d}}a.toString=vb;return a};var xb=/,?([achlmqrstvxz]),?/gi,ka=/\s*,\s*/,yb={hs:1,rg:1};l._path2string=function(){return this.join(",")[I](xb,"$1")};function Z(a,b,c){function d(){var f=Array[p].slice.call(arguments,0),e=f[R]("\u25ba"),g=d.cache=d.cache||{},h=d.count=d.count||[];if(g[z](e))return c?c(g[e]):g[e];h[o]>=1000&&delete g[h.shift()];h[F](e);g[e]=a[K](b,f);return c?
-c(g[e]):g[e]}return d}l.getRGB=Z(function(a){if(!a||(a=D(a)).indexOf("-")+1)return{r:-1,g:-1,b:-1,hex:"none",error:1};if(a=="none")return{r:-1,g:-1,b:-1,hex:"none"};!(yb[z](a.substring(0,2))||a.charAt()=="#")&&(a=ua(a));var b,c,d,f,e;if(a=a.match(ub)){if(a[2]){d=ha(a[2].substring(5),16);c=ha(a[2].substring(3,5),16);b=ha(a[2].substring(1,3),16)}if(a[3]){d=ha((e=a[3].charAt(3))+e,16);c=ha((e=a[3].charAt(2))+e,16);b=ha((e=a[3].charAt(1))+e,16)}if(a[4]){a=a[4][G](ka);b=y(a[0]);c=y(a[1]);d=y(a[2]);f=y(a[3])}if(a[5]){a=
-a[5][G](ka);b=y(a[0])*2.55;c=y(a[1])*2.55;d=y(a[2])*2.55;f=y(a[3])}if(a[6]){a=a[6][G](ka);b=y(a[0]);c=y(a[1]);d=y(a[2]);(a[0].slice(-3)=="deg"||a[0].slice(-1)=="\u00b0")&&(b/=360);return l.hsb2rgb(b,c,d)}if(a[7]){a=a[7][G](ka);b=y(a[0])*2.55;c=y(a[1])*2.55;d=y(a[2])*2.55;(a[0].slice(-3)=="deg"||a[0].slice(-1)=="\u00b0")&&(b/=360*2.55);return l.hsb2rgb(b,c,d)}if(a[8]){a=a[8][G](ka);b=y(a[0]);c=y(a[1]);d=y(a[2]);(a[0].slice(-3)=="deg"||a[0].slice(-1)=="\u00b0")&&(b/=360);return l.hsl2rgb(b,c,d)}if(a[9]){a=
-a[9][G](ka);b=y(a[0])*2.55;c=y(a[1])*2.55;d=y(a[2])*2.55;(a[0].slice(-3)=="deg"||a[0].slice(-1)=="\u00b0")&&(b/=360*2.55);return l.hsl2rgb(b,c,d)}a={r:b,g:c,b:d};b=(~~b)[O](16);c=(~~c)[O](16);d=(~~d)[O](16);b=b[I](ja,"0");c=c[I](ja,"0");d=d[I](ja,"0");a.hex="#"+b+c+d;isFinite(y(f))&&(a.o=f);return a}return{r:-1,g:-1,b:-1,hex:"none",error:1}},l);l.getColor=function(a){a=this.getColor.start=this.getColor.start||{h:0,s:1,b:a||0.75};var b=this.hsb2rgb(a.h,a.s,a.b);a.h+=0.075;if(a.h>1){a.h=0;a.s-=0.2;
-a.s<=0&&(this.getColor.start={h:0,s:1,b:a.b})}return b.hex};l.getColor.reset=function(){delete this.start};var zb=/([achlmqstvz])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?\s*,?\s*)+)/ig,Ab=/(-?\d*\.?\d*(?:e[-+]?\d+)?)\s*,?\s*/ig;l.parsePathString=Z(function(a){if(!a)return null;var b={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},c=[];if(l.is(a,U)&&l.is(a[0],U))c=va(a);c[o]||D(a)[I](zb,function(d,f,e){var g=[];d=fa.call(f);e[I](Ab,function(h,i){i&&g[F](+i)});if(d=="m"&&g[o]>2){c[F]([f][M](g.splice(0,2)));d="l";
-f=f=="m"?"l":"L"}for(;g[o]>=b[d];){c[F]([f][M](g.splice(0,b[d])));if(!b[d])break}});c[O]=l._path2string;return c});l.findDotsAtSegment=function(a,b,c,d,f,e,g,h,i){var j=1-i,m=E(j,3)*a+E(j,2)*3*i*c+j*3*i*i*f+E(i,3)*g;j=E(j,3)*b+E(j,2)*3*i*d+j*3*i*i*e+E(i,3)*h;var n=a+2*i*(c-a)+i*i*(f-2*c+a),r=b+2*i*(d-b)+i*i*(e-2*d+b),q=c+2*i*(f-c)+i*i*(g-2*f+c),k=d+2*i*(e-d)+i*i*(h-2*e+d);a=(1-i)*a+i*c;b=(1-i)*b+i*d;f=(1-i)*f+i*g;e=(1-i)*e+i*h;h=90-v.atan((n-q)/(r-k))*180/v.PI;(n>q||r<k)&&(h+=180);return{x:m,y:j,
-m:{x:n,y:r},n:{x:q,y:k},start:{x:a,y:b},end:{x:f,y:e},alpha:h}};var xa=Z(function(a){if(!a)return{x:0,y:0,width:0,height:0};a=wa(a);for(var b=0,c=0,d=[],f=[],e,g=0,h=a[o];g<h;g++){e=a[g];if(e[0]=="M"){b=e[1];c=e[2];d[F](b);f[F](c)}else{b=Bb(b,c,e[1],e[2],e[3],e[4],e[5],e[6]);d=d[M](b.min.x,b.max.x);f=f[M](b.min.y,b.max.y);b=e[5];c=e[6]}}a=ba[K](0,d);e=ba[K](0,f);return{x:a,y:e,width:Y[K](0,d)-a,height:Y[K](0,f)-e}});function va(a){var b=[];if(!l.is(a,U)||!l.is(a&&a[0],U))a=l.parsePathString(a);for(var c=
-0,d=a[o];c<d;c++){b[c]=[];for(var f=0,e=a[c][o];f<e;f++)b[c][f]=a[c][f]}b[O]=l._path2string;return b}var Ha=Z(function(a){if(!l.is(a,U)||!l.is(a&&a[0],U))a=l.parsePathString(a);var b=[],c=0,d=0,f=0,e=0,g=0;if(a[0][0]=="M"){c=a[0][1];d=a[0][2];f=c;e=d;g++;b[F](["M",c,d])}g=g;for(var h=a[o];g<h;g++){var i=b[g]=[],j=a[g];if(j[0]!=fa.call(j[0])){i[0]=fa.call(j[0]);switch(i[0]){case "a":i[1]=j[1];i[2]=j[2];i[3]=j[3];i[4]=j[4];i[5]=j[5];i[6]=+(j[6]-c).toFixed(3);i[7]=+(j[7]-d).toFixed(3);break;case "v":i[1]=
-+(j[1]-d).toFixed(3);break;case "m":f=j[1];e=j[2];default:for(var m=1,n=j[o];m<n;m++)i[m]=+(j[m]-(m%2?c:d)).toFixed(3)}}else{b[g]=[];if(j[0]=="m"){f=j[1]+c;e=j[2]+d}i=0;for(m=j[o];i<m;i++)b[g][i]=j[i]}j=b[g][o];switch(b[g][0]){case "z":c=f;d=e;break;case "h":c+=+b[g][j-1];break;case "v":d+=+b[g][j-1];break;default:c+=+b[g][j-2];d+=+b[g][j-1]}}b[O]=l._path2string;return b},0,va),oa=Z(function(a){if(!l.is(a,U)||!l.is(a&&a[0],U))a=l.parsePathString(a);var b=[],c=0,d=0,f=0,e=0,g=0;if(a[0][0]=="M"){c=
-+a[0][1];d=+a[0][2];f=c;e=d;g++;b[0]=["M",c,d]}g=g;for(var h=a[o];g<h;g++){var i=b[g]=[],j=a[g];if(j[0]!=sa.call(j[0])){i[0]=sa.call(j[0]);switch(i[0]){case "A":i[1]=j[1];i[2]=j[2];i[3]=j[3];i[4]=j[4];i[5]=j[5];i[6]=+(j[6]+c);i[7]=+(j[7]+d);break;case "V":i[1]=+j[1]+d;break;case "H":i[1]=+j[1]+c;break;case "M":f=+j[1]+c;e=+j[2]+d;default:for(var m=1,n=j[o];m<n;m++)i[m]=+j[m]+(m%2?c:d)}}else{m=0;for(n=j[o];m<n;m++)b[g][m]=j[m]}switch(i[0]){case "Z":c=f;d=e;break;case "H":c=i[1];break;case "V":d=i[1];
-break;case "M":f=b[g][b[g][o]-2];e=b[g][b[g][o]-1];default:c=b[g][b[g][o]-2];d=b[g][b[g][o]-1]}}b[O]=l._path2string;return b},null,va);function ya(a,b,c,d){return[a,b,c,d,c,d]}function Ua(a,b,c,d,f,e){var g=1/3,h=2/3;return[g*a+h*c,g*b+h*d,g*f+h*c,g*e+h*d,f,e]}function Va(a,b,c,d,f,e,g,h,i,j){var m=v.PI,n=m*120/180,r=m/180*(+f||0),q=[],k,t=Z(function(J,ia,za){var Cb=J*v.cos(za)-ia*v.sin(za);J=J*v.sin(za)+ia*v.cos(za);return{x:Cb,y:J}});if(j){w=j[0];k=j[1];e=j[2];B=j[3]}else{k=t(a,b,-r);a=k.x;b=k.y;
-k=t(h,i,-r);h=k.x;i=k.y;v.cos(m/180*f);v.sin(m/180*f);k=(a-h)/2;w=(b-i)/2;B=k*k/(c*c)+w*w/(d*d);if(B>1){B=v.sqrt(B);c=B*c;d=B*d}B=c*c;var L=d*d;B=(e==g?-1:1)*v.sqrt(v.abs((B*L-B*w*w-L*k*k)/(B*w*w+L*k*k)));e=B*c*w/d+(a+h)/2;var B=B*-d*k/c+(b+i)/2,w=v.asin(((b-B)/d).toFixed(7));k=v.asin(((i-B)/d).toFixed(7));w=a<e?m-w:w;k=h<e?m-k:k;w<0&&(w=m*2+w);k<0&&(k=m*2+k);if(g&&w>k)w-=m*2;if(!g&&k>w)k-=m*2}m=k-w;if(v.abs(m)>n){q=k;m=h;L=i;k=w+n*(g&&k>w?1:-1);h=e+c*v.cos(k);i=B+d*v.sin(k);q=Va(h,i,c,d,f,0,g,m,
-L,[k,q,e,B])}m=k-w;f=v.cos(w);e=v.sin(w);g=v.cos(k);k=v.sin(k);m=v.tan(m/4);c=4/3*c*m;m=4/3*d*m;d=[a,b];a=[a+c*e,b-m*f];b=[h+c*k,i-m*g];h=[h,i];a[0]=2*d[0]-a[0];a[1]=2*d[1]-a[1];if(j)return[a,b,h][M](q);else{q=[a,b,h][M](q)[R]()[G](",");j=[];h=0;for(i=q[o];h<i;h++)j[h]=h%2?t(q[h-1],q[h],r).y:t(q[h],q[h+1],r).x;return j}}function la(a,b,c,d,f,e,g,h,i){var j=1-i;return{x:E(j,3)*a+E(j,2)*3*i*c+j*3*i*i*f+E(i,3)*g,y:E(j,3)*b+E(j,2)*3*i*d+j*3*i*i*e+E(i,3)*h}}var Bb=Z(function(a,b,c,d,f,e,g,h){var i=f-2*
-c+a-(g-2*f+c),j=2*(c-a)-2*(f-c),m=a-c,n=(-j+v.sqrt(j*j-4*i*m))/2/i;i=(-j-v.sqrt(j*j-4*i*m))/2/i;var r=[b,h],q=[a,g];v.abs(n)>1000000000000&&(n=0.5);v.abs(i)>1000000000000&&(i=0.5);if(n>0&&n<1){n=la(a,b,c,d,f,e,g,h,n);q[F](n.x);r[F](n.y)}if(i>0&&i<1){n=la(a,b,c,d,f,e,g,h,i);q[F](n.x);r[F](n.y)}i=e-2*d+b-(h-2*e+d);j=2*(d-b)-2*(e-d);m=b-d;n=(-j+v.sqrt(j*j-4*i*m))/2/i;i=(-j-v.sqrt(j*j-4*i*m))/2/i;v.abs(n)>1000000000000&&(n=0.5);v.abs(i)>1000000000000&&(i=0.5);if(n>0&&n<1){n=la(a,b,c,d,f,e,g,h,n);q[F](n.x);
-r[F](n.y)}if(i>0&&i<1){n=la(a,b,c,d,f,e,g,h,i);q[F](n.x);r[F](n.y)}return{min:{x:ba[K](0,q),y:ba[K](0,r)},max:{x:Y[K](0,q),y:Y[K](0,r)}}}),wa=Z(function(a,b){var c=oa(a),d=b&&oa(b);a={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null};b={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null};function f(q,k){var t;if(!q)return["C",k.x,k.y,k.x,k.y,k.x,k.y];!(q[0]in{T:1,Q:1})&&(k.qx=k.qy=null);switch(q[0]){case "M":k.X=q[1];k.Y=q[2];break;case "A":q=["C"][M](Va[K](0,[k.x,k.y][M](q.slice(1))));break;case "S":t=k.x+(k.x-
-(k.bx||k.x));k=k.y+(k.y-(k.by||k.y));q=["C",t,k][M](q.slice(1));break;case "T":k.qx=k.x+(k.x-(k.qx||k.x));k.qy=k.y+(k.y-(k.qy||k.y));q=["C"][M](Ua(k.x,k.y,k.qx,k.qy,q[1],q[2]));break;case "Q":k.qx=q[1];k.qy=q[2];q=["C"][M](Ua(k.x,k.y,q[1],q[2],q[3],q[4]));break;case "L":q=["C"][M](ya(k.x,k.y,q[1],q[2]));break;case "H":q=["C"][M](ya(k.x,k.y,q[1],k.y));break;case "V":q=["C"][M](ya(k.x,k.y,k.x,q[1]));break;case "Z":q=["C"][M](ya(k.x,k.y,k.X,k.Y));break}return q}function e(q,k){if(q[k][o]>7){q[k].shift();
-for(var t=q[k];t[o];)q.splice(k++,0,["C"][M](t.splice(0,6)));q.splice(k,1);i=Y(c[o],d&&d[o]||0)}}function g(q,k,t,L,B){if(q&&k&&q[B][0]=="M"&&k[B][0]!="M"){k.splice(B,0,["M",L.x,L.y]);t.bx=0;t.by=0;t.x=q[B][1];t.y=q[B][2];i=Y(c[o],d&&d[o]||0)}}for(var h=0,i=Y(c[o],d&&d[o]||0);h<i;h++){c[h]=f(c[h],a);e(c,h);d&&(d[h]=f(d[h],b));d&&e(d,h);g(c,d,a,b,h);g(d,c,b,a,h);var j=c[h],m=d&&d[h],n=j[o],r=d&&m[o];a.x=j[n-2];a.y=j[n-1];a.bx=y(j[n-4])||a.x;a.by=y(j[n-3])||a.y;b.bx=d&&(y(m[r-4])||b.x);b.by=d&&(y(m[r-
-3])||b.y);b.x=d&&m[r-2];b.y=d&&m[r-1]}return d?[c,d]:c},null,va),Wa=Z(function(a){for(var b=[],c=0,d=a[o];c<d;c++){var f={},e=a[c].match(/^([^:]*):?([\d\.]*)/);f.color=l.getRGB(e[1]);if(f.color.error)return null;f.color=f.color.hex;e[2]&&(f.offset=e[2]+"%");b[F](f)}c=1;for(d=b[o]-1;c<d;c++)if(!b[c].offset){a=y(b[c-1].offset||0);e=0;for(f=c+1;f<d;f++)if(b[f].offset){e=b[f].offset;break}if(!e){e=100;f=d}e=y(e);for(e=(e-a)/(f-c+1);c<f;c++){a+=e;b[c].offset=a+"%"}}return b});function Xa(a,b,c,d){if(l.is(a,
-ga)||l.is(a,"object")){a=l.is(a,ga)?C.getElementById(a):a;if(a.tagName)return b==null?{container:a,width:a.style.pixelWidth||a.offsetWidth,height:a.style.pixelHeight||a.offsetHeight}:{container:a,width:b,height:c}}else return{container:1,x:a,y:b,width:c,height:d}}function Ia(a,b){var c=this;for(var d in b)if(b[z](d)&&!(d in a))switch(typeof b[d]){case "function":(function(f){a[d]=a===c?f:function(){return f[K](c,arguments)}})(b[d]);break;case "object":a[d]=a[d]||{};Ia.call(this,a[d],b[d]);break;default:a[d]=
-b[d];break}}function ma(a,b){a==b.top&&(b.top=a.prev);a==b.bottom&&(b.bottom=a.next);a.next&&(a.next.prev=a.prev);a.prev&&(a.prev.next=a.next)}function Ya(a,b){if(b.top!==a){ma(a,b);a.next=null;a.prev=b.top;b.top.next=a;b.top=a}}function Za(a,b){if(b.bottom!==a){ma(a,b);a.next=b.bottom;a.prev=null;b.bottom.prev=a;b.bottom=a}}function $a(a,b,c){ma(a,c);b==c.top&&(c.top=a);b.next&&(b.next.prev=a);a.next=b.next;a.prev=b;b.next=a}function ab(a,b,c){ma(a,c);b==c.bottom&&(c.bottom=a);b.prev&&(b.prev.next=
-a);a.prev=b.prev;b.prev=a;a.next=b}function bb(a){return function(){throw new Error("Rapha\u00ebl: you are calling to method \u201c"+a+"\u201d of removed object");}}var cb=/^r(?:\(([^,]+?)\s*,\s*([^\)]+?)\))?/;l.pathToRelative=Ha;if(l.svg){H[p].svgns="http://www.w3.org/2000/svg";H[p].xlink="http://www.w3.org/1999/xlink";Q=function(a){return+a+(~~a===a)*0.5};var u=function(a,b){if(b)for(var c in b)b[z](c)&&a[W](c,D(b[c]));else{a=C.createElementNS(H[p].svgns,a);a.style.webkitTapHighlightColor="rgba(0,0,0,0)";
-return a}};l[O]=function(){return"Your browser supports SVG.\nYou are running Rapha\u00ebl "+this.version};var db=function(a,b){var c=u("path");b.canvas&&b.canvas[x](c);b=new s(c,b);b.type="path";ea(b,{fill:"none",stroke:"#000",path:a});return b},pa=function(a,b,c){var d="linear",f=0.5,e=0.5,g=a.style;b=D(b)[I](cb,function(m,n,r){d="radial";if(n&&r){f=y(n);e=y(r);m=(e>0.5)*2-1;E(f-0.5,2)+E(e-0.5,2)>0.25&&(e=v.sqrt(0.25-E(f-0.5,2))*m+0.5)&&e!=0.5&&(e=e.toFixed(5)-1.0E-5*m)}return A});b=b[G](/\s*\-\s*/);
-if(d=="linear"){var h=b.shift();h=-y(h);if(isNaN(h))return null;h=[0,0,v.cos(h*v.PI/180),v.sin(h*v.PI/180)];var i=1/(Y(v.abs(h[2]),v.abs(h[3]))||1);h[2]*=i;h[3]*=i;if(h[2]<0){h[0]=-h[2];h[2]=0}if(h[3]<0){h[1]=-h[3];h[3]=0}}b=Wa(b);if(!b)return null;i=a.getAttribute(ca);(i=i.match(/^url\(#(.*)\)$/))&&c.defs.removeChild(C.getElementById(i[1]));i=u(d+"Gradient");i.id="r"+(l._id++)[O](36);u(i,d=="radial"?{fx:f,fy:e}:{x1:h[0],y1:h[1],x2:h[2],y2:h[3]});c.defs[x](i);c=0;for(h=b[o];c<h;c++){var j=u("stop");
-u(j,{offset:b[c].offset?b[c].offset:!c?"0%":"100%","stop-color":b[c].color||"#fff"});i[x](j)}u(a,{fill:"url(#"+i.id+")",opacity:1,"fill-opacity":1});g.fill=A;g.opacity=1;return g.fillOpacity=1},Ja=function(a){var b=a.getBBox();u(a.pattern,{patternTransform:l.format("translate({0},{1})",b.x,b.y)})},ea=function(a,b){var c={"":[0],none:[0],"-":[3,1],".":[1,1],"-.":[3,1,1,1],"-..":[3,1,1,1,1,1],". ":[1,3],"- ":[4,3],"--":[8,3],"- .":[4,3,1,3],"--.":[8,3,1,3],"--..":[8,3,1,3,1,3]},d=a.node,f=a.attrs,e=
-a.rotate();function g(k,t){if(t=c[fa.call(t)]){var L=k.attrs["stroke-width"]||"1";k={round:L,square:L,butt:0}[k.attrs["stroke-linecap"]||b["stroke-linecap"]]||0;for(var B=[],w=t[o];w--;)B[w]=t[w]*L+(w%2?1:-1)*k;u(d,{"stroke-dasharray":B[R](",")})}}b[z]("rotation")&&(e=b.rotation);var h=D(e)[G](V);if(h.length-1){h[1]=+h[1];h[2]=+h[2]}else h=null;y(e)&&a.rotate(0,true);for(var i in b)if(b[z](i))if(ta[z](i)){var j=b[i];f[i]=j;switch(i){case "blur":a.blur(j);break;case "rotation":a.rotate(j,true);break;
-case "href":case "title":case "target":var m=d.parentNode;if(fa.call(m.tagName)!="a"){var n=u("a");m.insertBefore(n,d);n[x](d);m=n}m.setAttributeNS(a.paper.xlink,i,j);break;case "cursor":d.style.cursor=j;break;case "clip-rect":m=D(j)[G](V);if(m[o]==4){a.clip&&a.clip.parentNode.parentNode.removeChild(a.clip.parentNode);var r=u("clipPath");n=u("rect");r.id="r"+(l._id++)[O](36);u(n,{x:m[0],y:m[1],width:m[2],height:m[3]});r[x](n);a.paper.defs[x](r);u(d,{"clip-path":"url(#"+r.id+")"});a.clip=n}if(!j){(j=
-C.getElementById(d.getAttribute("clip-path")[I](/(^url\(#|\)$)/g,A)))&&j.parentNode.removeChild(j);u(d,{"clip-path":A});delete a.clip}break;case "path":if(a.type=="path")u(d,{d:j?(f.path=oa(j)):"M0,0"});break;case "width":d[W](i,j);if(f.fx){i="x";j=f.x}else break;case "x":if(f.fx)j=-f.x-(f.width||0);case "rx":if(i=="rx"&&a.type=="rect")break;case "cx":h&&(i=="x"||i=="cx")&&(h[1]+=j-f[i]);d[W](i,j);a.pattern&&Ja(a);break;case "height":d[W](i,j);if(f.fy){i="y";j=f.y}else break;case "y":if(f.fy)j=-f.y-
-(f.height||0);case "ry":if(i=="ry"&&a.type=="rect")break;case "cy":h&&(i=="y"||i=="cy")&&(h[2]+=j-f[i]);d[W](i,j);a.pattern&&Ja(a);break;case "r":a.type=="rect"?u(d,{rx:j,ry:j}):d[W](i,j);break;case "src":a.type=="image"&&d.setAttributeNS(a.paper.xlink,"href",j);break;case "stroke-width":d.style.strokeWidth=j;d[W](i,j);f["stroke-dasharray"]&&g(a,f["stroke-dasharray"]);break;case "stroke-dasharray":g(a,j);break;case "translation":j=D(j)[G](V);j[0]=+j[0]||0;j[1]=+j[1]||0;if(h){h[1]+=j[0];h[2]+=j[1]}Aa.call(a,
-j[0],j[1]);break;case "scale":j=D(j)[G](V);a.scale(+j[0]||1,+j[1]||+j[0]||1,isNaN(y(j[2]))?null:+j[2],isNaN(y(j[3]))?null:+j[3]);break;case ca:if(m=D(j).match(Sa)){r=u("pattern");var q=u("image");r.id="r"+(l._id++)[O](36);u(r,{x:0,y:0,patternUnits:"userSpaceOnUse",height:1,width:1});u(q,{x:0,y:0});q.setAttributeNS(a.paper.xlink,"href",m[1]);r[x](q);j=C.createElement("img");j.style.cssText="position:absolute;left:-9999em;top-9999em";j.onload=function(){u(r,{width:this.offsetWidth,height:this.offsetHeight});
-u(q,{width:this.offsetWidth,height:this.offsetHeight});C.body.removeChild(this);a.paper.safari()};C.body[x](j);j.src=m[1];a.paper.defs[x](r);d.style.fill="url(#"+r.id+")";u(d,{fill:"url(#"+r.id+")"});a.pattern=r;a.pattern&&Ja(a);break}m=l.getRGB(j);if(m.error){if(({circle:1,ellipse:1}[z](a.type)||D(j).charAt()!="r")&&pa(d,j,a.paper)){f.gradient=j;f.fill="none";break}}else{delete b.gradient;delete f.gradient;!l.is(f.opacity,"undefined")&&l.is(b.opacity,"undefined")&&u(d,{opacity:f.opacity});!l.is(f["fill-opacity"],
-"undefined")&&l.is(b["fill-opacity"],"undefined")&&u(d,{"fill-opacity":f["fill-opacity"]})}m[z]("o")&&u(d,{"fill-opacity":m.o>1?m.o/100:m.o});case "stroke":m=l.getRGB(j);d[W](i,m.hex);i=="stroke"&&m[z]("o")&&u(d,{"stroke-opacity":m.o>1?m.o/100:m.o});break;case "gradient":(({circle:1,ellipse:1})[z](a.type)||D(j).charAt()!="r")&&pa(d,j,a.paper);break;case "opacity":case "fill-opacity":if(f.gradient){if(m=C.getElementById(d.getAttribute(ca)[I](/^url\(#|\)$/g,A))){m=m.getElementsByTagName("stop");m[m[o]-
-1][W]("stop-opacity",j)}break}default:i=="font-size"&&(j=ha(j,10)+"px");m=i[I](/(\-.)/g,function(k){return sa.call(k.substring(1))});d.style[m]=j;d[W](i,j);break}}Db(a,b);if(h)a.rotate(h.join(N));else y(e)&&a.rotate(e,true)},eb=1.2,Db=function(a,b){if(!(a.type!="text"||!(b[z]("text")||b[z]("font")||b[z]("font-size")||b[z]("x")||b[z]("y")))){var c=a.attrs,d=a.node,f=d.firstChild?ha(C.defaultView.getComputedStyle(d.firstChild,A).getPropertyValue("font-size"),10):10;if(b[z]("text")){for(c.text=b.text;d.firstChild;)d.removeChild(d.firstChild);
-b=D(b.text)[G]("\n");for(var e=0,g=b[o];e<g;e++)if(b[e]){var h=u("tspan");e&&u(h,{dy:f*eb,x:c.x});h[x](C.createTextNode(b[e]));d[x](h)}}else{b=d.getElementsByTagName("tspan");e=0;for(g=b[o];e<g;e++)e&&u(b[e],{dy:f*eb,x:c.x})}u(d,{y:c.y});a=a.getBBox();(a=c.y-(a.y+a.height/2))&&isFinite(a)&&u(d,{y:c.y+a})}},s=function(a,b){this[0]=a;this.id=l._oid++;this.node=a;a.raphael=this;this.paper=b;this.attrs=this.attrs||{};this.transformations=[];this._={tx:0,ty:0,rt:{deg:0,cx:0,cy:0},sx:1,sy:1};!b.bottom&&
-(b.bottom=this);(this.prev=b.top)&&(b.top.next=this);b.top=this;this.next=null};s[p].rotate=function(a,b,c){if(this.removed)return this;if(a==null){if(this._.rt.cx)return[this._.rt.deg,this._.rt.cx,this._.rt.cy][R](N);return this._.rt.deg}var d=this.getBBox();a=D(a)[G](V);if(a[o]-1){b=y(a[1]);c=y(a[2])}a=y(a[0]);if(b!=null)this._.rt.deg=a;else this._.rt.deg+=a;c==null&&(b=null);this._.rt.cx=b;this._.rt.cy=c;b=b==null?d.x+d.width/2:b;c=c==null?d.y+d.height/2:c;if(this._.rt.deg){this.transformations[0]=
-l.format("rotate({0} {1} {2})",this._.rt.deg,b,c);this.clip&&u(this.clip,{transform:l.format("rotate({0} {1} {2})",-this._.rt.deg,b,c)})}else{this.transformations[0]=A;this.clip&&u(this.clip,{transform:A})}u(this.node,{transform:this.transformations[R](N)});return this};s[p].hide=function(){!this.removed&&(this.node.style.display="none");return this};s[p].show=function(){!this.removed&&(this.node.style.display="");return this};s[p].remove=function(){if(!this.removed){ma(this,this.paper);this.node.parentNode.removeChild(this.node);
-for(var a in this)delete this[a];this.removed=true}};s[p].getBBox=function(){if(this.removed)return this;if(this.type=="path")return xa(this.attrs.path);if(this.node.style.display=="none"){this.show();var a=true}var b={};try{b=this.node.getBBox()}catch(c){}finally{b=b||{}}if(this.type=="text"){b={x:b.x,y:Infinity,width:0,height:0};for(var d=0,f=this.node.getNumberOfChars();d<f;d++){var e=this.node.getExtentOfChar(d);e.y<b.y&&(b.y=e.y);e.y+e.height-b.y>b.height&&(b.height=e.y+e.height-b.y);e.x+e.width-
-b.x>b.width&&(b.width=e.x+e.width-b.x)}}a&&this.hide();return b};s[p].attr=function(a,b){if(this.removed)return this;if(a==null){a={};for(var c in this.attrs)if(this.attrs[z](c))a[c]=this.attrs[c];this._.rt.deg&&(a.rotation=this.rotate());(this._.sx!=1||this._.sy!=1)&&(a.scale=this.scale());a.gradient&&a.fill=="none"&&(a.fill=a.gradient)&&delete a.gradient;return a}if(b==null&&l.is(a,ga)){if(a=="translation")return Aa.call(this);if(a=="rotation")return this.rotate();if(a=="scale")return this.scale();
-if(a==ca&&this.attrs.fill=="none"&&this.attrs.gradient)return this.attrs.gradient;return this.attrs[a]}if(b==null&&l.is(a,U)){b={};c=0;for(var d=a.length;c<d;c++)b[a[c]]=this.attr(a[c]);return b}if(b!=null){c={};c[a]=b;ea(this,c)}else a!=null&&l.is(a,"object")&&ea(this,a);return this};s[p].toFront=function(){if(this.removed)return this;this.node.parentNode[x](this.node);var a=this.paper;a.top!=this&&Ya(this,a);return this};s[p].toBack=function(){if(this.removed)return this;if(this.node.parentNode.firstChild!=
-this.node){this.node.parentNode.insertBefore(this.node,this.node.parentNode.firstChild);Za(this,this.paper)}return this};s[p].insertAfter=function(a){if(this.removed)return this;var b=a.node||a[a.length].node;b.nextSibling?b.parentNode.insertBefore(this.node,b.nextSibling):b.parentNode[x](this.node);$a(this,a,this.paper);return this};s[p].insertBefore=function(a){if(this.removed)return this;var b=a.node||a[0].node;b.parentNode.insertBefore(this.node,b);ab(this,a,this.paper);return this};s[p].blur=
-function(a){var b=this;if(+a!==0){var c=u("filter"),d=u("feGaussianBlur");b.attrs.blur=a;c.id="r"+(l._id++)[O](36);u(d,{stdDeviation:+a||1.5});c.appendChild(d);b.paper.defs.appendChild(c);b._blur=c;u(b.node,{filter:"url(#"+c.id+")"})}else{if(b._blur){b._blur.parentNode.removeChild(b._blur);delete b._blur;delete b.attrs.blur}b.node.removeAttribute("filter")}};var fb=function(a,b,c,d){var f=u("circle");a.canvas&&a.canvas[x](f);a=new s(f,a);a.attrs={cx:b,cy:c,r:d,fill:"none",stroke:"#000"};a.type="circle";
-u(f,a.attrs);return a},gb=function(a,b,c,d,f,e){var g=u("rect");a.canvas&&a.canvas[x](g);a=new s(g,a);a.attrs={x:b,y:c,width:d,height:f,r:e||0,rx:e||0,ry:e||0,fill:"none",stroke:"#000"};a.type="rect";u(g,a.attrs);return a},hb=function(a,b,c,d,f){var e=u("ellipse");a.canvas&&a.canvas[x](e);a=new s(e,a);a.attrs={cx:b,cy:c,rx:d,ry:f,fill:"none",stroke:"#000"};a.type="ellipse";u(e,a.attrs);return a},ib=function(a,b,c,d,f,e){var g=u("image");u(g,{x:c,y:d,width:f,height:e,preserveAspectRatio:"none"});g.setAttributeNS(a.xlink,
-"href",b);a.canvas&&a.canvas[x](g);a=new s(g,a);a.attrs={x:c,y:d,width:f,height:e,src:b};a.type="image";return a},jb=function(a,b,c,d){var f=u("text");u(f,{x:b,y:c,"text-anchor":"middle"});a.canvas&&a.canvas[x](f);a=new s(f,a);a.attrs={x:b,y:c,"text-anchor":"middle",text:d,font:ta.font,stroke:"none",fill:"#000"};a.type="text";ea(a,a.attrs);return a},kb=function(a,b){this.width=a||this.width;this.height=b||this.height;this.canvas[W]("width",this.width);this.canvas[W]("height",this.height);return this},
-Ca=function(){var a=Xa[K](0,arguments),b=a&&a.container,c=a.x,d=a.y,f=a.width;a=a.height;if(!b)throw new Error("SVG container not found.");var e=u("svg");c=c||0;d=d||0;f=f||512;a=a||342;u(e,{xmlns:"http://www.w3.org/2000/svg",version:1.1,width:f,height:a});if(b==1){e.style.cssText="position:absolute;left:"+c+"px;top:"+d+"px";C.body[x](e)}else b.firstChild?b.insertBefore(e,b.firstChild):b[x](e);b=new H;b.width=f;b.height=a;b.canvas=e;Ia.call(b,b,l.fn);b.clear();return b};H[p].clear=function(){for(var a=
-this.canvas;a.firstChild;)a.removeChild(a.firstChild);this.bottom=this.top=null;(this.desc=u("desc"))[x](C.createTextNode("Created with Rapha\u00ebl"));a[x](this.desc);a[x](this.defs=u("defs"))};H[p].remove=function(){this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas);for(var a in this)this[a]=bb(a)}}if(l.vml){var lb={M:"m",L:"l",C:"c",Z:"x",m:"t",l:"r",c:"v",z:"x"},Eb=/([clmz]),?([^clmz]*)/gi,Fb=/-?[^,\s-]+/g,qa=1000+N+1000,na=10,ra={path:1,rect:1},Gb=function(a){var b=/[ahqstv]/ig,
-c=oa;D(a).match(b)&&(c=wa);b=/[clmz]/g;if(c==oa&&!D(a).match(b))return a=D(a)[I](Eb,function(i,j,m){var n=[],r=fa.call(j)=="m",q=lb[j];m[I](Fb,function(k){if(r&&n[o]==2){q+=n+lb[j=="m"?"l":"L"];n=[]}n[F](Q(k*na))});return q+n});b=c(a);var d;a=[];for(var f=0,e=b[o];f<e;f++){c=b[f];d=fa.call(b[f][0]);d=="z"&&(d="x");for(var g=1,h=c[o];g<h;g++)d+=Q(c[g]*na)+(g!=h-1?",":A);a[F](d)}return a[R](N)};l[O]=function(){return"Your browser doesn\u2019t support SVG. Falling down to VML.\nYou are running Rapha\u00ebl "+
-this.version};db=function(a,b){var c=S("group");c.style.cssText="position:absolute;left:0;top:0;width:"+b.width+"px;height:"+b.height+"px";c.coordsize=b.coordsize;c.coordorigin=b.coordorigin;var d=S("shape"),f=d.style;f.width=b.width+"px";f.height=b.height+"px";d.coordsize=qa;d.coordorigin=b.coordorigin;c[x](d);d=new s(d,c,b);f={fill:"none",stroke:"#000"};a&&(f.path=a);d.isAbsolute=true;d.type="path";d.path=[];d.Path=A;ea(d,f);b.canvas[x](c);return d};ea=function(a,b){a.attrs=a.attrs||{};var c=a.node,
-d=a.attrs,f=c.style,e;e=(b.x!=d.x||b.y!=d.y||b.width!=d.width||b.height!=d.height||b.r!=d.r)&&a.type=="rect";var g=a;for(var h in b)if(b[z](h))d[h]=b[h];if(e){d.path=mb(d.x,d.y,d.width,d.height,d.r);a.X=d.x;a.Y=d.y;a.W=d.width;a.H=d.height}b.href&&(c.href=b.href);b.title&&(c.title=b.title);b.target&&(c.target=b.target);b.cursor&&(f.cursor=b.cursor);"blur"in b&&a.blur(b.blur);if(b.path&&a.type=="path"||e)c.path=Gb(d.path);b.rotation!=null&&a.rotate(b.rotation,true);if(b.translation){e=D(b.translation)[G](V);
-Aa.call(a,e[0],e[1]);if(a._.rt.cx!=null){a._.rt.cx+=+e[0];a._.rt.cy+=+e[1];a.setBox(a.attrs,e[0],e[1])}}if(b.scale){e=D(b.scale)[G](V);a.scale(+e[0]||1,+e[1]||+e[0]||1,+e[2]||null,+e[3]||null)}if("clip-rect"in b){e=D(b["clip-rect"])[G](V);if(e[o]==4){e[2]=+e[2]+ +e[0];e[3]=+e[3]+ +e[1];h=c.clipRect||C.createElement("div");var i=h.style,j=c.parentNode;i.clip=l.format("rect({1}px {2}px {3}px {0}px)",e);if(!c.clipRect){i.position="absolute";i.top=0;i.left=0;i.width=a.paper.width+"px";i.height=a.paper.height+
-"px";j.parentNode.insertBefore(h,j);h[x](j);c.clipRect=h}}if(!b["clip-rect"])c.clipRect&&(c.clipRect.style.clip=A)}if(a.type=="image"&&b.src)c.src=b.src;if(a.type=="image"&&b.opacity){c.filterOpacity=Fa+".Alpha(opacity="+b.opacity*100+")";f.filter=(c.filterMatrix||A)+(c.filterOpacity||A)}b.font&&(f.font=b.font);b["font-family"]&&(f.fontFamily='"'+b["font-family"][G](",")[0][I](/^['"]+|['"]+$/g,A)+'"');b["font-size"]&&(f.fontSize=b["font-size"]);b["font-weight"]&&(f.fontWeight=b["font-weight"]);b["font-style"]&&
-(f.fontStyle=b["font-style"]);if(b.opacity!=null||b["stroke-width"]!=null||b.fill!=null||b.stroke!=null||b["stroke-width"]!=null||b["stroke-opacity"]!=null||b["fill-opacity"]!=null||b["stroke-dasharray"]!=null||b["stroke-miterlimit"]!=null||b["stroke-linejoin"]!=null||b["stroke-linecap"]!=null){c=a.shape||c;f=c.getElementsByTagName(ca)&&c.getElementsByTagName(ca)[0];e=false;!f&&(e=f=S(ca));if("fill-opacity"in b||"opacity"in b){a=((+d["fill-opacity"]+1||2)-1)*((+d.opacity+1||2)-1)*((+l.getRGB(b.fill).o+
-1||2)-1);a<0&&(a=0);a>1&&(a=1);f.opacity=a}b.fill&&(f.on=true);if(f.on==null||b.fill=="none")f.on=false;if(f.on&&b.fill)if(a=b.fill.match(Sa)){f.src=a[1];f.type="tile"}else{f.color=l.getRGB(b.fill).hex;f.src=A;f.type="solid";if(l.getRGB(b.fill).error&&(g.type in{circle:1,ellipse:1}||D(b.fill).charAt()!="r")&&pa(g,b.fill)){d.fill="none";d.gradient=b.fill}}e&&c[x](f);f=c.getElementsByTagName("stroke")&&c.getElementsByTagName("stroke")[0];e=false;!f&&(e=f=S("stroke"));if(b.stroke&&b.stroke!="none"||
-b["stroke-width"]||b["stroke-opacity"]!=null||b["stroke-dasharray"]||b["stroke-miterlimit"]||b["stroke-linejoin"]||b["stroke-linecap"])f.on=true;(b.stroke=="none"||f.on==null||b.stroke==0||b["stroke-width"]==0)&&(f.on=false);a=l.getRGB(b.stroke);f.on&&b.stroke&&(f.color=a.hex);a=((+d["stroke-opacity"]+1||2)-1)*((+d.opacity+1||2)-1)*((+a.o+1||2)-1);h=(y(b["stroke-width"])||1)*0.75;a<0&&(a=0);a>1&&(a=1);b["stroke-width"]==null&&(h=d["stroke-width"]);b["stroke-width"]&&(f.weight=h);h&&h<1&&(a*=h)&&(f.weight=
-1);f.opacity=a;b["stroke-linejoin"]&&(f.joinstyle=b["stroke-linejoin"]||"miter");f.miterlimit=b["stroke-miterlimit"]||8;b["stroke-linecap"]&&(f.endcap=b["stroke-linecap"]=="butt"?"flat":b["stroke-linecap"]=="square"?"square":"round");if(b["stroke-dasharray"]){a={"-":"shortdash",".":"shortdot","-.":"shortdashdot","-..":"shortdashdotdot",". ":"dot","- ":"dash","--":"longdash","- .":"dashdot","--.":"longdashdot","--..":"longdashdotdot"};f.dashstyle=a[z](b["stroke-dasharray"])?a[b["stroke-dasharray"]]:
-A}e&&c[x](f)}if(g.type=="text"){f=g.paper.span.style;d.font&&(f.font=d.font);d["font-family"]&&(f.fontFamily=d["font-family"]);d["font-size"]&&(f.fontSize=d["font-size"]);d["font-weight"]&&(f.fontWeight=d["font-weight"]);d["font-style"]&&(f.fontStyle=d["font-style"]);g.node.string&&(g.paper.span.innerHTML=D(g.node.string)[I](/</g,"&#60;")[I](/&/g,"&#38;")[I](/\n/g,"<br>"));g.W=d.w=g.paper.span.offsetWidth;g.H=d.h=g.paper.span.offsetHeight;g.X=d.x;g.Y=d.y+Q(g.H/2);switch(d["text-anchor"]){case "start":g.node.style["v-text-align"]=
-"left";g.bbx=Q(g.W/2);break;case "end":g.node.style["v-text-align"]="right";g.bbx=-Q(g.W/2);break;default:g.node.style["v-text-align"]="center";break}}};pa=function(a,b){a.attrs=a.attrs||{};var c="linear",d=".5 .5";a.attrs.gradient=b;b=D(b)[I](cb,function(i,j,m){c="radial";if(j&&m){j=y(j);m=y(m);E(j-0.5,2)+E(m-0.5,2)>0.25&&(m=v.sqrt(0.25-E(j-0.5,2))*((m>0.5)*2-1)+0.5);d=j+N+m}return A});b=b[G](/\s*\-\s*/);if(c=="linear"){var f=b.shift();f=-y(f);if(isNaN(f))return null}var e=Wa(b);if(!e)return null;
-a=a.shape||a.node;b=a.getElementsByTagName(ca)[0]||S(ca);!b.parentNode&&a.appendChild(b);if(e[o]){b.on=true;b.method="none";b.color=e[0].color;b.color2=e[e[o]-1].color;a=[];for(var g=0,h=e[o];g<h;g++)e[g].offset&&a[F](e[g].offset+N+e[g].color);b.colors&&(b.colors.value=a[o]?a[R]():"0% "+b.color);if(c=="radial"){b.type="gradientradial";b.focus="100%";b.focussize=d;b.focusposition=d}else{b.type="gradient";b.angle=(270-f)%360}}return 1};s=function(a,b,c){this[0]=a;this.id=l._oid++;this.node=a;a.raphael=
-this;this.Y=this.X=0;this.attrs={};this.Group=b;this.paper=c;this._={tx:0,ty:0,rt:{deg:0},sx:1,sy:1};!c.bottom&&(c.bottom=this);(this.prev=c.top)&&(c.top.next=this);c.top=this;this.next=null};s[p].rotate=function(a,b,c){if(this.removed)return this;if(a==null){if(this._.rt.cx)return[this._.rt.deg,this._.rt.cx,this._.rt.cy][R](N);return this._.rt.deg}a=D(a)[G](V);if(a[o]-1){b=y(a[1]);c=y(a[2])}a=y(a[0]);if(b!=null)this._.rt.deg=a;else this._.rt.deg+=a;c==null&&(b=null);this._.rt.cx=b;this._.rt.cy=c;
-this.setBox(this.attrs,b,c);this.Group.style.rotation=this._.rt.deg;return this};s[p].setBox=function(a,b,c){if(this.removed)return this;var d=this.Group.style,f=this.shape&&this.shape.style||this.node.style;a=a||{};for(var e in a)if(a[z](e))this.attrs[e]=a[e];b=b||this._.rt.cx;c=c||this._.rt.cy;var g=this.attrs,h;switch(this.type){case "circle":a=g.cx-g.r;e=g.cy-g.r;h=g=g.r*2;break;case "ellipse":a=g.cx-g.rx;e=g.cy-g.ry;h=g.rx*2;g=g.ry*2;break;case "image":a=+g.x;e=+g.y;h=g.width||0;g=g.height||
-0;break;case "text":this.textpath.v=["m",Q(g.x),", ",Q(g.y-2),"l",Q(g.x)+1,", ",Q(g.y-2)][R](A);a=g.x-Q(this.W/2);e=g.y-this.H/2;h=this.W;g=this.H;break;case "rect":case "path":if(this.attrs.path){g=xa(this.attrs.path);a=g.x;e=g.y;h=g.width;g=g.height}else{e=a=0;h=this.paper.width;g=this.paper.height}break;default:e=a=0;h=this.paper.width;g=this.paper.height;break}b=b==null?a+h/2:b;c=c==null?e+g/2:c;b=b-this.paper.width/2;c=c-this.paper.height/2;var i;d.left!=(i=b+"px")&&(d.left=i);d.top!=(i=c+"px")&&
-(d.top=i);this.X=ra[z](this.type)?-b:a;this.Y=ra[z](this.type)?-c:e;this.W=h;this.H=g;if(ra[z](this.type)){f.left!=(i=-b*na+"px")&&(f.left=i);f.top!=(i=-c*na+"px")&&(f.top=i)}else if(this.type=="text"){f.left!=(i=-b+"px")&&(f.left=i);f.top!=(i=-c+"px")&&(f.top=i)}else{d.width!=(i=this.paper.width+"px")&&(d.width=i);d.height!=(i=this.paper.height+"px")&&(d.height=i);f.left!=(i=a-b+"px")&&(f.left=i);f.top!=(i=e-c+"px")&&(f.top=i);f.width!=(i=h+"px")&&(f.width=i);f.height!=(i=g+"px")&&(f.height=i)}};
-s[p].hide=function(){!this.removed&&(this.Group.style.display="none");return this};s[p].show=function(){!this.removed&&(this.Group.style.display="block");return this};s[p].getBBox=function(){if(this.removed)return this;if(ra[z](this.type))return xa(this.attrs.path);return{x:this.X+(this.bbx||0),y:this.Y,width:this.W,height:this.H}};s[p].remove=function(){if(!this.removed){ma(this,this.paper);this.node.parentNode.removeChild(this.node);this.Group.parentNode.removeChild(this.Group);this.shape&&this.shape.parentNode.removeChild(this.shape);
-for(var a in this)delete this[a];this.removed=true}};s[p].attr=function(a,b){if(this.removed)return this;if(a==null){a={};for(var c in this.attrs)if(this.attrs[z](c))a[c]=this.attrs[c];this._.rt.deg&&(a.rotation=this.rotate());(this._.sx!=1||this._.sy!=1)&&(a.scale=this.scale());a.gradient&&a.fill=="none"&&(a.fill=a.gradient)&&delete a.gradient;return a}if(b==null&&l.is(a,ga)){if(a=="translation")return Aa.call(this);if(a=="rotation")return this.rotate();if(a=="scale")return this.scale();if(a==ca&&
-this.attrs.fill=="none"&&this.attrs.gradient)return this.attrs.gradient;return this.attrs[a]}if(this.attrs&&b==null&&l.is(a,U)){var d={};c=0;for(b=a[o];c<b;c++)d[a[c]]=this.attr(a[c]);return d}if(b!=null){d={};d[a]=b}b==null&&l.is(a,"object")&&(d=a);if(d){if(d.text&&this.type=="text")this.node.string=d.text;ea(this,d);if(d.gradient&&({circle:1,ellipse:1}[z](this.type)||D(d.gradient).charAt()!="r"))pa(this,d.gradient);(!ra[z](this.type)||this._.rt.deg)&&this.setBox(this.attrs)}return this};s[p].toFront=
-function(){!this.removed&&this.Group.parentNode[x](this.Group);this.paper.top!=this&&Ya(this,this.paper);return this};s[p].toBack=function(){if(this.removed)return this;if(this.Group.parentNode.firstChild!=this.Group){this.Group.parentNode.insertBefore(this.Group,this.Group.parentNode.firstChild);Za(this,this.paper)}return this};s[p].insertAfter=function(a){if(this.removed)return this;if(a.constructor==X)a=a[a.length];a.Group.nextSibling?a.Group.parentNode.insertBefore(this.Group,a.Group.nextSibling):
-a.Group.parentNode[x](this.Group);$a(this,a,this.paper);return this};s[p].insertBefore=function(a){if(this.removed)return this;if(a.constructor==X)a=a[0];a.Group.parentNode.insertBefore(this.Group,a.Group);ab(this,a,this.paper);return this};var Hb=/ progid:\S+Blur\([^\)]+\)/g;s[p].blur=function(a){var b=this.node.runtimeStyle,c=b.filter;c=c.replace(Hb,A);if(+a!==0){this.attrs.blur=a;b.filter=c+N+Fa+".Blur(pixelradius="+(+a||1.5)+")";b.margin=l.format("-{0}px 0 0 -{0}px",Q(+a||1.5))}else{b.filter=
-c;b.margin=0;delete this.attrs.blur}};fb=function(a,b,c,d){var f=S("group"),e=S("oval");f.style.cssText="position:absolute;left:0;top:0;width:"+a.width+"px;height:"+a.height+"px";f.coordsize=qa;f.coordorigin=a.coordorigin;f[x](e);e=new s(e,f,a);e.type="circle";ea(e,{stroke:"#000",fill:"none"});e.attrs.cx=b;e.attrs.cy=c;e.attrs.r=d;e.setBox({x:b-d,y:c-d,width:d*2,height:d*2});a.canvas[x](f);return e};function mb(a,b,c,d,f){return f?l.format("M{0},{1}l{2},0a{3},{3},0,0,1,{3},{3}l0,{5}a{3},{3},0,0,1,{4},{3}l{6},0a{3},{3},0,0,1,{4},{4}l0,{7}a{3},{3},0,0,1,{3},{4}z",
-a+f,b,c-f*2,f,-f,d-f*2,f*2-c,f*2-d):l.format("M{0},{1}l{2},0,0,{3},{4},0z",a,b,c,d,-c)}gb=function(a,b,c,d,f,e){var g=mb(b,c,d,f,e);a=a.path(g);var h=a.attrs;a.X=h.x=b;a.Y=h.y=c;a.W=h.width=d;a.H=h.height=f;h.r=e;h.path=g;a.type="rect";return a};hb=function(a,b,c,d,f){var e=S("group"),g=S("oval");e.style.cssText="position:absolute;left:0;top:0;width:"+a.width+"px;height:"+a.height+"px";e.coordsize=qa;e.coordorigin=a.coordorigin;e[x](g);g=new s(g,e,a);g.type="ellipse";ea(g,{stroke:"#000"});g.attrs.cx=
-b;g.attrs.cy=c;g.attrs.rx=d;g.attrs.ry=f;g.setBox({x:b-d,y:c-f,width:d*2,height:f*2});a.canvas[x](e);return g};ib=function(a,b,c,d,f,e){var g=S("group"),h=S("image");g.style.cssText="position:absolute;left:0;top:0;width:"+a.width+"px;height:"+a.height+"px";g.coordsize=qa;g.coordorigin=a.coordorigin;h.src=b;g[x](h);h=new s(h,g,a);h.type="image";h.attrs.src=b;h.attrs.x=c;h.attrs.y=d;h.attrs.w=f;h.attrs.h=e;h.setBox({x:c,y:d,width:f,height:e});a.canvas[x](g);return h};jb=function(a,b,c,d){var f=S("group"),
-e=S("shape"),g=e.style,h=S("path"),i=S("textpath");f.style.cssText="position:absolute;left:0;top:0;width:"+a.width+"px;height:"+a.height+"px";f.coordsize=qa;f.coordorigin=a.coordorigin;h.v=l.format("m{0},{1}l{2},{1}",Q(b*10),Q(c*10),Q(b*10)+1);h.textpathok=true;g.width=a.width;g.height=a.height;i.string=D(d);i.on=true;e[x](i);e[x](h);f[x](e);g=new s(i,f,a);g.shape=e;g.textpath=h;g.type="text";g.attrs.text=d;g.attrs.x=b;g.attrs.y=c;g.attrs.w=1;g.attrs.h=1;ea(g,{font:ta.font,stroke:"none",fill:"#000"});
-g.setBox();a.canvas[x](f);return g};kb=function(a,b){var c=this.canvas.style;a==+a&&(a+="px");b==+b&&(b+="px");c.width=a;c.height=b;c.clip="rect(0 "+a+" "+b+" 0)";return this};var S;C.createStyleSheet().addRule(".rvml","behavior:url(#default#VML)");try{!C.namespaces.rvml&&C.namespaces.add("rvml","urn:schemas-microsoft-com:vml");S=function(a){return C.createElement("<rvml:"+a+' class="rvml">')}}catch(Pb){S=function(a){return C.createElement("<"+a+' xmlns="urn:schemas-microsoft.com:vml" class="rvml">')}}Ca=
-function(){var a=Xa[K](0,arguments),b=a.container,c=a.height,d=a.width,f=a.x;a=a.y;if(!b)throw new Error("VML container not found.");var e=new H,g=e.canvas=C.createElement("div"),h=g.style;f=f||0;a=a||0;d=d||512;c=c||342;d==+d&&(d+="px");c==+c&&(c+="px");e.width=1000;e.height=1000;e.coordsize=na*1000+N+na*1000;e.coordorigin="0 0";e.span=C.createElement("span");e.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;";g[x](e.span);h.cssText=
-l.format("width:{0};height:{1};display:inline-block;position:relative;clip:rect(0 {0} {1} 0);overflow:hidden",d,c);if(b==1){C.body[x](g);h.left=f+"px";h.top=a+"px";h.position="absolute"}else b.firstChild?b.insertBefore(g,b.firstChild):b[x](g);Ia.call(e,e,l.fn);return e};H[p].clear=function(){this.canvas.innerHTML=A;this.span=C.createElement("span");this.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;";this.canvas[x](this.span);this.bottom=
-this.top=null};H[p].remove=function(){this.canvas.parentNode.removeChild(this.canvas);for(var a in this)this[a]=bb(a);return true}}H[p].safari=navigator.vendor=="Apple Computer, Inc."&&(navigator.userAgent.match(/Version\/(.*?)\s/)[1]<4||aa.navigator.platform.slice(0,2)=="iP")?function(){var a=this.rect(-99,-99,this.width+99,this.height+99).attr({stroke:"none"});aa.setTimeout(function(){a.remove()})}:function(){};function Ib(){this.returnValue=false}function Jb(){return this.originalEvent.preventDefault()}
-function Kb(){this.cancelBubble=true}function Lb(){return this.originalEvent.stopPropagation()}var Mb=function(){if(C.addEventListener)return function(a,b,c,d){var f=Da&&Ea[b]?Ea[b]:b;function e(g){if(Da&&Ea[z](b))for(var h=0,i=g.targetTouches&&g.targetTouches.length;h<i;h++)if(g.targetTouches[h].target==a){i=g;g=g.targetTouches[h];g.originalEvent=i;g.preventDefault=Jb;g.stopPropagation=Lb;break}return c.call(d,g)}a.addEventListener(f,e,false);return function(){a.removeEventListener(f,e,false);return true}};
-else if(C.attachEvent)return function(a,b,c,d){function f(g){g=g||aa.event;g.preventDefault=g.preventDefault||Ib;g.stopPropagation=g.stopPropagation||Kb;return c.call(d,g)}a.attachEvent("on"+b,f);function e(){a.detachEvent("on"+b,f);return true}return e}}(),$=[];function Ka(a){for(var b=a.clientX,c=a.clientY,d,f=$.length;f--;){d=$[f];if(Da)for(var e=a.touches.length,g;e--;){g=a.touches[e];if(g.identifier==d.el._drag.id){b=g.clientX;c=g.clientY;(a.originalEvent?a.originalEvent:a).preventDefault();
-break}}else a.preventDefault();d.move&&d.move.call(d.el,b-d.el._drag.x,c-d.el._drag.y,b,c)}}function La(){l.unmousemove(Ka).unmouseup(La);for(var a=$.length,b;a--;){b=$[a];b.el._drag={};b.end&&b.end.call(b.el)}$=[]}for(da=Ra[o];da--;)(function(a){l[a]=s[p][a]=function(b){if(l.is(b,"function")){this.events=this.events||[];this.events.push({name:a,f:b,unbind:Mb(this.shape||this.node||C,a,b,this)})}return this};l["un"+a]=s[p]["un"+a]=function(b){for(var c=this.events,d=c[o];d--;)if(c[d].name==a&&c[d].f==
-b){c[d].unbind();c.splice(d,1);!c.length&&delete this.events;return this}return this}})(Ra[da]);s[p].hover=function(a,b){return this.mouseover(a).mouseout(b)};s[p].unhover=function(a,b){return this.unmouseover(a).unmouseout(b)};s[p].drag=function(a,b,c){this._drag={};this.mousedown(function(d){(d.originalEvent||d).preventDefault();this._drag.x=d.clientX;this._drag.y=d.clientY;this._drag.id=d.identifier;b&&b.call(this,d.clientX,d.clientY);!$.length&&l.mousemove(Ka).mouseup(La);$.push({el:this,move:a,
-end:c})});return this};s[p].undrag=function(a,b,c){for(b=$.length;b--;){$[b].el==this&&$[b].move==a&&$[b].end==c&&$.splice(b,1);!$.length&&l.unmousemove(Ka).unmouseup(La)}};H[p].circle=function(a,b,c){return fb(this,a||0,b||0,c||0)};H[p].rect=function(a,b,c,d,f){return gb(this,a||0,b||0,c||0,d||0,f||0)};H[p].ellipse=function(a,b,c,d){return hb(this,a||0,b||0,c||0,d||0)};H[p].path=function(a){a&&!l.is(a,ga)&&!l.is(a[0],U)&&(a+=A);return db(l.format[K](l,arguments),this)};H[p].image=function(a,b,c,
-d,f){return ib(this,a||"about:blank",b||0,c||0,d||0,f||0)};H[p].text=function(a,b,c){return jb(this,a||0,b||0,c||A)};H[p].set=function(a){arguments[o]>1&&(a=Array[p].splice.call(arguments,0,arguments[o]));return new X(a)};H[p].setSize=kb;H[p].top=H[p].bottom=null;H[p].raphael=l;function nb(){return this.x+N+this.y}s[p].resetScale=function(){if(this.removed)return this;this._.sx=1;this._.sy=1;this.attrs.scale="1 1"};s[p].scale=function(a,b,c,d){if(this.removed)return this;if(a==null&&b==null)return{x:this._.sx,
-y:this._.sy,toString:nb};b=b||a;!+b&&(b=a);var f,e,g=this.attrs;if(a!=0){var h=this.getBBox(),i=h.x+h.width/2,j=h.y+h.height/2;f=a/this._.sx;e=b/this._.sy;c=+c||c==0?c:i;d=+d||d==0?d:j;h=~~(a/v.abs(a));var m=~~(b/v.abs(b)),n=this.node.style,r=c+(i-c)*f;j=d+(j-d)*e;switch(this.type){case "rect":case "image":var q=g.width*h*f,k=g.height*m*e;this.attr({height:k,r:g.r*ba(h*f,m*e),width:q,x:r-q/2,y:j-k/2});break;case "circle":case "ellipse":this.attr({rx:g.rx*h*f,ry:g.ry*m*e,r:g.r*ba(h*f,m*e),cx:r,cy:j});
-break;case "text":this.attr({x:r,y:j});break;case "path":i=Ha(g.path);for(var t=true,L=0,B=i[o];L<B;L++){var w=i[L],J=sa.call(w[0]);if(!(J=="M"&&t)){t=false;if(J=="A"){w[i[L][o]-2]*=f;w[i[L][o]-1]*=e;w[1]*=h*f;w[2]*=m*e;w[5]=+!(h+m?!+w[5]:+w[5])}else if(J=="H"){J=1;for(var ia=w[o];J<ia;J++)w[J]*=f}else if(J=="V"){J=1;for(ia=w[o];J<ia;J++)w[J]*=e}else{J=1;for(ia=w[o];J<ia;J++)w[J]*=J%2?f:e}}}e=xa(i);f=r-e.x-e.width/2;e=j-e.y-e.height/2;i[0][1]+=f;i[0][2]+=e;this.attr({path:i});break}if(this.type in
-{text:1,image:1}&&(h!=1||m!=1))if(this.transformations){this.transformations[2]="scale("[M](h,",",m,")");this.node[W]("transform",this.transformations[R](N));f=h==-1?-g.x-(q||0):g.x;e=m==-1?-g.y-(k||0):g.y;this.attr({x:f,y:e});g.fx=h-1;g.fy=m-1}else{this.node.filterMatrix=Fa+".Matrix(M11="[M](h,", M12=0, M21=0, M22=",m,", Dx=0, Dy=0, sizingmethod='auto expand', filtertype='bilinear')");n.filter=(this.node.filterMatrix||A)+(this.node.filterOpacity||A)}else if(this.transformations){this.transformations[2]=
-A;this.node[W]("transform",this.transformations[R](N));g.fx=0;g.fy=0}else{this.node.filterMatrix=A;n.filter=(this.node.filterMatrix||A)+(this.node.filterOpacity||A)}g.scale=[a,b,c,d][R](N);this._.sx=a;this._.sy=b}return this};s[p].clone=function(){if(this.removed)return null;var a=this.attr();delete a.scale;delete a.translation;return this.paper[this.type]().attr(a)};var ob=Z(function(a,b,c,d,f,e,g,h,i){for(var j=0,m,n=0;n<1.01;n+=0.01){var r=la(a,b,c,d,f,e,g,h,n);n&&(j+=E(E(m.x-r.x,2)+E(m.y-r.y,
-2),0.5));if(j>=i)return r;m=r}});function Ma(a,b){return function(c,d,f){c=wa(c);for(var e,g,h,i,j="",m={},n=0,r=0,q=c.length;r<q;r++){h=c[r];if(h[0]=="M"){e=+h[1];g=+h[2]}else{i=Nb(e,g,h[1],h[2],h[3],h[4],h[5],h[6]);if(n+i>d){if(b&&!m.start){e=ob(e,g,h[1],h[2],h[3],h[4],h[5],h[6],d-n);j+=["C",e.start.x,e.start.y,e.m.x,e.m.y,e.x,e.y];if(f)return j;m.start=j;j=["M",e.x,e.y+"C",e.n.x,e.n.y,e.end.x,e.end.y,h[5],h[6]][R]();n+=i;e=+h[5];g=+h[6];continue}if(!a&&!b){e=ob(e,g,h[1],h[2],h[3],h[4],h[5],h[6],
-d-n);return{x:e.x,y:e.y,alpha:e.alpha}}}n+=i;e=+h[5];g=+h[6]}j+=h}m.end=j;e=a?n:b?m:l.findDotsAtSegment(e,g,h[1],h[2],h[3],h[4],h[5],h[6],1);e.alpha&&(e={x:e.x,y:e.y,alpha:e.alpha});return e}}var Nb=Z(function(a,b,c,d,f,e,g,h){for(var i={x:0,y:0},j=0,m=0;m<1.01;m+=0.01){var n=la(a,b,c,d,f,e,g,h,m);m&&(j+=E(E(i.x-n.x,2)+E(i.y-n.y,2),0.5));i=n}return j}),pb=Ma(1),Ba=Ma(),Na=Ma(0,1);s[p].getTotalLength=function(){if(this.type=="path"){if(this.node.getTotalLength)return this.node.getTotalLength();return pb(this.attrs.path)}};
-s[p].getPointAtLength=function(a){if(this.type=="path"){if(this.node.getPointAtLength)return this.node.getPointAtLength(a);return Ba(this.attrs.path,a)}};s[p].getSubpath=function(a,b){if(this.type=="path"){if(v.abs(this.getTotalLength()-b)<1.0E-6)return Na(this.attrs.path,a).end;b=Na(this.attrs.path,b,1);return a?Na(b,a).end:b}};l.easing_formulas={linear:function(a){return a},"<":function(a){return E(a,3)},">":function(a){return E(a-1,3)+1},"<>":function(a){a*=2;if(a<1)return E(a,3)/2;a-=2;return(E(a,
-3)+2)/2},backIn:function(a){var b=1.70158;return a*a*((b+1)*a-b)},backOut:function(a){a-=1;var b=1.70158;return a*a*((b+1)*a+b)+1},elastic:function(a){if(a==0||a==1)return a;var b=0.3,c=b/4;return E(2,-10*a)*v.sin((a-c)*2*v.PI/b)+1},bounce:function(a){var b=7.5625,c=2.75;if(a<1/c)a=b*a*a;else if(a<2/c){a-=1.5/c;a=b*a*a+0.75}else if(a<2.5/c){a-=2.25/c;a=b*a*a+0.9375}else{a-=2.625/c;a=b*a*a+0.984375}return a}};var T={length:0};function qb(){var a=+new Date;for(var b in T)if(b!="length"&&T[z](b)){var c=
-T[b];if(c.stop||c.el.removed){delete T[b];T[o]--}else{var d=a-c.start,f=c.ms,e=c.easing,g=c.from,h=c.diff,i=c.to,j=c.t,m=c.prev||0,n=c.el,r=c.callback,q={},k;if(d<f){r=l.easing_formulas[e]?l.easing_formulas[e](d/f):d/f;for(var t in g)if(g[z](t)){switch(Ga[t]){case "along":k=r*f*h[t];i.back&&(k=i.len-k);e=Ba(i[t],k);n.translate(h.sx-h.x||0,h.sy-h.y||0);h.x=e.x;h.y=e.y;n.translate(e.x-h.sx,e.y-h.sy);i.rot&&n.rotate(h.r+e.alpha,e.x,e.y);break;case P:k=+g[t]+r*f*h[t];break;case "colour":k="rgb("+[Oa(Q(g[t].r+
-r*f*h[t].r)),Oa(Q(g[t].g+r*f*h[t].g)),Oa(Q(g[t].b+r*f*h[t].b))][R](",")+")";break;case "path":k=[];e=0;for(var L=g[t][o];e<L;e++){k[e]=[g[t][e][0]];for(var B=1,w=g[t][e][o];B<w;B++)k[e][B]=+g[t][e][B]+r*f*h[t][e][B];k[e]=k[e][R](N)}k=k[R](N);break;case "csv":switch(t){case "translation":k=h[t][0]*(d-m);e=h[t][1]*(d-m);j.x+=k;j.y+=e;k=k+N+e;break;case "rotation":k=+g[t][0]+r*f*h[t][0];g[t][1]&&(k+=","+g[t][1]+","+g[t][2]);break;case "scale":k=[+g[t][0]+r*f*h[t][0],+g[t][1]+r*f*h[t][1],2 in i[t]?i[t][2]:
-A,3 in i[t]?i[t][3]:A][R](N);break;case "clip-rect":k=[];for(e=4;e--;)k[e]=+g[t][e]+r*f*h[t][e];break}break}q[t]=k}n.attr(q);n._run&&n._run.call(n)}else{if(i.along){e=Ba(i.along,i.len*!i.back);n.translate(h.sx-(h.x||0)+e.x-h.sx,h.sy-(h.y||0)+e.y-h.sy);i.rot&&n.rotate(h.r+e.alpha,e.x,e.y)}(j.x||j.y)&&n.translate(-j.x,-j.y);i.scale&&(i.scale+=A);n.attr(i);delete T[b];T[o]--;n.in_animation=null;l.is(r,"function")&&r.call(n)}c.prev=d}}l.svg&&n&&n.paper&&n.paper.safari();T[o]&&aa.setTimeout(qb)}function Oa(a){return Y(ba(a,
-255),0)}function Aa(a,b){if(a==null)return{x:this._.tx,y:this._.ty,toString:nb};this._.tx+=+a;this._.ty+=+b;switch(this.type){case "circle":case "ellipse":this.attr({cx:+a+this.attrs.cx,cy:+b+this.attrs.cy});break;case "rect":case "image":case "text":this.attr({x:+a+this.attrs.x,y:+b+this.attrs.y});break;case "path":var c=Ha(this.attrs.path);c[0][1]+=+a;c[0][2]+=+b;this.attr({path:c});break}return this}s[p].animateWith=function(a,b,c,d,f){T[a.id]&&(b.start=T[a.id].start);return this.animate(b,c,d,
-f)};s[p].animateAlong=rb();s[p].animateAlongBack=rb(1);function rb(a){return function(b,c,d,f){var e={back:a};l.is(d,"function")?(f=d):(e.rot=d);b&&b.constructor==s&&(b=b.attrs.path);b&&(e.along=b);return this.animate(e,c,f)}}s[p].onAnimation=function(a){this._run=a||0;return this};s[p].animate=function(a,b,c,d){if(l.is(c,"function")||!c)d=c||null;var f={},e={},g={};for(var h in a)if(a[z](h))if(Ga[z](h)){f[h]=this.attr(h);f[h]==null&&(f[h]=ta[h]);e[h]=a[h];switch(Ga[h]){case "along":var i=pb(a[h]),
-j=Ba(a[h],i*!!a.back),m=this.getBBox();g[h]=i/b;g.tx=m.x;g.ty=m.y;g.sx=j.x;g.sy=j.y;e.rot=a.rot;e.back=a.back;e.len=i;a.rot&&(g.r=y(this.rotate())||0);break;case P:g[h]=(e[h]-f[h])/b;break;case "colour":f[h]=l.getRGB(f[h]);i=l.getRGB(e[h]);g[h]={r:(i.r-f[h].r)/b,g:(i.g-f[h].g)/b,b:(i.b-f[h].b)/b};break;case "path":i=wa(f[h],e[h]);f[h]=i[0];j=i[1];g[h]=[];i=0;for(m=f[h][o];i<m;i++){g[h][i]=[0];for(var n=1,r=f[h][i][o];n<r;n++)g[h][i][n]=(j[i][n]-f[h][i][n])/b}break;case "csv":j=D(a[h])[G](V);i=D(f[h])[G](V);
-switch(h){case "translation":f[h]=[0,0];g[h]=[j[0]/b,j[1]/b];break;case "rotation":f[h]=i[1]==j[1]&&i[2]==j[2]?i:[0,j[1],j[2]];g[h]=[(j[0]-f[h][0])/b,0,0];break;case "scale":a[h]=j;f[h]=D(f[h])[G](V);g[h]=[(j[0]-f[h][0])/b,(j[1]-f[h][1])/b,0,0];break;case "clip-rect":f[h]=D(f[h])[G](V);g[h]=[];for(i=4;i--;)g[h][i]=(j[i]-f[h][i])/b;break}e[h]=j}}this.stop();this.in_animation=1;T[this.id]={start:a.start||+new Date,ms:b,easing:c,from:f,diff:g,to:e,el:this,callback:d,t:{x:0,y:0}};++T[o]==1&&qb();return this};
-s[p].stop=function(){T[this.id]&&T[o]--;delete T[this.id];return this};s[p].translate=function(a,b){return this.attr({translation:a+" "+b})};s[p][O]=function(){return"Rapha\u00ebl\u2019s object"};l.ae=T;function X(a){this.items=[];this[o]=0;this.type="set";if(a)for(var b=0,c=a[o];b<c;b++)if(a[b]&&(a[b].constructor==s||a[b].constructor==X)){this[this.items[o]]=this.items[this.items[o]]=a[b];this[o]++}}X[p][F]=function(){for(var a,b,c=0,d=arguments[o];c<d;c++)if((a=arguments[c])&&(a.constructor==s||
-a.constructor==X)){b=this.items[o];this[b]=this.items[b]=a;this[o]++}return this};X[p].pop=function(){delete this[this[o]--];return this.items.pop()};for(var Pa in s[p])if(s[p][z](Pa))X[p][Pa]=function(a){return function(){for(var b=0,c=this.items[o];b<c;b++)this.items[b][a][K](this.items[b],arguments);return this}}(Pa);X[p].attr=function(a,b){if(a&&l.is(a,U)&&l.is(a[0],"object")){b=0;for(var c=a[o];b<c;b++)this.items[b].attr(a[b])}else{c=0;for(var d=this.items[o];c<d;c++)this.items[c].attr(a,b)}return this};
-X[p].animate=function(a,b,c,d){(l.is(c,"function")||!c)&&(d=c||null);var f=this.items[o],e=f,g,h=this,i;d&&(i=function(){!--f&&d.call(h)});c=l.is(c,ga)?c:i;for(g=this.items[--e].animate(a,b,c,i);e--;)this.items[e].animateWith(g,a,b,c,i);return this};X[p].insertAfter=function(a){for(var b=this.items[o];b--;)this.items[b].insertAfter(a);return this};X[p].getBBox=function(){for(var a=[],b=[],c=[],d=[],f=this.items[o];f--;){var e=this.items[f].getBBox();a[F](e.x);b[F](e.y);c[F](e.x+e.width);d[F](e.y+
-e.height)}a=ba[K](0,a);b=ba[K](0,b);return{x:a,y:b,width:Y[K](0,c)-a,height:Y[K](0,d)-b}};X[p].clone=function(a){a=new X;for(var b=0,c=this.items[o];b<c;b++)a[F](this.items[b].clone());return a};l.registerFont=function(a){if(!a.face)return a;this.fonts=this.fonts||{};var b={w:a.w,face:{},glyphs:{}},c=a.face["font-family"];for(var d in a.face)if(a.face[z](d))b.face[d]=a.face[d];if(this.fonts[c])this.fonts[c][F](b);else this.fonts[c]=[b];if(!a.svg){b.face["units-per-em"]=ha(a.face["units-per-em"],10);
-for(var f in a.glyphs)if(a.glyphs[z](f)){c=a.glyphs[f];b.glyphs[f]={w:c.w,k:{},d:c.d&&"M"+c.d[I](/[mlcxtrv]/g,function(g){return{l:"L",c:"C",x:"z",t:"m",r:"l",v:"c"}[g]||"M"})+"z"};if(c.k)for(var e in c.k)if(c[z](e))b.glyphs[f].k[e]=c.k[e]}}return a};H[p].getFont=function(a,b,c,d){d=d||"normal";c=c||"normal";b=+b||{normal:400,bold:700,lighter:300,bolder:800}[b]||400;if(l.fonts){var f=l.fonts[a];if(!f){a=new RegExp("(^|\\s)"+a[I](/[^\w\d\s+!~.:_-]/g,A)+"(\\s|$)","i");for(var e in l.fonts)if(l.fonts[z](e))if(a.test(e)){f=
-l.fonts[e];break}}var g;if(f){e=0;for(a=f[o];e<a;e++){g=f[e];if(g.face["font-weight"]==b&&(g.face["font-style"]==c||!g.face["font-style"])&&g.face["font-stretch"]==d)break}}return g}};H[p].print=function(a,b,c,d,f,e){e=e||"middle";var g=this.set(),h=D(c)[G](A),i=0;l.is(d,c)&&(d=this.getFont(d));if(d){c=(f||16)/d.face["units-per-em"];var j=d.face.bbox.split(V);f=+j[0];e=+j[1]+(e=="baseline"?j[3]-j[1]+ +d.face.descent:(j[3]-j[1])/2);j=0;for(var m=h[o];j<m;j++){var n=j&&d.glyphs[h[j-1]]||{},r=d.glyphs[h[j]];
-i+=j?(n.w||d.w)+(n.k&&n.k[h[j]]||0):0;r&&r.d&&g[F](this.path(r.d).attr({fill:"#000",stroke:"none",translation:[i,0]}))}g.scale(c,c,f,e).translate(a-f,b-e)}return g};var Ob=/\{(\d+)\}/g;l.format=function(a,b){var c=l.is(b,U)?[0][M](b):arguments;a&&l.is(a,ga)&&c[o]-1&&(a=a[I](Ob,function(d,f){return c[++f]==null?A:c[f]}));return a||A};l.ninja=function(){Qa.was?(Raphael=Qa.is):delete Raphael;return l};l.el=s[p];return l}();
+(function(){function aG(){if(aG.is(arguments[0],a4)){var b=arguments[0],d=D[bz](aG,b.splice(0,3+aG.is(b[0],aD))),R=d.set();for(var E=0,S=b[r];E<S;E++){var e=b[E]||{};bm[af](e.type)&&R[j](d[e.type]().attr(e))}return R}return D[bz](aG,arguments)}aG.version="1.5.0";var a=/[, ]+/,bm={circle:1,rect:1,path:1,ellipse:1,text:1,image:1},bk=/\{(\d+)\}/g,bC="prototype",af="hasOwnProperty",Z=document,aN=window,q={was:Object[bC][af].call(aN,"Raphael"),is:aN.Raphael},bw=function(){this.customAttributes={}},aW,bh="appendChild",bz="apply",bt="concat",V="createTouch" in Z,aM="",aF=" ",bA=String,H="split",P="click dblclick mousedown mousemove mouseout mouseover mouseup touchstart touchmove touchend orientationchange touchcancel gesturestart gesturechange gestureend"[H](aF),bn={mousedown:"touchstart",mousemove:"touchmove",mouseup:"touchend"},aT="join",r="length",bE=bA[bC].toLowerCase,an=Math,l=an.max,bf=an.min,bi=an.pow,aD="number",ae="string",a4="array",aX="toString",a1="fill",aQ=Object[bC][aX],bq={},j="push",bx=/^(?=[\da-f]$)/,h=/^url\(['"]?([^\)]+?)['"]?\)$/i,F=/^\s*((#[a-f\d]{6})|(#[a-f\d]{3})|rgba?\(\s*([\d\.]+\s*,\s*[\d\.]+\s*,\s*[\d\.]+(?:\s*,\s*[\d\.]+)?)\s*\)|rgba?\(\s*([\d\.]+%\s*,\s*[\d\.]+%\s*,\s*[\d\.]+%(?:\s*,\s*[\d\.]+%)?)\s*\)|hsb\(\s*([\d\.]+(?:deg|\xb0)?\s*,\s*[\d\.]+\s*,\s*[\d\.]+)\s*\)|hsb\(\s*([\d\.]+(?:deg|\xb0|%)\s*,\s*[\d\.]+%\s*,\s*[\d\.]+%)\s*\)|hsl\(\s*([\d\.]+(?:deg|\xb0)?\s*,\s*[\d\.]+\s*,\s*[\d\.]+)\s*\)|hsl\(\s*([\d\.]+(?:deg|\xb0|%)\s*,\s*[\d\.]+%\s*,\s*[\d\.]+%)\s*\))\s*$/i,ao=/^(NaN|-?Infinity)$/,c=/^cubic-bezier\(([^,]+),([^,]+),([^,]+),([^\)]+)\)/,ac=an.round,C="setAttribute",ai=parseFloat,Q=parseInt,a2=" progid:DXImageTransform.Microsoft",bl=bA[bC].toUpperCase,p={blur:0,"clip-rect":"0 0 1e9 1e9",cursor:"default",cx:0,cy:0,fill:"#fff","fill-opacity":1,font:'10px "Arial"',"font-family":'"Arial"',"font-size":"10","font-style":"normal","font-weight":400,gradient:0,height:0,href:"http://raphaeljs.com/",opacity:1,path:"M0,0",r:0,rotation:0,rx:0,ry:0,scale:"1 1",src:"",stroke:"#000","stroke-dasharray":"","stroke-linecap":"butt","stroke-linejoin":"butt","stroke-miterlimit":0,"stroke-opacity":1,"stroke-width":1,target:"_blank","text-anchor":"middle",title:"Raphael",translation:"0 0",width:0,x:0,y:0},al={along:"along",blur:aD,"clip-rect":"csv",cx:aD,cy:aD,fill:"colour","fill-opacity":aD,"font-size":aD,height:aD,opacity:aD,path:"path",r:aD,rotation:"csv",rx:aD,ry:aD,scale:"csv",stroke:"colour","stroke-opacity":aD,"stroke-width":aD,translation:"csv",width:aD,x:aD,y:aD},bp="replace",a7=/,?([achlmqrstvxz]),?/gi,ba=/\s*,\s*/,m={hs:1,rg:1},bc=/^(from|to|\d+%)$/,aO=/([achlmqstvz])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?\s*,?\s*)+)/ig,aE=/(-?\d*\.?\d*(?:e[-+]?\d+)?)\s*,?\s*/ig,bj=function(e,d){return e.key-d.key};aG.type=(aN.SVGAngle||Z.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")?"SVG":"VML");if(aG.type=="VML"){var av=Z.createElement("div"),az;av.innerHTML='<v:shape adj="1"/>';az=av.firstChild;az.style.behavior="url(#default#VML)";if(!(az&&typeof az.adj=="object")){return aG.type=null}av=null}aG.svg=!(aG.vml=aG.type=="VML");bw[bC]=aG[bC];aW=bw[bC];aG._id=0;aG._oid=0;aG.fn={};aG.is=function(d,b){b=bE.call(b);if(b=="finite"){return !ao.test(+d)}return(b=="null"&&d===null)||(b==typeof d)||(b=="object"&&d===Object(d))||(b=="array"&&Array.isArray&&Array.isArray(d))||aQ.call(d).slice(8,-1).toLowerCase()==b};aG.angle=function(E,S,e,R,d,i){if(d==null){var b=E-e,bF=S-R;if(!b&&!bF){return 0}return((b<0)*180+an.atan(-bF/-b)*180/an.PI+360)%360}else{return aG.angle(E,S,d,i)-aG.angle(e,R,d,i)}};aG.snapTo=function(d,E,b){b=b||10;d=[][bt](d);var e=d.length;while(e--){if(an.abs(d[e]-E)<=b){return d[e]}}return E};aG.setWindow=function(b){aN=b;Z=aN.document};var a6=function(E){if(aG.vml){var b=/^\s+|\s+$/g;var S;try{var bF=new ActiveXObject("htmlfile");bF.write("<body>");bF.close();S=bF.body}catch(bG){S=createPopup().document.body}var d=S.createTextRange();a6=ay(function(i){try{S.style.color=bA(i)[bp](b,aM);var bH=d.queryCommandValue("ForeColor");bH=((bH&255)<<16)|(bH&65280)|((bH&16711680)>>>16);return"#"+("000000"+bH[aX](16)).slice(-6)}catch(bI){return"none"}})}else{var R=Z.createElement("i");R.title="Rapha\xebl Colour Picker";R.style.display="none";Z.body[bh](R);a6=ay(function(e){R.style.color=e;return Z.defaultView.getComputedStyle(R,aM).getPropertyValue("color")})}return a6(E)},aA=function(){return"hsb("+[this.h,this.s,this.b]+")"},L=function(){return"hsl("+[this.h,this.s,this.l]+")"},A=function(){return this.hex};aG.hsb2rgb=function(i,e,d){if(aG.is(i,"object")&&"h" in i&&"s" in i&&"b" in i){d=i.b;e=i.s;i=i.h}return aG.hsl2rgb(i,e,d/2)};aG.hsl2rgb=function(S,bM,e){if(aG.is(S,"object")&&"h" in S&&"s" in S&&"l" in S){e=S.l;bM=S.s;S=S.h}if(S>1||bM>1||e>1){S/=360;bM/=100;e/=100}var bJ={},bG=["r","g","b"],bF,bI,R,d,bH,bK;if(!bM){bJ={r:e,g:e,b:e}}else{if(e<0.5){bF=e*(1+bM)}else{bF=e+bM-e*bM}bI=2*e-bF;for(var E=0,bL=bG.length;E<bL;E++){R=S+1/3*-(E-1);R<0&&R++;R>1&&R--;if(R*6<1){bJ[bG[E]]=bI+(bF-bI)*6*R}else{if(R*2<1){bJ[bG[E]]=bF}else{if(R*3<2){bJ[bG[E]]=bI+(bF-bI)*(2/3-R)*6}else{bJ[bG[E]]=bI}}}}}bJ.r*=255;bJ.g*=255;bJ.b*=255;d=(~~bJ.r)[aX](16);bH=(~~bJ.g)[aX](16);bK=(~~bJ.b)[aX](16);d=d[bp](bx,"0");bH=bH[bp](bx,"0");bK=bK[bp](bx,"0");bJ.hex="#"+d+bH+bK;bJ.toString=A;return bJ};aG.rgb2hsb=function(b,d,bF){if(d==null&&aG.is(b,"object")&&"r" in b&&"g" in b&&"b" in b){bF=b.b;d=b.g;b=b.r}if(d==null&&aG.is(b,ae)){var bH=aG.getRGB(b);b=bH.r;d=bH.g;bF=bH.b}if(b>1||d>1||bF>1){b/=255;d/=255;bF/=255}var S=l(b,d,bF),e=bf(b,d,bF),E,i,R=S;if(e==S){return{h:0,s:0,b:S,toString:aA}}else{var bG=(S-e);i=bG/S;if(b==S){E=(d-bF)/bG}else{if(d==S){E=2+((bF-b)/bG)}else{E=4+((b-d)/bG)}}E/=6;E<0&&E++;E>1&&E--}return{h:E,s:i,b:R,toString:aA}};aG.rgb2hsl=function(d,e,S){if(e==null&&aG.is(d,"object")&&"r" in d&&"g" in d&&"b" in d){S=d.b;e=d.g;d=d.r}if(e==null&&aG.is(d,ae)){var bI=aG.getRGB(d);d=bI.r;e=bI.g;S=bI.b}if(d>1||e>1||S>1){d/=255;e/=255;S/=255}var R=l(d,e,S),i=bf(d,e,S),E,bH,b=(R+i)/2,bG;if(i==R){bG={h:0,s:0,l:b}}else{var bF=R-i;bH=b<0.5?bF/(R+i):bF/(2-R-i);if(d==R){E=(e-S)/bF}else{if(e==R){E=2+(S-d)/bF}else{E=4+(d-e)/bF}}E/=6;E<0&&E++;E>1&&E--;bG={h:E,s:bH,l:b}}bG.toString=L;return bG};aG._path2string=function(){return this.join(",")[bp](a7,"$1")};function ay(i,d,b){function e(){var E=Array[bC].slice.call(arguments,0),S=E[aT]("\u25ba"),R=e.cache=e.cache||{},bF=e.count=e.count||[];if(R[af](S)){return b?b(R[S]):R[S]}bF[r]>=1000&&delete R[bF.shift()];bF[j](S);R[S]=i[bz](d,E);return b?b(R[S]):R[S]}return e}aG.getRGB=ay(function(e){if(!e||!!((e=bA(e)).indexOf("-")+1)){return{r:-1,g:-1,b:-1,hex:"none",error:1}}if(e=="none"){return{r:-1,g:-1,b:-1,hex:"none"}}!(m[af](e.substring(0,2))||e.charAt()=="#")&&(e=a6(e));var bF,i,E,bI,S,bJ,bG=e.match(F);if(bG){if(bG[2]){bI=Q(bG[2].substring(5),16);E=Q(bG[2].substring(3,5),16);i=Q(bG[2].substring(1,3),16)}if(bG[3]){bI=Q((bJ=bG[3].charAt(3))+bJ,16);E=Q((bJ=bG[3].charAt(2))+bJ,16);i=Q((bJ=bG[3].charAt(1))+bJ,16)}if(bG[4]){bG=bG[4][H](ba);i=ai(bG[0]);E=ai(bG[1]);bI=ai(bG[2]);S=ai(bG[3])}if(bG[5]){bG=bG[5][H](ba);i=ai(bG[0])*2.55;E=ai(bG[1])*2.55;bI=ai(bG[2])*2.55;S=ai(bG[3])}if(bG[6]){bG=bG[6][H](ba);i=ai(bG[0]);E=ai(bG[1]);bI=ai(bG[2]);(bG[0].slice(-3)=="deg"||bG[0].slice(-1)=="\xb0")&&(i/=360);return aG.hsb2rgb(i,E,bI)}if(bG[7]){bG=bG[7][H](ba);i=ai(bG[0])*2.55;E=ai(bG[1])*2.55;bI=ai(bG[2])*2.55;(bG[0].slice(-3)=="deg"||bG[0].slice(-1)=="\xb0")&&(i/=360*2.55);return aG.hsb2rgb(i,E,bI)}if(bG[8]){bG=bG[8][H](ba);i=ai(bG[0]);E=ai(bG[1]);bI=ai(bG[2]);(bG[0].slice(-3)=="deg"||bG[0].slice(-1)=="\xb0")&&(i/=360);return aG.hsl2rgb(i,E,bI)}if(bG[9]){bG=bG[9][H](ba);i=ai(bG[0])*2.55;E=ai(bG[1])*2.55;bI=ai(bG[2])*2.55;(bG[0].slice(-3)=="deg"||bG[0].slice(-1)=="\xb0")&&(i/=360*2.55);return aG.hsl2rgb(i,E,bI)}bG={r:i,g:E,b:bI};var d=(~~i)[aX](16),R=(~~E)[aX](16),bH=(~~bI)[aX](16);d=d[bp](bx,"0");R=R[bp](bx,"0");bH=bH[bp](bx,"0");bG.hex="#"+d+R+bH;isFinite(ai(S))&&(bG.o=S);return bG}return{r:-1,g:-1,b:-1,hex:"none",error:1}},aG);aG.getColor=function(d){var e=this.getColor.start=this.getColor.start||{h:0,s:1,b:d||0.75},b=this.hsb2rgb(e.h,e.s,e.b);e.h+=0.075;if(e.h>1){e.h=0;e.s-=0.2;e.s<=0&&(this.getColor.start={h:0,s:1,b:e.b})}return b.hex};aG.getColor.reset=function(){delete this.start};aG.parsePathString=ay(function(b){if(!b){return null}var e={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},d=[];if(aG.is(b,a4)&&aG.is(b[0],a4)){d=aP(b)}if(!d[r]){bA(b)[bp](aO,function(E,i,bF){var S=[],R=bE.call(i);bF[bp](aE,function(bH,bG){bG&&S[j](+bG)});if(R=="m"&&S[r]>2){d[j]([i][bt](S.splice(0,2)));R="l";i=i=="m"?"l":"L"}while(S[r]>=e[R]){d[j]([i][bt](S.splice(0,e[R])));if(!e[R]){break}}})}d[aX]=aG._path2string;return d});aG.findDotsAtSegment=function(d,b,bS,bQ,S,E,bG,bF,bM){var bK=1-bM,bJ=bi(bK,3)*d+bi(bK,2)*3*bM*bS+bK*3*bM*bM*S+bi(bM,3)*bG,bH=bi(bK,3)*b+bi(bK,2)*3*bM*bQ+bK*3*bM*bM*E+bi(bM,3)*bF,bO=d+2*bM*(bS-d)+bM*bM*(S-2*bS+d),bN=b+2*bM*(bQ-b)+bM*bM*(E-2*bQ+b),bR=bS+2*bM*(S-bS)+bM*bM*(bG-2*S+bS),bP=bQ+2*bM*(E-bQ)+bM*bM*(bF-2*E+bQ),bL=(1-bM)*d+bM*bS,bI=(1-bM)*b+bM*bQ,i=(1-bM)*S+bM*bG,e=(1-bM)*E+bM*bF,R=(90-an.atan((bO-bR)/(bN-bP))*180/an.PI);(bO>bR||bN<bP)&&(R+=180);return{x:bJ,y:bH,m:{x:bO,y:bN},n:{x:bR,y:bP},start:{x:bL,y:bI},end:{x:i,y:e},alpha:R}};var ah=ay(function(bJ){if(!bJ){return{x:0,y:0,width:0,height:0}}bJ=U(bJ);var bG=0,bF=0,E=[],d=[],e;for(var R=0,bI=bJ[r];R<bI;R++){e=bJ[R];if(e[0]=="M"){bG=e[1];bF=e[2];E[j](bG);d[j](bF)}else{var S=a3(bG,bF,e[1],e[2],e[3],e[4],e[5],e[6]);E=E[bt](S.min.x,S.max.x);d=d[bt](S.min.y,S.max.y);bG=e[5];bF=e[6]}}var b=bf[bz](0,E),bH=bf[bz](0,d);return{x:b,y:bH,width:l[bz](0,E)-b,height:l[bz](0,d)-bH}}),aP=function(S){var e=[];if(!aG.is(S,a4)||!aG.is(S&&S[0],a4)){S=aG.parsePathString(S)}for(var d=0,E=S[r];d<E;d++){e[d]=[];for(var b=0,R=S[d][r];b<R;b++){e[d][b]=S[d][b]}}e[aX]=aG._path2string;return e},ar=ay(function(E){if(!aG.is(E,a4)||!aG.is(E&&E[0],a4)){E=aG.parsePathString(E)}var bI=[],bK=0,bJ=0,bN=0,bM=0,e=0;if(E[0][0]=="M"){bK=E[0][1];bJ=E[0][2];bN=bK;bM=bJ;e++;bI[j](["M",bK,bJ])}for(var bF=e,bO=E[r];bF<bO;bF++){var b=bI[bF]=[],bL=E[bF];if(bL[0]!=bE.call(bL[0])){b[0]=bE.call(bL[0]);switch(b[0]){case"a":b[1]=bL[1];b[2]=bL[2];b[3]=bL[3];b[4]=bL[4];b[5]=bL[5];b[6]=+(bL[6]-bK).toFixed(3);b[7]=+(bL[7]-bJ).toFixed(3);break;case"v":b[1]=+(bL[1]-bJ).toFixed(3);break;case"m":bN=bL[1];bM=bL[2];default:for(var S=1,bG=bL[r];S<bG;S++){b[S]=+(bL[S]-((S%2)?bK:bJ)).toFixed(3)}}}else{b=bI[bF]=[];if(bL[0]=="m"){bN=bL[1]+bK;bM=bL[2]+bJ}for(var R=0,d=bL[r];R<d;R++){bI[bF][R]=bL[R]}}var bH=bI[bF][r];switch(bI[bF][0]){case"z":bK=bN;bJ=bM;break;case"h":bK+=+bI[bF][bH-1];break;case"v":bJ+=+bI[bF][bH-1];break;default:bK+=+bI[bF][bH-2];bJ+=+bI[bF][bH-1]}}bI[aX]=aG._path2string;return bI},0,aP),x=ay(function(E){if(!aG.is(E,a4)||!aG.is(E&&E[0],a4)){E=aG.parsePathString(E)}var bH=[],bJ=0,bI=0,bM=0,bL=0,e=0;if(E[0][0]=="M"){bJ=+E[0][1];bI=+E[0][2];bM=bJ;bL=bI;e++;bH[0]=["M",bJ,bI]}for(var bF=e,bN=E[r];bF<bN;bF++){var b=bH[bF]=[],bK=E[bF];if(bK[0]!=bl.call(bK[0])){b[0]=bl.call(bK[0]);switch(b[0]){case"A":b[1]=bK[1];b[2]=bK[2];b[3]=bK[3];b[4]=bK[4];b[5]=bK[5];b[6]=+(bK[6]+bJ);b[7]=+(bK[7]+bI);break;case"V":b[1]=+bK[1]+bI;break;case"H":b[1]=+bK[1]+bJ;break;case"M":bM=+bK[1]+bJ;bL=+bK[2]+bI;default:for(var S=1,bG=bK[r];S<bG;S++){b[S]=+bK[S]+((S%2)?bJ:bI)}}}else{for(var R=0,d=bK[r];R<d;R++){bH[bF][R]=bK[R]}}switch(b[0]){case"Z":bJ=bM;bI=bL;break;case"H":bJ=b[1];break;case"V":bI=b[1];break;case"M":bM=bH[bF][bH[bF][r]-2];bL=bH[bF][bH[bF][r]-1];default:bJ=bH[bF][bH[bF][r]-2];bI=bH[bF][bH[bF][r]-1]}}bH[aX]=aG._path2string;return bH},null,aP),bB=function(d,i,b,e){return[d,i,b,e,b,e]},bg=function(d,i,S,E,b,e){var R=1/3,bF=2/3;return[R*d+bF*S,R*i+bF*E,R*b+bF*S,R*e+bF*E,b,e]},Y=function(bN,ci,bW,bU,bO,bI,R,bM,ch,bP){var E=an.PI,bT=E*120/180,b=E/180*(+bO||0),b0=[],bX,ce=ay(function(cj,cm,i){var cl=cj*an.cos(i)-cm*an.sin(i),ck=cj*an.sin(i)+cm*an.cos(i);return{x:cl,y:ck}});if(!bP){bX=ce(bN,ci,-b);bN=bX.x;ci=bX.y;bX=ce(bM,ch,-b);bM=bX.x;ch=bX.y;var d=an.cos(E/180*bO),bK=an.sin(E/180*bO),b2=(bN-bM)/2,b1=(ci-ch)/2;var cc=(b2*b2)/(bW*bW)+(b1*b1)/(bU*bU);if(cc>1){cc=an.sqrt(cc);bW=cc*bW;bU=cc*bU}var e=bW*bW,b5=bU*bU,b7=(bI==R?-1:1)*an.sqrt(an.abs((e*b5-e*b1*b1-b5*b2*b2)/(e*b1*b1+b5*b2*b2))),bR=b7*bW*b1/bU+(bN+bM)/2,bQ=b7*-bU*b2/bW+(ci+ch)/2,bH=an.asin(((ci-bQ)/bU).toFixed(9)),bG=an.asin(((ch-bQ)/bU).toFixed(9));bH=bN<bR?E-bH:bH;bG=bM<bR?E-bG:bG;bH<0&&(bH=E*2+bH);bG<0&&(bG=E*2+bG);if(R&&bH>bG){bH=bH-E*2}if(!R&&bG>bH){bG=bG-E*2}}else{bH=bP[0];bG=bP[1];bR=bP[2];bQ=bP[3]}var bL=bG-bH;if(an.abs(bL)>bT){var bS=bG,bV=bM,bJ=ch;bG=bH+bT*(R&&bG>bH?1:-1);bM=bR+bW*an.cos(bG);ch=bQ+bU*an.sin(bG);b0=Y(bM,ch,bW,bU,bO,0,R,bV,bJ,[bG,bS,bR,bQ])}bL=bG-bH;var bF=an.cos(bH),cg=an.sin(bH),S=an.cos(bG),cf=an.sin(bG),b3=an.tan(bL/4),b6=4/3*bW*b3,b4=4/3*bU*b3,cd=[bN,ci],cb=[bN+b6*cg,ci-b4*bF],ca=[bM+b6*cf,ch-b4*S],b8=[bM,ch];cb[0]=2*cd[0]-cb[0];cb[1]=2*cd[1]-cb[1];if(bP){return[cb,ca,b8][bt](b0)}else{b0=[cb,ca,b8][bt](b0)[aT]()[H](",");var bY=[];for(var b9=0,bZ=b0[r];b9<bZ;b9++){bY[b9]=b9%2?ce(b0[b9-1],b0[b9],b).y:ce(b0[b9],b0[b9+1],b).x}return bY}},ab=function(d,b,i,e,bG,bF,S,R,bH){var E=1-bH;return{x:bi(E,3)*d+bi(E,2)*3*bH*i+E*3*bH*bH*bG+bi(bH,3)*S,y:bi(E,3)*b+bi(E,2)*3*bH*e+E*3*bH*bH*bF+bi(bH,3)*R}},a3=ay(function(i,d,R,E,bO,bN,bK,bH){var bM=(bO-2*R+i)-(bK-2*bO+R),bJ=2*(R-i)-2*(bO-R),bG=i-R,bF=(-bJ+an.sqrt(bJ*bJ-4*bM*bG))/2/bM,S=(-bJ-an.sqrt(bJ*bJ-4*bM*bG))/2/bM,bI=[d,bH],bL=[i,bK],e;an.abs(bF)>"1e12"&&(bF=0.5);an.abs(S)>"1e12"&&(S=0.5);if(bF>0&&bF<1){e=ab(i,d,R,E,bO,bN,bK,bH,bF);bL[j](e.x);bI[j](e.y)}if(S>0&&S<1){e=ab(i,d,R,E,bO,bN,bK,bH,S);bL[j](e.x);bI[j](e.y)}bM=(bN-2*E+d)-(bH-2*bN+E);bJ=2*(E-d)-2*(bN-E);bG=d-E;bF=(-bJ+an.sqrt(bJ*bJ-4*bM*bG))/2/bM;S=(-bJ-an.sqrt(bJ*bJ-4*bM*bG))/2/bM;an.abs(bF)>"1e12"&&(bF=0.5);an.abs(S)>"1e12"&&(S=0.5);if(bF>0&&bF<1){e=ab(i,d,R,E,bO,bN,bK,bH,bF);bL[j](e.x);bI[j](e.y)}if(S>0&&S<1){e=ab(i,d,R,E,bO,bN,bK,bH,S);bL[j](e.x);bI[j](e.y)}return{min:{x:bf[bz](0,bL),y:bf[bz](0,bI)},max:{x:l[bz](0,bL),y:l[bz](0,bI)}}}),U=ay(function(bN,bI){var E=x(bN),bJ=bI&&x(bI),bK={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},b={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},S=function(bO,bP){var i,bQ;if(!bO){return["C",bP.x,bP.y,bP.x,bP.y,bP.x,bP.y]}!(bO[0] in {T:1,Q:1})&&(bP.qx=bP.qy=null);switch(bO[0]){case"M":bP.X=bO[1];bP.Y=bO[2];break;case"A":bO=["C"][bt](Y[bz](0,[bP.x,bP.y][bt](bO.slice(1))));break;case"S":i=bP.x+(bP.x-(bP.bx||bP.x));bQ=bP.y+(bP.y-(bP.by||bP.y));bO=["C",i,bQ][bt](bO.slice(1));break;case"T":bP.qx=bP.x+(bP.x-(bP.qx||bP.x));bP.qy=bP.y+(bP.y-(bP.qy||bP.y));bO=["C"][bt](bg(bP.x,bP.y,bP.qx,bP.qy,bO[1],bO[2]));break;case"Q":bP.qx=bO[1];bP.qy=bO[2];bO=["C"][bt](bg(bP.x,bP.y,bO[1],bO[2],bO[3],bO[4]));break;case"L":bO=["C"][bt](bB(bP.x,bP.y,bO[1],bO[2]));break;case"H":bO=["C"][bt](bB(bP.x,bP.y,bO[1],bP.y));break;case"V":bO=["C"][bt](bB(bP.x,bP.y,bP.x,bO[1]));break;case"Z":bO=["C"][bt](bB(bP.x,bP.y,bP.X,bP.Y));break}return bO},d=function(bO,bP){if(bO[bP][r]>7){bO[bP].shift();var bQ=bO[bP];while(bQ[r]){bO.splice(bP++,0,["C"][bt](bQ.splice(0,6)))}bO.splice(bP,1);bL=l(E[r],bJ&&bJ[r]||0)}},e=function(bS,bR,bP,bO,bQ){if(bS&&bR&&bS[bQ][0]=="M"&&bR[bQ][0]!="M"){bR.splice(bQ,0,["M",bO.x,bO.y]);bP.bx=0;bP.by=0;bP.x=bS[bQ][1];bP.y=bS[bQ][2];bL=l(E[r],bJ&&bJ[r]||0)}};for(var bG=0,bL=l(E[r],bJ&&bJ[r]||0);bG<bL;bG++){E[bG]=S(E[bG],bK);d(E,bG);bJ&&(bJ[bG]=S(bJ[bG],b));bJ&&d(bJ,bG);e(E,bJ,bK,b,bG);e(bJ,E,b,bK,bG);var bF=E[bG],bM=bJ&&bJ[bG],R=bF[r],bH=bJ&&bM[r];bK.x=bF[R-2];bK.y=bF[R-1];bK.bx=ai(bF[R-4])||bK.x;bK.by=ai(bF[R-3])||bK.y;b.bx=bJ&&(ai(bM[bH-4])||b.x);b.by=bJ&&(ai(bM[bH-3])||b.y);b.x=bJ&&bM[bH-2];b.y=bJ&&bM[bH-1]}return bJ?[E,bJ]:E},null,aP),v=ay(function(bI){var bH=[];for(var S=0,bJ=bI[r];S<bJ;S++){var b={},bG=bI[S].match(/^([^:]*):?([\d\.]*)/);b.color=aG.getRGB(bG[1]);if(b.color.error){return null}b.color=b.color.hex;bG[2]&&(b.offset=bG[2]+"%");bH[j](b)}for(S=1,bJ=bH[r]-1;S<bJ;S++){if(!bH[S].offset){var e=ai(bH[S-1].offset||0),E=0;for(var R=S+1;R<bJ;R++){if(bH[R].offset){E=bH[R].offset;break}}if(!E){E=100;R=bJ}E=ai(E);var bF=(E-e)/(R-S+1);for(;S<R;S++){e+=bF;bH[S].offset=e+"%"}}}return bH}),aH=function(b,E,e,i){var d;if(aG.is(b,ae)||aG.is(b,"object")){d=aG.is(b,ae)?Z.getElementById(b):b;if(d.tagName){if(E==null){return{container:d,width:d.style.pixelWidth||d.offsetWidth,height:d.style.pixelHeight||d.offsetHeight}}else{return{container:d,width:E,height:e}}}}else{return{container:1,x:b,y:E,width:e,height:i}}},bb=function(b,e){var d=this;for(var i in e){if(e[af](i)&&!(i in b)){switch(typeof e[i]){case"function":(function(E){b[i]=b===d?E:function(){return E[bz](d,arguments)}})(e[i]);break;case"object":b[i]=b[i]||{};bb.call(this,b[i],e[i]);break;default:b[i]=e[i];break}}}},aC=function(b,d){b==d.top&&(d.top=b.prev);b==d.bottom&&(d.bottom=b.next);b.next&&(b.next.prev=b.prev);b.prev&&(b.prev.next=b.next)},ak=function(b,d){if(d.top===b){return}aC(b,d);b.next=null;b.prev=d.top;d.top.next=b;d.top=b},o=function(b,d){if(d.bottom===b){return}aC(b,d);b.next=d.bottom;b.prev=null;d.bottom.prev=b;d.bottom=b},I=function(d,b,e){aC(d,e);b==e.top&&(e.top=d);b.next&&(b.next.prev=d);d.next=b.next;d.prev=b;b.next=d},aJ=function(d,b,e){aC(d,e);b==e.bottom&&(e.bottom=d);b.prev&&(b.prev.next=d);d.prev=b.prev;b.prev=d;d.next=b},y=function(b){return function(){throw new Error("Rapha\xebl: you are calling to method \u201c"+b+"\u201d of removed object")}},aL=/^r(?:\(([^,]+?)\s*,\s*([^\)]+?)\))?/;aG.pathToRelative=ar;if(aG.svg){aW.svgns="http://www.w3.org/2000/svg";aW.xlink="http://www.w3.org/1999/xlink";ac=function(b){return +b+(~~b===b)*0.5};var be=function(e,b){if(b){for(var d in b){if(b[af](d)){e[C](d,bA(b[d]))}}}else{e=Z.createElementNS(aW.svgns,e);e.style.webkitTapHighlightColor="rgba(0,0,0,0)";return e}};aG[aX]=function(){return"Your browser supports SVG.\nYou are running Rapha\xebl "+this.version};var w=function(b,i){var d=be("path");i.canvas&&i.canvas[bh](d);var e=new aR(d,i);e.type="path";am(e,{fill:"none",stroke:"#000",path:b});return e};var g=function(E,bM,b){var bJ="linear",bG=0.5,S=0.5,bO=E.style;bM=bA(bM)[bp](aL,function(bQ,i,bR){bJ="radial";if(i&&bR){bG=ai(i);S=ai(bR);var bP=((S>0.5)*2-1);bi(bG-0.5,2)+bi(S-0.5,2)>0.25&&(S=an.sqrt(0.25-bi(bG-0.5,2))*bP+0.5)&&S!=0.5&&(S=S.toFixed(5)-0.00001*bP)}return aM});bM=bM[H](/\s*\-\s*/);if(bJ=="linear"){var bF=bM.shift();bF=-ai(bF);if(isNaN(bF)){return null}var R=[0,0,an.cos(bF*an.PI/180),an.sin(bF*an.PI/180)],bL=1/(l(an.abs(R[2]),an.abs(R[3]))||1);R[2]*=bL;R[3]*=bL;if(R[2]<0){R[0]=-R[2];R[2]=0}if(R[3]<0){R[1]=-R[3];R[3]=0}}var bI=v(bM);if(!bI){return null}var d=E.getAttribute(a1);d=d.match(/^url\(#(.*)\)$/);d&&b.defs.removeChild(Z.getElementById(d[1]));var e=be(bJ+"Gradient");e.id="r"+(aG._id++)[aX](36);be(e,bJ=="radial"?{fx:bG,fy:S}:{x1:R[0],y1:R[1],x2:R[2],y2:R[3]});b.defs[bh](e);for(var bH=0,bN=bI[r];bH<bN;bH++){var bK=be("stop");be(bK,{offset:bI[bH].offset?bI[bH].offset:!bH?"0%":"100%","stop-color":bI[bH].color||"#fff"});e[bh](bK)}be(E,{fill:"url(#"+e.id+")",opacity:1,"fill-opacity":1});bO.fill=aM;bO.opacity=1;bO.fillOpacity=1;return 1};var aa=function(d){var b=d.getBBox();be(d.pattern,{patternTransform:aG.format("translate({0},{1})",b.x,b.y)})};var am=function(bL,bU){var bO={"":[0],none:[0],"-":[3,1],".":[1,1],"-.":[3,1,1,1],"-..":[3,1,1,1,1,1],". ":[1,3],"- ":[4,3],"--":[8,3],"- .":[4,3,1,3],"--.":[8,3,1,3],"--..":[8,3,1,3,1,3]},bQ=bL.node,bM=bL.attrs,bI=bL.rotate(),S=function(b1,b0){b0=bO[bE.call(b0)];if(b0){var bY=b1.attrs["stroke-width"]||"1",bW={round:bY,square:bY,butt:0}[b1.attrs["stroke-linecap"]||bU["stroke-linecap"]]||0,bZ=[];var bX=b0[r];while(bX--){bZ[bX]=b0[bX]*bY+((bX%2)?1:-1)*bW}be(bQ,{"stroke-dasharray":bZ[aT](",")})}};bU[af]("rotation")&&(bI=bU.rotation);var bH=bA(bI)[H](a);if(!(bH.length-1)){bH=null}else{bH[1]=+bH[1];bH[2]=+bH[2]}ai(bI)&&bL.rotate(0,true);for(var bP in bU){if(bU[af](bP)){if(!p[af](bP)){continue}var bN=bU[bP];bM[bP]=bN;switch(bP){case"blur":bL.blur(bN);break;case"rotation":bL.rotate(bN,true);break;case"href":case"title":case"target":var bS=bQ.parentNode;if(bE.call(bS.tagName)!="a"){var E=be("a");bS.insertBefore(E,bQ);E[bh](bQ);bS=E}if(bP=="target"&&bN=="blank"){bS.setAttributeNS(bL.paper.xlink,"show","new")}else{bS.setAttributeNS(bL.paper.xlink,bP,bN)}break;case"cursor":bQ.style.cursor=bN;break;case"clip-rect":var d=bA(bN)[H](a);if(d[r]==4){bL.clip&&bL.clip.parentNode.parentNode.removeChild(bL.clip.parentNode);var e=be("clipPath"),bR=be("rect");e.id="r"+(aG._id++)[aX](36);be(bR,{x:d[0],y:d[1],width:d[2],height:d[3]});e[bh](bR);bL.paper.defs[bh](e);be(bQ,{"clip-path":"url(#"+e.id+")"});bL.clip=bR}if(!bN){var bT=Z.getElementById(bQ.getAttribute("clip-path")[bp](/(^url\(#|\)$)/g,aM));bT&&bT.parentNode.removeChild(bT);be(bQ,{"clip-path":aM});delete bL.clip}break;case"path":if(bL.type=="path"){be(bQ,{d:bN?bM.path=x(bN):"M0,0"})}break;case"width":bQ[C](bP,bN);if(bM.fx){bP="x";bN=bM.x}else{break}case"x":if(bM.fx){bN=-bM.x-(bM.width||0)}case"rx":if(bP=="rx"&&bL.type=="rect"){break}case"cx":bH&&(bP=="x"||bP=="cx")&&(bH[1]+=bN-bM[bP]);bQ[C](bP,bN);bL.pattern&&aa(bL);break;case"height":bQ[C](bP,bN);if(bM.fy){bP="y";bN=bM.y}else{break}case"y":if(bM.fy){bN=-bM.y-(bM.height||0)}case"ry":if(bP=="ry"&&bL.type=="rect"){break}case"cy":bH&&(bP=="y"||bP=="cy")&&(bH[2]+=bN-bM[bP]);bQ[C](bP,bN);bL.pattern&&aa(bL);break;case"r":if(bL.type=="rect"){be(bQ,{rx:bN,ry:bN})}else{bQ[C](bP,bN)}break;case"src":if(bL.type=="image"){bQ.setAttributeNS(bL.paper.xlink,"href",bN)}break;case"stroke-width":bQ.style.strokeWidth=bN;bQ[C](bP,bN);if(bM["stroke-dasharray"]){S(bL,bM["stroke-dasharray"])}break;case"stroke-dasharray":S(bL,bN);break;case"translation":var bF=bA(bN)[H](a);bF[0]=+bF[0]||0;bF[1]=+bF[1]||0;if(bH){bH[1]+=bF[0];bH[2]+=bF[1]}z.call(bL,bF[0],bF[1]);break;case"scale":bF=bA(bN)[H](a);bL.scale(+bF[0]||1,+bF[1]||+bF[0]||1,isNaN(ai(bF[2]))?null:+bF[2],isNaN(ai(bF[3]))?null:+bF[3]);break;case a1:var R=bA(bN).match(h);if(R){e=be("pattern");var bK=be("image");e.id="r"+(aG._id++)[aX](36);be(e,{x:0,y:0,patternUnits:"userSpaceOnUse",height:1,width:1});be(bK,{x:0,y:0});bK.setAttributeNS(bL.paper.xlink,"href",R[1]);e[bh](bK);var bV=Z.createElement("img");bV.style.cssText="position:absolute;left:-9999em;top-9999em";bV.onload=function(){be(e,{width:this.offsetWidth,height:this.offsetHeight});be(bK,{width:this.offsetWidth,height:this.offsetHeight});Z.body.removeChild(this);bL.paper.safari()};Z.body[bh](bV);bV.src=R[1];bL.paper.defs[bh](e);bQ.style.fill="url(#"+e.id+")";be(bQ,{fill:"url(#"+e.id+")"});bL.pattern=e;bL.pattern&&aa(bL);break}var i=aG.getRGB(bN);if(!i.error){delete bU.gradient;delete bM.gradient;!aG.is(bM.opacity,"undefined")&&aG.is(bU.opacity,"undefined")&&be(bQ,{opacity:bM.opacity});!aG.is(bM["fill-opacity"],"undefined")&&aG.is(bU["fill-opacity"],"undefined")&&be(bQ,{"fill-opacity":bM["fill-opacity"]})}else{if((({circle:1,ellipse:1})[af](bL.type)||bA(bN).charAt()!="r")&&g(bQ,bN,bL.paper)){bM.gradient=bN;bM.fill="none";break}}i[af]("o")&&be(bQ,{"fill-opacity":i.o>1?i.o/100:i.o});case"stroke":i=aG.getRGB(bN);bQ[C](bP,i.hex);bP=="stroke"&&i[af]("o")&&be(bQ,{"stroke-opacity":i.o>1?i.o/100:i.o});break;case"gradient":(({circle:1,ellipse:1})[af](bL.type)||bA(bN).charAt()!="r")&&g(bQ,bN,bL.paper);break;case"opacity":case"fill-opacity":if(bM.gradient){var b=Z.getElementById(bQ.getAttribute(a1)[bp](/^url\(#|\)$/g,aM));if(b){var bG=b.getElementsByTagName("stop");bG[bG[r]-1][C]("stop-opacity",bN)}break}default:bP=="font-size"&&(bN=Q(bN,10)+"px");var bJ=bP[bp](/(\-.)/g,function(bW){return bl.call(bW.substring(1))});bQ.style[bJ]=bN;bQ[C](bP,bN);break}}}O(bL,bU);if(bH){bL.rotate(bH.join(aF))}else{ai(bI)&&bL.rotate(bI,true)}};var n=1.2,O=function(b,E){if(b.type!="text"||!(E[af]("text")||E[af]("font")||E[af]("font-size")||E[af]("x")||E[af]("y"))){return}var bH=b.attrs,d=b.node,bJ=d.firstChild?Q(Z.defaultView.getComputedStyle(d.firstChild,aM).getPropertyValue("font-size"),10):10;if(E[af]("text")){bH.text=E.text;while(d.firstChild){d.removeChild(d.firstChild)}var e=bA(E.text)[H]("\n");for(var R=0,bI=e[r];R<bI;R++){if(e[R]){var bF=be("tspan");R&&be(bF,{dy:bJ*n,x:bH.x});bF[bh](Z.createTextNode(e[R]));d[bh](bF)}}}else{e=d.getElementsByTagName("tspan");for(R=0,bI=e[r];R<bI;R++){R&&be(e[R],{dy:bJ*n,x:bH.x})}}be(d,{y:bH.y});var S=b.getBBox(),bG=bH.y-(S.y+S.height/2);bG&&isFinite(bG)&&be(d,{y:bH.y+bG})},aR=function(d,b){var i=0,e=0;this[0]=d;this.id=aG._oid++;this.node=d;d.raphael=this;this.paper=b;this.attrs=this.attrs||{};this.transformations=[];this._={tx:0,ty:0,rt:{deg:0,cx:0,cy:0},sx:1,sy:1};!b.bottom&&(b.bottom=this);this.prev=b.top;b.top&&(b.top.next=this);b.top=this;this.next=null};var a9=aR[bC];aR[bC].rotate=function(d,b,i){if(this.removed){return this}if(d==null){if(this._.rt.cx){return[this._.rt.deg,this._.rt.cx,this._.rt.cy][aT](aF)}return this._.rt.deg}var e=this.getBBox();d=bA(d)[H](a);if(d[r]-1){b=ai(d[1]);i=ai(d[2])}d=ai(d[0]);if(b!=null&&b!==false){this._.rt.deg=d}else{this._.rt.deg+=d}(i==null)&&(b=null);this._.rt.cx=b;this._.rt.cy=i;b=b==null?e.x+e.width/2:b;i=i==null?e.y+e.height/2:i;if(this._.rt.deg){this.transformations[0]=aG.format("rotate({0} {1} {2})",this._.rt.deg,b,i);this.clip&&be(this.clip,{transform:aG.format("rotate({0} {1} {2})",-this._.rt.deg,b,i)})}else{this.transformations[0]=aM;this.clip&&be(this.clip,{transform:aM})}be(this.node,{transform:this.transformations[aT](aF)});return this};aR[bC].hide=function(){!this.removed&&(this.node.style.display="none");return this};aR[bC].show=function(){!this.removed&&(this.node.style.display="");return this};aR[bC].remove=function(){if(this.removed){return}aC(this,this.paper);this.node.parentNode.removeChild(this.node);for(var b in this){delete this[b]}this.removed=true};aR[bC].getBBox=function(){if(this.removed){return this}if(this.type=="path"){return ah(this.attrs.path)}if(this.node.style.display=="none"){this.show();var d=true}var bF={};try{bF=this.node.getBBox()}catch(R){}finally{bF=bF||{}}if(this.type=="text"){bF={x:bF.x,y:Infinity,width:0,height:0};for(var b=0,E=this.node.getNumberOfChars();b<E;b++){var S=this.node.getExtentOfChar(b);(S.y<bF.y)&&(bF.y=S.y);(S.y+S.height-bF.y>bF.height)&&(bF.height=S.y+S.height-bF.y);(S.x+S.width-bF.x>bF.width)&&(bF.width=S.x+S.width-bF.x)}}d&&this.hide();return bF};aR[bC].attr=function(b,bH){if(this.removed){return this}if(b==null){var bG={};for(var R in this.attrs){if(this.attrs[af](R)){bG[R]=this.attrs[R]}}this._.rt.deg&&(bG.rotation=this.rotate());(this._.sx!=1||this._.sy!=1)&&(bG.scale=this.scale());bG.gradient&&bG.fill=="none"&&(bG.fill=bG.gradient)&&delete bG.gradient;return bG}if(bH==null&&aG.is(b,ae)){if(b=="translation"){return z.call(this)}if(b=="rotation"){return this.rotate()}if(b=="scale"){return this.scale()}if(b==a1&&this.attrs.fill=="none"&&this.attrs.gradient){return this.attrs.gradient}return this.attrs[b]}if(bH==null&&aG.is(b,a4)){var bJ={};for(var E=0,S=b.length;E<S;E++){bJ[b[E]]=this.attr(b[E])}return bJ}if(bH!=null){var d={};d[b]=bH}else{if(b!=null&&aG.is(b,"object")){d=b}}for(var bI in this.paper.customAttributes){if(this.paper.customAttributes[af](bI)&&d[af](bI)&&aG.is(this.paper.customAttributes[bI],"function")){var bF=this.paper.customAttributes[bI].apply(this,[][bt](d[bI]));this.attrs[bI]=d[bI];for(var e in bF){if(bF[af](e)){d[e]=bF[e]}}}}am(this,d);return this};aR[bC].toFront=function(){if(this.removed){return this}this.node.parentNode[bh](this.node);var b=this.paper;b.top!=this&&ak(this,b);return this};aR[bC].toBack=function(){if(this.removed){return this}if(this.node.parentNode.firstChild!=this.node){this.node.parentNode.insertBefore(this.node,this.node.parentNode.firstChild);o(this,this.paper);var b=this.paper}return this};aR[bC].insertAfter=function(b){if(this.removed){return this}var d=b.node||b[b.length-1].node;if(d.nextSibling){d.parentNode.insertBefore(this.node,d.nextSibling)}else{d.parentNode[bh](this.node)}I(this,b,this.paper);return this};aR[bC].insertBefore=function(b){if(this.removed){return this}var d=b.node||b[0].node;d.parentNode.insertBefore(this.node,d);aJ(this,b,this.paper);return this};aR[bC].blur=function(d){var b=this;if(+d!==0){var e=be("filter"),i=be("feGaussianBlur");b.attrs.blur=d;e.id="r"+(aG._id++)[aX](36);be(i,{stdDeviation:+d||1.5});e.appendChild(i);b.paper.defs.appendChild(e);b._blur=e;be(b.node,{filter:"url(#"+e.id+")"})}else{if(b._blur){b._blur.parentNode.removeChild(b._blur);delete b._blur;delete b.attrs.blur}b.node.removeAttribute("filter")}};var ad=function(d,b,R,E){var i=be("circle");d.canvas&&d.canvas[bh](i);var e=new aR(i,d);e.attrs={cx:b,cy:R,r:E,fill:"none",stroke:"#000"};e.type="circle";be(i,e.attrs);return e},a8=function(e,b,bF,d,R,S){var E=be("rect");e.canvas&&e.canvas[bh](E);var i=new aR(E,e);i.attrs={x:b,y:bF,width:d,height:R,r:S||0,rx:S||0,ry:S||0,fill:"none",stroke:"#000"};i.type="rect";be(E,i.attrs);return i},ax=function(d,b,S,R,E){var i=be("ellipse");d.canvas&&d.canvas[bh](i);var e=new aR(i,d);e.attrs={cx:b,cy:S,rx:R,ry:E,fill:"none",stroke:"#000"};e.type="ellipse";be(i,e.attrs);return e},u=function(e,S,b,bF,d,R){var E=be("image");be(E,{x:b,y:bF,width:d,height:R,preserveAspectRatio:"none"});E.setAttributeNS(e.xlink,"href",S);e.canvas&&e.canvas[bh](E);var i=new aR(E,e);i.attrs={x:b,y:bF,width:d,height:R,src:S};i.type="image";return i},aj=function(d,b,R,E){var i=be("text");be(i,{x:b,y:R,"text-anchor":"middle"});d.canvas&&d.canvas[bh](i);var e=new aR(i,d);e.attrs={x:b,y:R,"text-anchor":"middle",text:E,font:p.font,stroke:"none",fill:"#000"};e.type="text";am(e,e.attrs);return e},by=function(d,b){this.width=d||this.width;this.height=b||this.height;this.canvas[C]("width",this.width);this.canvas[C]("height",this.height);return this},D=function(){var i=aH[bz](0,arguments),e=i&&i.container,d=i.x,S=i.y,E=i.width,b=i.height;if(!e){throw new Error("SVG container not found.")}var R=be("svg");d=d||0;S=S||0;E=E||512;b=b||342;be(R,{xmlns:"http://www.w3.org/2000/svg",version:1.1,width:E,height:b});if(e==1){R.style.cssText="position:absolute;left:"+d+"px;top:"+S+"px";Z.body[bh](R)}else{if(e.firstChild){e.insertBefore(R,e.firstChild)}else{e[bh](R)}}e=new bw;e.width=E;e.height=b;e.canvas=R;bb.call(e,e,aG.fn);e.clear();return e};aW.clear=function(){var b=this.canvas;while(b.firstChild){b.removeChild(b.firstChild)}this.bottom=this.top=null;(this.desc=be("desc"))[bh](Z.createTextNode("Created with Rapha\xebl"));b[bh](this.desc);b[bh](this.defs=be("defs"))};aW.remove=function(){this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas);for(var b in this){this[b]=y(b)}}}if(aG.vml){var M={M:"m",L:"l",C:"c",Z:"x",m:"t",l:"r",c:"v",z:"x"},aK=/([clmz]),?([^clmz]*)/gi,bu=/ progid:\S+Blur\([^\)]+\)/g,bD=/-?[^,\s-]+/g,aU=1000+aF+1000,t=10,s={path:1,rect:1},bd=function(bJ){var bG=/[ahqstv]/ig,e=x;bA(bJ).match(bG)&&(e=U);bG=/[clmz]/g;if(e==x&&!bA(bJ).match(bG)){var bF=bA(bJ)[bp](aK,function(bM,bO,bK){var bN=[],i=bE.call(bO)=="m",bL=M[bO];bK[bp](bD,function(bP){if(i&&bN[r]==2){bL+=bN+M[bO=="m"?"l":"L"];bN=[]}bN[j](ac(bP*t))});return bL+bN});return bF}var bH=e(bJ),d,b;bF=[];for(var R=0,bI=bH[r];R<bI;R++){d=bH[R];b=bE.call(bH[R][0]);b=="z"&&(b="x");for(var E=1,S=d[r];E<S;E++){b+=ac(d[E]*t)+(E!=S-1?",":aM)}bF[j](b)}return bF[aT](aF)};aG[aX]=function(){return"Your browser doesn\u2019t support SVG. Falling down to VML.\nYou are running Rapha\xebl "+this.version};w=function(e,d){var R=aw("group");R.style.cssText="position:absolute;left:0;top:0;width:"+d.width+"px;height:"+d.height+"px";R.coordsize=d.coordsize;R.coordorigin=d.coordorigin;var E=aw("shape"),i=E.style;i.width=d.width+"px";i.height=d.height+"px";E.coordsize=aU;E.coordorigin=d.coordorigin;R[bh](E);var S=new aR(E,R,d),b={fill:"none",stroke:"#000"};e&&(b.path=e);S.type="path";S.path=[];S.Path=aM;am(S,b);d.canvas[bh](R);return S};am=function(bH,bO){bH.attrs=bH.attrs||{};var bL=bH.node,bP=bH.attrs,S=bL.style,i,bN=(bO.x!=bP.x||bO.y!=bP.y||bO.width!=bP.width||bO.height!=bP.height||bO.r!=bP.r)&&bH.type=="rect",bT=bH;for(var bF in bO){if(bO[af](bF)){bP[bF]=bO[bF]}}if(bN){bP.path=aq(bP.x,bP.y,bP.width,bP.height,bP.r);bH.X=bP.x;bH.Y=bP.y;bH.W=bP.width;bH.H=bP.height}bO.href&&(bL.href=bO.href);bO.title&&(bL.title=bO.title);bO.target&&(bL.target=bO.target);bO.cursor&&(S.cursor=bO.cursor);"blur" in bO&&bH.blur(bO.blur);if(bO.path&&bH.type=="path"||bN){bL.path=bd(bP.path)}if(bO.rotation!=null){bH.rotate(bO.rotation,true)}if(bO.translation){i=bA(bO.translation)[H](a);z.call(bH,i[0],i[1]);if(bH._.rt.cx!=null){bH._.rt.cx+=+i[0];bH._.rt.cy+=+i[1];bH.setBox(bH.attrs,i[0],i[1])}}if(bO.scale){i=bA(bO.scale)[H](a);bH.scale(+i[0]||1,+i[1]||+i[0]||1,+i[2]||null,+i[3]||null)}if("clip-rect" in bO){var b=bA(bO["clip-rect"])[H](a);if(b[r]==4){b[2]=+b[2]+(+b[0]);b[3]=+b[3]+(+b[1]);var bG=bL.clipRect||Z.createElement("div"),bS=bG.style,R=bL.parentNode;bS.clip=aG.format("rect({1}px {2}px {3}px {0}px)",b);if(!bL.clipRect){bS.position="absolute";bS.top=0;bS.left=0;bS.width=bH.paper.width+"px";bS.height=bH.paper.height+"px";R.parentNode.insertBefore(bG,R);bG[bh](R);bL.clipRect=bG}}if(!bO["clip-rect"]){bL.clipRect&&(bL.clipRect.style.clip=aM)}}if(bH.type=="image"&&bO.src){bL.src=bO.src}if(bH.type=="image"&&bO.opacity){bL.filterOpacity=a2+".Alpha(opacity="+(bO.opacity*100)+")";S.filter=(bL.filterMatrix||aM)+(bL.filterOpacity||aM)}bO.font&&(S.font=bO.font);bO["font-family"]&&(S.fontFamily='"'+bO["font-family"][H](",")[0][bp](/^['"]+|['"]+$/g,aM)+'"');bO["font-size"]&&(S.fontSize=bO["font-size"]);bO["font-weight"]&&(S.fontWeight=bO["font-weight"]);bO["font-style"]&&(S.fontStyle=bO["font-style"]);if(bO.opacity!=null||bO["stroke-width"]!=null||bO.fill!=null||bO.stroke!=null||bO["stroke-width"]!=null||bO["stroke-opacity"]!=null||bO["fill-opacity"]!=null||bO["stroke-dasharray"]!=null||bO["stroke-miterlimit"]!=null||bO["stroke-linejoin"]!=null||bO["stroke-linecap"]!=null){bL=bH.shape||bL;var bM=(bL.getElementsByTagName(a1)&&bL.getElementsByTagName(a1)[0]),bQ=false;!bM&&(bQ=bM=aw(a1));if("fill-opacity" in bO||"opacity" in bO){var d=((+bP["fill-opacity"]+1||2)-1)*((+bP.opacity+1||2)-1)*((+aG.getRGB(bO.fill).o+1||2)-1);d=bf(l(d,0),1);bM.opacity=d}bO.fill&&(bM.on=true);if(bM.on==null||bO.fill=="none"){bM.on=false}if(bM.on&&bO.fill){var e=bO.fill.match(h);if(e){bM.src=e[1];bM.type="tile"}else{bM.color=aG.getRGB(bO.fill).hex;bM.src=aM;bM.type="solid";if(aG.getRGB(bO.fill).error&&(bT.type in {circle:1,ellipse:1}||bA(bO.fill).charAt()!="r")&&g(bT,bO.fill)){bP.fill="none";bP.gradient=bO.fill}}}bQ&&bL[bh](bM);var E=(bL.getElementsByTagName("stroke")&&bL.getElementsByTagName("stroke")[0]),bR=false;!E&&(bR=E=aw("stroke"));if((bO.stroke&&bO.stroke!="none")||bO["stroke-width"]||bO["stroke-opacity"]!=null||bO["stroke-dasharray"]||bO["stroke-miterlimit"]||bO["stroke-linejoin"]||bO["stroke-linecap"]){E.on=true}(bO.stroke=="none"||E.on==null||bO.stroke==0||bO["stroke-width"]==0)&&(E.on=false);var bK=aG.getRGB(bO.stroke);E.on&&bO.stroke&&(E.color=bK.hex);d=((+bP["stroke-opacity"]+1||2)-1)*((+bP.opacity+1||2)-1)*((+bK.o+1||2)-1);var bI=(ai(bO["stroke-width"])||1)*0.75;d=bf(l(d,0),1);bO["stroke-width"]==null&&(bI=bP["stroke-width"]);bO["stroke-width"]&&(E.weight=bI);bI&&bI<1&&(d*=bI)&&(E.weight=1);E.opacity=d;bO["stroke-linejoin"]&&(E.joinstyle=bO["stroke-linejoin"]||"miter");E.miterlimit=bO["stroke-miterlimit"]||8;bO["stroke-linecap"]&&(E.endcap=bO["stroke-linecap"]=="butt"?"flat":bO["stroke-linecap"]=="square"?"square":"round");if(bO["stroke-dasharray"]){var bJ={"-":"shortdash",".":"shortdot","-.":"shortdashdot","-..":"shortdashdotdot",". ":"dot","- ":"dash","--":"longdash","- .":"dashdot","--.":"longdashdot","--..":"longdashdotdot"};E.dashstyle=bJ[af](bO["stroke-dasharray"])?bJ[bO["stroke-dasharray"]]:aM}bR&&bL[bh](E)}if(bT.type=="text"){S=bT.paper.span.style;bP.font&&(S.font=bP.font);bP["font-family"]&&(S.fontFamily=bP["font-family"]);bP["font-size"]&&(S.fontSize=bP["font-size"]);bP["font-weight"]&&(S.fontWeight=bP["font-weight"]);bP["font-style"]&&(S.fontStyle=bP["font-style"]);bT.node.string&&(bT.paper.span.innerHTML=bA(bT.node.string)[bp](/</g,"&#60;")[bp](/&/g,"&#38;")[bp](/\n/g,"<br>"));bT.W=bP.w=bT.paper.span.offsetWidth;bT.H=bP.h=bT.paper.span.offsetHeight;bT.X=bP.x;bT.Y=bP.y+ac(bT.H/2);switch(bP["text-anchor"]){case"start":bT.node.style["v-text-align"]="left";bT.bbx=ac(bT.W/2);break;case"end":bT.node.style["v-text-align"]="right";bT.bbx=-ac(bT.W/2);break;default:bT.node.style["v-text-align"]="center";break}}};g=function(b,bF){b.attrs=b.attrs||{};var bG=b.attrs,bI,R="linear",S=".5 .5";b.attrs.gradient=bF;bF=bA(bF)[bp](aL,function(bK,bL,i){R="radial";if(bL&&i){bL=ai(bL);i=ai(i);bi(bL-0.5,2)+bi(i-0.5,2)>0.25&&(i=an.sqrt(0.25-bi(bL-0.5,2))*((i>0.5)*2-1)+0.5);S=bL+aF+i}return aM});bF=bF[H](/\s*\-\s*/);if(R=="linear"){var d=bF.shift();d=-ai(d);if(isNaN(d)){return null}}var E=v(bF);if(!E){return null}b=b.shape||b.node;bI=b.getElementsByTagName(a1)[0]||aw(a1);!bI.parentNode&&b.appendChild(bI);if(E[r]){bI.on=true;bI.method="none";bI.color=E[0].color;bI.color2=E[E[r]-1].color;var bJ=[];for(var e=0,bH=E[r];e<bH;e++){E[e].offset&&bJ[j](E[e].offset+aF+E[e].color)}bI.colors&&(bI.colors.value=bJ[r]?bJ[aT]():"0% "+bI.color);if(R=="radial"){bI.type="gradientradial";bI.focus="100%";bI.focussize=S;bI.focusposition=S}else{bI.type="gradient";bI.angle=(270-d)%360}}return 1};aR=function(E,S,b){var R=0,e=0,d=0,i=1;this[0]=E;this.id=aG._oid++;this.node=E;E.raphael=this;this.X=0;this.Y=0;this.attrs={};this.Group=S;this.paper=b;this._={tx:0,ty:0,rt:{deg:0},sx:1,sy:1};!b.bottom&&(b.bottom=this);this.prev=b.top;b.top&&(b.top.next=this);b.top=this;this.next=null};a9=aR[bC];a9.rotate=function(d,b,e){if(this.removed){return this}if(d==null){if(this._.rt.cx){return[this._.rt.deg,this._.rt.cx,this._.rt.cy][aT](aF)}return this._.rt.deg}d=bA(d)[H](a);if(d[r]-1){b=ai(d[1]);e=ai(d[2])}d=ai(d[0]);if(b!=null){this._.rt.deg=d}else{this._.rt.deg+=d}e==null&&(b=null);this._.rt.cx=b;this._.rt.cy=e;this.setBox(this.attrs,b,e);this.Group.style.rotation=this._.rt.deg;return this};a9.setBox=function(E,R,e){if(this.removed){return this}var b=this.Group.style,S=(this.shape&&this.shape.style)||this.node.style;E=E||{};for(var bF in E){if(E[af](bF)){this.attrs[bF]=E[bF]}}R=R||this._.rt.cx;e=e||this._.rt.cy;var bI=this.attrs,bL,bK,bM,bH;switch(this.type){case"circle":bL=bI.cx-bI.r;bK=bI.cy-bI.r;bM=bH=bI.r*2;break;case"ellipse":bL=bI.cx-bI.rx;bK=bI.cy-bI.ry;bM=bI.rx*2;bH=bI.ry*2;break;case"image":bL=+bI.x;bK=+bI.y;bM=bI.width||0;bH=bI.height||0;break;case"text":this.textpath.v=["m",ac(bI.x),", ",ac(bI.y-2),"l",ac(bI.x)+1,", ",ac(bI.y-2)][aT](aM);bL=bI.x-ac(this.W/2);bK=bI.y-this.H/2;bM=this.W;bH=this.H;break;case"rect":case"path":if(!this.attrs.path){bL=0;bK=0;bM=this.paper.width;bH=this.paper.height}else{var bG=ah(this.attrs.path);bL=bG.x;bK=bG.y;bM=bG.width;bH=bG.height}break;default:bL=0;bK=0;bM=this.paper.width;bH=this.paper.height;break}R=(R==null)?bL+bM/2:R;e=(e==null)?bK+bH/2:e;var d=R-this.paper.width/2,bJ=e-this.paper.height/2,bN;b.left!=(bN=d+"px")&&(b.left=bN);b.top!=(bN=bJ+"px")&&(b.top=bN);this.X=s[af](this.type)?-d:bL;this.Y=s[af](this.type)?-bJ:bK;this.W=bM;this.H=bH;if(s[af](this.type)){S.left!=(bN=-d*t+"px")&&(S.left=bN);S.top!=(bN=-bJ*t+"px")&&(S.top=bN)}else{if(this.type=="text"){S.left!=(bN=-d+"px")&&(S.left=bN);S.top!=(bN=-bJ+"px")&&(S.top=bN)}else{b.width!=(bN=this.paper.width+"px")&&(b.width=bN);b.height!=(bN=this.paper.height+"px")&&(b.height=bN);S.left!=(bN=bL-d+"px")&&(S.left=bN);S.top!=(bN=bK-bJ+"px")&&(S.top=bN);S.width!=(bN=bM+"px")&&(S.width=bN);S.height!=(bN=bH+"px")&&(S.height=bN)}}};a9.hide=function(){!this.removed&&(this.Group.style.display="none");return this};a9.show=function(){!this.removed&&(this.Group.style.display="block");return this};a9.getBBox=function(){if(this.removed){return this}if(s[af](this.type)){return ah(this.attrs.path)}return{x:this.X+(this.bbx||0),y:this.Y,width:this.W,height:this.H}};a9.remove=function(){if(this.removed){return}aC(this,this.paper);this.node.parentNode.removeChild(this.node);this.Group.parentNode.removeChild(this.Group);this.shape&&this.shape.parentNode.removeChild(this.shape);for(var b in this){delete this[b]}this.removed=true};a9.attr=function(b,bF){if(this.removed){return this}if(b==null){var S={};for(var E in this.attrs){if(this.attrs[af](E)){S[E]=this.attrs[E]}}this._.rt.deg&&(S.rotation=this.rotate());(this._.sx!=1||this._.sy!=1)&&(S.scale=this.scale());S.gradient&&S.fill=="none"&&(S.fill=S.gradient)&&delete S.gradient;return S}if(bF==null&&aG.is(b,"string")){if(b=="translation"){return z.call(this)}if(b=="rotation"){return this.rotate()}if(b=="scale"){return this.scale()}if(b==a1&&this.attrs.fill=="none"&&this.attrs.gradient){return this.attrs.gradient}return this.attrs[b]}if(this.attrs&&bF==null&&aG.is(b,a4)){var bI,bH={};for(E=0,bI=b[r];E<bI;E++){bH[b[E]]=this.attr(b[E])}return bH}var d;if(bF!=null){d={};d[b]=bF}bF==null&&aG.is(b,"object")&&(d=b);if(d){for(var bG in this.paper.customAttributes){if(this.paper.customAttributes[af](bG)&&d[af](bG)&&aG.is(this.paper.customAttributes[bG],"function")){var R=this.paper.customAttributes[bG].apply(this,[][bt](d[bG]));this.attrs[bG]=d[bG];for(var e in R){if(R[af](e)){d[e]=R[e]}}}}if(d.text&&this.type=="text"){this.node.string=d.text}am(this,d);if(d.gradient&&(({circle:1,ellipse:1})[af](this.type)||bA(d.gradient).charAt()!="r")){g(this,d.gradient)}(!s[af](this.type)||this._.rt.deg)&&this.setBox(this.attrs)}return this};a9.toFront=function(){!this.removed&&this.Group.parentNode[bh](this.Group);this.paper.top!=this&&ak(this,this.paper);return this};a9.toBack=function(){if(this.removed){return this}if(this.Group.parentNode.firstChild!=this.Group){this.Group.parentNode.insertBefore(this.Group,this.Group.parentNode.firstChild);o(this,this.paper)}return this};a9.insertAfter=function(b){if(this.removed){return this}if(b.constructor==ag){b=b[b.length]}if(b.Group.nextSibling){b.Group.parentNode.insertBefore(this.Group,b.Group.nextSibling)}else{b.Group.parentNode[bh](this.Group)}I(this,b,this.paper);return this};a9.insertBefore=function(b){if(this.removed){return this}if(b.constructor==ag){b=b[0]}b.Group.parentNode.insertBefore(this.Group,b.Group);aJ(this,b,this.paper);return this};a9.blur=function(b){var d=this.node.runtimeStyle,e=d.filter;e=e.replace(bu,aM);if(+b!==0){this.attrs.blur=b;d.filter=e+aF+a2+".Blur(pixelradius="+(+b||1.5)+")";d.margin=aG.format("-{0}px 0 0 -{0}px",ac(+b||1.5))}else{d.filter=e;d.margin=0;delete this.attrs.blur}};ad=function(d,b,bF,R){var E=aw("group"),S=aw("oval"),e=S.style;E.style.cssText="position:absolute;left:0;top:0;width:"+d.width+"px;height:"+d.height+"px";E.coordsize=aU;E.coordorigin=d.coordorigin;E[bh](S);var i=new aR(S,E,d);i.type="circle";am(i,{stroke:"#000",fill:"none"});i.attrs.cx=b;i.attrs.cy=bF;i.attrs.r=R;i.setBox({x:b-R,y:bF-R,width:R*2,height:R*2});d.canvas[bh](E);return i};function aq(b,E,d,e,i){if(i){return aG.format("M{0},{1}l{2},0a{3},{3},0,0,1,{3},{3}l0,{5}a{3},{3},0,0,1,{4},{3}l{6},0a{3},{3},0,0,1,{4},{4}l0,{7}a{3},{3},0,0,1,{3},{4}z",b+i,E,d-i*2,i,-i,e-i*2,i*2-d,i*2-e)}else{return aG.format("M{0},{1}l{2},0,0,{3},{4},0z",b,E,d,e,-d)}}a8=function(d,S,E,bF,e,b){var bG=aq(S,E,bF,e,b),i=d.path(bG),R=i.attrs;i.X=R.x=S;i.Y=R.y=E;i.W=R.width=bF;i.H=R.height=e;R.r=b;R.path=bG;i.type="rect";return i};ax=function(b,bG,bF,e,d){var E=aw("group"),i=aw("oval"),S=i.style;E.style.cssText="position:absolute;left:0;top:0;width:"+b.width+"px;height:"+b.height+"px";E.coordsize=aU;E.coordorigin=b.coordorigin;E[bh](i);var R=new aR(i,E,b);R.type="ellipse";am(R,{stroke:"#000"});R.attrs.cx=bG;R.attrs.cy=bF;R.attrs.rx=e;R.attrs.ry=d;R.setBox({x:bG-e,y:bF-d,width:e*2,height:d*2});b.canvas[bh](E);return R};u=function(d,b,bF,S,bG,i){var E=aw("group"),e=aw("image");E.style.cssText="position:absolute;left:0;top:0;width:"+d.width+"px;height:"+d.height+"px";E.coordsize=aU;E.coordorigin=d.coordorigin;e.src=b;E[bh](e);var R=new aR(e,E,d);R.type="image";R.attrs.src=b;R.attrs.x=bF;R.attrs.y=S;R.attrs.w=bG;R.attrs.h=i;R.setBox({x:bF,y:S,width:bG,height:i});d.canvas[bh](E);return R};aj=function(d,bG,bF,bH){var E=aw("group"),i=aw("shape"),S=i.style,bI=aw("path"),b=bI.style,e=aw("textpath");E.style.cssText="position:absolute;left:0;top:0;width:"+d.width+"px;height:"+d.height+"px";E.coordsize=aU;E.coordorigin=d.coordorigin;bI.v=aG.format("m{0},{1}l{2},{1}",ac(bG*10),ac(bF*10),ac(bG*10)+1);bI.textpathok=true;S.width=d.width;S.height=d.height;e.string=bA(bH);e.on=true;i[bh](e);i[bh](bI);E[bh](i);var R=new aR(e,E,d);R.shape=i;R.textpath=bI;R.type="text";R.attrs.text=bH;R.attrs.x=bG;R.attrs.y=bF;R.attrs.w=1;R.attrs.h=1;am(R,{font:p.font,stroke:"none",fill:"#000"});R.setBox();d.canvas[bh](E);return R};by=function(e,b){var d=this.canvas.style;e==+e&&(e+="px");b==+b&&(b+="px");d.width=e;d.height=b;d.clip="rect(0 "+e+" "+b+" 0)";return this};var aw;Z.createStyleSheet().addRule(".rvml","behavior:url(#default#VML)");try{!Z.namespaces.rvml&&Z.namespaces.add("rvml","urn:schemas-microsoft-com:vml");aw=function(b){return Z.createElement("<rvml:"+b+' class="rvml">')}}catch(au){aw=function(b){return Z.createElement("<"+b+' xmlns="urn:schemas-microsoft.com:vml" class="rvml">')}}D=function(){var e=aH[bz](0,arguments),b=e.container,bG=e.height,bH,d=e.width,bF=e.x,S=e.y;if(!b){throw new Error("VML container not found.")}var E=new bw,R=E.canvas=Z.createElement("div"),i=R.style;bF=bF||0;S=S||0;d=d||512;bG=bG||342;d==+d&&(d+="px");bG==+bG&&(bG+="px");E.width=1000;E.height=1000;E.coordsize=t*1000+aF+t*1000;E.coordorigin="0 0";E.span=Z.createElement("span");E.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;";R[bh](E.span);i.cssText=aG.format("top:0;left:0;width:{0};height:{1};display:inline-block;position:relative;clip:rect(0 {0} {1} 0);overflow:hidden",d,bG);if(b==1){Z.body[bh](R);i.left=bF+"px";i.top=S+"px";i.position="absolute"}else{if(b.firstChild){b.insertBefore(R,b.firstChild)}else{b[bh](R)}}bb.call(E,E,aG.fn);return E};aW.clear=function(){this.canvas.innerHTML=aM;this.span=Z.createElement("span");this.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;";this.canvas[bh](this.span);this.bottom=this.top=null};aW.remove=function(){this.canvas.parentNode.removeChild(this.canvas);for(var b in this){this[b]=y(b)}return true}}var T=navigator.userAgent.match(/Version\/(.*?)\s/);if((navigator.vendor=="Apple Computer, Inc.")&&(T&&T[1]<4||navigator.platform.slice(0,2)=="iP")){aW.safari=function(){var b=this.rect(-99,-99,this.width+99,this.height+99).attr({stroke:"none"});aN.setTimeout(function(){b.remove()})}}else{aW.safari=function(){}}var N=function(){this.returnValue=false},bs=function(){return this.originalEvent.preventDefault()},a0=function(){this.cancelBubble=true},aB=function(){return this.originalEvent.stopPropagation()},at=(function(){if(Z.addEventListener){return function(R,i,e,d){var b=V&&bn[i]?bn[i]:i;var E=function(bH){if(V&&bn[af](i)){for(var bF=0,bG=bH.targetTouches&&bH.targetTouches.length;bF<bG;bF++){if(bH.targetTouches[bF].target==R){var S=bH;bH=bH.targetTouches[bF];bH.originalEvent=S;bH.preventDefault=bs;bH.stopPropagation=aB;break}}}return e.call(d,bH)};R.addEventListener(b,E,false);return function(){R.removeEventListener(b,E,false);return true}}}else{if(Z.attachEvent){return function(R,i,e,d){var E=function(S){S=S||aN.event;S.preventDefault=S.preventDefault||N;S.stopPropagation=S.stopPropagation||a0;return e.call(d,S)};R.attachEvent("on"+i,E);var b=function(){R.detachEvent("on"+i,E);return true};return b}}}})(),a5=[],bo=function(S){var bG=S.clientX,bF=S.clientY,bH=Z.documentElement.scrollTop||Z.body.scrollTop,bI=Z.documentElement.scrollLeft||Z.body.scrollLeft,b,d=a5.length;while(d--){b=a5[d];if(V){var R=S.touches.length,E;while(R--){E=S.touches[R];if(E.identifier==b.el._drag.id){bG=E.clientX;bF=E.clientY;(S.originalEvent?S.originalEvent:S).preventDefault();break}}}else{S.preventDefault()}bG+=bI;bF+=bH;b.move&&b.move.call(b.el,bG-b.el._drag.x,bF-b.el._drag.y,bG,bF)}},f=function(){aG.unmousemove(bo).unmouseup(f);var d=a5.length,b;while(d--){b=a5[d];b.el._drag={};b.end&&b.end.call(b.el)}a5=[]};for(var ap=P[r];ap--;){(function(b){aG[b]=aR[bC][b]=function(d){if(aG.is(d,"function")){this.events=this.events||[];this.events.push({name:b,f:d,unbind:at(this.shape||this.node||Z,b,d,this)})}return this};aG["un"+b]=aR[bC]["un"+b]=function(i){var e=this.events,d=e[r];while(d--){if(e[d].name==b&&e[d].f==i){e[d].unbind();e.splice(d,1);!e.length&&delete this.events;return this}}return this}})(P[ap])}a9.hover=function(d,b){return this.mouseover(d).mouseout(b)};a9.unhover=function(d,b){return this.unmouseover(d).unmouseout(b)};a9.drag=function(b,e,d){this._drag={};this.mousedown(function(E){(E.originalEvent||E).preventDefault();var i=Z.documentElement.scrollTop||Z.body.scrollTop,R=Z.documentElement.scrollLeft||Z.body.scrollLeft;this._drag.x=E.clientX+R;this._drag.y=E.clientY+i;this._drag.id=E.identifier;e&&e.call(this,E.clientX+R,E.clientY+i);!a5.length&&aG.mousemove(bo).mouseup(f);a5.push({el:this,move:b,end:d})});return this};a9.undrag=function(b,E,e){var d=a5.length;while(d--){a5[d].el==this&&(a5[d].move==b&&a5[d].end==e)&&a5.splice(d,1);!a5.length&&aG.unmousemove(bo).unmouseup(f)}};aW.circle=function(b,e,d){return ad(this,b||0,e||0,d||0)};aW.rect=function(b,E,d,e,i){return a8(this,b||0,E||0,d||0,e||0,i||0)};aW.ellipse=function(b,i,e,d){return ax(this,b||0,i||0,e||0,d||0)};aW.path=function(b){b&&!aG.is(b,ae)&&!aG.is(b[0],a4)&&(b+=aM);return w(aG.format[bz](aG,arguments),this)};aW.image=function(i,b,E,d,e){return u(this,i||"about:blank",b||0,E||0,d||0,e||0)};aW.text=function(b,e,d){return aj(this,b||0,e||0,bA(d))};aW.set=function(b){arguments[r]>1&&(b=Array[bC].splice.call(arguments,0,arguments[r]));return new ag(b)};aW.setSize=by;aW.top=aW.bottom=null;aW.raphael=aG;function B(){return this.x+aF+this.y}a9.resetScale=function(){if(this.removed){return this}this._.sx=1;this._.sy=1;this.attrs.scale="1 1"};a9.scale=function(bK,bJ,e,d){if(this.removed){return this}if(bK==null&&bJ==null){return{x:this._.sx,y:this._.sy,toString:B}}bJ=bJ||bK;!+bJ&&(bJ=bK);var bO,bM,bN,bL,b0=this.attrs;if(bK!=0){var bI=this.getBBox(),bF=bI.x+bI.width/2,E=bI.y+bI.height/2,bZ=bK/this._.sx,bY=bJ/this._.sy;e=(+e||e==0)?e:bF;d=(+d||d==0)?d:E;var bH=~~(bK/an.abs(bK)),S=~~(bJ/an.abs(bJ)),bR=this.node.style,b2=e+(bF-e)*bZ,b1=d+(E-d)*bY;switch(this.type){case"rect":case"image":var bG=b0.width*bH*bZ,bQ=b0.height*S*bY;this.attr({height:bQ,r:b0.r*bf(bH*bZ,S*bY),width:bG,x:b2-bG/2,y:b1-bQ/2});break;case"circle":case"ellipse":this.attr({rx:b0.rx*bH*bZ,ry:b0.ry*S*bY,r:b0.r*bf(bH*bZ,S*bY),cx:b2,cy:b1});break;case"text":this.attr({x:b2,y:b1});break;case"path":var bT=ar(b0.path),bU=true;for(var bW=0,bP=bT[r];bW<bP;bW++){var bS=bT[bW],R=bl.call(bS[0]);if(R=="M"&&bU){continue}else{bU=false}if(R=="A"){bS[bT[bW][r]-2]*=bZ;bS[bT[bW][r]-1]*=bY;bS[1]*=bH*bZ;bS[2]*=S*bY;bS[5]=+!(bH+S?!+bS[5]:+bS[5])}else{if(R=="H"){for(var bV=1,bX=bS[r];bV<bX;bV++){bS[bV]*=bZ}}else{if(R=="V"){for(bV=1,bX=bS[r];bV<bX;bV++){bS[bV]*=bY}}else{for(bV=1,bX=bS[r];bV<bX;bV++){bS[bV]*=(bV%2)?bZ:bY}}}}}var b=ah(bT);bO=b2-b.x-b.width/2;bM=b1-b.y-b.height/2;bT[0][1]+=bO;bT[0][2]+=bM;this.attr({path:bT});break}if(this.type in {text:1,image:1}&&(bH!=1||S!=1)){if(this.transformations){this.transformations[2]="scale("[bt](bH,",",S,")");this.node[C]("transform",this.transformations[aT](aF));bO=(bH==-1)?-b0.x-(bG||0):b0.x;bM=(S==-1)?-b0.y-(bQ||0):b0.y;this.attr({x:bO,y:bM});b0.fx=bH-1;b0.fy=S-1}else{this.node.filterMatrix=a2+".Matrix(M11="[bt](bH,", M12=0, M21=0, M22=",S,", Dx=0, Dy=0, sizingmethod='auto expand', filtertype='bilinear')");bR.filter=(this.node.filterMatrix||aM)+(this.node.filterOpacity||aM)}}else{if(this.transformations){this.transformations[2]=aM;this.node[C]("transform",this.transformations[aT](aF));b0.fx=0;b0.fy=0}else{this.node.filterMatrix=aM;bR.filter=(this.node.filterMatrix||aM)+(this.node.filterOpacity||aM)}}b0.scale=[bK,bJ,e,d][aT](aF);this._.sx=bK;this._.sy=bJ}return this};a9.clone=function(){if(this.removed){return null}var b=this.attr();delete b.scale;delete b.translation;return this.paper[this.type]().attr(b)};var aZ={},k=function(R,d,bH,bG,bN,bM,bL,bK,S){var bJ=0,E=[R,d,bH,bG,bN,bM,bL,bK].join(),b=aZ[E],bF,e;!b&&(aZ[E]=b={data:[]});b.timer&&clearTimeout(b.timer);b.timer=setTimeout(function(){delete aZ[E]},2000);for(var bI=0;bI<101;bI++){if(b.data[S]>bI){e=b.data[bI*100]}else{e=aG.findDotsAtSegment(R,d,bH,bG,bN,bM,bL,bK,bI/100);b.data[bI]=e}bI&&(bJ+=bi(bi(bF.x-e.x,2)+bi(bF.y-e.y,2),0.5));if(S!=null&&bJ>=S){return e}bF=e}if(S==null){return bJ}},aY=function(b,d){return function(bN,R,S){bN=U(bN);var bJ,bI,e,bF,E="",bM={},bK,bH=0;for(var bG=0,bL=bN.length;bG<bL;bG++){e=bN[bG];if(e[0]=="M"){bJ=+e[1];bI=+e[2]}else{bF=k(bJ,bI,e[1],e[2],e[3],e[4],e[5],e[6]);if(bH+bF>R){if(d&&!bM.start){bK=k(bJ,bI,e[1],e[2],e[3],e[4],e[5],e[6],R-bH);E+=["C",bK.start.x,bK.start.y,bK.m.x,bK.m.y,bK.x,bK.y];if(S){return E}bM.start=E;E=["M",bK.x,bK.y+"C",bK.n.x,bK.n.y,bK.end.x,bK.end.y,e[5],e[6]][aT]();bH+=bF;bJ=+e[5];bI=+e[6];continue}if(!b&&!d){bK=k(bJ,bI,e[1],e[2],e[3],e[4],e[5],e[6],R-bH);return{x:bK.x,y:bK.y,alpha:bK.alpha}}}bH+=bF;bJ=+e[5];bI=+e[6]}E+=e}bM.end=E;bK=b?bH:d?bM:aG.findDotsAtSegment(bJ,bI,e[1],e[2],e[3],e[4],e[5],e[6],1);bK.alpha&&(bK={x:bK.x,y:bK.y,alpha:bK.alpha});return bK}};var aI=aY(1),K=aY(),X=aY(0,1);a9.getTotalLength=function(){if(this.type!="path"){return}if(this.node.getTotalLength){return this.node.getTotalLength()}return aI(this.attrs.path)};a9.getPointAtLength=function(b){if(this.type!="path"){return}if(this.node.getPointAtLength){return this.node.getPointAtLength(b)}return K(this.attrs.path,b)};a9.getSubpath=function(e,d){if(this.type!="path"){return}if(an.abs(this.getTotalLength()-d)<"1e-6"){return X(this.attrs.path,e).end}var b=X(this.attrs.path,d,1);return e?X(b,e).end:b};aG.easing_formulas={linear:function(b){return b},"<":function(b){return bi(b,3)},">":function(b){return bi(b-1,3)+1},"<>":function(b){b=b*2;if(b<1){return bi(b,3)/2}b-=2;return(bi(b,3)+2)/2},backIn:function(d){var b=1.70158;return d*d*((b+1)*d-b)},backOut:function(d){d=d-1;var b=1.70158;return d*d*((b+1)*d+b)+1},elastic:function(e){if(e==0||e==1){return e}var d=0.3,b=d/4;return bi(2,-10*e)*an.sin((e-b)*(2*an.PI)/d)+1},bounce:function(i){var d=7.5625,e=2.75,b;if(i<(1/e)){b=d*i*i}else{if(i<(2/e)){i-=(1.5/e);b=d*i*i+0.75}else{if(i<(2.5/e)){i-=(2.25/e);b=d*i*i+0.9375}else{i-=(2.625/e);b=d*i*i+0.984375}}}return b}};var W=[],br=function(){var bG=+new Date;for(var bR=0;bR<W[r];bR++){var bW=W[bR];if(bW.stop||bW.el.removed){continue}var R=bG-bW.start,bO=bW.ms,bN=bW.easing,bS=bW.from,bL=bW.diff,d=bW.to,bK=bW.t,bF=bW.el,bM={},b;if(R<bO){var E=bN(R/bO);for(var bP in bS){if(bS[af](bP)){switch(al[bP]){case"along":b=E*bO*bL[bP];d.back&&(b=d.len-b);var bQ=K(d[bP],b);bF.translate(bL.sx-bL.x||0,bL.sy-bL.y||0);bL.x=bQ.x;bL.y=bQ.y;bF.translate(bQ.x-bL.sx,bQ.y-bL.sy);d.rot&&bF.rotate(bL.r+bQ.alpha,bQ.x,bQ.y);break;case aD:b=+bS[bP]+E*bO*bL[bP];break;case"colour":b="rgb("+[J(ac(bS[bP].r+E*bO*bL[bP].r)),J(ac(bS[bP].g+E*bO*bL[bP].g)),J(ac(bS[bP].b+E*bO*bL[bP].b))][aT](",")+")";break;case"path":b=[];for(var bU=0,bJ=bS[bP][r];bU<bJ;bU++){b[bU]=[bS[bP][bU][0]];for(var bT=1,bV=bS[bP][bU][r];bT<bV;bT++){b[bU][bT]=+bS[bP][bU][bT]+E*bO*bL[bP][bU][bT]}b[bU]=b[bU][aT](aF)}b=b[aT](aF);break;case"csv":switch(bP){case"translation":var bI=E*bO*bL[bP][0]-bK.x,bH=E*bO*bL[bP][1]-bK.y;bK.x+=bI;bK.y+=bH;b=bI+aF+bH;break;case"rotation":b=+bS[bP][0]+E*bO*bL[bP][0];bS[bP][1]&&(b+=","+bS[bP][1]+","+bS[bP][2]);break;case"scale":b=[+bS[bP][0]+E*bO*bL[bP][0],+bS[bP][1]+E*bO*bL[bP][1],(2 in d[bP]?d[bP][2]:aM),(3 in d[bP]?d[bP][3]:aM)][aT](aF);break;case"clip-rect":b=[];bU=4;while(bU--){b[bU]=+bS[bP][bU]+E*bO*bL[bP][bU]}break}break;default:var S=[].concat(bS[bP]);b=[];bU=bF.paper.customAttributes[bP].length;while(bU--){b[bU]=+S[bU]+E*bO*bL[bP][bU]}break}bM[bP]=b}}bF.attr(bM);bF._run&&bF._run.call(bF)}else{if(d.along){bQ=K(d.along,d.len*!d.back);bF.translate(bL.sx-(bL.x||0)+bQ.x-bL.sx,bL.sy-(bL.y||0)+bQ.y-bL.sy);d.rot&&bF.rotate(bL.r+bQ.alpha,bQ.x,bQ.y)}(bK.x||bK.y)&&bF.translate(-bK.x,-bK.y);d.scale&&(d.scale+=aM);bF.attr(d);W.splice(bR--,1)}}aG.svg&&bF&&bF.paper&&bF.paper.safari();W[r]&&setTimeout(br)},bv=function(b,e,R,E,i){var d=R-E;e.timeouts.push(setTimeout(function(){aG.is(i,"function")&&i.call(e);e.animate(b,d,b.easing)},E))},J=function(b){return l(bf(b,255),0)},z=function(b,e){if(b==null){return{x:this._.tx,y:this._.ty,toString:B}}this._.tx+=+b;this._.ty+=+e;switch(this.type){case"circle":case"ellipse":this.attr({cx:+b+this.attrs.cx,cy:+e+this.attrs.cy});break;case"rect":case"image":case"text":this.attr({x:+b+this.attrs.x,y:+e+this.attrs.y});break;case"path":var d=ar(this.attrs.path);d[0][1]+=+b;d[0][2]+=+e;this.attr({path:d});break}return this};a9.animateWith=function(e,R,b,bF,S){for(var d=0,E=W.length;d<E;d++){if(W[d].el.id==e.id){R.start=W[d].start}}return this.animate(R,b,bF,S)};a9.animateAlong=aS();a9.animateAlongBack=aS(1);function aS(b){return function(i,e,d,R){var E={back:b};aG.is(d,"function")?(R=d):(E.rot=d);i&&i.constructor==aR&&(i=i.attrs.path);i&&(E.along=i);return this.animate(E,e,R)}}function aV(bL,i,d,bK,bJ,bF){var bG=3*i,bI=3*(bK-i)-bG,b=1-bG-bI,S=3*d,bH=3*(bJ-d)-S,bM=1-S-bH;function R(bN){return((b*bN+bI)*bN+bG)*bN}function e(bN,bP){var bO=E(bN,bP);return((bM*bO+bH)*bO+S)*bO}function E(bN,bU){var bT,bS,bQ,bO,bR,bP;for(bQ=bN,bP=0;bP<8;bP++){bO=R(bQ)-bN;if(an.abs(bO)<bU){return bQ}bR=(3*b*bQ+2*bI)*bQ+bG;if(an.abs(bR)<0.000001){break}bQ=bQ-bO/bR}bT=0;bS=1;bQ=bN;if(bQ<bT){return bT}if(bQ>bS){return bS}while(bT<bS){bO=R(bQ);if(an.abs(bO-bN)<bU){return bQ}if(bN>bO){bT=bQ}else{bS=bQ}bQ=(bS-bT)/2+bT}return bQ}return e(bL,1/(200*bF))}a9.onAnimation=function(b){this._run=b||0;return this};a9.animate=function(bY,bO,bN,R){var d=this;d.timeouts=d.timeouts||[];if(aG.is(bN,"function")||!bN){R=bN||null}if(d.removed){R&&R.call(d);return d}var bS={},e={},S=false,bJ={};for(var bP in bY){if(bY[af](bP)){if(al[af](bP)||d.paper.customAttributes[af](bP)){S=true;bS[bP]=d.attr(bP);(bS[bP]==null)&&(bS[bP]=p[bP]);e[bP]=bY[bP];switch(al[bP]){case"along":var bW=aI(bY[bP]);var bQ=K(bY[bP],bW*!!bY.back);var bF=d.getBBox();bJ[bP]=bW/bO;bJ.tx=bF.x;bJ.ty=bF.y;bJ.sx=bQ.x;bJ.sy=bQ.y;e.rot=bY.rot;e.back=bY.back;e.len=bW;bY.rot&&(bJ.r=ai(d.rotate())||0);break;case aD:bJ[bP]=(e[bP]-bS[bP])/bO;break;case"colour":bS[bP]=aG.getRGB(bS[bP]);var bR=aG.getRGB(e[bP]);bJ[bP]={r:(bR.r-bS[bP].r)/bO,g:(bR.g-bS[bP].g)/bO,b:(bR.b-bS[bP].b)/bO};break;case"path":var bG=U(bS[bP],e[bP]);bS[bP]=bG[0];var bL=bG[1];bJ[bP]=[];for(var bV=0,bI=bS[bP][r];bV<bI;bV++){bJ[bP][bV]=[0];for(var bU=1,bX=bS[bP][bV][r];bU<bX;bU++){bJ[bP][bV][bU]=(bL[bV][bU]-bS[bP][bV][bU])/bO}}break;case"csv":var b=bA(bY[bP])[H](a),bH=bA(bS[bP])[H](a);switch(bP){case"translation":bS[bP]=[0,0];bJ[bP]=[b[0]/bO,b[1]/bO];break;case"rotation":bS[bP]=(bH[1]==b[1]&&bH[2]==b[2])?bH:[0,b[1],b[2]];bJ[bP]=[(b[0]-bS[bP][0])/bO,0,0];break;case"scale":bY[bP]=b;bS[bP]=bA(bS[bP])[H](a);bJ[bP]=[(b[0]-bS[bP][0])/bO,(b[1]-bS[bP][1])/bO,0,0];break;case"clip-rect":bS[bP]=bA(bS[bP])[H](a);bJ[bP]=[];bV=4;while(bV--){bJ[bP][bV]=(b[bV]-bS[bP][bV])/bO}break}e[bP]=b;break;default:b=[].concat(bY[bP]);bH=[].concat(bS[bP]);bJ[bP]=[];bV=d.paper.customAttributes[bP][r];while(bV--){bJ[bP][bV]=((b[bV]||0)-(bH[bV]||0))/bO}break}}}}if(!S){var bM=[],E;for(var bZ in bY){if(bY[af](bZ)&&bc.test(bZ)){bP={value:bY[bZ]};bZ=="from"&&(bZ=0);bZ=="to"&&(bZ=100);bP.key=Q(bZ,10);bM.push(bP)}}bM.sort(bj);if(bM[0].key){bM.unshift({key:0,value:d.attrs})}for(bV=0,bI=bM[r];bV<bI;bV++){bv(bM[bV].value,d,bO/100*bM[bV].key,bO/100*(bM[bV-1]&&bM[bV-1].key||0),bM[bV-1]&&bM[bV-1].value.callback)}E=bM[bM[r]-1].value.callback;if(E){d.timeouts.push(setTimeout(function(){E.call(d)},bO))}}else{var bT=aG.easing_formulas[bN];if(!bT){bT=bA(bN).match(c);if(bT&&bT[r]==5){var bK=bT;bT=function(i){return aV(i,+bK[1],+bK[2],+bK[3],+bK[4],bO)}}else{bT=function(i){return i}}}W.push({start:bY.start||+new Date,ms:bO,easing:bT,from:bS,diff:bJ,to:e,el:d,t:{x:0,y:0}});aG.is(R,"function")&&(d._ac=setTimeout(function(){R.call(d)},bO));W[r]==1&&setTimeout(br)}return this};a9.stop=function(){for(var b=0;b<W.length;b++){W[b].el.id==this.id&&W.splice(b--,1)}for(b=0,ii=this.timeouts&&this.timeouts.length;b<ii;b++){clearTimeout(this.timeouts[b])}this.timeouts=[];clearTimeout(this._ac);delete this._ac;return this};a9.translate=function(b,d){return this.attr({translation:b+" "+d})};a9[aX]=function(){return"Rapha\xebl\u2019s object"};aG.ae=W;var ag=function(b){this.items=[];this[r]=0;this.type="set";if(b){for(var d=0,e=b[r];d<e;d++){if(b[d]&&(b[d].constructor==aR||b[d].constructor==ag)){this[this.items[r]]=this.items[this.items[r]]=b[d];this[r]++}}}};ag[bC][j]=function(){var E,b;for(var d=0,e=arguments[r];d<e;d++){E=arguments[d];if(E&&(E.constructor==aR||E.constructor==ag)){b=this.items[r];this[b]=this.items[b]=E;this[r]++}}return this};ag[bC].pop=function(){delete this[this[r]--];return this.items.pop()};for(var G in a9){if(a9[af](G)){ag[bC][G]=(function(b){return function(){for(var d=0,e=this.items[r];d<e;d++){this.items[d][b][bz](this.items[d],arguments)}return this}})(G)}}ag[bC].attr=function(d,S){if(d&&aG.is(d,a4)&&aG.is(d[0],"object")){for(var b=0,R=d[r];b<R;b++){this.items[b].attr(d[b])}}else{for(var e=0,E=this.items[r];e<E;e++){this.items[e].attr(d,S)}}return this};ag[bC].animate=function(d,b,S,bG){(aG.is(S,"function")||!S)&&(bG=S||null);var R=this.items[r],e=R,bH,bF=this,E;bG&&(E=function(){!--R&&bG.call(bF)});S=aG.is(S,ae)?S:E;bH=this.items[--e].animate(d,b,S,E);while(e--){this.items[e]&&!this.items[e].removed&&this.items[e].animateWith(bH,d,b,S,E)}return this};ag[bC].insertAfter=function(d){var b=this.items[r];while(b--){this.items[b].insertAfter(d)}return this};ag[bC].getBBox=function(){var b=[],S=[],d=[],E=[];for(var e=this.items[r];e--;){var R=this.items[e].getBBox();b[j](R.x);S[j](R.y);d[j](R.x+R.width);E[j](R.y+R.height)}b=bf[bz](0,b);S=bf[bz](0,S);return{x:b,y:S,width:l[bz](0,d)-b,height:l[bz](0,E)-S}};ag[bC].clone=function(e){e=new ag;for(var b=0,d=this.items[r];b<d;b++){e[j](this.items[b].clone())}return e};aG.registerFont=function(d){if(!d.face){return d}this.fonts=this.fonts||{};var i={w:d.w,face:{},glyphs:{}},e=d.face["font-family"];for(var S in d.face){if(d.face[af](S)){i.face[S]=d.face[S]}}if(this.fonts[e]){this.fonts[e][j](i)}else{this.fonts[e]=[i]}if(!d.svg){i.face["units-per-em"]=Q(d.face["units-per-em"],10);for(var E in d.glyphs){if(d.glyphs[af](E)){var R=d.glyphs[E];i.glyphs[E]={w:R.w,k:{},d:R.d&&"M"+R.d[bp](/[mlcxtrv]/g,function(bF){return{l:"L",c:"C",x:"z",t:"m",r:"l",v:"c"}[bF]||"M"})+"z"};if(R.k){for(var b in R.k){if(R[af](b)){i.glyphs[E].k[b]=R.k[b]}}}}}}return d};aW.getFont=function(bG,bH,d,E){E=E||"normal";d=d||"normal";bH=+bH||{normal:400,bold:700,lighter:300,bolder:800}[bH]||400;if(!aG.fonts){return}var R=aG.fonts[bG];if(!R){var e=new RegExp("(^|\\s)"+bG[bp](/[^\w\d\s+!~.:_-]/g,aM)+"(\\s|$)","i");for(var b in aG.fonts){if(aG.fonts[af](b)){if(e.test(b)){R=aG.fonts[b];break}}}}var S;if(R){for(var bF=0,bI=R[r];bF<bI;bF++){S=R[bF];if(S.face["font-weight"]==bH&&(S.face["font-style"]==d||!S.face["font-style"])&&S.face["font-stretch"]==E){break}}}return S};aW.print=function(R,E,b,bG,bH,bQ,d){bQ=bQ||"middle";d=l(bf(d||0,1),-1);var bM=this.set(),bP=bA(b)[H](aM),bN=0,bK=aM,bR;aG.is(bG,b)&&(bG=this.getFont(bG));if(bG){bR=(bH||16)/bG.face["units-per-em"];var e=bG.face.bbox.split(a),bF=+e[0],bI=+e[1]+(bQ=="baseline"?e[3]-e[1]+(+bG.face.descent):(e[3]-e[1])/2);for(var bL=0,S=bP[r];bL<S;bL++){var bJ=bL&&bG.glyphs[bP[bL-1]]||{},bO=bG.glyphs[bP[bL]];bN+=bL?(bJ.w||bG.w)+(bJ.k&&bJ.k[bP[bL]]||0)+(bG.w*d):0;bO&&bO.d&&bM[j](this.path(bO.d).attr({fill:"#000",stroke:"none",translation:[bN,0]}))}bM.scale(bR,bR,bF,bI).translate(R-bF,E-bI)}return bM};aG.format=function(d,e){var b=aG.is(e,a4)?[0][bt](e):arguments;d&&aG.is(d,ae)&&b[r]-1&&(d=d[bp](bk,function(R,E){return b[++E]==null?aM:b[E]}));return d||aM};aG.ninja=function(){q.was?(aN.Raphael=q.is):delete Raphael;return aG};aG.el=a9;aG.st=ag[bC];q.was?(aN.Raphael=aG):(Raphael=aG)})();
\ No newline at end of file
index b55a741..92a6007 100644 (file)
@@ -1,11 +1,10 @@
 /*!
- * Raphael 1.4.7 - JavaScript Vector Library
+ * Raphael 1.5.0 - JavaScript Vector Library
  *
  * Copyright (c) 2010 Dmitry Baranovskiy (http://raphaeljs.com)
  * Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license.
  */
-Raphael = (function () {
+(function () {
     function R() {
         if (R.is(arguments[0], array)) {
             var a = arguments[0],
@@ -13,15 +12,16 @@ Raphael = (function () {
                 res = cnv.set();
             for (var i = 0, ii = a[length]; i < ii; i++) {
                 var j = a[i] || {};
-                elements.test(j.type) && res[push](cnv[j.type]().attr(j));
+                elements[has](j.type) && res[push](cnv[j.type]().attr(j));
             }
             return res;
         }
         return create[apply](R, arguments);
     }
-    R.version = "1.4.7";
+    R.version = "1.5.0";
     var separator = /[, ]+/,
-        elements = /^(circle|rect|path|ellipse|text|image)$/,
+        elements = {circle: 1, rect: 1, path: 1, ellipse: 1, text: 1, image: 1},
+        formatrg = /\{(\d+)\}/g,
         proto = "prototype",
         has = "hasOwnProperty",
         doc = document,
@@ -30,7 +30,10 @@ Raphael = (function () {
             was: Object[proto][has].call(win, "Raphael"),
             is: win.Raphael
         },
-        Paper = function () {},
+        Paper = function () {
+            this.customAttributes = {};
+        },
+        paperproto,
         appendChild = "appendChild",
         apply = "apply",
         concat = "concat",
@@ -47,10 +50,11 @@ Raphael = (function () {
         },
         join = "join",
         length = "length",
-        lowerCase = String[proto].toLowerCase,
+        lowerCase = Str[proto].toLowerCase,
         math = Math,
         mmax = math.max,
         mmin = math.min,
+        pow = math.pow,
         nu = "number",
         string = "string",
         array = "array",
@@ -58,20 +62,31 @@ Raphael = (function () {
         fillString = "fill",
         objectToString = Object[proto][toString],
         paper = {},
-        pow = math.pow,
         push = "push",
         rg = /^(?=[\da-f]$)/,
         ISURL = /^url\(['"]?([^\)]+?)['"]?\)$/i,
         colourRegExp = /^\s*((#[a-f\d]{6})|(#[a-f\d]{3})|rgba?\(\s*([\d\.]+\s*,\s*[\d\.]+\s*,\s*[\d\.]+(?:\s*,\s*[\d\.]+)?)\s*\)|rgba?\(\s*([\d\.]+%\s*,\s*[\d\.]+%\s*,\s*[\d\.]+%(?:\s*,\s*[\d\.]+%)?)\s*\)|hsb\(\s*([\d\.]+(?:deg|\xb0)?\s*,\s*[\d\.]+\s*,\s*[\d\.]+)\s*\)|hsb\(\s*([\d\.]+(?:deg|\xb0|%)\s*,\s*[\d\.]+%\s*,\s*[\d\.]+%)\s*\)|hsl\(\s*([\d\.]+(?:deg|\xb0)?\s*,\s*[\d\.]+\s*,\s*[\d\.]+)\s*\)|hsl\(\s*([\d\.]+(?:deg|\xb0|%)\s*,\s*[\d\.]+%\s*,\s*[\d\.]+%)\s*\))\s*$/i,
+        isnan = /^(NaN|-?Infinity)$/,
+        bezierrg = /^cubic-bezier\(([^,]+),([^,]+),([^,]+),([^\)]+)\)/,
         round = math.round,
         setAttribute = "setAttribute",
         toFloat = parseFloat,
         toInt = parseInt,
         ms = " progid:DXImageTransform.Microsoft",
-        upperCase = String[proto].toUpperCase,
+        upperCase = Str[proto].toUpperCase,
         availableAttrs = {blur: 0, "clip-rect": "0 0 1e9 1e9", cursor: "default", cx: 0, cy: 0, fill: "#fff", "fill-opacity": 1, font: '10px "Arial"', "font-family": '"Arial"', "font-size": "10", "font-style": "normal", "font-weight": 400, gradient: 0, height: 0, href: "http://raphaeljs.com/", opacity: 1, path: "M0,0", r: 0, rotation: 0, rx: 0, ry: 0, scale: "1 1", src: "", stroke: "#000", "stroke-dasharray": "", "stroke-linecap": "butt", "stroke-linejoin": "butt", "stroke-miterlimit": 0, "stroke-opacity": 1, "stroke-width": 1, target: "_blank", "text-anchor": "middle", title: "Raphael", translation: "0 0", width: 0, x: 0, y: 0},
         availableAnimAttrs = {along: "along", blur: nu, "clip-rect": "csv", cx: nu, cy: nu, fill: "colour", "fill-opacity": nu, "font-size": nu, height: nu, opacity: nu, path: "path", r: nu, rotation: "csv", rx: nu, ry: nu, scale: "csv", stroke: "colour", "stroke-opacity": nu, "stroke-width": nu, translation: "csv", width: nu, x: nu, y: nu},
-        rp = "replace";
+        rp = "replace",
+        p2s = /,?([achlmqrstvxz]),?/gi,
+        commaSpaces = /\s*,\s*/,
+        hsrg = {hs: 1, rg: 1},
+        animKeyFrames= /^(from|to|\d+%)$/,
+        pathCommand = /([achlmqstvz])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?\s*,?\s*)+)/ig,
+        pathValues = /(-?\d*\.?\d*(?:e[-+]?\d+)?)\s*,?\s*/ig,
+        sortByKey = function (a, b) {
+            return a.key - b.key;
+        };
+
     R.type = (win.SVGAngle || doc.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") ? "SVG" : "VML");
     if (R.type == "VML") {
         var d = doc.createElement("div"),
@@ -86,16 +101,41 @@ Raphael = (function () {
     }
     R.svg = !(R.vml = R.type == "VML");
     Paper[proto] = R[proto];
+    paperproto = Paper[proto];
     R._id = 0;
     R._oid = 0;
     R.fn = {};
     R.is = function (o, type) {
         type = lowerCase.call(type);
-        return  (type == "object" && o === Object(o)) ||
-                (type == "undefined" && typeof o == type) ||
-                (type == "null" && o == null) ||
+        if (type == "finite") {
+            return !isnan.test(+o);
+        }
+        return  (type == "null" && o === null) ||
+                (type == typeof o) ||
+                (type == "object" && o === Object(o)) ||
                 (type == "array" && Array.isArray && Array.isArray(o)) ||
-                lowerCase.call(objectToString.call(o).slice(8, -1)) == type;
+                objectToString.call(o).slice(8, -1).toLowerCase() == type;
+    };
+    R.angle = function (x1, y1, x2, y2, x3, y3) {
+        if (x3 == null) {
+            var x = x1 - x2,
+                y = y1 - y2;
+            if (!x && !y) {
+                return 0;
+            }
+            return ((x < 0) * 180 + math.atan(-y / -x) * 180 / math.PI + 360) % 360;
+        } else {
+            return R.angle(x1, y1, x3, y3) - R.angle(x2, y2, x3, y3);
+        }
+    };
+    R.snapTo = function (values, value, tolerance) {
+        tolerance = tolerance || 10;
+        values = [][concat](values);
+        var i = values.length;
+        while (i--) if (math.abs(values[i] - value) <= tolerance) {
+            return values[i];
+        }
+        return value;
     };
 
     R.setWindow = function (newwin) {
@@ -107,20 +147,19 @@ Raphael = (function () {
         if (R.vml) {
             // http://dean.edwards.name/weblog/2009/10/convert-any-colour-value-to-hex-in-msie/
             var trim = /^\s+|\s+$/g;
+            var bod;
+            try {
+                var docum = new ActiveXObject("htmlfile");
+                docum.write("<body>");
+                docum.close();
+                bod = docum.body;
+            } catch(e) {
+                bod = createPopup().document.body;
+            }
+            var range = bod.createTextRange();
             toHex = cacher(function (color) {
-                var bod;
-                color = Str(color)[rp](trim, E);
                 try {
-                    var docum = new win.ActiveXObject("htmlfile");
-                    docum.write("<body>");
-                    docum.close();
-                    bod = docum.body;
-                } catch(e) {
-                    bod = win.createPopup().document.body;
-                }
-                var range = bod.createTextRange();
-                try {
-                    bod.style.color = color;
+                    bod.style.color = Str(color)[rp](trim, E);
                     var value = range.queryCommandValue("ForeColor");
                     value = ((value & 255) << 16) | (value & 65280) | ((value & 16711680) >>> 16);
                     return "#" + ("000000" + value[toString](16)).slice(-6);
@@ -164,9 +203,9 @@ Raphael = (function () {
             h = h.h;
         }
         if (h > 1 || s > 1 || l > 1) {
-            h /= 255;
-            s /= 255;
-            l /= 255;
+            h /= 360;
+            s /= 100;
+            l /= 100;
         }
         var rgb = {},
             channels = ["r", "g", "b"],
@@ -295,9 +334,6 @@ Raphael = (function () {
         hsl.toString = hsltoString;
         return hsl;
     };
-    var p2s = /,?([achlmqrstvxz]),?/gi,
-        commaSpaces = /\s*,\s*/,
-        hsrg = {hs: 1, rg: 1};
     R._path2string = function () {
         return this.join(",")[rp](p2s, "$1");
     };
@@ -418,8 +454,6 @@ Raphael = (function () {
         delete this.start;
     };
     // path utilities
-    var pathCommand = /([achlmqstvz])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?\s*,?\s*)+)/ig,
-        pathValues = /(-?\d*\.?\d*(?:e[-+]?\d+)?)\s*,?\s*/ig;
     R.parsePathString = cacher(function (pathString) {
         if (!pathString) {
             return null;
@@ -715,8 +749,8 @@ Raphael = (function () {
                         math.sqrt(math.abs((rx2 * ry2 - rx2 * y * y - ry2 * x * x) / (rx2 * y * y + ry2 * x * x))),
                     cx = k * rx * y / ry + (x1 + x2) / 2,
                     cy = k * -ry * x / rx + (y1 + y2) / 2,
-                    f1 = math.asin(((y1 - cy) / ry).toFixed(7)),
-                    f2 = math.asin(((y2 - cy) / ry).toFixed(7));
+                    f1 = math.asin(((y1 - cy) / ry).toFixed(9)),
+                    f2 = math.asin(((y2 - cy) / ry).toFixed(9));
 
                 f1 = x1 < cx ? PI - f1 : f1;
                 f2 = x2 < cx ? PI - f2 : f2;
@@ -785,8 +819,8 @@ Raphael = (function () {
                 y = [p1y, p2y],
                 x = [p1x, p2x],
                 dot;
-            math.abs(t1) > 1e12 && (t1 = .5);
-            math.abs(t2) > 1e12 && (t2 = .5);
+            math.abs(t1) > "1e12" && (t1 = .5);
+            math.abs(t2) > "1e12" && (t2 = .5);
             if (t1 > 0 && t1 < 1) {
                 dot = findDotAtSegment(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t1);
                 x[push](dot.x);
@@ -802,8 +836,8 @@ Raphael = (function () {
             c = p1y - c1y;
             t1 = (-b + math.sqrt(b * b - 4 * a * c)) / 2 / a;
             t2 = (-b - math.sqrt(b * b - 4 * a * c)) / 2 / a;
-            math.abs(t1) > 1e12 && (t1 = .5);
-            math.abs(t2) > 1e12 && (t2 = .5);
+            math.abs(t1) > "1e12" && (t1 = .5);
+            math.abs(t2) > "1e12" && (t2 = .5);
             if (t1 > 0 && t1 < 1) {
                 dot = findDotAtSegment(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t1);
                 x[push](dot.x);
@@ -1039,8 +1073,8 @@ Raphael = (function () {
     R.pathToRelative = pathToRelative;
     // SVG
     if (R.svg) {
-        Paper[proto].svgns = "http://www.w3.org/2000/svg";
-        Paper[proto].xlink = "http://www.w3.org/1999/xlink";
+        paperproto.svgns = "http://www.w3.org/2000/svg";
+        paperproto.xlink = "http://www.w3.org/1999/xlink";
         round = function (num) {
             return +num + (~~num === num) * .5;
         };
@@ -1052,7 +1086,7 @@ Raphael = (function () {
                     }
                 }
             } else {
-                el = doc.createElementNS(Paper[proto].svgns, el);
+                el = doc.createElementNS(paperproto.svgns, el);
                 el.style.webkitTapHighlightColor = "rgba(0,0,0,0)";
                 return el;
             }
@@ -1112,7 +1146,7 @@ Raphael = (function () {
             var id = o.getAttribute(fillString);
             id = id.match(/^url\(#(.*)\)$/);
             id && SVG.defs.removeChild(doc.getElementById(id[1]));
-            
+
             var el = $(type + "Gradient");
             el.id = "r" + (R._id++)[toString](36);
             $(el, type == "radial" ? {fx: fx, fy: fy} : {x1: vector[0], y1: vector[1], x2: vector[2], y2: vector[3]});
@@ -1203,7 +1237,11 @@ Raphael = (function () {
                                 hl[appendChild](node);
                                 pn = hl;
                             }
-                            pn.setAttributeNS(o.paper.xlink, att, value);
+                            if (att == "target" && value == "blank") {
+                                pn.setAttributeNS(o.paper.xlink, "show", "new");
+                            } else {
+                                pn.setAttributeNS(o.paper.xlink, att, value);
+                            }
                             break;
                         case "cursor":
                             node.style.cursor = value;
@@ -1454,6 +1492,7 @@ Raphael = (function () {
             svg.top = this;
             this.next = null;
         };
+        var elproto = Element[proto];
         Element[proto].rotate = function (deg, cx, cy) {
             if (this.removed) {
                 return this;
@@ -1471,7 +1510,7 @@ Raphael = (function () {
                 cy = toFloat(deg[2]);
             }
             deg = toFloat(deg[0]);
-            if (cx != null) {
+            if (cx != null && cx !== false) {
                 this._.rt.deg = deg;
             } else {
                 this._.rt.deg += deg;
@@ -1580,10 +1619,17 @@ Raphael = (function () {
             if (value != null) {
                 var params = {};
                 params[name] = value;
-                setFillAndStroke(this, params);
             } else if (name != null && R.is(name, "object")) {
-                setFillAndStroke(this, name);
+                params = name;
+            }
+            for (var key in this.paper.customAttributes) if (this.paper.customAttributes[has](key) && params[has](key) && R.is(this.paper.customAttributes[key], "function")) {
+                var par = this.paper.customAttributes[key].apply(this, [][concat](params[key]));
+                this.attrs[key] = params[key];
+                for (var subkey in par) if (par[has](subkey)) {
+                    params[subkey] = par[subkey];
+                }
             }
+            setFillAndStroke(this, params);
             return this;
         };
         Element[proto].toFront = function () {
@@ -1610,7 +1656,7 @@ Raphael = (function () {
             if (this.removed) {
                 return this;
             }
-            var node = element.node || element[element.length].node;
+            var node = element.node || element[element.length - 1].node;
             if (node.nextSibling) {
                 node.parentNode.insertBefore(this.node, node.nextSibling);
             } else {
@@ -1658,8 +1704,8 @@ Raphael = (function () {
             res.type = "circle";
             $(el, res.attrs);
             return res;
-        };
-        var theRect = function (svg, x, y, w, h, r) {
+        },
+        theRect = function (svg, x, y, w, h, r) {
             var el = $("rect");
             svg.canvas && svg.canvas[appendChild](el);
             var res = new Element(el, svg);
@@ -1667,8 +1713,8 @@ Raphael = (function () {
             res.type = "rect";
             $(el, res.attrs);
             return res;
-        };
-        var theEllipse = function (svg, x, y, rx, ry) {
+        },
+        theEllipse = function (svg, x, y, rx, ry) {
             var el = $("ellipse");
             svg.canvas && svg.canvas[appendChild](el);
             var res = new Element(el, svg);
@@ -1676,8 +1722,8 @@ Raphael = (function () {
             res.type = "ellipse";
             $(el, res.attrs);
             return res;
-        };
-        var theImage = function (svg, src, x, y, w, h) {
+        },
+        theImage = function (svg, src, x, y, w, h) {
             var el = $("image");
             $(el, {x: x, y: y, width: w, height: h, preserveAspectRatio: "none"});
             el.setAttributeNS(svg.xlink, "href", src);
@@ -1686,8 +1732,8 @@ Raphael = (function () {
             res.attrs = {x: x, y: y, width: w, height: h, src: src};
             res.type = "image";
             return res;
-        };
-        var theText = function (svg, x, y, text) {
+        },
+        theText = function (svg, x, y, text) {
             var el = $("text");
             $(el, {x: x, y: y, "text-anchor": "middle"});
             svg.canvas && svg.canvas[appendChild](el);
@@ -1696,15 +1742,15 @@ Raphael = (function () {
             res.type = "text";
             setFillAndStroke(res, res.attrs);
             return res;
-        };
-        var setSize = function (width, height) {
+        },
+        setSize = function (width, height) {
             this.width = width || this.width;
             this.height = height || this.height;
             this.canvas[setAttribute]("width", this.width);
             this.canvas[setAttribute]("height", this.height);
             return this;
-        };
-        var create = function () {
+        },
+        create = function () {
             var con = getContainer[apply](0, arguments),
                 container = con && con.container,
                 x = con.x,
@@ -1743,7 +1789,7 @@ Raphael = (function () {
             container.clear();
             return container;
         };
-        Paper[proto].clear = function () {
+        paperproto.clear = function () {
             var c = this.canvas;
             while (c.firstChild) {
                 c.removeChild(c.firstChild);
@@ -1753,7 +1799,7 @@ Raphael = (function () {
             c[appendChild](this.desc);
             c[appendChild](this.defs = $("defs"));
         };
-        Paper[proto].remove = function () {
+        paperproto.remove = function () {
             this.canvas.parentNode && this.canvas.parentNode.removeChild(this.canvas);
             for (var i in this) {
                 this[i] = removed(i);
@@ -1765,6 +1811,7 @@ Raphael = (function () {
     if (R.vml) {
         var map = {M: "m", L: "l", C: "c", Z: "x", m: "t", l: "r", c: "v", z: "x"},
             bites = /([clmz]),?([^clmz]*)/gi,
+            blurregexp = / progid:\S+Blur\([^\)]+\)/g,
             val = /-?[^,\s-]+/g,
             coordsize = 1e3 + S + 1e3,
             zoom = 10,
@@ -1821,7 +1868,6 @@ Raphael = (function () {
             var p = new Element(el, g, vml),
                 attr = {fill: "none", stroke: "#000"};
             pathString && (attr.path = pathString);
-            p.isAbsolute = true;
             p.type = "path";
             p.path = [];
             p.Path = E;
@@ -1854,7 +1900,7 @@ Raphael = (function () {
             params.cursor && (s.cursor = params.cursor);
             "blur" in params && o.blur(params.blur);
             if (params.path && o.type == "path" || newpath) {
-                    node.path = path2vml(a.path);
+                node.path = path2vml(a.path);
             }
             if (params.rotation != null) {
                 o.rotate(params.rotation, true);
@@ -1925,8 +1971,7 @@ Raphael = (function () {
                 !fill && (newfill = fill = createNode(fillString));
                 if ("fill-opacity" in params || "opacity" in params) {
                     var opacity = ((+a["fill-opacity"] + 1 || 2) - 1) * ((+a.opacity + 1 || 2) - 1) * ((+R.getRGB(params.fill).o + 1 || 2) - 1);
-                    opacity < 0 && (opacity = 0);
-                    opacity > 1 && (opacity = 1);
+                    opacity = mmin(mmax(opacity, 0), 1);
                     fill.opacity = opacity;
                 }
                 params.fill && (fill.on = true);
@@ -1966,8 +2011,7 @@ Raphael = (function () {
                 stroke.on && params.stroke && (stroke.color = strokeColor.hex);
                 opacity = ((+a["stroke-opacity"] + 1 || 2) - 1) * ((+a.opacity + 1 || 2) - 1) * ((+strokeColor.o + 1 || 2) - 1);
                 var width = (toFloat(params["stroke-width"]) || 1) * .75;
-                opacity < 0 && (opacity = 0);
-                opacity > 1 && (opacity = 1);
+                opacity = mmin(mmax(opacity, 0), 1);
                 params["stroke-width"] == null && (width = a["stroke-width"]);
                 params["stroke-width"] && (stroke.weight = width);
                 width && width < 1 && (opacity *= width) && (stroke.weight = 1);
@@ -2103,7 +2147,8 @@ Raphael = (function () {
             vml.top = this;
             this.next = null;
         };
-        Element[proto].rotate = function (deg, cx, cy) {
+        elproto = Element[proto];
+        elproto.rotate = function (deg, cx, cy) {
             if (this.removed) {
                 return this;
             }
@@ -2136,7 +2181,7 @@ Raphael = (function () {
             // !R.is(fill.angle, "undefined") && (fill.angle = b);
             return this;
         };
-        Element[proto].setBox = function (params, cx, cy) {
+        elproto.setBox = function (params, cx, cy) {
             if (this.removed) {
                 return this;
             }
@@ -2225,15 +2270,15 @@ Raphael = (function () {
                 os.height != (t = h + "px") && (os.height = t);
             }
         };
-        Element[proto].hide = function () {
+        elproto.hide = function () {
             !this.removed && (this.Group.style.display = "none");
             return this;
         };
-        Element[proto].show = function () {
+        elproto.show = function () {
             !this.removed && (this.Group.style.display = "block");
             return this;
         };
-        Element[proto].getBBox = function () {
+        elproto.getBBox = function () {
             if (this.removed) {
                 return this;
             }
@@ -2247,7 +2292,7 @@ Raphael = (function () {
                 height: this.H
             };
         };
-        Element[proto].remove = function () {
+        elproto.remove = function () {
             if (this.removed) {
                 return;
             }
@@ -2260,7 +2305,7 @@ Raphael = (function () {
             }
             this.removed = true;
         };
-        Element[proto].attr = function (name, value) {
+        elproto.attr = function (name, value) {
             if (this.removed) {
                 return this;
             }
@@ -2274,7 +2319,7 @@ Raphael = (function () {
                 res.gradient && res.fill == "none" && (res.fill = res.gradient) && delete res.gradient;
                 return res;
             }
-            if (value == null && R.is(name, string)) {
+            if (value == null && R.is(name, "string")) {
                 if (name == "translation") {
                     return translate.call(this);
                 }
@@ -2303,6 +2348,13 @@ Raphael = (function () {
             }
             value == null && R.is(name, "object") && (params = name);
             if (params) {
+                for (var key in this.paper.customAttributes) if (this.paper.customAttributes[has](key) && params[has](key) && R.is(this.paper.customAttributes[key], "function")) {
+                    var par = this.paper.customAttributes[key].apply(this, [][concat](params[key]));
+                    this.attrs[key] = params[key];
+                    for (var subkey in par) if (par[has](subkey)) {
+                        params[subkey] = par[subkey];
+                    }
+                }
                 if (params.text && this.type == "text") {
                     this.node.string = params.text;
                 }
@@ -2314,12 +2366,12 @@ Raphael = (function () {
             }
             return this;
         };
-        Element[proto].toFront = function () {
+        elproto.toFront = function () {
             !this.removed && this.Group.parentNode[appendChild](this.Group);
             this.paper.top != this && tofront(this, this.paper);
             return this;
         };
-        Element[proto].toBack = function () {
+        elproto.toBack = function () {
             if (this.removed) {
                 return this;
             }
@@ -2329,7 +2381,7 @@ Raphael = (function () {
             }
             return this;
         };
-        Element[proto].insertAfter = function (element) {
+        elproto.insertAfter = function (element) {
             if (this.removed) {
                 return this;
             }
@@ -2344,7 +2396,7 @@ Raphael = (function () {
             insertafter(this, element, this.paper);
             return this;
         };
-        Element[proto].insertBefore = function (element) {
+        elproto.insertBefore = function (element) {
             if (this.removed) {
                 return this;
             }
@@ -2355,8 +2407,7 @@ Raphael = (function () {
             insertbefore(this, element, this.paper);
             return this;
         };
-        var blurregexp = / progid:\S+Blur\([^\)]+\)/g;
-        Element[proto].blur = function (size) {
+        elproto.blur = function (size) {
             var s = this.node.runtimeStyle,
                 f = s.filter;
             f = f.replace(blurregexp, E);
@@ -2430,8 +2481,7 @@ Raphael = (function () {
         };
         theImage = function (vml, src, x, y, w, h) {
             var g = createNode("group"),
-                o = createNode("image"),
-                ol = o.style;
+                o = createNode("image");
             g.style.cssText = "position:absolute;left:0;top:0;width:" + vml.width + "px;height:" + vml.height + "px";
             g.coordsize = coordsize;
             g.coordorigin = vml.coordorigin;
@@ -2529,7 +2579,7 @@ Raphael = (function () {
             res.span = doc.createElement("span");
             res.span.style.cssText = "position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;";
             c[appendChild](res.span);
-            cs.cssText = R.format("width:{0};height:{1};display:inline-block;position:relative;clip:rect(0 {0} {1} 0);overflow:hidden", width, height);
+            cs.cssText = R.format("top:0;left:0;width:{0};height:{1};display:inline-block;position:relative;clip:rect(0 {0} {1} 0);overflow:hidden", width, height);
             if (container == 1) {
                 doc.body[appendChild](c);
                 cs.left = x + "px";
@@ -2545,14 +2595,14 @@ Raphael = (function () {
             plugins.call(res, res, R.fn);
             return res;
         };
-        Paper[proto].clear = function () {
+        paperproto.clear = function () {
             this.canvas.innerHTML = E;
             this.span = doc.createElement("span");
             this.span.style.cssText = "position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;";
             this.canvas[appendChild](this.span);
             this.bottom = this.top = null;
         };
-        Paper[proto].remove = function () {
+        paperproto.remove = function () {
             this.canvas.parentNode.removeChild(this.canvas);
             for (var i in this) {
                 this[i] = removed(i);
@@ -2563,13 +2613,14 @@ Raphael = (function () {
  
     // rest
     // WebKit rendering bug workaround method
-    if ((navigator.vendor == "Apple Computer, Inc.") && (navigator.userAgent.match(/Version\/(.*?)\s/)[1] < 4 || win.navigator.platform.slice(0, 2) == "iP")) {
-        Paper[proto].safari = function () {
+    var version = navigator.userAgent.match(/Version\/(.*?)\s/);
+    if ((navigator.vendor == "Apple Computer, Inc.") && (version && version[1] < 4 || navigator.platform.slice(0, 2) == "iP")) {
+        paperproto.safari = function () {
             var rect = this.rect(-99, -99, this.width + 99, this.height + 99).attr({stroke: "none"});
             win.setTimeout(function () {rect.remove();});
         };
     } else {
-        Paper[proto].safari = function () {};
+        paperproto.safari = function () {};
     }
  
     // Events
@@ -2631,6 +2682,8 @@ Raphael = (function () {
     dragMove = function (e) {
         var x = e.clientX,
             y = e.clientY,
+            scrollY = doc.documentElement.scrollTop || doc.body.scrollTop,
+            scrollX = doc.documentElement.scrollLeft || doc.body.scrollLeft,
             dragi,
             j = drag.length;
         while (j--) {
@@ -2650,6 +2703,8 @@ Raphael = (function () {
             } else {
                 e.preventDefault();
             }
+            x += scrollX;
+            y += scrollY;
             dragi.move && dragi.move.call(dragi.el, x - dragi.el._drag.x, y - dragi.el._drag.y, x, y);
         }
     },
@@ -2686,62 +2741,64 @@ Raphael = (function () {
             };
         })(events[i]);
     }
-    Element[proto].hover = function (f_in, f_out) {
+    elproto.hover = function (f_in, f_out) {
         return this.mouseover(f_in).mouseout(f_out);
     };
-    Element[proto].unhover = function (f_in, f_out) {
+    elproto.unhover = function (f_in, f_out) {
         return this.unmouseover(f_in).unmouseout(f_out);
     };
-    Element[proto].drag = function (onmove, onstart, onend) {
+    elproto.drag = function (onmove, onstart, onend) {
         this._drag = {};
         this.mousedown(function (e) {
             (e.originalEvent || e).preventDefault();
-            this._drag.x = e.clientX;
-            this._drag.y = e.clientY;
+            var scrollY = doc.documentElement.scrollTop || doc.body.scrollTop,
+                scrollX = doc.documentElement.scrollLeft || doc.body.scrollLeft;
+            this._drag.x = e.clientX + scrollX;
+            this._drag.y = e.clientY + scrollY;
             this._drag.id = e.identifier;
-            onstart && onstart.call(this, e.clientX, e.clientY);
+            onstart && onstart.call(this, e.clientX + scrollX, e.clientY + scrollY);
             !drag.length && R.mousemove(dragMove).mouseup(dragUp);
             drag.push({el: this, move: onmove, end: onend});
         });
         return this;
     };
-    Element[proto].undrag = function (onmove, onstart, onend) {
+    elproto.undrag = function (onmove, onstart, onend) {
         var i = drag.length;
         while (i--) {
             drag[i].el == this && (drag[i].move == onmove && drag[i].end == onend) && drag.splice(i, 1);
             !drag.length && R.unmousemove(dragMove).unmouseup(dragUp);
         }
     };
-    Paper[proto].circle = function (x, y, r) {
+    paperproto.circle = function (x, y, r) {
         return theCircle(this, x || 0, y || 0, r || 0);
     };
-    Paper[proto].rect = function (x, y, w, h, r) {
+    paperproto.rect = function (x, y, w, h, r) {
         return theRect(this, x || 0, y || 0, w || 0, h || 0, r || 0);
     };
-    Paper[proto].ellipse = function (x, y, rx, ry) {
+    paperproto.ellipse = function (x, y, rx, ry) {
         return theEllipse(this, x || 0, y || 0, rx || 0, ry || 0);
     };
-    Paper[proto].path = function (pathString) {
+    paperproto.path = function (pathString) {
         pathString && !R.is(pathString, string) && !R.is(pathString[0], array) && (pathString += E);
         return thePath(R.format[apply](R, arguments), this);
     };
-    Paper[proto].image = function (src, x, y, w, h) {
+    paperproto.image = function (src, x, y, w, h) {
         return theImage(this, src || "about:blank", x || 0, y || 0, w || 0, h || 0);
     };
-    Paper[proto].text = function (x, y, text) {
-        return theText(this, x || 0, y || 0, text || E);
+    paperproto.text = function (x, y, text) {
+        return theText(this, x || 0, y || 0, Str(text));
     };
-    Paper[proto].set = function (itemsArray) {
+    paperproto.set = function (itemsArray) {
         arguments[length] > 1 && (itemsArray = Array[proto].splice.call(arguments, 0, arguments[length]));
         return new Set(itemsArray);
     };
-    Paper[proto].setSize = setSize;
-    Paper[proto].top = Paper[proto].bottom = null;
-    Paper[proto].raphael = R;
+    paperproto.setSize = setSize;
+    paperproto.top = paperproto.bottom = null;
+    paperproto.raphael = R;
     function x_y() {
         return this.x + S + this.y;
     }
-    Element[proto].resetScale = function () {
+    elproto.resetScale = function () {
         if (this.removed) {
             return this;
         }
@@ -2749,7 +2806,7 @@ Raphael = (function () {
         this._.sy = 1;
         this.attrs.scale = "1 1";
     };
-    Element[proto].scale = function (x, y, cx, cy) {
+    elproto.scale = function (x, y, cx, cy) {
         if (this.removed) {
             return this;
         }
@@ -2880,7 +2937,7 @@ Raphael = (function () {
         }
         return this;
     };
-    Element[proto].clone = function () {
+    elproto.clone = function () {
         if (this.removed) {
             return null;
         }
@@ -2889,18 +2946,32 @@ Raphael = (function () {
         delete attr.translation;
         return this.paper[this.type]().attr(attr);
     };
-    var getPointAtSegmentLength = cacher(function (p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, length) {
+    var curveslengths = {},
+    getPointAtSegmentLength = function (p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, length) {
         var len = 0,
-            old;
-        for (var i = 0; i < 1.01; i+=.01) {
-            var dot = findDotAtSegment(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, i);
+            name = [p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y].join(),
+            cache = curveslengths[name],
+            old, dot;
+        !cache && (curveslengths[name] = cache = {data: []});
+        cache.timer && clearTimeout(cache.timer);
+        cache.timer = setTimeout(function () {delete curveslengths[name];}, 2000);
+        for (var i = 0; i < 101; i++) {
+            if (cache.data[length] > i) {
+                dot = cache.data[i * 100];
+            } else {
+                dot = R.findDotsAtSegment(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, i / 100);
+                cache.data[i] = dot;
+            }
             i && (len += pow(pow(old.x - dot.x, 2) + pow(old.y - dot.y, 2), .5));
-            if (len >= length) {
+            if (length != null && len >= length) {
                 return dot;
             }
             old = dot;
         }
-    }),
+        if (length == null) {
+            return len;
+        }
+    },
     getLengthFactory = function (istotal, subpath) {
         return function (path, length, onlystart) {
             path = path2curve(path);
@@ -2912,7 +2983,7 @@ Raphael = (function () {
                     x = +p[1];
                     y = +p[2];
                 } else {
-                    l = segmentLength(x, y, p[1], p[2], p[3], p[4], p[5], p[6]);
+                    l = getPointAtSegmentLength(x, y, p[1], p[2], p[3], p[4], p[5], p[6]);
                     if (len + l > length) {
                         if (subpath && !subpaths.start) {
                             point = getPointAtSegmentLength(x, y, p[1], p[2], p[3], p[4], p[5], p[6], length - len);
@@ -2941,37 +3012,27 @@ Raphael = (function () {
             point.alpha && (point = {x: point.x, y: point.y, alpha: point.alpha});
             return point;
         };
-    },
-    segmentLength = cacher(function (p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y) {
-        var old = {x: 0, y: 0},
-            len = 0;
-        for (var i = 0; i < 1.01; i+=.01) {
-            var dot = findDotAtSegment(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, i);
-            i && (len += pow(pow(old.x - dot.x, 2) + pow(old.y - dot.y, 2), .5));
-            old = dot;
-        }
-        return len;
-    });
+    };
     var getTotalLength = getLengthFactory(1),
         getPointAtLength = getLengthFactory(),
         getSubpathsAtLength = getLengthFactory(0, 1);
-    Element[proto].getTotalLength = function () {
+    elproto.getTotalLength = function () {
         if (this.type != "path") {return;}
         if (this.node.getTotalLength) {
             return this.node.getTotalLength();
         }
         return getTotalLength(this.attrs.path);
     };
-    Element[proto].getPointAtLength = function (length) {
+    elproto.getPointAtLength = function (length) {
         if (this.type != "path") {return;}
         if (this.node.getPointAtLength) {
             return this.node.getPointAtLength(length);
         }
         return getPointAtLength(this.attrs.path, length);
     };
-    Element[proto].getSubpath = function (from, to) {
+    elproto.getSubpath = function (from, to) {
         if (this.type != "path") {return;}
-        if (math.abs(this.getTotalLength() - to) < 1e-6) {
+        if (math.abs(this.getTotalLength() - to) < "1e-6") {
             return getSubpathsAtLength(this.attrs.path, from).end;
         }
         var a = getSubpathsAtLength(this.attrs.path, to, 1);
@@ -3038,14 +3099,12 @@ Raphael = (function () {
         }
     };
 
-    var animationElements = {length : 0},
+    var animationElements = [],
         animation = function () {
             var Now = +new Date;
-            for (var l in animationElements) if (l != "length" && animationElements[has](l)) {
+            for (var l = 0; l < animationElements[length]; l++) {
                 var e = animationElements[l];
                 if (e.stop || e.el.removed) {
-                    delete animationElements[l];
-                    animationElements[length]--;
                     continue;
                 }
                 var time = Now - e.start,
@@ -3055,13 +3114,11 @@ Raphael = (function () {
                     diff = e.diff,
                     to = e.to,
                     t = e.t,
-                    prev = e.prev || 0,
                     that = e.el,
-                    callback = e.callback,
                     set = {},
                     now;
                 if (time < ms) {
-                    var pos = R.easing_formulas[easing] ? R.easing_formulas[easing](time / ms) : time / ms;
+                    var pos = easing(time / ms);
                     for (var attr in from) if (from[has](attr)) {
                         switch (availableAnimAttrs[attr]) {
                             case "along":
@@ -3098,8 +3155,8 @@ Raphael = (function () {
                             case "csv":
                                 switch (attr) {
                                     case "translation":
-                                        var x = diff[attr][0] * (time - prev),
-                                            y = diff[attr][1] * (time - prev);
+                                        var x = pos * ms * diff[attr][0] - t.x,
+                                            y = pos * ms * diff[attr][1] - t.y;
                                         t.x += x;
                                         t.y += y;
                                         now = x + S + y;
@@ -3120,6 +3177,14 @@ Raphael = (function () {
                                     break;
                                 }
                                 break;
+                            default:
+                              var from2 = [].concat(from[attr]);
+                                now = [];
+                                i = that.paper.customAttributes[attr].length;
+                                while (i--) {
+                                    now[i] = +from2[i] + pos * ms * diff[attr][i];
+                                }
+                                break;
                         }
                         set[attr] = now;
                     }
@@ -3134,15 +3199,18 @@ Raphael = (function () {
                     (t.x || t.y) && that.translate(-t.x, -t.y);
                     to.scale && (to.scale += E);
                     that.attr(to);
-                    delete animationElements[l];
-                    animationElements[length]--;
-                    that.in_animation = null;
-                    R.is(callback, "function") && callback.call(that);
+                    animationElements.splice(l--, 1);
                 }
-                e.prev = time;
             }
             R.svg && that && that.paper && that.paper.safari();
-            animationElements[length] && win.setTimeout(animation);
+            animationElements[length] && setTimeout(animation);
+        },
+        keyframesRun = function (attr, element, time, prev, prevcallback) {
+            var dif = time - prev;
+            element.timeouts.push(setTimeout(function () {
+                R.is(prevcallback, "function") && prevcallback.call(element);
+                element.animate(attr, dif, attr.easing);
+            }, prev));
         },
         upto255 = function (color) {
             return mmax(mmin(color, 255), 0);
@@ -3172,12 +3240,16 @@ Raphael = (function () {
             }
             return this;
         };
-    Element[proto].animateWith = function (element, params, ms, easing, callback) {
-        animationElements[element.id] && (params.start = animationElements[element.id].start);
+    elproto.animateWith = function (element, params, ms, easing, callback) {
+        for (var i = 0, ii = animationElements.length; i < ii; i++) {
+            if (animationElements[i].el.id == element.id) {
+                params.start = animationElements[i].start;
+            }
+        }
         return this.animate(params, ms, easing, callback);
     };
-    Element[proto].animateAlong = along();
-    Element[proto].animateAlongBack = along(1);
+    elproto.animateAlong = along();
+    elproto.animateAlongBack = along(1);
     function along(isBack) {
         return function (path, ms, rotate, callback) {
             var params = {back: isBack};
@@ -3187,27 +3259,87 @@ Raphael = (function () {
             return this.animate(params, ms, callback);
         };
     }
-    Element[proto].onAnimation = function (f) {
+    function CubicBezierAtTime(t, p1x, p1y, p2x, p2y, duration) {
+        var cx = 3 * p1x,
+            bx = 3 * (p2x - p1x) - cx,
+            ax = 1 - cx - bx,
+            cy = 3 * p1y,
+            by = 3 * (p2y - p1y) - cy,
+            ay = 1 - cy - by;
+        function sampleCurveX(t) {
+            return ((ax * t + bx) * t + cx) * t;
+        }
+        function solve(x, epsilon) {
+            var t = solveCurveX(x, epsilon);
+            return ((ay * t + by) * t + cy) * t;
+        }
+        function solveCurveX(x, epsilon) {
+            var t0, t1, t2, x2, d2, i;
+            for(t2 = x, i = 0; i < 8; i++) {
+                x2 = sampleCurveX(t2) - x;
+                if (math.abs(x2) < epsilon) {
+                    return t2;
+                }
+                d2 = (3 * ax * t2 + 2 * bx) * t2 + cx;
+                if (math.abs(d2) < 1e-6) {
+                    break;
+                }
+                t2 = t2 - x2 / d2;
+            }
+            t0 = 0;
+            t1 = 1;
+            t2 = x;
+            if (t2 < t0) {
+                return t0;
+            }
+            if (t2 > t1) {
+                return t1;
+            }
+            while (t0 < t1) {
+                x2 = sampleCurveX(t2);
+                if (math.abs(x2 - x) < epsilon) {
+                    return t2;
+                }
+                if (x > x2) {
+                    t0 = t2;
+                } else {
+                    t1 = t2;
+                }
+                t2 = (t1 - t0) / 2 + t0;
+            }
+            return t2;
+        }
+        return solve(t, 1 / (200 * duration));
+    }
+    elproto.onAnimation = function (f) {
         this._run = f || 0;
         return this;
     };
-    Element[proto].animate = function (params, ms, easing, callback) {
+    elproto.animate = function (params, ms, easing, callback) {
+        var element = this;
+        element.timeouts = element.timeouts || [];
         if (R.is(easing, "function") || !easing) {
             callback = easing || null;
         }
+        if (element.removed) {
+            callback && callback.call(element);
+            return element;
+        }
         var from = {},
             to = {},
+            animateable = false,
             diff = {};
         for (var attr in params) if (params[has](attr)) {
-            if (availableAnimAttrs[has](attr)) {
-                from[attr] = this.attr(attr);
+            if (availableAnimAttrs[has](attr) || element.paper.customAttributes[has](attr)) {
+                animateable = true;
+                from[attr] = element.attr(attr);
                 (from[attr] == null) && (from[attr] = availableAttrs[attr]);
                 to[attr] = params[attr];
                 switch (availableAnimAttrs[attr]) {
                     case "along":
                         var len = getTotalLength(params[attr]);
                         var point = getPointAtLength(params[attr], len * !!params.back);
-                        var bb = this.getBBox();
+                        var bb = element.getBBox();
                         diff[attr] = len / ms;
                         diff.tx = bb.x;
                         diff.ty = bb.y;
@@ -3216,7 +3348,7 @@ Raphael = (function () {
                         to.rot = params.rot;
                         to.back = params.back;
                         to.len = len;
-                        params.rot && (diff.r = toFloat(this.rotate()) || 0);
+                        params.rot && (diff.r = toFloat(element.rotate()) || 0);
                         break;
                     case nu:
                         diff[attr] = (to[attr] - from[attr]) / ms;
@@ -3269,34 +3401,88 @@ Raphael = (function () {
                             break;
                         }
                         to[attr] = values;
+                        break;
+                    default:
+                        values = [].concat(params[attr]);
+                        from2 = [].concat(from[attr]);
+                        diff[attr] = [];
+                        i = element.paper.customAttributes[attr][length];
+                        while (i--) {
+                            diff[attr][i] = ((values[i] || 0) - (from2[i] || 0)) / ms;
+                        }
+                        break;
                 }
             }
         }
-        this.stop();
-        this.in_animation = 1;
-        animationElements[this.id] = {
-            start: params.start || +new Date,
-            ms: ms,
-            easing: easing,
-            from: from,
-            diff: diff,
-            to: to,
-            el: this,
-            callback: callback,
-            t: {x: 0, y: 0}
-        };
-        ++animationElements[length] == 1 && animation();
+        if (!animateable) {
+            var attrs = [],
+                lastcall;
+            for (var key in params) if (params[has](key) && animKeyFrames.test(key)) {
+                attr = {value: params[key]};
+                key == "from" && (key = 0);
+                key == "to" && (key = 100);
+                attr.key = toInt(key, 10);
+                attrs.push(attr);
+            }
+            attrs.sort(sortByKey);
+            if (attrs[0].key) {
+                attrs.unshift({key: 0, value: element.attrs});
+            }
+            for (i = 0, ii = attrs[length]; i < ii; i++) {
+                keyframesRun(attrs[i].value, element, ms / 100 * attrs[i].key, ms / 100 * (attrs[i - 1] && attrs[i - 1].key || 0), attrs[i - 1] && attrs[i - 1].value.callback);
+            }
+            lastcall = attrs[attrs[length] - 1].value.callback;
+            if (lastcall) {
+                element.timeouts.push(setTimeout(function () {lastcall.call(element);}, ms));
+            }
+        } else {
+            var easyeasy = R.easing_formulas[easing];
+            if (!easyeasy) {
+                easyeasy = Str(easing).match(bezierrg);
+                if (easyeasy && easyeasy[length] == 5) {
+                    var curve = easyeasy;
+                    easyeasy = function (t) {
+                        return CubicBezierAtTime(t, +curve[1], +curve[2], +curve[3], +curve[4], ms);
+                    };
+                } else {
+                    easyeasy = function (t) {
+                        return t;
+                    };
+                }
+            }
+            animationElements.push({
+                start: params.start || +new Date,
+                ms: ms,
+                easing: easyeasy,
+                from: from,
+                diff: diff,
+                to: to,
+                el: element,
+                t: {x: 0, y: 0}
+            });
+            R.is(callback, "function") && (element._ac = setTimeout(function () {
+                callback.call(element);
+            }, ms));
+            animationElements[length] == 1 && setTimeout(animation);
+        }
         return this;
     };
-    Element[proto].stop = function () {
-        animationElements[this.id] && animationElements[length]--;
-        delete animationElements[this.id];
+    elproto.stop = function () {
+        for (var i = 0; i < animationElements.length; i++) {
+            animationElements[i].el.id == this.id && animationElements.splice(i--, 1);
+        }
+        for (i = 0, ii = this.timeouts && this.timeouts.length; i < ii; i++) {
+            clearTimeout(this.timeouts[i]);
+        }
+        this.timeouts = [];
+        clearTimeout(this._ac);
+        delete this._ac;
         return this;
     };
-    Element[proto].translate = function (x, y) {
+    elproto.translate = function (x, y) {
         return this.attr({translation: x + " " + y});
     };
-    Element[proto][toString] = function () {
+    elproto[toString] = function () {
         return "Rapha\xebl\u2019s object";
     };
     R.ae = animationElements;
@@ -3332,7 +3518,7 @@ Raphael = (function () {
         delete this[this[length]--];
         return this.items.pop();
     };
-    for (var method in Element[proto]) if (Element[proto][has](method)) {
+    for (var method in elproto) if (elproto[has](method)) {
         Set[proto][method] = (function (methodname) {
             return function () {
                 for (var i = 0, ii = this.items[length]; i < ii; i++) {
@@ -3367,7 +3553,7 @@ Raphael = (function () {
         easing = R.is(easing, string) ? easing : collector;
         item = this.items[--i].animate(params, ms, easing, collector);
         while (i--) {
-            this.items[i].animateWith(item, params, ms, easing, collector);
+            this.items[i] && !this.items[i].removed && this.items[i].animateWith(item, params, ms, easing, collector);
         }
         return this;
     };
@@ -3446,7 +3632,7 @@ Raphael = (function () {
         }
         return font;
     };
-    Paper[proto].getFont = function (family, weight, style, stretch) {
+    paperproto.getFont = function (family, weight, style, stretch) {
         stretch = stretch || "normal";
         style = style || "normal";
         weight = +weight || {normal: 400, bold: 700, lighter: 300, bolder: 800}[weight] || 400;
@@ -3474,8 +3660,9 @@ Raphael = (function () {
         }
         return thefont;
     };
-    Paper[proto].print = function (x, y, string, font, size, origin) {
+    paperproto.print = function (x, y, string, font, size, origin, letter_spacing) {
         origin = origin || "middle"; // baseline|middle
+        letter_spacing = mmax(mmin(letter_spacing || 0, 1), -1);
         var out = this.set(),
             letters = Str(string)[split](E),
             shift = 0,
@@ -3490,7 +3677,7 @@ Raphael = (function () {
             for (var i = 0, ii = letters[length]; i < ii; i++) {
                 var prev = i && font.glyphs[letters[i - 1]] || {},
                     curr = font.glyphs[letters[i]];
-                shift += i ? (prev.w || font.w) + (prev.k && prev.k[letters[i]] || 0) : 0;
+                shift += i ? (prev.w || font.w) + (prev.k && prev.k[letters[i]] || 0) + (font.w * letter_spacing) : 0;
                 curr && curr.d && out[push](this.path(curr.d).attr({fill: "#000", stroke: "none", translation: [shift, 0]}));
             }
             out.scale(scale, scale, top, height).translate(x - top, y - height);
@@ -3498,7 +3685,6 @@ Raphael = (function () {
         return out;
     };
 
-    var formatrg = /\{(\d+)\}/g;
     R.format = function (token, params) {
         var args = R.is(params, array) ? [0][concat](params) : arguments;
         token && R.is(token, string) && args[length] - 1 && (token = token[rp](formatrg, function (str, i) {
@@ -3507,9 +3693,11 @@ Raphael = (function () {
         return token || E;
     };
     R.ninja = function () {
-        oldRaphael.was ? (Raphael = oldRaphael.is) : delete Raphael;
+        oldRaphael.was ? (win.Raphael = oldRaphael.is) : delete Raphael;
         return R;
     };
-    R.el = Element[proto];
-    return R;
+    R.el = elproto;
+    R.st = Set[proto];
+
+    oldRaphael.was ? (win.Raphael = R) : (Raphael = R);
 })();
\ No newline at end of file
index 3474e44..1c70e53 100644 (file)
@@ -1,8 +1,9 @@
-<!DOCTYPE html><html lang="en">
+<!DOCTYPE html>
+<html lang="en">
     <head>
         <title>Raphaël Reference</title>
         <meta http-equiv="content-language" content="en">
-        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+        <meta charset="utf-8">
         <meta name="author" content="Dmitry Baranovskiy">
         <meta name="description" content="Vector Graphics JavaScript Library">
         <meta name="keywords" content="JavaScript Library, Raphael, SVG, VML">
@@ -20,7 +21,7 @@
             <div id="top">&nbsp;</div>
                     <div id="column-1">
                         <h2>Main Function</h2>
-                        <h3 id="Raphael">
+                        <h3 id="RAPHAEL">
                             Raphael
                         </h3>
                         <p>
@@ -392,9 +393,15 @@ c.attr({
                         <ol>
                             <li>newAttrs <em>object</em> A parameters object of the animation results. (Not all attributes can be animated.)</li>
                             <li>ms <em>number</em> The duration of the animation, given in milliseconds.</li>
-                            <li>easing <em>string</em> [“<samp>></samp>”, “<samp>&lt;</samp>”, “<samp>&lt;></samp>”, “<samp>backIn</samp>”, “<samp>backOut</samp>”, “<samp>bounce</samp>”, “<samp>elastic</samp>”] or <em>function</em> [optional]</li>
+                            <li>easing <em>string</em> [“<samp>></samp>”, “<samp>&lt;</samp>”, “<samp>&lt;></samp>”, “<samp>backIn</samp>”, “<samp>backOut</samp>”, “<samp>bounce</samp>”, “<samp>elastic</samp>”, “<samp>cubic-bezier(p1, p2, p3, p4)</samp>”] or <em>function</em> [optional], see <a href="http://www.w3.org/TR/css3-transitions/#transition-timing-function_tag" title="CSS Transitions Module Level 3">explanation re cubic-bezier syntax</a></li>
                             <li>callback <em>function</em> [optional]</li>
                         </ol>
+                        <p>or</p>
+                        <ol>
+                            <li>keyFrames <em>object</em> Key-value map, where key represents keyframe timing: [“from”, “20%”, “to”, “35%”, etc] and value is the same as <code>newAttrs</code> from above, except it could also have <samp>easing</samp> and <samp>callback</samp> properties</li>
+                            <li>ms <em>number</em> The duration of the animation, given in milliseconds.</li>
+                        </ol>
+                        <p>Look at the <a href="bounce.html">example of keyframes usage</a></p>
                         <h4>Attributes that can be animated</h4>
                         <p>The <code>newAttrs</code> parameter accepts an object whose properties are the attributes to animate. However, not all attributes listed in the <code>attr</code> method reference can be animated. The following is a list of those properties that can be animated:</p>
                         <ul>
@@ -425,9 +432,14 @@ c.attr({
                             For easing use built in functions or add your own by adding new functions to <code>Raphael.easing_formulas</code> object. Look at the <a href="easing.html">example of easing usage</a>.
                         </p>
                         <h4>Usage</h4>
-                        <pre class="javascript code"><code>var c = paper.circle(10, 10, 10);</code>
-<code>c.animate({cx: 20, r: 20}, 2000);</code>
-<code>c.animate({cx: 20, r: 20}, 2000, "bounce");</code></pre>
+                        <pre class="javascript code"><code>var c = paper.circle(10, 10, 10);
+c.animate({cx: 20, r: 20}, 2000);
+c.animate({cx: 20, r: 20}, 2000, "bounce");
+c.animate({
+    "20%": {cx: 20, r: 20, easing: ">"},
+    "50%": {cx: 70, r: 120, callback: function () {…}},
+    "100%": {cx: 10, r: 10}
+}, 2000);</code></pre>
                         <h3 id="animateWith">
                             animateWith
                         </h3>
@@ -753,10 +765,13 @@ paper.circle(100, 100, 20).red();
                             <li>#•••••• — full length HTML colour: (“<samp>#000000</samp>”, “<samp>#bd2300</samp>”)</li>
                             <li>rgb(•••, •••, •••) — red, green and blue channels’ values: (“<samp>rgb(200,&nbsp;100,&nbsp;0)</samp>”)</li>
                             <li>rgb(•••%, •••%, •••%) — same as above, but in %: (“<samp>rgb(100%,&nbsp;175%,&nbsp;0%)</samp>”)</li>
+                            <li>rgba(•••, •••, •••, •••) — red, green and blue channels’ values: (“<samp>rgb(200,&nbsp;100,&nbsp;0, .5)</samp>”)</li>
+                            <li>rgba(•••%, •••%, •••%, •••%) — same as above, but in %: (“<samp>rgb(100%,&nbsp;175%,&nbsp;0%, 50%)</samp>”)</li>
                             <li>hsb(•••, •••, •••) — hue, saturation and brightness values: (“<samp>hsb(0.5,&nbsp;0.25,&nbsp;1)</samp>”)</li>
                             <li>hsb(•••%, •••%, •••%) — same as above, but in %</li>
-                            <li>hsl(•••, •••, •••) — same as hsb</li>
-                            <li>hsl(•••%, •••%, •••%) — same as hsb</li>
+                            <li>hsl(•••, •••, •••) — almost the same as hsb, see <a href="http://en.wikipedia.org/wiki/HSL_and_HSV" title="HSL and HSV - Wikipedia, the free encyclopedia">Wikipedia page</a></li>
+                            <li>hsl(•••%, •••%, •••%) — almost the same as hsb</li>
+                            <li>Optionally for hsb and hsl you could specify hue as a degree: “<samp>hsl(240deg,&nbsp;1,&nbsp;.5)</samp>” or, if you want to go fancy, “<samp>hsl(240°,&nbsp;1,&nbsp;.5)</samp>”</li>
                         </ul>
                         <h4>Usage</h4>
                         <pre class="javascript code"><code>paper.circle(100, 100, 20).attr({
@@ -819,6 +834,42 @@ element.hover(function (event) {
                         <p>
                             To unbind events use the same method names with “un” prefix, i.e. <samp>element.unclick(f);</samp>
                         </p>
+                        <h3 id="drag-n-drop">
+                            Drag ’n’ Drop
+                        </h3>
+                        <p>
+                            To make element “draggable” you need to call method <code>drag</code> on element.
+                        </p>
+                        <h4>Parameters</h4>
+                        <ol>
+                            <li>onmove <em>function</em> event handler for moving</li>
+                            <li>onstart <em>function</em> event handler for start</li>
+                            <li>onend <em>function</em> event handler for end of the drag</li>
+                        </ol>
+                        <h4>Usage</h4>
+                        <pre class="javascript code"><code>var c = R.circle(100, 100, 50).attr({
+    fill: "hsb(.8, 1, 1)",
+    stroke: "none",
+    opacity: .5
+});
+var start = function () {
+    // storing original coordinates
+    this.ox = this.attr("cx");
+    this.oy = this.attr("cy");
+    this.attr({opacity: 1});
+},
+move = function (dx, dy) {
+    // move will be called with dx and dy
+    this.attr({cx: this.ox + dx, cy: this.oy + dy});
+},
+up = function () {
+    // restoring state
+    this.attr({opacity: .5});
+};
+c.drag(move, start, up);</code></pre>
+                        <p>
+                            To unbind drag use the <samp>undrag</samp> method.
+                        </p>
                     </div>
                     <div id="column-2">
                         <h2>