raphaeljs-rails 2.0.0 → 2.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 555d7a5605b7d3a8501240496414deb9e8ad5ab9
4
- data.tar.gz: aa3813349513c8f78f356e47da9e61e3224c4b9d
3
+ metadata.gz: d7f2dc868ed0a34e78f40b34401695f3d2d3a7d1
4
+ data.tar.gz: c8c2c14f5d21e5f0711d462ad3048512a27fed49
5
5
  SHA512:
6
- metadata.gz: 26f858ab26f4a89e7b9ca067a3240418631b52f4526df047589d55c68601b6e2056f857084c11e86e0cb7f2bbca774565e44bb140a9c4b751ba908aa5a1573fc
7
- data.tar.gz: a7255a938ba01bacbde0dca7bcaa48fa10dd91af7b8b923b429c6357a74eedafd20bedb4173d5acb163c203a20d0127a4f703690c1e33e5f329e3d9011ebc7c7
6
+ metadata.gz: d4a5852ade48516089b8acca6858382076c1a8a74233f2667979d238fca94b503ce2b520650135cfb0f2c902ead585516e5d05d17ee6ef0013eaf0e06169fea7
7
+ data.tar.gz: bab31d15e16cb125d5a19cbe1afc23e0d7472757bca692c11c3c030d1c865c6586d201b48fabd50681edb0f71d39fe4909fb3ffb273865c7cf4ca6af49720367
@@ -1,6 +1,5 @@
1
1
  module Raphaeljs
2
2
  module Rails
3
- VERSION = "2.0.0"
4
- RAPHAEL_VERSION = "2.1.0"
3
+ VERSION = "2.1.2"
5
4
  end
6
- end
5
+ end
@@ -1,10 +1,11 @@
1
1
  // ┌────────────────────────────────────────────────────────────────────┐ \\
2
- // │ Raphaël 2.1.0 - JavaScript Vector Library │ \\
2
+ // │ Raphaël 2.1.2 - JavaScript Vector Library │ \\
3
3
  // ├────────────────────────────────────────────────────────────────────┤ \\
4
4
  // │ Copyright © 2008-2012 Dmitry Baranovskiy (http://raphaeljs.com) │ \\
5
5
  // │ Copyright © 2008-2012 Sencha Labs (http://sencha.com) │ \\
6
6
  // ├────────────────────────────────────────────────────────────────────┤ \\
7
7
  // │ Licensed under the MIT (http://raphaeljs.com/license.html) license.│ \\
8
8
  // └────────────────────────────────────────────────────────────────────┘ \\
9
-
10
- (function(a){var b="0.3.4",c="hasOwnProperty",d=/[\.\/]/,e="*",f=function(){},g=function(a,b){return a-b},h,i,j={n:{}},k=function(a,b){var c=j,d=i,e=Array.prototype.slice.call(arguments,2),f=k.listeners(a),l=0,m=!1,n,o=[],p={},q=[],r=h,s=[];h=a,i=0;for(var t=0,u=f.length;t<u;t++)"zIndex"in f[t]&&(o.push(f[t].zIndex),f[t].zIndex<0&&(p[f[t].zIndex]=f[t]));o.sort(g);while(o[l]<0){n=p[o[l++]],q.push(n.apply(b,e));if(i){i=d;return q}}for(t=0;t<u;t++){n=f[t];if("zIndex"in n)if(n.zIndex==o[l]){q.push(n.apply(b,e));if(i)break;do{l++,n=p[o[l]],n&&q.push(n.apply(b,e));if(i)break}while(n)}else p[n.zIndex]=n;else{q.push(n.apply(b,e));if(i)break}}i=d,h=r;return q.length?q:null};k.listeners=function(a){var b=a.split(d),c=j,f,g,h,i,k,l,m,n,o=[c],p=[];for(i=0,k=b.length;i<k;i++){n=[];for(l=0,m=o.length;l<m;l++){c=o[l].n,g=[c[b[i]],c[e]],h=2;while(h--)f=g[h],f&&(n.push(f),p=p.concat(f.f||[]))}o=n}return p},k.on=function(a,b){var c=a.split(d),e=j;for(var g=0,h=c.length;g<h;g++)e=e.n,!e[c[g]]&&(e[c[g]]={n:{}}),e=e[c[g]];e.f=e.f||[];for(g=0,h=e.f.length;g<h;g++)if(e.f[g]==b)return f;e.f.push(b);return function(a){+a==+a&&(b.zIndex=+a)}},k.stop=function(){i=1},k.nt=function(a){if(a)return(new RegExp("(?:\\.|\\/|^)"+a+"(?:\\.|\\/|$)")).test(h);return h},k.off=k.unbind=function(a,b){var f=a.split(d),g,h,i,k,l,m,n,o=[j];for(k=0,l=f.length;k<l;k++)for(m=0;m<o.length;m+=i.length-2){i=[m,1],g=o[m].n;if(f[k]!=e)g[f[k]]&&i.push(g[f[k]]);else for(h in g)g[c](h)&&i.push(g[h]);o.splice.apply(o,i)}for(k=0,l=o.length;k<l;k++){g=o[k];while(g.n){if(b){if(g.f){for(m=0,n=g.f.length;m<n;m++)if(g.f[m]==b){g.f.splice(m,1);break}!g.f.length&&delete g.f}for(h in g.n)if(g.n[c](h)&&g.n[h].f){var p=g.n[h].f;for(m=0,n=p.length;m<n;m++)if(p[m]==b){p.splice(m,1);break}!p.length&&delete g.n[h].f}}else{delete g.f;for(h in g.n)g.n[c](h)&&g.n[h].f&&delete g.n[h].f}g=g.n}}},k.once=function(a,b){var c=function(){var d=b.apply(this,arguments);k.unbind(a,c);return d};return k.on(a,c)},k.version=b,k.toString=function(){return"You are running Eve "+b},typeof module!="undefined"&&module.exports?module.exports=k:typeof define!="undefined"?define("eve",[],function(){return k}):a.eve=k})(this),function(){function cF(a){for(var b=0;b<cy.length;b++)cy[b].el.paper==a&&cy.splice(b--,1)}function cE(b,d,e,f,h,i){e=Q(e);var j,k,l,m=[],o,p,q,t=b.ms,u={},v={},w={};if(f)for(y=0,z=cy.length;y<z;y++){var x=cy[y];if(x.el.id==d.id&&x.anim==b){x.percent!=e?(cy.splice(y,1),l=1):k=x,d.attr(x.totalOrigin);break}}else f=+v;for(var y=0,z=b.percents.length;y<z;y++){if(b.percents[y]==e||b.percents[y]>f*b.top){e=b.percents[y],p=b.percents[y-1]||0,t=t/b.top*(e-p),o=b.percents[y+1],j=b.anim[e];break}f&&d.attr(b.anim[b.percents[y]])}if(!!j){if(!k){for(var A in j)if(j[g](A))if(U[g](A)||d.paper.customAttributes[g](A)){u[A]=d.attr(A),u[A]==null&&(u[A]=T[A]),v[A]=j[A];switch(U[A]){case C:w[A]=(v[A]-u[A])/t;break;case"colour":u[A]=a.getRGB(u[A]);var B=a.getRGB(v[A]);w[A]={r:(B.r-u[A].r)/t,g:(B.g-u[A].g)/t,b:(B.b-u[A].b)/t};break;case"path":var D=bR(u[A],v[A]),E=D[1];u[A]=D[0],w[A]=[];for(y=0,z=u[A].length;y<z;y++){w[A][y]=[0];for(var F=1,G=u[A][y].length;F<G;F++)w[A][y][F]=(E[y][F]-u[A][y][F])/t}break;case"transform":var H=d._,I=ca(H[A],v[A]);if(I){u[A]=I.from,v[A]=I.to,w[A]=[],w[A].real=!0;for(y=0,z=u[A].length;y<z;y++){w[A][y]=[u[A][y][0]];for(F=1,G=u[A][y].length;F<G;F++)w[A][y][F]=(v[A][y][F]-u[A][y][F])/t}}else{var J=d.matrix||new cb,K={_:{transform:H.transform},getBBox:function(){return d.getBBox(1)}};u[A]=[J.a,J.b,J.c,J.d,J.e,J.f],b$(K,v[A]),v[A]=K._.transform,w[A]=[(K.matrix.a-J.a)/t,(K.matrix.b-J.b)/t,(K.matrix.c-J.c)/t,(K.matrix.d-J.d)/t,(K.matrix.e-J.e)/t,(K.matrix.f-J.f)/t]}break;case"csv":var L=r(j[A])[s](c),M=r(u[A])[s](c);if(A=="clip-rect"){u[A]=M,w[A]=[],y=M.length;while(y--)w[A][y]=(L[y]-u[A][y])/t}v[A]=L;break;default:L=[][n](j[A]),M=[][n](u[A]),w[A]=[],y=d.paper.customAttributes[A].length;while(y--)w[A][y]=((L[y]||0)-(M[y]||0))/t}}var O=j.easing,P=a.easing_formulas[O];if(!P){P=r(O).match(N);if(P&&P.length==5){var R=P;P=function(a){return cC(a,+R[1],+R[2],+R[3],+R[4],t)}}else P=bf}q=j.start||b.start||+(new Date),x={anim:b,percent:e,timestamp:q,start:q+(b.del||0),status:0,initstatus:f||0,stop:!1,ms:t,easing:P,from:u,diff:w,to:v,el:d,callback:j.callback,prev:p,next:o,repeat:i||b.times,origin:d.attr(),totalOrigin:h},cy.push(x);if(f&&!k&&!l){x.stop=!0,x.start=new Date-t*f;if(cy.length==1)return cA()}l&&(x.start=new Date-x.ms*f),cy.length==1&&cz(cA)}else k.initstatus=f,k.start=new Date-k.ms*f;eve("raphael.anim.start."+d.id,d,b)}}function cD(a,b){var c=[],d={};this.ms=b,this.times=1;if(a){for(var e in a)a[g](e)&&(d[Q(e)]=a[e],c.push(Q(e)));c.sort(bd)}this.anim=d,this.top=c[c.length-1],this.percents=c}function cC(a,b,c,d,e,f){function o(a,b){var c,d,e,f,j,k;for(e=a,k=0;k<8;k++){f=m(e)-a;if(z(f)<b)return e;j=(3*i*e+2*h)*e+g;if(z(j)<1e-6)break;e=e-f/j}c=0,d=1,e=a;if(e<c)return c;if(e>d)return d;while(c<d){f=m(e);if(z(f-a)<b)return e;a>f?c=e:d=e,e=(d-c)/2+c}return e}function n(a,b){var c=o(a,b);return((l*c+k)*c+j)*c}function m(a){return((i*a+h)*a+g)*a}var g=3*b,h=3*(d-b)-g,i=1-g-h,j=3*c,k=3*(e-c)-j,l=1-j-k;return n(a,1/(200*f))}function cq(){return this.x+q+this.y+q+this.width+" × "+this.height}function cp(){return this.x+q+this.y}function cb(a,b,c,d,e,f){a!=null?(this.a=+a,this.b=+b,this.c=+c,this.d=+d,this.e=+e,this.f=+f):(this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0)}function bH(b,c,d){b=a._path2curve(b),c=a._path2curve(c);var e,f,g,h,i,j,k,l,m,n,o=d?0:[];for(var p=0,q=b.length;p<q;p++){var r=b[p];if(r[0]=="M")e=i=r[1],f=j=r[2];else{r[0]=="C"?(m=[e,f].concat(r.slice(1)),e=m[6],f=m[7]):(m=[e,f,e,f,i,j,i,j],e=i,f=j);for(var s=0,t=c.length;s<t;s++){var u=c[s];if(u[0]=="M")g=k=u[1],h=l=u[2];else{u[0]=="C"?(n=[g,h].concat(u.slice(1)),g=n[6],h=n[7]):(n=[g,h,g,h,k,l,k,l],g=k,h=l);var v=bG(m,n,d);if(d)o+=v;else{for(var w=0,x=v.length;w<x;w++)v[w].segment1=p,v[w].segment2=s,v[w].bez1=m,v[w].bez2=n;o=o.concat(v)}}}}}return o}function bG(b,c,d){var e=a.bezierBBox(b),f=a.bezierBBox(c);if(!a.isBBoxIntersect(e,f))return d?0:[];var g=bB.apply(0,b),h=bB.apply(0,c),i=~~(g/5),j=~~(h/5),k=[],l=[],m={},n=d?0:[];for(var o=0;o<i+1;o++){var p=a.findDotsAtSegment.apply(a,b.concat(o/i));k.push({x:p.x,y:p.y,t:o/i})}for(o=0;o<j+1;o++)p=a.findDotsAtSegment.apply(a,c.concat(o/j)),l.push({x:p.x,y:p.y,t:o/j});for(o=0;o<i;o++)for(var q=0;q<j;q++){var r=k[o],s=k[o+1],t=l[q],u=l[q+1],v=z(s.x-r.x)<.001?"y":"x",w=z(u.x-t.x)<.001?"y":"x",x=bD(r.x,r.y,s.x,s.y,t.x,t.y,u.x,u.y);if(x){if(m[x.x.toFixed(4)]==x.y.toFixed(4))continue;m[x.x.toFixed(4)]=x.y.toFixed(4);var y=r.t+z((x[v]-r[v])/(s[v]-r[v]))*(s.t-r.t),A=t.t+z((x[w]-t[w])/(u[w]-t[w]))*(u.t-t.t);y>=0&&y<=1&&A>=0&&A<=1&&(d?n++:n.push({x:x.x,y:x.y,t1:y,t2:A}))}}return n}function bF(a,b){return bG(a,b,1)}function bE(a,b){return bG(a,b)}function bD(a,b,c,d,e,f,g,h){if(!(x(a,c)<y(e,g)||y(a,c)>x(e,g)||x(b,d)<y(f,h)||y(b,d)>x(f,h))){var i=(a*d-b*c)*(e-g)-(a-c)*(e*h-f*g),j=(a*d-b*c)*(f-h)-(b-d)*(e*h-f*g),k=(a-c)*(f-h)-(b-d)*(e-g);if(!k)return;var l=i/k,m=j/k,n=+l.toFixed(2),o=+m.toFixed(2);if(n<+y(a,c).toFixed(2)||n>+x(a,c).toFixed(2)||n<+y(e,g).toFixed(2)||n>+x(e,g).toFixed(2)||o<+y(b,d).toFixed(2)||o>+x(b,d).toFixed(2)||o<+y(f,h).toFixed(2)||o>+x(f,h).toFixed(2))return;return{x:l,y:m}}}function bC(a,b,c,d,e,f,g,h,i){if(!(i<0||bB(a,b,c,d,e,f,g,h)<i)){var j=1,k=j/2,l=j-k,m,n=.01;m=bB(a,b,c,d,e,f,g,h,l);while(z(m-i)>n)k/=2,l+=(m<i?1:-1)*k,m=bB(a,b,c,d,e,f,g,h,l);return l}}function bB(a,b,c,d,e,f,g,h,i){i==null&&(i=1),i=i>1?1:i<0?0:i;var j=i/2,k=12,l=[-0.1252,.1252,-0.3678,.3678,-0.5873,.5873,-0.7699,.7699,-0.9041,.9041,-0.9816,.9816],m=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],n=0;for(var o=0;o<k;o++){var p=j*l[o]+j,q=bA(p,a,c,e,g),r=bA(p,b,d,f,h),s=q*q+r*r;n+=m[o]*w.sqrt(s)}return j*n}function bA(a,b,c,d,e){var f=-3*b+9*c-9*d+3*e,g=a*f+6*b-12*c+6*d;return a*g-3*b+3*c}function by(a,b){var c=[];for(var d=0,e=a.length;e-2*!b>d;d+=2){var f=[{x:+a[d-2],y:+a[d-1]},{x:+a[d],y:+a[d+1]},{x:+a[d+2],y:+a[d+3]},{x:+a[d+4],y:+a[d+5]}];b?d?e-4==d?f[3]={x:+a[0],y:+a[1]}:e-2==d&&(f[2]={x:+a[0],y:+a[1]},f[3]={x:+a[2],y:+a[3]}):f[0]={x:+a[e-2],y:+a[e-1]}:e-4==d?f[3]=f[2]:d||(f[0]={x:+a[d],y:+a[d+1]}),c.push(["C",(-f[0].x+6*f[1].x+f[2].x)/6,(-f[0].y+6*f[1].y+f[2].y)/6,(f[1].x+6*f[2].x-f[3].x)/6,(f[1].y+6*f[2].y-f[3].y)/6,f[2].x,f[2].y])}return c}function bx(){return this.hex}function bv(a,b,c){function d(){var e=Array.prototype.slice.call(arguments,0),f=e.join("␀"),h=d.cache=d.cache||{},i=d.count=d.count||[];if(h[g](f)){bu(i,f);return c?c(h[f]):h[f]}i.length>=1e3&&delete h[i.shift()],i.push(f),h[f]=a[m](b,e);return c?c(h[f]):h[f]}return d}function bu(a,b){for(var c=0,d=a.length;c<d;c++)if(a[c]===b)return a.push(a.splice(c,1)[0])}function bm(a){if(Object(a)!==a)return a;var b=new a.constructor;for(var c in a)a[g](c)&&(b[c]=bm(a[c]));return b}function a(c){if(a.is(c,"function"))return b?c():eve.on("raphael.DOMload",c);if(a.is(c,E))return a._engine.create[m](a,c.splice(0,3+a.is(c[0],C))).add(c);var d=Array.prototype.slice.call(arguments,0);if(a.is(d[d.length-1],"function")){var e=d.pop();return b?e.call(a._engine.create[m](a,d)):eve.on("raphael.DOMload",function(){e.call(a._engine.create[m](a,d))})}return a._engine.create[m](a,arguments)}a.version="2.1.0",a.eve=eve;var b,c=/[, ]+/,d={circle:1,rect:1,path:1,ellipse:1,text:1,image:1},e=/\{(\d+)\}/g,f="prototype",g="hasOwnProperty",h={doc:document,win:window},i={was:Object.prototype[g].call(h.win,"Raphael"),is:h.win.Raphael},j=function(){this.ca=this.customAttributes={}},k,l="appendChild",m="apply",n="concat",o="createTouch"in h.doc,p="",q=" ",r=String,s="split",t="click dblclick mousedown mousemove mouseout mouseover mouseup touchstart touchmove touchend touchcancel"[s](q),u={mousedown:"touchstart",mousemove:"touchmove",mouseup:"touchend"},v=r.prototype.toLowerCase,w=Math,x=w.max,y=w.min,z=w.abs,A=w.pow,B=w.PI,C="number",D="string",E="array",F="toString",G="fill",H=Object.prototype.toString,I={},J="push",K=a._ISURL=/^url\(['"]?([^\)]+?)['"]?\)$/i,L=/^\s*((#[a-f\d]{6})|(#[a-f\d]{3})|rgba?\(\s*([\d\.]+%?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+%?(?:\s*,\s*[\d\.]+%?)?)\s*\)|hsba?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?)%?\s*\)|hsla?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?)%?\s*\))\s*$/i,M={NaN:1,Infinity:1,"-Infinity":1},N=/^(?:cubic-)?bezier\(([^,]+),([^,]+),([^,]+),([^\)]+)\)/,O=w.round,P="setAttribute",Q=parseFloat,R=parseInt,S=r.prototype.toUpperCase,T=a._availableAttrs={"arrow-end":"none","arrow-start":"none",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/","letter-spacing":0,opacity:1,path:"M0,0",r:0,rx:0,ry:0,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",transform:"",width:0,x:0,y:0},U=a._availableAnimAttrs={blur:C,"clip-rect":"csv",cx:C,cy:C,fill:"colour","fill-opacity":C,"font-size":C,height:C,opacity:C,path:"path",r:C,rx:C,ry:C,stroke:"colour","stroke-opacity":C,"stroke-width":C,transform:"transform",width:C,x:C,y:C},V=/[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]/g,W=/[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*/,X={hs:1,rg:1},Y=/,?([achlmqrstvxz]),?/gi,Z=/([achlmrqstvz])[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*)+)/ig,$=/([rstm])[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*)+)/ig,_=/(-?\d*\.?\d*(?:e[\-+]?\d+)?)[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*/ig,ba=a._radial_gradient=/^r(?:\(([^,]+?)[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*([^\)]+?)\))?/,bb={},bc=function(a,b){return a.key-b.key},bd=function(a,b){return Q(a)-Q(b)},be=function(){},bf=function(a){return a},bg=a._rectPath=function(a,b,c,d,e){if(e)return[["M",a+e,b],["l",c-e*2,0],["a",e,e,0,0,1,e,e],["l",0,d-e*2],["a",e,e,0,0,1,-e,e],["l",e*2-c,0],["a",e,e,0,0,1,-e,-e],["l",0,e*2-d],["a",e,e,0,0,1,e,-e],["z"]];return[["M",a,b],["l",c,0],["l",0,d],["l",-c,0],["z"]]},bh=function(a,b,c,d){d==null&&(d=c);return[["M",a,b],["m",0,-d],["a",c,d,0,1,1,0,2*d],["a",c,d,0,1,1,0,-2*d],["z"]]},bi=a._getPath={path:function(a){return a.attr("path")},circle:function(a){var b=a.attrs;return bh(b.cx,b.cy,b.r)},ellipse:function(a){var b=a.attrs;return bh(b.cx,b.cy,b.rx,b.ry)},rect:function(a){var b=a.attrs;return bg(b.x,b.y,b.width,b.height,b.r)},image:function(a){var b=a.attrs;return bg(b.x,b.y,b.width,b.height)},text:function(a){var b=a._getBBox();return bg(b.x,b.y,b.width,b.height)}},bj=a.mapPath=function(a,b){if(!b)return a;var c,d,e,f,g,h,i;a=bR(a);for(e=0,g=a.length;e<g;e++){i=a[e];for(f=1,h=i.length;f<h;f+=2)c=b.x(i[f],i[f+1]),d=b.y(i[f],i[f+1]),i[f]=c,i[f+1]=d}return a};a._g=h,a.type=h.win.SVGAngle||h.doc.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")?"SVG":"VML";if(a.type=="VML"){var bk=h.doc.createElement("div"),bl;bk.innerHTML='<v:shape adj="1"/>',bl=bk.firstChild,bl.style.behavior="url(#default#VML)";if(!bl||typeof bl.adj!="object")return a.type=p;bk=null}a.svg=!(a.vml=a.type=="VML"),a._Paper=j,a.fn=k=j.prototype=a.prototype,a._id=0,a._oid=0,a.is=function(a,b){b=v.call(b);if(b=="finite")return!M[g](+a);if(b=="array")return a instanceof Array;return b=="null"&&a===null||b==typeof a&&a!==null||b=="object"&&a===Object(a)||b=="array"&&Array.isArray&&Array.isArray(a)||H.call(a).slice(8,-1).toLowerCase()==b},a.angle=function(b,c,d,e,f,g){if(f==null){var h=b-d,i=c-e;if(!h&&!i)return 0;return(180+w.atan2(-i,-h)*180/B+360)%360}return a.angle(b,c,f,g)-a.angle(d,e,f,g)},a.rad=function(a){return a%360*B/180},a.deg=function(a){return a*180/B%360},a.snapTo=function(b,c,d){d=a.is(d,"finite")?d:10;if(a.is(b,E)){var e=b.length;while(e--)if(z(b[e]-c)<=d)return b[e]}else{b=+b;var f=c%b;if(f<d)return c-f;if(f>b-d)return c-f+b}return c};var bn=a.createUUID=function(a,b){return function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(a,b).toUpperCase()}}(/[xy]/g,function(a){var b=w.random()*16|0,c=a=="x"?b:b&3|8;return c.toString(16)});a.setWindow=function(b){eve("raphael.setWindow",a,h.win,b),h.win=b,h.doc=h.win.document,a._engine.initWin&&a._engine.initWin(h.win)};var bo=function(b){if(a.vml){var c=/^\s+|\s+$/g,d;try{var e=new ActiveXObject("htmlfile");e.write("<body>"),e.close(),d=e.body}catch(f){d=createPopup().document.body}var g=d.createTextRange();bo=bv(function(a){try{d.style.color=r(a).replace(c,p);var b=g.queryCommandValue("ForeColor");b=(b&255)<<16|b&65280|(b&16711680)>>>16;return"#"+("000000"+b.toString(16)).slice(-6)}catch(e){return"none"}})}else{var i=h.doc.createElement("i");i.title="Raphaël Colour Picker",i.style.display="none",h.doc.body.appendChild(i),bo=bv(function(a){i.style.color=a;return h.doc.defaultView.getComputedStyle(i,p).getPropertyValue("color")})}return bo(b)},bp=function(){return"hsb("+[this.h,this.s,this.b]+")"},bq=function(){return"hsl("+[this.h,this.s,this.l]+")"},br=function(){return this.hex},bs=function(b,c,d){c==null&&a.is(b,"object")&&"r"in b&&"g"in b&&"b"in b&&(d=b.b,c=b.g,b=b.r);if(c==null&&a.is(b,D)){var e=a.getRGB(b);b=e.r,c=e.g,d=e.b}if(b>1||c>1||d>1)b/=255,c/=255,d/=255;return[b,c,d]},bt=function(b,c,d,e){b*=255,c*=255,d*=255;var f={r:b,g:c,b:d,hex:a.rgb(b,c,d),toString:br};a.is(e,"finite")&&(f.opacity=e);return f};a.color=function(b){var c;a.is(b,"object")&&"h"in b&&"s"in b&&"b"in b?(c=a.hsb2rgb(b),b.r=c.r,b.g=c.g,b.b=c.b,b.hex=c.hex):a.is(b,"object")&&"h"in b&&"s"in b&&"l"in b?(c=a.hsl2rgb(b),b.r=c.r,b.g=c.g,b.b=c.b,b.hex=c.hex):(a.is(b,"string")&&(b=a.getRGB(b)),a.is(b,"object")&&"r"in b&&"g"in b&&"b"in b?(c=a.rgb2hsl(b),b.h=c.h,b.s=c.s,b.l=c.l,c=a.rgb2hsb(b),b.v=c.b):(b={hex:"none"},b.r=b.g=b.b=b.h=b.s=b.v=b.l=-1)),b.toString=br;return b},a.hsb2rgb=function(a,b,c,d){this.is(a,"object")&&"h"in a&&"s"in a&&"b"in a&&(c=a.b,b=a.s,a=a.h,d=a.o),a*=360;var e,f,g,h,i;a=a%360/60,i=c*b,h=i*(1-z(a%2-1)),e=f=g=c-i,a=~~a,e+=[i,h,0,0,h,i][a],f+=[h,i,i,h,0,0][a],g+=[0,0,h,i,i,h][a];return bt(e,f,g,d)},a.hsl2rgb=function(a,b,c,d){this.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/=360,b/=100,c/=100;a*=360;var e,f,g,h,i;a=a%360/60,i=2*b*(c<.5?c:1-c),h=i*(1-z(a%2-1)),e=f=g=c-i/2,a=~~a,e+=[i,h,0,0,h,i][a],f+=[h,i,i,h,0,0][a],g+=[0,0,h,i,i,h][a];return bt(e,f,g,d)},a.rgb2hsb=function(a,b,c){c=bs(a,b,c),a=c[0],b=c[1],c=c[2];var d,e,f,g;f=x(a,b,c),g=f-y(a,b,c),d=g==0?null:f==a?(b-c)/g:f==b?(c-a)/g+2:(a-b)/g+4,d=(d+360)%6*60/360,e=g==0?0:g/f;return{h:d,s:e,b:f,toString:bp}},a.rgb2hsl=function(a,b,c){c=bs(a,b,c),a=c[0],b=c[1],c=c[2];var d,e,f,g,h,i;g=x(a,b,c),h=y(a,b,c),i=g-h,d=i==0?null:g==a?(b-c)/i:g==b?(c-a)/i+2:(a-b)/i+4,d=(d+360)%6*60/360,f=(g+h)/2,e=i==0?0:f<.5?i/(2*f):i/(2-2*f);return{h:d,s:e,l:f,toString:bq}},a._path2string=function(){return this.join(",").replace(Y,"$1")};var bw=a._preload=function(a,b){var c=h.doc.createElement("img");c.style.cssText="position:absolute;left:-9999em;top:-9999em",c.onload=function(){b.call(this),this.onload=null,h.doc.body.removeChild(this)},c.onerror=function(){h.doc.body.removeChild(this)},h.doc.body.appendChild(c),c.src=a};a.getRGB=bv(function(b){if(!b||!!((b=r(b)).indexOf("-")+1))return{r:-1,g:-1,b:-1,hex:"none",error:1,toString:bx};if(b=="none")return{r:-1,g:-1,b:-1,hex:"none",toString:bx};!X[g](b.toLowerCase().substring(0,2))&&b.charAt()!="#"&&(b=bo(b));var c,d,e,f,h,i,j,k=b.match(L);if(k){k[2]&&(f=R(k[2].substring(5),16),e=R(k[2].substring(3,5),16),d=R(k[2].substring(1,3),16)),k[3]&&(f=R((i=k[3].charAt(3))+i,16),e=R((i=k[3].charAt(2))+i,16),d=R((i=k[3].charAt(1))+i,16)),k[4]&&(j=k[4][s](W),d=Q(j[0]),j[0].slice(-1)=="%"&&(d*=2.55),e=Q(j[1]),j[1].slice(-1)=="%"&&(e*=2.55),f=Q(j[2]),j[2].slice(-1)=="%"&&(f*=2.55),k[1].toLowerCase().slice(0,4)=="rgba"&&(h=Q(j[3])),j[3]&&j[3].slice(-1)=="%"&&(h/=100));if(k[5]){j=k[5][s](W),d=Q(j[0]),j[0].slice(-1)=="%"&&(d*=2.55),e=Q(j[1]),j[1].slice(-1)=="%"&&(e*=2.55),f=Q(j[2]),j[2].slice(-1)=="%"&&(f*=2.55),(j[0].slice(-3)=="deg"||j[0].slice(-1)=="°")&&(d/=360),k[1].toLowerCase().slice(0,4)=="hsba"&&(h=Q(j[3])),j[3]&&j[3].slice(-1)=="%"&&(h/=100);return a.hsb2rgb(d,e,f,h)}if(k[6]){j=k[6][s](W),d=Q(j[0]),j[0].slice(-1)=="%"&&(d*=2.55),e=Q(j[1]),j[1].slice(-1)=="%"&&(e*=2.55),f=Q(j[2]),j[2].slice(-1)=="%"&&(f*=2.55),(j[0].slice(-3)=="deg"||j[0].slice(-1)=="°")&&(d/=360),k[1].toLowerCase().slice(0,4)=="hsla"&&(h=Q(j[3])),j[3]&&j[3].slice(-1)=="%"&&(h/=100);return a.hsl2rgb(d,e,f,h)}k={r:d,g:e,b:f,toString:bx},k.hex="#"+(16777216|f|e<<8|d<<16).toString(16).slice(1),a.is(h,"finite")&&(k.opacity=h);return k}return{r:-1,g:-1,b:-1,hex:"none",error:1,toString:bx}},a),a.hsb=bv(function(b,c,d){return a.hsb2rgb(b,c,d).hex}),a.hsl=bv(function(b,c,d){return a.hsl2rgb(b,c,d).hex}),a.rgb=bv(function(a,b,c){return"#"+(16777216|c|b<<8|a<<16).toString(16).slice(1)}),a.getColor=function(a){var b=this.getColor.start=this.getColor.start||{h:0,s:1,b:a||.75},c=this.hsb2rgb(b.h,b.s,b.b);b.h+=.075,b.h>1&&(b.h=0,b.s-=.2,b.s<=0&&(this.getColor.start={h:0,s:1,b:b.b}));return c.hex},a.getColor.reset=function(){delete this.start},a.parsePathString=function(b){if(!b)return null;var c=bz(b);if(c.arr)return bJ(c.arr);var d={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0},e=[];a.is(b,E)&&a.is(b[0],E)&&(e=bJ(b)),e.length||r(b).replace(Z,function(a,b,c){var f=[],g=b.toLowerCase();c.replace(_,function(a,b){b&&f.push(+b)}),g=="m"&&f.length>2&&(e.push([b][n](f.splice(0,2))),g="l",b=b=="m"?"l":"L");if(g=="r")e.push([b][n](f));else while(f.length>=d[g]){e.push([b][n](f.splice(0,d[g])));if(!d[g])break}}),e.toString=a._path2string,c.arr=bJ(e);return e},a.parseTransformString=bv(function(b){if(!b)return null;var c={r:3,s:4,t:2,m:6},d=[];a.is(b,E)&&a.is(b[0],E)&&(d=bJ(b)),d.length||r(b).replace($,function(a,b,c){var e=[],f=v.call(b);c.replace(_,function(a,b){b&&e.push(+b)}),d.push([b][n](e))}),d.toString=a._path2string;return d});var bz=function(a){var b=bz.ps=bz.ps||{};b[a]?b[a].sleep=100:b[a]={sleep:100},setTimeout(function(){for(var c in b)b[g](c)&&c!=a&&(b[c].sleep--,!b[c].sleep&&delete b[c])});return b[a]};a.findDotsAtSegment=function(a,b,c,d,e,f,g,h,i){var j=1-i,k=A(j,3),l=A(j,2),m=i*i,n=m*i,o=k*a+l*3*i*c+j*3*i*i*e+n*g,p=k*b+l*3*i*d+j*3*i*i*f+n*h,q=a+2*i*(c-a)+m*(e-2*c+a),r=b+2*i*(d-b)+m*(f-2*d+b),s=c+2*i*(e-c)+m*(g-2*e+c),t=d+2*i*(f-d)+m*(h-2*f+d),u=j*a+i*c,v=j*b+i*d,x=j*e+i*g,y=j*f+i*h,z=90-w.atan2(q-s,r-t)*180/B;(q>s||r<t)&&(z+=180);return{x:o,y:p,m:{x:q,y:r},n:{x:s,y:t},start:{x:u,y:v},end:{x:x,y:y},alpha:z}},a.bezierBBox=function(b,c,d,e,f,g,h,i){a.is(b,"array")||(b=[b,c,d,e,f,g,h,i]);var j=bQ.apply(null,b);return{x:j.min.x,y:j.min.y,x2:j.max.x,y2:j.max.y,width:j.max.x-j.min.x,height:j.max.y-j.min.y}},a.isPointInsideBBox=function(a,b,c){return b>=a.x&&b<=a.x2&&c>=a.y&&c<=a.y2},a.isBBoxIntersect=function(b,c){var d=a.isPointInsideBBox;return d(c,b.x,b.y)||d(c,b.x2,b.y)||d(c,b.x,b.y2)||d(c,b.x2,b.y2)||d(b,c.x,c.y)||d(b,c.x2,c.y)||d(b,c.x,c.y2)||d(b,c.x2,c.y2)||(b.x<c.x2&&b.x>c.x||c.x<b.x2&&c.x>b.x)&&(b.y<c.y2&&b.y>c.y||c.y<b.y2&&c.y>b.y)},a.pathIntersection=function(a,b){return bH(a,b)},a.pathIntersectionNumber=function(a,b){return bH(a,b,1)},a.isPointInsidePath=function(b,c,d){var e=a.pathBBox(b);return a.isPointInsideBBox(e,c,d)&&bH(b,[["M",c,d],["H",e.x2+10]],1)%2==1},a._removedFactory=function(a){return function(){eve("raphael.log",null,"Raphaël: you are calling to method “"+a+"” of removed object",a)}};var bI=a.pathBBox=function(a){var b=bz(a);if(b.bbox)return b.bbox;if(!a)return{x:0,y:0,width:0,height:0,x2:0,y2:0};a=bR(a);var c=0,d=0,e=[],f=[],g;for(var h=0,i=a.length;h<i;h++){g=a[h];if(g[0]=="M")c=g[1],d=g[2],e.push(c),f.push(d);else{var j=bQ(c,d,g[1],g[2],g[3],g[4],g[5],g[6]);e=e[n](j.min.x,j.max.x),f=f[n](j.min.y,j.max.y),c=g[5],d=g[6]}}var k=y[m](0,e),l=y[m](0,f),o=x[m](0,e),p=x[m](0,f),q={x:k,y:l,x2:o,y2:p,width:o-k,height:p-l};b.bbox=bm(q);return q},bJ=function(b){var c=bm(b);c.toString=a._path2string;return c},bK=a._pathToRelative=function(b){var c=bz(b);if(c.rel)return bJ(c.rel);if(!a.is(b,E)||!a.is(b&&b[0],E))b=a.parsePathString(b);var d=[],e=0,f=0,g=0,h=0,i=0;b[0][0]=="M"&&(e=b[0][1],f=b[0][2],g=e,h=f,i++,d.push(["M",e,f]));for(var j=i,k=b.length;j<k;j++){var l=d[j]=[],m=b[j];if(m[0]!=v.call(m[0])){l[0]=v.call(m[0]);switch(l[0]){case"a":l[1]=m[1],l[2]=m[2],l[3]=m[3],l[4]=m[4],l[5]=m[5],l[6]=+(m[6]-e).toFixed(3),l[7]=+(m[7]-f).toFixed(3);break;case"v":l[1]=+(m[1]-f).toFixed(3);break;case"m":g=m[1],h=m[2];default:for(var n=1,o=m.length;n<o;n++)l[n]=+(m[n]-(n%2?e:f)).toFixed(3)}}else{l=d[j]=[],m[0]=="m"&&(g=m[1]+e,h=m[2]+f);for(var p=0,q=m.length;p<q;p++)d[j][p]=m[p]}var r=d[j].length;switch(d[j][0]){case"z":e=g,f=h;break;case"h":e+=+d[j][r-1];break;case"v":f+=+d[j][r-1];break;default:e+=+d[j][r-2],f+=+d[j][r-1]}}d.toString=a._path2string,c.rel=bJ(d);return d},bL=a._pathToAbsolute=function(b){var c=bz(b);if(c.abs)return bJ(c.abs);if(!a.is(b,E)||!a.is(b&&b[0],E))b=a.parsePathString(b);if(!b||!b.length)return[["M",0,0]];var d=[],e=0,f=0,g=0,h=0,i=0;b[0][0]=="M"&&(e=+b[0][1],f=+b[0][2],g=e,h=f,i++,d[0]=["M",e,f]);var j=b.length==3&&b[0][0]=="M"&&b[1][0].toUpperCase()=="R"&&b[2][0].toUpperCase()=="Z";for(var k,l,m=i,o=b.length;m<o;m++){d.push(k=[]),l=b[m];if(l[0]!=S.call(l[0])){k[0]=S.call(l[0]);switch(k[0]){case"A":k[1]=l[1],k[2]=l[2],k[3]=l[3],k[4]=l[4],k[5]=l[5],k[6]=+(l[6]+e),k[7]=+(l[7]+f);break;case"V":k[1]=+l[1]+f;break;case"H":k[1]=+l[1]+e;break;case"R":var p=[e,f][n](l.slice(1));for(var q=2,r=p.length;q<r;q++)p[q]=+p[q]+e,p[++q]=+p[q]+f;d.pop(),d=d[n](by(p,j));break;case"M":g=+l[1]+e,h=+l[2]+f;default:for(q=1,r=l.length;q<r;q++)k[q]=+l[q]+(q%2?e:f)}}else if(l[0]=="R")p=[e,f][n](l.slice(1)),d.pop(),d=d[n](by(p,j)),k=["R"][n](l.slice(-2));else for(var s=0,t=l.length;s<t;s++)k[s]=l[s];switch(k[0]){case"Z":e=g,f=h;break;case"H":e=k[1];break;case"V":f=k[1];break;case"M":g=k[k.length-2],h=k[k.length-1];default:e=k[k.length-2],f=k[k.length-1]}}d.toString=a._path2string,c.abs=bJ(d);return d},bM=function(a,b,c,d){return[a,b,c,d,c,d]},bN=function(a,b,c,d,e,f){var g=1/3,h=2/3;return[g*a+h*c,g*b+h*d,g*e+h*c,g*f+h*d,e,f]},bO=function(a,b,c,d,e,f,g,h,i,j){var k=B*120/180,l=B/180*(+e||0),m=[],o,p=bv(function(a,b,c){var d=a*w.cos(c)-b*w.sin(c),e=a*w.sin(c)+b*w.cos(c);return{x:d,y:e}});if(!j){o=p(a,b,-l),a=o.x,b=o.y,o=p(h,i,-l),h=o.x,i=o.y;var q=w.cos(B/180*e),r=w.sin(B/180*e),t=(a-h)/2,u=(b-i)/2,v=t*t/(c*c)+u*u/(d*d);v>1&&(v=w.sqrt(v),c=v*c,d=v*d);var x=c*c,y=d*d,A=(f==g?-1:1)*w.sqrt(z((x*y-x*u*u-y*t*t)/(x*u*u+y*t*t))),C=A*c*u/d+(a+h)/2,D=A*-d*t/c+(b+i)/2,E=w.asin(((b-D)/d).toFixed(9)),F=w.asin(((i-D)/d).toFixed(9));E=a<C?B-E:E,F=h<C?B-F:F,E<0&&(E=B*2+E),F<0&&(F=B*2+F),g&&E>F&&(E=E-B*2),!g&&F>E&&(F=F-B*2)}else E=j[0],F=j[1],C=j[2],D=j[3];var G=F-E;if(z(G)>k){var H=F,I=h,J=i;F=E+k*(g&&F>E?1:-1),h=C+c*w.cos(F),i=D+d*w.sin(F),m=bO(h,i,c,d,e,0,g,I,J,[F,H,C,D])}G=F-E;var K=w.cos(E),L=w.sin(E),M=w.cos(F),N=w.sin(F),O=w.tan(G/4),P=4/3*c*O,Q=4/3*d*O,R=[a,b],S=[a+P*L,b-Q*K],T=[h+P*N,i-Q*M],U=[h,i];S[0]=2*R[0]-S[0],S[1]=2*R[1]-S[1];if(j)return[S,T,U][n](m);m=[S,T,U][n](m).join()[s](",");var V=[];for(var W=0,X=m.length;W<X;W++)V[W]=W%2?p(m[W-1],m[W],l).y:p(m[W],m[W+1],l).x;return V},bP=function(a,b,c,d,e,f,g,h,i){var j=1-i;return{x:A(j,3)*a+A(j,2)*3*i*c+j*3*i*i*e+A(i,3)*g,y:A(j,3)*b+A(j,2)*3*i*d+j*3*i*i*f+A(i,3)*h}},bQ=bv(function(a,b,c,d,e,f,g,h){var i=e-2*c+a-(g-2*e+c),j=2*(c-a)-2*(e-c),k=a-c,l=(-j+w.sqrt(j*j-4*i*k))/2/i,n=(-j-w.sqrt(j*j-4*i*k))/2/i,o=[b,h],p=[a,g],q;z(l)>"1e12"&&(l=.5),z(n)>"1e12"&&(n=.5),l>0&&l<1&&(q=bP(a,b,c,d,e,f,g,h,l),p.push(q.x),o.push(q.y)),n>0&&n<1&&(q=bP(a,b,c,d,e,f,g,h,n),p.push(q.x),o.push(q.y)),i=f-2*d+b-(h-2*f+d),j=2*(d-b)-2*(f-d),k=b-d,l=(-j+w.sqrt(j*j-4*i*k))/2/i,n=(-j-w.sqrt(j*j-4*i*k))/2/i,z(l)>"1e12"&&(l=.5),z(n)>"1e12"&&(n=.5),l>0&&l<1&&(q=bP(a,b,c,d,e,f,g,h,l),p.push(q.x),o.push(q.y)),n>0&&n<1&&(q=bP(a,b,c,d,e,f,g,h,n),p.push(q.x),o.push(q.y));return{min:{x:y[m](0,p),y:y[m](0,o)},max:{x:x[m](0,p),y:x[m](0,o)}}}),bR=a._path2curve=bv(function(a,b){var c=!b&&bz(a);if(!b&&c.curve)return bJ(c.curve);var d=bL(a),e=b&&bL(b),f={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},g={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},h=function(a,b){var c,d;if(!a)return["C",b.x,b.y,b.x,b.y,b.x,b.y];!(a[0]in{T:1,Q:1})&&(b.qx=b.qy=null);switch(a[0]){case"M":b.X=a[1],b.Y=a[2];break;case"A":a=["C"][n](bO[m](0,[b.x,b.y][n](a.slice(1))));break;case"S":c=b.x+(b.x-(b.bx||b.x)),d=b.y+(b.y-(b.by||b.y)),a=["C",c,d][n](a.slice(1));break;case"T":b.qx=b.x+(b.x-(b.qx||b.x)),b.qy=b.y+(b.y-(b.qy||b.y)),a=["C"][n](bN(b.x,b.y,b.qx,b.qy,a[1],a[2]));break;case"Q":b.qx=a[1],b.qy=a[2],a=["C"][n](bN(b.x,b.y,a[1],a[2],a[3],a[4]));break;case"L":a=["C"][n](bM(b.x,b.y,a[1],a[2]));break;case"H":a=["C"][n](bM(b.x,b.y,a[1],b.y));break;case"V":a=["C"][n](bM(b.x,b.y,b.x,a[1]));break;case"Z":a=["C"][n](bM(b.x,b.y,b.X,b.Y))}return a},i=function(a,b){if(a[b].length>7){a[b].shift();var c=a[b];while(c.length)a.splice(b++,0,["C"][n](c.splice(0,6)));a.splice(b,1),l=x(d.length,e&&e.length||0)}},j=function(a,b,c,f,g){a&&b&&a[g][0]=="M"&&b[g][0]!="M"&&(b.splice(g,0,["M",f.x,f.y]),c.bx=0,c.by=0,c.x=a[g][1],c.y=a[g][2],l=x(d.length,e&&e.length||0))};for(var k=0,l=x(d.length,e&&e.length||0);k<l;k++){d[k]=h(d[k],f),i(d,k),e&&(e[k]=h(e[k],g)),e&&i(e,k),j(d,e,f,g,k),j(e,d,g,f,k);var o=d[k],p=e&&e[k],q=o.length,r=e&&p.length;f.x=o[q-2],f.y=o[q-1],f.bx=Q(o[q-4])||f.x,f.by=Q(o[q-3])||f.y,g.bx=e&&(Q(p[r-4])||g.x),g.by=e&&(Q(p[r-3])||g.y),g.x=e&&p[r-2],g.y=e&&p[r-1]}e||(c.curve=bJ(d));return e?[d,e]:d},null,bJ),bS=a._parseDots=bv(function(b){var c=[];for(var d=0,e=b.length;d<e;d++){var f={},g=b[d].match(/^([^:]*):?([\d\.]*)/);f.color=a.getRGB(g[1]);if(f.color.error)return null;f.color=f.color.hex,g[2]&&(f.offset=g[2]+"%"),c.push(f)}for(d=1,e=c.length-1;d<e;d++)if(!c[d].offset){var h=Q(c[d-1].offset||0),i=0;for(var j=d+1;j<e;j++)if(c[j].offset){i=c[j].offset;break}i||(i=100,j=e),i=Q(i);var k=(i-h)/(j-d+1);for(;d<j;d++)h+=k,c[d].offset=h+"%"}return c}),bT=a._tear=function(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)},bU=a._tofront=function(a,b){b.top!==a&&(bT(a,b),a.next=null,a.prev=b.top,b.top.next=a,b.top=a)},bV=a._toback=function(a,b){b.bottom!==a&&(bT(a,b),a.next=b.bottom,a.prev=null,b.bottom.prev=a,b.bottom=a)},bW=a._insertafter=function(a,b,c){bT(a,c),b==c.top&&(c.top=a),b.next&&(b.next.prev=a),a.next=b.next,a.prev=b,b.next=a},bX=a._insertbefore=function(a,b,c){bT(a,c),b==c.bottom&&(c.bottom=a),b.prev&&(b.prev.next=a),a.prev=b.prev,b.prev=a,a.next=b},bY=a.toMatrix=function(a,b){var c=bI(a),d={_:{transform:p},getBBox:function(){return c}};b$(d,b);return d.matrix},bZ=a.transformPath=function(a,b){return bj(a,bY(a,b))},b$=a._extractTransform=function(b,c){if(c==null)return b._.transform;c=r(c).replace(/\.{3}|\u2026/g,b._.transform||p);var d=a.parseTransformString(c),e=0,f=0,g=0,h=1,i=1,j=b._,k=new cb;j.transform=d||[];if(d)for(var l=0,m=d.length;l<m;l++){var n=d[l],o=n.length,q=r(n[0]).toLowerCase(),s=n[0]!=q,t=s?k.invert():0,u,v,w,x,y;q=="t"&&o==3?s?(u=t.x(0,0),v=t.y(0,0),w=t.x(n[1],n[2]),x=t.y(n[1],n[2]),k.translate(w-u,x-v)):k.translate(n[1],n[2]):q=="r"?o==2?(y=y||b.getBBox(1),k.rotate(n[1],y.x+y.width/2,y.y+y.height/2),e+=n[1]):o==4&&(s?(w=t.x(n[2],n[3]),x=t.y(n[2],n[3]),k.rotate(n[1],w,x)):k.rotate(n[1],n[2],n[3]),e+=n[1]):q=="s"?o==2||o==3?(y=y||b.getBBox(1),k.scale(n[1],n[o-1],y.x+y.width/2,y.y+y.height/2),h*=n[1],i*=n[o-1]):o==5&&(s?(w=t.x(n[3],n[4]),x=t.y(n[3],n[4]),k.scale(n[1],n[2],w,x)):k.scale(n[1],n[2],n[3],n[4]),h*=n[1],i*=n[2]):q=="m"&&o==7&&k.add(n[1],n[2],n[3],n[4],n[5],n[6]),j.dirtyT=1,b.matrix=k}b.matrix=k,j.sx=h,j.sy=i,j.deg=e,j.dx=f=k.e,j.dy=g=k.f,h==1&&i==1&&!e&&j.bbox?(j.bbox.x+=+f,j.bbox.y+=+g):j.dirtyT=1},b_=function(a){var b=a[0];switch(b.toLowerCase()){case"t":return[b,0,0];case"m":return[b,1,0,0,1,0,0];case"r":return a.length==4?[b,0,a[2],a[3]]:[b,0];case"s":return a.length==5?[b,1,1,a[3],a[4]]:a.length==3?[b,1,1]:[b,1]}},ca=a._equaliseTransform=function(b,c){c=r(c).replace(/\.{3}|\u2026/g,b),b=a.parseTransformString(b)||[],c=a.parseTransformString(c)||[];var d=x(b.length,c.length),e=[],f=[],g=0,h,i,j,k;for(;g<d;g++){j=b[g]||b_(c[g]),k=c[g]||b_(j);if(j[0]!=k[0]||j[0].toLowerCase()=="r"&&(j[2]!=k[2]||j[3]!=k[3])||j[0].toLowerCase()=="s"&&(j[3]!=k[3]||j[4]!=k[4]))return;e[g]=[],f[g]=[];for(h=0,i=x(j.length,k.length);h<i;h++)h in j&&(e[g][h]=j[h]),h in k&&(f[g][h]=k[h])}return{from:e,to:f}};a._getContainer=function(b,c,d,e){var f;f=e==null&&!a.is(b,"object")?h.doc.getElementById(b):b;if(f!=null){if(f.tagName)return c==null?{container:f,width:f.style.pixelWidth||f.offsetWidth,height:f.style.pixelHeight||f.offsetHeight}:{container:f,width:c,height:d};return{container:1,x:b,y:c,width:d,height:e}}},a.pathToRelative=bK,a._engine={},a.path2curve=bR,a.matrix=function(a,b,c,d,e,f){return new cb(a,b,c,d,e,f)},function(b){function d(a){var b=w.sqrt(c(a));a[0]&&(a[0]/=b),a[1]&&(a[1]/=b)}function c(a){return a[0]*a[0]+a[1]*a[1]}b.add=function(a,b,c,d,e,f){var g=[[],[],[]],h=[[this.a,this.c,this.e],[this.b,this.d,this.f],[0,0,1]],i=[[a,c,e],[b,d,f],[0,0,1]],j,k,l,m;a&&a instanceof cb&&(i=[[a.a,a.c,a.e],[a.b,a.d,a.f],[0,0,1]]);for(j=0;j<3;j++)for(k=0;k<3;k++){m=0;for(l=0;l<3;l++)m+=h[j][l]*i[l][k];g[j][k]=m}this.a=g[0][0],this.b=g[1][0],this.c=g[0][1],this.d=g[1][1],this.e=g[0][2],this.f=g[1][2]},b.invert=function(){var a=this,b=a.a*a.d-a.b*a.c;return new cb(a.d/b,-a.b/b,-a.c/b,a.a/b,(a.c*a.f-a.d*a.e)/b,(a.b*a.e-a.a*a.f)/b)},b.clone=function(){return new cb(this.a,this.b,this.c,this.d,this.e,this.f)},b.translate=function(a,b){this.add(1,0,0,1,a,b)},b.scale=function(a,b,c,d){b==null&&(b=a),(c||d)&&this.add(1,0,0,1,c,d),this.add(a,0,0,b,0,0),(c||d)&&this.add(1,0,0,1,-c,-d)},b.rotate=function(b,c,d){b=a.rad(b),c=c||0,d=d||0;var e=+w.cos(b).toFixed(9),f=+w.sin(b).toFixed(9);this.add(e,f,-f,e,c,d),this.add(1,0,0,1,-c,-d)},b.x=function(a,b){return a*this.a+b*this.c+this.e},b.y=function(a,b){return a*this.b+b*this.d+this.f},b.get=function(a){return+this[r.fromCharCode(97+a)].toFixed(4)},b.toString=function(){return a.svg?"matrix("+[this.get(0),this.get(1),this.get(2),this.get(3),this.get(4),this.get(5)].join()+")":[this.get(0),this.get(2),this.get(1),this.get(3),0,0].join()},b.toFilter=function(){return"progid:DXImageTransform.Microsoft.Matrix(M11="+this.get(0)+", M12="+this.get(2)+", M21="+this.get(1)+", M22="+this.get(3)+", Dx="+this.get(4)+", Dy="+this.get(5)+", sizingmethod='auto expand')"},b.offset=function(){return[this.e.toFixed(4),this.f.toFixed(4)]},b.split=function(){var b={};b.dx=this.e,b.dy=this.f;var e=[[this.a,this.c],[this.b,this.d]];b.scalex=w.sqrt(c(e[0])),d(e[0]),b.shear=e[0][0]*e[1][0]+e[0][1]*e[1][1],e[1]=[e[1][0]-e[0][0]*b.shear,e[1][1]-e[0][1]*b.shear],b.scaley=w.sqrt(c(e[1])),d(e[1]),b.shear/=b.scaley;var f=-e[0][1],g=e[1][1];g<0?(b.rotate=a.deg(w.acos(g)),f<0&&(b.rotate=360-b.rotate)):b.rotate=a.deg(w.asin(f)),b.isSimple=!+b.shear.toFixed(9)&&(b.scalex.toFixed(9)==b.scaley.toFixed(9)||!b.rotate),b.isSuperSimple=!+b.shear.toFixed(9)&&b.scalex.toFixed(9)==b.scaley.toFixed(9)&&!b.rotate,b.noRotation=!+b.shear.toFixed(9)&&!b.rotate;return b},b.toTransformString=function(a){var b=a||this[s]();if(b.isSimple){b.scalex=+b.scalex.toFixed(4),b.scaley=+b.scaley.toFixed(4),b.rotate=+b.rotate.toFixed(4);return(b.dx||b.dy?"t"+[b.dx,b.dy]:p)+(b.scalex!=1||b.scaley!=1?"s"+[b.scalex,b.scaley,0,0]:p)+(b.rotate?"r"+[b.rotate,0,0]:p)}return"m"+[this.get(0),this.get(1),this.get(2),this.get(3),this.get(4),this.get(5)]}}(cb.prototype);var cc=navigator.userAgent.match(/Version\/(.*?)\s/)||navigator.userAgent.match(/Chrome\/(\d+)/);navigator.vendor=="Apple Computer, Inc."&&(cc&&cc[1]<4||navigator.platform.slice(0,2)=="iP")||navigator.vendor=="Google Inc."&&cc&&cc[1]<8?k.safari=function(){var a=this.rect(-99,-99,this.width+99,this.height+99).attr({stroke:"none"});setTimeout(function(){a.remove()})}:k.safari=be;var cd=function(){this.returnValue=!1},ce=function(){return this.originalEvent.preventDefault()},cf=function(){this.cancelBubble=!0},cg=function(){return this.originalEvent.stopPropagation()},ch=function(){if(h.doc.addEventListener)return function(a,b,c,d){var e=o&&u[b]?u[b]:b,f=function(e){var f=h.doc.documentElement.scrollTop||h.doc.body.scrollTop,i=h.doc.documentElement.scrollLeft||h.doc.body.scrollLeft,j=e.clientX+i,k=e.clientY+f;if(o&&u[g](b))for(var l=0,m=e.targetTouches&&e.targetTouches.length;l<m;l++)if(e.targetTouches[l].target==a){var n=e;e=e.targetTouches[l],e.originalEvent=n,e.preventDefault=ce,e.stopPropagation=cg;break}return c.call(d,e,j,k)};a.addEventListener(e,f,!1);return function(){a.removeEventListener(e,f,!1);return!0}};if(h.doc.attachEvent)return function(a,b,c,d){var e=function(a){a=a||h.win.event;var b=h.doc.documentElement.scrollTop||h.doc.body.scrollTop,e=h.doc.documentElement.scrollLeft||h.doc.body.scrollLeft,f=a.clientX+e,g=a.clientY+b;a.preventDefault=a.preventDefault||cd,a.stopPropagation=a.stopPropagation||cf;return c.call(d,a,f,g)};a.attachEvent("on"+b,e);var f=function(){a.detachEvent("on"+b,e);return!0};return f}}(),ci=[],cj=function(a){var b=a.clientX,c=a.clientY,d=h.doc.documentElement.scrollTop||h.doc.body.scrollTop,e=h.doc.documentElement.scrollLeft||h.doc.body.scrollLeft,f,g=ci.length;while(g--){f=ci[g];if(o){var i=a.touches.length,j;while(i--){j=a.touches[i];if(j.identifier==f.el._drag.id){b=j.clientX,c=j.clientY,(a.originalEvent?a.originalEvent:a).preventDefault();break}}}else a.preventDefault();var k=f.el.node,l,m=k.nextSibling,n=k.parentNode,p=k.style.display;h.win.opera&&n.removeChild(k),k.style.display="none",l=f.el.paper.getElementByPoint(b,c),k.style.display=p,h.win.opera&&(m?n.insertBefore(k,m):n.appendChild(k)),l&&eve("raphael.drag.over."+f.el.id,f.el,l),b+=e,c+=d,eve("raphael.drag.move."+f.el.id,f.move_scope||f.el,b-f.el._drag.x,c-f.el._drag.y,b,c,a)}},ck=function(b){a.unmousemove(cj).unmouseup(ck);var c=ci.length,d;while(c--)d=ci[c],d.el._drag={},eve("raphael.drag.end."+d.el.id,d.end_scope||d.start_scope||d.move_scope||d.el,b);ci=[]},cl=a.el={};for(var cm=t.length;cm--;)(function(b){a[b]=cl[b]=function(c,d){a.is(c,"function")&&(this.events=this.events||[],this.events.push({name:b,f:c,unbind:ch(this.shape||this.node||h.doc,b,c,d||this)}));return this},a["un"+b]=cl["un"+b]=function(a){var c=this.events||[],d=c.length;while(d--)if(c[d].name==b&&c[d].f==a){c[d].unbind(),c.splice(d,1),!c.length&&delete this.events;return this}return this}})(t[cm]);cl.data=function(b,c){var d=bb[this.id]=bb[this.id]||{};if(arguments.length==1){if(a.is(b,"object")){for(var e in b)b[g](e)&&this.data(e,b[e]);return this}eve("raphael.data.get."+this.id,this,d[b],b);return d[b]}d[b]=c,eve("raphael.data.set."+this.id,this,c,b);return this},cl.removeData=function(a){a==null?bb[this.id]={}:bb[this.id]&&delete bb[this.id][a];return this},cl.hover=function(a,b,c,d){return this.mouseover(a,c).mouseout(b,d||c)},cl.unhover=function(a,b){return this.unmouseover(a).unmouseout(b)};var cn=[];cl.drag=function(b,c,d,e,f,g){function i(i){(i.originalEvent||i).preventDefault();var j=h.doc.documentElement.scrollTop||h.doc.body.scrollTop,k=h.doc.documentElement.scrollLeft||h.doc.body.scrollLeft;this._drag.x=i.clientX+k,this._drag.y=i.clientY+j,this._drag.id=i.identifier,!ci.length&&a.mousemove(cj).mouseup(ck),ci.push({el:this,move_scope:e,start_scope:f,end_scope:g}),c&&eve.on("raphael.drag.start."+this.id,c),b&&eve.on("raphael.drag.move."+this.id,b),d&&eve.on("raphael.drag.end."+this.id,d),eve("raphael.drag.start."+this.id,f||e||this,i.clientX+k,i.clientY+j,i)}this._drag={},cn.push({el:this,start:i}),this.mousedown(i);return this},cl.onDragOver=function(a){a?eve.on("raphael.drag.over."+this.id,a):eve.unbind("raphael.drag.over."+this.id)},cl.undrag=function(){var b=cn.length;while(b--)cn[b].el==this&&(this.unmousedown(cn[b].start),cn.splice(b,1),eve.unbind("raphael.drag.*."+this.id));!cn.length&&a.unmousemove(cj).unmouseup(ck)},k.circle=function(b,c,d){var e=a._engine.circle(this,b||0,c||0,d||0);this.__set__&&this.__set__.push(e);return e},k.rect=function(b,c,d,e,f){var g=a._engine.rect(this,b||0,c||0,d||0,e||0,f||0);this.__set__&&this.__set__.push(g);return g},k.ellipse=function(b,c,d,e){var f=a._engine.ellipse(this,b||0,c||0,d||0,e||0);this.__set__&&this.__set__.push(f);return f},k.path=function(b){b&&!a.is(b,D)&&!a.is(b[0],E)&&(b+=p);var c=a._engine.path(a.format[m](a,arguments),this);this.__set__&&this.__set__.push(c);return c},k.image=function(b,c,d,e,f){var g=a._engine.image(this,b||"about:blank",c||0,d||0,e||0,f||0);this.__set__&&this.__set__.push(g);return g},k.text=function(b,c,d){var e=a._engine.text(this,b||0,c||0,r(d));this.__set__&&this.__set__.push(e);return e},k.set=function(b){!a.is(b,"array")&&(b=Array.prototype.splice.call(arguments,0,arguments.length));var c=new cG(b);this.__set__&&this.__set__.push(c);return c},k.setStart=function(a){this.__set__=a||this.set()},k.setFinish=function(a){var b=this.__set__;delete this.__set__;return b},k.setSize=function(b,c){return a._engine.setSize.call(this,b,c)},k.setViewBox=function(b,c,d,e,f){return a._engine.setViewBox.call(this,b,c,d,e,f)},k.top=k.bottom=null,k.raphael=a;var co=function(a){var b=a.getBoundingClientRect(),c=a.ownerDocument,d=c.body,e=c.documentElement,f=e.clientTop||d.clientTop||0,g=e.clientLeft||d.clientLeft||0,i=b.top+(h.win.pageYOffset||e.scrollTop||d.scrollTop)-f,j=b.left+(h.win.pageXOffset||e.scrollLeft||d.scrollLeft)-g;return{y:i,x:j}};k.getElementByPoint=function(a,b){var c=this,d=c.canvas,e=h.doc.elementFromPoint(a,b);if(h.win.opera&&e.tagName=="svg"){var f=co(d),g=d.createSVGRect();g.x=a-f.x,g.y=b-f.y,g.width=g.height=1;var i=d.getIntersectionList(g,null);i.length&&(e=i[i.length-1])}if(!e)return null;while(e.parentNode&&e!=d.parentNode&&!e.raphael)e=e.parentNode;e==c.canvas.parentNode&&(e=d),e=e&&e.raphael?c.getById(e.raphaelid):null;return e},k.getById=function(a){var b=this.bottom;while(b){if(b.id==a)return b;b=b.next}return null},k.forEach=function(a,b){var c=this.bottom;while(c){if(a.call(b,c)===!1)return this;c=c.next}return this},k.getElementsByPoint=function(a,b){var c=this.set();this.forEach(function(d){d.isPointInside(a,b)&&c.push(d)});return c},cl.isPointInside=function(b,c){var d=this.realPath=this.realPath||bi[this.type](this);return a.isPointInsidePath(d,b,c)},cl.getBBox=function(a){if(this.removed)return{};var b=this._;if(a){if(b.dirty||!b.bboxwt)this.realPath=bi[this.type](this),b.bboxwt=bI(this.realPath),b.bboxwt.toString=cq,b.dirty=0;return b.bboxwt}if(b.dirty||b.dirtyT||!b.bbox){if(b.dirty||!this.realPath)b.bboxwt=0,this.realPath=bi[this.type](this);b.bbox=bI(bj(this.realPath,this.matrix)),b.bbox.toString=cq,b.dirty=b.dirtyT=0}return b.bbox},cl.clone=function(){if(this.removed)return null;var a=this.paper[this.type]().attr(this.attr());this.__set__&&this.__set__.push(a);return a},cl.glow=function(a){if(this.type=="text")return null;a=a||{};var b={width:(a.width||10)+(+this.attr("stroke-width")||1),fill:a.fill||!1,opacity:a.opacity||.5,offsetx:a.offsetx||0,offsety:a.offsety||0,color:a.color||"#000"},c=b.width/2,d=this.paper,e=d.set(),f=this.realPath||bi[this.type](this);f=this.matrix?bj(f,this.matrix):f;for(var g=1;g<c+1;g++)e.push(d.path(f).attr({stroke:b.color,fill:b.fill?b.color:"none","stroke-linejoin":"round","stroke-linecap":"round","stroke-width":+(b.width/c*g).toFixed(3),opacity:+(b.opacity/c).toFixed(3)}));return e.insertBefore(this).translate(b.offsetx,b.offsety)};var cr={},cs=function(b,c,d,e,f,g,h,i,j){return j==null?bB(b,c,d,e,f,g,h,i):a.findDotsAtSegment(b,c,d,e,f,g,h,i,bC(b,c,d,e,f,g,h,i,j))},ct=function(b,c){return function(d,e,f){d=bR(d);var g,h,i,j,k="",l={},m,n=0;for(var o=0,p=d.length;o<p;o++){i=d[o];if(i[0]=="M")g=+i[1],h=+i[2];else{j=cs(g,h,i[1],i[2],i[3],i[4],i[5],i[6]);if(n+j>e){if(c&&!l.start){m=cs(g,h,i[1],i[2],i[3],i[4],i[5],i[6],e-n),k+=["C"+m.start.x,m.start.y,m.m.x,m.m.y,m.x,m.y];if(f)return k;l.start=k,k=["M"+m.x,m.y+"C"+m.n.x,m.n.y,m.end.x,m.end.y,i[5],i[6]].join(),n+=j,g=+i[5],h=+i[6];continue}if(!b&&!c){m=cs(g,h,i[1],i[2],i[3],i[4],i[5],i[6],e-n);return{x:m.x,y:m.y,alpha:m.alpha}}}n+=j,g=+i[5],h=+i[6]}k+=i.shift()+i}l.end=k,m=b?n:c?l:a.findDotsAtSegment(g,h,i[0],i[1],i[2],i[3],i[4],i[5],1),m.alpha&&(m={x:m.x,y:m.y,alpha:m.alpha});return m}},cu=ct(1),cv=ct(),cw=ct(0,1);a.getTotalLength=cu,a.getPointAtLength=cv,a.getSubpath=function(a,b,c){if(this.getTotalLength(a)-c<1e-6)return cw(a,b).end;var d=cw(a,c,1);return b?cw(d,b).end:d},cl.getTotalLength=function(){if(this.type=="path"){if(this.node.getTotalLength)return this.node.getTotalLength();return cu(this.attrs.path)}},cl.getPointAtLength=function(a){if(this.type=="path")return cv(this.attrs.path,a)},cl.getSubpath=function(b,c){if(this.type=="path")return a.getSubpath(this.attrs.path,b,c)};var cx=a.easing_formulas={linear:function(a){return a},"<":function(a){return A(a,1.7)},">":function(a){return A(a,.48)},"<>":function(a){var b=.48-a/1.04,c=w.sqrt(.1734+b*b),d=c-b,e=A(z(d),1/3)*(d<0?-1:1),f=-c-b,g=A(z(f),1/3)*(f<0?-1:1),h=e+g+.5;return(1-h)*3*h*h+h*h*h},backIn:function(a){var b=1.70158;return a*a*((b+1)*a-b)},backOut:function(a){a=a-1;var b=1.70158;return a*a*((b+1)*a+b)+1},elastic:function(a){if(a==!!a)return a;return A(2,-10*a)*w.sin((a-.075)*2*B/.3)+1},bounce:function(a){var b=7.5625,c=2.75,d;a<1/c?d=b*a*a:a<2/c?(a-=1.5/c,d=b*a*a+.75):a<2.5/c?(a-=2.25/c,d=b*a*a+.9375):(a-=2.625/c,d=b*a*a+.984375);return d}};cx.easeIn=cx["ease-in"]=cx["<"],cx.easeOut=cx["ease-out"]=cx[">"],cx.easeInOut=cx["ease-in-out"]=cx["<>"],cx["back-in"]=cx.backIn,cx["back-out"]=cx.backOut;var cy=[],cz=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){setTimeout(a,16)},cA=function(){var b=+(new Date),c=0;for(;c<cy.length;c++){var d=cy[c];if(d.el.removed||d.paused)continue;var e=b-d.start,f=d.ms,h=d.easing,i=d.from,j=d.diff,k=d.to,l=d.t,m=d.el,o={},p,r={},s;d.initstatus?(e=(d.initstatus*d.anim.top-d.prev)/(d.percent-d.prev)*f,d.status=d.initstatus,delete d.initstatus,d.stop&&cy.splice(c--,1)):d.status=(d.prev+(d.percent-d.prev)*(e/f))/d.anim.top;if(e<0)continue;if(e<f){var t=h(e/f);for(var u in i)if(i[g](u)){switch(U[u]){case C:p=+i[u]+t*f*j[u];break;case"colour":p="rgb("+[cB(O(i[u].r+t*f*j[u].r)),cB(O(i[u].g+t*f*j[u].g)),cB(O(i[u].b+t*f*j[u].b))].join(",")+")";break;case"path":p=[];for(var v=0,w=i[u].length;v<w;v++){p[v]=[i[u][v][0]];for(var x=1,y=i[u][v].length;x<y;x++)p[v][x]=+i[u][v][x]+t*f*j[u][v][x];p[v]=p[v].join(q)}p=p.join(q);break;case"transform":if(j[u].real){p=[];for(v=0,w=i[u].length;v<w;v++){p[v]=[i[u][v][0]];for(x=1,y=i[u][v].length;x<y;x++)p[v][x]=i[u][v][x]+t*f*j[u][v][x]}}else{var z=function(a){return+i[u][a]+t*f*j[u][a]};p=[["m",z(0),z(1),z(2),z(3),z(4),z(5)]]}break;case"csv":if(u=="clip-rect"){p=[],v=4;while(v--)p[v]=+i[u][v]+t*f*j[u][v]}break;default:var A=[][n](i[u]);p=[],v=m.paper.customAttributes[u].length;while(v--)p[v]=+A[v]+t*f*j[u][v]}o[u]=p}m.attr(o),function(a,b,c){setTimeout(function(){eve("raphael.anim.frame."+a,b,c)})}(m.id,m,d.anim)}else{(function(b,c,d){setTimeout(function(){eve("raphael.anim.frame."+c.id,c,d),eve("raphael.anim.finish."+c.id,c,d),a.is(b,"function")&&b.call(c)})})(d.callback,m,d.anim),m.attr(k),cy.splice(c--,1);if(d.repeat>1&&!d.next){for(s in k)k[g](s)&&(r[s]=d.totalOrigin[s]);d.el.attr(r),cE(d.anim,d.el,d.anim.percents[0],null,d.totalOrigin,d.repeat-1)}d.next&&!d.stop&&cE(d.anim,d.el,d.next,null,d.totalOrigin,d.repeat)}}a.svg&&m&&m.paper&&m.paper.safari(),cy.length&&cz(cA)},cB=function(a){return a>255?255:a<0?0:a};cl.animateWith=function(b,c,d,e,f,g){var h=this;if(h.removed){g&&g.call(h);return h}var i=d instanceof cD?d:a.animation(d,e,f,g),j,k;cE(i,h,i.percents[0],null,h.attr());for(var l=0,m=cy.length;l<m;l++)if(cy[l].anim==c&&cy[l].el==b){cy[m-1].start=cy[l].start;break}return h},cl.onAnimation=function(a){a?eve.on("raphael.anim.frame."+this.id,a):eve.unbind("raphael.anim.frame."+this.id);return this},cD.prototype.delay=function(a){var b=new cD(this.anim,this.ms);b.times=this.times,b.del=+a||0;return b},cD.prototype.repeat=function(a){var b=new cD(this.anim,this.ms);b.del=this.del,b.times=w.floor(x(a,0))||1;return b},a.animation=function(b,c,d,e){if(b instanceof cD)return b;if(a.is(d,"function")||!d)e=e||d||null,d=null;b=Object(b),c=+c||0;var f={},h,i;for(i in b)b[g](i)&&Q(i)!=i&&Q(i)+"%"!=i&&(h=!0,f[i]=b[i]);if(!h)return new cD(b,c);d&&(f.easing=d),e&&(f.callback=e);return new cD({100:f},c)},cl.animate=function(b,c,d,e){var f=this;if(f.removed){e&&e.call(f);return f}var g=b instanceof cD?b:a.animation(b,c,d,e);cE(g,f,g.percents[0],null,f.attr());return f},cl.setTime=function(a,b){a&&b!=null&&this.status(a,y(b,a.ms)/a.ms);return this},cl.status=function(a,b){var c=[],d=0,e,f;if(b!=null){cE(a,this,-1,y(b,1));return this}e=cy.length;for(;d<e;d++){f=cy[d];if(f.el.id==this.id&&(!a||f.anim==a)){if(a)return f.status;c.push({anim:f.anim,status:f.status})}}if(a)return 0;return c},cl.pause=function(a){for(var b=0;b<cy.length;b++)cy[b].el.id==this.id&&(!a||cy[b].anim==a)&&eve("raphael.anim.pause."+this.id,this,cy[b].anim)!==!1&&(cy[b].paused=!0);return this},cl.resume=function(a){for(var b=0;b<cy.length;b++)if(cy[b].el.id==this.id&&(!a||cy[b].anim==a)){var c=cy[b];eve("raphael.anim.resume."+this.id,this,c.anim)!==!1&&(delete c.paused,this.status(c.anim,c.status))}return this},cl.stop=function(a){for(var b=0;b<cy.length;b++)cy[b].el.id==this.id&&(!a||cy[b].anim==a)&&eve("raphael.anim.stop."+this.id,this,cy[b].anim)!==!1&&cy.splice(b--,1);return this},eve.on("raphael.remove",cF),eve.on("raphael.clear",cF),cl.toString=function(){return"Raphaël’s object"};var cG=function(a){this.items=[],this.length=0,this.type="set";if(a)for(var b=0,c=a.length;b<c;b++)a[b]&&(a[b].constructor==cl.constructor||a[b].constructor==cG)&&(this[this.items.length]=this.items[this.items.length]=a[b],this.length++)},cH=cG.prototype;cH.push=function(){var a,b;for(var c=0,d=arguments.length;c<d;c++)a=arguments[c],a&&(a.constructor==cl.constructor||a.constructor==cG)&&(b=this.items.length,this[b]=this.items[b]=a,this.length++);return this},cH.pop=function(){this.length&&delete this[this.length--];return this.items.pop()},cH.forEach=function(a,b){for(var c=0,d=this.items.length;c<d;c++)if(a.call(b,this.items[c],c)===!1)return this;return this};for(var cI in cl)cl[g](cI)&&(cH[cI]=function(a){return function(){var b=arguments;return this.forEach(function(c){c[a][m](c,b)})}}(cI));cH.attr=function(b,c){if(b&&a.is(b,E)&&a.is(b[0],"object"))for(var d=0,e=b.length;d<e;d++)this.items[d].attr(b[d]);else for(var f=0,g=this.items.length;f<g;f++)this.items[f].attr(b,c);return this},cH.clear=function(){while(this.length)this.pop()},cH.splice=function(a,b,c){a=a<0?x(this.length+a,0):a,b=x(0,y(this.length-a,b));var d=[],e=[],f=[],g;for(g=2;g<arguments.length;g++)f.push(arguments[g]);for(g=0;g<b;g++)e.push(this[a+g]);for(;g<this.length-a;g++)d.push(this[a+g]);var h=f.length;for(g=0;g<h+d.length;g++)this.items[a+g]=this[a+g]=g<h?f[g]:d[g-h];g=this.items.length=this.length-=b-h;while(this[g])delete this[g++];return new cG(e)},cH.exclude=function(a){for(var b=0,c=this.length;b<c;b++)if(this[b]==a){this.splice(b,1);return!0}},cH.animate=function(b,c,d,e){(a.is(d,"function")||!d)&&(e=d||null);var f=this.items.length,g=f,h,i=this,j;if(!f)return this;e&&(j=function(){!--f&&e.call(i)}),d=a.is(d,D)?d:j;var k=a.animation(b,c,d,j);h=this.items[--g].animate(k);while(g--)this.items[g]&&!this.items[g].removed&&this.items[g].animateWith(h,k,k);return this},cH.insertAfter=function(a){var b=this.items.length;while(b--)this.items[b].insertAfter(a);return this},cH.getBBox=function(){var a=[],b=[],c=[],d=[];for(var e=this.items.length;e--;)if(!this.items[e].removed){var f=this.items[e].getBBox();a.push(f.x),b.push(f.y),c.push(f.x+f.width),d.push(f.y+f.height)}a=y[m](0,a),b=y[m](0,b),c=x[m](0,c),d=x[m](0,d);return{x:a,y:b,x2:c,y2:d,width:c-a,height:d-b}},cH.clone=function(a){a=new cG;for(var b=0,c=this.items.length;b<c;b++)a.push(this.items[b].clone());return a},cH.toString=function(){return"Raphaël‘s set"},a.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)a.face[g](d)&&(b.face[d]=a.face[d]);this.fonts[c]?this.fonts[c].push(b):this.fonts[c]=[b];if(!a.svg){b.face["units-per-em"]=R(a.face["units-per-em"],10);for(var e in a.glyphs)if(a.glyphs[g](e)){var f=a.glyphs[e];b.glyphs[e]={w:f.w,k:{},d:f.d&&"M"+f.d.replace(/[mlcxtrv]/g,function(a){return{l:"L",c:"C",x:"z",t:"m",r:"l",v:"c"}[a]||"M"})+"z"};if(f.k)for(var h in f.k)f[g](h)&&(b.glyphs[e].k[h]=f.k[h])}}return a},k.getFont=function(b,c,d,e){e=e||"normal",d=d||"normal",c=+c||{normal:400,bold:700,lighter:300,bolder:800}[c]||400;if(!!a.fonts){var f=a.fonts[b];if(!f){var h=new RegExp("(^|\\s)"+b.replace(/[^\w\d\s+!~.:_-]/g,p)+"(\\s|$)","i");for(var i in a.fonts)if(a.fonts[g](i)&&h.test(i)){f=a.fonts[i];break}}var j;if(f)for(var k=0,l=f.length;k<l;k++){j=f[k];if(j.face["font-weight"]==c&&(j.face["font-style"]==d||!j.face["font-style"])&&j.face["font-stretch"]==e)break}return j}},k.print=function(b,d,e,f,g,h,i){h=h||"middle",i=x(y(i||0,1),-1);var j=r(e)[s](p),k=0,l=0,m=p,n;a.is(f,e)&&(f=this.getFont(f));if(f){n=(g||16)/f.face["units-per-em"];var o=f.face.bbox[s](c),q=+o[0],t=o[3]-o[1],u=0,v=+o[1]+(h=="baseline"?t+ +f.face.descent:t/2);for(var w=0,z=j.length;w<z;w++){if(j[w]=="\n")k=0,B=0,l=0,u+=t;else{var A=l&&f.glyphs[j[w-1]]||{},B=f.glyphs[j[w]];k+=l?(A.w||f.w)+(A.k&&A.k[j[w]]||0)+f.w*i:0,l=1}B&&B.d&&(m+=a.transformPath(B.d,["t",k*n,u*n,"s",n,n,q,v,"t",(b-q)/n,(d-v)/n]))}}return this.path(m).attr({fill:"#000",stroke:"none"})},k.add=function(b){if(a.is(b,"array")){var c=this.set(),e=0,f=b.length,h;for(;e<f;e++)h=b[e]||{},d[g](h.type)&&c.push(this[h.type]().attr(h))}return c},a.format=function(b,c){var d=a.is(c,E)?[0][n](c):arguments;b&&a.is(b,D)&&d.length-1&&(b=b.replace(e,function(a,b){return d[++b]==null?p:d[b]}));return b||p},a.fullfill=function(){var a=/\{([^\}]+)\}/g,b=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g,c=function(a,c,d){var e=d;c.replace(b,function(a,b,c,d,f){b=b||d,e&&(b in e&&(e=e[b]),typeof e=="function"&&f&&(e=e()))}),e=(e==null||e==d?a:e)+"";return e};return function(b,d){return String(b).replace(a,function(a,b){return c(a,b,d)})}}(),a.ninja=function(){i.was?h.win.Raphael=i.is:delete Raphael;return a},a.st=cH,function(b,c,d){function e(){/in/.test(b.readyState)?setTimeout(e,9):a.eve("raphael.DOMload")}b.readyState==null&&b.addEventListener&&(b.addEventListener(c,d=function(){b.removeEventListener(c,d,!1),b.readyState="complete"},!1),b.readyState="loading"),e()}(document,"DOMContentLoaded"),i.was?h.win.Raphael=a:Raphael=a,eve.on("raphael.DOMload",function(){b=!0})}(),window.Raphael.svg&&function(a){var b="hasOwnProperty",c=String,d=parseFloat,e=parseInt,f=Math,g=f.max,h=f.abs,i=f.pow,j=/[, ]+/,k=a.eve,l="",m=" ",n="http://www.w3.org/1999/xlink",o={block:"M5,0 0,2.5 5,5z",classic:"M5,0 0,2.5 5,5 3.5,3 3.5,2z",diamond:"M2.5,0 5,2.5 2.5,5 0,2.5z",open:"M6,1 1,3.5 6,6",oval:"M2.5,0A2.5,2.5,0,0,1,2.5,5 2.5,2.5,0,0,1,2.5,0z"},p={};a.toString=function(){return"Your browser supports SVG.\nYou are running Raphaël "+this.version};var q=function(d,e){if(e){typeof d=="string"&&(d=q(d));for(var f in e)e[b](f)&&(f.substring(0,6)=="xlink:"?d.setAttributeNS(n,f.substring(6),c(e[f])):d.setAttribute(f,c(e[f])))}else d=a._g.doc.createElementNS("http://www.w3.org/2000/svg",d),d.style&&(d.style.webkitTapHighlightColor="rgba(0,0,0,0)");return d},r=function(b,e){var j="linear",k=b.id+e,m=.5,n=.5,o=b.node,p=b.paper,r=o.style,s=a._g.doc.getElementById(k);if(!s){e=c(e).replace(a._radial_gradient,function(a,b,c){j="radial";if(b&&c){m=d(b),n=d(c);var e=(n>.5)*2-1;i(m-.5,2)+i(n-.5,2)>.25&&(n=f.sqrt(.25-i(m-.5,2))*e+.5)&&n!=.5&&(n=n.toFixed(5)-1e-5*e)}return l}),e=e.split(/\s*\-\s*/);if(j=="linear"){var t=e.shift();t=-d(t);if(isNaN(t))return null;var u=[0,0,f.cos(a.rad(t)),f.sin(a.rad(t))],v=1/(g(h(u[2]),h(u[3]))||1);u[2]*=v,u[3]*=v,u[2]<0&&(u[0]=-u[2],u[2]=0),u[3]<0&&(u[1]=-u[3],u[3]=0)}var w=a._parseDots(e);if(!w)return null;k=k.replace(/[\(\)\s,\xb0#]/g,"_"),b.gradient&&k!=b.gradient.id&&(p.defs.removeChild(b.gradient),delete b.gradient);if(!b.gradient){s=q(j+"Gradient",{id:k}),b.gradient=s,q(s,j=="radial"?{fx:m,fy:n}:{x1:u[0],y1:u[1],x2:u[2],y2:u[3],gradientTransform:b.matrix.invert()}),p.defs.appendChild(s);for(var x=0,y=w.length;x<y;x++)s.appendChild(q("stop",{offset:w[x].offset?w[x].offset:x?"100%":"0%","stop-color":w[x].color||"#fff"}))}}q(o,{fill:"url(#"+k+")",opacity:1,"fill-opacity":1}),r.fill=l,r.opacity=1,r.fillOpacity=1;return 1},s=function(a){var b=a.getBBox(1);q(a.pattern,{patternTransform:a.matrix.invert()+" translate("+b.x+","+b.y+")"})},t=function(d,e,f){if(d.type=="path"){var g=c(e).toLowerCase().split("-"),h=d.paper,i=f?"end":"start",j=d.node,k=d.attrs,m=k["stroke-width"],n=g.length,r="classic",s,t,u,v,w,x=3,y=3,z=5;while(n--)switch(g[n]){case"block":case"classic":case"oval":case"diamond":case"open":case"none":r=g[n];break;case"wide":y=5;break;case"narrow":y=2;break;case"long":x=5;break;case"short":x=2}r=="open"?(x+=2,y+=2,z+=2,u=1,v=f?4:1,w={fill:"none",stroke:k.stroke}):(v=u=x/2,w={fill:k.stroke,stroke:"none"}),d._.arrows?f?(d._.arrows.endPath&&p[d._.arrows.endPath]--,d._.arrows.endMarker&&p[d._.arrows.endMarker]--):(d._.arrows.startPath&&p[d._.arrows.startPath]--,d._.arrows.startMarker&&p[d._.arrows.startMarker]--):d._.arrows={};if(r!="none"){var A="raphael-marker-"+r,B="raphael-marker-"+i+r+x+y;a._g.doc.getElementById(A)?p[A]++:(h.defs.appendChild(q(q("path"),{"stroke-linecap":"round",d:o[r],id:A})),p[A]=1);var C=a._g.doc.getElementById(B),D;C?(p[B]++,D=C.getElementsByTagName("use")[0]):(C=q(q("marker"),{id:B,markerHeight:y,markerWidth:x,orient:"auto",refX:v,refY:y/2}),D=q(q("use"),{"xlink:href":"#"+A,transform:(f?"rotate(180 "+x/2+" "+y/2+") ":l)+"scale("+x/z+","+y/z+")","stroke-width":(1/((x/z+y/z)/2)).toFixed(4)}),C.appendChild(D),h.defs.appendChild(C),p[B]=1),q(D,w);var F=u*(r!="diamond"&&r!="oval");f?(s=d._.arrows.startdx*m||0,t=a.getTotalLength(k.path)-F*m):(s=F*m,t=a.getTotalLength(k.path)-(d._.arrows.enddx*m||0)),w={},w["marker-"+i]="url(#"+B+")";if(t||s)w.d=Raphael.getSubpath(k.path,s,t);q(j,w),d._.arrows[i+"Path"]=A,d._.arrows[i+"Marker"]=B,d._.arrows[i+"dx"]=F,d._.arrows[i+"Type"]=r,d._.arrows[i+"String"]=e}else f?(s=d._.arrows.startdx*m||0,t=a.getTotalLength(k.path)-s):(s=0,t=a.getTotalLength(k.path)-(d._.arrows.enddx*m||0)),d._.arrows[i+"Path"]&&q(j,{d:Raphael.getSubpath(k.path,s,t)}),delete d._.arrows[i+"Path"],delete d._.arrows[i+"Marker"],delete d._.arrows[i+"dx"],delete d._.arrows[i+"Type"],delete d._.arrows[i+"String"];for(w in p)if(p[b](w)&&!p[w]){var G=a._g.doc.getElementById(w);G&&G.parentNode.removeChild(G)}}},u={"":[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]},v=function(a,b,d){b=u[c(b).toLowerCase()];if(b){var e=a.attrs["stroke-width"]||"1",f={round:e,square:e,butt:0}[a.attrs["stroke-linecap"]||d["stroke-linecap"]]||0,g=[],h=b.length;while(h--)g[h]=b[h]*e+(h%2?1:-1)*f;q(a.node,{"stroke-dasharray":g.join(",")})}},w=function(d,f){var i=d.node,k=d.attrs,m=i.style.visibility;i.style.visibility="hidden";for(var o in f)if(f[b](o)){if(!a._availableAttrs[b](o))continue;var p=f[o];k[o]=p;switch(o){case"blur":d.blur(p);break;case"href":case"title":case"target":var u=i.parentNode;if(u.tagName.toLowerCase()!="a"){var w=q("a");u.insertBefore(w,i),w.appendChild(i),u=w}o=="target"?u.setAttributeNS(n,"show",p=="blank"?"new":p):u.setAttributeNS(n,o,p);break;case"cursor":i.style.cursor=p;break;case"transform":d.transform(p);break;case"arrow-start":t(d,p);break;case"arrow-end":t(d,p,1);break;case"clip-rect":var x=c(p).split(j);if(x.length==4){d.clip&&d.clip.parentNode.parentNode.removeChild(d.clip.parentNode);var z=q("clipPath"),A=q("rect");z.id=a.createUUID(),q(A,{x:x[0],y:x[1],width:x[2],height:x[3]}),z.appendChild(A),d.paper.defs.appendChild(z),q(i,{"clip-path":"url(#"+z.id+")"}),d.clip=A}if(!p){var B=i.getAttribute("clip-path");if(B){var C=a._g.doc.getElementById(B.replace(/(^url\(#|\)$)/g,l));C&&C.parentNode.removeChild(C),q(i,{"clip-path":l}),delete d.clip}}break;case"path":d.type=="path"&&(q(i,{d:p?k.path=a._pathToAbsolute(p):"M0,0"}),d._.dirty=1,d._.arrows&&("startString"in d._.arrows&&t(d,d._.arrows.startString),"endString"in d._.arrows&&t(d,d._.arrows.endString,1)));break;case"width":i.setAttribute(o,p),d._.dirty=1;if(k.fx)o="x",p=k.x;else break;case"x":k.fx&&(p=-k.x-(k.width||0));case"rx":if(o=="rx"&&d.type=="rect")break;case"cx":i.setAttribute(o,p),d.pattern&&s(d),d._.dirty=1;break;case"height":i.setAttribute(o,p),d._.dirty=1;if(k.fy)o="y",p=k.y;else break;case"y":k.fy&&(p=-k.y-(k.height||0));case"ry":if(o=="ry"&&d.type=="rect")break;case"cy":i.setAttribute(o,p),d.pattern&&s(d),d._.dirty=1;break;case"r":d.type=="rect"?q(i,{rx:p,ry:p}):i.setAttribute(o,p),d._.dirty=1;break;case"src":d.type=="image"&&i.setAttributeNS(n,"href",p);break;case"stroke-width":if(d._.sx!=1||d._.sy!=1)p/=g(h(d._.sx),h(d._.sy))||1;d.paper._vbSize&&(p*=d.paper._vbSize),i.setAttribute(o,p),k["stroke-dasharray"]&&v(d,k["stroke-dasharray"],f),d._.arrows&&("startString"in d._.arrows&&t(d,d._.arrows.startString),"endString"in d._.arrows&&t(d,d._.arrows.endString,1));break;case"stroke-dasharray":v(d,p,f);break;case"fill":var D=c(p).match(a._ISURL);if(D){z=q("pattern");var F=q("image");z.id=a.createUUID(),q(z,{x:0,y:0,patternUnits:"userSpaceOnUse",height:1,width:1}),q(F,{x:0,y:0,"xlink:href":D[1]}),z.appendChild(F),function(b){a._preload(D[1],function(){var a=this.offsetWidth,c=this.offsetHeight;q(b,{width:a,height:c}),q(F,{width:a,height:c}),d.paper.safari()})}(z),d.paper.defs.appendChild(z),q(i,{fill:"url(#"+z.id+")"}),d.pattern=z,d.pattern&&s(d);break}var G=a.getRGB(p);if(!G.error)delete f.gradient,delete k.gradient,!a.is(k.opacity,"undefined")&&a.is(f.opacity,"undefined")&&q(i,{opacity:k.opacity}),!a.is(k["fill-opacity"],"undefined")&&a.is(f["fill-opacity"],"undefined")&&q(i,{"fill-opacity":k["fill-opacity"]});else if((d.type=="circle"||d.type=="ellipse"||c(p).charAt()!="r")&&r(d,p)){if("opacity"in k||"fill-opacity"in k){var H=a._g.doc.getElementById(i.getAttribute("fill").replace(/^url\(#|\)$/g,l));if(H){var I=H.getElementsByTagName("stop");q(I[I.length-1],{"stop-opacity":("opacity"in k?k.opacity:1)*("fill-opacity"in k?k["fill-opacity"]:1)})}}k.gradient=p,k.fill="none";break}G[b]("opacity")&&q(i,{"fill-opacity":G.opacity>1?G.opacity/100:G.opacity});case"stroke":G=a.getRGB(p),i.setAttribute(o,G.hex),o=="stroke"&&G[b]("opacity")&&q(i,{"stroke-opacity":G.opacity>1?G.opacity/100:G.opacity}),o=="stroke"&&d._.arrows&&("startString"in d._.arrows&&t(d,d._.arrows.startString),"endString"in d._.arrows&&t(d,d._.arrows.endString,1));break;case"gradient":(d.type=="circle"||d.type=="ellipse"||c(p).charAt()!="r")&&r(d,p);break;case"opacity":k.gradient&&!k[b]("stroke-opacity")&&q(i,{"stroke-opacity":p>1?p/100:p});case"fill-opacity":if(k.gradient){H=a._g.doc.getElementById(i.getAttribute("fill").replace(/^url\(#|\)$/g,l)),H&&(I=H.getElementsByTagName("stop"),q(I[I.length-1],{"stop-opacity":p}));break};default:o=="font-size"&&(p=e(p,10)+"px");var J=o.replace(/(\-.)/g,function(a){return a.substring(1).toUpperCase()});i.style[J]=p,d._.dirty=1,i.setAttribute(o,p)}}y(d,f),i.style.visibility=m},x=1.2,y=function(d,f){if(d.type=="text"&&!!(f[b]("text")||f[b]("font")||f[b]("font-size")||f[b]("x")||f[b]("y"))){var g=d.attrs,h=d.node,i=h.firstChild?e(a._g.doc.defaultView.getComputedStyle(h.firstChild,l).getPropertyValue("font-size"),10):10;if(f[b]("text")){g.text=f.text;while(h.firstChild)h.removeChild(h.firstChild);var j=c(f.text).split("\n"),k=[],m;for(var n=0,o=j.length;n<o;n++)m=q("tspan"),n&&q(m,{dy:i*x,x:g.x}),m.appendChild(a._g.doc.createTextNode(j[n])),h.appendChild(m),k[n]=m}else{k=h.getElementsByTagName("tspan");for(n=0,o=k.length;n<o;n++)n?q(k[n],{dy:i*x,x:g.x}):q(k[0],{dy:0})}q(h,{x:g.x,y:g.y}),d._.dirty=1;var p=d._getBBox(),r=g.y-(p.y+p.height/2);r&&a.is(r,"finite")&&q(k[0],{dy:r})}},z=function(b,c){var d=0,e=0;this[0]=this.node=b,b.raphael=!0,this.id=a._oid++,b.raphaelid=this.id,this.matrix=a.matrix(),this.realPath=null,this.paper=c,this.attrs=this.attrs||{},this._={transform:[],sx:1,sy:1,deg:0,dx:0,dy:0,dirty:1},!c.bottom&&(c.bottom=this),this.prev=c.top,c.top&&(c.top.next=this),c.top=this,this.next=null},A=a.el;z.prototype=A,A.constructor=z,a._engine.path=function(a,b){var c=q("path");b.canvas&&b.canvas.appendChild(c);var d=new z(c,b);d.type="path",w(d,{fill:"none",stroke:"#000",path:a});return d},A.rotate=function(a,b,e){if(this.removed)return this;a=c(a).split(j),a.length-1&&(b=d(a[1]),e=d(a[2])),a=d(a[0]),e==null&&(b=e);if(b==null||e==null){var f=this.getBBox(1);b=f.x+f.width/2,e=f.y+f.height/2}this.transform(this._.transform.concat([["r",a,b,e]]));return this},A.scale=function(a,b,e,f){if(this.removed)return this;a=c(a).split(j),a.length-1&&(b=d(a[1]),e=d(a[2]),f=d(a[3])),a=d(a[0]),b==null&&(b=a),f==null&&(e=f);if(e==null||f==null)var g=this.getBBox(1);e=e==null?g.x+g.width/2:e,f=f==null?g.y+g.height/2:f,this.transform(this._.transform.concat([["s",a,b,e,f]]));return this},A.translate=function(a,b){if(this.removed)return this;a=c(a).split(j),a.length-1&&(b=d(a[1])),a=d(a[0])||0,b=+b||0,this.transform(this._.transform.concat([["t",a,b]]));return this},A.transform=function(c){var d=this._;if(c==null)return d.transform;a._extractTransform(this,c),this.clip&&q(this.clip,{transform:this.matrix.invert()}),this.pattern&&s(this),this.node&&q(this.node,{transform:this.matrix});if(d.sx!=1||d.sy!=1){var e=this.attrs[b]("stroke-width")?this.attrs["stroke-width"]:1;this.attr({"stroke-width":e})}return this},A.hide=function(){!this.removed&&this.paper.safari(this.node.style.display="none");return this},A.show=function(){!this.removed&&this.paper.safari(this.node.style.display="");return this},A.remove=function(){if(!this.removed&&!!this.node.parentNode){var b=this.paper;b.__set__&&b.__set__.exclude(this),k.unbind("raphael.*.*."+this.id),this.gradient&&b.defs.removeChild(this.gradient),a._tear(this,b),this.node.parentNode.tagName.toLowerCase()=="a"?this.node.parentNode.parentNode.removeChild(this.node.parentNode):this.node.parentNode.removeChild(this.node);for(var c in this)this[c]=typeof this[c]=="function"?a._removedFactory(c):null;this.removed=!0}},A._getBBox=function(){if(this.node.style.display=="none"){this.show();var a=!0}var b={};try{b=this.node.getBBox()}catch(c){}finally{b=b||{}}a&&this.hide();return b},A.attr=function(c,d){if(this.removed)return this;if(c==null){var e={};for(var f in this.attrs)this.attrs[b](f)&&(e[f]=this.attrs[f]);e.gradient&&e.fill=="none"&&(e.fill=e.gradient)&&delete e.gradient,e.transform=this._.transform;return e}if(d==null&&a.is(c,"string")){if(c=="fill"&&this.attrs.fill=="none"&&this.attrs.gradient)return this.attrs.gradient;if(c=="transform")return this._.transform;var g=c.split(j),h={};for(var i=0,l=g.length;i<l;i++)c=g[i],c in this.attrs?h[c]=this.attrs[c]:a.is(this.paper.customAttributes[c],"function")?h[c]=this.paper.customAttributes[c].def:h[c]=a._availableAttrs[c];return l-1?h:h[g[0]]}if(d==null&&a.is(c,"array")){h={};for(i=0,l=c.length;i<l;i++)h[c[i]]=this.attr(c[i]);return h}if(d!=null){var m={};m[c]=d}else c!=null&&a.is(c,"object")&&(m=c);for(var n in m)k("raphael.attr."+n+"."+this.id,this,m[n]);for(n in this.paper.customAttributes)if(this.paper.customAttributes[b](n)&&m[b](n)&&a.is(this.paper.customAttributes[n],"function")){var o=this.paper.customAttributes[n].apply(this,[].concat(m[n]));this.attrs[n]=m[n];for(var p in o)o[b](p)&&(m[p]=o[p])}w(this,m);return this},A.toFront=function(){if(this.removed)return this;this.node.parentNode.tagName.toLowerCase()=="a"?this.node.parentNode.parentNode.appendChild(this.node.parentNode):this.node.parentNode.appendChild(this.node);var b=this.paper;b.top!=this&&a._tofront(this,b);return this},A.toBack=function(){if(this.removed)return this;var b=this.node.parentNode;b.tagName.toLowerCase()=="a"?b.parentNode.insertBefore(this.node.parentNode,this.node.parentNode.parentNode.firstChild):b.firstChild!=this.node&&b.insertBefore(this.node,this.node.parentNode.firstChild),a._toback(this,this.paper);var c=this.paper;return this},A.insertAfter=function(b){if(this.removed)return this;var c=b.node||b[b.length-1].node;c.nextSibling?c.parentNode.insertBefore(this.node,c.nextSibling):c.parentNode.appendChild(this.node),a._insertafter(this,b,this.paper);return this},A.insertBefore=function(b){if(this.removed)return this;var c=b.node||b[0].node;c.parentNode.insertBefore(this.node,c),a._insertbefore(this,b,this.paper);return this},A.blur=function(b){var c=this;if(+b!==0){var d=q("filter"),e=q("feGaussianBlur");c.attrs.blur=b,d.id=a.createUUID(),q(e,{stdDeviation:+b||1.5}),d.appendChild(e),c.paper.defs.appendChild(d),c._blur=d,q(c.node,{filter:"url(#"+d.id+")"})}else c._blur&&(c._blur.parentNode.removeChild(c._blur),delete c._blur,delete c.attrs.blur),c.node.removeAttribute("filter")},a._engine.circle=function(a,b,c,d){var e=q("circle");a.canvas&&a.canvas.appendChild(e);var f=new z(e,a);f.attrs={cx:b,cy:c,r:d,fill:"none",stroke:"#000"},f.type="circle",q(e,f.attrs);return f},a._engine.rect=function(a,b,c,d,e,f){var g=q("rect");a.canvas&&a.canvas.appendChild(g);var h=new z(g,a);h.attrs={x:b,y:c,width:d,height:e,r:f||0,rx:f||0,ry:f||0,fill:"none",stroke:"#000"},h.type="rect",q(g,h.attrs);return h},a._engine.ellipse=function(a,b,c,d,e){var f=q("ellipse");a.canvas&&a.canvas.appendChild(f);var g=new z(f,a);g.attrs={cx:b,cy:c,rx:d,ry:e,fill:"none",stroke:"#000"},g.type="ellipse",q(f,g.attrs);return g},a._engine.image=function(a,b,c,d,e,f){var g=q("image");q(g,{x:c,y:d,width:e,height:f,preserveAspectRatio:"none"}),g.setAttributeNS(n,"href",b),a.canvas&&a.canvas.appendChild(g);var h=new z(g,a);h.attrs={x:c,y:d,width:e,height:f,src:b},h.type="image";return h},a._engine.text=function(b,c,d,e){var f=q("text");b.canvas&&b.canvas.appendChild(f);var g=new z(f,b);g.attrs={x:c,y:d,"text-anchor":"middle",text:e,font:a._availableAttrs.font,stroke:"none",fill:"#000"},g.type="text",w(g,g.attrs);return g},a._engine.setSize=function(a,b){this.width=a||this.width,this.height=b||this.height,this.canvas.setAttribute("width",this.width),this.canvas.setAttribute("height",this.height),this._viewBox&&this.setViewBox.apply(this,this._viewBox);return this},a._engine.create=function(){var b=a._getContainer.apply(0,arguments),c=b&&b.container,d=b.x,e=b.y,f=b.width,g=b.height;if(!c)throw new Error("SVG container not found.");var h=q("svg"),i="overflow:hidden;",j;d=d||0,e=e||0,f=f||512,g=g||342,q(h,{height:g,version:1.1,width:f,xmlns:"http://www.w3.org/2000/svg"}),c==1?(h.style.cssText=i+"position:absolute;left:"+d+"px;top:"+e+"px",a._g.doc.body.appendChild(h),j=1):(h.style.cssText=i+"position:relative",c.firstChild?c.insertBefore(h,c.firstChild):c.appendChild(h)),c=new a._Paper,c.width=f,c.height=g,c.canvas=h,c.clear(),c._left=c._top=0,j&&(c.renderfix=function(){}),c.renderfix();return c},a._engine.setViewBox=function(a,b,c,d,e){k("raphael.setViewBox",this,this._viewBox,[a,b,c,d,e]);var f=g(c/this.width,d/this.height),h=this.top,i=e?"meet":"xMinYMin",j,l;a==null?(this._vbSize&&(f=1),delete this._vbSize,j="0 0 "+this.width+m+this.height):(this._vbSize=f,j=a+m+b+m+c+m+d),q(this.canvas,{viewBox:j,preserveAspectRatio:i});while(f&&h)l="stroke-width"in h.attrs?h.attrs["stroke-width"]:1,h.attr({"stroke-width":l}),h._.dirty=1,h._.dirtyT=1,h=h.prev;this._viewBox=[a,b,c,d,!!e];return this},a.prototype.renderfix=function(){var a=this.canvas,b=a.style,c;try{c=a.getScreenCTM()||a.createSVGMatrix()}catch(d){c=a.createSVGMatrix()}var e=-c.e%1,f=-c.f%1;if(e||f)e&&(this._left=(this._left+e)%1,b.left=this._left+"px"),f&&(this._top=(this._top+f)%1,b.top=this._top+"px")},a.prototype.clear=function(){a.eve("raphael.clear",this);var b=this.canvas;while(b.firstChild)b.removeChild(b.firstChild);this.bottom=this.top=null,(this.desc=q("desc")).appendChild(a._g.doc.createTextNode("Created with Raphaël "+a.version)),b.appendChild(this.desc),b.appendChild(this.defs=q("defs"))},a.prototype.remove=function(){k("raphael.remove",this),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas);for(var b in this)this[b]=typeof this[b]=="function"?a._removedFactory(b):null};var B=a.st;for(var C in A)A[b](C)&&!B[b](C)&&(B[C]=function(a){return function(){var b=arguments;return this.forEach(function(c){c[a].apply(c,b)})}}(C))}(window.Raphael),window.Raphael.vml&&function(a){var b="hasOwnProperty",c=String,d=parseFloat,e=Math,f=e.round,g=e.max,h=e.min,i=e.abs,j="fill",k=/[, ]+/,l=a.eve,m=" progid:DXImageTransform.Microsoft",n=" ",o="",p={M:"m",L:"l",C:"c",Z:"x",m:"t",l:"r",c:"v",z:"x"},q=/([clmz]),?([^clmz]*)/gi,r=/ progid:\S+Blur\([^\)]+\)/g,s=/-?[^,\s-]+/g,t="position:absolute;left:0;top:0;width:1px;height:1px",u=21600,v={path:1,rect:1,image:1},w={circle:1,ellipse:1},x=function(b){var d=/[ahqstv]/ig,e=a._pathToAbsolute;c(b).match(d)&&(e=a._path2curve),d=/[clmz]/g;if(e==a._pathToAbsolute&&!c(b).match(d)){var g=c(b).replace(q,function(a,b,c){var d=[],e=b.toLowerCase()=="m",g=p[b];c.replace(s,function(a){e&&d.length==2&&(g+=d+p[b=="m"?"l":"L"],d=[]),d.push(f(a*u))});return g+d});return g}var h=e(b),i,j;g=[];for(var k=0,l=h.length;k<l;k++){i=h[k],j=h[k][0].toLowerCase(),j=="z"&&(j="x");for(var m=1,r=i.length;m<r;m++)j+=f(i[m]*u)+(m!=r-1?",":o);g.push(j)}return g.join(n)},y=function(b,c,d){var e=a.matrix();e.rotate(-b,.5,.5);return{dx:e.x(c,d),dy:e.y(c,d)}},z=function(a,b,c,d,e,f){var g=a._,h=a.matrix,k=g.fillpos,l=a.node,m=l.style,o=1,p="",q,r=u/b,s=u/c;m.visibility="hidden";if(!!b&&!!c){l.coordsize=i(r)+n+i(s),m.rotation=f*(b*c<0?-1:1);if(f){var t=y(f,d,e);d=t.dx,e=t.dy}b<0&&(p+="x"),c<0&&(p+=" y")&&(o=-1),m.flip=p,l.coordorigin=d*-r+n+e*-s;if(k||g.fillsize){var v=l.getElementsByTagName(j);v=v&&v[0],l.removeChild(v),k&&(t=y(f,h.x(k[0],k[1]),h.y(k[0],k[1])),v.position=t.dx*o+n+t.dy*o),g.fillsize&&(v.size=g.fillsize[0]*i(b)+n+g.fillsize[1]*i(c)),l.appendChild(v)}m.visibility="visible"}};a.toString=function(){return"Your browser doesn’t support SVG. Falling down to VML.\nYou are running Raphaël "+this.version};var A=function(a,b,d){var e=c(b).toLowerCase().split("-"),f=d?"end":"start",g=e.length,h="classic",i="medium",j="medium";while(g--)switch(e[g]){case"block":case"classic":case"oval":case"diamond":case"open":case"none":h=e[g];break;case"wide":case"narrow":j=e[g];break;case"long":case"short":i=e[g]}var k=a.node.getElementsByTagName("stroke")[0];k[f+"arrow"]=h,k[f+"arrowlength"]=i,k[f+"arrowwidth"]=j},B=function(e,i){e.attrs=e.attrs||{};var l=e.node,m=e.attrs,p=l.style,q,r=v[e.type]&&(i.x!=m.x||i.y!=m.y||i.width!=m.width||i.height!=m.height||i.cx!=m.cx||i.cy!=m.cy||i.rx!=m.rx||i.ry!=m.ry||i.r!=m.r),s=w[e.type]&&(m.cx!=i.cx||m.cy!=i.cy||m.r!=i.r||m.rx!=i.rx||m.ry!=i.ry),t=e;for(var y in i)i[b](y)&&(m[y]=i[y]);r&&(m.path=a._getPath[e.type](e),e._.dirty=1),i.href&&(l.href=i.href),i.title&&(l.title=i.title),i.target&&(l.target=i.target),i.cursor&&(p.cursor=i.cursor),"blur"in i&&e.blur(i.blur);if(i.path&&e.type=="path"||r)l.path=x(~c(m.path).toLowerCase().indexOf("r")?a._pathToAbsolute(m.path):m.path),e.type=="image"&&(e._.fillpos=[m.x,m.y],e._.fillsize=[m.width,m.height],z(e,1,1,0,0,0));"transform"in i&&e.transform(i.transform);if(s){var B=+m.cx,D=+m.cy,E=+m.rx||+m.r||0,G=+m.ry||+m.r||0;l.path=a.format("ar{0},{1},{2},{3},{4},{1},{4},{1}x",f((B-E)*u),f((D-G)*u),f((B+E)*u),f((D+G)*u),f(B*u))}if("clip-rect"in i){var H=c(i["clip-rect"]).split(k);if(H.length==4){H[2]=+H[2]+ +H[0],H[3]=+H[3]+ +H[1];var I=l.clipRect||a._g.doc.createElement("div"),J=I.style;J.clip=a.format("rect({1}px {2}px {3}px {0}px)",H),l.clipRect||(J.position="absolute",J.top=0,J.left=0,J.width=e.paper.width+"px",J.height=e.paper.height+"px",l.parentNode.insertBefore(I,l),I.appendChild(l),l.clipRect=I)}i["clip-rect"]||l.clipRect&&(l.clipRect.style.clip="auto")}if(e.textpath){var K=e.textpath.style;i.font&&(K.font=i.font),i["font-family"]&&(K.fontFamily='"'+i["font-family"].split(",")[0].replace(/^['"]+|['"]+$/g,o)+'"'),i["font-size"]&&(K.fontSize=i["font-size"]),i["font-weight"]&&(K.fontWeight=i["font-weight"]),i["font-style"]&&(K.fontStyle=i["font-style"])}"arrow-start"in i&&A(t,i["arrow-start"]),"arrow-end"in i&&A(t,i["arrow-end"],1);if(i.opacity!=null||i["stroke-width"]!=null||i.fill!=null||i.src!=null||i.stroke!=null||i["stroke-width"]!=null||i["stroke-opacity"]!=null||i["fill-opacity"]!=null||i["stroke-dasharray"]!=null||i["stroke-miterlimit"]!=null||i["stroke-linejoin"]!=null||i["stroke-linecap"]!=null){var L=l.getElementsByTagName(j),M=!1;L=L&&L[0],!L&&(M=L=F(j)),e.type=="image"&&i.src&&(L.src=i.src),i.fill&&(L.on=!0);if(L.on==null||i.fill=="none"||i.fill===null)L.on=!1;if(L.on&&i.fill){var N=c(i.fill).match(a._ISURL);if(N){L.parentNode==l&&l.removeChild(L),L.rotate=!0,L.src=N[1],L.type="tile";var O=e.getBBox(1);L.position=O.x+n+O.y,e._.fillpos=[O.x,O.y],a._preload(N[1],function(){e._.fillsize=[this.offsetWidth,this.offsetHeight]})}else L.color=a.getRGB(i.fill).hex,L.src=o,L.type="solid",a.getRGB(i.fill).error&&(t.type in{circle:1,ellipse:1}||c(i.fill).charAt()!="r")&&C(t,i.fill,L)&&(m.fill="none",m.gradient=i.fill,L.rotate=!1)}if("fill-opacity"in i||"opacity"in i){var P=((+m["fill-opacity"]+1||2)-1)*((+m.opacity+1||2)-1)*((+a.getRGB(i.fill).o+1||2)-1);P=h(g(P,0),1),L.opacity=P,L.src&&(L.color="none")}l.appendChild(L);var Q=l.getElementsByTagName("stroke")&&l.getElementsByTagName("stroke")[0],T=!1;!Q&&(T=Q=F("stroke"));if(i.stroke&&i.stroke!="none"||i["stroke-width"]||i["stroke-opacity"]!=null||i["stroke-dasharray"]||i["stroke-miterlimit"]||i["stroke-linejoin"]||i["stroke-linecap"])Q.on=!0;(i.stroke=="none"||i.stroke===null||Q.on==null||i.stroke==0||i["stroke-width"]==0)&&(Q.on=!1);var U=a.getRGB(i.stroke);Q.on&&i.stroke&&(Q.color=U.hex),P=((+m["stroke-opacity"]+1||2)-1)*((+m.opacity+1||2)-1)*((+U.o+1||2)-1);var V=(d(i["stroke-width"])||1)*.75;P=h(g(P,0),1),i["stroke-width"]==null&&(V=m["stroke-width"]),i["stroke-width"]&&(Q.weight=V),V&&V<1&&(P*=V)&&(Q.weight=1),Q.opacity=P,i["stroke-linejoin"]&&(Q.joinstyle=i["stroke-linejoin"]||"miter"),Q.miterlimit=i["stroke-miterlimit"]||8,i["stroke-linecap"]&&(Q.endcap=i["stroke-linecap"]=="butt"?"flat":i["stroke-linecap"]=="square"?"square":"round");if(i["stroke-dasharray"]){var W={"-":"shortdash",".":"shortdot","-.":"shortdashdot","-..":"shortdashdotdot",". ":"dot","- ":"dash","--":"longdash","- .":"dashdot","--.":"longdashdot","--..":"longdashdotdot"};Q.dashstyle=W[b](i["stroke-dasharray"])?W[i["stroke-dasharray"]]:o}T&&l.appendChild(Q)}if(t.type=="text"){t.paper.canvas.style.display=o;var X=t.paper.span,Y=100,Z=m.font&&m.font.match(/\d+(?:\.\d*)?(?=px)/);p=X.style,m.font&&(p.font=m.font),m["font-family"]&&(p.fontFamily=m["font-family"]),m["font-weight"]&&(p.fontWeight=m["font-weight"]),m["font-style"]&&(p.fontStyle=m["font-style"]),Z=d(m["font-size"]||Z&&Z[0])||10,p.fontSize=Z*Y+"px",t.textpath.string&&(X.innerHTML=c(t.textpath.string).replace(/</g,"&#60;").replace(/&/g,"&#38;").replace(/\n/g,"<br>"));var $=X.getBoundingClientRect();t.W=m.w=($.right-$.left)/Y,t.H=m.h=($.bottom-$.top)/Y,t.X=m.x,t.Y=m.y+t.H/2,("x"in i||"y"in i)&&(t.path.v=a.format("m{0},{1}l{2},{1}",f(m.x*u),f(m.y*u),f(m.x*u)+1));var _=["x","y","text","font","font-family","font-weight","font-style","font-size"];for(var ba=0,bb=_.length;ba<bb;ba++)if(_[ba]in i){t._.dirty=1;break}switch(m["text-anchor"]){case"start":t.textpath.style["v-text-align"]="left",t.bbx=t.W/2;break;case"end":t.textpath.style["v-text-align"]="right",t.bbx=-t.W/2;break;default:t.textpath.style["v-text-align"]="center",t.bbx=0}t.textpath.style["v-text-kern"]=!0}},C=function(b,f,g){b.attrs=b.attrs||{};var h=b.attrs,i=Math.pow,j,k,l="linear",m=".5 .5";b.attrs.gradient=f,f=c(f).replace(a._radial_gradient,function(a,b,c){l="radial",b&&c&&(b=d(b),c=d(c),i(b-.5,2)+i(c-.5,2)>.25&&(c=e.sqrt(.25-i(b-.5,2))*((c>.5)*2-1)+.5),m=b+n+c);return o}),f=f.split(/\s*\-\s*/);if(l=="linear"){var p=f.shift();p=-d(p);if(isNaN(p))return null}var q=a._parseDots(f);if(!q)return null;b=b.shape||b.node;if(q.length){b.removeChild(g),g.on=!0,g.method="none",g.color=q[0].color,g.color2=q[q.length-1].color;var r=[];for(var s=0,t=q.length;s<t;s++)q[s].offset&&r.push(q[s].offset+n+q[s].color);g.colors=r.length?r.join():"0% "+g.color,l=="radial"?(g.type="gradientTitle",g.focus="100%",g.focussize="0 0",g.focusposition=m,g.angle=0):(g.type="gradient",g.angle=(270-p)%360),b.appendChild(g)}return 1},D=function(b,c){this[0]=this.node=b,b.raphael=!0,this.id=a._oid++,b.raphaelid=this.id,this.X=0,this.Y=0,this.attrs={},this.paper=c,this.matrix=a.matrix(),this._={transform:[],sx:1,sy:1,dx:0,dy:0,deg:0,dirty:1,dirtyT:1},!c.bottom&&(c.bottom=this),this.prev=c.top,c.top&&(c.top.next=this),c.top=this,this.next=null},E=a.el;D.prototype=E,E.constructor=D,E.transform=function(b){if(b==null)return this._.transform;var d=this.paper._viewBoxShift,e=d?"s"+[d.scale,d.scale]+"-1-1t"+[d.dx,d.dy]:o,f;d&&(f=b=c(b).replace(/\.{3}|\u2026/g,this._.transform||o)),a._extractTransform(this,e+b);var g=this.matrix.clone(),h=this.skew,i=this.node,j,k=~c(this.attrs.fill).indexOf("-"),l=!c(this.attrs.fill).indexOf("url(");g.translate(-0.5,-0.5);if(l||k||this.type=="image"){h.matrix="1 0 0 1",h.offset="0 0",j=g.split();if(k&&j.noRotation||!j.isSimple){i.style.filter=g.toFilter();var m=this.getBBox(),p=this.getBBox(1),q=m.x-p.x,r=m.y-p.y;i.coordorigin=q*-u+n+r*-u,z(this,1,1,q,r,0)}else i.style.filter=o,z(this,j.scalex,j.scaley,j.dx,j.dy,j.rotate)}else i.style.filter=o,h.matrix=c(g),h.offset=g.offset();f&&(this._.transform=f);return this},E.rotate=function(a,b,e){if(this.removed)return this;if(a!=null){a=c(a).split(k),a.length-1&&(b=d(a[1]),e=d(a[2])),a=d(a[0]),e==null&&(b=e);if(b==null||e==null){var f=this.getBBox(1);b=f.x+f.width/2,e=f.y+f.height/2}this._.dirtyT=1,this.transform(this._.transform.concat([["r",a,b,e]]));return this}},E.translate=function(a,b){if(this.removed)return this;a=c(a).split(k),a.length-1&&(b=d(a[1])),a=d(a[0])||0,b=+b||0,this._.bbox&&(this._.bbox.x+=a,this._.bbox.y+=b),this.transform(this._.transform.concat([["t",a,b]]));return this},E.scale=function(a,b,e,f){if(this.removed)return this;a=c(a).split(k),a.length-1&&(b=d(a[1]),e=d(a[2]),f=d(a[3]),isNaN(e)&&(e=null),isNaN(f)&&(f=null)),a=d(a[0]),b==null&&(b=a),f==null&&(e=f);if(e==null||f==null)var g=this.getBBox(1);e=e==null?g.x+g.width/2:e,f=f==null?g.y+g.height/2:f,this.transform(this._.transform.concat([["s",a,b,e,f]])),this._.dirtyT=1;return this},E.hide=function(){!this.removed&&(this.node.style.display="none");return this},E.show=function(){!this.removed&&(this.node.style.display=o);return this},E._getBBox=function(){if(this.removed)return{};return{x:this.X+(this.bbx||0)-this.W/2,y:this.Y-this.H,width:this.W,height:this.H}},E.remove=function(){if(!this.removed&&!!this.node.parentNode){this.paper.__set__&&this.paper.__set__.exclude(this),a.eve.unbind("raphael.*.*."+this.id),a._tear(this,this.paper),this.node.parentNode.removeChild(this.node),this.shape&&this.shape.parentNode.removeChild(this.shape);for(var b in this)this[b]=typeof this[b]=="function"?a._removedFactory(b):null;this.removed=!0}},E.attr=function(c,d){if(this.removed)return this;if(c==null){var e={};for(var f in this.attrs)this.attrs[b](f)&&(e[f]=this.attrs[f]);e.gradient&&e.fill=="none"&&(e.fill=e.gradient)&&delete e.gradient,e.transform=this._.transform;return e}if(d==null&&a.is(c,"string")){if(c==j&&this.attrs.fill=="none"&&this.attrs.gradient)return this.attrs.gradient;var g=c.split(k),h={};for(var i=0,m=g.length;i<m;i++)c=g[i],c in this.attrs?h[c]=this.attrs[c]:a.is(this.paper.customAttributes[c],"function")?h[c]=this.paper.customAttributes[c].def:h[c]=a._availableAttrs[c];return m-1?h:h[g[0]]}if(this.attrs&&d==null&&a.is(c,"array")){h={};for(i=0,m=c.length;i<m;i++)h[c[i]]=this.attr(c[i]);return h}var n;d!=null&&(n={},n[c]=d),d==null&&a.is(c,"object")&&(n=c);for(var o in n)l("raphael.attr."+o+"."+this.id,this,n[o]);if(n){for(o in this.paper.customAttributes)if(this.paper.customAttributes[b](o)&&n[b](o)&&a.is(this.paper.customAttributes[o],"function")){var p=this.paper.customAttributes[o].apply(this,[].concat(n[o]));this.attrs[o]=n[o];for(var q in p)p[b](q)&&(n[q]=p[q])}n.text&&this.type=="text"&&(this.textpath.string=n.text),B(this,n)}return this},E.toFront=function(){!this.removed&&this.node.parentNode.appendChild(this.node),this.paper&&this.paper.top!=this&&a._tofront(this,this.paper);return this},E.toBack=function(){if(this.removed)return this;this.node.parentNode.firstChild!=this.node&&(this.node.parentNode.insertBefore(this.node,this.node.parentNode.firstChild),a._toback(this,this.paper));return this},E.insertAfter=function(b){if(this.removed)return this;b.constructor==a.st.constructor&&(b=b[b.length-1]),b.node.nextSibling?b.node.parentNode.insertBefore(this.node,b.node.nextSibling):b.node.parentNode.appendChild(this.node),a._insertafter(this,b,this.paper);return this},E.insertBefore=function(b){if(this.removed)return this;b.constructor==a.st.constructor&&(b=b[0]),b.node.parentNode.insertBefore(this.node,b.node),a._insertbefore(this,b,this.paper);return this},E.blur=function(b){var c=this.node.runtimeStyle,d=c.filter;d=d.replace(r,o),+b!==0?(this.attrs.blur=b,c.filter=d+n+m+".Blur(pixelradius="+(+b||1.5)+")",c.margin=a.format("-{0}px 0 0 -{0}px",f(+b||1.5))):(c.filter=d,c.margin=0,delete this.attrs.blur)},a._engine.path=function(a,b){var c=F("shape");c.style.cssText=t,c.coordsize=u+n+u,c.coordorigin=b.coordorigin;var d=new D(c,b),e={fill:"none",stroke:"#000"};a&&(e.path=a),d.type="path",d.path=[],d.Path=o,B(d,e),b.canvas.appendChild(c);var f=F("skew");f.on=!0,c.appendChild(f),d.skew=f,d.transform(o);return d},a._engine.rect=function(b,c,d,e,f,g){var h=a._rectPath(c,d,e,f,g),i=b.path(h),j=i.attrs;i.X=j.x=c,i.Y=j.y=d,i.W=j.width=e,i.H=j.height=f,j.r=g,j.path=h,i.type="rect";return i},a._engine.ellipse=function(a,b,c,d,e){var f=a.path(),g=f.attrs;f.X=b-d,f.Y=c-e,f.W=d*2,f.H=e*2,f.type="ellipse",B(f,{cx:b,cy:c,rx:d,ry:e});return f},a._engine.circle=function(a,b,c,d){var e=a.path(),f=e.attrs;e.X=b-d,e.Y=c-d,e.W=e.H=d*2,e.type="circle",B(e,{cx:b,cy:c,r:d});return e},a._engine.image=function(b,c,d,e,f,g){var h=a._rectPath(d,e,f,g),i=b.path(h).attr({stroke:"none"}),k=i.attrs,l=i.node,m=l.getElementsByTagName(j)[0];k.src=c,i.X=k.x=d,i.Y=k.y=e,i.W=k.width=f,i.H=k.height=g,k.path=h,i.type="image",m.parentNode==l&&l.removeChild(m),m.rotate=!0,m.src=c,m.type="tile",i._.fillpos=[d,e],i._.fillsize=[f,g],l.appendChild(m),z(i,1,1,0,0,0);return i},a._engine.text=function(b,d,e,g){var h=F("shape"),i=F("path"),j=F("textpath");d=d||0,e=e||0,g=g||"",i.v=a.format("m{0},{1}l{2},{1}",f(d*u),f(e*u),f(d*u)+1),i.textpathok=!0,j.string=c(g),j.on=!0,h.style.cssText=t,h.coordsize=u+n+u,h.coordorigin="0 0";var k=new D(h,b),l={fill:"#000",stroke:"none",font:a._availableAttrs.font,text:g};k.shape=h,k.path=i,k.textpath=j,k.type="text",k.attrs.text=c(g),k.attrs.x=d,k.attrs.y=e,k.attrs.w=1,k.attrs.h=1,B(k,l),h.appendChild(j),h.appendChild(i),b.canvas.appendChild(h);var m=F("skew");m.on=!0,h.appendChild(m),k.skew=m,k.transform(o);return k},a._engine.setSize=function(b,c){var d=this.canvas.style;this.width=b,this.height=c,b==+b&&(b+="px"),c==+c&&(c+="px"),d.width=b,d.height=c,d.clip="rect(0 "+b+" "+c+" 0)",this._viewBox&&a._engine.setViewBox.apply(this,this._viewBox);return this},a._engine.setViewBox=function(b,c,d,e,f){a.eve("raphael.setViewBox",this,this._viewBox,[b,c,d,e,f]);var h=this.width,i=this.height,j=1/g(d/h,e/i),k,l;f&&(k=i/e,l=h/d,d*k<h&&(b-=(h-d*k)/2/k),e*l<i&&(c-=(i-e*l)/2/l)),this._viewBox=[b,c,d,e,!!f],this._viewBoxShift={dx:-b,dy:-c,scale:j},this.forEach(function(a){a.transform("...")});return this};var F;a._engine.initWin=function(a){var b=a.document;b.createStyleSheet().addRule(".rvml","behavior:url(#default#VML)");try{!b.namespaces.rvml&&b.namespaces.add("rvml","urn:schemas-microsoft-com:vml"),F=function(a){return b.createElement("<rvml:"+a+' class="rvml">')}}catch(c){F=function(a){return b.createElement("<"+a+' xmlns="urn:schemas-microsoft.com:vml" class="rvml">')}}},a._engine.initWin(a._g.win),a._engine.create=function(){var b=a._getContainer.apply(0,arguments),c=b.container,d=b.height,e,f=b.width,g=b.x,h=b.y;if(!c)throw new Error("VML container not found.");var i=new a._Paper,j=i.canvas=a._g.doc.createElement("div"),k=j.style;g=g||0,h=h||0,f=f||512,d=d||342,i.width=f,i.height=d,f==+f&&(f+="px"),d==+d&&(d+="px"),i.coordsize=u*1e3+n+u*1e3,i.coordorigin="0 0",i.span=a._g.doc.createElement("span"),i.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;",j.appendChild(i.span),k.cssText=a.format("top:0;left:0;width:{0};height:{1};display:inline-block;position:relative;clip:rect(0 {0} {1} 0);overflow:hidden",f,d),c==1?(a._g.doc.body.appendChild(j),k.left=g+"px",k.top=h+"px",k.position="absolute"):c.firstChild?c.insertBefore(j,c.firstChild):c.appendChild(j),i.renderfix=function(){};return i},a.prototype.clear=function(){a.eve("raphael.clear",this),this.canvas.innerHTML=o,this.span=a._g.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},a.prototype.remove=function(){a.eve("raphael.remove",this),this.canvas.parentNode.removeChild(this.canvas);for(var b in this)this[b]=typeof this[b]=="function"?a._removedFactory(b):null;return!0};var G=a.st;for(var H in E)E[b](H)&&!G[b](H)&&(G[H]=function(a){return function(){var b=arguments;return this.forEach(function(c){c[a].apply(c,b)})}}(H))}(window.Raphael)
9
+ !function(a){var b,c,d="0.4.2",e="hasOwnProperty",f=/[\.\/]/,g="*",h=function(){},i=function(a,b){return a-b},j={n:{}},k=function(a,d){a=String(a);var e,f=c,g=Array.prototype.slice.call(arguments,2),h=k.listeners(a),j=0,l=[],m={},n=[],o=b;b=a,c=0;for(var p=0,q=h.length;q>p;p++)"zIndex"in h[p]&&(l.push(h[p].zIndex),h[p].zIndex<0&&(m[h[p].zIndex]=h[p]));for(l.sort(i);l[j]<0;)if(e=m[l[j++]],n.push(e.apply(d,g)),c)return c=f,n;for(p=0;q>p;p++)if(e=h[p],"zIndex"in e)if(e.zIndex==l[j]){if(n.push(e.apply(d,g)),c)break;do if(j++,e=m[l[j]],e&&n.push(e.apply(d,g)),c)break;while(e)}else m[e.zIndex]=e;else if(n.push(e.apply(d,g)),c)break;return c=f,b=o,n.length?n:null};k._events=j,k.listeners=function(a){var b,c,d,e,h,i,k,l,m=a.split(f),n=j,o=[n],p=[];for(e=0,h=m.length;h>e;e++){for(l=[],i=0,k=o.length;k>i;i++)for(n=o[i].n,c=[n[m[e]],n[g]],d=2;d--;)b=c[d],b&&(l.push(b),p=p.concat(b.f||[]));o=l}return p},k.on=function(a,b){if(a=String(a),"function"!=typeof b)return function(){};for(var c=a.split(f),d=j,e=0,g=c.length;g>e;e++)d=d.n,d=d.hasOwnProperty(c[e])&&d[c[e]]||(d[c[e]]={n:{}});for(d.f=d.f||[],e=0,g=d.f.length;g>e;e++)if(d.f[e]==b)return h;return d.f.push(b),function(a){+a==+a&&(b.zIndex=+a)}},k.f=function(a){var b=[].slice.call(arguments,1);return function(){k.apply(null,[a,null].concat(b).concat([].slice.call(arguments,0)))}},k.stop=function(){c=1},k.nt=function(a){return a?new RegExp("(?:\\.|\\/|^)"+a+"(?:\\.|\\/|$)").test(b):b},k.nts=function(){return b.split(f)},k.off=k.unbind=function(a,b){if(!a)return k._events=j={n:{}},void 0;var c,d,h,i,l,m,n,o=a.split(f),p=[j];for(i=0,l=o.length;l>i;i++)for(m=0;m<p.length;m+=h.length-2){if(h=[m,1],c=p[m].n,o[i]!=g)c[o[i]]&&h.push(c[o[i]]);else for(d in c)c[e](d)&&h.push(c[d]);p.splice.apply(p,h)}for(i=0,l=p.length;l>i;i++)for(c=p[i];c.n;){if(b){if(c.f){for(m=0,n=c.f.length;n>m;m++)if(c.f[m]==b){c.f.splice(m,1);break}!c.f.length&&delete c.f}for(d in c.n)if(c.n[e](d)&&c.n[d].f){var q=c.n[d].f;for(m=0,n=q.length;n>m;m++)if(q[m]==b){q.splice(m,1);break}!q.length&&delete c.n[d].f}}else{delete c.f;for(d in c.n)c.n[e](d)&&c.n[d].f&&delete c.n[d].f}c=c.n}},k.once=function(a,b){var c=function(){return k.unbind(a,c),b.apply(this,arguments)};return k.on(a,c)},k.version=d,k.toString=function(){return"You are running Eve "+d},"undefined"!=typeof module&&module.exports?module.exports=k:"undefined"!=typeof define?define("eve",[],function(){return k}):a.eve=k}(this),function(a,b){"function"==typeof define&&define.amd?define(["eve"],function(c){return b(a,c)}):b(a,a.eve)}(this,function(a,b){function c(a){if(c.is(a,"function"))return u?a():b.on("raphael.DOMload",a);if(c.is(a,V))return c._engine.create[D](c,a.splice(0,3+c.is(a[0],T))).add(a);var d=Array.prototype.slice.call(arguments,0);if(c.is(d[d.length-1],"function")){var e=d.pop();return u?e.call(c._engine.create[D](c,d)):b.on("raphael.DOMload",function(){e.call(c._engine.create[D](c,d))})}return c._engine.create[D](c,arguments)}function d(a){if("function"==typeof a||Object(a)!==a)return a;var b=new a.constructor;for(var c in a)a[z](c)&&(b[c]=d(a[c]));return b}function e(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return a.push(a.splice(c,1)[0])}function f(a,b,c){function d(){var f=Array.prototype.slice.call(arguments,0),g=f.join("␀"),h=d.cache=d.cache||{},i=d.count=d.count||[];return h[z](g)?(e(i,g),c?c(h[g]):h[g]):(i.length>=1e3&&delete h[i.shift()],i.push(g),h[g]=a[D](b,f),c?c(h[g]):h[g])}return d}function g(){return this.hex}function h(a,b){for(var c=[],d=0,e=a.length;e-2*!b>d;d+=2){var f=[{x:+a[d-2],y:+a[d-1]},{x:+a[d],y:+a[d+1]},{x:+a[d+2],y:+a[d+3]},{x:+a[d+4],y:+a[d+5]}];b?d?e-4==d?f[3]={x:+a[0],y:+a[1]}:e-2==d&&(f[2]={x:+a[0],y:+a[1]},f[3]={x:+a[2],y:+a[3]}):f[0]={x:+a[e-2],y:+a[e-1]}:e-4==d?f[3]=f[2]:d||(f[0]={x:+a[d],y:+a[d+1]}),c.push(["C",(-f[0].x+6*f[1].x+f[2].x)/6,(-f[0].y+6*f[1].y+f[2].y)/6,(f[1].x+6*f[2].x-f[3].x)/6,(f[1].y+6*f[2].y-f[3].y)/6,f[2].x,f[2].y])}return c}function i(a,b,c,d,e){var f=-3*b+9*c-9*d+3*e,g=a*f+6*b-12*c+6*d;return a*g-3*b+3*c}function j(a,b,c,d,e,f,g,h,j){null==j&&(j=1),j=j>1?1:0>j?0:j;for(var k=j/2,l=12,m=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],n=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],o=0,p=0;l>p;p++){var q=k*m[p]+k,r=i(q,a,c,e,g),s=i(q,b,d,f,h),t=r*r+s*s;o+=n[p]*N.sqrt(t)}return k*o}function k(a,b,c,d,e,f,g,h,i){if(!(0>i||j(a,b,c,d,e,f,g,h)<i)){var k,l=1,m=l/2,n=l-m,o=.01;for(k=j(a,b,c,d,e,f,g,h,n);Q(k-i)>o;)m/=2,n+=(i>k?1:-1)*m,k=j(a,b,c,d,e,f,g,h,n);return n}}function l(a,b,c,d,e,f,g,h){if(!(O(a,c)<P(e,g)||P(a,c)>O(e,g)||O(b,d)<P(f,h)||P(b,d)>O(f,h))){var i=(a*d-b*c)*(e-g)-(a-c)*(e*h-f*g),j=(a*d-b*c)*(f-h)-(b-d)*(e*h-f*g),k=(a-c)*(f-h)-(b-d)*(e-g);if(k){var l=i/k,m=j/k,n=+l.toFixed(2),o=+m.toFixed(2);if(!(n<+P(a,c).toFixed(2)||n>+O(a,c).toFixed(2)||n<+P(e,g).toFixed(2)||n>+O(e,g).toFixed(2)||o<+P(b,d).toFixed(2)||o>+O(b,d).toFixed(2)||o<+P(f,h).toFixed(2)||o>+O(f,h).toFixed(2)))return{x:l,y:m}}}}function m(a,b,d){var e=c.bezierBBox(a),f=c.bezierBBox(b);if(!c.isBBoxIntersect(e,f))return d?0:[];for(var g=j.apply(0,a),h=j.apply(0,b),i=O(~~(g/5),1),k=O(~~(h/5),1),m=[],n=[],o={},p=d?0:[],q=0;i+1>q;q++){var r=c.findDotsAtSegment.apply(c,a.concat(q/i));m.push({x:r.x,y:r.y,t:q/i})}for(q=0;k+1>q;q++)r=c.findDotsAtSegment.apply(c,b.concat(q/k)),n.push({x:r.x,y:r.y,t:q/k});for(q=0;i>q;q++)for(var s=0;k>s;s++){var t=m[q],u=m[q+1],v=n[s],w=n[s+1],x=Q(u.x-t.x)<.001?"y":"x",y=Q(w.x-v.x)<.001?"y":"x",z=l(t.x,t.y,u.x,u.y,v.x,v.y,w.x,w.y);if(z){if(o[z.x.toFixed(4)]==z.y.toFixed(4))continue;o[z.x.toFixed(4)]=z.y.toFixed(4);var A=t.t+Q((z[x]-t[x])/(u[x]-t[x]))*(u.t-t.t),B=v.t+Q((z[y]-v[y])/(w[y]-v[y]))*(w.t-v.t);A>=0&&1.001>=A&&B>=0&&1.001>=B&&(d?p++:p.push({x:z.x,y:z.y,t1:P(A,1),t2:P(B,1)}))}}return p}function n(a,b,d){a=c._path2curve(a),b=c._path2curve(b);for(var e,f,g,h,i,j,k,l,n,o,p=d?0:[],q=0,r=a.length;r>q;q++){var s=a[q];if("M"==s[0])e=i=s[1],f=j=s[2];else{"C"==s[0]?(n=[e,f].concat(s.slice(1)),e=n[6],f=n[7]):(n=[e,f,e,f,i,j,i,j],e=i,f=j);for(var t=0,u=b.length;u>t;t++){var v=b[t];if("M"==v[0])g=k=v[1],h=l=v[2];else{"C"==v[0]?(o=[g,h].concat(v.slice(1)),g=o[6],h=o[7]):(o=[g,h,g,h,k,l,k,l],g=k,h=l);var w=m(n,o,d);if(d)p+=w;else{for(var x=0,y=w.length;y>x;x++)w[x].segment1=q,w[x].segment2=t,w[x].bez1=n,w[x].bez2=o;p=p.concat(w)}}}}}return p}function o(a,b,c,d,e,f){null!=a?(this.a=+a,this.b=+b,this.c=+c,this.d=+d,this.e=+e,this.f=+f):(this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0)}function p(){return this.x+H+this.y+H+this.width+" × "+this.height}function q(a,b,c,d,e,f){function g(a){return((l*a+k)*a+j)*a}function h(a,b){var c=i(a,b);return((o*c+n)*c+m)*c}function i(a,b){var c,d,e,f,h,i;for(e=a,i=0;8>i;i++){if(f=g(e)-a,Q(f)<b)return e;if(h=(3*l*e+2*k)*e+j,Q(h)<1e-6)break;e-=f/h}if(c=0,d=1,e=a,c>e)return c;if(e>d)return d;for(;d>c;){if(f=g(e),Q(f-a)<b)return e;a>f?c=e:d=e,e=(d-c)/2+c}return e}var j=3*b,k=3*(d-b)-j,l=1-j-k,m=3*c,n=3*(e-c)-m,o=1-m-n;return h(a,1/(200*f))}function r(a,b){var c=[],d={};if(this.ms=b,this.times=1,a){for(var e in a)a[z](e)&&(d[_(e)]=a[e],c.push(_(e)));c.sort(lb)}this.anim=d,this.top=c[c.length-1],this.percents=c}function s(a,d,e,f,g,h){e=_(e);var i,j,k,l,m,n,p=a.ms,r={},s={},t={};if(f)for(v=0,x=ic.length;x>v;v++){var u=ic[v];if(u.el.id==d.id&&u.anim==a){u.percent!=e?(ic.splice(v,1),k=1):j=u,d.attr(u.totalOrigin);break}}else f=+s;for(var v=0,x=a.percents.length;x>v;v++){if(a.percents[v]==e||a.percents[v]>f*a.top){e=a.percents[v],m=a.percents[v-1]||0,p=p/a.top*(e-m),l=a.percents[v+1],i=a.anim[e];break}f&&d.attr(a.anim[a.percents[v]])}if(i){if(j)j.initstatus=f,j.start=new Date-j.ms*f;else{for(var y in i)if(i[z](y)&&(db[z](y)||d.paper.customAttributes[z](y)))switch(r[y]=d.attr(y),null==r[y]&&(r[y]=cb[y]),s[y]=i[y],db[y]){case T:t[y]=(s[y]-r[y])/p;break;case"colour":r[y]=c.getRGB(r[y]);var A=c.getRGB(s[y]);t[y]={r:(A.r-r[y].r)/p,g:(A.g-r[y].g)/p,b:(A.b-r[y].b)/p};break;case"path":var B=Kb(r[y],s[y]),C=B[1];for(r[y]=B[0],t[y]=[],v=0,x=r[y].length;x>v;v++){t[y][v]=[0];for(var D=1,F=r[y][v].length;F>D;D++)t[y][v][D]=(C[v][D]-r[y][v][D])/p}break;case"transform":var G=d._,H=Pb(G[y],s[y]);if(H)for(r[y]=H.from,s[y]=H.to,t[y]=[],t[y].real=!0,v=0,x=r[y].length;x>v;v++)for(t[y][v]=[r[y][v][0]],D=1,F=r[y][v].length;F>D;D++)t[y][v][D]=(s[y][v][D]-r[y][v][D])/p;else{var K=d.matrix||new o,L={_:{transform:G.transform},getBBox:function(){return d.getBBox(1)}};r[y]=[K.a,K.b,K.c,K.d,K.e,K.f],Nb(L,s[y]),s[y]=L._.transform,t[y]=[(L.matrix.a-K.a)/p,(L.matrix.b-K.b)/p,(L.matrix.c-K.c)/p,(L.matrix.d-K.d)/p,(L.matrix.e-K.e)/p,(L.matrix.f-K.f)/p]}break;case"csv":var M=I(i[y])[J](w),N=I(r[y])[J](w);if("clip-rect"==y)for(r[y]=N,t[y]=[],v=N.length;v--;)t[y][v]=(M[v]-r[y][v])/p;s[y]=M;break;default:for(M=[][E](i[y]),N=[][E](r[y]),t[y]=[],v=d.paper.customAttributes[y].length;v--;)t[y][v]=((M[v]||0)-(N[v]||0))/p}var O=i.easing,P=c.easing_formulas[O];if(!P)if(P=I(O).match(Z),P&&5==P.length){var Q=P;P=function(a){return q(a,+Q[1],+Q[2],+Q[3],+Q[4],p)}}else P=nb;if(n=i.start||a.start||+new Date,u={anim:a,percent:e,timestamp:n,start:n+(a.del||0),status:0,initstatus:f||0,stop:!1,ms:p,easing:P,from:r,diff:t,to:s,el:d,callback:i.callback,prev:m,next:l,repeat:h||a.times,origin:d.attr(),totalOrigin:g},ic.push(u),f&&!j&&!k&&(u.stop=!0,u.start=new Date-p*f,1==ic.length))return kc();k&&(u.start=new Date-u.ms*f),1==ic.length&&jc(kc)}b("raphael.anim.start."+d.id,d,a)}}function t(a){for(var b=0;b<ic.length;b++)ic[b].el.paper==a&&ic.splice(b--,1)}c.version="2.1.2",c.eve=b;var u,v,w=/[, ]+/,x={circle:1,rect:1,path:1,ellipse:1,text:1,image:1},y=/\{(\d+)\}/g,z="hasOwnProperty",A={doc:document,win:a},B={was:Object.prototype[z].call(A.win,"Raphael"),is:A.win.Raphael},C=function(){this.ca=this.customAttributes={}},D="apply",E="concat",F="ontouchstart"in A.win||A.win.DocumentTouch&&A.doc instanceof DocumentTouch,G="",H=" ",I=String,J="split",K="click dblclick mousedown mousemove mouseout mouseover mouseup touchstart touchmove touchend touchcancel"[J](H),L={mousedown:"touchstart",mousemove:"touchmove",mouseup:"touchend"},M=I.prototype.toLowerCase,N=Math,O=N.max,P=N.min,Q=N.abs,R=N.pow,S=N.PI,T="number",U="string",V="array",W=Object.prototype.toString,X=(c._ISURL=/^url\(['"]?([^\)]+?)['"]?\)$/i,/^\s*((#[a-f\d]{6})|(#[a-f\d]{3})|rgba?\(\s*([\d\.]+%?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+%?(?:\s*,\s*[\d\.]+%?)?)\s*\)|hsba?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?)%?\s*\)|hsla?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?)%?\s*\))\s*$/i),Y={NaN:1,Infinity:1,"-Infinity":1},Z=/^(?:cubic-)?bezier\(([^,]+),([^,]+),([^,]+),([^\)]+)\)/,$=N.round,_=parseFloat,ab=parseInt,bb=I.prototype.toUpperCase,cb=c._availableAttrs={"arrow-end":"none","arrow-start":"none",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/","letter-spacing":0,opacity:1,path:"M0,0",r:0,rx:0,ry:0,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",transform:"",width:0,x:0,y:0},db=c._availableAnimAttrs={blur:T,"clip-rect":"csv",cx:T,cy:T,fill:"colour","fill-opacity":T,"font-size":T,height:T,opacity:T,path:"path",r:T,rx:T,ry:T,stroke:"colour","stroke-opacity":T,"stroke-width":T,transform:"transform",width:T,x:T,y:T},eb=/[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*/,fb={hs:1,rg:1},gb=/,?([achlmqrstvxz]),?/gi,hb=/([achlmrqstvz])[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*)+)/gi,ib=/([rstm])[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*)+)/gi,jb=/(-?\d*\.?\d*(?:e[\-+]?\d+)?)[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*/gi,kb=(c._radial_gradient=/^r(?:\(([^,]+?)[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*([^\)]+?)\))?/,{}),lb=function(a,b){return _(a)-_(b)},mb=function(){},nb=function(a){return a},ob=c._rectPath=function(a,b,c,d,e){return e?[["M",a+e,b],["l",c-2*e,0],["a",e,e,0,0,1,e,e],["l",0,d-2*e],["a",e,e,0,0,1,-e,e],["l",2*e-c,0],["a",e,e,0,0,1,-e,-e],["l",0,2*e-d],["a",e,e,0,0,1,e,-e],["z"]]:[["M",a,b],["l",c,0],["l",0,d],["l",-c,0],["z"]]},pb=function(a,b,c,d){return null==d&&(d=c),[["M",a,b],["m",0,-d],["a",c,d,0,1,1,0,2*d],["a",c,d,0,1,1,0,-2*d],["z"]]},qb=c._getPath={path:function(a){return a.attr("path")},circle:function(a){var b=a.attrs;return pb(b.cx,b.cy,b.r)},ellipse:function(a){var b=a.attrs;return pb(b.cx,b.cy,b.rx,b.ry)},rect:function(a){var b=a.attrs;return ob(b.x,b.y,b.width,b.height,b.r)},image:function(a){var b=a.attrs;return ob(b.x,b.y,b.width,b.height)},text:function(a){var b=a._getBBox();return ob(b.x,b.y,b.width,b.height)},set:function(a){var b=a._getBBox();return ob(b.x,b.y,b.width,b.height)}},rb=c.mapPath=function(a,b){if(!b)return a;var c,d,e,f,g,h,i;for(a=Kb(a),e=0,g=a.length;g>e;e++)for(i=a[e],f=1,h=i.length;h>f;f+=2)c=b.x(i[f],i[f+1]),d=b.y(i[f],i[f+1]),i[f]=c,i[f+1]=d;return a};if(c._g=A,c.type=A.win.SVGAngle||A.doc.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")?"SVG":"VML","VML"==c.type){var sb,tb=A.doc.createElement("div");if(tb.innerHTML='<v:shape adj="1"/>',sb=tb.firstChild,sb.style.behavior="url(#default#VML)",!sb||"object"!=typeof sb.adj)return c.type=G;tb=null}c.svg=!(c.vml="VML"==c.type),c._Paper=C,c.fn=v=C.prototype=c.prototype,c._id=0,c._oid=0,c.is=function(a,b){return b=M.call(b),"finite"==b?!Y[z](+a):"array"==b?a instanceof Array:"null"==b&&null===a||b==typeof a&&null!==a||"object"==b&&a===Object(a)||"array"==b&&Array.isArray&&Array.isArray(a)||W.call(a).slice(8,-1).toLowerCase()==b},c.angle=function(a,b,d,e,f,g){if(null==f){var h=a-d,i=b-e;return h||i?(180+180*N.atan2(-i,-h)/S+360)%360:0}return c.angle(a,b,f,g)-c.angle(d,e,f,g)},c.rad=function(a){return a%360*S/180},c.deg=function(a){return 180*a/S%360},c.snapTo=function(a,b,d){if(d=c.is(d,"finite")?d:10,c.is(a,V)){for(var e=a.length;e--;)if(Q(a[e]-b)<=d)return a[e]}else{a=+a;var f=b%a;if(d>f)return b-f;if(f>a-d)return b-f+a}return b},c.createUUID=function(a,b){return function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(a,b).toUpperCase()}}(/[xy]/g,function(a){var b=0|16*N.random(),c="x"==a?b:8|3&b;return c.toString(16)}),c.setWindow=function(a){b("raphael.setWindow",c,A.win,a),A.win=a,A.doc=A.win.document,c._engine.initWin&&c._engine.initWin(A.win)};var ub=function(a){if(c.vml){var b,d=/^\s+|\s+$/g;try{var e=new ActiveXObject("htmlfile");e.write("<body>"),e.close(),b=e.body}catch(g){b=createPopup().document.body}var h=b.createTextRange();ub=f(function(a){try{b.style.color=I(a).replace(d,G);var c=h.queryCommandValue("ForeColor");return c=(255&c)<<16|65280&c|(16711680&c)>>>16,"#"+("000000"+c.toString(16)).slice(-6)}catch(e){return"none"}})}else{var i=A.doc.createElement("i");i.title="Raphaël Colour Picker",i.style.display="none",A.doc.body.appendChild(i),ub=f(function(a){return i.style.color=a,A.doc.defaultView.getComputedStyle(i,G).getPropertyValue("color")})}return ub(a)},vb=function(){return"hsb("+[this.h,this.s,this.b]+")"},wb=function(){return"hsl("+[this.h,this.s,this.l]+")"},xb=function(){return this.hex},yb=function(a,b,d){if(null==b&&c.is(a,"object")&&"r"in a&&"g"in a&&"b"in a&&(d=a.b,b=a.g,a=a.r),null==b&&c.is(a,U)){var e=c.getRGB(a);a=e.r,b=e.g,d=e.b}return(a>1||b>1||d>1)&&(a/=255,b/=255,d/=255),[a,b,d]},zb=function(a,b,d,e){a*=255,b*=255,d*=255;var f={r:a,g:b,b:d,hex:c.rgb(a,b,d),toString:xb};return c.is(e,"finite")&&(f.opacity=e),f};c.color=function(a){var b;return c.is(a,"object")&&"h"in a&&"s"in a&&"b"in a?(b=c.hsb2rgb(a),a.r=b.r,a.g=b.g,a.b=b.b,a.hex=b.hex):c.is(a,"object")&&"h"in a&&"s"in a&&"l"in a?(b=c.hsl2rgb(a),a.r=b.r,a.g=b.g,a.b=b.b,a.hex=b.hex):(c.is(a,"string")&&(a=c.getRGB(a)),c.is(a,"object")&&"r"in a&&"g"in a&&"b"in a?(b=c.rgb2hsl(a),a.h=b.h,a.s=b.s,a.l=b.l,b=c.rgb2hsb(a),a.v=b.b):(a={hex:"none"},a.r=a.g=a.b=a.h=a.s=a.v=a.l=-1)),a.toString=xb,a},c.hsb2rgb=function(a,b,c,d){this.is(a,"object")&&"h"in a&&"s"in a&&"b"in a&&(c=a.b,b=a.s,a=a.h,d=a.o),a*=360;var e,f,g,h,i;return a=a%360/60,i=c*b,h=i*(1-Q(a%2-1)),e=f=g=c-i,a=~~a,e+=[i,h,0,0,h,i][a],f+=[h,i,i,h,0,0][a],g+=[0,0,h,i,i,h][a],zb(e,f,g,d)},c.hsl2rgb=function(a,b,c,d){this.is(a,"object")&&"h"in a&&"s"in a&&"l"in a&&(c=a.l,b=a.s,a=a.h),(a>1||b>1||c>1)&&(a/=360,b/=100,c/=100),a*=360;var e,f,g,h,i;return a=a%360/60,i=2*b*(.5>c?c:1-c),h=i*(1-Q(a%2-1)),e=f=g=c-i/2,a=~~a,e+=[i,h,0,0,h,i][a],f+=[h,i,i,h,0,0][a],g+=[0,0,h,i,i,h][a],zb(e,f,g,d)},c.rgb2hsb=function(a,b,c){c=yb(a,b,c),a=c[0],b=c[1],c=c[2];var d,e,f,g;return f=O(a,b,c),g=f-P(a,b,c),d=0==g?null:f==a?(b-c)/g:f==b?(c-a)/g+2:(a-b)/g+4,d=60*((d+360)%6)/360,e=0==g?0:g/f,{h:d,s:e,b:f,toString:vb}},c.rgb2hsl=function(a,b,c){c=yb(a,b,c),a=c[0],b=c[1],c=c[2];var d,e,f,g,h,i;return g=O(a,b,c),h=P(a,b,c),i=g-h,d=0==i?null:g==a?(b-c)/i:g==b?(c-a)/i+2:(a-b)/i+4,d=60*((d+360)%6)/360,f=(g+h)/2,e=0==i?0:.5>f?i/(2*f):i/(2-2*f),{h:d,s:e,l:f,toString:wb}},c._path2string=function(){return this.join(",").replace(gb,"$1")},c._preload=function(a,b){var c=A.doc.createElement("img");c.style.cssText="position:absolute;left:-9999em;top:-9999em",c.onload=function(){b.call(this),this.onload=null,A.doc.body.removeChild(this)},c.onerror=function(){A.doc.body.removeChild(this)},A.doc.body.appendChild(c),c.src=a},c.getRGB=f(function(a){if(!a||(a=I(a)).indexOf("-")+1)return{r:-1,g:-1,b:-1,hex:"none",error:1,toString:g};if("none"==a)return{r:-1,g:-1,b:-1,hex:"none",toString:g};!(fb[z](a.toLowerCase().substring(0,2))||"#"==a.charAt())&&(a=ub(a));var b,d,e,f,h,i,j=a.match(X);return j?(j[2]&&(e=ab(j[2].substring(5),16),d=ab(j[2].substring(3,5),16),b=ab(j[2].substring(1,3),16)),j[3]&&(e=ab((h=j[3].charAt(3))+h,16),d=ab((h=j[3].charAt(2))+h,16),b=ab((h=j[3].charAt(1))+h,16)),j[4]&&(i=j[4][J](eb),b=_(i[0]),"%"==i[0].slice(-1)&&(b*=2.55),d=_(i[1]),"%"==i[1].slice(-1)&&(d*=2.55),e=_(i[2]),"%"==i[2].slice(-1)&&(e*=2.55),"rgba"==j[1].toLowerCase().slice(0,4)&&(f=_(i[3])),i[3]&&"%"==i[3].slice(-1)&&(f/=100)),j[5]?(i=j[5][J](eb),b=_(i[0]),"%"==i[0].slice(-1)&&(b*=2.55),d=_(i[1]),"%"==i[1].slice(-1)&&(d*=2.55),e=_(i[2]),"%"==i[2].slice(-1)&&(e*=2.55),("deg"==i[0].slice(-3)||"°"==i[0].slice(-1))&&(b/=360),"hsba"==j[1].toLowerCase().slice(0,4)&&(f=_(i[3])),i[3]&&"%"==i[3].slice(-1)&&(f/=100),c.hsb2rgb(b,d,e,f)):j[6]?(i=j[6][J](eb),b=_(i[0]),"%"==i[0].slice(-1)&&(b*=2.55),d=_(i[1]),"%"==i[1].slice(-1)&&(d*=2.55),e=_(i[2]),"%"==i[2].slice(-1)&&(e*=2.55),("deg"==i[0].slice(-3)||"°"==i[0].slice(-1))&&(b/=360),"hsla"==j[1].toLowerCase().slice(0,4)&&(f=_(i[3])),i[3]&&"%"==i[3].slice(-1)&&(f/=100),c.hsl2rgb(b,d,e,f)):(j={r:b,g:d,b:e,toString:g},j.hex="#"+(16777216|e|d<<8|b<<16).toString(16).slice(1),c.is(f,"finite")&&(j.opacity=f),j)):{r:-1,g:-1,b:-1,hex:"none",error:1,toString:g}},c),c.hsb=f(function(a,b,d){return c.hsb2rgb(a,b,d).hex}),c.hsl=f(function(a,b,d){return c.hsl2rgb(a,b,d).hex}),c.rgb=f(function(a,b,c){return"#"+(16777216|c|b<<8|a<<16).toString(16).slice(1)}),c.getColor=function(a){var b=this.getColor.start=this.getColor.start||{h:0,s:1,b:a||.75},c=this.hsb2rgb(b.h,b.s,b.b);return b.h+=.075,b.h>1&&(b.h=0,b.s-=.2,b.s<=0&&(this.getColor.start={h:0,s:1,b:b.b})),c.hex},c.getColor.reset=function(){delete this.start},c.parsePathString=function(a){if(!a)return null;var b=Ab(a);if(b.arr)return Cb(b.arr);var d={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0},e=[];return c.is(a,V)&&c.is(a[0],V)&&(e=Cb(a)),e.length||I(a).replace(hb,function(a,b,c){var f=[],g=b.toLowerCase();if(c.replace(jb,function(a,b){b&&f.push(+b)}),"m"==g&&f.length>2&&(e.push([b][E](f.splice(0,2))),g="l",b="m"==b?"l":"L"),"r"==g)e.push([b][E](f));else for(;f.length>=d[g]&&(e.push([b][E](f.splice(0,d[g]))),d[g]););}),e.toString=c._path2string,b.arr=Cb(e),e},c.parseTransformString=f(function(a){if(!a)return null;var b=[];return c.is(a,V)&&c.is(a[0],V)&&(b=Cb(a)),b.length||I(a).replace(ib,function(a,c,d){var e=[];M.call(c),d.replace(jb,function(a,b){b&&e.push(+b)}),b.push([c][E](e))}),b.toString=c._path2string,b});var Ab=function(a){var b=Ab.ps=Ab.ps||{};return b[a]?b[a].sleep=100:b[a]={sleep:100},setTimeout(function(){for(var c in b)b[z](c)&&c!=a&&(b[c].sleep--,!b[c].sleep&&delete b[c])}),b[a]};c.findDotsAtSegment=function(a,b,c,d,e,f,g,h,i){var j=1-i,k=R(j,3),l=R(j,2),m=i*i,n=m*i,o=k*a+3*l*i*c+3*j*i*i*e+n*g,p=k*b+3*l*i*d+3*j*i*i*f+n*h,q=a+2*i*(c-a)+m*(e-2*c+a),r=b+2*i*(d-b)+m*(f-2*d+b),s=c+2*i*(e-c)+m*(g-2*e+c),t=d+2*i*(f-d)+m*(h-2*f+d),u=j*a+i*c,v=j*b+i*d,w=j*e+i*g,x=j*f+i*h,y=90-180*N.atan2(q-s,r-t)/S;return(q>s||t>r)&&(y+=180),{x:o,y:p,m:{x:q,y:r},n:{x:s,y:t},start:{x:u,y:v},end:{x:w,y:x},alpha:y}},c.bezierBBox=function(a,b,d,e,f,g,h,i){c.is(a,"array")||(a=[a,b,d,e,f,g,h,i]);var j=Jb.apply(null,a);return{x:j.min.x,y:j.min.y,x2:j.max.x,y2:j.max.y,width:j.max.x-j.min.x,height:j.max.y-j.min.y}},c.isPointInsideBBox=function(a,b,c){return b>=a.x&&b<=a.x2&&c>=a.y&&c<=a.y2},c.isBBoxIntersect=function(a,b){var d=c.isPointInsideBBox;return d(b,a.x,a.y)||d(b,a.x2,a.y)||d(b,a.x,a.y2)||d(b,a.x2,a.y2)||d(a,b.x,b.y)||d(a,b.x2,b.y)||d(a,b.x,b.y2)||d(a,b.x2,b.y2)||(a.x<b.x2&&a.x>b.x||b.x<a.x2&&b.x>a.x)&&(a.y<b.y2&&a.y>b.y||b.y<a.y2&&b.y>a.y)},c.pathIntersection=function(a,b){return n(a,b)},c.pathIntersectionNumber=function(a,b){return n(a,b,1)},c.isPointInsidePath=function(a,b,d){var e=c.pathBBox(a);return c.isPointInsideBBox(e,b,d)&&1==n(a,[["M",b,d],["H",e.x2+10]],1)%2},c._removedFactory=function(a){return function(){b("raphael.log",null,"Raphaël: you are calling to method “"+a+"” of removed object",a)}};var Bb=c.pathBBox=function(a){var b=Ab(a);if(b.bbox)return d(b.bbox);if(!a)return{x:0,y:0,width:0,height:0,x2:0,y2:0};a=Kb(a);for(var c,e=0,f=0,g=[],h=[],i=0,j=a.length;j>i;i++)if(c=a[i],"M"==c[0])e=c[1],f=c[2],g.push(e),h.push(f);else{var k=Jb(e,f,c[1],c[2],c[3],c[4],c[5],c[6]);g=g[E](k.min.x,k.max.x),h=h[E](k.min.y,k.max.y),e=c[5],f=c[6]}var l=P[D](0,g),m=P[D](0,h),n=O[D](0,g),o=O[D](0,h),p=n-l,q=o-m,r={x:l,y:m,x2:n,y2:o,width:p,height:q,cx:l+p/2,cy:m+q/2};return b.bbox=d(r),r},Cb=function(a){var b=d(a);return b.toString=c._path2string,b},Db=c._pathToRelative=function(a){var b=Ab(a);if(b.rel)return Cb(b.rel);c.is(a,V)&&c.is(a&&a[0],V)||(a=c.parsePathString(a));var d=[],e=0,f=0,g=0,h=0,i=0;"M"==a[0][0]&&(e=a[0][1],f=a[0][2],g=e,h=f,i++,d.push(["M",e,f]));for(var j=i,k=a.length;k>j;j++){var l=d[j]=[],m=a[j];if(m[0]!=M.call(m[0]))switch(l[0]=M.call(m[0]),l[0]){case"a":l[1]=m[1],l[2]=m[2],l[3]=m[3],l[4]=m[4],l[5]=m[5],l[6]=+(m[6]-e).toFixed(3),l[7]=+(m[7]-f).toFixed(3);break;case"v":l[1]=+(m[1]-f).toFixed(3);break;case"m":g=m[1],h=m[2];default:for(var n=1,o=m.length;o>n;n++)l[n]=+(m[n]-(n%2?e:f)).toFixed(3)}else{l=d[j]=[],"m"==m[0]&&(g=m[1]+e,h=m[2]+f);for(var p=0,q=m.length;q>p;p++)d[j][p]=m[p]}var r=d[j].length;switch(d[j][0]){case"z":e=g,f=h;break;case"h":e+=+d[j][r-1];break;case"v":f+=+d[j][r-1];break;default:e+=+d[j][r-2],f+=+d[j][r-1]}}return d.toString=c._path2string,b.rel=Cb(d),d},Eb=c._pathToAbsolute=function(a){var b=Ab(a);if(b.abs)return Cb(b.abs);if(c.is(a,V)&&c.is(a&&a[0],V)||(a=c.parsePathString(a)),!a||!a.length)return[["M",0,0]];var d=[],e=0,f=0,g=0,i=0,j=0;"M"==a[0][0]&&(e=+a[0][1],f=+a[0][2],g=e,i=f,j++,d[0]=["M",e,f]);for(var k,l,m=3==a.length&&"M"==a[0][0]&&"R"==a[1][0].toUpperCase()&&"Z"==a[2][0].toUpperCase(),n=j,o=a.length;o>n;n++){if(d.push(k=[]),l=a[n],l[0]!=bb.call(l[0]))switch(k[0]=bb.call(l[0]),k[0]){case"A":k[1]=l[1],k[2]=l[2],k[3]=l[3],k[4]=l[4],k[5]=l[5],k[6]=+(l[6]+e),k[7]=+(l[7]+f);break;case"V":k[1]=+l[1]+f;break;case"H":k[1]=+l[1]+e;break;case"R":for(var p=[e,f][E](l.slice(1)),q=2,r=p.length;r>q;q++)p[q]=+p[q]+e,p[++q]=+p[q]+f;d.pop(),d=d[E](h(p,m));break;case"M":g=+l[1]+e,i=+l[2]+f;default:for(q=1,r=l.length;r>q;q++)k[q]=+l[q]+(q%2?e:f)}else if("R"==l[0])p=[e,f][E](l.slice(1)),d.pop(),d=d[E](h(p,m)),k=["R"][E](l.slice(-2));else for(var s=0,t=l.length;t>s;s++)k[s]=l[s];switch(k[0]){case"Z":e=g,f=i;break;case"H":e=k[1];break;case"V":f=k[1];break;case"M":g=k[k.length-2],i=k[k.length-1];default:e=k[k.length-2],f=k[k.length-1]}}return d.toString=c._path2string,b.abs=Cb(d),d},Fb=function(a,b,c,d){return[a,b,c,d,c,d]},Gb=function(a,b,c,d,e,f){var g=1/3,h=2/3;return[g*a+h*c,g*b+h*d,g*e+h*c,g*f+h*d,e,f]},Hb=function(a,b,c,d,e,g,h,i,j,k){var l,m=120*S/180,n=S/180*(+e||0),o=[],p=f(function(a,b,c){var d=a*N.cos(c)-b*N.sin(c),e=a*N.sin(c)+b*N.cos(c);return{x:d,y:e}});if(k)y=k[0],z=k[1],w=k[2],x=k[3];else{l=p(a,b,-n),a=l.x,b=l.y,l=p(i,j,-n),i=l.x,j=l.y;var q=(N.cos(S/180*e),N.sin(S/180*e),(a-i)/2),r=(b-j)/2,s=q*q/(c*c)+r*r/(d*d);s>1&&(s=N.sqrt(s),c=s*c,d=s*d);var t=c*c,u=d*d,v=(g==h?-1:1)*N.sqrt(Q((t*u-t*r*r-u*q*q)/(t*r*r+u*q*q))),w=v*c*r/d+(a+i)/2,x=v*-d*q/c+(b+j)/2,y=N.asin(((b-x)/d).toFixed(9)),z=N.asin(((j-x)/d).toFixed(9));y=w>a?S-y:y,z=w>i?S-z:z,0>y&&(y=2*S+y),0>z&&(z=2*S+z),h&&y>z&&(y-=2*S),!h&&z>y&&(z-=2*S)}var A=z-y;if(Q(A)>m){var B=z,C=i,D=j;z=y+m*(h&&z>y?1:-1),i=w+c*N.cos(z),j=x+d*N.sin(z),o=Hb(i,j,c,d,e,0,h,C,D,[z,B,w,x])}A=z-y;var F=N.cos(y),G=N.sin(y),H=N.cos(z),I=N.sin(z),K=N.tan(A/4),L=4/3*c*K,M=4/3*d*K,O=[a,b],P=[a+L*G,b-M*F],R=[i+L*I,j-M*H],T=[i,j];if(P[0]=2*O[0]-P[0],P[1]=2*O[1]-P[1],k)return[P,R,T][E](o);o=[P,R,T][E](o).join()[J](",");for(var U=[],V=0,W=o.length;W>V;V++)U[V]=V%2?p(o[V-1],o[V],n).y:p(o[V],o[V+1],n).x;return U},Ib=function(a,b,c,d,e,f,g,h,i){var j=1-i;return{x:R(j,3)*a+3*R(j,2)*i*c+3*j*i*i*e+R(i,3)*g,y:R(j,3)*b+3*R(j,2)*i*d+3*j*i*i*f+R(i,3)*h}},Jb=f(function(a,b,c,d,e,f,g,h){var i,j=e-2*c+a-(g-2*e+c),k=2*(c-a)-2*(e-c),l=a-c,m=(-k+N.sqrt(k*k-4*j*l))/2/j,n=(-k-N.sqrt(k*k-4*j*l))/2/j,o=[b,h],p=[a,g];return Q(m)>"1e12"&&(m=.5),Q(n)>"1e12"&&(n=.5),m>0&&1>m&&(i=Ib(a,b,c,d,e,f,g,h,m),p.push(i.x),o.push(i.y)),n>0&&1>n&&(i=Ib(a,b,c,d,e,f,g,h,n),p.push(i.x),o.push(i.y)),j=f-2*d+b-(h-2*f+d),k=2*(d-b)-2*(f-d),l=b-d,m=(-k+N.sqrt(k*k-4*j*l))/2/j,n=(-k-N.sqrt(k*k-4*j*l))/2/j,Q(m)>"1e12"&&(m=.5),Q(n)>"1e12"&&(n=.5),m>0&&1>m&&(i=Ib(a,b,c,d,e,f,g,h,m),p.push(i.x),o.push(i.y)),n>0&&1>n&&(i=Ib(a,b,c,d,e,f,g,h,n),p.push(i.x),o.push(i.y)),{min:{x:P[D](0,p),y:P[D](0,o)},max:{x:O[D](0,p),y:O[D](0,o)}}}),Kb=c._path2curve=f(function(a,b){var c=!b&&Ab(a);if(!b&&c.curve)return Cb(c.curve);for(var d=Eb(a),e=b&&Eb(b),f={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},g={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},h=(function(a,b,c){var d,e;if(!a)return["C",b.x,b.y,b.x,b.y,b.x,b.y];switch(!(a[0]in{T:1,Q:1})&&(b.qx=b.qy=null),a[0]){case"M":b.X=a[1],b.Y=a[2];break;case"A":a=["C"][E](Hb[D](0,[b.x,b.y][E](a.slice(1))));break;case"S":"C"==c||"S"==c?(d=2*b.x-b.bx,e=2*b.y-b.by):(d=b.x,e=b.y),a=["C",d,e][E](a.slice(1));break;case"T":"Q"==c||"T"==c?(b.qx=2*b.x-b.qx,b.qy=2*b.y-b.qy):(b.qx=b.x,b.qy=b.y),a=["C"][E](Gb(b.x,b.y,b.qx,b.qy,a[1],a[2]));break;case"Q":b.qx=a[1],b.qy=a[2],a=["C"][E](Gb(b.x,b.y,a[1],a[2],a[3],a[4]));break;case"L":a=["C"][E](Fb(b.x,b.y,a[1],a[2]));break;case"H":a=["C"][E](Fb(b.x,b.y,a[1],b.y));break;case"V":a=["C"][E](Fb(b.x,b.y,b.x,a[1]));break;case"Z":a=["C"][E](Fb(b.x,b.y,b.X,b.Y))}return a}),i=function(a,b){if(a[b].length>7){a[b].shift();for(var c=a[b];c.length;)a.splice(b++,0,["C"][E](c.splice(0,6)));a.splice(b,1),l=O(d.length,e&&e.length||0)}},j=function(a,b,c,f,g){a&&b&&"M"==a[g][0]&&"M"!=b[g][0]&&(b.splice(g,0,["M",f.x,f.y]),c.bx=0,c.by=0,c.x=a[g][1],c.y=a[g][2],l=O(d.length,e&&e.length||0))},k=0,l=O(d.length,e&&e.length||0);l>k;k++){d[k]=h(d[k],f),i(d,k),e&&(e[k]=h(e[k],g)),e&&i(e,k),j(d,e,f,g,k),j(e,d,g,f,k);var m=d[k],n=e&&e[k],o=m.length,p=e&&n.length;f.x=m[o-2],f.y=m[o-1],f.bx=_(m[o-4])||f.x,f.by=_(m[o-3])||f.y,g.bx=e&&(_(n[p-4])||g.x),g.by=e&&(_(n[p-3])||g.y),g.x=e&&n[p-2],g.y=e&&n[p-1]}return e||(c.curve=Cb(d)),e?[d,e]:d},null,Cb),Lb=(c._parseDots=f(function(a){for(var b=[],d=0,e=a.length;e>d;d++){var f={},g=a[d].match(/^([^:]*):?([\d\.]*)/);if(f.color=c.getRGB(g[1]),f.color.error)return null;f.color=f.color.hex,g[2]&&(f.offset=g[2]+"%"),b.push(f)}for(d=1,e=b.length-1;e>d;d++)if(!b[d].offset){for(var h=_(b[d-1].offset||0),i=0,j=d+1;e>j;j++)if(b[j].offset){i=b[j].offset;break}i||(i=100,j=e),i=_(i);for(var k=(i-h)/(j-d+1);j>d;d++)h+=k,b[d].offset=h+"%"}return b}),c._tear=function(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)}),Mb=(c._tofront=function(a,b){b.top!==a&&(Lb(a,b),a.next=null,a.prev=b.top,b.top.next=a,b.top=a)},c._toback=function(a,b){b.bottom!==a&&(Lb(a,b),a.next=b.bottom,a.prev=null,b.bottom.prev=a,b.bottom=a)},c._insertafter=function(a,b,c){Lb(a,c),b==c.top&&(c.top=a),b.next&&(b.next.prev=a),a.next=b.next,a.prev=b,b.next=a},c._insertbefore=function(a,b,c){Lb(a,c),b==c.bottom&&(c.bottom=a),b.prev&&(b.prev.next=a),a.prev=b.prev,b.prev=a,a.next=b},c.toMatrix=function(a,b){var c=Bb(a),d={_:{transform:G},getBBox:function(){return c}};return Nb(d,b),d.matrix}),Nb=(c.transformPath=function(a,b){return rb(a,Mb(a,b))},c._extractTransform=function(a,b){if(null==b)return a._.transform;b=I(b).replace(/\.{3}|\u2026/g,a._.transform||G);var d=c.parseTransformString(b),e=0,f=0,g=0,h=1,i=1,j=a._,k=new o;if(j.transform=d||[],d)for(var l=0,m=d.length;m>l;l++){var n,p,q,r,s,t=d[l],u=t.length,v=I(t[0]).toLowerCase(),w=t[0]!=v,x=w?k.invert():0;"t"==v&&3==u?w?(n=x.x(0,0),p=x.y(0,0),q=x.x(t[1],t[2]),r=x.y(t[1],t[2]),k.translate(q-n,r-p)):k.translate(t[1],t[2]):"r"==v?2==u?(s=s||a.getBBox(1),k.rotate(t[1],s.x+s.width/2,s.y+s.height/2),e+=t[1]):4==u&&(w?(q=x.x(t[2],t[3]),r=x.y(t[2],t[3]),k.rotate(t[1],q,r)):k.rotate(t[1],t[2],t[3]),e+=t[1]):"s"==v?2==u||3==u?(s=s||a.getBBox(1),k.scale(t[1],t[u-1],s.x+s.width/2,s.y+s.height/2),h*=t[1],i*=t[u-1]):5==u&&(w?(q=x.x(t[3],t[4]),r=x.y(t[3],t[4]),k.scale(t[1],t[2],q,r)):k.scale(t[1],t[2],t[3],t[4]),h*=t[1],i*=t[2]):"m"==v&&7==u&&k.add(t[1],t[2],t[3],t[4],t[5],t[6]),j.dirtyT=1,a.matrix=k}a.matrix=k,j.sx=h,j.sy=i,j.deg=e,j.dx=f=k.e,j.dy=g=k.f,1==h&&1==i&&!e&&j.bbox?(j.bbox.x+=+f,j.bbox.y+=+g):j.dirtyT=1}),Ob=function(a){var b=a[0];switch(b.toLowerCase()){case"t":return[b,0,0];case"m":return[b,1,0,0,1,0,0];case"r":return 4==a.length?[b,0,a[2],a[3]]:[b,0];case"s":return 5==a.length?[b,1,1,a[3],a[4]]:3==a.length?[b,1,1]:[b,1]}},Pb=c._equaliseTransform=function(a,b){b=I(b).replace(/\.{3}|\u2026/g,a),a=c.parseTransformString(a)||[],b=c.parseTransformString(b)||[];for(var d,e,f,g,h=O(a.length,b.length),i=[],j=[],k=0;h>k;k++){if(f=a[k]||Ob(b[k]),g=b[k]||Ob(f),f[0]!=g[0]||"r"==f[0].toLowerCase()&&(f[2]!=g[2]||f[3]!=g[3])||"s"==f[0].toLowerCase()&&(f[3]!=g[3]||f[4]!=g[4]))return;for(i[k]=[],j[k]=[],d=0,e=O(f.length,g.length);e>d;d++)d in f&&(i[k][d]=f[d]),d in g&&(j[k][d]=g[d])
10
+ }return{from:i,to:j}};c._getContainer=function(a,b,d,e){var f;return f=null!=e||c.is(a,"object")?a:A.doc.getElementById(a),null!=f?f.tagName?null==b?{container:f,width:f.style.pixelWidth||f.offsetWidth,height:f.style.pixelHeight||f.offsetHeight}:{container:f,width:b,height:d}:{container:1,x:a,y:b,width:d,height:e}:void 0},c.pathToRelative=Db,c._engine={},c.path2curve=Kb,c.matrix=function(a,b,c,d,e,f){return new o(a,b,c,d,e,f)},function(a){function b(a){return a[0]*a[0]+a[1]*a[1]}function d(a){var c=N.sqrt(b(a));a[0]&&(a[0]/=c),a[1]&&(a[1]/=c)}a.add=function(a,b,c,d,e,f){var g,h,i,j,k=[[],[],[]],l=[[this.a,this.c,this.e],[this.b,this.d,this.f],[0,0,1]],m=[[a,c,e],[b,d,f],[0,0,1]];for(a&&a instanceof o&&(m=[[a.a,a.c,a.e],[a.b,a.d,a.f],[0,0,1]]),g=0;3>g;g++)for(h=0;3>h;h++){for(j=0,i=0;3>i;i++)j+=l[g][i]*m[i][h];k[g][h]=j}this.a=k[0][0],this.b=k[1][0],this.c=k[0][1],this.d=k[1][1],this.e=k[0][2],this.f=k[1][2]},a.invert=function(){var a=this,b=a.a*a.d-a.b*a.c;return new o(a.d/b,-a.b/b,-a.c/b,a.a/b,(a.c*a.f-a.d*a.e)/b,(a.b*a.e-a.a*a.f)/b)},a.clone=function(){return new o(this.a,this.b,this.c,this.d,this.e,this.f)},a.translate=function(a,b){this.add(1,0,0,1,a,b)},a.scale=function(a,b,c,d){null==b&&(b=a),(c||d)&&this.add(1,0,0,1,c,d),this.add(a,0,0,b,0,0),(c||d)&&this.add(1,0,0,1,-c,-d)},a.rotate=function(a,b,d){a=c.rad(a),b=b||0,d=d||0;var e=+N.cos(a).toFixed(9),f=+N.sin(a).toFixed(9);this.add(e,f,-f,e,b,d),this.add(1,0,0,1,-b,-d)},a.x=function(a,b){return a*this.a+b*this.c+this.e},a.y=function(a,b){return a*this.b+b*this.d+this.f},a.get=function(a){return+this[I.fromCharCode(97+a)].toFixed(4)},a.toString=function(){return c.svg?"matrix("+[this.get(0),this.get(1),this.get(2),this.get(3),this.get(4),this.get(5)].join()+")":[this.get(0),this.get(2),this.get(1),this.get(3),0,0].join()},a.toFilter=function(){return"progid:DXImageTransform.Microsoft.Matrix(M11="+this.get(0)+", M12="+this.get(2)+", M21="+this.get(1)+", M22="+this.get(3)+", Dx="+this.get(4)+", Dy="+this.get(5)+", sizingmethod='auto expand')"},a.offset=function(){return[this.e.toFixed(4),this.f.toFixed(4)]},a.split=function(){var a={};a.dx=this.e,a.dy=this.f;var e=[[this.a,this.c],[this.b,this.d]];a.scalex=N.sqrt(b(e[0])),d(e[0]),a.shear=e[0][0]*e[1][0]+e[0][1]*e[1][1],e[1]=[e[1][0]-e[0][0]*a.shear,e[1][1]-e[0][1]*a.shear],a.scaley=N.sqrt(b(e[1])),d(e[1]),a.shear/=a.scaley;var f=-e[0][1],g=e[1][1];return 0>g?(a.rotate=c.deg(N.acos(g)),0>f&&(a.rotate=360-a.rotate)):a.rotate=c.deg(N.asin(f)),a.isSimple=!(+a.shear.toFixed(9)||a.scalex.toFixed(9)!=a.scaley.toFixed(9)&&a.rotate),a.isSuperSimple=!+a.shear.toFixed(9)&&a.scalex.toFixed(9)==a.scaley.toFixed(9)&&!a.rotate,a.noRotation=!+a.shear.toFixed(9)&&!a.rotate,a},a.toTransformString=function(a){var b=a||this[J]();return b.isSimple?(b.scalex=+b.scalex.toFixed(4),b.scaley=+b.scaley.toFixed(4),b.rotate=+b.rotate.toFixed(4),(b.dx||b.dy?"t"+[b.dx,b.dy]:G)+(1!=b.scalex||1!=b.scaley?"s"+[b.scalex,b.scaley,0,0]:G)+(b.rotate?"r"+[b.rotate,0,0]:G)):"m"+[this.get(0),this.get(1),this.get(2),this.get(3),this.get(4),this.get(5)]}}(o.prototype);var Qb=navigator.userAgent.match(/Version\/(.*?)\s/)||navigator.userAgent.match(/Chrome\/(\d+)/);v.safari="Apple Computer, Inc."==navigator.vendor&&(Qb&&Qb[1]<4||"iP"==navigator.platform.slice(0,2))||"Google Inc."==navigator.vendor&&Qb&&Qb[1]<8?function(){var a=this.rect(-99,-99,this.width+99,this.height+99).attr({stroke:"none"});setTimeout(function(){a.remove()})}:mb;for(var Rb=function(){this.returnValue=!1},Sb=function(){return this.originalEvent.preventDefault()},Tb=function(){this.cancelBubble=!0},Ub=function(){return this.originalEvent.stopPropagation()},Vb=function(a){var b=A.doc.documentElement.scrollTop||A.doc.body.scrollTop,c=A.doc.documentElement.scrollLeft||A.doc.body.scrollLeft;return{x:a.clientX+c,y:a.clientY+b}},Wb=function(){return A.doc.addEventListener?function(a,b,c,d){var e=function(a){var b=Vb(a);return c.call(d,a,b.x,b.y)};if(a.addEventListener(b,e,!1),F&&L[b]){var f=function(b){for(var e=Vb(b),f=b,g=0,h=b.targetTouches&&b.targetTouches.length;h>g;g++)if(b.targetTouches[g].target==a){b=b.targetTouches[g],b.originalEvent=f,b.preventDefault=Sb,b.stopPropagation=Ub;break}return c.call(d,b,e.x,e.y)};a.addEventListener(L[b],f,!1)}return function(){return a.removeEventListener(b,e,!1),F&&L[b]&&a.removeEventListener(L[b],e,!1),!0}}:A.doc.attachEvent?function(a,b,c,d){var e=function(a){a=a||A.win.event;var b=A.doc.documentElement.scrollTop||A.doc.body.scrollTop,e=A.doc.documentElement.scrollLeft||A.doc.body.scrollLeft,f=a.clientX+e,g=a.clientY+b;return a.preventDefault=a.preventDefault||Rb,a.stopPropagation=a.stopPropagation||Tb,c.call(d,a,f,g)};a.attachEvent("on"+b,e);var f=function(){return a.detachEvent("on"+b,e),!0};return f}:void 0}(),Xb=[],Yb=function(a){for(var c,d=a.clientX,e=a.clientY,f=A.doc.documentElement.scrollTop||A.doc.body.scrollTop,g=A.doc.documentElement.scrollLeft||A.doc.body.scrollLeft,h=Xb.length;h--;){if(c=Xb[h],F&&a.touches){for(var i,j=a.touches.length;j--;)if(i=a.touches[j],i.identifier==c.el._drag.id){d=i.clientX,e=i.clientY,(a.originalEvent?a.originalEvent:a).preventDefault();break}}else a.preventDefault();var k,l=c.el.node,m=l.nextSibling,n=l.parentNode,o=l.style.display;A.win.opera&&n.removeChild(l),l.style.display="none",k=c.el.paper.getElementByPoint(d,e),l.style.display=o,A.win.opera&&(m?n.insertBefore(l,m):n.appendChild(l)),k&&b("raphael.drag.over."+c.el.id,c.el,k),d+=g,e+=f,b("raphael.drag.move."+c.el.id,c.move_scope||c.el,d-c.el._drag.x,e-c.el._drag.y,d,e,a)}},Zb=function(a){c.unmousemove(Yb).unmouseup(Zb);for(var d,e=Xb.length;e--;)d=Xb[e],d.el._drag={},b("raphael.drag.end."+d.el.id,d.end_scope||d.start_scope||d.move_scope||d.el,a);Xb=[]},$b=c.el={},_b=K.length;_b--;)!function(a){c[a]=$b[a]=function(b,d){return c.is(b,"function")&&(this.events=this.events||[],this.events.push({name:a,f:b,unbind:Wb(this.shape||this.node||A.doc,a,b,d||this)})),this},c["un"+a]=$b["un"+a]=function(b){for(var d=this.events||[],e=d.length;e--;)d[e].name!=a||!c.is(b,"undefined")&&d[e].f!=b||(d[e].unbind(),d.splice(e,1),!d.length&&delete this.events);return this}}(K[_b]);$b.data=function(a,d){var e=kb[this.id]=kb[this.id]||{};if(0==arguments.length)return e;if(1==arguments.length){if(c.is(a,"object")){for(var f in a)a[z](f)&&this.data(f,a[f]);return this}return b("raphael.data.get."+this.id,this,e[a],a),e[a]}return e[a]=d,b("raphael.data.set."+this.id,this,d,a),this},$b.removeData=function(a){return null==a?kb[this.id]={}:kb[this.id]&&delete kb[this.id][a],this},$b.getData=function(){return d(kb[this.id]||{})},$b.hover=function(a,b,c,d){return this.mouseover(a,c).mouseout(b,d||c)},$b.unhover=function(a,b){return this.unmouseover(a).unmouseout(b)};var ac=[];$b.drag=function(a,d,e,f,g,h){function i(i){(i.originalEvent||i).preventDefault();var j=i.clientX,k=i.clientY,l=A.doc.documentElement.scrollTop||A.doc.body.scrollTop,m=A.doc.documentElement.scrollLeft||A.doc.body.scrollLeft;if(this._drag.id=i.identifier,F&&i.touches)for(var n,o=i.touches.length;o--;)if(n=i.touches[o],this._drag.id=n.identifier,n.identifier==this._drag.id){j=n.clientX,k=n.clientY;break}this._drag.x=j+m,this._drag.y=k+l,!Xb.length&&c.mousemove(Yb).mouseup(Zb),Xb.push({el:this,move_scope:f,start_scope:g,end_scope:h}),d&&b.on("raphael.drag.start."+this.id,d),a&&b.on("raphael.drag.move."+this.id,a),e&&b.on("raphael.drag.end."+this.id,e),b("raphael.drag.start."+this.id,g||f||this,i.clientX+m,i.clientY+l,i)}return this._drag={},ac.push({el:this,start:i}),this.mousedown(i),this},$b.onDragOver=function(a){a?b.on("raphael.drag.over."+this.id,a):b.unbind("raphael.drag.over."+this.id)},$b.undrag=function(){for(var a=ac.length;a--;)ac[a].el==this&&(this.unmousedown(ac[a].start),ac.splice(a,1),b.unbind("raphael.drag.*."+this.id));!ac.length&&c.unmousemove(Yb).unmouseup(Zb),Xb=[]},v.circle=function(a,b,d){var e=c._engine.circle(this,a||0,b||0,d||0);return this.__set__&&this.__set__.push(e),e},v.rect=function(a,b,d,e,f){var g=c._engine.rect(this,a||0,b||0,d||0,e||0,f||0);return this.__set__&&this.__set__.push(g),g},v.ellipse=function(a,b,d,e){var f=c._engine.ellipse(this,a||0,b||0,d||0,e||0);return this.__set__&&this.__set__.push(f),f},v.path=function(a){a&&!c.is(a,U)&&!c.is(a[0],V)&&(a+=G);var b=c._engine.path(c.format[D](c,arguments),this);return this.__set__&&this.__set__.push(b),b},v.image=function(a,b,d,e,f){var g=c._engine.image(this,a||"about:blank",b||0,d||0,e||0,f||0);return this.__set__&&this.__set__.push(g),g},v.text=function(a,b,d){var e=c._engine.text(this,a||0,b||0,I(d));return this.__set__&&this.__set__.push(e),e},v.set=function(a){!c.is(a,"array")&&(a=Array.prototype.splice.call(arguments,0,arguments.length));var b=new mc(a);return this.__set__&&this.__set__.push(b),b.paper=this,b.type="set",b},v.setStart=function(a){this.__set__=a||this.set()},v.setFinish=function(){var a=this.__set__;return delete this.__set__,a},v.setSize=function(a,b){return c._engine.setSize.call(this,a,b)},v.setViewBox=function(a,b,d,e,f){return c._engine.setViewBox.call(this,a,b,d,e,f)},v.top=v.bottom=null,v.raphael=c;var bc=function(a){var b=a.getBoundingClientRect(),c=a.ownerDocument,d=c.body,e=c.documentElement,f=e.clientTop||d.clientTop||0,g=e.clientLeft||d.clientLeft||0,h=b.top+(A.win.pageYOffset||e.scrollTop||d.scrollTop)-f,i=b.left+(A.win.pageXOffset||e.scrollLeft||d.scrollLeft)-g;return{y:h,x:i}};v.getElementByPoint=function(a,b){var c=this,d=c.canvas,e=A.doc.elementFromPoint(a,b);if(A.win.opera&&"svg"==e.tagName){var f=bc(d),g=d.createSVGRect();g.x=a-f.x,g.y=b-f.y,g.width=g.height=1;var h=d.getIntersectionList(g,null);h.length&&(e=h[h.length-1])}if(!e)return null;for(;e.parentNode&&e!=d.parentNode&&!e.raphael;)e=e.parentNode;return e==c.canvas.parentNode&&(e=d),e=e&&e.raphael?c.getById(e.raphaelid):null},v.getElementsByBBox=function(a){var b=this.set();return this.forEach(function(d){c.isBBoxIntersect(d.getBBox(),a)&&b.push(d)}),b},v.getById=function(a){for(var b=this.bottom;b;){if(b.id==a)return b;b=b.next}return null},v.forEach=function(a,b){for(var c=this.bottom;c;){if(a.call(b,c)===!1)return this;c=c.next}return this},v.getElementsByPoint=function(a,b){var c=this.set();return this.forEach(function(d){d.isPointInside(a,b)&&c.push(d)}),c},$b.isPointInside=function(a,b){var d=this.realPath=qb[this.type](this);return this.attr("transform")&&this.attr("transform").length&&(d=c.transformPath(d,this.attr("transform"))),c.isPointInsidePath(d,a,b)},$b.getBBox=function(a){if(this.removed)return{};var b=this._;return a?((b.dirty||!b.bboxwt)&&(this.realPath=qb[this.type](this),b.bboxwt=Bb(this.realPath),b.bboxwt.toString=p,b.dirty=0),b.bboxwt):((b.dirty||b.dirtyT||!b.bbox)&&((b.dirty||!this.realPath)&&(b.bboxwt=0,this.realPath=qb[this.type](this)),b.bbox=Bb(rb(this.realPath,this.matrix)),b.bbox.toString=p,b.dirty=b.dirtyT=0),b.bbox)},$b.clone=function(){if(this.removed)return null;var a=this.paper[this.type]().attr(this.attr());return this.__set__&&this.__set__.push(a),a},$b.glow=function(a){if("text"==this.type)return null;a=a||{};var b={width:(a.width||10)+(+this.attr("stroke-width")||1),fill:a.fill||!1,opacity:a.opacity||.5,offsetx:a.offsetx||0,offsety:a.offsety||0,color:a.color||"#000"},c=b.width/2,d=this.paper,e=d.set(),f=this.realPath||qb[this.type](this);f=this.matrix?rb(f,this.matrix):f;for(var g=1;c+1>g;g++)e.push(d.path(f).attr({stroke:b.color,fill:b.fill?b.color:"none","stroke-linejoin":"round","stroke-linecap":"round","stroke-width":+(b.width/c*g).toFixed(3),opacity:+(b.opacity/c).toFixed(3)}));return e.insertBefore(this).translate(b.offsetx,b.offsety)};var cc=function(a,b,d,e,f,g,h,i,l){return null==l?j(a,b,d,e,f,g,h,i):c.findDotsAtSegment(a,b,d,e,f,g,h,i,k(a,b,d,e,f,g,h,i,l))},dc=function(a,b){return function(d,e,f){d=Kb(d);for(var g,h,i,j,k,l="",m={},n=0,o=0,p=d.length;p>o;o++){if(i=d[o],"M"==i[0])g=+i[1],h=+i[2];else{if(j=cc(g,h,i[1],i[2],i[3],i[4],i[5],i[6]),n+j>e){if(b&&!m.start){if(k=cc(g,h,i[1],i[2],i[3],i[4],i[5],i[6],e-n),l+=["C"+k.start.x,k.start.y,k.m.x,k.m.y,k.x,k.y],f)return l;m.start=l,l=["M"+k.x,k.y+"C"+k.n.x,k.n.y,k.end.x,k.end.y,i[5],i[6]].join(),n+=j,g=+i[5],h=+i[6];continue}if(!a&&!b)return k=cc(g,h,i[1],i[2],i[3],i[4],i[5],i[6],e-n),{x:k.x,y:k.y,alpha:k.alpha}}n+=j,g=+i[5],h=+i[6]}l+=i.shift()+i}return m.end=l,k=a?n:b?m:c.findDotsAtSegment(g,h,i[0],i[1],i[2],i[3],i[4],i[5],1),k.alpha&&(k={x:k.x,y:k.y,alpha:k.alpha}),k}},ec=dc(1),fc=dc(),gc=dc(0,1);c.getTotalLength=ec,c.getPointAtLength=fc,c.getSubpath=function(a,b,c){if(this.getTotalLength(a)-c<1e-6)return gc(a,b).end;var d=gc(a,c,1);return b?gc(d,b).end:d},$b.getTotalLength=function(){var a=this.getPath();if(a)return this.node.getTotalLength?this.node.getTotalLength():ec(a)},$b.getPointAtLength=function(a){var b=this.getPath();if(b)return fc(b,a)},$b.getPath=function(){var a,b=c._getPath[this.type];if("text"!=this.type&&"set"!=this.type)return b&&(a=b(this)),a},$b.getSubpath=function(a,b){var d=this.getPath();if(d)return c.getSubpath(d,a,b)};var hc=c.easing_formulas={linear:function(a){return a},"<":function(a){return R(a,1.7)},">":function(a){return R(a,.48)},"<>":function(a){var b=.48-a/1.04,c=N.sqrt(.1734+b*b),d=c-b,e=R(Q(d),1/3)*(0>d?-1:1),f=-c-b,g=R(Q(f),1/3)*(0>f?-1:1),h=e+g+.5;return 3*(1-h)*h*h+h*h*h},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){return a==!!a?a:R(2,-10*a)*N.sin((a-.075)*2*S/.3)+1},bounce:function(a){var b,c=7.5625,d=2.75;return 1/d>a?b=c*a*a:2/d>a?(a-=1.5/d,b=c*a*a+.75):2.5/d>a?(a-=2.25/d,b=c*a*a+.9375):(a-=2.625/d,b=c*a*a+.984375),b}};hc.easeIn=hc["ease-in"]=hc["<"],hc.easeOut=hc["ease-out"]=hc[">"],hc.easeInOut=hc["ease-in-out"]=hc["<>"],hc["back-in"]=hc.backIn,hc["back-out"]=hc.backOut;var ic=[],jc=a.requestAnimationFrame||a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||a.oRequestAnimationFrame||a.msRequestAnimationFrame||function(a){setTimeout(a,16)},kc=function(){for(var a=+new Date,d=0;d<ic.length;d++){var e=ic[d];if(!e.el.removed&&!e.paused){var f,g,h=a-e.start,i=e.ms,j=e.easing,k=e.from,l=e.diff,m=e.to,n=(e.t,e.el),o={},p={};if(e.initstatus?(h=(e.initstatus*e.anim.top-e.prev)/(e.percent-e.prev)*i,e.status=e.initstatus,delete e.initstatus,e.stop&&ic.splice(d--,1)):e.status=(e.prev+(e.percent-e.prev)*(h/i))/e.anim.top,!(0>h))if(i>h){var q=j(h/i);for(var r in k)if(k[z](r)){switch(db[r]){case T:f=+k[r]+q*i*l[r];break;case"colour":f="rgb("+[lc($(k[r].r+q*i*l[r].r)),lc($(k[r].g+q*i*l[r].g)),lc($(k[r].b+q*i*l[r].b))].join(",")+")";break;case"path":f=[];for(var t=0,u=k[r].length;u>t;t++){f[t]=[k[r][t][0]];for(var v=1,w=k[r][t].length;w>v;v++)f[t][v]=+k[r][t][v]+q*i*l[r][t][v];f[t]=f[t].join(H)}f=f.join(H);break;case"transform":if(l[r].real)for(f=[],t=0,u=k[r].length;u>t;t++)for(f[t]=[k[r][t][0]],v=1,w=k[r][t].length;w>v;v++)f[t][v]=k[r][t][v]+q*i*l[r][t][v];else{var x=function(a){return+k[r][a]+q*i*l[r][a]};f=[["m",x(0),x(1),x(2),x(3),x(4),x(5)]]}break;case"csv":if("clip-rect"==r)for(f=[],t=4;t--;)f[t]=+k[r][t]+q*i*l[r][t];break;default:var y=[][E](k[r]);for(f=[],t=n.paper.customAttributes[r].length;t--;)f[t]=+y[t]+q*i*l[r][t]}o[r]=f}n.attr(o),function(a,c,d){setTimeout(function(){b("raphael.anim.frame."+a,c,d)})}(n.id,n,e.anim)}else{if(function(a,d,e){setTimeout(function(){b("raphael.anim.frame."+d.id,d,e),b("raphael.anim.finish."+d.id,d,e),c.is(a,"function")&&a.call(d)})}(e.callback,n,e.anim),n.attr(m),ic.splice(d--,1),e.repeat>1&&!e.next){for(g in m)m[z](g)&&(p[g]=e.totalOrigin[g]);e.el.attr(p),s(e.anim,e.el,e.anim.percents[0],null,e.totalOrigin,e.repeat-1)}e.next&&!e.stop&&s(e.anim,e.el,e.next,null,e.totalOrigin,e.repeat)}}}c.svg&&n&&n.paper&&n.paper.safari(),ic.length&&jc(kc)},lc=function(a){return a>255?255:0>a?0:a};$b.animateWith=function(a,b,d,e,f,g){var h=this;if(h.removed)return g&&g.call(h),h;var i=d instanceof r?d:c.animation(d,e,f,g);s(i,h,i.percents[0],null,h.attr());for(var j=0,k=ic.length;k>j;j++)if(ic[j].anim==b&&ic[j].el==a){ic[k-1].start=ic[j].start;break}return h},$b.onAnimation=function(a){return a?b.on("raphael.anim.frame."+this.id,a):b.unbind("raphael.anim.frame."+this.id),this},r.prototype.delay=function(a){var b=new r(this.anim,this.ms);return b.times=this.times,b.del=+a||0,b},r.prototype.repeat=function(a){var b=new r(this.anim,this.ms);return b.del=this.del,b.times=N.floor(O(a,0))||1,b},c.animation=function(a,b,d,e){if(a instanceof r)return a;(c.is(d,"function")||!d)&&(e=e||d||null,d=null),a=Object(a),b=+b||0;var f,g,h={};for(g in a)a[z](g)&&_(g)!=g&&_(g)+"%"!=g&&(f=!0,h[g]=a[g]);return f?(d&&(h.easing=d),e&&(h.callback=e),new r({100:h},b)):new r(a,b)},$b.animate=function(a,b,d,e){var f=this;if(f.removed)return e&&e.call(f),f;var g=a instanceof r?a:c.animation(a,b,d,e);return s(g,f,g.percents[0],null,f.attr()),f},$b.setTime=function(a,b){return a&&null!=b&&this.status(a,P(b,a.ms)/a.ms),this},$b.status=function(a,b){var c,d,e=[],f=0;if(null!=b)return s(a,this,-1,P(b,1)),this;for(c=ic.length;c>f;f++)if(d=ic[f],d.el.id==this.id&&(!a||d.anim==a)){if(a)return d.status;e.push({anim:d.anim,status:d.status})}return a?0:e},$b.pause=function(a){for(var c=0;c<ic.length;c++)ic[c].el.id!=this.id||a&&ic[c].anim!=a||b("raphael.anim.pause."+this.id,this,ic[c].anim)!==!1&&(ic[c].paused=!0);return this},$b.resume=function(a){for(var c=0;c<ic.length;c++)if(ic[c].el.id==this.id&&(!a||ic[c].anim==a)){var d=ic[c];b("raphael.anim.resume."+this.id,this,d.anim)!==!1&&(delete d.paused,this.status(d.anim,d.status))}return this},$b.stop=function(a){for(var c=0;c<ic.length;c++)ic[c].el.id!=this.id||a&&ic[c].anim!=a||b("raphael.anim.stop."+this.id,this,ic[c].anim)!==!1&&ic.splice(c--,1);return this},b.on("raphael.remove",t),b.on("raphael.clear",t),$b.toString=function(){return"Raphaël’s object"};var mc=function(a){if(this.items=[],this.length=0,this.type="set",a)for(var b=0,c=a.length;c>b;b++)!a[b]||a[b].constructor!=$b.constructor&&a[b].constructor!=mc||(this[this.items.length]=this.items[this.items.length]=a[b],this.length++)},nc=mc.prototype;nc.push=function(){for(var a,b,c=0,d=arguments.length;d>c;c++)a=arguments[c],!a||a.constructor!=$b.constructor&&a.constructor!=mc||(b=this.items.length,this[b]=this.items[b]=a,this.length++);return this},nc.pop=function(){return this.length&&delete this[this.length--],this.items.pop()},nc.forEach=function(a,b){for(var c=0,d=this.items.length;d>c;c++)if(a.call(b,this.items[c],c)===!1)return this;return this};for(var oc in $b)$b[z](oc)&&(nc[oc]=function(a){return function(){var b=arguments;return this.forEach(function(c){c[a][D](c,b)})}}(oc));return nc.attr=function(a,b){if(a&&c.is(a,V)&&c.is(a[0],"object"))for(var d=0,e=a.length;e>d;d++)this.items[d].attr(a[d]);else for(var f=0,g=this.items.length;g>f;f++)this.items[f].attr(a,b);return this},nc.clear=function(){for(;this.length;)this.pop()},nc.splice=function(a,b){a=0>a?O(this.length+a,0):a,b=O(0,P(this.length-a,b));var c,d=[],e=[],f=[];for(c=2;c<arguments.length;c++)f.push(arguments[c]);for(c=0;b>c;c++)e.push(this[a+c]);for(;c<this.length-a;c++)d.push(this[a+c]);var g=f.length;for(c=0;c<g+d.length;c++)this.items[a+c]=this[a+c]=g>c?f[c]:d[c-g];for(c=this.items.length=this.length-=b-g;this[c];)delete this[c++];return new mc(e)},nc.exclude=function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]==a)return this.splice(b,1),!0},nc.animate=function(a,b,d,e){(c.is(d,"function")||!d)&&(e=d||null);var f,g,h=this.items.length,i=h,j=this;if(!h)return this;e&&(g=function(){!--h&&e.call(j)}),d=c.is(d,U)?d:g;var k=c.animation(a,b,d,g);for(f=this.items[--i].animate(k);i--;)this.items[i]&&!this.items[i].removed&&this.items[i].animateWith(f,k,k),this.items[i]&&!this.items[i].removed||h--;return this},nc.insertAfter=function(a){for(var b=this.items.length;b--;)this.items[b].insertAfter(a);return this},nc.getBBox=function(){for(var a=[],b=[],c=[],d=[],e=this.items.length;e--;)if(!this.items[e].removed){var f=this.items[e].getBBox();a.push(f.x),b.push(f.y),c.push(f.x+f.width),d.push(f.y+f.height)}return a=P[D](0,a),b=P[D](0,b),c=O[D](0,c),d=O[D](0,d),{x:a,y:b,x2:c,y2:d,width:c-a,height:d-b}},nc.clone=function(a){a=this.paper.set();for(var b=0,c=this.items.length;c>b;b++)a.push(this.items[b].clone());return a},nc.toString=function(){return"Raphaël‘s set"},nc.glow=function(a){var b=this.paper.set();return this.forEach(function(c){var d=c.glow(a);null!=d&&d.forEach(function(a){b.push(a)})}),b},nc.isPointInside=function(a,b){var c=!1;return this.forEach(function(d){return d.isPointInside(a,b)?(console.log("runned"),c=!0,!1):void 0}),c},c.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)a.face[z](d)&&(b.face[d]=a.face[d]);if(this.fonts[c]?this.fonts[c].push(b):this.fonts[c]=[b],!a.svg){b.face["units-per-em"]=ab(a.face["units-per-em"],10);for(var e in a.glyphs)if(a.glyphs[z](e)){var f=a.glyphs[e];if(b.glyphs[e]={w:f.w,k:{},d:f.d&&"M"+f.d.replace(/[mlcxtrv]/g,function(a){return{l:"L",c:"C",x:"z",t:"m",r:"l",v:"c"}[a]||"M"})+"z"},f.k)for(var g in f.k)f[z](g)&&(b.glyphs[e].k[g]=f.k[g])}}return a},v.getFont=function(a,b,d,e){if(e=e||"normal",d=d||"normal",b=+b||{normal:400,bold:700,lighter:300,bolder:800}[b]||400,c.fonts){var f=c.fonts[a];if(!f){var g=new RegExp("(^|\\s)"+a.replace(/[^\w\d\s+!~.:_-]/g,G)+"(\\s|$)","i");for(var h in c.fonts)if(c.fonts[z](h)&&g.test(h)){f=c.fonts[h];break}}var i;if(f)for(var j=0,k=f.length;k>j&&(i=f[j],i.face["font-weight"]!=b||i.face["font-style"]!=d&&i.face["font-style"]||i.face["font-stretch"]!=e);j++);return i}},v.print=function(a,b,d,e,f,g,h,i){g=g||"middle",h=O(P(h||0,1),-1),i=O(P(i||1,3),1);var j,k=I(d)[J](G),l=0,m=0,n=G;if(c.is(e,"string")&&(e=this.getFont(e)),e){j=(f||16)/e.face["units-per-em"];for(var o=e.face.bbox[J](w),p=+o[0],q=o[3]-o[1],r=0,s=+o[1]+("baseline"==g?q+ +e.face.descent:q/2),t=0,u=k.length;u>t;t++){if("\n"==k[t])l=0,x=0,m=0,r+=q*i;else{var v=m&&e.glyphs[k[t-1]]||{},x=e.glyphs[k[t]];l+=m?(v.w||e.w)+(v.k&&v.k[k[t]]||0)+e.w*h:0,m=1}x&&x.d&&(n+=c.transformPath(x.d,["t",l*j,r*j,"s",j,j,p,s,"t",(a-p)/j,(b-s)/j]))}}return this.path(n).attr({fill:"#000",stroke:"none"})},v.add=function(a){if(c.is(a,"array"))for(var b,d=this.set(),e=0,f=a.length;f>e;e++)b=a[e]||{},x[z](b.type)&&d.push(this[b.type]().attr(b));return d},c.format=function(a,b){var d=c.is(b,V)?[0][E](b):arguments;return a&&c.is(a,U)&&d.length-1&&(a=a.replace(y,function(a,b){return null==d[++b]?G:d[b]})),a||G},c.fullfill=function(){var a=/\{([^\}]+)\}/g,b=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g,c=function(a,c,d){var e=d;return c.replace(b,function(a,b,c,d,f){b=b||d,e&&(b in e&&(e=e[b]),"function"==typeof e&&f&&(e=e()))}),e=(null==e||e==d?a:e)+""};return function(b,d){return String(b).replace(a,function(a,b){return c(a,b,d)})}}(),c.ninja=function(){return B.was?A.win.Raphael=B.is:delete Raphael,c},c.st=nc,function(a,b,d){function e(){/in/.test(a.readyState)?setTimeout(e,9):c.eve("raphael.DOMload")}null==a.readyState&&a.addEventListener&&(a.addEventListener(b,d=function(){a.removeEventListener(b,d,!1),a.readyState="complete"},!1),a.readyState="loading"),e()}(document,"DOMContentLoaded"),b.on("raphael.DOMload",function(){u=!0}),function(){if(c.svg){var a="hasOwnProperty",b=String,d=parseFloat,e=parseInt,f=Math,g=f.max,h=f.abs,i=f.pow,j=/[, ]+/,k=c.eve,l="",m=" ",n="http://www.w3.org/1999/xlink",o={block:"M5,0 0,2.5 5,5z",classic:"M5,0 0,2.5 5,5 3.5,3 3.5,2z",diamond:"M2.5,0 5,2.5 2.5,5 0,2.5z",open:"M6,1 1,3.5 6,6",oval:"M2.5,0A2.5,2.5,0,0,1,2.5,5 2.5,2.5,0,0,1,2.5,0z"},p={};c.toString=function(){return"Your browser supports SVG.\nYou are running Raphaël "+this.version};var q=function(d,e){if(e){"string"==typeof d&&(d=q(d));for(var f in e)e[a](f)&&("xlink:"==f.substring(0,6)?d.setAttributeNS(n,f.substring(6),b(e[f])):d.setAttribute(f,b(e[f])))}else d=c._g.doc.createElementNS("http://www.w3.org/2000/svg",d),d.style&&(d.style.webkitTapHighlightColor="rgba(0,0,0,0)");return d},r=function(a,e){var j="linear",k=a.id+e,m=.5,n=.5,o=a.node,p=a.paper,r=o.style,s=c._g.doc.getElementById(k);if(!s){if(e=b(e).replace(c._radial_gradient,function(a,b,c){if(j="radial",b&&c){m=d(b),n=d(c);var e=2*(n>.5)-1;i(m-.5,2)+i(n-.5,2)>.25&&(n=f.sqrt(.25-i(m-.5,2))*e+.5)&&.5!=n&&(n=n.toFixed(5)-1e-5*e)}return l}),e=e.split(/\s*\-\s*/),"linear"==j){var t=e.shift();if(t=-d(t),isNaN(t))return null;var u=[0,0,f.cos(c.rad(t)),f.sin(c.rad(t))],v=1/(g(h(u[2]),h(u[3]))||1);u[2]*=v,u[3]*=v,u[2]<0&&(u[0]=-u[2],u[2]=0),u[3]<0&&(u[1]=-u[3],u[3]=0)}var w=c._parseDots(e);if(!w)return null;if(k=k.replace(/[\(\)\s,\xb0#]/g,"_"),a.gradient&&k!=a.gradient.id&&(p.defs.removeChild(a.gradient),delete a.gradient),!a.gradient){s=q(j+"Gradient",{id:k}),a.gradient=s,q(s,"radial"==j?{fx:m,fy:n}:{x1:u[0],y1:u[1],x2:u[2],y2:u[3],gradientTransform:a.matrix.invert()}),p.defs.appendChild(s);for(var x=0,y=w.length;y>x;x++)s.appendChild(q("stop",{offset:w[x].offset?w[x].offset:x?"100%":"0%","stop-color":w[x].color||"#fff"}))}}return q(o,{fill:"url(#"+k+")",opacity:1,"fill-opacity":1}),r.fill=l,r.opacity=1,r.fillOpacity=1,1},s=function(a){var b=a.getBBox(1);q(a.pattern,{patternTransform:a.matrix.invert()+" translate("+b.x+","+b.y+")"})},t=function(d,e,f){if("path"==d.type){for(var g,h,i,j,k,m=b(e).toLowerCase().split("-"),n=d.paper,r=f?"end":"start",s=d.node,t=d.attrs,u=t["stroke-width"],v=m.length,w="classic",x=3,y=3,z=5;v--;)switch(m[v]){case"block":case"classic":case"oval":case"diamond":case"open":case"none":w=m[v];break;case"wide":y=5;break;case"narrow":y=2;break;case"long":x=5;break;case"short":x=2}if("open"==w?(x+=2,y+=2,z+=2,i=1,j=f?4:1,k={fill:"none",stroke:t.stroke}):(j=i=x/2,k={fill:t.stroke,stroke:"none"}),d._.arrows?f?(d._.arrows.endPath&&p[d._.arrows.endPath]--,d._.arrows.endMarker&&p[d._.arrows.endMarker]--):(d._.arrows.startPath&&p[d._.arrows.startPath]--,d._.arrows.startMarker&&p[d._.arrows.startMarker]--):d._.arrows={},"none"!=w){var A="raphael-marker-"+w,B="raphael-marker-"+r+w+x+y;c._g.doc.getElementById(A)?p[A]++:(n.defs.appendChild(q(q("path"),{"stroke-linecap":"round",d:o[w],id:A})),p[A]=1);var C,D=c._g.doc.getElementById(B);D?(p[B]++,C=D.getElementsByTagName("use")[0]):(D=q(q("marker"),{id:B,markerHeight:y,markerWidth:x,orient:"auto",refX:j,refY:y/2}),C=q(q("use"),{"xlink:href":"#"+A,transform:(f?"rotate(180 "+x/2+" "+y/2+") ":l)+"scale("+x/z+","+y/z+")","stroke-width":(1/((x/z+y/z)/2)).toFixed(4)}),D.appendChild(C),n.defs.appendChild(D),p[B]=1),q(C,k);var E=i*("diamond"!=w&&"oval"!=w);f?(g=d._.arrows.startdx*u||0,h=c.getTotalLength(t.path)-E*u):(g=E*u,h=c.getTotalLength(t.path)-(d._.arrows.enddx*u||0)),k={},k["marker-"+r]="url(#"+B+")",(h||g)&&(k.d=c.getSubpath(t.path,g,h)),q(s,k),d._.arrows[r+"Path"]=A,d._.arrows[r+"Marker"]=B,d._.arrows[r+"dx"]=E,d._.arrows[r+"Type"]=w,d._.arrows[r+"String"]=e}else f?(g=d._.arrows.startdx*u||0,h=c.getTotalLength(t.path)-g):(g=0,h=c.getTotalLength(t.path)-(d._.arrows.enddx*u||0)),d._.arrows[r+"Path"]&&q(s,{d:c.getSubpath(t.path,g,h)}),delete d._.arrows[r+"Path"],delete d._.arrows[r+"Marker"],delete d._.arrows[r+"dx"],delete d._.arrows[r+"Type"],delete d._.arrows[r+"String"];for(k in p)if(p[a](k)&&!p[k]){var F=c._g.doc.getElementById(k);F&&F.parentNode.removeChild(F)}}},u={"":[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]},v=function(a,c,d){if(c=u[b(c).toLowerCase()]){for(var e=a.attrs["stroke-width"]||"1",f={round:e,square:e,butt:0}[a.attrs["stroke-linecap"]||d["stroke-linecap"]]||0,g=[],h=c.length;h--;)g[h]=c[h]*e+(h%2?1:-1)*f;q(a.node,{"stroke-dasharray":g.join(",")})}},w=function(d,f){var i=d.node,k=d.attrs,m=i.style.visibility;i.style.visibility="hidden";for(var o in f)if(f[a](o)){if(!c._availableAttrs[a](o))continue;var p=f[o];switch(k[o]=p,o){case"blur":d.blur(p);break;case"href":case"title":var u=q("title"),w=c._g.doc.createTextNode(p);u.appendChild(w),i.appendChild(u);break;case"target":var x=i.parentNode;if("a"!=x.tagName.toLowerCase()){var u=q("a");x.insertBefore(u,i),u.appendChild(i),x=u}"target"==o?x.setAttributeNS(n,"show","blank"==p?"new":p):x.setAttributeNS(n,o,p);break;case"cursor":i.style.cursor=p;break;case"transform":d.transform(p);break;case"arrow-start":t(d,p);break;case"arrow-end":t(d,p,1);break;case"clip-rect":var z=b(p).split(j);if(4==z.length){d.clip&&d.clip.parentNode.parentNode.removeChild(d.clip.parentNode);var A=q("clipPath"),B=q("rect");A.id=c.createUUID(),q(B,{x:z[0],y:z[1],width:z[2],height:z[3]}),A.appendChild(B),d.paper.defs.appendChild(A),q(i,{"clip-path":"url(#"+A.id+")"}),d.clip=B}if(!p){var C=i.getAttribute("clip-path");if(C){var D=c._g.doc.getElementById(C.replace(/(^url\(#|\)$)/g,l));D&&D.parentNode.removeChild(D),q(i,{"clip-path":l}),delete d.clip}}break;case"path":"path"==d.type&&(q(i,{d:p?k.path=c._pathToAbsolute(p):"M0,0"}),d._.dirty=1,d._.arrows&&("startString"in d._.arrows&&t(d,d._.arrows.startString),"endString"in d._.arrows&&t(d,d._.arrows.endString,1)));break;case"width":if(i.setAttribute(o,p),d._.dirty=1,!k.fx)break;o="x",p=k.x;case"x":k.fx&&(p=-k.x-(k.width||0));case"rx":if("rx"==o&&"rect"==d.type)break;case"cx":i.setAttribute(o,p),d.pattern&&s(d),d._.dirty=1;break;case"height":if(i.setAttribute(o,p),d._.dirty=1,!k.fy)break;o="y",p=k.y;case"y":k.fy&&(p=-k.y-(k.height||0));case"ry":if("ry"==o&&"rect"==d.type)break;case"cy":i.setAttribute(o,p),d.pattern&&s(d),d._.dirty=1;break;case"r":"rect"==d.type?q(i,{rx:p,ry:p}):i.setAttribute(o,p),d._.dirty=1;break;case"src":"image"==d.type&&i.setAttributeNS(n,"href",p);break;case"stroke-width":(1!=d._.sx||1!=d._.sy)&&(p/=g(h(d._.sx),h(d._.sy))||1),d.paper._vbSize&&(p*=d.paper._vbSize),i.setAttribute(o,p),k["stroke-dasharray"]&&v(d,k["stroke-dasharray"],f),d._.arrows&&("startString"in d._.arrows&&t(d,d._.arrows.startString),"endString"in d._.arrows&&t(d,d._.arrows.endString,1));break;case"stroke-dasharray":v(d,p,f);break;case"fill":var E=b(p).match(c._ISURL);if(E){A=q("pattern");var F=q("image");A.id=c.createUUID(),q(A,{x:0,y:0,patternUnits:"userSpaceOnUse",height:1,width:1}),q(F,{x:0,y:0,"xlink:href":E[1]}),A.appendChild(F),function(a){c._preload(E[1],function(){var b=this.offsetWidth,c=this.offsetHeight;q(a,{width:b,height:c}),q(F,{width:b,height:c}),d.paper.safari()})}(A),d.paper.defs.appendChild(A),q(i,{fill:"url(#"+A.id+")"}),d.pattern=A,d.pattern&&s(d);break}var G=c.getRGB(p);if(G.error){if(("circle"==d.type||"ellipse"==d.type||"r"!=b(p).charAt())&&r(d,p)){if("opacity"in k||"fill-opacity"in k){var H=c._g.doc.getElementById(i.getAttribute("fill").replace(/^url\(#|\)$/g,l));if(H){var I=H.getElementsByTagName("stop");q(I[I.length-1],{"stop-opacity":("opacity"in k?k.opacity:1)*("fill-opacity"in k?k["fill-opacity"]:1)})}}k.gradient=p,k.fill="none";break}}else delete f.gradient,delete k.gradient,!c.is(k.opacity,"undefined")&&c.is(f.opacity,"undefined")&&q(i,{opacity:k.opacity}),!c.is(k["fill-opacity"],"undefined")&&c.is(f["fill-opacity"],"undefined")&&q(i,{"fill-opacity":k["fill-opacity"]});G[a]("opacity")&&q(i,{"fill-opacity":G.opacity>1?G.opacity/100:G.opacity});case"stroke":G=c.getRGB(p),i.setAttribute(o,G.hex),"stroke"==o&&G[a]("opacity")&&q(i,{"stroke-opacity":G.opacity>1?G.opacity/100:G.opacity}),"stroke"==o&&d._.arrows&&("startString"in d._.arrows&&t(d,d._.arrows.startString),"endString"in d._.arrows&&t(d,d._.arrows.endString,1));break;case"gradient":("circle"==d.type||"ellipse"==d.type||"r"!=b(p).charAt())&&r(d,p);break;case"opacity":k.gradient&&!k[a]("stroke-opacity")&&q(i,{"stroke-opacity":p>1?p/100:p});case"fill-opacity":if(k.gradient){H=c._g.doc.getElementById(i.getAttribute("fill").replace(/^url\(#|\)$/g,l)),H&&(I=H.getElementsByTagName("stop"),q(I[I.length-1],{"stop-opacity":p}));break}default:"font-size"==o&&(p=e(p,10)+"px");var J=o.replace(/(\-.)/g,function(a){return a.substring(1).toUpperCase()});i.style[J]=p,d._.dirty=1,i.setAttribute(o,p)}}y(d,f),i.style.visibility=m},x=1.2,y=function(d,f){if("text"==d.type&&(f[a]("text")||f[a]("font")||f[a]("font-size")||f[a]("x")||f[a]("y"))){var g=d.attrs,h=d.node,i=h.firstChild?e(c._g.doc.defaultView.getComputedStyle(h.firstChild,l).getPropertyValue("font-size"),10):10;
11
+ if(f[a]("text")){for(g.text=f.text;h.firstChild;)h.removeChild(h.firstChild);for(var j,k=b(f.text).split("\n"),m=[],n=0,o=k.length;o>n;n++)j=q("tspan"),n&&q(j,{dy:i*x,x:g.x}),j.appendChild(c._g.doc.createTextNode(k[n])),h.appendChild(j),m[n]=j}else for(m=h.getElementsByTagName("tspan"),n=0,o=m.length;o>n;n++)n?q(m[n],{dy:i*x,x:g.x}):q(m[0],{dy:0});q(h,{x:g.x,y:g.y}),d._.dirty=1;var p=d._getBBox(),r=g.y-(p.y+p.height/2);r&&c.is(r,"finite")&&q(m[0],{dy:r})}},z=function(a,b){this[0]=this.node=a,a.raphael=!0,this.id=c._oid++,a.raphaelid=this.id,this.matrix=c.matrix(),this.realPath=null,this.paper=b,this.attrs=this.attrs||{},this._={transform:[],sx:1,sy:1,deg:0,dx:0,dy:0,dirty:1},!b.bottom&&(b.bottom=this),this.prev=b.top,b.top&&(b.top.next=this),b.top=this,this.next=null},A=c.el;z.prototype=A,A.constructor=z,c._engine.path=function(a,b){var c=q("path");b.canvas&&b.canvas.appendChild(c);var d=new z(c,b);return d.type="path",w(d,{fill:"none",stroke:"#000",path:a}),d},A.rotate=function(a,c,e){if(this.removed)return this;if(a=b(a).split(j),a.length-1&&(c=d(a[1]),e=d(a[2])),a=d(a[0]),null==e&&(c=e),null==c||null==e){var f=this.getBBox(1);c=f.x+f.width/2,e=f.y+f.height/2}return this.transform(this._.transform.concat([["r",a,c,e]])),this},A.scale=function(a,c,e,f){if(this.removed)return this;if(a=b(a).split(j),a.length-1&&(c=d(a[1]),e=d(a[2]),f=d(a[3])),a=d(a[0]),null==c&&(c=a),null==f&&(e=f),null==e||null==f)var g=this.getBBox(1);return e=null==e?g.x+g.width/2:e,f=null==f?g.y+g.height/2:f,this.transform(this._.transform.concat([["s",a,c,e,f]])),this},A.translate=function(a,c){return this.removed?this:(a=b(a).split(j),a.length-1&&(c=d(a[1])),a=d(a[0])||0,c=+c||0,this.transform(this._.transform.concat([["t",a,c]])),this)},A.transform=function(b){var d=this._;if(null==b)return d.transform;if(c._extractTransform(this,b),this.clip&&q(this.clip,{transform:this.matrix.invert()}),this.pattern&&s(this),this.node&&q(this.node,{transform:this.matrix}),1!=d.sx||1!=d.sy){var e=this.attrs[a]("stroke-width")?this.attrs["stroke-width"]:1;this.attr({"stroke-width":e})}return this},A.hide=function(){return!this.removed&&this.paper.safari(this.node.style.display="none"),this},A.show=function(){return!this.removed&&this.paper.safari(this.node.style.display=""),this},A.remove=function(){if(!this.removed&&this.node.parentNode){var a=this.paper;a.__set__&&a.__set__.exclude(this),k.unbind("raphael.*.*."+this.id),this.gradient&&a.defs.removeChild(this.gradient),c._tear(this,a),"a"==this.node.parentNode.tagName.toLowerCase()?this.node.parentNode.parentNode.removeChild(this.node.parentNode):this.node.parentNode.removeChild(this.node);for(var b in this)this[b]="function"==typeof this[b]?c._removedFactory(b):null;this.removed=!0}},A._getBBox=function(){if("none"==this.node.style.display){this.show();var a=!0}var b={};try{b=this.node.getBBox()}catch(c){}finally{b=b||{}}return a&&this.hide(),b},A.attr=function(b,d){if(this.removed)return this;if(null==b){var e={};for(var f in this.attrs)this.attrs[a](f)&&(e[f]=this.attrs[f]);return e.gradient&&"none"==e.fill&&(e.fill=e.gradient)&&delete e.gradient,e.transform=this._.transform,e}if(null==d&&c.is(b,"string")){if("fill"==b&&"none"==this.attrs.fill&&this.attrs.gradient)return this.attrs.gradient;if("transform"==b)return this._.transform;for(var g=b.split(j),h={},i=0,l=g.length;l>i;i++)b=g[i],h[b]=b in this.attrs?this.attrs[b]:c.is(this.paper.customAttributes[b],"function")?this.paper.customAttributes[b].def:c._availableAttrs[b];return l-1?h:h[g[0]]}if(null==d&&c.is(b,"array")){for(h={},i=0,l=b.length;l>i;i++)h[b[i]]=this.attr(b[i]);return h}if(null!=d){var m={};m[b]=d}else null!=b&&c.is(b,"object")&&(m=b);for(var n in m)k("raphael.attr."+n+"."+this.id,this,m[n]);for(n in this.paper.customAttributes)if(this.paper.customAttributes[a](n)&&m[a](n)&&c.is(this.paper.customAttributes[n],"function")){var o=this.paper.customAttributes[n].apply(this,[].concat(m[n]));this.attrs[n]=m[n];for(var p in o)o[a](p)&&(m[p]=o[p])}return w(this,m),this},A.toFront=function(){if(this.removed)return this;"a"==this.node.parentNode.tagName.toLowerCase()?this.node.parentNode.parentNode.appendChild(this.node.parentNode):this.node.parentNode.appendChild(this.node);var a=this.paper;return a.top!=this&&c._tofront(this,a),this},A.toBack=function(){if(this.removed)return this;var a=this.node.parentNode;return"a"==a.tagName.toLowerCase()?a.parentNode.insertBefore(this.node.parentNode,this.node.parentNode.parentNode.firstChild):a.firstChild!=this.node&&a.insertBefore(this.node,this.node.parentNode.firstChild),c._toback(this,this.paper),this.paper,this},A.insertAfter=function(a){if(this.removed)return this;var b=a.node||a[a.length-1].node;return b.nextSibling?b.parentNode.insertBefore(this.node,b.nextSibling):b.parentNode.appendChild(this.node),c._insertafter(this,a,this.paper),this},A.insertBefore=function(a){if(this.removed)return this;var b=a.node||a[0].node;return b.parentNode.insertBefore(this.node,b),c._insertbefore(this,a,this.paper),this},A.blur=function(a){var b=this;if(0!==+a){var d=q("filter"),e=q("feGaussianBlur");b.attrs.blur=a,d.id=c.createUUID(),q(e,{stdDeviation:+a||1.5}),d.appendChild(e),b.paper.defs.appendChild(d),b._blur=d,q(b.node,{filter:"url(#"+d.id+")"})}else b._blur&&(b._blur.parentNode.removeChild(b._blur),delete b._blur,delete b.attrs.blur),b.node.removeAttribute("filter");return b},c._engine.circle=function(a,b,c,d){var e=q("circle");a.canvas&&a.canvas.appendChild(e);var f=new z(e,a);return f.attrs={cx:b,cy:c,r:d,fill:"none",stroke:"#000"},f.type="circle",q(e,f.attrs),f},c._engine.rect=function(a,b,c,d,e,f){var g=q("rect");a.canvas&&a.canvas.appendChild(g);var h=new z(g,a);return h.attrs={x:b,y:c,width:d,height:e,r:f||0,rx:f||0,ry:f||0,fill:"none",stroke:"#000"},h.type="rect",q(g,h.attrs),h},c._engine.ellipse=function(a,b,c,d,e){var f=q("ellipse");a.canvas&&a.canvas.appendChild(f);var g=new z(f,a);return g.attrs={cx:b,cy:c,rx:d,ry:e,fill:"none",stroke:"#000"},g.type="ellipse",q(f,g.attrs),g},c._engine.image=function(a,b,c,d,e,f){var g=q("image");q(g,{x:c,y:d,width:e,height:f,preserveAspectRatio:"none"}),g.setAttributeNS(n,"href",b),a.canvas&&a.canvas.appendChild(g);var h=new z(g,a);return h.attrs={x:c,y:d,width:e,height:f,src:b},h.type="image",h},c._engine.text=function(a,b,d,e){var f=q("text");a.canvas&&a.canvas.appendChild(f);var g=new z(f,a);return g.attrs={x:b,y:d,"text-anchor":"middle",text:e,font:c._availableAttrs.font,stroke:"none",fill:"#000"},g.type="text",w(g,g.attrs),g},c._engine.setSize=function(a,b){return this.width=a||this.width,this.height=b||this.height,this.canvas.setAttribute("width",this.width),this.canvas.setAttribute("height",this.height),this._viewBox&&this.setViewBox.apply(this,this._viewBox),this},c._engine.create=function(){var a=c._getContainer.apply(0,arguments),b=a&&a.container,d=a.x,e=a.y,f=a.width,g=a.height;if(!b)throw new Error("SVG container not found.");var h,i=q("svg"),j="overflow:hidden;";return d=d||0,e=e||0,f=f||512,g=g||342,q(i,{height:g,version:1.1,width:f,xmlns:"http://www.w3.org/2000/svg"}),1==b?(i.style.cssText=j+"position:absolute;left:"+d+"px;top:"+e+"px",c._g.doc.body.appendChild(i),h=1):(i.style.cssText=j+"position:relative",b.firstChild?b.insertBefore(i,b.firstChild):b.appendChild(i)),b=new c._Paper,b.width=f,b.height=g,b.canvas=i,b.clear(),b._left=b._top=0,h&&(b.renderfix=function(){}),b.renderfix(),b},c._engine.setViewBox=function(a,b,c,d,e){k("raphael.setViewBox",this,this._viewBox,[a,b,c,d,e]);var f,h,i=g(c/this.width,d/this.height),j=this.top,l=e?"meet":"xMinYMin";for(null==a?(this._vbSize&&(i=1),delete this._vbSize,f="0 0 "+this.width+m+this.height):(this._vbSize=i,f=a+m+b+m+c+m+d),q(this.canvas,{viewBox:f,preserveAspectRatio:l});i&&j;)h="stroke-width"in j.attrs?j.attrs["stroke-width"]:1,j.attr({"stroke-width":h}),j._.dirty=1,j._.dirtyT=1,j=j.prev;return this._viewBox=[a,b,c,d,!!e],this},c.prototype.renderfix=function(){var a,b=this.canvas,c=b.style;try{a=b.getScreenCTM()||b.createSVGMatrix()}catch(d){a=b.createSVGMatrix()}var e=-a.e%1,f=-a.f%1;(e||f)&&(e&&(this._left=(this._left+e)%1,c.left=this._left+"px"),f&&(this._top=(this._top+f)%1,c.top=this._top+"px"))},c.prototype.clear=function(){c.eve("raphael.clear",this);for(var a=this.canvas;a.firstChild;)a.removeChild(a.firstChild);this.bottom=this.top=null,(this.desc=q("desc")).appendChild(c._g.doc.createTextNode("Created with Raphaël "+c.version)),a.appendChild(this.desc),a.appendChild(this.defs=q("defs"))},c.prototype.remove=function(){k("raphael.remove",this),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas);for(var a in this)this[a]="function"==typeof this[a]?c._removedFactory(a):null};var B=c.st;for(var C in A)A[a](C)&&!B[a](C)&&(B[C]=function(a){return function(){var b=arguments;return this.forEach(function(c){c[a].apply(c,b)})}}(C))}}(),function(){if(c.vml){var a="hasOwnProperty",b=String,d=parseFloat,e=Math,f=e.round,g=e.max,h=e.min,i=e.abs,j="fill",k=/[, ]+/,l=c.eve,m=" progid:DXImageTransform.Microsoft",n=" ",o="",p={M:"m",L:"l",C:"c",Z:"x",m:"t",l:"r",c:"v",z:"x"},q=/([clmz]),?([^clmz]*)/gi,r=/ progid:\S+Blur\([^\)]+\)/g,s=/-?[^,\s-]+/g,t="position:absolute;left:0;top:0;width:1px;height:1px",u=21600,v={path:1,rect:1,image:1},w={circle:1,ellipse:1},x=function(a){var d=/[ahqstv]/gi,e=c._pathToAbsolute;if(b(a).match(d)&&(e=c._path2curve),d=/[clmz]/g,e==c._pathToAbsolute&&!b(a).match(d)){var g=b(a).replace(q,function(a,b,c){var d=[],e="m"==b.toLowerCase(),g=p[b];return c.replace(s,function(a){e&&2==d.length&&(g+=d+p["m"==b?"l":"L"],d=[]),d.push(f(a*u))}),g+d});return g}var h,i,j=e(a);g=[];for(var k=0,l=j.length;l>k;k++){h=j[k],i=j[k][0].toLowerCase(),"z"==i&&(i="x");for(var m=1,r=h.length;r>m;m++)i+=f(h[m]*u)+(m!=r-1?",":o);g.push(i)}return g.join(n)},y=function(a,b,d){var e=c.matrix();return e.rotate(-a,.5,.5),{dx:e.x(b,d),dy:e.y(b,d)}},z=function(a,b,c,d,e,f){var g=a._,h=a.matrix,k=g.fillpos,l=a.node,m=l.style,o=1,p="",q=u/b,r=u/c;if(m.visibility="hidden",b&&c){if(l.coordsize=i(q)+n+i(r),m.rotation=f*(0>b*c?-1:1),f){var s=y(f,d,e);d=s.dx,e=s.dy}if(0>b&&(p+="x"),0>c&&(p+=" y")&&(o=-1),m.flip=p,l.coordorigin=d*-q+n+e*-r,k||g.fillsize){var t=l.getElementsByTagName(j);t=t&&t[0],l.removeChild(t),k&&(s=y(f,h.x(k[0],k[1]),h.y(k[0],k[1])),t.position=s.dx*o+n+s.dy*o),g.fillsize&&(t.size=g.fillsize[0]*i(b)+n+g.fillsize[1]*i(c)),l.appendChild(t)}m.visibility="visible"}};c.toString=function(){return"Your browser doesn’t support SVG. Falling down to VML.\nYou are running Raphaël "+this.version};var A=function(a,c,d){for(var e=b(c).toLowerCase().split("-"),f=d?"end":"start",g=e.length,h="classic",i="medium",j="medium";g--;)switch(e[g]){case"block":case"classic":case"oval":case"diamond":case"open":case"none":h=e[g];break;case"wide":case"narrow":j=e[g];break;case"long":case"short":i=e[g]}var k=a.node.getElementsByTagName("stroke")[0];k[f+"arrow"]=h,k[f+"arrowlength"]=i,k[f+"arrowwidth"]=j},B=function(e,i){e.attrs=e.attrs||{};var l=e.node,m=e.attrs,p=l.style,q=v[e.type]&&(i.x!=m.x||i.y!=m.y||i.width!=m.width||i.height!=m.height||i.cx!=m.cx||i.cy!=m.cy||i.rx!=m.rx||i.ry!=m.ry||i.r!=m.r),r=w[e.type]&&(m.cx!=i.cx||m.cy!=i.cy||m.r!=i.r||m.rx!=i.rx||m.ry!=i.ry),s=e;for(var t in i)i[a](t)&&(m[t]=i[t]);if(q&&(m.path=c._getPath[e.type](e),e._.dirty=1),i.href&&(l.href=i.href),i.title&&(l.title=i.title),i.target&&(l.target=i.target),i.cursor&&(p.cursor=i.cursor),"blur"in i&&e.blur(i.blur),(i.path&&"path"==e.type||q)&&(l.path=x(~b(m.path).toLowerCase().indexOf("r")?c._pathToAbsolute(m.path):m.path),"image"==e.type&&(e._.fillpos=[m.x,m.y],e._.fillsize=[m.width,m.height],z(e,1,1,0,0,0))),"transform"in i&&e.transform(i.transform),r){var y=+m.cx,B=+m.cy,D=+m.rx||+m.r||0,E=+m.ry||+m.r||0;l.path=c.format("ar{0},{1},{2},{3},{4},{1},{4},{1}x",f((y-D)*u),f((B-E)*u),f((y+D)*u),f((B+E)*u),f(y*u)),e._.dirty=1}if("clip-rect"in i){var G=b(i["clip-rect"]).split(k);if(4==G.length){G[2]=+G[2]+ +G[0],G[3]=+G[3]+ +G[1];var H=l.clipRect||c._g.doc.createElement("div"),I=H.style;I.clip=c.format("rect({1}px {2}px {3}px {0}px)",G),l.clipRect||(I.position="absolute",I.top=0,I.left=0,I.width=e.paper.width+"px",I.height=e.paper.height+"px",l.parentNode.insertBefore(H,l),H.appendChild(l),l.clipRect=H)}i["clip-rect"]||l.clipRect&&(l.clipRect.style.clip="auto")}if(e.textpath){var J=e.textpath.style;i.font&&(J.font=i.font),i["font-family"]&&(J.fontFamily='"'+i["font-family"].split(",")[0].replace(/^['"]+|['"]+$/g,o)+'"'),i["font-size"]&&(J.fontSize=i["font-size"]),i["font-weight"]&&(J.fontWeight=i["font-weight"]),i["font-style"]&&(J.fontStyle=i["font-style"])}if("arrow-start"in i&&A(s,i["arrow-start"]),"arrow-end"in i&&A(s,i["arrow-end"],1),null!=i.opacity||null!=i["stroke-width"]||null!=i.fill||null!=i.src||null!=i.stroke||null!=i["stroke-width"]||null!=i["stroke-opacity"]||null!=i["fill-opacity"]||null!=i["stroke-dasharray"]||null!=i["stroke-miterlimit"]||null!=i["stroke-linejoin"]||null!=i["stroke-linecap"]){var K=l.getElementsByTagName(j),L=!1;if(K=K&&K[0],!K&&(L=K=F(j)),"image"==e.type&&i.src&&(K.src=i.src),i.fill&&(K.on=!0),(null==K.on||"none"==i.fill||null===i.fill)&&(K.on=!1),K.on&&i.fill){var M=b(i.fill).match(c._ISURL);if(M){K.parentNode==l&&l.removeChild(K),K.rotate=!0,K.src=M[1],K.type="tile";var N=e.getBBox(1);K.position=N.x+n+N.y,e._.fillpos=[N.x,N.y],c._preload(M[1],function(){e._.fillsize=[this.offsetWidth,this.offsetHeight]})}else K.color=c.getRGB(i.fill).hex,K.src=o,K.type="solid",c.getRGB(i.fill).error&&(s.type in{circle:1,ellipse:1}||"r"!=b(i.fill).charAt())&&C(s,i.fill,K)&&(m.fill="none",m.gradient=i.fill,K.rotate=!1)}if("fill-opacity"in i||"opacity"in i){var O=((+m["fill-opacity"]+1||2)-1)*((+m.opacity+1||2)-1)*((+c.getRGB(i.fill).o+1||2)-1);O=h(g(O,0),1),K.opacity=O,K.src&&(K.color="none")}l.appendChild(K);var P=l.getElementsByTagName("stroke")&&l.getElementsByTagName("stroke")[0],Q=!1;!P&&(Q=P=F("stroke")),(i.stroke&&"none"!=i.stroke||i["stroke-width"]||null!=i["stroke-opacity"]||i["stroke-dasharray"]||i["stroke-miterlimit"]||i["stroke-linejoin"]||i["stroke-linecap"])&&(P.on=!0),("none"==i.stroke||null===i.stroke||null==P.on||0==i.stroke||0==i["stroke-width"])&&(P.on=!1);var R=c.getRGB(i.stroke);P.on&&i.stroke&&(P.color=R.hex),O=((+m["stroke-opacity"]+1||2)-1)*((+m.opacity+1||2)-1)*((+R.o+1||2)-1);var S=.75*(d(i["stroke-width"])||1);if(O=h(g(O,0),1),null==i["stroke-width"]&&(S=m["stroke-width"]),i["stroke-width"]&&(P.weight=S),S&&1>S&&(O*=S)&&(P.weight=1),P.opacity=O,i["stroke-linejoin"]&&(P.joinstyle=i["stroke-linejoin"]||"miter"),P.miterlimit=i["stroke-miterlimit"]||8,i["stroke-linecap"]&&(P.endcap="butt"==i["stroke-linecap"]?"flat":"square"==i["stroke-linecap"]?"square":"round"),i["stroke-dasharray"]){var T={"-":"shortdash",".":"shortdot","-.":"shortdashdot","-..":"shortdashdotdot",". ":"dot","- ":"dash","--":"longdash","- .":"dashdot","--.":"longdashdot","--..":"longdashdotdot"};P.dashstyle=T[a](i["stroke-dasharray"])?T[i["stroke-dasharray"]]:o}Q&&l.appendChild(P)}if("text"==s.type){s.paper.canvas.style.display=o;var U=s.paper.span,V=100,W=m.font&&m.font.match(/\d+(?:\.\d*)?(?=px)/);p=U.style,m.font&&(p.font=m.font),m["font-family"]&&(p.fontFamily=m["font-family"]),m["font-weight"]&&(p.fontWeight=m["font-weight"]),m["font-style"]&&(p.fontStyle=m["font-style"]),W=d(m["font-size"]||W&&W[0])||10,p.fontSize=W*V+"px",s.textpath.string&&(U.innerHTML=b(s.textpath.string).replace(/</g,"&#60;").replace(/&/g,"&#38;").replace(/\n/g,"<br>"));var X=U.getBoundingClientRect();s.W=m.w=(X.right-X.left)/V,s.H=m.h=(X.bottom-X.top)/V,s.X=m.x,s.Y=m.y+s.H/2,("x"in i||"y"in i)&&(s.path.v=c.format("m{0},{1}l{2},{1}",f(m.x*u),f(m.y*u),f(m.x*u)+1));for(var Y=["x","y","text","font","font-family","font-weight","font-style","font-size"],Z=0,$=Y.length;$>Z;Z++)if(Y[Z]in i){s._.dirty=1;break}switch(m["text-anchor"]){case"start":s.textpath.style["v-text-align"]="left",s.bbx=s.W/2;break;case"end":s.textpath.style["v-text-align"]="right",s.bbx=-s.W/2;break;default:s.textpath.style["v-text-align"]="center",s.bbx=0}s.textpath.style["v-text-kern"]=!0}},C=function(a,f,g){a.attrs=a.attrs||{};var h=(a.attrs,Math.pow),i="linear",j=".5 .5";if(a.attrs.gradient=f,f=b(f).replace(c._radial_gradient,function(a,b,c){return i="radial",b&&c&&(b=d(b),c=d(c),h(b-.5,2)+h(c-.5,2)>.25&&(c=e.sqrt(.25-h(b-.5,2))*(2*(c>.5)-1)+.5),j=b+n+c),o}),f=f.split(/\s*\-\s*/),"linear"==i){var k=f.shift();if(k=-d(k),isNaN(k))return null}var l=c._parseDots(f);if(!l)return null;if(a=a.shape||a.node,l.length){a.removeChild(g),g.on=!0,g.method="none",g.color=l[0].color,g.color2=l[l.length-1].color;for(var m=[],p=0,q=l.length;q>p;p++)l[p].offset&&m.push(l[p].offset+n+l[p].color);g.colors=m.length?m.join():"0% "+g.color,"radial"==i?(g.type="gradientTitle",g.focus="100%",g.focussize="0 0",g.focusposition=j,g.angle=0):(g.type="gradient",g.angle=(270-k)%360),a.appendChild(g)}return 1},D=function(a,b){this[0]=this.node=a,a.raphael=!0,this.id=c._oid++,a.raphaelid=this.id,this.X=0,this.Y=0,this.attrs={},this.paper=b,this.matrix=c.matrix(),this._={transform:[],sx:1,sy:1,dx:0,dy:0,deg:0,dirty:1,dirtyT:1},!b.bottom&&(b.bottom=this),this.prev=b.top,b.top&&(b.top.next=this),b.top=this,this.next=null},E=c.el;D.prototype=E,E.constructor=D,E.transform=function(a){if(null==a)return this._.transform;var d,e=this.paper._viewBoxShift,f=e?"s"+[e.scale,e.scale]+"-1-1t"+[e.dx,e.dy]:o;e&&(d=a=b(a).replace(/\.{3}|\u2026/g,this._.transform||o)),c._extractTransform(this,f+a);var g,h=this.matrix.clone(),i=this.skew,j=this.node,k=~b(this.attrs.fill).indexOf("-"),l=!b(this.attrs.fill).indexOf("url(");if(h.translate(1,1),l||k||"image"==this.type)if(i.matrix="1 0 0 1",i.offset="0 0",g=h.split(),k&&g.noRotation||!g.isSimple){j.style.filter=h.toFilter();var m=this.getBBox(),p=this.getBBox(1),q=m.x-p.x,r=m.y-p.y;j.coordorigin=q*-u+n+r*-u,z(this,1,1,q,r,0)}else j.style.filter=o,z(this,g.scalex,g.scaley,g.dx,g.dy,g.rotate);else j.style.filter=o,i.matrix=b(h),i.offset=h.offset();return d&&(this._.transform=d),this},E.rotate=function(a,c,e){if(this.removed)return this;if(null!=a){if(a=b(a).split(k),a.length-1&&(c=d(a[1]),e=d(a[2])),a=d(a[0]),null==e&&(c=e),null==c||null==e){var f=this.getBBox(1);c=f.x+f.width/2,e=f.y+f.height/2}return this._.dirtyT=1,this.transform(this._.transform.concat([["r",a,c,e]])),this}},E.translate=function(a,c){return this.removed?this:(a=b(a).split(k),a.length-1&&(c=d(a[1])),a=d(a[0])||0,c=+c||0,this._.bbox&&(this._.bbox.x+=a,this._.bbox.y+=c),this.transform(this._.transform.concat([["t",a,c]])),this)},E.scale=function(a,c,e,f){if(this.removed)return this;if(a=b(a).split(k),a.length-1&&(c=d(a[1]),e=d(a[2]),f=d(a[3]),isNaN(e)&&(e=null),isNaN(f)&&(f=null)),a=d(a[0]),null==c&&(c=a),null==f&&(e=f),null==e||null==f)var g=this.getBBox(1);return e=null==e?g.x+g.width/2:e,f=null==f?g.y+g.height/2:f,this.transform(this._.transform.concat([["s",a,c,e,f]])),this._.dirtyT=1,this},E.hide=function(){return!this.removed&&(this.node.style.display="none"),this},E.show=function(){return!this.removed&&(this.node.style.display=o),this},E._getBBox=function(){return this.removed?{}:{x:this.X+(this.bbx||0)-this.W/2,y:this.Y-this.H,width:this.W,height:this.H}},E.remove=function(){if(!this.removed&&this.node.parentNode){this.paper.__set__&&this.paper.__set__.exclude(this),c.eve.unbind("raphael.*.*."+this.id),c._tear(this,this.paper),this.node.parentNode.removeChild(this.node),this.shape&&this.shape.parentNode.removeChild(this.shape);for(var a in this)this[a]="function"==typeof this[a]?c._removedFactory(a):null;this.removed=!0}},E.attr=function(b,d){if(this.removed)return this;if(null==b){var e={};for(var f in this.attrs)this.attrs[a](f)&&(e[f]=this.attrs[f]);return e.gradient&&"none"==e.fill&&(e.fill=e.gradient)&&delete e.gradient,e.transform=this._.transform,e}if(null==d&&c.is(b,"string")){if(b==j&&"none"==this.attrs.fill&&this.attrs.gradient)return this.attrs.gradient;for(var g=b.split(k),h={},i=0,m=g.length;m>i;i++)b=g[i],h[b]=b in this.attrs?this.attrs[b]:c.is(this.paper.customAttributes[b],"function")?this.paper.customAttributes[b].def:c._availableAttrs[b];return m-1?h:h[g[0]]}if(this.attrs&&null==d&&c.is(b,"array")){for(h={},i=0,m=b.length;m>i;i++)h[b[i]]=this.attr(b[i]);return h}var n;null!=d&&(n={},n[b]=d),null==d&&c.is(b,"object")&&(n=b);for(var o in n)l("raphael.attr."+o+"."+this.id,this,n[o]);if(n){for(o in this.paper.customAttributes)if(this.paper.customAttributes[a](o)&&n[a](o)&&c.is(this.paper.customAttributes[o],"function")){var p=this.paper.customAttributes[o].apply(this,[].concat(n[o]));this.attrs[o]=n[o];for(var q in p)p[a](q)&&(n[q]=p[q])}n.text&&"text"==this.type&&(this.textpath.string=n.text),B(this,n)}return this},E.toFront=function(){return!this.removed&&this.node.parentNode.appendChild(this.node),this.paper&&this.paper.top!=this&&c._tofront(this,this.paper),this},E.toBack=function(){return this.removed?this:(this.node.parentNode.firstChild!=this.node&&(this.node.parentNode.insertBefore(this.node,this.node.parentNode.firstChild),c._toback(this,this.paper)),this)},E.insertAfter=function(a){return this.removed?this:(a.constructor==c.st.constructor&&(a=a[a.length-1]),a.node.nextSibling?a.node.parentNode.insertBefore(this.node,a.node.nextSibling):a.node.parentNode.appendChild(this.node),c._insertafter(this,a,this.paper),this)},E.insertBefore=function(a){return this.removed?this:(a.constructor==c.st.constructor&&(a=a[0]),a.node.parentNode.insertBefore(this.node,a.node),c._insertbefore(this,a,this.paper),this)},E.blur=function(a){var b=this.node.runtimeStyle,d=b.filter;return d=d.replace(r,o),0!==+a?(this.attrs.blur=a,b.filter=d+n+m+".Blur(pixelradius="+(+a||1.5)+")",b.margin=c.format("-{0}px 0 0 -{0}px",f(+a||1.5))):(b.filter=d,b.margin=0,delete this.attrs.blur),this},c._engine.path=function(a,b){var c=F("shape");c.style.cssText=t,c.coordsize=u+n+u,c.coordorigin=b.coordorigin;var d=new D(c,b),e={fill:"none",stroke:"#000"};a&&(e.path=a),d.type="path",d.path=[],d.Path=o,B(d,e),b.canvas.appendChild(c);var f=F("skew");return f.on=!0,c.appendChild(f),d.skew=f,d.transform(o),d},c._engine.rect=function(a,b,d,e,f,g){var h=c._rectPath(b,d,e,f,g),i=a.path(h),j=i.attrs;return i.X=j.x=b,i.Y=j.y=d,i.W=j.width=e,i.H=j.height=f,j.r=g,j.path=h,i.type="rect",i},c._engine.ellipse=function(a,b,c,d,e){var f=a.path();return f.attrs,f.X=b-d,f.Y=c-e,f.W=2*d,f.H=2*e,f.type="ellipse",B(f,{cx:b,cy:c,rx:d,ry:e}),f},c._engine.circle=function(a,b,c,d){var e=a.path();return e.attrs,e.X=b-d,e.Y=c-d,e.W=e.H=2*d,e.type="circle",B(e,{cx:b,cy:c,r:d}),e},c._engine.image=function(a,b,d,e,f,g){var h=c._rectPath(d,e,f,g),i=a.path(h).attr({stroke:"none"}),k=i.attrs,l=i.node,m=l.getElementsByTagName(j)[0];return k.src=b,i.X=k.x=d,i.Y=k.y=e,i.W=k.width=f,i.H=k.height=g,k.path=h,i.type="image",m.parentNode==l&&l.removeChild(m),m.rotate=!0,m.src=b,m.type="tile",i._.fillpos=[d,e],i._.fillsize=[f,g],l.appendChild(m),z(i,1,1,0,0,0),i},c._engine.text=function(a,d,e,g){var h=F("shape"),i=F("path"),j=F("textpath");d=d||0,e=e||0,g=g||"",i.v=c.format("m{0},{1}l{2},{1}",f(d*u),f(e*u),f(d*u)+1),i.textpathok=!0,j.string=b(g),j.on=!0,h.style.cssText=t,h.coordsize=u+n+u,h.coordorigin="0 0";var k=new D(h,a),l={fill:"#000",stroke:"none",font:c._availableAttrs.font,text:g};k.shape=h,k.path=i,k.textpath=j,k.type="text",k.attrs.text=b(g),k.attrs.x=d,k.attrs.y=e,k.attrs.w=1,k.attrs.h=1,B(k,l),h.appendChild(j),h.appendChild(i),a.canvas.appendChild(h);var m=F("skew");return m.on=!0,h.appendChild(m),k.skew=m,k.transform(o),k},c._engine.setSize=function(a,b){var d=this.canvas.style;return this.width=a,this.height=b,a==+a&&(a+="px"),b==+b&&(b+="px"),d.width=a,d.height=b,d.clip="rect(0 "+a+" "+b+" 0)",this._viewBox&&c._engine.setViewBox.apply(this,this._viewBox),this},c._engine.setViewBox=function(a,b,d,e,f){c.eve("raphael.setViewBox",this,this._viewBox,[a,b,d,e,f]);var h,i,j=this.width,k=this.height,l=1/g(d/j,e/k);return f&&(h=k/e,i=j/d,j>d*h&&(a-=(j-d*h)/2/h),k>e*i&&(b-=(k-e*i)/2/i)),this._viewBox=[a,b,d,e,!!f],this._viewBoxShift={dx:-a,dy:-b,scale:l},this.forEach(function(a){a.transform("...")}),this};var F;c._engine.initWin=function(a){var b=a.document;b.createStyleSheet().addRule(".rvml","behavior:url(#default#VML)");try{!b.namespaces.rvml&&b.namespaces.add("rvml","urn:schemas-microsoft-com:vml"),F=function(a){return b.createElement("<rvml:"+a+' class="rvml">')}}catch(c){F=function(a){return b.createElement("<"+a+' xmlns="urn:schemas-microsoft.com:vml" class="rvml">')}}},c._engine.initWin(c._g.win),c._engine.create=function(){var a=c._getContainer.apply(0,arguments),b=a.container,d=a.height,e=a.width,f=a.x,g=a.y;if(!b)throw new Error("VML container not found.");var h=new c._Paper,i=h.canvas=c._g.doc.createElement("div"),j=i.style;return f=f||0,g=g||0,e=e||512,d=d||342,h.width=e,h.height=d,e==+e&&(e+="px"),d==+d&&(d+="px"),h.coordsize=1e3*u+n+1e3*u,h.coordorigin="0 0",h.span=c._g.doc.createElement("span"),h.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;",i.appendChild(h.span),j.cssText=c.format("top:0;left:0;width:{0};height:{1};display:inline-block;position:relative;clip:rect(0 {0} {1} 0);overflow:hidden",e,d),1==b?(c._g.doc.body.appendChild(i),j.left=f+"px",j.top=g+"px",j.position="absolute"):b.firstChild?b.insertBefore(i,b.firstChild):b.appendChild(i),h.renderfix=function(){},h},c.prototype.clear=function(){c.eve("raphael.clear",this),this.canvas.innerHTML=o,this.span=c._g.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},c.prototype.remove=function(){c.eve("raphael.remove",this),this.canvas.parentNode.removeChild(this.canvas);for(var a in this)this[a]="function"==typeof this[a]?c._removedFactory(a):null;return!0};var G=c.st;for(var H in E)E[a](H)&&!G[a](H)&&(G[H]=function(a){return function(){var b=arguments;return this.forEach(function(c){c[a].apply(c,b)})}}(H))}}(),B.was?A.win.Raphael=c:Raphael=c,c});
@@ -1,21 +1,32 @@
1
1
  // ┌────────────────────────────────────────────────────────────────────┐ \\
2
- // │ Raphaël 2.1.0 - JavaScript Vector Library │ \\
2
+ // │ Raphaël 2.1.2 - JavaScript Vector Library │ \\
3
3
  // ├────────────────────────────────────────────────────────────────────┤ \\
4
4
  // │ Copyright © 2008-2012 Dmitry Baranovskiy (http://raphaeljs.com) │ \\
5
5
  // │ Copyright © 2008-2012 Sencha Labs (http://sencha.com) │ \\
6
6
  // ├────────────────────────────────────────────────────────────────────┤ \\
7
7
  // │ Licensed under the MIT (http://raphaeljs.com/license.html) license.│ \\
8
8
  // └────────────────────────────────────────────────────────────────────┘ \\
9
-
10
- // ┌──────────────────────────────────────────────────────────────────────────────────────┐ \\
11
- // Eve 0.3.4 - JavaScript Events Library │ \\
12
- // ├──────────────────────────────────────────────────────────────────────────────────────┤ \\
13
- // Copyright (c) 2008-2011 Dmitry Baranovskiy (http://dmitry.baranovskiy.com/) │ \\
14
- // │ Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license. │ \\
15
- // └──────────────────────────────────────────────────────────────────────────────────────┘ \\
9
+ // Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
10
+ //
11
+ // Licensed under the Apache License, Version 2.0 (the "License");
12
+ // you may not use this file except in compliance with the License.
13
+ // You may obtain a copy of the License at
14
+ //
15
+ // http://www.apache.org/licenses/LICENSE-2.0
16
+ //
17
+ // Unless required by applicable law or agreed to in writing, software
18
+ // distributed under the License is distributed on an "AS IS" BASIS,
19
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
+ // See the License for the specific language governing permissions and
21
+ // limitations under the License.
22
+ // ┌────────────────────────────────────────────────────────────┐ \\
23
+ // │ Eve 0.4.2 - JavaScript Events Library │ \\
24
+ // ├────────────────────────────────────────────────────────────┤ \\
25
+ // │ Author Dmitry Baranovskiy (http://dmitry.baranovskiy.com/) │ \\
26
+ // └────────────────────────────────────────────────────────────┘ \\
16
27
 
17
28
  (function (glob) {
18
- var version = "0.3.4",
29
+ var version = "0.4.2",
19
30
  has = "hasOwnProperty",
20
31
  separator = /[\.\/]/,
21
32
  wildcard = "*",
@@ -26,8 +37,22 @@
26
37
  current_event,
27
38
  stop,
28
39
  events = {n: {}},
29
-
40
+ /*\
41
+ * eve
42
+ [ method ]
43
+
44
+ * Fires event with given `name`, given scope and other parameters.
45
+
46
+ > Arguments
47
+
48
+ - name (string) name of the *event*, dot (`.`) or slash (`/`) separated
49
+ - scope (object) context for the event handlers
50
+ - varargs (...) the rest of arguments will be sent to event handlers
51
+
52
+ = (object) array of returned values from the listeners
53
+ \*/
30
54
  eve = function (name, scope) {
55
+ name = String(name);
31
56
  var e = events,
32
57
  oldstop = stop,
33
58
  args = Array.prototype.slice.call(arguments, 2),
@@ -87,7 +112,20 @@
87
112
  current_event = ce;
88
113
  return out.length ? out : null;
89
114
  };
90
-
115
+ // Undocumented. Debug only.
116
+ eve._events = events;
117
+ /*\
118
+ * eve.listeners
119
+ [ method ]
120
+
121
+ * Internal method which gives you array of all event handlers that will be triggered by the given `name`.
122
+
123
+ > Arguments
124
+
125
+ - name (string) name of the event, dot (`.`) or slash (`/`) separated
126
+
127
+ = (array) array of event handlers
128
+ \*/
91
129
  eve.listeners = function (name) {
92
130
  var names = name.split(separator),
93
131
  e = events,
@@ -120,14 +158,40 @@
120
158
  return out;
121
159
  };
122
160
 
123
-
161
+ /*\
162
+ * eve.on
163
+ [ method ]
164
+ **
165
+ * Binds given event handler with a given name. You can use wildcards “`*`” for the names:
166
+ | eve.on("*.under.*", f);
167
+ | eve("mouse.under.floor"); // triggers f
168
+ * Use @eve to trigger the listener.
169
+ **
170
+ > Arguments
171
+ **
172
+ - name (string) name of the event, dot (`.`) or slash (`/`) separated, with optional wildcards
173
+ - f (function) event handler function
174
+ **
175
+ = (function) returned function accepts a single numeric parameter that represents z-index of the handler. It is an optional feature and only used when you need to ensure that some subset of handlers will be invoked in a given order, despite of the order of assignment.
176
+ > Example:
177
+ | eve.on("mouse", eatIt)(2);
178
+ | eve.on("mouse", scream);
179
+ | eve.on("mouse", catchIt)(1);
180
+ * This will ensure that `catchIt()` function will be called before `eatIt()`.
181
+ *
182
+ * If you want to put your handler before non-indexed handlers, specify a negative value.
183
+ * Note: I assume most of the time you don’t need to worry about z-index, but it’s nice to have this feature “just in case”.
184
+ \*/
124
185
  eve.on = function (name, f) {
186
+ name = String(name);
187
+ if (typeof f != "function") {
188
+ return function () {};
189
+ }
125
190
  var names = name.split(separator),
126
191
  e = events;
127
192
  for (var i = 0, ii = names.length; i < ii; i++) {
128
193
  e = e.n;
129
- !e[names[i]] && (e[names[i]] = {n: {}});
130
- e = e[names[i]];
194
+ e = e.hasOwnProperty(names[i]) && e[names[i]] || (e[names[i]] = {n: {}});
131
195
  }
132
196
  e.f = e.f || [];
133
197
  for (i = 0, ii = e.f.length; i < ii; i++) if (e.f[i] == f) {
@@ -140,20 +204,92 @@
140
204
  }
141
205
  };
142
206
  };
143
-
207
+ /*\
208
+ * eve.f
209
+ [ method ]
210
+ **
211
+ * Returns function that will fire given event with optional arguments.
212
+ * Arguments that will be passed to the result function will be also
213
+ * concated to the list of final arguments.
214
+ | el.onclick = eve.f("click", 1, 2);
215
+ | eve.on("click", function (a, b, c) {
216
+ | console.log(a, b, c); // 1, 2, [event object]
217
+ | });
218
+ > Arguments
219
+ - event (string) event name
220
+ - varargs (…) and any other arguments
221
+ = (function) possible event handler function
222
+ \*/
223
+ eve.f = function (event) {
224
+ var attrs = [].slice.call(arguments, 1);
225
+ return function () {
226
+ eve.apply(null, [event, null].concat(attrs).concat([].slice.call(arguments, 0)));
227
+ };
228
+ };
229
+ /*\
230
+ * eve.stop
231
+ [ method ]
232
+ **
233
+ * Is used inside an event handler to stop the event, preventing any subsequent listeners from firing.
234
+ \*/
144
235
  eve.stop = function () {
145
236
  stop = 1;
146
237
  };
147
-
238
+ /*\
239
+ * eve.nt
240
+ [ method ]
241
+ **
242
+ * Could be used inside event handler to figure out actual name of the event.
243
+ **
244
+ > Arguments
245
+ **
246
+ - subname (string) #optional subname of the event
247
+ **
248
+ = (string) name of the event, if `subname` is not specified
249
+ * or
250
+ = (boolean) `true`, if current event’s name contains `subname`
251
+ \*/
148
252
  eve.nt = function (subname) {
149
253
  if (subname) {
150
254
  return new RegExp("(?:\\.|\\/|^)" + subname + "(?:\\.|\\/|$)").test(current_event);
151
255
  }
152
256
  return current_event;
153
257
  };
154
-
155
-
258
+ /*\
259
+ * eve.nts
260
+ [ method ]
261
+ **
262
+ * Could be used inside event handler to figure out actual name of the event.
263
+ **
264
+ **
265
+ = (array) names of the event
266
+ \*/
267
+ eve.nts = function () {
268
+ return current_event.split(separator);
269
+ };
270
+ /*\
271
+ * eve.off
272
+ [ method ]
273
+ **
274
+ * Removes given function from the list of event listeners assigned to given name.
275
+ * If no arguments specified all the events will be cleared.
276
+ **
277
+ > Arguments
278
+ **
279
+ - name (string) name of the event, dot (`.`) or slash (`/`) separated, with optional wildcards
280
+ - f (function) event handler function
281
+ \*/
282
+ /*\
283
+ * eve.unbind
284
+ [ method ]
285
+ **
286
+ * See @eve.off
287
+ \*/
156
288
  eve.off = eve.unbind = function (name, f) {
289
+ if (!name) {
290
+ eve._events = events = {n: {}};
291
+ return;
292
+ }
157
293
  var names = name.split(separator),
158
294
  e,
159
295
  key,
@@ -205,33 +341,113 @@
205
341
  }
206
342
  }
207
343
  };
208
-
344
+ /*\
345
+ * eve.once
346
+ [ method ]
347
+ **
348
+ * Binds given event handler with a given name to only run once then unbind itself.
349
+ | eve.once("login", f);
350
+ | eve("login"); // triggers f
351
+ | eve("login"); // no listeners
352
+ * Use @eve to trigger the listener.
353
+ **
354
+ > Arguments
355
+ **
356
+ - name (string) name of the event, dot (`.`) or slash (`/`) separated, with optional wildcards
357
+ - f (function) event handler function
358
+ **
359
+ = (function) same return function as @eve.on
360
+ \*/
209
361
  eve.once = function (name, f) {
210
362
  var f2 = function () {
211
- var res = f.apply(this, arguments);
212
363
  eve.unbind(name, f2);
213
- return res;
364
+ return f.apply(this, arguments);
214
365
  };
215
366
  return eve.on(name, f2);
216
367
  };
217
-
368
+ /*\
369
+ * eve.version
370
+ [ property (string) ]
371
+ **
372
+ * Current version of the library.
373
+ \*/
218
374
  eve.version = version;
219
375
  eve.toString = function () {
220
376
  return "You are running Eve " + version;
221
377
  };
222
378
  (typeof module != "undefined" && module.exports) ? (module.exports = eve) : (typeof define != "undefined" ? (define("eve", [], function() { return eve; })) : (glob.eve = eve));
223
379
  })(this);
224
-
225
-
226
380
  // ┌─────────────────────────────────────────────────────────────────────┐ \\
227
- // │ "Raphaël 2.1.0" - JavaScript Vector Library │ \\
381
+ // │ "Raphaël 2.1.2" - JavaScript Vector Library │ \\
228
382
  // ├─────────────────────────────────────────────────────────────────────┤ \\
229
383
  // │ Copyright (c) 2008-2011 Dmitry Baranovskiy (http://raphaeljs.com) │ \\
230
384
  // │ Copyright (c) 2008-2011 Sencha Labs (http://sencha.com) │ \\
231
385
  // │ Licensed under the MIT (http://raphaeljs.com/license.html) license. │ \\
232
386
  // └─────────────────────────────────────────────────────────────────────┘ \\
233
- (function () {
234
-
387
+
388
+ (function (glob, factory) {
389
+ // AMD support
390
+ if (typeof define === "function" && define.amd) {
391
+ // Define as an anonymous module
392
+ define(["eve"], function( eve ) {
393
+ return factory(glob, eve);
394
+ });
395
+ } else {
396
+ // Browser globals (glob is window)
397
+ // Raphael adds itself to window
398
+ factory(glob, glob.eve);
399
+ }
400
+ }(this, function (window, eve) {
401
+ /*\
402
+ * Raphael
403
+ [ method ]
404
+ **
405
+ * Creates a canvas object on which to draw.
406
+ * You must do this first, as all future calls to drawing methods
407
+ * from this instance will be bound to this canvas.
408
+ > Parameters
409
+ **
410
+ - container (HTMLElement|string) DOM element or its ID which is going to be a parent for drawing surface
411
+ - width (number)
412
+ - height (number)
413
+ - callback (function) #optional callback function which is going to be executed in the context of newly created paper
414
+ * or
415
+ - x (number)
416
+ - y (number)
417
+ - width (number)
418
+ - height (number)
419
+ - callback (function) #optional callback function which is going to be executed in the context of newly created paper
420
+ * or
421
+ - all (array) (first 3 or 4 elements in the array are equal to [containerID, width, height] or [x, y, width, height]. The rest are element descriptions in format {type: type, <attributes>}). See @Paper.add.
422
+ - callback (function) #optional callback function which is going to be executed in the context of newly created paper
423
+ * or
424
+ - onReadyCallback (function) function that is going to be called on DOM ready event. You can also subscribe to this event via Eve’s “DOMLoad” event. In this case method returns `undefined`.
425
+ = (object) @Paper
426
+ > Usage
427
+ | // Each of the following examples create a canvas
428
+ | // that is 320px wide by 200px high.
429
+ | // Canvas is created at the viewport’s 10,50 coordinate.
430
+ | var paper = Raphael(10, 50, 320, 200);
431
+ | // Canvas is created at the top left corner of the #notepad element
432
+ | // (or its top right corner in dir="rtl" elements)
433
+ | var paper = Raphael(document.getElementById("notepad"), 320, 200);
434
+ | // Same as above
435
+ | var paper = Raphael("notepad", 320, 200);
436
+ | // Image dump
437
+ | var set = Raphael(["notepad", 320, 200, {
438
+ | type: "rect",
439
+ | x: 10,
440
+ | y: 10,
441
+ | width: 25,
442
+ | height: 25,
443
+ | stroke: "#f00"
444
+ | }, {
445
+ | type: "text",
446
+ | x: 30,
447
+ | y: 40,
448
+ | text: "Dump"
449
+ | }]);
450
+ \*/
235
451
  function R(first) {
236
452
  if (R.is(first, "function")) {
237
453
  return loaded ? first() : eve.on("raphael.DOMload", first);
@@ -249,7 +465,7 @@
249
465
  }
250
466
  }
251
467
  }
252
- R.version = "2.1.0";
468
+ R.version = "2.1.2";
253
469
  R.eve = eve;
254
470
  var loaded,
255
471
  separator = /[, ]+/,
@@ -266,15 +482,45 @@
266
482
  is: g.win.Raphael
267
483
  },
268
484
  Paper = function () {
269
-
270
-
485
+ /*\
486
+ * Paper.ca
487
+ [ property (object) ]
488
+ **
489
+ * Shortcut for @Paper.customAttributes
490
+ \*/
491
+ /*\
492
+ * Paper.customAttributes
493
+ [ property (object) ]
494
+ **
495
+ * If you have a set of attributes that you would like to represent
496
+ * as a function of some number you can do it easily with custom attributes:
497
+ > Usage
498
+ | paper.customAttributes.hue = function (num) {
499
+ | num = num % 1;
500
+ | return {fill: "hsb(" + num + ", 0.75, 1)"};
501
+ | };
502
+ | // Custom attribute “hue” will change fill
503
+ | // to be given hue with fixed saturation and brightness.
504
+ | // Now you can use it like this:
505
+ | var c = paper.circle(10, 10, 10).attr({hue: .45});
506
+ | // or even like this:
507
+ | c.animate({hue: 1}, 1e3);
508
+ |
509
+ | // You could also create custom attribute
510
+ | // with multiple parameters:
511
+ | paper.customAttributes.hsb = function (h, s, b) {
512
+ | return {fill: "hsb(" + [h, s, b].join(",") + ")"};
513
+ | };
514
+ | c.attr({hsb: "0.5 .8 1"});
515
+ | c.animate({hsb: [1, 0, 0.5]}, 1e3);
516
+ \*/
271
517
  this.ca = this.customAttributes = {};
272
518
  },
273
519
  paperproto,
274
520
  appendChild = "appendChild",
275
521
  apply = "apply",
276
522
  concat = "concat",
277
- supportsTouch = "createTouch" in g.doc,
523
+ supportsTouch = ('ontouchstart' in g.win) || g.win.DocumentTouch && g.doc instanceof DocumentTouch, //taken from Modernizr touch test
278
524
  E = "",
279
525
  S = " ",
280
526
  Str = String,
@@ -425,9 +671,22 @@
425
671
  text: function (el) {
426
672
  var bbox = el._getBBox();
427
673
  return rectPath(bbox.x, bbox.y, bbox.width, bbox.height);
674
+ },
675
+ set : function(el) {
676
+ var bbox = el._getBBox();
677
+ return rectPath(bbox.x, bbox.y, bbox.width, bbox.height);
428
678
  }
429
679
  },
430
-
680
+ /*\
681
+ * Raphael.mapPath
682
+ [ method ]
683
+ **
684
+ * Transform the path string with given matrix.
685
+ > Parameters
686
+ - path (string) path string
687
+ - matrix (object) see @Matrix
688
+ = (string) transformed path string
689
+ \*/
431
690
  mapPath = R.mapPath = function (path, matrix) {
432
691
  if (!matrix) {
433
692
  return path;
@@ -447,7 +706,12 @@
447
706
  };
448
707
 
449
708
  R._g = g;
450
-
709
+ /*\
710
+ * Raphael.type
711
+ [ property (string) ]
712
+ **
713
+ * Can be “SVG”, “VML” or empty, depending on browser support.
714
+ \*/
451
715
  R.type = (g.win.SVGAngle || g.doc.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") ? "SVG" : "VML");
452
716
  if (R.type == "VML") {
453
717
  var d = g.doc.createElement("div"),
@@ -460,15 +724,59 @@
460
724
  }
461
725
  d = null;
462
726
  }
463
-
464
-
727
+ /*\
728
+ * Raphael.svg
729
+ [ property (boolean) ]
730
+ **
731
+ * `true` if browser supports SVG.
732
+ \*/
733
+ /*\
734
+ * Raphael.vml
735
+ [ property (boolean) ]
736
+ **
737
+ * `true` if browser supports VML.
738
+ \*/
465
739
  R.svg = !(R.vml = R.type == "VML");
466
740
  R._Paper = Paper;
467
-
741
+ /*\
742
+ * Raphael.fn
743
+ [ property (object) ]
744
+ **
745
+ * You can add your own method to the canvas. For example if you want to draw a pie chart,
746
+ * you can create your own pie chart function and ship it as a Raphaël plugin. To do this
747
+ * you need to extend the `Raphael.fn` object. You should modify the `fn` object before a
748
+ * Raphaël instance is created, otherwise it will take no effect. Please note that the
749
+ * ability for namespaced plugins was removed in Raphael 2.0. It is up to the plugin to
750
+ * ensure any namespacing ensures proper context.
751
+ > Usage
752
+ | Raphael.fn.arrow = function (x1, y1, x2, y2, size) {
753
+ | return this.path( ... );
754
+ | };
755
+ | // or create namespace
756
+ | Raphael.fn.mystuff = {
757
+ | arrow: function () {…},
758
+ | star: function () {…},
759
+ | // etc…
760
+ | };
761
+ | var paper = Raphael(10, 10, 630, 480);
762
+ | // then use it
763
+ | paper.arrow(10, 10, 30, 30, 5).attr({fill: "#f00"});
764
+ | paper.mystuff.arrow();
765
+ | paper.mystuff.star();
766
+ \*/
468
767
  R.fn = paperproto = Paper.prototype = R.prototype;
469
768
  R._id = 0;
470
769
  R._oid = 0;
471
-
770
+ /*\
771
+ * Raphael.is
772
+ [ method ]
773
+ **
774
+ * Handfull replacement for `typeof` operator.
775
+ > Parameters
776
+ - o (…) any object or primitive
777
+ - type (string) name of the type, i.e. “string”, “function”, “number”, etc.
778
+ = (boolean) is given value is of given type
779
+ \*/
472
780
  R.is = function (o, type) {
473
781
  type = lowerCase.call(type);
474
782
  if (type == "finite") {
@@ -485,7 +793,7 @@
485
793
  };
486
794
 
487
795
  function clone(obj) {
488
- if (Object(obj) !== obj) {
796
+ if (typeof obj == "function" || Object(obj) !== obj) {
489
797
  return obj;
490
798
  }
491
799
  var res = new obj.constructor;
@@ -495,7 +803,20 @@
495
803
  return res;
496
804
  }
497
805
 
498
-
806
+ /*\
807
+ * Raphael.angle
808
+ [ method ]
809
+ **
810
+ * Returns angle between two or three points
811
+ > Parameters
812
+ - x1 (number) x coord of first point
813
+ - y1 (number) y coord of first point
814
+ - x2 (number) x coord of second point
815
+ - y2 (number) y coord of second point
816
+ - x3 (number) #optional x coord of third point
817
+ - y3 (number) #optional y coord of third point
818
+ = (number) angle in degrees.
819
+ \*/
499
820
  R.angle = function (x1, y1, x2, y2, x3, y3) {
500
821
  if (x3 == null) {
501
822
  var x = x1 - x2,
@@ -508,15 +829,41 @@
508
829
  return R.angle(x1, y1, x3, y3) - R.angle(x2, y2, x3, y3);
509
830
  }
510
831
  };
511
-
832
+ /*\
833
+ * Raphael.rad
834
+ [ method ]
835
+ **
836
+ * Transform angle to radians
837
+ > Parameters
838
+ - deg (number) angle in degrees
839
+ = (number) angle in radians.
840
+ \*/
512
841
  R.rad = function (deg) {
513
842
  return deg % 360 * PI / 180;
514
843
  };
515
-
844
+ /*\
845
+ * Raphael.deg
846
+ [ method ]
847
+ **
848
+ * Transform angle to degrees
849
+ > Parameters
850
+ - deg (number) angle in radians
851
+ = (number) angle in degrees.
852
+ \*/
516
853
  R.deg = function (rad) {
517
854
  return rad * 180 / PI % 360;
518
855
  };
519
-
856
+ /*\
857
+ * Raphael.snapTo
858
+ [ method ]
859
+ **
860
+ * Snaps given value to given grid.
861
+ > Parameters
862
+ - values (array|number) given array of values or step of the grid
863
+ - value (number) value to adjust
864
+ - tolerance (number) #optional tolerance for snapping. Default is `10`.
865
+ = (number) adjusted value.
866
+ \*/
520
867
  R.snapTo = function (values, value, tolerance) {
521
868
  tolerance = R.is(tolerance, "finite") ? tolerance : 10;
522
869
  if (R.is(values, array)) {
@@ -536,8 +883,13 @@
536
883
  }
537
884
  return value;
538
885
  };
539
-
540
-
886
+
887
+ /*\
888
+ * Raphael.createUUID
889
+ [ method ]
890
+ **
891
+ * Returns RFC4122, version 4 ID
892
+ \*/
541
893
  var createUUID = R.createUUID = (function (uuidRegEx, uuidReplacer) {
542
894
  return function () {
543
895
  return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(uuidRegEx, uuidReplacer).toUpperCase();
@@ -548,7 +900,14 @@
548
900
  return v.toString(16);
549
901
  });
550
902
 
551
-
903
+ /*\
904
+ * Raphael.setWindow
905
+ [ method ]
906
+ **
907
+ * Used when you need to draw in `&lt;iframe>`. Switched window to the iframe one.
908
+ > Parameters
909
+ - newwin (window) new window object
910
+ \*/
552
911
  R.setWindow = function (newwin) {
553
912
  eve("raphael.setWindow", R, g.win, newwin);
554
913
  g.win = newwin;
@@ -619,7 +978,7 @@
619
978
  g /= 255;
620
979
  b /= 255;
621
980
  }
622
-
981
+
623
982
  return [r, g, b];
624
983
  },
625
984
  packageRGB = function (r, g, b, o) {
@@ -636,8 +995,27 @@
636
995
  R.is(o, "finite") && (rgb.opacity = o);
637
996
  return rgb;
638
997
  };
639
-
640
-
998
+
999
+ /*\
1000
+ * Raphael.color
1001
+ [ method ]
1002
+ **
1003
+ * Parses the color string and returns object with all values for the given color.
1004
+ > Parameters
1005
+ - clr (string) color string in one of the supported formats (see @Raphael.getRGB)
1006
+ = (object) Combined RGB & HSB object in format:
1007
+ o {
1008
+ o r (number) red,
1009
+ o g (number) green,
1010
+ o b (number) blue,
1011
+ o hex (string) color in HTML/CSS format: #••••••,
1012
+ o error (boolean) `true` if string can’t be parsed,
1013
+ o h (number) hue,
1014
+ o s (number) saturation,
1015
+ o v (number) value (brightness),
1016
+ o l (number) lightness
1017
+ o }
1018
+ \*/
641
1019
  R.color = function (clr) {
642
1020
  var rgb;
643
1021
  if (R.is(clr, "object") && "h" in clr && "s" in clr && "b" in clr) {
@@ -671,7 +1049,23 @@
671
1049
  clr.toString = rgbtoString;
672
1050
  return clr;
673
1051
  };
674
-
1052
+ /*\
1053
+ * Raphael.hsb2rgb
1054
+ [ method ]
1055
+ **
1056
+ * Converts HSB values to RGB object.
1057
+ > Parameters
1058
+ - h (number) hue
1059
+ - s (number) saturation
1060
+ - v (number) value or brightness
1061
+ = (object) RGB object in format:
1062
+ o {
1063
+ o r (number) red,
1064
+ o g (number) green,
1065
+ o b (number) blue,
1066
+ o hex (string) color in HTML/CSS format: #••••••
1067
+ o }
1068
+ \*/
675
1069
  R.hsb2rgb = function (h, s, v, o) {
676
1070
  if (this.is(h, "object") && "h" in h && "s" in h && "b" in h) {
677
1071
  v = h.b;
@@ -692,7 +1086,23 @@
692
1086
  B += [0, 0, X, C, C, X][h];
693
1087
  return packageRGB(R, G, B, o);
694
1088
  };
695
-
1089
+ /*\
1090
+ * Raphael.hsl2rgb
1091
+ [ method ]
1092
+ **
1093
+ * Converts HSL values to RGB object.
1094
+ > Parameters
1095
+ - h (number) hue
1096
+ - s (number) saturation
1097
+ - l (number) luminosity
1098
+ = (object) RGB object in format:
1099
+ o {
1100
+ o r (number) red,
1101
+ o g (number) green,
1102
+ o b (number) blue,
1103
+ o hex (string) color in HTML/CSS format: #••••••
1104
+ o }
1105
+ \*/
696
1106
  R.hsl2rgb = function (h, s, l, o) {
697
1107
  if (this.is(h, "object") && "h" in h && "s" in h && "l" in h) {
698
1108
  l = h.l;
@@ -717,7 +1127,22 @@
717
1127
  B += [0, 0, X, C, C, X][h];
718
1128
  return packageRGB(R, G, B, o);
719
1129
  };
720
-
1130
+ /*\
1131
+ * Raphael.rgb2hsb
1132
+ [ method ]
1133
+ **
1134
+ * Converts RGB values to HSB object.
1135
+ > Parameters
1136
+ - r (number) red
1137
+ - g (number) green
1138
+ - b (number) blue
1139
+ = (object) HSB object in format:
1140
+ o {
1141
+ o h (number) hue
1142
+ o s (number) saturation
1143
+ o b (number) brightness
1144
+ o }
1145
+ \*/
721
1146
  R.rgb2hsb = function (r, g, b) {
722
1147
  b = prepareRGB(r, g, b);
723
1148
  r = b[0];
@@ -736,7 +1161,22 @@
736
1161
  S = C == 0 ? 0 : C / V;
737
1162
  return {h: H, s: S, b: V, toString: hsbtoString};
738
1163
  };
739
-
1164
+ /*\
1165
+ * Raphael.rgb2hsl
1166
+ [ method ]
1167
+ **
1168
+ * Converts RGB values to HSL object.
1169
+ > Parameters
1170
+ - r (number) red
1171
+ - g (number) green
1172
+ - b (number) blue
1173
+ = (object) HSL object in format:
1174
+ o {
1175
+ o h (number) hue
1176
+ o s (number) saturation
1177
+ o l (number) luminosity
1178
+ o }
1179
+ \*/
740
1180
  R.rgb2hsl = function (r, g, b) {
741
1181
  b = prepareRGB(r, g, b);
742
1182
  r = b[0];
@@ -798,12 +1238,38 @@
798
1238
  g.doc.body.appendChild(img);
799
1239
  img.src = src;
800
1240
  };
801
-
1241
+
802
1242
  function clrToString() {
803
1243
  return this.hex;
804
1244
  }
805
1245
 
806
-
1246
+ /*\
1247
+ * Raphael.getRGB
1248
+ [ method ]
1249
+ **
1250
+ * Parses colour string as RGB object
1251
+ > Parameters
1252
+ - colour (string) colour string in one of formats:
1253
+ # <ul>
1254
+ # <li>Colour name (“<code>red</code>”, “<code>green</code>”, “<code>cornflowerblue</code>”, etc)</li>
1255
+ # <li>#••• — shortened HTML colour: (“<code>#000</code>”, “<code>#fc0</code>”, etc)</li>
1256
+ # <li>#•••••• — full length HTML colour: (“<code>#000000</code>”, “<code>#bd2300</code>”)</li>
1257
+ # <li>rgb(•••, •••, •••) — red, green and blue channels’ values: (“<code>rgb(200,&nbsp;100,&nbsp;0)</code>”)</li>
1258
+ # <li>rgb(•••%, •••%, •••%) — same as above, but in %: (“<code>rgb(100%,&nbsp;175%,&nbsp;0%)</code>”)</li>
1259
+ # <li>hsb(•••, •••, •••) — hue, saturation and brightness values: (“<code>hsb(0.5,&nbsp;0.25,&nbsp;1)</code>”)</li>
1260
+ # <li>hsb(•••%, •••%, •••%) — same as above, but in %</li>
1261
+ # <li>hsl(•••, •••, •••) — same as hsb</li>
1262
+ # <li>hsl(•••%, •••%, •••%) — same as hsb</li>
1263
+ # </ul>
1264
+ = (object) RGB object in format:
1265
+ o {
1266
+ o r (number) red,
1267
+ o g (number) green,
1268
+ o b (number) blue
1269
+ o hex (string) color in HTML/CSS format: #••••••,
1270
+ o error (boolean) true if string can’t be parsed
1271
+ o }
1272
+ \*/
807
1273
  R.getRGB = cacher(function (colour) {
808
1274
  if (!colour || !!((colour = Str(colour)).indexOf("-") + 1)) {
809
1275
  return {r: -1, g: -1, b: -1, hex: "none", error: 1, toString: clrToString};
@@ -875,19 +1341,57 @@
875
1341
  }
876
1342
  return {r: -1, g: -1, b: -1, hex: "none", error: 1, toString: clrToString};
877
1343
  }, R);
878
-
1344
+ /*\
1345
+ * Raphael.hsb
1346
+ [ method ]
1347
+ **
1348
+ * Converts HSB values to hex representation of the colour.
1349
+ > Parameters
1350
+ - h (number) hue
1351
+ - s (number) saturation
1352
+ - b (number) value or brightness
1353
+ = (string) hex representation of the colour.
1354
+ \*/
879
1355
  R.hsb = cacher(function (h, s, b) {
880
1356
  return R.hsb2rgb(h, s, b).hex;
881
1357
  });
882
-
1358
+ /*\
1359
+ * Raphael.hsl
1360
+ [ method ]
1361
+ **
1362
+ * Converts HSL values to hex representation of the colour.
1363
+ > Parameters
1364
+ - h (number) hue
1365
+ - s (number) saturation
1366
+ - l (number) luminosity
1367
+ = (string) hex representation of the colour.
1368
+ \*/
883
1369
  R.hsl = cacher(function (h, s, l) {
884
1370
  return R.hsl2rgb(h, s, l).hex;
885
1371
  });
886
-
1372
+ /*\
1373
+ * Raphael.rgb
1374
+ [ method ]
1375
+ **
1376
+ * Converts RGB values to hex representation of the colour.
1377
+ > Parameters
1378
+ - r (number) red
1379
+ - g (number) green
1380
+ - b (number) blue
1381
+ = (string) hex representation of the colour.
1382
+ \*/
887
1383
  R.rgb = cacher(function (r, g, b) {
888
1384
  return "#" + (16777216 | b | (g << 8) | (r << 16)).toString(16).slice(1);
889
1385
  });
890
-
1386
+ /*\
1387
+ * Raphael.getColor
1388
+ [ method ]
1389
+ **
1390
+ * On each call returns next colour in the spectrum. To reset it back to red call @Raphael.getColor.reset
1391
+ > Parameters
1392
+ - value (number) #optional brightness, default is `0.75`
1393
+ = (string) hex representation of the colour.
1394
+ \*/
891
1395
  R.getColor = function (value) {
892
1396
  var start = this.getColor.start = this.getColor.start || {h: 0, s: 1, b: value || .75},
893
1397
  rgb = this.hsb2rgb(start.h, start.s, start.b);
@@ -899,7 +1403,12 @@
899
1403
  }
900
1404
  return rgb.hex;
901
1405
  };
902
-
1406
+ /*\
1407
+ * Raphael.getColor.reset
1408
+ [ method ]
1409
+ **
1410
+ * Resets spectrum position for @Raphael.getColor back to red.
1411
+ \*/
903
1412
  R.getColor.reset = function () {
904
1413
  delete this.start;
905
1414
  };
@@ -942,7 +1451,17 @@
942
1451
 
943
1452
  return d;
944
1453
  }
945
-
1454
+ /*\
1455
+ * Raphael.parsePathString
1456
+ [ method ]
1457
+ **
1458
+ * Utility method
1459
+ **
1460
+ * Parses given path string into an array of arrays of path segments.
1461
+ > Parameters
1462
+ - pathString (string|array) path string or array of segments (in the last case it will be returned straight away)
1463
+ = (array) array of segments.
1464
+ \*/
946
1465
  R.parsePathString = function (pathString) {
947
1466
  if (!pathString) {
948
1467
  return null;
@@ -951,7 +1470,7 @@
951
1470
  if (pth.arr) {
952
1471
  return pathClone(pth.arr);
953
1472
  }
954
-
1473
+
955
1474
  var paramCounts = {a: 7, c: 6, h: 1, l: 2, m: 2, r: 4, q: 4, s: 4, t: 2, v: 1, z: 0},
956
1475
  data = [];
957
1476
  if (R.is(pathString, array) && R.is(pathString[0], array)) { // rough assumption
@@ -983,7 +1502,17 @@
983
1502
  pth.arr = pathClone(data);
984
1503
  return data;
985
1504
  };
986
-
1505
+ /*\
1506
+ * Raphael.parseTransformString
1507
+ [ method ]
1508
+ **
1509
+ * Utility method
1510
+ **
1511
+ * Parses given path string into an array of transformations.
1512
+ > Parameters
1513
+ - TString (string|array) transform string or array of transformations (in the last case it will be returned straight away)
1514
+ = (array) array of transformations.
1515
+ \*/
987
1516
  R.parseTransformString = cacher(function (TString) {
988
1517
  if (!TString) {
989
1518
  return null;
@@ -1024,7 +1553,46 @@
1024
1553
  });
1025
1554
  return p[ps];
1026
1555
  };
1027
-
1556
+ /*\
1557
+ * Raphael.findDotsAtSegment
1558
+ [ method ]
1559
+ **
1560
+ * Utility method
1561
+ **
1562
+ * Find dot coordinates on the given cubic bezier curve at the given t.
1563
+ > Parameters
1564
+ - p1x (number) x of the first point of the curve
1565
+ - p1y (number) y of the first point of the curve
1566
+ - c1x (number) x of the first anchor of the curve
1567
+ - c1y (number) y of the first anchor of the curve
1568
+ - c2x (number) x of the second anchor of the curve
1569
+ - c2y (number) y of the second anchor of the curve
1570
+ - p2x (number) x of the second point of the curve
1571
+ - p2y (number) y of the second point of the curve
1572
+ - t (number) position on the curve (0..1)
1573
+ = (object) point information in format:
1574
+ o {
1575
+ o x: (number) x coordinate of the point
1576
+ o y: (number) y coordinate of the point
1577
+ o m: {
1578
+ o x: (number) x coordinate of the left anchor
1579
+ o y: (number) y coordinate of the left anchor
1580
+ o }
1581
+ o n: {
1582
+ o x: (number) x coordinate of the right anchor
1583
+ o y: (number) y coordinate of the right anchor
1584
+ o }
1585
+ o start: {
1586
+ o x: (number) x coordinate of the start of the curve
1587
+ o y: (number) y coordinate of the start of the curve
1588
+ o }
1589
+ o end: {
1590
+ o x: (number) x coordinate of the end of the curve
1591
+ o y: (number) y coordinate of the end of the curve
1592
+ o }
1593
+ o alpha: (number) angle of the curve derivative at the point
1594
+ o }
1595
+ \*/
1028
1596
  R.findDotsAtSegment = function (p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t) {
1029
1597
  var t1 = 1 - t,
1030
1598
  t13 = pow(t1, 3),
@@ -1053,7 +1621,36 @@
1053
1621
  alpha: alpha
1054
1622
  };
1055
1623
  };
1056
-
1624
+ /*\
1625
+ * Raphael.bezierBBox
1626
+ [ method ]
1627
+ **
1628
+ * Utility method
1629
+ **
1630
+ * Return bounding box of a given cubic bezier curve
1631
+ > Parameters
1632
+ - p1x (number) x of the first point of the curve
1633
+ - p1y (number) y of the first point of the curve
1634
+ - c1x (number) x of the first anchor of the curve
1635
+ - c1y (number) y of the first anchor of the curve
1636
+ - c2x (number) x of the second anchor of the curve
1637
+ - c2y (number) y of the second anchor of the curve
1638
+ - p2x (number) x of the second point of the curve
1639
+ - p2y (number) y of the second point of the curve
1640
+ * or
1641
+ - bez (array) array of six points for bezier curve
1642
+ = (object) point information in format:
1643
+ o {
1644
+ o min: {
1645
+ o x: (number) x coordinate of the left point
1646
+ o y: (number) y coordinate of the top point
1647
+ o }
1648
+ o max: {
1649
+ o x: (number) x coordinate of the right point
1650
+ o y: (number) y coordinate of the bottom point
1651
+ o }
1652
+ o }
1653
+ \*/
1057
1654
  R.bezierBBox = function (p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y) {
1058
1655
  if (!R.is(p1x, "array")) {
1059
1656
  p1x = [p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y];
@@ -1068,11 +1665,34 @@
1068
1665
  height: bbox.max.y - bbox.min.y
1069
1666
  };
1070
1667
  };
1071
-
1668
+ /*\
1669
+ * Raphael.isPointInsideBBox
1670
+ [ method ]
1671
+ **
1672
+ * Utility method
1673
+ **
1674
+ * Returns `true` if given point is inside bounding boxes.
1675
+ > Parameters
1676
+ - bbox (string) bounding box
1677
+ - x (string) x coordinate of the point
1678
+ - y (string) y coordinate of the point
1679
+ = (boolean) `true` if point inside
1680
+ \*/
1072
1681
  R.isPointInsideBBox = function (bbox, x, y) {
1073
1682
  return x >= bbox.x && x <= bbox.x2 && y >= bbox.y && y <= bbox.y2;
1074
1683
  };
1075
-
1684
+ /*\
1685
+ * Raphael.isBBoxIntersect
1686
+ [ method ]
1687
+ **
1688
+ * Utility method
1689
+ **
1690
+ * Returns `true` if two bounding boxes intersect
1691
+ > Parameters
1692
+ - bbox1 (string) first bounding box
1693
+ - bbox2 (string) second bounding box
1694
+ = (boolean) `true` if they intersect
1695
+ \*/
1076
1696
  R.isBBoxIntersect = function (bbox1, bbox2) {
1077
1697
  var i = R.isPointInsideBBox;
1078
1698
  return i(bbox2, bbox1.x, bbox1.y)
@@ -1175,8 +1795,8 @@
1175
1795
  }
1176
1796
  var l1 = bezlen.apply(0, bez1),
1177
1797
  l2 = bezlen.apply(0, bez2),
1178
- n1 = ~~(l1 / 5),
1179
- n2 = ~~(l2 / 5),
1798
+ n1 = mmax(~~(l1 / 5), 1),
1799
+ n2 = mmax(~~(l2 / 5), 1),
1180
1800
  dots1 = [],
1181
1801
  dots2 = [],
1182
1802
  xy = {},
@@ -1205,15 +1825,15 @@
1205
1825
  xy[is.x.toFixed(4)] = is.y.toFixed(4);
1206
1826
  var t1 = di.t + abs((is[ci] - di[ci]) / (di1[ci] - di[ci])) * (di1.t - di.t),
1207
1827
  t2 = dj.t + abs((is[cj] - dj[cj]) / (dj1[cj] - dj[cj])) * (dj1.t - dj.t);
1208
- if (t1 >= 0 && t1 <= 1 && t2 >= 0 && t2 <= 1) {
1828
+ if (t1 >= 0 && t1 <= 1.001 && t2 >= 0 && t2 <= 1.001) {
1209
1829
  if (justCount) {
1210
1830
  res++;
1211
1831
  } else {
1212
1832
  res.push({
1213
1833
  x: is.x,
1214
1834
  y: is.y,
1215
- t1: t1,
1216
- t2: t2
1835
+ t1: mmin(t1, 1),
1836
+ t2: mmin(t2, 1)
1217
1837
  });
1218
1838
  }
1219
1839
  }
@@ -1222,7 +1842,30 @@
1222
1842
  }
1223
1843
  return res;
1224
1844
  }
1225
-
1845
+ /*\
1846
+ * Raphael.pathIntersection
1847
+ [ method ]
1848
+ **
1849
+ * Utility method
1850
+ **
1851
+ * Finds intersections of two paths
1852
+ > Parameters
1853
+ - path1 (string) path string
1854
+ - path2 (string) path string
1855
+ = (array) dots of intersection
1856
+ o [
1857
+ o {
1858
+ o x: (number) x coordinate of the point
1859
+ o y: (number) y coordinate of the point
1860
+ o t1: (number) t value for segment of path1
1861
+ o t2: (number) t value for segment of path2
1862
+ o segment1: (number) order number for segment of path1
1863
+ o segment2: (number) order number for segment of path2
1864
+ o bez1: (array) eight coordinates representing beziér curve for the segment of path1
1865
+ o bez2: (array) eight coordinates representing beziér curve for the segment of path2
1866
+ o }
1867
+ o ]
1868
+ \*/
1226
1869
  R.pathIntersection = function (path1, path2) {
1227
1870
  return interPathHelper(path1, path2);
1228
1871
  };
@@ -1282,7 +1925,19 @@
1282
1925
  }
1283
1926
  return res;
1284
1927
  }
1285
-
1928
+ /*\
1929
+ * Raphael.isPointInsidePath
1930
+ [ method ]
1931
+ **
1932
+ * Utility method
1933
+ **
1934
+ * Returns `true` if given point is inside a given closed path.
1935
+ > Parameters
1936
+ - path (string) path string
1937
+ - x (number) x of the point
1938
+ - y (number) y of the point
1939
+ = (boolean) true, if point is inside the path
1940
+ \*/
1286
1941
  R.isPointInsidePath = function (path, x, y) {
1287
1942
  var bbox = R.pathBBox(path);
1288
1943
  return R.isPointInsideBBox(bbox, x, y) &&
@@ -1293,17 +1948,37 @@
1293
1948
  eve("raphael.log", null, "Rapha\xebl: you are calling to method \u201c" + methodname + "\u201d of removed object", methodname);
1294
1949
  };
1295
1950
  };
1296
-
1951
+ /*\
1952
+ * Raphael.pathBBox
1953
+ [ method ]
1954
+ **
1955
+ * Utility method
1956
+ **
1957
+ * Return bounding box of a given path
1958
+ > Parameters
1959
+ - path (string) path string
1960
+ = (object) bounding box
1961
+ o {
1962
+ o x: (number) x coordinate of the left top point of the box
1963
+ o y: (number) y coordinate of the left top point of the box
1964
+ o x2: (number) x coordinate of the right bottom point of the box
1965
+ o y2: (number) y coordinate of the right bottom point of the box
1966
+ o width: (number) width of the box
1967
+ o height: (number) height of the box
1968
+ o cx: (number) x coordinate of the center of the box
1969
+ o cy: (number) y coordinate of the center of the box
1970
+ o }
1971
+ \*/
1297
1972
  var pathDimensions = R.pathBBox = function (path) {
1298
1973
  var pth = paths(path);
1299
1974
  if (pth.bbox) {
1300
- return pth.bbox;
1975
+ return clone(pth.bbox);
1301
1976
  }
1302
1977
  if (!path) {
1303
1978
  return {x: 0, y: 0, width: 0, height: 0, x2: 0, y2: 0};
1304
1979
  }
1305
1980
  path = path2curve(path);
1306
- var x = 0,
1981
+ var x = 0,
1307
1982
  y = 0,
1308
1983
  X = [],
1309
1984
  Y = [],
@@ -1327,13 +2002,17 @@
1327
2002
  ymin = mmin[apply](0, Y),
1328
2003
  xmax = mmax[apply](0, X),
1329
2004
  ymax = mmax[apply](0, Y),
1330
- bb = {
2005
+ width = xmax - xmin,
2006
+ height = ymax - ymin,
2007
+ bb = {
1331
2008
  x: xmin,
1332
2009
  y: ymin,
1333
2010
  x2: xmax,
1334
2011
  y2: ymax,
1335
- width: xmax - xmin,
1336
- height: ymax - ymin
2012
+ width: width,
2013
+ height: height,
2014
+ cx: xmin + width / 2,
2015
+ cy: ymin + height / 2
1337
2016
  };
1338
2017
  pth.bbox = clone(bb);
1339
2018
  return bb;
@@ -1682,7 +2361,7 @@
1682
2361
  p2 = path2 && pathToAbsolute(path2),
1683
2362
  attrs = {x: 0, y: 0, bx: 0, by: 0, X: 0, Y: 0, qx: null, qy: null},
1684
2363
  attrs2 = {x: 0, y: 0, bx: 0, by: 0, X: 0, Y: 0, qx: null, qy: null},
1685
- processPath = function (path, d) {
2364
+ processPath = function (path, d, pcom) {
1686
2365
  var nx, ny;
1687
2366
  if (!path) {
1688
2367
  return ["C", d.x, d.y, d.x, d.y, d.x, d.y];
@@ -1697,13 +2376,25 @@
1697
2376
  path = ["C"][concat](a2c[apply](0, [d.x, d.y][concat](path.slice(1))));
1698
2377
  break;
1699
2378
  case "S":
1700
- nx = d.x + (d.x - (d.bx || d.x));
1701
- ny = d.y + (d.y - (d.by || d.y));
2379
+ if (pcom == "C" || pcom == "S") { // In "S" case we have to take into account, if the previous command is C/S.
2380
+ nx = d.x * 2 - d.bx; // And reflect the previous
2381
+ ny = d.y * 2 - d.by; // command's control point relative to the current point.
2382
+ }
2383
+ else { // or some else or nothing
2384
+ nx = d.x;
2385
+ ny = d.y;
2386
+ }
1702
2387
  path = ["C", nx, ny][concat](path.slice(1));
1703
2388
  break;
1704
2389
  case "T":
1705
- d.qx = d.x + (d.x - (d.qx || d.x));
1706
- d.qy = d.y + (d.y - (d.qy || d.y));
2390
+ if (pcom == "Q" || pcom == "T") { // In "T" case we have to take into account, if the previous command is Q/T.
2391
+ d.qx = d.x * 2 - d.qx; // And make a reflection similar
2392
+ d.qy = d.y * 2 - d.qy; // to case "S".
2393
+ }
2394
+ else { // or something else or nothing
2395
+ d.qx = d.x;
2396
+ d.qy = d.y;
2397
+ }
1707
2398
  path = ["C"][concat](q2c(d.x, d.y, d.qx, d.qy, path[1], path[2]));
1708
2399
  break;
1709
2400
  case "Q":
@@ -1851,7 +2542,18 @@
1851
2542
  el2.prev = el;
1852
2543
  el.next = el2;
1853
2544
  },
1854
-
2545
+ /*\
2546
+ * Raphael.toMatrix
2547
+ [ method ]
2548
+ **
2549
+ * Utility method
2550
+ **
2551
+ * Returns matrix of transformations applied to a given path
2552
+ > Parameters
2553
+ - path (string) path string
2554
+ - transform (string|array) transformation string
2555
+ = (object) @Matrix
2556
+ \*/
1855
2557
  toMatrix = R.toMatrix = function (path, transform) {
1856
2558
  var bb = pathDimensions(path),
1857
2559
  el = {
@@ -1865,7 +2567,18 @@
1865
2567
  extractTransform(el, transform);
1866
2568
  return el.matrix;
1867
2569
  },
1868
-
2570
+ /*\
2571
+ * Raphael.transformPath
2572
+ [ method ]
2573
+ **
2574
+ * Utility method
2575
+ **
2576
+ * Returns path transformed by a given transformation
2577
+ > Parameters
2578
+ - path (string) path string
2579
+ - transform (string|array) transformation string
2580
+ = (string) path
2581
+ \*/
1869
2582
  transformPath = R.transformPath = function (path, transform) {
1870
2583
  return mapPath(path, toMatrix(path, transform));
1871
2584
  },
@@ -1945,7 +2658,12 @@
1945
2658
  }
1946
2659
  }
1947
2660
 
1948
-
2661
+ /*\
2662
+ * Element.matrix
2663
+ [ property (object) ]
2664
+ **
2665
+ * Keeps @Matrix object, which represents element transformation
2666
+ \*/
1949
2667
  el.matrix = m;
1950
2668
 
1951
2669
  _.sx = sx;
@@ -2039,12 +2757,47 @@
2039
2757
  height: h
2040
2758
  };
2041
2759
  };
2042
-
2760
+ /*\
2761
+ * Raphael.pathToRelative
2762
+ [ method ]
2763
+ **
2764
+ * Utility method
2765
+ **
2766
+ * Converts path to relative form
2767
+ > Parameters
2768
+ - pathString (string|array) path string or array of segments
2769
+ = (array) array of segments.
2770
+ \*/
2043
2771
  R.pathToRelative = pathToRelative;
2044
2772
  R._engine = {};
2045
-
2773
+ /*\
2774
+ * Raphael.path2curve
2775
+ [ method ]
2776
+ **
2777
+ * Utility method
2778
+ **
2779
+ * Converts path to a new path where all segments are cubic bezier curves.
2780
+ > Parameters
2781
+ - pathString (string|array) path string or array of segments
2782
+ = (array) array of segments.
2783
+ \*/
2046
2784
  R.path2curve = path2curve;
2047
-
2785
+ /*\
2786
+ * Raphael.matrix
2787
+ [ method ]
2788
+ **
2789
+ * Utility method
2790
+ **
2791
+ * Returns matrix based on given parameters.
2792
+ > Parameters
2793
+ - a (number)
2794
+ - b (number)
2795
+ - c (number)
2796
+ - d (number)
2797
+ - e (number)
2798
+ - f (number)
2799
+ = (object) @Matrix
2800
+ \*/
2048
2801
  R.matrix = function (a, b, c, d, e, f) {
2049
2802
  return new Matrix(a, b, c, d, e, f);
2050
2803
  };
@@ -2066,7 +2819,21 @@
2066
2819
  }
2067
2820
  }
2068
2821
  (function (matrixproto) {
2069
-
2822
+ /*\
2823
+ * Matrix.add
2824
+ [ method ]
2825
+ **
2826
+ * Adds given matrix to existing one.
2827
+ > Parameters
2828
+ - a (number)
2829
+ - b (number)
2830
+ - c (number)
2831
+ - d (number)
2832
+ - e (number)
2833
+ - f (number)
2834
+ or
2835
+ - matrix (object) @Matrix
2836
+ \*/
2070
2837
  matrixproto.add = function (a, b, c, d, e, f) {
2071
2838
  var out = [[], [], []],
2072
2839
  m = [[this.a, this.c, this.e], [this.b, this.d, this.f], [0, 0, 1]],
@@ -2093,28 +2860,67 @@
2093
2860
  this.e = out[0][2];
2094
2861
  this.f = out[1][2];
2095
2862
  };
2096
-
2863
+ /*\
2864
+ * Matrix.invert
2865
+ [ method ]
2866
+ **
2867
+ * Returns inverted version of the matrix
2868
+ = (object) @Matrix
2869
+ \*/
2097
2870
  matrixproto.invert = function () {
2098
2871
  var me = this,
2099
2872
  x = me.a * me.d - me.b * me.c;
2100
2873
  return new Matrix(me.d / x, -me.b / x, -me.c / x, me.a / x, (me.c * me.f - me.d * me.e) / x, (me.b * me.e - me.a * me.f) / x);
2101
2874
  };
2102
-
2875
+ /*\
2876
+ * Matrix.clone
2877
+ [ method ]
2878
+ **
2879
+ * Returns copy of the matrix
2880
+ = (object) @Matrix
2881
+ \*/
2103
2882
  matrixproto.clone = function () {
2104
2883
  return new Matrix(this.a, this.b, this.c, this.d, this.e, this.f);
2105
2884
  };
2106
-
2885
+ /*\
2886
+ * Matrix.translate
2887
+ [ method ]
2888
+ **
2889
+ * Translate the matrix
2890
+ > Parameters
2891
+ - x (number)
2892
+ - y (number)
2893
+ \*/
2107
2894
  matrixproto.translate = function (x, y) {
2108
2895
  this.add(1, 0, 0, 1, x, y);
2109
2896
  };
2110
-
2897
+ /*\
2898
+ * Matrix.scale
2899
+ [ method ]
2900
+ **
2901
+ * Scales the matrix
2902
+ > Parameters
2903
+ - x (number)
2904
+ - y (number) #optional
2905
+ - cx (number) #optional
2906
+ - cy (number) #optional
2907
+ \*/
2111
2908
  matrixproto.scale = function (x, y, cx, cy) {
2112
2909
  y == null && (y = x);
2113
2910
  (cx || cy) && this.add(1, 0, 0, 1, cx, cy);
2114
2911
  this.add(x, 0, 0, y, 0, 0);
2115
2912
  (cx || cy) && this.add(1, 0, 0, 1, -cx, -cy);
2116
2913
  };
2117
-
2914
+ /*\
2915
+ * Matrix.rotate
2916
+ [ method ]
2917
+ **
2918
+ * Rotates the matrix
2919
+ > Parameters
2920
+ - a (number)
2921
+ - x (number)
2922
+ - y (number)
2923
+ \*/
2118
2924
  matrixproto.rotate = function (a, x, y) {
2119
2925
  a = R.rad(a);
2120
2926
  x = x || 0;
@@ -2124,11 +2930,29 @@
2124
2930
  this.add(cos, sin, -sin, cos, x, y);
2125
2931
  this.add(1, 0, 0, 1, -x, -y);
2126
2932
  };
2127
-
2933
+ /*\
2934
+ * Matrix.x
2935
+ [ method ]
2936
+ **
2937
+ * Return x coordinate for given point after transformation described by the matrix. See also @Matrix.y
2938
+ > Parameters
2939
+ - x (number)
2940
+ - y (number)
2941
+ = (number) x
2942
+ \*/
2128
2943
  matrixproto.x = function (x, y) {
2129
2944
  return x * this.a + y * this.c + this.e;
2130
2945
  };
2131
-
2946
+ /*\
2947
+ * Matrix.y
2948
+ [ method ]
2949
+ **
2950
+ * Return y coordinate for given point after transformation described by the matrix. See also @Matrix.x
2951
+ > Parameters
2952
+ - x (number)
2953
+ - y (number)
2954
+ = (number) y
2955
+ \*/
2132
2956
  matrixproto.y = function (x, y) {
2133
2957
  return x * this.b + y * this.d + this.f;
2134
2958
  };
@@ -2156,7 +2980,20 @@
2156
2980
  a[0] && (a[0] /= mag);
2157
2981
  a[1] && (a[1] /= mag);
2158
2982
  }
2159
-
2983
+ /*\
2984
+ * Matrix.split
2985
+ [ method ]
2986
+ **
2987
+ * Splits matrix into primitive transformations
2988
+ = (object) in format:
2989
+ o dx (number) translation by x
2990
+ o dy (number) translation by y
2991
+ o scalex (number) scale by x
2992
+ o scaley (number) scale by y
2993
+ o shear (number) shear
2994
+ o rotate (number) rotation in deg
2995
+ o isSimple (boolean) could it be represented via simple transformations
2996
+ \*/
2160
2997
  matrixproto.split = function () {
2161
2998
  var out = {};
2162
2999
  // translation
@@ -2192,14 +3029,20 @@
2192
3029
  out.noRotation = !+out.shear.toFixed(9) && !out.rotate;
2193
3030
  return out;
2194
3031
  };
2195
-
3032
+ /*\
3033
+ * Matrix.toTransformString
3034
+ [ method ]
3035
+ **
3036
+ * Return transform string that represents given matrix
3037
+ = (string) transform string
3038
+ \*/
2196
3039
  matrixproto.toTransformString = function (shorter) {
2197
3040
  var s = shorter || this[split]();
2198
3041
  if (s.isSimple) {
2199
3042
  s.scalex = +s.scalex.toFixed(4);
2200
3043
  s.scaley = +s.scaley.toFixed(4);
2201
3044
  s.rotate = +s.rotate.toFixed(4);
2202
- return (s.dx || s.dy ? "t" + [s.dx, s.dy] : E) +
3045
+ return (s.dx || s.dy ? "t" + [s.dx, s.dy] : E) +
2203
3046
  (s.scalex != 1 || s.scaley != 1 ? "s" + [s.scalex, s.scaley, 0, 0] : E) +
2204
3047
  (s.rotate ? "r" + [s.rotate, 0, 0] : E);
2205
3048
  } else {
@@ -2212,7 +3055,14 @@
2212
3055
  var version = navigator.userAgent.match(/Version\/(.*?)\s/) || navigator.userAgent.match(/Chrome\/(\d+)/);
2213
3056
  if ((navigator.vendor == "Apple Computer, Inc.") && (version && version[1] < 4 || navigator.platform.slice(0, 2) == "iP") ||
2214
3057
  (navigator.vendor == "Google Inc." && version && version[1] < 8)) {
2215
-
3058
+ /*\
3059
+ * Paper.safari
3060
+ [ method ]
3061
+ **
3062
+ * There is an inconvenient rendering bug in Safari (WebKit):
3063
+ * sometimes the rendering should be forced.
3064
+ * This method should help with dealing with this bug.
3065
+ \*/
2216
3066
  paperproto.safari = function () {
2217
3067
  var rect = this.rect(-99, -99, this.width + 99, this.height + 99).attr({stroke: "none"});
2218
3068
  setTimeout(function () {rect.remove();});
@@ -2220,7 +3070,7 @@
2220
3070
  } else {
2221
3071
  paperproto.safari = fun;
2222
3072
  }
2223
-
3073
+
2224
3074
  var preventDefault = function () {
2225
3075
  this.returnValue = false;
2226
3076
  },
@@ -2233,19 +3083,31 @@
2233
3083
  stopTouch = function () {
2234
3084
  return this.originalEvent.stopPropagation();
2235
3085
  },
3086
+ getEventPosition = function (e) {
3087
+ var scrollY = g.doc.documentElement.scrollTop || g.doc.body.scrollTop,
3088
+ scrollX = g.doc.documentElement.scrollLeft || g.doc.body.scrollLeft;
3089
+
3090
+ return {
3091
+ x: e.clientX + scrollX,
3092
+ y: e.clientY + scrollY
3093
+ };
3094
+ },
2236
3095
  addEvent = (function () {
2237
3096
  if (g.doc.addEventListener) {
2238
3097
  return function (obj, type, fn, element) {
2239
- var realName = supportsTouch && touchMap[type] ? touchMap[type] : type,
2240
- f = function (e) {
2241
- var scrollY = g.doc.documentElement.scrollTop || g.doc.body.scrollTop,
2242
- scrollX = g.doc.documentElement.scrollLeft || g.doc.body.scrollLeft,
2243
- x = e.clientX + scrollX,
2244
- y = e.clientY + scrollY;
2245
- if (supportsTouch && touchMap[has](type)) {
3098
+ var f = function (e) {
3099
+ var pos = getEventPosition(e);
3100
+ return fn.call(element, e, pos.x, pos.y);
3101
+ };
3102
+ obj.addEventListener(type, f, false);
3103
+
3104
+ if (supportsTouch && touchMap[type]) {
3105
+ var _f = function (e) {
3106
+ var pos = getEventPosition(e),
3107
+ olde = e;
3108
+
2246
3109
  for (var i = 0, ii = e.targetTouches && e.targetTouches.length; i < ii; i++) {
2247
3110
  if (e.targetTouches[i].target == obj) {
2248
- var olde = e;
2249
3111
  e = e.targetTouches[i];
2250
3112
  e.originalEvent = olde;
2251
3113
  e.preventDefault = preventTouch;
@@ -2253,12 +3115,18 @@
2253
3115
  break;
2254
3116
  }
2255
3117
  }
2256
- }
2257
- return fn.call(element, e, x, y);
2258
- };
2259
- obj.addEventListener(realName, f, false);
3118
+
3119
+ return fn.call(element, e, pos.x, pos.y);
3120
+ };
3121
+ obj.addEventListener(touchMap[type], _f, false);
3122
+ }
3123
+
2260
3124
  return function () {
2261
- obj.removeEventListener(realName, f, false);
3125
+ obj.removeEventListener(type, f, false);
3126
+
3127
+ if (supportsTouch && touchMap[type])
3128
+ obj.removeEventListener(touchMap[type], f, false);
3129
+
2262
3130
  return true;
2263
3131
  };
2264
3132
  };
@@ -2293,7 +3161,7 @@
2293
3161
  j = drag.length;
2294
3162
  while (j--) {
2295
3163
  dragi = drag[j];
2296
- if (supportsTouch) {
3164
+ if (supportsTouch && e.touches) {
2297
3165
  var i = e.touches.length,
2298
3166
  touch;
2299
3167
  while (i--) {
@@ -2335,40 +3203,229 @@
2335
3203
  }
2336
3204
  drag = [];
2337
3205
  },
2338
-
3206
+ /*\
3207
+ * Raphael.el
3208
+ [ property (object) ]
3209
+ **
3210
+ * You can add your own method to elements. This is usefull when you want to hack default functionality or
3211
+ * want to wrap some common transformation or attributes in one method. In difference to canvas methods,
3212
+ * you can redefine element method at any time. Expending element methods wouldn’t affect set.
3213
+ > Usage
3214
+ | Raphael.el.red = function () {
3215
+ | this.attr({fill: "#f00"});
3216
+ | };
3217
+ | // then use it
3218
+ | paper.circle(100, 100, 20).red();
3219
+ \*/
2339
3220
  elproto = R.el = {};
2340
-
2341
-
2342
-
2343
-
2344
-
2345
-
2346
-
2347
-
2348
-
2349
-
2350
-
2351
-
2352
-
2353
-
2354
-
2355
-
2356
-
2357
-
2358
-
2359
-
2360
-
2361
-
2362
-
2363
-
2364
-
2365
-
2366
-
2367
-
2368
-
2369
-
2370
-
2371
-
3221
+ /*\
3222
+ * Element.click
3223
+ [ method ]
3224
+ **
3225
+ * Adds event handler for click for the element.
3226
+ > Parameters
3227
+ - handler (function) handler for the event
3228
+ = (object) @Element
3229
+ \*/
3230
+ /*\
3231
+ * Element.unclick
3232
+ [ method ]
3233
+ **
3234
+ * Removes event handler for click for the element.
3235
+ > Parameters
3236
+ - handler (function) #optional handler for the event
3237
+ = (object) @Element
3238
+ \*/
3239
+
3240
+ /*\
3241
+ * Element.dblclick
3242
+ [ method ]
3243
+ **
3244
+ * Adds event handler for double click for the element.
3245
+ > Parameters
3246
+ - handler (function) handler for the event
3247
+ = (object) @Element
3248
+ \*/
3249
+ /*\
3250
+ * Element.undblclick
3251
+ [ method ]
3252
+ **
3253
+ * Removes event handler for double click for the element.
3254
+ > Parameters
3255
+ - handler (function) #optional handler for the event
3256
+ = (object) @Element
3257
+ \*/
3258
+
3259
+ /*\
3260
+ * Element.mousedown
3261
+ [ method ]
3262
+ **
3263
+ * Adds event handler for mousedown for the element.
3264
+ > Parameters
3265
+ - handler (function) handler for the event
3266
+ = (object) @Element
3267
+ \*/
3268
+ /*\
3269
+ * Element.unmousedown
3270
+ [ method ]
3271
+ **
3272
+ * Removes event handler for mousedown for the element.
3273
+ > Parameters
3274
+ - handler (function) #optional handler for the event
3275
+ = (object) @Element
3276
+ \*/
3277
+
3278
+ /*\
3279
+ * Element.mousemove
3280
+ [ method ]
3281
+ **
3282
+ * Adds event handler for mousemove for the element.
3283
+ > Parameters
3284
+ - handler (function) handler for the event
3285
+ = (object) @Element
3286
+ \*/
3287
+ /*\
3288
+ * Element.unmousemove
3289
+ [ method ]
3290
+ **
3291
+ * Removes event handler for mousemove for the element.
3292
+ > Parameters
3293
+ - handler (function) #optional handler for the event
3294
+ = (object) @Element
3295
+ \*/
3296
+
3297
+ /*\
3298
+ * Element.mouseout
3299
+ [ method ]
3300
+ **
3301
+ * Adds event handler for mouseout for the element.
3302
+ > Parameters
3303
+ - handler (function) handler for the event
3304
+ = (object) @Element
3305
+ \*/
3306
+ /*\
3307
+ * Element.unmouseout
3308
+ [ method ]
3309
+ **
3310
+ * Removes event handler for mouseout for the element.
3311
+ > Parameters
3312
+ - handler (function) #optional handler for the event
3313
+ = (object) @Element
3314
+ \*/
3315
+
3316
+ /*\
3317
+ * Element.mouseover
3318
+ [ method ]
3319
+ **
3320
+ * Adds event handler for mouseover for the element.
3321
+ > Parameters
3322
+ - handler (function) handler for the event
3323
+ = (object) @Element
3324
+ \*/
3325
+ /*\
3326
+ * Element.unmouseover
3327
+ [ method ]
3328
+ **
3329
+ * Removes event handler for mouseover for the element.
3330
+ > Parameters
3331
+ - handler (function) #optional handler for the event
3332
+ = (object) @Element
3333
+ \*/
3334
+
3335
+ /*\
3336
+ * Element.mouseup
3337
+ [ method ]
3338
+ **
3339
+ * Adds event handler for mouseup for the element.
3340
+ > Parameters
3341
+ - handler (function) handler for the event
3342
+ = (object) @Element
3343
+ \*/
3344
+ /*\
3345
+ * Element.unmouseup
3346
+ [ method ]
3347
+ **
3348
+ * Removes event handler for mouseup for the element.
3349
+ > Parameters
3350
+ - handler (function) #optional handler for the event
3351
+ = (object) @Element
3352
+ \*/
3353
+
3354
+ /*\
3355
+ * Element.touchstart
3356
+ [ method ]
3357
+ **
3358
+ * Adds event handler for touchstart for the element.
3359
+ > Parameters
3360
+ - handler (function) handler for the event
3361
+ = (object) @Element
3362
+ \*/
3363
+ /*\
3364
+ * Element.untouchstart
3365
+ [ method ]
3366
+ **
3367
+ * Removes event handler for touchstart for the element.
3368
+ > Parameters
3369
+ - handler (function) #optional handler for the event
3370
+ = (object) @Element
3371
+ \*/
3372
+
3373
+ /*\
3374
+ * Element.touchmove
3375
+ [ method ]
3376
+ **
3377
+ * Adds event handler for touchmove for the element.
3378
+ > Parameters
3379
+ - handler (function) handler for the event
3380
+ = (object) @Element
3381
+ \*/
3382
+ /*\
3383
+ * Element.untouchmove
3384
+ [ method ]
3385
+ **
3386
+ * Removes event handler for touchmove for the element.
3387
+ > Parameters
3388
+ - handler (function) #optional handler for the event
3389
+ = (object) @Element
3390
+ \*/
3391
+
3392
+ /*\
3393
+ * Element.touchend
3394
+ [ method ]
3395
+ **
3396
+ * Adds event handler for touchend for the element.
3397
+ > Parameters
3398
+ - handler (function) handler for the event
3399
+ = (object) @Element
3400
+ \*/
3401
+ /*\
3402
+ * Element.untouchend
3403
+ [ method ]
3404
+ **
3405
+ * Removes event handler for touchend for the element.
3406
+ > Parameters
3407
+ - handler (function) #optional handler for the event
3408
+ = (object) @Element
3409
+ \*/
3410
+
3411
+ /*\
3412
+ * Element.touchcancel
3413
+ [ method ]
3414
+ **
3415
+ * Adds event handler for touchcancel for the element.
3416
+ > Parameters
3417
+ - handler (function) handler for the event
3418
+ = (object) @Element
3419
+ \*/
3420
+ /*\
3421
+ * Element.untouchcancel
3422
+ [ method ]
3423
+ **
3424
+ * Removes event handler for touchcancel for the element.
3425
+ > Parameters
3426
+ - handler (function) #optional handler for the event
3427
+ = (object) @Element
3428
+ \*/
2372
3429
  for (var i = events.length; i--;) {
2373
3430
  (function (eventName) {
2374
3431
  R[eventName] = elproto[eventName] = function (fn, scope) {
@@ -2381,20 +3438,48 @@
2381
3438
  R["un" + eventName] = elproto["un" + eventName] = function (fn) {
2382
3439
  var events = this.events || [],
2383
3440
  l = events.length;
2384
- while (l--) if (events[l].name == eventName && events[l].f == fn) {
2385
- events[l].unbind();
2386
- events.splice(l, 1);
2387
- !events.length && delete this.events;
2388
- return this;
3441
+ while (l--){
3442
+ if (events[l].name == eventName && (R.is(fn, "undefined") || events[l].f == fn)) {
3443
+ events[l].unbind();
3444
+ events.splice(l, 1);
3445
+ !events.length && delete this.events;
3446
+ }
2389
3447
  }
2390
3448
  return this;
2391
3449
  };
2392
3450
  })(events[i]);
2393
3451
  }
2394
-
2395
-
3452
+
3453
+ /*\
3454
+ * Element.data
3455
+ [ method ]
3456
+ **
3457
+ * Adds or retrieves given value asociated with given key.
3458
+ **
3459
+ * See also @Element.removeData
3460
+ > Parameters
3461
+ - key (string) key to store data
3462
+ - value (any) #optional value to store
3463
+ = (object) @Element
3464
+ * or, if value is not specified:
3465
+ = (any) value
3466
+ * or, if key and value are not specified:
3467
+ = (object) Key/value pairs for all the data associated with the element.
3468
+ > Usage
3469
+ | for (var i = 0, i < 5, i++) {
3470
+ | paper.circle(10 + 15 * i, 10, 10)
3471
+ | .attr({fill: "#000"})
3472
+ | .data("i", i)
3473
+ | .click(function () {
3474
+ | alert(this.data("i"));
3475
+ | });
3476
+ | }
3477
+ \*/
2396
3478
  elproto.data = function (key, value) {
2397
3479
  var data = eldata[this.id] = eldata[this.id] || {};
3480
+ if (arguments.length == 0) {
3481
+ return data;
3482
+ }
2398
3483
  if (arguments.length == 1) {
2399
3484
  if (R.is(key, "object")) {
2400
3485
  for (var i in key) if (key[has](i)) {
@@ -2409,7 +3494,16 @@
2409
3494
  eve("raphael.data.set." + this.id, this, value, key);
2410
3495
  return this;
2411
3496
  };
2412
-
3497
+ /*\
3498
+ * Element.removeData
3499
+ [ method ]
3500
+ **
3501
+ * Removes value associated with an element by given key.
3502
+ * If key is not provided, removes all the data of the element.
3503
+ > Parameters
3504
+ - key (string) #optional key
3505
+ = (object) @Element
3506
+ \*/
2413
3507
  elproto.removeData = function (key) {
2414
3508
  if (key == null) {
2415
3509
  eldata[this.id] = {};
@@ -2418,24 +3512,97 @@
2418
3512
  }
2419
3513
  return this;
2420
3514
  };
2421
-
3515
+ /*\
3516
+ * Element.getData
3517
+ [ method ]
3518
+ **
3519
+ * Retrieves the element data
3520
+ = (object) data
3521
+ \*/
3522
+ elproto.getData = function () {
3523
+ return clone(eldata[this.id] || {});
3524
+ };
3525
+ /*\
3526
+ * Element.hover
3527
+ [ method ]
3528
+ **
3529
+ * Adds event handlers for hover for the element.
3530
+ > Parameters
3531
+ - f_in (function) handler for hover in
3532
+ - f_out (function) handler for hover out
3533
+ - icontext (object) #optional context for hover in handler
3534
+ - ocontext (object) #optional context for hover out handler
3535
+ = (object) @Element
3536
+ \*/
2422
3537
  elproto.hover = function (f_in, f_out, scope_in, scope_out) {
2423
3538
  return this.mouseover(f_in, scope_in).mouseout(f_out, scope_out || scope_in);
2424
3539
  };
2425
-
3540
+ /*\
3541
+ * Element.unhover
3542
+ [ method ]
3543
+ **
3544
+ * Removes event handlers for hover for the element.
3545
+ > Parameters
3546
+ - f_in (function) handler for hover in
3547
+ - f_out (function) handler for hover out
3548
+ = (object) @Element
3549
+ \*/
2426
3550
  elproto.unhover = function (f_in, f_out) {
2427
3551
  return this.unmouseover(f_in).unmouseout(f_out);
2428
3552
  };
2429
3553
  var draggable = [];
2430
-
3554
+ /*\
3555
+ * Element.drag
3556
+ [ method ]
3557
+ **
3558
+ * Adds event handlers for drag of the element.
3559
+ > Parameters
3560
+ - onmove (function) handler for moving
3561
+ - onstart (function) handler for drag start
3562
+ - onend (function) handler for drag end
3563
+ - mcontext (object) #optional context for moving handler
3564
+ - scontext (object) #optional context for drag start handler
3565
+ - econtext (object) #optional context for drag end handler
3566
+ * Additionaly following `drag` events will be triggered: `drag.start.<id>` on start,
3567
+ * `drag.end.<id>` on end and `drag.move.<id>` on every move. When element will be dragged over another element
3568
+ * `drag.over.<id>` will be fired as well.
3569
+ *
3570
+ * Start event and start handler will be called in specified context or in context of the element with following parameters:
3571
+ o x (number) x position of the mouse
3572
+ o y (number) y position of the mouse
3573
+ o event (object) DOM event object
3574
+ * Move event and move handler will be called in specified context or in context of the element with following parameters:
3575
+ o dx (number) shift by x from the start point
3576
+ o dy (number) shift by y from the start point
3577
+ o x (number) x position of the mouse
3578
+ o y (number) y position of the mouse
3579
+ o event (object) DOM event object
3580
+ * End event and end handler will be called in specified context or in context of the element with following parameters:
3581
+ o event (object) DOM event object
3582
+ = (object) @Element
3583
+ \*/
2431
3584
  elproto.drag = function (onmove, onstart, onend, move_scope, start_scope, end_scope) {
2432
3585
  function start(e) {
2433
3586
  (e.originalEvent || e).preventDefault();
2434
- var scrollY = g.doc.documentElement.scrollTop || g.doc.body.scrollTop,
3587
+ var x = e.clientX,
3588
+ y = e.clientY,
3589
+ scrollY = g.doc.documentElement.scrollTop || g.doc.body.scrollTop,
2435
3590
  scrollX = g.doc.documentElement.scrollLeft || g.doc.body.scrollLeft;
2436
- this._drag.x = e.clientX + scrollX;
2437
- this._drag.y = e.clientY + scrollY;
2438
3591
  this._drag.id = e.identifier;
3592
+ if (supportsTouch && e.touches) {
3593
+ var i = e.touches.length, touch;
3594
+ while (i--) {
3595
+ touch = e.touches[i];
3596
+ this._drag.id = touch.identifier;
3597
+ if (touch.identifier == this._drag.id) {
3598
+ x = touch.clientX;
3599
+ y = touch.clientY;
3600
+ break;
3601
+ }
3602
+ }
3603
+ }
3604
+ this._drag.x = x + scrollX;
3605
+ this._drag.y = y + scrollY;
2439
3606
  !drag.length && R.mousemove(dragMove).mouseup(dragUp);
2440
3607
  drag.push({el: this, move_scope: move_scope, start_scope: start_scope, end_scope: end_scope});
2441
3608
  onstart && eve.on("raphael.drag.start." + this.id, onstart);
@@ -2448,11 +3615,23 @@
2448
3615
  this.mousedown(start);
2449
3616
  return this;
2450
3617
  };
2451
-
3618
+ /*\
3619
+ * Element.onDragOver
3620
+ [ method ]
3621
+ **
3622
+ * Shortcut for assigning event handler for `drag.over.<id>` event, where id is id of the element (see @Element.id).
3623
+ > Parameters
3624
+ - f (function) handler for event, first argument would be the element you are dragging over
3625
+ \*/
2452
3626
  elproto.onDragOver = function (f) {
2453
3627
  f ? eve.on("raphael.drag.over." + this.id, f) : eve.unbind("raphael.drag.over." + this.id);
2454
3628
  };
2455
-
3629
+ /*\
3630
+ * Element.undrag
3631
+ [ method ]
3632
+ **
3633
+ * Removes all drag event handlers from given element.
3634
+ \*/
2456
3635
  elproto.undrag = function () {
2457
3636
  var i = draggable.length;
2458
3637
  while (i--) if (draggable[i].el == this) {
@@ -2461,73 +3640,265 @@
2461
3640
  eve.unbind("raphael.drag.*." + this.id);
2462
3641
  }
2463
3642
  !draggable.length && R.unmousemove(dragMove).unmouseup(dragUp);
3643
+ drag = [];
2464
3644
  };
2465
-
3645
+ /*\
3646
+ * Paper.circle
3647
+ [ method ]
3648
+ **
3649
+ * Draws a circle.
3650
+ **
3651
+ > Parameters
3652
+ **
3653
+ - x (number) x coordinate of the centre
3654
+ - y (number) y coordinate of the centre
3655
+ - r (number) radius
3656
+ = (object) Raphaël element object with type “circle”
3657
+ **
3658
+ > Usage
3659
+ | var c = paper.circle(50, 50, 40);
3660
+ \*/
2466
3661
  paperproto.circle = function (x, y, r) {
2467
3662
  var out = R._engine.circle(this, x || 0, y || 0, r || 0);
2468
3663
  this.__set__ && this.__set__.push(out);
2469
3664
  return out;
2470
3665
  };
2471
-
3666
+ /*\
3667
+ * Paper.rect
3668
+ [ method ]
3669
+ *
3670
+ * Draws a rectangle.
3671
+ **
3672
+ > Parameters
3673
+ **
3674
+ - x (number) x coordinate of the top left corner
3675
+ - y (number) y coordinate of the top left corner
3676
+ - width (number) width
3677
+ - height (number) height
3678
+ - r (number) #optional radius for rounded corners, default is 0
3679
+ = (object) Raphaël element object with type “rect”
3680
+ **
3681
+ > Usage
3682
+ | // regular rectangle
3683
+ | var c = paper.rect(10, 10, 50, 50);
3684
+ | // rectangle with rounded corners
3685
+ | var c = paper.rect(40, 40, 50, 50, 10);
3686
+ \*/
2472
3687
  paperproto.rect = function (x, y, w, h, r) {
2473
3688
  var out = R._engine.rect(this, x || 0, y || 0, w || 0, h || 0, r || 0);
2474
3689
  this.__set__ && this.__set__.push(out);
2475
3690
  return out;
2476
3691
  };
2477
-
3692
+ /*\
3693
+ * Paper.ellipse
3694
+ [ method ]
3695
+ **
3696
+ * Draws an ellipse.
3697
+ **
3698
+ > Parameters
3699
+ **
3700
+ - x (number) x coordinate of the centre
3701
+ - y (number) y coordinate of the centre
3702
+ - rx (number) horizontal radius
3703
+ - ry (number) vertical radius
3704
+ = (object) Raphaël element object with type “ellipse”
3705
+ **
3706
+ > Usage
3707
+ | var c = paper.ellipse(50, 50, 40, 20);
3708
+ \*/
2478
3709
  paperproto.ellipse = function (x, y, rx, ry) {
2479
3710
  var out = R._engine.ellipse(this, x || 0, y || 0, rx || 0, ry || 0);
2480
3711
  this.__set__ && this.__set__.push(out);
2481
3712
  return out;
2482
3713
  };
2483
-
3714
+ /*\
3715
+ * Paper.path
3716
+ [ method ]
3717
+ **
3718
+ * Creates a path element by given path data string.
3719
+ > Parameters
3720
+ - pathString (string) #optional path string in SVG format.
3721
+ * Path string consists of one-letter commands, followed by comma seprarated arguments in numercal form. Example:
3722
+ | "M10,20L30,40"
3723
+ * Here we can see two commands: “M”, with arguments `(10, 20)` and “L” with arguments `(30, 40)`. Upper case letter mean command is absolute, lower case—relative.
3724
+ *
3725
+ # <p>Here is short list of commands available, for more details see <a href="http://www.w3.org/TR/SVG/paths.html#PathData" title="Details of a path's data attribute's format are described in the SVG specification.">SVG path string format</a>.</p>
3726
+ # <table><thead><tr><th>Command</th><th>Name</th><th>Parameters</th></tr></thead><tbody>
3727
+ # <tr><td>M</td><td>moveto</td><td>(x y)+</td></tr>
3728
+ # <tr><td>Z</td><td>closepath</td><td>(none)</td></tr>
3729
+ # <tr><td>L</td><td>lineto</td><td>(x y)+</td></tr>
3730
+ # <tr><td>H</td><td>horizontal lineto</td><td>x+</td></tr>
3731
+ # <tr><td>V</td><td>vertical lineto</td><td>y+</td></tr>
3732
+ # <tr><td>C</td><td>curveto</td><td>(x1 y1 x2 y2 x y)+</td></tr>
3733
+ # <tr><td>S</td><td>smooth curveto</td><td>(x2 y2 x y)+</td></tr>
3734
+ # <tr><td>Q</td><td>quadratic Bézier curveto</td><td>(x1 y1 x y)+</td></tr>
3735
+ # <tr><td>T</td><td>smooth quadratic Bézier curveto</td><td>(x y)+</td></tr>
3736
+ # <tr><td>A</td><td>elliptical arc</td><td>(rx ry x-axis-rotation large-arc-flag sweep-flag x y)+</td></tr>
3737
+ # <tr><td>R</td><td><a href="http://en.wikipedia.org/wiki/Catmull–Rom_spline#Catmull.E2.80.93Rom_spline">Catmull-Rom curveto</a>*</td><td>x1 y1 (x y)+</td></tr></tbody></table>
3738
+ * * “Catmull-Rom curveto” is a not standard SVG command and added in 2.0 to make life easier.
3739
+ * Note: there is a special case when path consist of just three commands: “M10,10R…z”. In this case path will smoothly connects to its beginning.
3740
+ > Usage
3741
+ | var c = paper.path("M10 10L90 90");
3742
+ | // draw a diagonal line:
3743
+ | // move to 10,10, line to 90,90
3744
+ * For example of path strings, check out these icons: http://raphaeljs.com/icons/
3745
+ \*/
2484
3746
  paperproto.path = function (pathString) {
2485
3747
  pathString && !R.is(pathString, string) && !R.is(pathString[0], array) && (pathString += E);
2486
3748
  var out = R._engine.path(R.format[apply](R, arguments), this);
2487
3749
  this.__set__ && this.__set__.push(out);
2488
3750
  return out;
2489
3751
  };
2490
-
3752
+ /*\
3753
+ * Paper.image
3754
+ [ method ]
3755
+ **
3756
+ * Embeds an image into the surface.
3757
+ **
3758
+ > Parameters
3759
+ **
3760
+ - src (string) URI of the source image
3761
+ - x (number) x coordinate position
3762
+ - y (number) y coordinate position
3763
+ - width (number) width of the image
3764
+ - height (number) height of the image
3765
+ = (object) Raphaël element object with type “image”
3766
+ **
3767
+ > Usage
3768
+ | var c = paper.image("apple.png", 10, 10, 80, 80);
3769
+ \*/
2491
3770
  paperproto.image = function (src, x, y, w, h) {
2492
3771
  var out = R._engine.image(this, src || "about:blank", x || 0, y || 0, w || 0, h || 0);
2493
3772
  this.__set__ && this.__set__.push(out);
2494
3773
  return out;
2495
3774
  };
2496
-
3775
+ /*\
3776
+ * Paper.text
3777
+ [ method ]
3778
+ **
3779
+ * Draws a text string. If you need line breaks, put “\n” in the string.
3780
+ **
3781
+ > Parameters
3782
+ **
3783
+ - x (number) x coordinate position
3784
+ - y (number) y coordinate position
3785
+ - text (string) The text string to draw
3786
+ = (object) Raphaël element object with type “text”
3787
+ **
3788
+ > Usage
3789
+ | var t = paper.text(50, 50, "Raphaël\nkicks\nbutt!");
3790
+ \*/
2497
3791
  paperproto.text = function (x, y, text) {
2498
3792
  var out = R._engine.text(this, x || 0, y || 0, Str(text));
2499
3793
  this.__set__ && this.__set__.push(out);
2500
3794
  return out;
2501
3795
  };
2502
-
3796
+ /*\
3797
+ * Paper.set
3798
+ [ method ]
3799
+ **
3800
+ * Creates array-like object to keep and operate several elements at once.
3801
+ * Warning: it doesn’t create any elements for itself in the page, it just groups existing elements.
3802
+ * Sets act as pseudo elements — all methods available to an element can be used on a set.
3803
+ = (object) array-like object that represents set of elements
3804
+ **
3805
+ > Usage
3806
+ | var st = paper.set();
3807
+ | st.push(
3808
+ | paper.circle(10, 10, 5),
3809
+ | paper.circle(30, 10, 5)
3810
+ | );
3811
+ | st.attr({fill: "red"}); // changes the fill of both circles
3812
+ \*/
2503
3813
  paperproto.set = function (itemsArray) {
2504
3814
  !R.is(itemsArray, "array") && (itemsArray = Array.prototype.splice.call(arguments, 0, arguments.length));
2505
3815
  var out = new Set(itemsArray);
2506
3816
  this.__set__ && this.__set__.push(out);
3817
+ out["paper"] = this;
3818
+ out["type"] = "set";
2507
3819
  return out;
2508
3820
  };
2509
-
3821
+ /*\
3822
+ * Paper.setStart
3823
+ [ method ]
3824
+ **
3825
+ * Creates @Paper.set. All elements that will be created after calling this method and before calling
3826
+ * @Paper.setFinish will be added to the set.
3827
+ **
3828
+ > Usage
3829
+ | paper.setStart();
3830
+ | paper.circle(10, 10, 5),
3831
+ | paper.circle(30, 10, 5)
3832
+ | var st = paper.setFinish();
3833
+ | st.attr({fill: "red"}); // changes the fill of both circles
3834
+ \*/
2510
3835
  paperproto.setStart = function (set) {
2511
3836
  this.__set__ = set || this.set();
2512
3837
  };
2513
-
3838
+ /*\
3839
+ * Paper.setFinish
3840
+ [ method ]
3841
+ **
3842
+ * See @Paper.setStart. This method finishes catching and returns resulting set.
3843
+ **
3844
+ = (object) set
3845
+ \*/
2514
3846
  paperproto.setFinish = function (set) {
2515
3847
  var out = this.__set__;
2516
3848
  delete this.__set__;
2517
3849
  return out;
2518
3850
  };
2519
-
3851
+ /*\
3852
+ * Paper.setSize
3853
+ [ method ]
3854
+ **
3855
+ * If you need to change dimensions of the canvas call this method
3856
+ **
3857
+ > Parameters
3858
+ **
3859
+ - width (number) new width of the canvas
3860
+ - height (number) new height of the canvas
3861
+ \*/
2520
3862
  paperproto.setSize = function (width, height) {
2521
3863
  return R._engine.setSize.call(this, width, height);
2522
3864
  };
2523
-
3865
+ /*\
3866
+ * Paper.setViewBox
3867
+ [ method ]
3868
+ **
3869
+ * Sets the view box of the paper. Practically it gives you ability to zoom and pan whole paper surface by
3870
+ * specifying new boundaries.
3871
+ **
3872
+ > Parameters
3873
+ **
3874
+ - x (number) new x position, default is `0`
3875
+ - y (number) new y position, default is `0`
3876
+ - w (number) new width of the canvas
3877
+ - h (number) new height of the canvas
3878
+ - fit (boolean) `true` if you want graphics to fit into new boundary box
3879
+ \*/
2524
3880
  paperproto.setViewBox = function (x, y, w, h, fit) {
2525
3881
  return R._engine.setViewBox.call(this, x, y, w, h, fit);
2526
3882
  };
2527
-
2528
-
3883
+ /*\
3884
+ * Paper.top
3885
+ [ property ]
3886
+ **
3887
+ * Points to the topmost element on the paper
3888
+ \*/
3889
+ /*\
3890
+ * Paper.bottom
3891
+ [ property ]
3892
+ **
3893
+ * Points to the bottom element on the paper
3894
+ \*/
2529
3895
  paperproto.top = paperproto.bottom = null;
2530
-
3896
+ /*\
3897
+ * Paper.raphael
3898
+ [ property ]
3899
+ **
3900
+ * Points to the @Raphael object/function
3901
+ \*/
2531
3902
  paperproto.raphael = R;
2532
3903
  var getOffset = function (elem) {
2533
3904
  var box = elem.getBoundingClientRect(),
@@ -2542,7 +3913,20 @@
2542
3913
  x: left
2543
3914
  };
2544
3915
  };
2545
-
3916
+ /*\
3917
+ * Paper.getElementByPoint
3918
+ [ method ]
3919
+ **
3920
+ * Returns you topmost element under given point.
3921
+ **
3922
+ = (object) Raphaël element object
3923
+ > Parameters
3924
+ **
3925
+ - x (number) x coordinate from the top left corner of the window
3926
+ - y (number) y coordinate from the top left corner of the window
3927
+ > Usage
3928
+ | paper.getElementByPoint(mouseX, mouseY).attr({stroke: "#f00"});
3929
+ \*/
2546
3930
  paperproto.getElementByPoint = function (x, y) {
2547
3931
  var paper = this,
2548
3932
  svg = paper.canvas,
@@ -2568,7 +3952,39 @@
2568
3952
  target = target && target.raphael ? paper.getById(target.raphaelid) : null;
2569
3953
  return target;
2570
3954
  };
2571
-
3955
+
3956
+ /*\
3957
+ * Paper.getElementsByBBox
3958
+ [ method ]
3959
+ **
3960
+ * Returns set of elements that have an intersecting bounding box
3961
+ **
3962
+ > Parameters
3963
+ **
3964
+ - bbox (object) bbox to check with
3965
+ = (object) @Set
3966
+ \*/
3967
+ paperproto.getElementsByBBox = function (bbox) {
3968
+ var set = this.set();
3969
+ this.forEach(function (el) {
3970
+ if (R.isBBoxIntersect(el.getBBox(), bbox)) {
3971
+ set.push(el);
3972
+ }
3973
+ });
3974
+ return set;
3975
+ };
3976
+
3977
+ /*\
3978
+ * Paper.getById
3979
+ [ method ]
3980
+ **
3981
+ * Returns you element by its internal ID.
3982
+ **
3983
+ > Parameters
3984
+ **
3985
+ - id (number) id
3986
+ = (object) Raphaël element object
3987
+ \*/
2572
3988
  paperproto.getById = function (id) {
2573
3989
  var bot = this.bottom;
2574
3990
  while (bot) {
@@ -2579,7 +3995,24 @@
2579
3995
  }
2580
3996
  return null;
2581
3997
  };
2582
-
3998
+ /*\
3999
+ * Paper.forEach
4000
+ [ method ]
4001
+ **
4002
+ * Executes given function for each element on the paper
4003
+ *
4004
+ * If callback function returns `false` it will stop loop running.
4005
+ **
4006
+ > Parameters
4007
+ **
4008
+ - callback (function) function to run
4009
+ - thisArg (object) context object for the callback
4010
+ = (object) Paper object
4011
+ > Usage
4012
+ | paper.forEach(function (el) {
4013
+ | el.attr({ stroke: "blue" });
4014
+ | });
4015
+ \*/
2583
4016
  paperproto.forEach = function (callback, thisArg) {
2584
4017
  var bot = this.bottom;
2585
4018
  while (bot) {
@@ -2590,7 +4023,18 @@
2590
4023
  }
2591
4024
  return this;
2592
4025
  };
2593
-
4026
+ /*\
4027
+ * Paper.getElementsByPoint
4028
+ [ method ]
4029
+ **
4030
+ * Returns set of elements that have common point inside
4031
+ **
4032
+ > Parameters
4033
+ **
4034
+ - x (number) x coordinate of the point
4035
+ - y (number) y coordinate of the point
4036
+ = (object) @Set
4037
+ \*/
2594
4038
  paperproto.getElementsByPoint = function (x, y) {
2595
4039
  var set = this.set();
2596
4040
  this.forEach(function (el) {
@@ -2606,12 +4050,44 @@
2606
4050
  function x_y_w_h() {
2607
4051
  return this.x + S + this.y + S + this.width + " \xd7 " + this.height;
2608
4052
  }
2609
-
4053
+ /*\
4054
+ * Element.isPointInside
4055
+ [ method ]
4056
+ **
4057
+ * Determine if given point is inside this element’s shape
4058
+ **
4059
+ > Parameters
4060
+ **
4061
+ - x (number) x coordinate of the point
4062
+ - y (number) y coordinate of the point
4063
+ = (boolean) `true` if point inside the shape
4064
+ \*/
2610
4065
  elproto.isPointInside = function (x, y) {
2611
- var rp = this.realPath = this.realPath || getPath[this.type](this);
4066
+ var rp = this.realPath = getPath[this.type](this);
4067
+ if (this.attr('transform') && this.attr('transform').length) {
4068
+ rp = R.transformPath(rp, this.attr('transform'));
4069
+ }
2612
4070
  return R.isPointInsidePath(rp, x, y);
2613
4071
  };
2614
-
4072
+ /*\
4073
+ * Element.getBBox
4074
+ [ method ]
4075
+ **
4076
+ * Return bounding box for a given element
4077
+ **
4078
+ > Parameters
4079
+ **
4080
+ - isWithoutTransform (boolean) flag, `true` if you want to have bounding box before transformations. Default is `false`.
4081
+ = (object) Bounding box object:
4082
+ o {
4083
+ o x: (number) top left corner x
4084
+ o y: (number) top left corner y
4085
+ o x2: (number) bottom right corner x
4086
+ o y2: (number) bottom right corner y
4087
+ o width: (number) width
4088
+ o height: (number) height
4089
+ o }
4090
+ \*/
2615
4091
  elproto.getBBox = function (isWithoutTransform) {
2616
4092
  if (this.removed) {
2617
4093
  return {};
@@ -2637,7 +4113,13 @@
2637
4113
  }
2638
4114
  return _.bbox;
2639
4115
  };
2640
-
4116
+ /*\
4117
+ * Element.clone
4118
+ [ method ]
4119
+ **
4120
+ = (object) clone of a given element
4121
+ **
4122
+ \*/
2641
4123
  elproto.clone = function () {
2642
4124
  if (this.removed) {
2643
4125
  return null;
@@ -2646,7 +4128,27 @@
2646
4128
  this.__set__ && this.__set__.push(out);
2647
4129
  return out;
2648
4130
  };
2649
-
4131
+ /*\
4132
+ * Element.glow
4133
+ [ method ]
4134
+ **
4135
+ * Return set of elements that create glow-like effect around given element. See @Paper.set.
4136
+ *
4137
+ * Note: Glow is not connected to the element. If you change element attributes it won’t adjust itself.
4138
+ **
4139
+ > Parameters
4140
+ **
4141
+ - glow (object) #optional parameters object with all properties optional:
4142
+ o {
4143
+ o width (number) size of the glow, default is `10`
4144
+ o fill (boolean) will it be filled, default is `false`
4145
+ o opacity (number) opacity, default is `0.5`
4146
+ o offsetx (number) horizontal offset, default is `0`
4147
+ o offsety (number) vertical offset, default is `0`
4148
+ o color (string) glow colour, default is `black`
4149
+ o }
4150
+ = (object) @Paper.set of elements that represents glow
4151
+ \*/
2650
4152
  elproto.glow = function (glow) {
2651
4153
  if (this.type == "text") {
2652
4154
  return null;
@@ -2729,11 +4231,52 @@
2729
4231
  var getTotalLength = getLengthFactory(1),
2730
4232
  getPointAtLength = getLengthFactory(),
2731
4233
  getSubpathsAtLength = getLengthFactory(0, 1);
2732
-
4234
+ /*\
4235
+ * Raphael.getTotalLength
4236
+ [ method ]
4237
+ **
4238
+ * Returns length of the given path in pixels.
4239
+ **
4240
+ > Parameters
4241
+ **
4242
+ - path (string) SVG path string.
4243
+ **
4244
+ = (number) length.
4245
+ \*/
2733
4246
  R.getTotalLength = getTotalLength;
2734
-
4247
+ /*\
4248
+ * Raphael.getPointAtLength
4249
+ [ method ]
4250
+ **
4251
+ * Return coordinates of the point located at the given length on the given path.
4252
+ **
4253
+ > Parameters
4254
+ **
4255
+ - path (string) SVG path string
4256
+ - length (number)
4257
+ **
4258
+ = (object) representation of the point:
4259
+ o {
4260
+ o x: (number) x coordinate
4261
+ o y: (number) y coordinate
4262
+ o alpha: (number) angle of derivative
4263
+ o }
4264
+ \*/
2735
4265
  R.getPointAtLength = getPointAtLength;
2736
-
4266
+ /*\
4267
+ * Raphael.getSubpath
4268
+ [ method ]
4269
+ **
4270
+ * Return subpath of a given path from given length to given length.
4271
+ **
4272
+ > Parameters
4273
+ **
4274
+ - path (string) SVG path string
4275
+ - from (number) position of the start of the segment
4276
+ - to (number) position of the end of the segment
4277
+ **
4278
+ = (string) pathstring for the segment
4279
+ \*/
2737
4280
  R.getSubpath = function (path, from, to) {
2738
4281
  if (this.getTotalLength(path) - to < 1e-6) {
2739
4282
  return getSubpathsAtLength(path, from).end;
@@ -2741,25 +4284,110 @@
2741
4284
  var a = getSubpathsAtLength(path, to, 1);
2742
4285
  return from ? getSubpathsAtLength(a, from).end : a;
2743
4286
  };
2744
-
4287
+ /*\
4288
+ * Element.getTotalLength
4289
+ [ method ]
4290
+ **
4291
+ * Returns length of the path in pixels. Only works for element of “path” type.
4292
+ = (number) length.
4293
+ \*/
2745
4294
  elproto.getTotalLength = function () {
2746
- if (this.type != "path") {return;}
4295
+ var path = this.getPath();
4296
+ if (!path) {
4297
+ return;
4298
+ }
4299
+
2747
4300
  if (this.node.getTotalLength) {
2748
4301
  return this.node.getTotalLength();
2749
4302
  }
2750
- return getTotalLength(this.attrs.path);
2751
- };
2752
-
4303
+
4304
+ return getTotalLength(path);
4305
+ };
4306
+ /*\
4307
+ * Element.getPointAtLength
4308
+ [ method ]
4309
+ **
4310
+ * Return coordinates of the point located at the given length on the given path. Only works for element of “path” type.
4311
+ **
4312
+ > Parameters
4313
+ **
4314
+ - length (number)
4315
+ **
4316
+ = (object) representation of the point:
4317
+ o {
4318
+ o x: (number) x coordinate
4319
+ o y: (number) y coordinate
4320
+ o alpha: (number) angle of derivative
4321
+ o }
4322
+ \*/
2753
4323
  elproto.getPointAtLength = function (length) {
2754
- if (this.type != "path") {return;}
2755
- return getPointAtLength(this.attrs.path, length);
2756
- };
2757
-
4324
+ var path = this.getPath();
4325
+ if (!path) {
4326
+ return;
4327
+ }
4328
+
4329
+ return getPointAtLength(path, length);
4330
+ };
4331
+ /*\
4332
+ * Element.getPath
4333
+ [ method ]
4334
+ **
4335
+ * Returns path of the element. Only works for elements of “path” type and simple elements like circle.
4336
+ = (object) path
4337
+ **
4338
+ \*/
4339
+ elproto.getPath = function () {
4340
+ var path,
4341
+ getPath = R._getPath[this.type];
4342
+
4343
+ if (this.type == "text" || this.type == "set") {
4344
+ return;
4345
+ }
4346
+
4347
+ if (getPath) {
4348
+ path = getPath(this);
4349
+ }
4350
+
4351
+ return path;
4352
+ };
4353
+ /*\
4354
+ * Element.getSubpath
4355
+ [ method ]
4356
+ **
4357
+ * Return subpath of a given element from given length to given length. Only works for element of “path” type.
4358
+ **
4359
+ > Parameters
4360
+ **
4361
+ - from (number) position of the start of the segment
4362
+ - to (number) position of the end of the segment
4363
+ **
4364
+ = (string) pathstring for the segment
4365
+ \*/
2758
4366
  elproto.getSubpath = function (from, to) {
2759
- if (this.type != "path") {return;}
2760
- return R.getSubpath(this.attrs.path, from, to);
2761
- };
2762
-
4367
+ var path = this.getPath();
4368
+ if (!path) {
4369
+ return;
4370
+ }
4371
+
4372
+ return R.getSubpath(path, from, to);
4373
+ };
4374
+ /*\
4375
+ * Raphael.easing_formulas
4376
+ [ property ]
4377
+ **
4378
+ * Object that contains easing formulas for animation. You could extend it with your own. By default it has following list of easing:
4379
+ # <ul>
4380
+ # <li>“linear”</li>
4381
+ # <li>“&lt;” or “easeIn” or “ease-in”</li>
4382
+ # <li>“>” or “easeOut” or “ease-out”</li>
4383
+ # <li>“&lt;>” or “easeInOut” or “ease-in-out”</li>
4384
+ # <li>“backIn” or “back-in”</li>
4385
+ # <li>“backOut” or “back-out”</li>
4386
+ # <li>“elastic”</li>
4387
+ # <li>“bounce”</li>
4388
+ # </ul>
4389
+ # <p>See also <a href="http://raphaeljs.com/easing.html">Easing demo</a>.</p>
4390
+ \*/
2763
4391
  var ef = R.easing_formulas = {
2764
4392
  linear: function (n) {
2765
4393
  return n;
@@ -2960,7 +4588,27 @@
2960
4588
  upto255 = function (color) {
2961
4589
  return color > 255 ? 255 : color < 0 ? 0 : color;
2962
4590
  };
2963
-
4591
+ /*\
4592
+ * Element.animateWith
4593
+ [ method ]
4594
+ **
4595
+ * Acts similar to @Element.animate, but ensure that given animation runs in sync with another given element.
4596
+ **
4597
+ > Parameters
4598
+ **
4599
+ - el (object) element to sync with
4600
+ - anim (object) animation to sync with
4601
+ - params (object) #optional final attributes for the element, see also @Element.attr
4602
+ - ms (number) #optional number of milliseconds for animation to run
4603
+ - easing (string) #optional easing type. Accept on of @Raphael.easing_formulas or CSS format: `cubic&#x2010;bezier(XX,&#160;XX,&#160;XX,&#160;XX)`
4604
+ - callback (function) #optional callback function. Will be called at the end of animation.
4605
+ * or
4606
+ - element (object) element to sync with
4607
+ - anim (object) animation to sync with
4608
+ - animation (object) #optional animation object, see @Raphael.animation
4609
+ **
4610
+ = (object) original element
4611
+ \*/
2964
4612
  elproto.animateWith = function (el, anim, params, ms, easing, callback) {
2965
4613
  var element = this;
2966
4614
  if (element.removed) {
@@ -3055,15 +4703,40 @@
3055
4703
  this.top = percents[percents.length - 1];
3056
4704
  this.percents = percents;
3057
4705
  }
3058
-
4706
+ /*\
4707
+ * Animation.delay
4708
+ [ method ]
4709
+ **
4710
+ * Creates a copy of existing animation object with given delay.
4711
+ **
4712
+ > Parameters
4713
+ **
4714
+ - delay (number) number of ms to pass between animation start and actual animation
4715
+ **
4716
+ = (object) new altered Animation object
4717
+ | var anim = Raphael.animation({cx: 10, cy: 20}, 2e3);
4718
+ | circle1.animate(anim); // run the given animation immediately
4719
+ | circle2.animate(anim.delay(500)); // run the given animation after 500 ms
4720
+ \*/
3059
4721
  Animation.prototype.delay = function (delay) {
3060
4722
  var a = new Animation(this.anim, this.ms);
3061
4723
  a.times = this.times;
3062
4724
  a.del = +delay || 0;
3063
4725
  return a;
3064
4726
  };
3065
-
3066
- Animation.prototype.repeat = function (times) {
4727
+ /*\
4728
+ * Animation.repeat
4729
+ [ method ]
4730
+ **
4731
+ * Creates a copy of existing animation object with given repetition.
4732
+ **
4733
+ > Parameters
4734
+ **
4735
+ - repeat (number) number iterations of animation. For infinite animation pass `Infinity`
4736
+ **
4737
+ = (object) new altered Animation object
4738
+ \*/
4739
+ Animation.prototype.repeat = function (times) {
3067
4740
  var a = new Animation(this.anim, this.ms);
3068
4741
  a.del = this.del;
3069
4742
  a.times = math.floor(mmax(times, 0)) || 1;
@@ -3275,7 +4948,22 @@
3275
4948
  }
3276
4949
  eve("raphael.anim.start." + element.id, element, anim);
3277
4950
  }
3278
-
4951
+ /*\
4952
+ * Raphael.animation
4953
+ [ method ]
4954
+ **
4955
+ * Creates an animation object that can be passed to the @Element.animate or @Element.animateWith methods.
4956
+ * See also @Animation.delay and @Animation.repeat methods.
4957
+ **
4958
+ > Parameters
4959
+ **
4960
+ - params (object) final attributes for the element, see also @Element.attr
4961
+ - ms (number) number of milliseconds for animation to run
4962
+ - easing (string) #optional easing type. Accept one of @Raphael.easing_formulas or CSS format: `cubic&#x2010;bezier(XX,&#160;XX,&#160;XX,&#160;XX)`
4963
+ - callback (function) #optional callback function. Will be called at the end of animation.
4964
+ **
4965
+ = (object) @Animation
4966
+ \*/
3279
4967
  R.animation = function (params, ms, easing, callback) {
3280
4968
  if (params instanceof Animation) {
3281
4969
  return params;
@@ -3301,7 +4989,23 @@
3301
4989
  return new Animation({100: p}, ms);
3302
4990
  }
3303
4991
  };
3304
-
4992
+ /*\
4993
+ * Element.animate
4994
+ [ method ]
4995
+ **
4996
+ * Creates and starts animation for given element.
4997
+ **
4998
+ > Parameters
4999
+ **
5000
+ - params (object) final attributes for the element, see also @Element.attr
5001
+ - ms (number) number of milliseconds for animation to run
5002
+ - easing (string) #optional easing type. Accept one of @Raphael.easing_formulas or CSS format: `cubic&#x2010;bezier(XX,&#160;XX,&#160;XX,&#160;XX)`
5003
+ - callback (function) #optional callback function. Will be called at the end of animation.
5004
+ * or
5005
+ - animation (object) animation object, see @Raphael.animation
5006
+ **
5007
+ = (object) original element
5008
+ \*/
3305
5009
  elproto.animate = function (params, ms, easing, callback) {
3306
5010
  var element = this;
3307
5011
  if (element.removed) {
@@ -3312,14 +5016,49 @@
3312
5016
  runAnimation(anim, element, anim.percents[0], null, element.attr());
3313
5017
  return element;
3314
5018
  };
3315
-
5019
+ /*\
5020
+ * Element.setTime
5021
+ [ method ]
5022
+ **
5023
+ * Sets the status of animation of the element in milliseconds. Similar to @Element.status method.
5024
+ **
5025
+ > Parameters
5026
+ **
5027
+ - anim (object) animation object
5028
+ - value (number) number of milliseconds from the beginning of the animation
5029
+ **
5030
+ = (object) original element if `value` is specified
5031
+ * Note, that during animation following events are triggered:
5032
+ *
5033
+ * On each animation frame event `anim.frame.<id>`, on start `anim.start.<id>` and on end `anim.finish.<id>`.
5034
+ \*/
3316
5035
  elproto.setTime = function (anim, value) {
3317
5036
  if (anim && value != null) {
3318
5037
  this.status(anim, mmin(value, anim.ms) / anim.ms);
3319
5038
  }
3320
5039
  return this;
3321
5040
  };
3322
-
5041
+ /*\
5042
+ * Element.status
5043
+ [ method ]
5044
+ **
5045
+ * Gets or sets the status of animation of the element.
5046
+ **
5047
+ > Parameters
5048
+ **
5049
+ - anim (object) #optional animation object
5050
+ - value (number) #optional 0 – 1. If specified, method works like a setter and sets the status of a given animation to the value. This will cause animation to jump to the given position.
5051
+ **
5052
+ = (number) status
5053
+ * or
5054
+ = (array) status if `anim` is not specified. Array of objects in format:
5055
+ o {
5056
+ o anim: (object) animation object
5057
+ o status: (number) status
5058
+ o }
5059
+ * or
5060
+ = (object) original element if `value` is specified
5061
+ \*/
3323
5062
  elproto.status = function (anim, value) {
3324
5063
  var out = [],
3325
5064
  i = 0,
@@ -3348,7 +5087,18 @@
3348
5087
  return out;
3349
5088
  }
3350
5089
  };
3351
-
5090
+ /*\
5091
+ * Element.pause
5092
+ [ method ]
5093
+ **
5094
+ * Stops animation of the element with ability to resume it later on.
5095
+ **
5096
+ > Parameters
5097
+ **
5098
+ - anim (object) #optional animation object
5099
+ **
5100
+ = (object) original element
5101
+ \*/
3352
5102
  elproto.pause = function (anim) {
3353
5103
  for (var i = 0; i < animationElements.length; i++) if (animationElements[i].el.id == this.id && (!anim || animationElements[i].anim == anim)) {
3354
5104
  if (eve("raphael.anim.pause." + this.id, this, animationElements[i].anim) !== false) {
@@ -3357,7 +5107,18 @@
3357
5107
  }
3358
5108
  return this;
3359
5109
  };
3360
-
5110
+ /*\
5111
+ * Element.resume
5112
+ [ method ]
5113
+ **
5114
+ * Resumes animation if it was paused with @Element.pause method.
5115
+ **
5116
+ > Parameters
5117
+ **
5118
+ - anim (object) #optional animation object
5119
+ **
5120
+ = (object) original element
5121
+ \*/
3361
5122
  elproto.resume = function (anim) {
3362
5123
  for (var i = 0; i < animationElements.length; i++) if (animationElements[i].el.id == this.id && (!anim || animationElements[i].anim == anim)) {
3363
5124
  var e = animationElements[i];
@@ -3368,7 +5129,18 @@
3368
5129
  }
3369
5130
  return this;
3370
5131
  };
3371
-
5132
+ /*\
5133
+ * Element.stop
5134
+ [ method ]
5135
+ **
5136
+ * Stops animation of the element.
5137
+ **
5138
+ > Parameters
5139
+ **
5140
+ - anim (object) #optional animation object
5141
+ **
5142
+ = (object) original element
5143
+ \*/
3372
5144
  elproto.stop = function (anim) {
3373
5145
  for (var i = 0; i < animationElements.length; i++) if (animationElements[i].el.id == this.id && (!anim || animationElements[i].anim == anim)) {
3374
5146
  if (eve("raphael.anim.stop." + this.id, this, animationElements[i].anim) !== false) {
@@ -3403,7 +5175,13 @@
3403
5175
  }
3404
5176
  },
3405
5177
  setproto = Set.prototype;
3406
-
5178
+ /*\
5179
+ * Set.push
5180
+ [ method ]
5181
+ **
5182
+ * Adds each argument to the current set.
5183
+ = (object) original element
5184
+ \*/
3407
5185
  setproto.push = function () {
3408
5186
  var item,
3409
5187
  len;
@@ -3417,12 +5195,31 @@
3417
5195
  }
3418
5196
  return this;
3419
5197
  };
3420
-
5198
+ /*\
5199
+ * Set.pop
5200
+ [ method ]
5201
+ **
5202
+ * Removes last element and returns it.
5203
+ = (object) element
5204
+ \*/
3421
5205
  setproto.pop = function () {
3422
5206
  this.length && delete this[this.length--];
3423
5207
  return this.items.pop();
3424
5208
  };
3425
-
5209
+ /*\
5210
+ * Set.forEach
5211
+ [ method ]
5212
+ **
5213
+ * Executes given function for each element in the set.
5214
+ *
5215
+ * If function returns `false` it will stop loop running.
5216
+ **
5217
+ > Parameters
5218
+ **
5219
+ - callback (function) function to run
5220
+ - thisArg (object) context object for the callback
5221
+ = (object) Set object
5222
+ \*/
3426
5223
  setproto.forEach = function (callback, thisArg) {
3427
5224
  for (var i = 0, ii = this.items.length; i < ii; i++) {
3428
5225
  if (callback.call(thisArg, this.items[i], i) === false) {
@@ -3453,13 +5250,30 @@
3453
5250
  }
3454
5251
  return this;
3455
5252
  };
3456
-
5253
+ /*\
5254
+ * Set.clear
5255
+ [ method ]
5256
+ **
5257
+ * Removeds all elements from the set
5258
+ \*/
3457
5259
  setproto.clear = function () {
3458
5260
  while (this.length) {
3459
5261
  this.pop();
3460
5262
  }
3461
5263
  };
3462
-
5264
+ /*\
5265
+ * Set.splice
5266
+ [ method ]
5267
+ **
5268
+ * Removes given element from the set
5269
+ **
5270
+ > Parameters
5271
+ **
5272
+ - index (number) position of the deletion
5273
+ - count (number) number of element to remove
5274
+ - insertion… (object) #optional elements to insert
5275
+ = (object) set elements that were deleted
5276
+ \*/
3463
5277
  setproto.splice = function (index, count, insertion) {
3464
5278
  index = index < 0 ? mmax(this.length + index, 0) : index;
3465
5279
  count = mmax(0, mmin(this.length - index, count));
@@ -3486,7 +5300,17 @@
3486
5300
  }
3487
5301
  return new Set(todel);
3488
5302
  };
3489
-
5303
+ /*\
5304
+ * Set.exclude
5305
+ [ method ]
5306
+ **
5307
+ * Removes given element from the set
5308
+ **
5309
+ > Parameters
5310
+ **
5311
+ - element (object) element to remove
5312
+ = (boolean) `true` if object was found & removed from the set
5313
+ \*/
3490
5314
  setproto.exclude = function (el) {
3491
5315
  for (var i = 0, ii = this.length; i < ii; i++) if (this[i] == el) {
3492
5316
  this.splice(i, 1);
@@ -3511,6 +5335,7 @@
3511
5335
  item = this.items[--i].animate(anim);
3512
5336
  while (i--) {
3513
5337
  this.items[i] && !this.items[i].removed && this.items[i].animateWith(item, anim, anim);
5338
+ (this.items[i] && !this.items[i].removed) || len--;
3514
5339
  }
3515
5340
  return this;
3516
5341
  };
@@ -3547,7 +5372,7 @@
3547
5372
  };
3548
5373
  };
3549
5374
  setproto.clone = function (s) {
3550
- s = new Set;
5375
+ s = this.paper.set();
3551
5376
  for (var i = 0, ii = this.items.length; i < ii; i++) {
3552
5377
  s.push(this.items[i].clone());
3553
5378
  }
@@ -3557,7 +5382,59 @@
3557
5382
  return "Rapha\xebl\u2018s set";
3558
5383
  };
3559
5384
 
3560
-
5385
+ setproto.glow = function(glowConfig) {
5386
+ var ret = this.paper.set();
5387
+ this.forEach(function(shape, index){
5388
+ var g = shape.glow(glowConfig);
5389
+ if(g != null){
5390
+ g.forEach(function(shape2, index2){
5391
+ ret.push(shape2);
5392
+ });
5393
+ }
5394
+ });
5395
+ return ret;
5396
+ };
5397
+
5398
+
5399
+ /*\
5400
+ * Set.isPointInside
5401
+ [ method ]
5402
+ **
5403
+ * Determine if given point is inside this set’s elements
5404
+ **
5405
+ > Parameters
5406
+ **
5407
+ - x (number) x coordinate of the point
5408
+ - y (number) y coordinate of the point
5409
+ = (boolean) `true` if point is inside any of the set's elements
5410
+ \*/
5411
+ setproto.isPointInside = function (x, y) {
5412
+ var isPointInside = false;
5413
+ this.forEach(function (el) {
5414
+ if (el.isPointInside(x, y)) {
5415
+ console.log('runned');
5416
+ isPointInside = true;
5417
+ return false; // stop loop
5418
+ }
5419
+ });
5420
+ return isPointInside;
5421
+ };
5422
+
5423
+ /*\
5424
+ * Raphael.registerFont
5425
+ [ method ]
5426
+ **
5427
+ * Adds given font to the registered set of fonts for Raphaël. Should be used as an internal call from within Cufón’s font file.
5428
+ * Returns original parameter, so it could be used with chaining.
5429
+ # <a href="http://wiki.github.com/sorccu/cufon/about">More about Cufón and how to convert your font form TTF, OTF, etc to JavaScript file.</a>
5430
+ **
5431
+ > Parameters
5432
+ **
5433
+ - font (object) the font to register
5434
+ = (object) the font you passed in
5435
+ > Usage
5436
+ | Cufon.registerFont(Raphael.registerFont({…}));
5437
+ \*/
3561
5438
  R.registerFont = function (font) {
3562
5439
  if (!font.face) {
3563
5440
  return font;
@@ -3597,7 +5474,22 @@
3597
5474
  }
3598
5475
  return font;
3599
5476
  };
3600
-
5477
+ /*\
5478
+ * Paper.getFont
5479
+ [ method ]
5480
+ **
5481
+ * Finds font object in the registered fonts by given parameters. You could specify only one word from the font name, like “Myriad” for “Myriad Pro”.
5482
+ **
5483
+ > Parameters
5484
+ **
5485
+ - family (string) font family name or any word from it
5486
+ - weight (string) #optional font weight
5487
+ - style (string) #optional font style
5488
+ - stretch (string) #optional font stretch
5489
+ = (object) the font object
5490
+ > Usage
5491
+ | paper.print(100, 100, "Test string", paper.getFont("Times", 800), 30);
5492
+ \*/
3601
5493
  paperproto.getFont = function (family, weight, style, stretch) {
3602
5494
  stretch = stretch || "normal";
3603
5495
  style = style || "normal";
@@ -3626,16 +5518,37 @@
3626
5518
  }
3627
5519
  return thefont;
3628
5520
  };
3629
-
3630
- paperproto.print = function (x, y, string, font, size, origin, letter_spacing) {
5521
+ /*\
5522
+ * Paper.print
5523
+ [ method ]
5524
+ **
5525
+ * Creates path that represent given text written using given font at given position with given size.
5526
+ * Result of the method is path element that contains whole text as a separate path.
5527
+ **
5528
+ > Parameters
5529
+ **
5530
+ - x (number) x position of the text
5531
+ - y (number) y position of the text
5532
+ - string (string) text to print
5533
+ - font (object) font object, see @Paper.getFont
5534
+ - size (number) #optional size of the font, default is `16`
5535
+ - origin (string) #optional could be `"baseline"` or `"middle"`, default is `"middle"`
5536
+ - letter_spacing (number) #optional number in range `-1..1`, default is `0`
5537
+ - line_spacing (number) #optional number in range `1..3`, default is `1`
5538
+ = (object) resulting path element, which consist of all letters
5539
+ > Usage
5540
+ | var txt = r.print(10, 50, "print", r.getFont("Museo"), 30).attr({fill: "#fff"});
5541
+ \*/
5542
+ paperproto.print = function (x, y, string, font, size, origin, letter_spacing, line_spacing) {
3631
5543
  origin = origin || "middle"; // baseline|middle
3632
5544
  letter_spacing = mmax(mmin(letter_spacing || 0, 1), -1);
5545
+ line_spacing = mmax(mmin(line_spacing || 1, 3), 1);
3633
5546
  var letters = Str(string)[split](E),
3634
5547
  shift = 0,
3635
5548
  notfirst = 0,
3636
5549
  path = E,
3637
5550
  scale;
3638
- R.is(font, string) && (font = this.getFont(font));
5551
+ R.is(font, "string") && (font = this.getFont(font));
3639
5552
  if (font) {
3640
5553
  scale = (size || 16) / font.face["units-per-em"];
3641
5554
  var bb = font.face.bbox[split](separator),
@@ -3648,7 +5561,7 @@
3648
5561
  shift = 0;
3649
5562
  curr = 0;
3650
5563
  notfirst = 0;
3651
- shifty += lineHeight;
5564
+ shifty += lineHeight * line_spacing;
3652
5565
  } else {
3653
5566
  var prev = notfirst && font.glyphs[letters[i - 1]] || {},
3654
5567
  curr = font.glyphs[letters[i]];
@@ -3666,7 +5579,34 @@
3666
5579
  });
3667
5580
  };
3668
5581
 
3669
-
5582
+ /*\
5583
+ * Paper.add
5584
+ [ method ]
5585
+ **
5586
+ * Imports elements in JSON array in format `{type: type, <attributes>}`
5587
+ **
5588
+ > Parameters
5589
+ **
5590
+ - json (array)
5591
+ = (object) resulting set of imported elements
5592
+ > Usage
5593
+ | paper.add([
5594
+ | {
5595
+ | type: "circle",
5596
+ | cx: 10,
5597
+ | cy: 10,
5598
+ | r: 5
5599
+ | },
5600
+ | {
5601
+ | type: "rect",
5602
+ | x: 10,
5603
+ | y: 10,
5604
+ | width: 10,
5605
+ | height: 10,
5606
+ | fill: "#fc0"
5607
+ | }
5608
+ | ]);
5609
+ \*/
3670
5610
  paperproto.add = function (json) {
3671
5611
  if (R.is(json, "array")) {
3672
5612
  var res = this.set(),
@@ -3681,7 +5621,25 @@
3681
5621
  return res;
3682
5622
  };
3683
5623
 
3684
-
5624
+ /*\
5625
+ * Raphael.format
5626
+ [ method ]
5627
+ **
5628
+ * Simple format function. Replaces construction of type “`{<number>}`” to the corresponding argument.
5629
+ **
5630
+ > Parameters
5631
+ **
5632
+ - token (string) string to format
5633
+ - … (string) rest of arguments will be treated as parameters for replacement
5634
+ = (string) formated string
5635
+ > Usage
5636
+ | var x = 10,
5637
+ | y = 20,
5638
+ | width = 40,
5639
+ | height = 50;
5640
+ | // this will draw a rectangular shape equivalent to "M10,20h40v50h-40z"
5641
+ | paper.path(Raphael.format("M{0},{1}h{2}v{3}h{4}z", x, y, width, height, -width));
5642
+ \*/
3685
5643
  R.format = function (token, params) {
3686
5644
  var args = R.is(params, array) ? [0][concat](params) : arguments;
3687
5645
  token && R.is(token, string) && args.length - 1 && (token = token.replace(formatrg, function (str, i) {
@@ -3689,7 +5647,29 @@
3689
5647
  }));
3690
5648
  return token || E;
3691
5649
  };
3692
-
5650
+ /*\
5651
+ * Raphael.fullfill
5652
+ [ method ]
5653
+ **
5654
+ * A little bit more advanced format function than @Raphael.format. Replaces construction of type “`{<name>}`” to the corresponding argument.
5655
+ **
5656
+ > Parameters
5657
+ **
5658
+ - token (string) string to format
5659
+ - json (object) object which properties will be used as a replacement
5660
+ = (string) formated string
5661
+ > Usage
5662
+ | // this will draw a rectangular shape equivalent to "M10,20h40v50h-40z"
5663
+ | paper.path(Raphael.fullfill("M{x},{y}h{dim.width}v{dim.height}h{dim['negative width']}z", {
5664
+ | x: 10,
5665
+ | y: 20,
5666
+ | dim: {
5667
+ | width: 40,
5668
+ | height: 50,
5669
+ | "negative width": -40
5670
+ | }
5671
+ | }));
5672
+ \*/
3693
5673
  R.fullfill = (function () {
3694
5674
  var tokenRegex = /\{([^\}]+)\}/g,
3695
5675
  objNotationRegex = /(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g, // matches .xxxxx or ["xxxxx"] to run over object properties
@@ -3713,12 +5693,44 @@
3713
5693
  });
3714
5694
  };
3715
5695
  })();
3716
-
5696
+ /*\
5697
+ * Raphael.ninja
5698
+ [ method ]
5699
+ **
5700
+ * If you want to leave no trace of Raphaël (Well, Raphaël creates only one global variable `Raphael`, but anyway.) You can use `ninja` method.
5701
+ * Beware, that in this case plugins could stop working, because they are depending on global variable existance.
5702
+ **
5703
+ = (object) Raphael object
5704
+ > Usage
5705
+ | (function (local_raphael) {
5706
+ | var paper = local_raphael(10, 10, 320, 200);
5707
+ | …
5708
+ | })(Raphael.ninja());
5709
+ \*/
3717
5710
  R.ninja = function () {
3718
5711
  oldRaphael.was ? (g.win.Raphael = oldRaphael.is) : delete Raphael;
3719
5712
  return R;
3720
5713
  };
3721
-
5714
+ /*\
5715
+ * Raphael.st
5716
+ [ property (object) ]
5717
+ **
5718
+ * You can add your own method to elements and sets. It is wise to add a set method for each element method
5719
+ * you added, so you will be able to call the same method on sets too.
5720
+ **
5721
+ * See also @Raphael.el.
5722
+ > Usage
5723
+ | Raphael.el.red = function () {
5724
+ | this.attr({fill: "#f00"});
5725
+ | };
5726
+ | Raphael.st.red = function () {
5727
+ | this.forEach(function (el) {
5728
+ | el.red();
5729
+ | });
5730
+ | };
5731
+ | // then use it
5732
+ | paper.set(paper.circle(100, 100, 20), paper.circle(110, 100, 20)).red();
5733
+ \*/
3722
5734
  R.st = setproto;
3723
5735
  // Firefox <3.6 fix: http://webreflection.blogspot.com/2009/11/195-chars-to-help-lazy-loading.html
3724
5736
  (function (doc, loaded, f) {
@@ -3735,13 +5747,9 @@
3735
5747
  isLoaded();
3736
5748
  })(document, "DOMContentLoaded");
3737
5749
 
3738
- oldRaphael.was ? (g.win.Raphael = R) : (Raphael = R);
3739
-
3740
5750
  eve.on("raphael.DOMload", function () {
3741
5751
  loaded = true;
3742
5752
  });
3743
- })();
3744
-
3745
5753
 
3746
5754
  // ┌─────────────────────────────────────────────────────────────────────┐ \\
3747
5755
  // │ Raphaël - JavaScript Vector Library │ \\
@@ -3752,7 +5760,11 @@
3752
5760
  // │ Copyright (c) 2008-2011 Sencha Labs (http://sencha.com) │ \\
3753
5761
  // │ Licensed under the MIT (http://raphaeljs.com/license.html) license. │ \\
3754
5762
  // └─────────────────────────────────────────────────────────────────────┘ \\
3755
- window.Raphael.svg && function (R) {
5763
+
5764
+ (function(){
5765
+ if (!R.svg) {
5766
+ return;
5767
+ }
3756
5768
  var has = "hasOwnProperty",
3757
5769
  Str = String,
3758
5770
  toFloat = parseFloat,
@@ -3994,7 +6006,7 @@ window.Raphael.svg && function (R) {
3994
6006
  attr = {};
3995
6007
  attr["marker-" + se] = "url(#" + markerId + ")";
3996
6008
  if (to || from) {
3997
- attr.d = Raphael.getSubpath(attrs.path, from, to);
6009
+ attr.d = R.getSubpath(attrs.path, from, to);
3998
6010
  }
3999
6011
  $(node, attr);
4000
6012
  o._.arrows[se + "Path"] = pathId;
@@ -4010,7 +6022,7 @@ window.Raphael.svg && function (R) {
4010
6022
  from = 0;
4011
6023
  to = R.getTotalLength(attrs.path) - (o._.arrows.enddx * stroke || 0);
4012
6024
  }
4013
- o._.arrows[se + "Path"] && $(node, {d: Raphael.getSubpath(attrs.path, from, to)});
6025
+ o._.arrows[se + "Path"] && $(node, {d: R.getSubpath(attrs.path, from, to)});
4014
6026
  delete o._.arrows[se + "Path"];
4015
6027
  delete o._.arrows[se + "Marker"];
4016
6028
  delete o._.arrows[se + "dx"];
@@ -4068,6 +6080,11 @@ window.Raphael.svg && function (R) {
4068
6080
  break;
4069
6081
  case "href":
4070
6082
  case "title":
6083
+ var hl = $("title");
6084
+ var val = R._g.doc.createTextNode(value);
6085
+ hl.appendChild(val);
6086
+ node.appendChild(hl);
6087
+ break;
4071
6088
  case "target":
4072
6089
  var pn = node.parentNode;
4073
6090
  if (pn.tagName.toLowerCase() != "a") {
@@ -4339,16 +6356,57 @@ window.Raphael.svg && function (R) {
4339
6356
  Element = function (node, svg) {
4340
6357
  var X = 0,
4341
6358
  Y = 0;
4342
-
6359
+ /*\
6360
+ * Element.node
6361
+ [ property (object) ]
6362
+ **
6363
+ * Gives you a reference to the DOM object, so you can assign event handlers or just mess around.
6364
+ **
6365
+ * Note: Don’t mess with it.
6366
+ > Usage
6367
+ | // draw a circle at coordinate 10,10 with radius of 10
6368
+ | var c = paper.circle(10, 10, 10);
6369
+ | c.node.onclick = function () {
6370
+ | c.attr("fill", "red");
6371
+ | };
6372
+ \*/
4343
6373
  this[0] = this.node = node;
4344
-
6374
+ /*\
6375
+ * Element.raphael
6376
+ [ property (object) ]
6377
+ **
6378
+ * Internal reference to @Raphael object. In case it is not available.
6379
+ > Usage
6380
+ | Raphael.el.red = function () {
6381
+ | var hsb = this.paper.raphael.rgb2hsb(this.attr("fill"));
6382
+ | hsb.h = 1;
6383
+ | this.attr({fill: this.paper.raphael.hsb2rgb(hsb).hex});
6384
+ | }
6385
+ \*/
4345
6386
  node.raphael = true;
4346
-
6387
+ /*\
6388
+ * Element.id
6389
+ [ property (number) ]
6390
+ **
6391
+ * Unique id of the element. Especially usesful when you want to listen to events of the element,
6392
+ * because all events are fired in format `<module>.<action>.<id>`. Also useful for @Paper.getById method.
6393
+ \*/
4347
6394
  this.id = R._oid++;
4348
6395
  node.raphaelid = this.id;
4349
6396
  this.matrix = R.matrix();
4350
6397
  this.realPath = null;
4351
-
6398
+ /*\
6399
+ * Element.paper
6400
+ [ property (object) ]
6401
+ **
6402
+ * Internal reference to “paper” where object drawn. Mainly for use in plugins and element extensions.
6403
+ > Usage
6404
+ | Raphael.el.cross = function () {
6405
+ | this.attr({fill: "red"});
6406
+ | this.paper.path("M10,10L50,50M50,10L10,50")
6407
+ | .attr({stroke: "red"});
6408
+ | }
6409
+ \*/
4352
6410
  this.paper = svg;
4353
6411
  this.attrs = this.attrs || {};
4354
6412
  this._ = {
@@ -4361,11 +6419,21 @@ window.Raphael.svg && function (R) {
4361
6419
  dirty: 1
4362
6420
  };
4363
6421
  !svg.bottom && (svg.bottom = this);
4364
-
6422
+ /*\
6423
+ * Element.prev
6424
+ [ property (object) ]
6425
+ **
6426
+ * Reference to the previous element in the hierarchy.
6427
+ \*/
4365
6428
  this.prev = svg.top;
4366
6429
  svg.top && (svg.top.next = this);
4367
6430
  svg.top = this;
4368
-
6431
+ /*\
6432
+ * Element.next
6433
+ [ property (object) ]
6434
+ **
6435
+ * Reference to the next element in the hierarchy.
6436
+ \*/
4369
6437
  this.next = null;
4370
6438
  },
4371
6439
  elproto = R.el;
@@ -4385,7 +6453,20 @@ window.Raphael.svg && function (R) {
4385
6453
  });
4386
6454
  return p;
4387
6455
  };
4388
-
6456
+ /*\
6457
+ * Element.rotate
6458
+ [ method ]
6459
+ **
6460
+ * Deprecated! Use @Element.transform instead.
6461
+ * Adds rotation by given angle around given point to the list of
6462
+ * transformations of the element.
6463
+ > Parameters
6464
+ - deg (number) angle in degrees
6465
+ - cx (number) #optional x coordinate of the centre of rotation
6466
+ - cy (number) #optional y coordinate of the centre of rotation
6467
+ * If cx & cy aren’t specified centre of the shape is used as a point of rotation.
6468
+ = (object) @Element
6469
+ \*/
4389
6470
  elproto.rotate = function (deg, cx, cy) {
4390
6471
  if (this.removed) {
4391
6472
  return this;
@@ -4405,7 +6486,21 @@ window.Raphael.svg && function (R) {
4405
6486
  this.transform(this._.transform.concat([["r", deg, cx, cy]]));
4406
6487
  return this;
4407
6488
  };
4408
-
6489
+ /*\
6490
+ * Element.scale
6491
+ [ method ]
6492
+ **
6493
+ * Deprecated! Use @Element.transform instead.
6494
+ * Adds scale by given amount relative to given point to the list of
6495
+ * transformations of the element.
6496
+ > Parameters
6497
+ - sx (number) horisontal scale amount
6498
+ - sy (number) vertical scale amount
6499
+ - cx (number) #optional x coordinate of the centre of scale
6500
+ - cy (number) #optional y coordinate of the centre of scale
6501
+ * If cx & cy aren’t specified centre of the shape is used instead.
6502
+ = (object) @Element
6503
+ \*/
4409
6504
  elproto.scale = function (sx, sy, cx, cy) {
4410
6505
  if (this.removed) {
4411
6506
  return this;
@@ -4427,7 +6522,17 @@ window.Raphael.svg && function (R) {
4427
6522
  this.transform(this._.transform.concat([["s", sx, sy, cx, cy]]));
4428
6523
  return this;
4429
6524
  };
4430
-
6525
+ /*\
6526
+ * Element.translate
6527
+ [ method ]
6528
+ **
6529
+ * Deprecated! Use @Element.transform instead.
6530
+ * Adds translation by given amount to the list of transformations of the element.
6531
+ > Parameters
6532
+ - dx (number) horisontal shift
6533
+ - dy (number) vertical shift
6534
+ = (object) @Element
6535
+ \*/
4431
6536
  elproto.translate = function (dx, dy) {
4432
6537
  if (this.removed) {
4433
6538
  return this;
@@ -4441,7 +6546,43 @@ window.Raphael.svg && function (R) {
4441
6546
  this.transform(this._.transform.concat([["t", dx, dy]]));
4442
6547
  return this;
4443
6548
  };
4444
-
6549
+ /*\
6550
+ * Element.transform
6551
+ [ method ]
6552
+ **
6553
+ * Adds transformation to the element which is separate to other attributes,
6554
+ * i.e. translation doesn’t change `x` or `y` of the rectange. The format
6555
+ * of transformation string is similar to the path string syntax:
6556
+ | "t100,100r30,100,100s2,2,100,100r45s1.5"
6557
+ * Each letter is a command. There are four commands: `t` is for translate, `r` is for rotate, `s` is for
6558
+ * scale and `m` is for matrix.
6559
+ *
6560
+ * There are also alternative “absolute” translation, rotation and scale: `T`, `R` and `S`. They will not take previous transformation into account. For example, `...T100,0` will always move element 100 px horisontally, while `...t100,0` could move it vertically if there is `r90` before. Just compare results of `r90t100,0` and `r90T100,0`.
6561
+ *
6562
+ * So, the example line above could be read like “translate by 100, 100; rotate 30° around 100, 100; scale twice around 100, 100;
6563
+ * rotate 45° around centre; scale 1.5 times relative to centre”. As you can see rotate and scale commands have origin
6564
+ * coordinates as optional parameters, the default is the centre point of the element.
6565
+ * Matrix accepts six parameters.
6566
+ > Usage
6567
+ | var el = paper.rect(10, 20, 300, 200);
6568
+ | // translate 100, 100, rotate 45°, translate -100, 0
6569
+ | el.transform("t100,100r45t-100,0");
6570
+ | // if you want you can append or prepend transformations
6571
+ | el.transform("...t50,50");
6572
+ | el.transform("s2...");
6573
+ | // or even wrap
6574
+ | el.transform("t50,50...t-50-50");
6575
+ | // to reset transformation call method with empty string
6576
+ | el.transform("");
6577
+ | // to get current value call it without parameters
6578
+ | console.log(el.transform());
6579
+ > Parameters
6580
+ - tstr (string) #optional transformation string
6581
+ * If tstr isn’t specified
6582
+ = (string) current transformation string
6583
+ * else
6584
+ = (object) @Element
6585
+ \*/
4445
6586
  elproto.transform = function (tstr) {
4446
6587
  var _ = this._;
4447
6588
  if (tstr == null) {
@@ -4460,17 +6601,34 @@ window.Raphael.svg && function (R) {
4460
6601
 
4461
6602
  return this;
4462
6603
  };
4463
-
6604
+ /*\
6605
+ * Element.hide
6606
+ [ method ]
6607
+ **
6608
+ * Makes element invisible. See @Element.show.
6609
+ = (object) @Element
6610
+ \*/
4464
6611
  elproto.hide = function () {
4465
6612
  !this.removed && this.paper.safari(this.node.style.display = "none");
4466
6613
  return this;
4467
6614
  };
4468
-
6615
+ /*\
6616
+ * Element.show
6617
+ [ method ]
6618
+ **
6619
+ * Makes element visible. See @Element.hide.
6620
+ = (object) @Element
6621
+ \*/
4469
6622
  elproto.show = function () {
4470
6623
  !this.removed && this.paper.safari(this.node.style.display = "");
4471
6624
  return this;
4472
6625
  };
4473
-
6626
+ /*\
6627
+ * Element.remove
6628
+ [ method ]
6629
+ **
6630
+ * Removes element from the paper.
6631
+ \*/
4474
6632
  elproto.remove = function () {
4475
6633
  if (this.removed || !this.node.parentNode) {
4476
6634
  return;
@@ -4508,7 +6666,87 @@ window.Raphael.svg && function (R) {
4508
6666
  hide && this.hide();
4509
6667
  return bbox;
4510
6668
  };
4511
-
6669
+ /*\
6670
+ * Element.attr
6671
+ [ method ]
6672
+ **
6673
+ * Sets the attributes of the element.
6674
+ > Parameters
6675
+ - attrName (string) attribute’s name
6676
+ - value (string) value
6677
+ * or
6678
+ - params (object) object of name/value pairs
6679
+ * or
6680
+ - attrName (string) attribute’s name
6681
+ * or
6682
+ - attrNames (array) in this case method returns array of current values for given attribute names
6683
+ = (object) @Element if attrsName & value or params are passed in.
6684
+ = (...) value of the attribute if only attrsName is passed in.
6685
+ = (array) array of values of the attribute if attrsNames is passed in.
6686
+ = (object) object of attributes if nothing is passed in.
6687
+ > Possible parameters
6688
+ # <p>Please refer to the <a href="http://www.w3.org/TR/SVG/" title="The W3C Recommendation for the SVG language describes these properties in detail.">SVG specification</a> for an explanation of these parameters.</p>
6689
+ o arrow-end (string) arrowhead on the end of the path. The format for string is `<type>[-<width>[-<length>]]`. Possible types: `classic`, `block`, `open`, `oval`, `diamond`, `none`, width: `wide`, `narrow`, `medium`, length: `long`, `short`, `midium`.
6690
+ o clip-rect (string) comma or space separated values: x, y, width and height
6691
+ o cursor (string) CSS type of the cursor
6692
+ o cx (number) the x-axis coordinate of the center of the circle, or ellipse
6693
+ o cy (number) the y-axis coordinate of the center of the circle, or ellipse
6694
+ o fill (string) colour, gradient or image
6695
+ o fill-opacity (number)
6696
+ o font (string)
6697
+ o font-family (string)
6698
+ o font-size (number) font size in pixels
6699
+ o font-weight (string)
6700
+ o height (number)
6701
+ o href (string) URL, if specified element behaves as hyperlink
6702
+ o opacity (number)
6703
+ o path (string) SVG path string format
6704
+ o r (number) radius of the circle, ellipse or rounded corner on the rect
6705
+ o rx (number) horisontal radius of the ellipse
6706
+ o ry (number) vertical radius of the ellipse
6707
+ o src (string) image URL, only works for @Element.image element
6708
+ o stroke (string) stroke colour
6709
+ o stroke-dasharray (string) [“”, “`-`”, “`.`”, “`-.`”, “`-..`”, “`. `”, “`- `”, “`--`”, “`- .`”, “`--.`”, “`--..`”]
6710
+ o stroke-linecap (string) [“`butt`”, “`square`”, “`round`”]
6711
+ o stroke-linejoin (string) [“`bevel`”, “`round`”, “`miter`”]
6712
+ o stroke-miterlimit (number)
6713
+ o stroke-opacity (number)
6714
+ o stroke-width (number) stroke width in pixels, default is '1'
6715
+ o target (string) used with href
6716
+ o text (string) contents of the text element. Use `\n` for multiline text
6717
+ o text-anchor (string) [“`start`”, “`middle`”, “`end`”], default is “`middle`”
6718
+ o title (string) will create tooltip with a given text
6719
+ o transform (string) see @Element.transform
6720
+ o width (number)
6721
+ o x (number)
6722
+ o y (number)
6723
+ > Gradients
6724
+ * Linear gradient format: “`‹angle›-‹colour›[-‹colour›[:‹offset›]]*-‹colour›`”, example: “`90-#fff-#000`” – 90°
6725
+ * gradient from white to black or “`0-#fff-#f00:20-#000`” – 0° gradient from white via red (at 20%) to black.
6726
+ *
6727
+ * radial gradient: “`r[(‹fx›, ‹fy›)]‹colour›[-‹colour›[:‹offset›]]*-‹colour›`”, example: “`r#fff-#000`” –
6728
+ * gradient from white to black or “`r(0.25, 0.75)#fff-#000`” – gradient from white to black with focus point
6729
+ * at 0.25, 0.75. Focus point coordinates are in 0..1 range. Radial gradients can only be applied to circles and ellipses.
6730
+ > Path String
6731
+ # <p>Please refer to <a href="http://www.w3.org/TR/SVG/paths.html#PathData" title="Details of a path’s data attribute’s format are described in the SVG specification.">SVG documentation regarding path string</a>. Raphaël fully supports it.</p>
6732
+ > Colour Parsing
6733
+ # <ul>
6734
+ # <li>Colour name (“<code>red</code>”, “<code>green</code>”, “<code>cornflowerblue</code>”, etc)</li>
6735
+ # <li>#••• — shortened HTML colour: (“<code>#000</code>”, “<code>#fc0</code>”, etc)</li>
6736
+ # <li>#•••••• — full length HTML colour: (“<code>#000000</code>”, “<code>#bd2300</code>”)</li>
6737
+ # <li>rgb(•••, •••, •••) — red, green and blue channels’ values: (“<code>rgb(200,&nbsp;100,&nbsp;0)</code>”)</li>
6738
+ # <li>rgb(•••%, •••%, •••%) — same as above, but in %: (“<code>rgb(100%,&nbsp;175%,&nbsp;0%)</code>”)</li>
6739
+ # <li>rgba(•••, •••, •••, •••) — red, green and blue channels’ values: (“<code>rgba(200,&nbsp;100,&nbsp;0, .5)</code>”)</li>
6740
+ # <li>rgba(•••%, •••%, •••%, •••%) — same as above, but in %: (“<code>rgba(100%,&nbsp;175%,&nbsp;0%, 50%)</code>”)</li>
6741
+ # <li>hsb(•••, •••, •••) — hue, saturation and brightness values: (“<code>hsb(0.5,&nbsp;0.25,&nbsp;1)</code>”)</li>
6742
+ # <li>hsb(•••%, •••%, •••%) — same as above, but in %</li>
6743
+ # <li>hsba(•••, •••, •••, •••) — same as above, but with opacity</li>
6744
+ # <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>
6745
+ # <li>hsl(•••%, •••%, •••%) — same as above, but in %</li>
6746
+ # <li>hsla(•••, •••, •••, •••) — same as above, but with opacity</li>
6747
+ # <li>Optionally for hsb and hsl you could specify hue as a degree: “<code>hsl(240deg,&nbsp;1,&nbsp;.5)</code>” or, if you want to go fancy, “<code>hsl(240°,&nbsp;1,&nbsp;.5)</code>”</li>
6748
+ # </ul>
6749
+ \*/
4512
6750
  elproto.attr = function (name, value) {
4513
6751
  if (this.removed) {
4514
6752
  return this;
@@ -4569,7 +6807,13 @@ window.Raphael.svg && function (R) {
4569
6807
  setFillAndStroke(this, params);
4570
6808
  return this;
4571
6809
  };
4572
-
6810
+ /*\
6811
+ * Element.toFront
6812
+ [ method ]
6813
+ **
6814
+ * Moves the element so it is the closest to the viewer’s eyes, on top of other elements.
6815
+ = (object) @Element
6816
+ \*/
4573
6817
  elproto.toFront = function () {
4574
6818
  if (this.removed) {
4575
6819
  return this;
@@ -4583,7 +6827,13 @@ window.Raphael.svg && function (R) {
4583
6827
  svg.top != this && R._tofront(this, svg);
4584
6828
  return this;
4585
6829
  };
4586
-
6830
+ /*\
6831
+ * Element.toBack
6832
+ [ method ]
6833
+ **
6834
+ * Moves the element so it is the furthest from the viewer’s eyes, behind other elements.
6835
+ = (object) @Element
6836
+ \*/
4587
6837
  elproto.toBack = function () {
4588
6838
  if (this.removed) {
4589
6839
  return this;
@@ -4598,7 +6848,13 @@ window.Raphael.svg && function (R) {
4598
6848
  var svg = this.paper;
4599
6849
  return this;
4600
6850
  };
4601
-
6851
+ /*\
6852
+ * Element.insertAfter
6853
+ [ method ]
6854
+ **
6855
+ * Inserts current object after the given one.
6856
+ = (object) @Element
6857
+ \*/
4602
6858
  elproto.insertAfter = function (element) {
4603
6859
  if (this.removed) {
4604
6860
  return this;
@@ -4612,7 +6868,13 @@ window.Raphael.svg && function (R) {
4612
6868
  R._insertafter(this, element, this.paper);
4613
6869
  return this;
4614
6870
  };
4615
-
6871
+ /*\
6872
+ * Element.insertBefore
6873
+ [ method ]
6874
+ **
6875
+ * Inserts current object before the given one.
6876
+ = (object) @Element
6877
+ \*/
4616
6878
  elproto.insertBefore = function (element) {
4617
6879
  if (this.removed) {
4618
6880
  return this;
@@ -4643,6 +6905,7 @@ window.Raphael.svg && function (R) {
4643
6905
  }
4644
6906
  t.node.removeAttribute("filter");
4645
6907
  }
6908
+ return t;
4646
6909
  };
4647
6910
  R._engine.circle = function (svg, x, y, r) {
4648
6911
  var el = $("circle");
@@ -4784,7 +7047,16 @@ window.Raphael.svg && function (R) {
4784
7047
  this._viewBox = [x, y, w, h, !!fit];
4785
7048
  return this;
4786
7049
  };
4787
-
7050
+ /*\
7051
+ * Paper.renderfix
7052
+ [ method ]
7053
+ **
7054
+ * Fixes the issue of Firefox and IE9 regarding subpixel rendering. If paper is dependant
7055
+ * on other elements after reflow it could shift half pixel which cause for lines to lost their crispness.
7056
+ * This method fixes the issue.
7057
+ **
7058
+ Special thanks to Mariusz Nowak (http://www.medikoo.com/) for this method.
7059
+ \*/
4788
7060
  R.prototype.renderfix = function () {
4789
7061
  var cnvs = this.canvas,
4790
7062
  s = cnvs.style,
@@ -4807,7 +7079,12 @@ window.Raphael.svg && function (R) {
4807
7079
  }
4808
7080
  }
4809
7081
  };
4810
-
7082
+ /*\
7083
+ * Paper.clear
7084
+ [ method ]
7085
+ **
7086
+ * Clears the paper, i.e. removes all the elements.
7087
+ \*/
4811
7088
  R.prototype.clear = function () {
4812
7089
  R.eve("raphael.clear", this);
4813
7090
  var c = this.canvas;
@@ -4819,7 +7096,12 @@ window.Raphael.svg && function (R) {
4819
7096
  c.appendChild(this.desc);
4820
7097
  c.appendChild(this.defs = $("defs"));
4821
7098
  };
4822
-
7099
+ /*\
7100
+ * Paper.remove
7101
+ [ method ]
7102
+ **
7103
+ * Removes the paper from the DOM.
7104
+ \*/
4823
7105
  R.prototype.remove = function () {
4824
7106
  eve("raphael.remove", this);
4825
7107
  this.canvas.parentNode && this.canvas.parentNode.removeChild(this.canvas);
@@ -4838,7 +7120,7 @@ window.Raphael.svg && function (R) {
4838
7120
  };
4839
7121
  })(method);
4840
7122
  }
4841
- }(window.Raphael);
7123
+ })();
4842
7124
 
4843
7125
  // ┌─────────────────────────────────────────────────────────────────────┐ \\
4844
7126
  // │ Raphaël - JavaScript Vector Library │ \\
@@ -4849,7 +7131,11 @@ window.Raphael.svg && function (R) {
4849
7131
  // │ Copyright (c) 2008-2011 Sencha Labs (http://sencha.com) │ \\
4850
7132
  // │ Licensed under the MIT (http://raphaeljs.com/license.html) license. │ \\
4851
7133
  // └─────────────────────────────────────────────────────────────────────┘ \\
4852
- window.Raphael.vml && function (R) {
7134
+
7135
+ (function(){
7136
+ if (!R.vml) {
7137
+ return;
7138
+ }
4853
7139
  var has = "hasOwnProperty",
4854
7140
  Str = String,
4855
7141
  toFloat = parseFloat,
@@ -5025,6 +7311,7 @@ window.Raphael.vml && function (R) {
5025
7311
  rx = +a.rx || +a.r || 0,
5026
7312
  ry = +a.ry || +a.r || 0;
5027
7313
  node.path = R.format("ar{0},{1},{2},{3},{4},{1},{4},{1}x", round((cx - rx) * zoom), round((cy - ry) * zoom), round((cx + rx) * zoom), round((cy + ry) * zoom), round(cx * zoom));
7314
+ o._.dirty = 1;
5028
7315
  }
5029
7316
  if ("clip-rect" in params) {
5030
7317
  var rect = Str(params["clip-rect"]).split(separator);
@@ -5314,7 +7601,7 @@ window.Raphael.vml && function (R) {
5314
7601
  split,
5315
7602
  isGrad = ~Str(this.attrs.fill).indexOf("-"),
5316
7603
  isPatt = !Str(this.attrs.fill).indexOf("url(");
5317
- matrix.translate(-.5, -.5);
7604
+ matrix.translate(1, 1);
5318
7605
  if (isPatt || isGrad || this.type == "image") {
5319
7606
  skew.matrix = "1 0 0 1";
5320
7607
  skew.offset = "0 0";
@@ -5555,6 +7842,7 @@ window.Raphael.vml && function (R) {
5555
7842
  s.margin = 0;
5556
7843
  delete this.attrs.blur;
5557
7844
  }
7845
+ return this;
5558
7846
  };
5559
7847
 
5560
7848
  R._engine.path = function (pathString, vml) {
@@ -5812,4 +8100,12 @@ window.Raphael.vml && function (R) {
5812
8100
  };
5813
8101
  })(method);
5814
8102
  }
5815
- }(window.Raphael);
8103
+ })();
8104
+
8105
+ // EXPOSE
8106
+ // SVG and VML are appended just before the EXPOSE line
8107
+ // Even with AMD, Raphael should be defined globally
8108
+ oldRaphael.was ? (g.win.Raphael = R) : (Raphael = R);
8109
+
8110
+ return R;
8111
+ }));