Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Replace Google's closure compiler with UglifyJS.

UglifyJS requires Node.js to run, but it's a lot faster than Google's
compiler and produces smaller gzipped sizes.  Some of the non-gzipped
sizes are a bit larger than Google's but I think the gzipped size is
more important.  Faster runtime is also good when we start testing the
minified versions too.
  • Loading branch information...
commit 1dfd3350dcd78ce29f76f4f15da0f94ca219ffad 1 parent 39a32e1
@jasondavies jasondavies authored
Showing with 5,114 additions and 635 deletions.
  1. +2 −4 Makefile
  2. +1 −3 d3.behavior.min.js
  3. +1 −3 d3.csv.min.js
  4. +1 −11 d3.geo.min.js
  5. +1 −15 d3.geom.min.js
  6. +3 −12 d3.js
  7. +1 −17 d3.layout.min.js
  8. +2 −70 d3.min.js
  9. +1 −8 d3.time.min.js
  10. +0 −202 lib/google-compiler/COPYING
  11. +0 −278 lib/google-compiler/README
  12. BIN  lib/google-compiler/compiler.jar
  13. +4 −0 lib/uglifyjs/.gitignore
  14. +782 −0 lib/uglifyjs/README.html
  15. +408 −0 lib/uglifyjs/README.org
  16. +212 −0 lib/uglifyjs/bin/uglifyjs
  17. +75 −0 lib/uglifyjs/docstyle.css
  18. +2 −0  lib/uglifyjs/index.js
  19. +1,319 −0 lib/uglifyjs/lib/parse-js.js
  20. +1,614 −0 lib/uglifyjs/lib/process.js
  21. +22 −0 lib/uglifyjs/lib/squeeze-more.js
  22. +6 −0 lib/uglifyjs/package.json
  23. +28 −0 lib/uglifyjs/test/beautify.js
  24. +402 −0 lib/uglifyjs/test/testparser.js
  25. +1 −0  lib/uglifyjs/test/unit/compress/expected/array1.js
  26. +1 −0  lib/uglifyjs/test/unit/compress/expected/array2.js
  27. +1 −0  lib/uglifyjs/test/unit/compress/expected/array3.js
  28. +1 −0  lib/uglifyjs/test/unit/compress/expected/array4.js
  29. +1 −0  lib/uglifyjs/test/unit/compress/expected/assignment.js
  30. +1 −0  lib/uglifyjs/test/unit/compress/expected/concatstring.js
  31. +1 −0  lib/uglifyjs/test/unit/compress/expected/const.js
  32. +1 −0  lib/uglifyjs/test/unit/compress/expected/empty-blocks.js
  33. +1 −0  lib/uglifyjs/test/unit/compress/expected/forstatement.js
  34. +1 −0  lib/uglifyjs/test/unit/compress/expected/if.js
  35. +1 −0  lib/uglifyjs/test/unit/compress/expected/ifreturn.js
  36. +1 −0  lib/uglifyjs/test/unit/compress/expected/issue10.js
  37. +1 −0  lib/uglifyjs/test/unit/compress/expected/issue11.js
  38. +1 −0  lib/uglifyjs/test/unit/compress/expected/issue13.js
  39. +1 −0  lib/uglifyjs/test/unit/compress/expected/issue14.js
  40. +1 −0  lib/uglifyjs/test/unit/compress/expected/issue16.js
  41. +1 −0  lib/uglifyjs/test/unit/compress/expected/issue17.js
  42. +1 −0  lib/uglifyjs/test/unit/compress/expected/issue20.js
  43. +1 −0  lib/uglifyjs/test/unit/compress/expected/issue21.js
  44. +1 −0  lib/uglifyjs/test/unit/compress/expected/issue25.js
  45. +1 −0  lib/uglifyjs/test/unit/compress/expected/issue27.js
  46. +1 −0  lib/uglifyjs/test/unit/compress/expected/issue28.js
  47. +1 −0  lib/uglifyjs/test/unit/compress/expected/issue29.js
  48. +1 −0  lib/uglifyjs/test/unit/compress/expected/issue30.js
  49. +1 −0  lib/uglifyjs/test/unit/compress/expected/issue34.js
  50. +1 −0  lib/uglifyjs/test/unit/compress/expected/issue4.js
  51. +1 −0  lib/uglifyjs/test/unit/compress/expected/issue48.js
  52. +1 −0  lib/uglifyjs/test/unit/compress/expected/issue50.js
  53. +1 −0  lib/uglifyjs/test/unit/compress/expected/issue53.js
  54. +1 −0  lib/uglifyjs/test/unit/compress/expected/issue54.1.js
  55. +1 −0  lib/uglifyjs/test/unit/compress/expected/issue68.js
  56. +1 −0  lib/uglifyjs/test/unit/compress/expected/issue69.js
  57. +1 −0  lib/uglifyjs/test/unit/compress/expected/issue9.js
  58. +1 −0  lib/uglifyjs/test/unit/compress/expected/strict-equals.js
  59. +1 −0  lib/uglifyjs/test/unit/compress/expected/var.js
  60. +3 −0  lib/uglifyjs/test/unit/compress/test/array1.js
  61. +4 −0 lib/uglifyjs/test/unit/compress/test/array2.js
  62. +4 −0 lib/uglifyjs/test/unit/compress/test/array3.js
  63. +6 −0 lib/uglifyjs/test/unit/compress/test/array4.js
  64. +20 −0 lib/uglifyjs/test/unit/compress/test/assignment.js
  65. +3 −0  lib/uglifyjs/test/unit/compress/test/concatstring.js
  66. +5 −0 lib/uglifyjs/test/unit/compress/test/const.js
  67. +4 −0 lib/uglifyjs/test/unit/compress/test/empty-blocks.js
  68. +10 −0 lib/uglifyjs/test/unit/compress/test/forstatement.js
  69. +6 −0 lib/uglifyjs/test/unit/compress/test/if.js
  70. +9 −0 lib/uglifyjs/test/unit/compress/test/ifreturn.js
  71. +1 −0  lib/uglifyjs/test/unit/compress/test/issue10.js
  72. +3 −0  lib/uglifyjs/test/unit/compress/test/issue11.js
  73. +1 −0  lib/uglifyjs/test/unit/compress/test/issue13.js
  74. +1 −0  lib/uglifyjs/test/unit/compress/test/issue14.js
  75. +1 −0  lib/uglifyjs/test/unit/compress/test/issue16.js
  76. +4 −0 lib/uglifyjs/test/unit/compress/test/issue17.js
  77. +1 −0  lib/uglifyjs/test/unit/compress/test/issue20.js
  78. +6 −0 lib/uglifyjs/test/unit/compress/test/issue21.js
  79. +7 −0 lib/uglifyjs/test/unit/compress/test/issue25.js
  80. +1 −0  lib/uglifyjs/test/unit/compress/test/issue27.js
  81. +3 −0  lib/uglifyjs/test/unit/compress/test/issue28.js
  82. +1 −0  lib/uglifyjs/test/unit/compress/test/issue29.js
  83. +3 −0  lib/uglifyjs/test/unit/compress/test/issue30.js
  84. +3 −0  lib/uglifyjs/test/unit/compress/test/issue34.js
  85. +3 −0  lib/uglifyjs/test/unit/compress/test/issue4.js
  86. +1 −0  lib/uglifyjs/test/unit/compress/test/issue48.js
  87. +9 −0 lib/uglifyjs/test/unit/compress/test/issue50.js
  88. +1 −0  lib/uglifyjs/test/unit/compress/test/issue53.js
  89. +3 −0  lib/uglifyjs/test/unit/compress/test/issue54.1.js
  90. +5 −0 lib/uglifyjs/test/unit/compress/test/issue68.js
  91. +1 −0  lib/uglifyjs/test/unit/compress/test/issue69.js
  92. +4 −0 lib/uglifyjs/test/unit/compress/test/issue9.js
  93. +3 −0  lib/uglifyjs/test/unit/compress/test/strict-equals.js
  94. +3 −0  lib/uglifyjs/test/unit/compress/test/var.js
  95. +46 −0 lib/uglifyjs/test/unit/scripts.js
  96. +3 −12 src/core/call.js
View
6 Makefile
@@ -1,7 +1,5 @@
JS_COMPILER = \
- java -jar lib/google-compiler/compiler.jar \
- --externs=src/externs.js \
- --charset=UTF-8
+ ./lib/uglifyjs/bin/uglifyjs
all: \
d3.js \
@@ -155,7 +153,7 @@ tests: \
%.min.js: %.js Makefile
@rm -f $@
- $(JS_COMPILER) --js $< --js_output_file $@
+ $(JS_COMPILER) < $< > $@
d3.js d3%.js: Makefile
@rm -f $@
View
4 d3.behavior.min.js
@@ -1,3 +1 @@
-(function(){d3.behavior={};d3.behavior.zoom=function(){function a(){this.on("mousedown",t).on("mousewheel",n).on("DOMMouseScroll",n).on("dblclick",n);d3.select(window).on("mousemove",q).on("mouseup",u)}function t(e,f){c={x0:g-d3.event.clientX,y0:h-d3.event.clientY,target:this,data:e,index:f};d3.event.preventDefault();window.focus()}function q(){a=null;if(c){g=d3.event.clientX+c.x0;h=d3.event.clientY+c.y0;r.call(c.target,c.data,c.index)}}function u(){if(c){q();c=null}}function n(e,f){var b=d3.event;
-if(!a){var i=d3.svg.mouse(this.nearestViewportElement||this);a={x0:g,y0:h,z0:j,x1:g-i[0],y1:h-i[1]}}if(b.type=="dblclick")j=b.shiftKey?Math.ceil(j-1):Math.floor(j+1);else{i=(b.wheelDelta/120||-b.detail)*0.1;if(o<0){var l=Date.now(),k=l-s;if(k>9&&Math.abs(b.wheelDelta)/k>=50)o=1;s=l}if(o==1)i*=0.03;j+=i}b=Math.pow(2,j-a.z0)-1;g=a.x0+a.x1*b;h=a.y0+a.y1*b;r.call(this,e,f)}function r(e,f){function b(d,m){var v=d.__domain||(d.__domain=d.domain());range=d.range().map(function(w){return(w-m)/l});d.domain(v).domain(range.map(d.invert))}
-var i=d3.event,l=Math.pow(2,j);d3.event={scale:l,translate:[g,h],transform:function(d,m){d&&b(d,g);m&&b(m,h)}};try{for(var k=0,x=p.length;k<x;k++)p[k].call(this,e,f)}finally{d3.event=i}}var o=/WebKit\/533/.test(navigator.userAgent)?-1:0,s=0,g=0,h=0,j=0,p=[],c;a.on=function(e,f){e=="zoom"&&p.push(f);return a};return a}})();
+(function(){d3.behavior={},d3.behavior.zoom=function(){function m(a,b){function i(a,b){var c=a.__domain||(a.__domain=a.domain());range=a.range().map(function(a){return(a-b)/h}),a.domain(c).domain(range.map(a.invert))}var g=d3.event,h=Math.pow(2,e);d3.event={scale:h,translate:[c,d],transform:function(a,b){a&&i(a,c),b&&i(b,d)}};try{for(var j=0,k=f.length;j<k;j++)f[j].call(this,a,b)}finally{d3.event=g}}function l(f,g){var i=d3.event;if(!h){var j=d3.svg.mouse(this.nearestViewportElement||this);h={x0:c,y0:d,z0:e,x1:c-j[0],y1:d-j[1]}}if(i.type=="dblclick")e=i.shiftKey?Math.ceil(e-1):Math.floor(e+1);else{var k=(i.wheelDelta/120||-i.detail)*.1;if(a<0){var l=Date.now(),n=l-b;n>9&&Math.abs(i.wheelDelta)/n>=50&&(a=1),b=l}a==1&&(k*=.03),e+=k}var o=Math.pow(2,e-h.z0)-1;c=h.x0+h.x1*o,d=h.y0+h.y1*o,m.call(this,f,g)}function k(){g&&(j(),g=null)}function j(){h=null,g&&(c=d3.event.clientX+g.x0,d=d3.event.clientY+g.y0,m.call(g.target,g.data,g.index))}function i(a,b){g={x0:c-d3.event.clientX,y0:d-d3.event.clientY,target:this,data:a,index:b},d3.event.preventDefault(),window.focus()}function h(){var a=this.on("mousedown",i).on("mousewheel",l).on("DOMMouseScroll",l).on("dblclick",l);d3.select(window).on("mousemove",j).on("mouseup",k)}var a=/WebKit\/533/.test(navigator.userAgent)?-1:0,b=0,c=0,d=0,e=0,f=[],g,h;h.on=function(a,b){a=="zoom"&&f.push(b);return h};return h}})()
View
4 d3.csv.min.js
@@ -1,3 +1 @@
-(function(){function n(a){return a.map(o).join(",")}function o(a){return/[",\n]/.test(a)?'"'+a.replace(/\"/g,'""')+'"':a}d3.csv=function(a,c){d3.text(a,"text/csv",function(d){c(d&&d3.csv.parse(d))})};d3.csv.parse=function(a){var c;return d3.csv.parseRows(a,function(d,k){if(k){for(var f={},g=-1,e=c.length;++g<e;)f[c[g]]=d[g];return f}else{c=d;return null}})};d3.csv.parseRows=function(a,c){function d(){if(e.lastIndex==a.length)return f;if(h){h=false;return k}var i=e.lastIndex;if(a.charCodeAt(i)==34){for(var b=
-i;b++<a.length;)if(a.charCodeAt(b)==34){if(a.charCodeAt(b+1)!=34)break;b++}e.lastIndex=b+2;var m=a.charCodeAt(b+1);if(m==13){h=true;a.charCodeAt(b+2)==10&&e.lastIndex++}else if(m==10)h=true;return a.substring(i+1,b).replace(/""/g,'"')}if(b=e.exec(a)){h=b[0].charCodeAt(0)!=44;return a.substring(i,b.index)}e.lastIndex=a.length;return a.substring(i)}for(var k={},f={},g=[],e=/\r\n|[,\r\n]/g,p=0,j,h;(j=d())!==f;){for(var l=[];j!==k&&j!==f;){l.push(j);j=d()}c&&!(l=c(l,p++))||g.push(l)}return g};d3.csv.format=
-function(a){return a.map(n).join("\n")}})();
+(function(){function b(a){return/[",\n]/.test(a)?'"'+a.replace(/\"/g,'""')+'"':a}function a(a){return a.map(b).join(",")}d3.csv=function(a,b){d3.text(a,"text/csv",function(a){b(a&&d3.csv.parse(a))})},d3.csv.parse=function(a){var b;return d3.csv.parseRows(a,function(a,c){if(c){var d={},e=-1,f=b.length;while(++e<f)d[b[e]]=a[e];return d}b=a;return null})},d3.csv.parseRows=function(a,b){function j(){if(f.lastIndex==a.length)return d;if(i){i=!1;return c}var b=f.lastIndex;if(a.charCodeAt(b)==34){var e=b;while(e++<a.length)if(a.charCodeAt(e)==34){if(a.charCodeAt(e+1)!=34)break;e++}f.lastIndex=e+2;var g=a.charCodeAt(e+1);g==13?(i=!0,a.charCodeAt(e+2)==10&&f.lastIndex++):g==10&&(i=!0);return a.substring(b+1,e).replace(/""/g,'"')}var h=f.exec(a);if(h){i=h[0].charCodeAt(0)!=44;return a.substring(b,h.index)}f.lastIndex=a.length;return a.substring(b)}var c={},d={},e=[],f=/\r\n|[,\r\n]/g,g=0,h,i;while((h=j())!==d){var k=[];while(h!==c&&h!==d)k.push(h),h=j();if(b&&!(k=b(k,g++)))continue;e.push(k)}return e},d3.csv.format=function(b){return b.map(a).join("\n")}})()
View
12 d3.geo.min.js
@@ -1,11 +1 @@
-(function(){function v(b){return"m0,"+b+"a"+b+","+b+" 0 1,1 0,"+-2*b+"a"+b+","+b+" 0 1,1 0,"+ +2*b+"z"}function u(){return 0}function q(b,d){return d&&d.type in b?b[d.type](d):""}function w(b,d){if(b.type in y)y[b.type](b,d)}function z(b,d){for(var g=b.coordinates,e=0,k=g.length;e<k;e++)d.apply(null,g[e])}d3.geo={};d3.geo.albers=function(){function b(a){var c=l*(r*a[0]-i);a=Math.sqrt(p-2*l*Math.sin(r*a[1]))/l;return[k*a*Math.sin(c)+h[0],k*(a*Math.cos(c)-s)+h[1]]}function d(){var a=r*e[0],c=r*e[1],
-f=r*g[1],j=Math.sin(a);a=Math.cos(a);i=r*g[0];l=0.5*(j+Math.sin(c));p=a*a+2*l*j;s=Math.sqrt(p-2*l*Math.sin(f))/l;return b}var g=[-98,38],e=[29.5,45.5],k=1E3,h=[480,250],i,l,p,s;b.origin=function(a){if(!arguments.length)return g;g=[+a[0],+a[1]];return d()};b.parallels=function(a){if(!arguments.length)return e;e=[+a[0],+a[1]];return d()};b.scale=function(a){if(!arguments.length)return k;k=+a;return b};b.translate=function(a){if(!arguments.length)return h;h=[+a[0],+a[1]];return b};return d()};d3.geo.albersUsa=
-function(){function b(h){var i=h[0],l=h[1];return(l<25?i<-100?e:k:l>50?g:d)(h)}var d=d3.geo.albers(),g=d3.geo.albers().origin([-160,60]).parallels([55,65]),e=d3.geo.albers().origin([-160,20]).parallels([8,18]),k=d3.geo.albers().origin([-60,10]).parallels([8,18]);b.scale=function(h){if(!arguments.length)return d.scale();d.scale(h);g.scale(h*0.6);e.scale(h);k.scale(h*1.5);return b.translate(d.translate())};b.translate=function(h){if(!arguments.length)return d.translate();var i=d.scale()/1E3,l=h[0],
-p=h[1];d.translate(h);g.translate([l-400*i,p+170*i]);e.translate([l-190*i,p+200*i]);k.translate([l+580*i,p+430*i]);return b};return b.scale(d.scale())};var r=Math.PI/180;d3.geo.mercator=function(){function b(e){return[d*(e[0]/360)+g[0],d*Math.max(-0.5,Math.min(0.5,-180/Math.PI*Math.log(Math.tan(Math.PI/4+e[1]*Math.PI/360))/360))+g[1]]}var d=500,g=[480,250];b.scale=function(e){if(!arguments.length)return d;d=+e;return b};b.translate=function(e){if(!arguments.length)return g;g=[+e[0],+e[1]];return b};
-return b};d3.geo.path=function(){function b(a){if(typeof k=="function")h=v(k.apply(this,arguments));return q(l,a)}function d(a){return i(a).join(",")}function g(a){for(var c=Math.abs(d3.geom.polygon(a[0].map(i)).area()),f=0,j=a.length;++f<j;)c-=Math.abs(d3.geom.polygon(a[f].map(i)).area());return c}function e(a){for(var c=d3.geom.polygon(a[0].map(i)),f=c.centroid(1),j=f[0],m=f[1],n=Math.abs(c.area()),o=0,t=a.length;++o<t;){c=d3.geom.polygon(a[o].map(i));f=c.centroid(1);j-=f[0];m-=f[1];n-=Math.abs(c.area())}return[j,
-m,6*n]}var k=4.5,h=v(k),i=d3.geo.albersUsa(),l={FeatureCollection:function(a){var c=[];a=a.features;for(var f=-1,j=a.length;++f<j;)c.push(q(l,a[f].geometry));return c.join("")},Feature:function(a){return q(l,a.geometry)},Point:function(a){return"M"+d(a.coordinates)+h},MultiPoint:function(a){var c=[];a=a.coordinates;for(var f=-1,j=a.length;++f<j;)c.push("M",d(a[f]),h);return c.join("")},LineString:function(a){var c=["M"];a=a.coordinates;for(var f=-1,j=a.length;++f<j;)c.push(d(a[f]),"L");c.pop();return c.join("")},
-MultiLineString:function(a){var c=[];a=a.coordinates;for(var f=-1,j=a.length,m,n,o;++f<j;){m=a[f];n=-1;o=m.length;for(c.push("M");++n<o;)c.push(d(m[n]),"L");c.pop()}return c.join("")},Polygon:function(a){var c=[];a=a.coordinates;for(var f=-1,j=a.length,m,n,o;++f<j;){m=a[f];n=-1;o=m.length;for(c.push("M");++n<o;)c.push(d(m[n]),"L");c[c.length-1]="Z"}return c.join("")},MultiPolygon:function(a){var c=[];a=a.coordinates;for(var f=-1,j=a.length,m,n,o,t,x,A;++f<j;){m=a[f];n=-1;for(o=m.length;++n<o;){t=
-m[n];x=-1;A=t.length-1;for(c.push("M");++x<A;)c.push(d(t[x]),"L");c[c.length-1]="Z"}}return c.join("")},GeometryCollection:function(a){var c=[];a=a.geometries;for(var f=-1,j=a.length;++f<j;)c.push(q(l,a[f]));return c.join("")}},p={FeatureCollection:function(a){var c=0;a=a.features;for(var f=-1,j=a.length;++f<j;)c+=q(p,a[f]);return c},Feature:function(a){return q(p,a.geometry)},Point:u,MultiPoint:u,LineString:u,MultiLineString:u,Polygon:function(a){return g(a.coordinates)},MultiPolygon:function(a){var c=
-0;a=a.coordinates;for(var f=-1,j=a.length;++f<j;)c+=g(a[f]);return c},GeometryCollection:function(a){var c=0;a=a.geometries;for(var f=-1,j=a.length;++f<j;)c+=q(p,a[f]);return c}},s={Feature:function(a){return q(s,a.geometry)},Polygon:function(a){a=e(a.coordinates);return[a[0]/a[2],a[1]/a[2]]},MultiPolygon:function(a){a=a.coordinates;for(var c,f=0,j=0,m=0,n=-1,o=a.length;++n<o;){c=e(a[n]);f+=c[0];j+=c[1];m+=c[2]}return[f/m,j/m]}};b.projection=function(a){i=a;return b};b.area=function(a){return q(p,
-a)};b.centroid=function(a){return q(s,a)};b.pointRadius=function(a){if(typeof a=="function")k=a;else{k=+a;h=v(k)}return b};return b};d3.geo.bounds=function(b){var d=Infinity,g=Infinity,e=-Infinity,k=-Infinity;w(b,function(h,i){if(h<d)d=h;if(h>e)e=h;if(i<g)g=i;if(i>k)k=i});return[[d,g],[e,k]]};var y={Feature:function(b,d){w(b.geometry,d)},FeatureCollection:function(b,d){for(var g=b.features,e=0,k=g.length;e<k;e++)w(g[e].geometry,d)},LineString:z,MultiLineString:function(b,d){for(var g=b.coordinates,
-e=0,k=g.length;e<k;e++)for(var h=g[e],i=0,l=h.length;i<l;i++)d.apply(null,h[i])},MultiPoint:z,MultiPolygon:function(b,d){for(var g=b.coordinates,e=0,k=g.length;e<k;e++)for(var h=g[e][0],i=0,l=h.length;i<l;i++)d.apply(null,h[i])},Point:function(b,d){d.apply(null,b.coordinates)},Polygon:function(b,d){for(var g=b.coordinates[0],e=0,k=g.length;e<k;e++)d.apply(null,g[e])}}})();
+(function(){function m(a,b){for(var c=a.coordinates[0],d=0,e=c.length;d<e;d++)b.apply(null,c[d])}function l(a,b){b.apply(null,a.coordinates)}function k(a,b){for(var c=a.coordinates,d=0,e=c.length;d<e;d++)for(var f=c[d][0],g=0,h=f.length;g<h;g++)b.apply(null,f[g])}function j(a,b){for(var c=a.coordinates,d=0,e=c.length;d<e;d++)for(var f=c[d],g=0,h=f.length;g<h;g++)b.apply(null,f[g])}function i(a,b){for(var c=a.coordinates,d=0,e=c.length;d<e;d++)b.apply(null,c[d])}function h(a,b){for(var c=a.features,d=0,f=c.length;d<f;d++)e(c[d].geometry,b)}function g(a,b){e(a.geometry,b)}function e(a,b){a.type in f&&f[a.type](a,b)}function d(a,b){return b&&b.type in a?a[b.type](b):""}function c(){return 0}function b(a){return"m0,"+a+"a"+a+","+a+" 0 1,1 0,"+ -2*a+"a"+a+","+a+" 0 1,1 0,"+2*a+"z"}d3.geo={},d3.geo.albers=function(){function k(){var d=a*c[0],e=a*c[1],k=a*b[1],l=Math.sin(d),m=Math.cos(d);f=a*b[0],g=.5*(l+Math.sin(e)),h=m*m+2*g*l,i=Math.sqrt(h-2*g*Math.sin(k))/g;return j}function j(b){var c=g*(a*b[0]-f),j=Math.sqrt(h-2*g*Math.sin(a*b[1]))/g;return[d*j*Math.sin(c)+e[0],d*(j*Math.cos(c)-i)+e[1]]}var b=[-98,38],c=[29.5,45.5],d=1e3,e=[480,250],f,g,h,i;j.origin=function(a){if(!arguments.length)return b;b=[+a[0],+a[1]];return k()},j.parallels=function(a){if(!arguments.length)return c;c=[+a[0],+a[1]];return k()},j.scale=function(a){if(!arguments.length)return d;d=+a;return j},j.translate=function(a){if(!arguments.length)return e;e=[+a[0],+a[1]];return j};return k()},d3.geo.albersUsa=function(){function e(e){var f=e[0],g=e[1];return(g<25?f<-100?c:d:g>50?b:a)(e)}var a=d3.geo.albers(),b=d3.geo.albers().origin([-160,60]).parallels([55,65]),c=d3.geo.albers().origin([-160,20]).parallels([8,18]),d=d3.geo.albers().origin([-60,10]).parallels([8,18]);e.scale=function(f){if(!arguments.length)return a.scale();a.scale(f),b.scale(f*.6),c.scale(f),d.scale(f*1.5);return e.translate(a.translate())},e.translate=function(f){if(!arguments.length)return a.translate();var g=a.scale()/1e3,h=f[0],i=f[1];a.translate(f),b.translate([h-400*g,i+170*g]),c.translate([h-190*g,i+200*g]),d.translate([h+580*g,i+430*g]);return e};return e.scale(a.scale())};var a=Math.PI/180;d3.geo.mercator=function(){function c(c){var d=c[0]/360,e=-180/Math.PI*Math.log(Math.tan(Math.PI/4+c[1]*Math.PI/360))/360;return[a*d+b[0],a*Math.max(-0.5,Math.min(.5,e))+b[1]]}var a=500,b=[480,250];c.scale=function(b){if(!arguments.length)return a;a=+b;return c},c.translate=function(a){if(!arguments.length)return b;b=[+a[0],+a[1]];return c};return c},d3.geo.path=function(){function n(a){return Math.abs(d3.geom.polygon(a.map(f)).area())}function l(a){var b=d3.geom.polygon(a[0].map(f)),c=b.centroid(1),d=c[0],e=c[1],g=Math.abs(b.area()),h=0,i=a.length;while(++h<i)b=d3.geom.polygon(a[h].map(f)),c=b.centroid(1),d-=c[0],e-=c[1],g-=Math.abs(b.area());return[d,e,6*g]}function k(a){var b=n(a[0]),c=0,d=a.length;while(++c<d)b-=n(a[c]);return b}function h(a){return f(a).join(",")}function g(c,f){typeof a=="function"&&(e=b(a.apply(this,arguments)));return d(i,c)}var a=4.5,e=b(a),f=d3.geo.albersUsa(),i={FeatureCollection:function(a){var b=[],c=a.features,e=-1,f=c.length;while(++e<f)b.push(d(i,c[e].geometry));return b.join("")},Feature:function(a){return d(i,a.geometry)},Point:function(a){return"M"+h(a.coordinates)+e},MultiPoint:function(a){var b=[],c=a.coordinates,d=-1,f=c.length;while(++d<f)b.push("M",h(c[d]),e);return b.join("")},LineString:function(a){var b=["M"],c=a.coordinates,d=-1,e=c.length;while(++d<e)b.push(h(c[d]),"L");b.pop();return b.join("")},MultiLineString:function(a){var b=[],c=a.coordinates,d=-1,e=c.length,f,g,i;while(++d<e){f=c[d],g=-1,i=f.length,b.push("M");while(++g<i)b.push(h(f[g]),"L");b.pop()}return b.join("")},Polygon:function(a){var b=[],c=a.coordinates,d=-1,e=c.length,f,g,i;while(++d<e){f=c[d],g=-1,i=f.length,b.push("M");while(++g<i)b.push(h(f[g]),"L");b[b.length-1]="Z"}return b.join("")},MultiPolygon:function(a){var b=[],c=a.coordinates,d=-1,e=c.length,f,g,i,j,k,l;while(++d<e){f=c[d],g=-1,i=f.length;while(++g<i){j=f[g],k=-1,l=j.length-1,b.push("M");while(++k<l)b.push(h(j[k]),"L");b[b.length-1]="Z"}}return b.join("")},GeometryCollection:function(a){var b=[],c=a.geometries,e=-1,f=c.length;while(++e<f)b.push(d(i,c[e]));return b.join("")}},j={FeatureCollection:function(a){var b=0,c=a.features,e=-1,f=c.length;while(++e<f)b+=d(j,c[e]);return b},Feature:function(a){return d(j,a.geometry)},Point:c,MultiPoint:c,LineString:c,MultiLineString:c,Polygon:function(a){return k(a.coordinates)},MultiPolygon:function(a){var b=0,c=a.coordinates,d=-1,e=c.length;while(++d<e)b+=k(c[d]);return b},GeometryCollection:function(a){var b=0,c=a.geometries,e=-1,f=c.length;while(++e<f)b+=d(j,c[e]);return b}},m={Feature:function(a){return d(m,a.geometry)},Polygon:function(a){var b=l(a.coordinates);return[b[0]/b[2],b[1]/b[2]]},MultiPolygon:function(a){var b=0,c=a.coordinates,d,e=0,f=0,g=0,h=-1,i=c.length;while(++h<i)d=l(c[h]),e+=d[0],f+=d[1],g+=d[2];return[e/g,f/g]}};g.projection=function(a){f=a;return g},g.area=function(a){return d(j,a)},g.centroid=function(a){return d(m,a)},g.pointRadius=function(c){typeof c=="function"?a=c:(a=+c,e=b(a));return g};return g},d3.geo.bounds=function(a){var b=Infinity,c=Infinity,d=-Infinity,f=-Infinity;e(a,function(a,e){a<b&&(b=a),a>d&&(d=a),e<c&&(c=e),e>f&&(f=e)});return[[b,c],[d,f]]};var f={Feature:g,FeatureCollection:h,LineString:i,MultiLineString:j,MultiPoint:i,MultiPolygon:k,Point:l,Polygon:m}})()
View
16 d3.geom.min.js
@@ -1,15 +1 @@
-(function(){function E(c,g,d,a){var f,b,e;c=a[c];f=c[0];b=c[1];c=a[g];g=c[0];e=c[1];c=a[d];return(c[1]-b)*(g-f)-(e-b)*(c[0]-f)>0}function A(c,g,d){return(d[0]-g[0])*(c[1]-g[1])<(d[1]-g[1])*(c[0]-g[0])}function C(c,g,d,a){var f=c[0],b=d[0];c=c[1];var e=d[1];d=g[0]-f;var l=a[0]-b;g=g[1]-c;a=a[1]-e;b=(l*(c-e)-a*(f-b))/(a*d-l*g);return[f+b*d,c+b*g]}function D(c,g){var d={list:c.map(function(h,i){return{index:i,x:h[0],y:h[1]}}).sort(function(h,i){return h.y<i.y?-1:h.y>i.y?1:h.x<i.x?-1:h.x>i.x?1:0}),bottomSite:null},
-a={list:[],leftEnd:null,rightEnd:null,init:function(){a.leftEnd=a.createHalfEdge(null,"l");a.rightEnd=a.createHalfEdge(null,"l");a.leftEnd.r=a.rightEnd;a.rightEnd.l=a.leftEnd;a.list.unshift(a.leftEnd,a.rightEnd)},createHalfEdge:function(h,i){return{edge:h,side:i,vertex:null,l:null,r:null}},insert:function(h,i){i.l=h;i.r=h.r;h.r.l=i;h.r=i},leftBound:function(h){var i=a.leftEnd;do i=i.r;while(i!=a.rightEnd&&f.rightOf(i,h));return i=i.l},del:function(h){h.l.r=h.r;h.r.l=h.l;h.edge=null},right:function(h){return h.r},
-left:function(h){return h.l},leftRegion:function(h){return h.edge==null?d.bottomSite:h.edge.region[h.side]},rightRegion:function(h){return h.edge==null?d.bottomSite:h.edge.region[B[h.side]]}},f={bisect:function(h,i){var j={region:{l:h,r:i},ep:{l:null,r:null}},m=i.x-h.x,r=i.y-h.y;j.c=h.x*m+h.y*r+(m*m+r*r)*0.5;if((m>0?m:-m)>(r>0?r:-r)){j.a=1;j.b=r/m;j.c/=m}else{j.b=1;j.a=m/r;j.c/=r}return j},intersect:function(h,i){var j=h.edge,m=i.edge;if(!j||!m||j.region.r==m.region.r)return null;var r=j.a*m.b-j.b*
-m.a;if(Math.abs(r)<1.0E-10)return null;var u=(j.c*m.b-m.c*j.b)/r;r=(m.c*j.a-j.c*m.a)/r;var w=j.region.r,y=m.region.r;if(w.y<y.y||w.y==y.y&&w.x<y.x)w=h;else{w=i;j=m}if((j=u>=j.region.r.x)&&w.side=="l"||!j&&w.side=="r")return null;return{x:u,y:r}},rightOf:function(h,i){var j=h.edge,m=j.region.r,r=i.x>m.x;if(r&&h.side=="l")return 1;if(!r&&h.side=="r")return 0;if(j.a==1){var u=i.y-m.y,w=i.x-m.x,y=0,x=0;if(!r&&j.b<0||r&&j.b>=0)x=y=u>=j.b*w;else{x=i.x+i.y*j.b>j.c;if(j.b<0)x=!x;x||(y=1)}if(!y){m=m.x-j.region.l.x;
-x=j.b*(w*w-u*u)<m*u*(1+2*w/m+j.b*j.b);if(j.b<0)x=!x}}else{w=j.c-j.a*i.x;j=i.y-w;u=i.x-m.x;m=w-m.y;x=j*j>u*u+m*m}return h.side=="l"?x:!x},endPoint:function(h,i,j){h.ep[i]=j;h.ep[B[i]]&&g(h)},distance:function(h,i){var j=h.x-i.x,m=h.y-i.y;return Math.sqrt(j*j+m*m)}},b={list:[],insert:function(h,i,j){h.vertex=i;h.ystar=i.y+j;j=0;for(var m=b.list,r=m.length;j<r;j++){var u=m[j];if(!(h.ystar>u.ystar||h.ystar==u.ystar&&i.x>u.vertex.x))break}m.splice(j,0,h)},del:function(h){for(var i=0,j=b.list,m=j.length;i<
-m&&j[i]!=h;++i);j.splice(i,1)},empty:function(){return b.list.length==0},nextEvent:function(h){for(var i=0,j=b.list,m=j.length;i<m;++i)if(j[i]==h)return j[i+1];return null},min:function(){var h=b.list[0];return{x:h.vertex.x,y:h.ystar}},extractMin:function(){return b.list.shift()}};a.init();d.bottomSite=d.list.shift();for(var e=d.list.shift(),l,k,o,p,s,n,t,q,v;;){b.empty()||(l=b.min());if(e&&(b.empty()||e.y<l.y||e.y==l.y&&e.x<l.x)){k=a.leftBound(e);o=a.right(k);t=a.rightRegion(k);v=f.bisect(t,e);n=
-a.createHalfEdge(v,"l");a.insert(k,n);if(q=f.intersect(k,n)){b.del(k);b.insert(k,q,f.distance(q,e))}k=n;n=a.createHalfEdge(v,"r");a.insert(k,n);(q=f.intersect(n,o))&&b.insert(n,q,f.distance(q,e));e=d.list.shift()}else if(b.empty())break;else{k=b.extractMin();p=a.left(k);o=a.right(k);s=a.right(o);t=a.leftRegion(k);n=a.rightRegion(o);q=k.vertex;f.endPoint(k.edge,k.side,q);f.endPoint(o.edge,o.side,q);a.del(k);b.del(o);a.del(o);k="l";if(t.y>n.y){k=t;t=n;n=k;k="r"}v=f.bisect(t,n);n=a.createHalfEdge(v,
-k);a.insert(p,n);f.endPoint(v,B[k],q);if(q=f.intersect(p,n)){b.del(p);b.insert(p,q,f.distance(q,t))}(q=f.intersect(n,s))&&b.insert(n,q,f.distance(q,t))}}for(k=a.right(a.leftEnd);k!=a.rightEnd;k=a.right(k))g(k.edge)}function z(c,g,d,a,f,b){if(!c(g,d,a,f,b)){var e=(d+f)*0.5,l=(a+b)*0.5;g=g.nodes;g[0]&&z(c,g[0],d,a,e,l);g[1]&&z(c,g[1],e,a,f,l);g[2]&&z(c,g[2],d,l,e,b);g[3]&&z(c,g[3],e,l,f,b)}}d3.geom={};d3.geom.contour=function(c,g){var d;if(!(d=g))a:{for(var a=d=0;;){if(c(d,a)){d=[d,a];break a}if(d==
-0){d=a+1;a=0}else{d-=1;a+=1}}d=void 0}a=[];var f=d[0],b=d[1],e=0,l=0,k=NaN,o=NaN;l=0;do{l=0;if(c(f-1,b-1))l+=1;if(c(f,b-1))l+=2;if(c(f-1,b))l+=4;if(c(f,b))l+=8;if(l==6){e=o==-1?-1:1;l=0}else if(l==9){e=0;l=k==1?-1:1}else{e=F[l];l=G[l]}if(e!=k&&l!=o){a.push([f,b]);k=e;o=l}f+=e;b+=l}while(d[0]!=f||d[1]!=b);return a};var F=[1,0,1,1,-1,0,-1,1,0,0,0,0,-1,0,-1,NaN],G=[0,-1,0,0,0,-1,0,0,1,-1,1,1,0,-1,0,NaN];d3.geom.hull=function(c){if(c.length<3)return[];var g=c.length,d=g-1,a=[],f=[],b,e=0,l,k,o,p,s,n,
-t;for(b=1;b<g;++b)if(c[b][1]<c[e][1])e=b;else if(c[b][1]==c[e][1])e=c[b][0]<c[e][0]?b:e;for(b=0;b<g;++b)if(b!=e){k=c[b][1]-c[e][1];l=c[b][0]-c[e][0];a.push({angle:Math.atan2(k,l),index:b})}a.sort(function(q,v){return q.angle-v.angle});t=a[0].angle;n=a[0].index;s=0;for(b=1;b<d;++b){g=a[b].index;if(t==a[b].angle){l=c[n][0]-c[e][0];k=c[n][1]-c[e][1];o=c[g][0]-c[e][0];p=c[g][1]-c[e][1];if(l*l+k*k>=o*o+p*p)a[b].index=-1;else{a[s].index=-1;t=a[b].angle;s=b;n=g}}else{t=a[b].angle;s=b;n=g}}f.push(e);for(g=
-b=0;b<2;++g)if(a[g].index!=-1){f.push(a[g].index);b++}for(e=f.length;g<d;++g)if(a[g].index!=-1){for(;!E(f[e-2],f[e-1],a[g].index,c);)--e;f[e++]=a[g].index}d=[];for(b=0;b<e;++b)d.push(c[f[b]]);return d};d3.geom.polygon=function(c){c.area=function(){for(var g=0,d=c.length,a=c[d-1][0]*c[0][1],f=c[d-1][1]*c[0][0];++g<d;){a+=c[g-1][0]*c[g][1];f+=c[g-1][1]*c[g][0]}return(f-a)*0.5};c.centroid=function(g){var d=-1,a=c.length-1,f=0,b=0,e,l,k;for(arguments.length||(g=1/(6*c.area()));++d<a;){e=c[d];l=c[d+1];
-k=e[0]*l[1]-l[0]*e[1];f+=(e[0]+l[0])*k;b+=(e[1]+l[1])*k}return[f*g,b*g]};c.clip=function(g){for(var d,a=-1,f=c.length,b,e,l=c[f-1],k,o,p;++a<f;){d=g.slice();g.length=0;k=c[a];o=d[(e=d.length)-1];for(b=-1;++b<e;){p=d[b];if(A(p,l,k)){A(o,l,k)||g.push(C(o,p,l,k));g.push(p)}else A(o,l,k)&&g.push(C(o,p,l,k));o=p}l=k}return g};return c};d3.geom.voronoi=function(c){var g=c.map(function(){return[]});D(c,function(d){var a,f,b,e;if(d.a==1&&d.b>=0){a=d.ep.r;f=d.ep.l}else{a=d.ep.l;f=d.ep.r}if(d.a==1){b=a?a.y:
--1E6;a=d.c-d.b*b;e=f?f.y:1E6;f=d.c-d.b*e}else{a=a?a.x:-1E6;b=d.c-d.a*a;f=f?f.x:1E6;e=d.c-d.a*f}a=[a,b];f=[f,e];g[d.region.l.index].push(a,f);g[d.region.r.index].push(a,f)});return g.map(function(d,a){var f=c[a][0],b=c[a][1];d.forEach(function(e){e.angle=Math.atan2(e[0]-f,e[1]-b)});return d.sort(function(e,l){return e.angle-l.angle}).filter(function(e,l){return!l||e.angle-d[l-1].angle>1.0E-10})})};var B={l:"r",r:"l"};d3.geom.delaunay=function(c){var g=c.map(function(){return[]}),d=[];D(c,function(a){g[a.region.l.index].push(c[a.region.r.index])});
-g.forEach(function(a,f){var b=c[f],e=b[0],l=b[1];a.forEach(function(p){p.angle=Math.atan2(p[0]-e,p[1]-l)});a.sort(function(p,s){return p.angle-s.angle});for(var k=0,o=a.length-1;k<o;k++)d.push([b,a[k],a[k+1]])});return d};d3.geom.quadtree=function(c){function g(s,n,t,q,v,h){if(!(isNaN(n[0])||isNaN(n[1])))if(s.leaf){var i=s.point;if(i){if(!(Math.abs(i[0]-n[0])+Math.abs(i[1]-n[1])<0.01)){s.point=null;d(s,i,t,q,v,h)}d(s,n,t,q,v,h)}else s.point=n}else d(s,n,t,q,v,h)}function d(s,n,t,q,v,h){var i=(t+v)*
-0.5,j=(q+h)*0.5,m=n[0]>=i,r=n[1]>=j,u=(r<<1)+m;s.leaf=false;s=s.nodes[u]||(s.nodes[u]={leaf:true,nodes:[],point:null});if(m)t=i;else v=i;if(r)q=j;else h=j;g(s,n,t,q,v,h)}for(var a,f=-1,b=c.length,e=Number.POSITIVE_INFINITY,l=e,k=Number.NEGATIVE_INFINITY,o=k;++f<b;){a=c[f];if(a[0]<e)e=a[0];if(a[1]<l)l=a[1];if(a[0]>k)k=a[0];if(a[1]>o)o=a[1]}a=k-e;f=o-l;if(a>f)o=l+a;else k=e+f;var p={leaf:true,nodes:[],point:null};for(f=-1;++f<b;)g(p,c[f],e,l,k,o);p.visit=function(s){z(s,p,e,l,k,o)};return p}})();
+(function(){function j(a,b,c,d,e,f){if(!a(b,c,d,e,f)){var g=(c+e)*.5,h=(d+f)*.5,i=b.nodes;i[0]&&j(a,i[0],c,d,g,h),i[1]&&j(a,i[1],g,d,e,h),i[2]&&j(a,i[2],c,h,g,f),i[3]&&j(a,i[3],g,h,e,f)}}function i(){return{leaf:!0,nodes:[],point:null}}function h(a,b){var c={list:a.map(function(a,b){return{index:b,x:a[0],y:a[1]}}).sort(function(a,b){return a.y<b.y?-1:a.y>b.y?1:a.x<b.x?-1:a.x>b.x?1:0}),bottomSite:null},d={list:[],leftEnd:null,rightEnd:null,init:function(){d.leftEnd=d.createHalfEdge(null,"l"),d.rightEnd=d.createHalfEdge(null,"l"),d.leftEnd.r=d.rightEnd,d.rightEnd.l=d.leftEnd,d.list.unshift(d.leftEnd,d.rightEnd)},createHalfEdge:function(a,b){return{edge:a,side:b,vertex:null,l:null,r:null}},insert:function(a,b){b.l=a,b.r=a.r,a.r.l=b,a.r=b},leftBound:function(a){var b=d.leftEnd;do b=b.r;while(b!=d.rightEnd&&e.rightOf(b,a));b=b.l;return b},del:function(a){a.l.r=a.r,a.r.l=a.l,a.edge=null},right:function(a){return a.r},left:function(a){return a.l},leftRegion:function(a){return a.edge==null?c.bottomSite:a.edge.region[a.side]},rightRegion:function(a){return a.edge==null?c.bottomSite:a.edge.region[g[a.side]]}},e={bisect:function(a,b){var c={region:{l:a,r:b},ep:{l:null,r:null}},d=b.x-a.x,e=b.y-a.y,f=d>0?d:-d,g=e>0?e:-e;c.c=a.x*d+a.y*e+(d*d+e*e)*.5,f>g?(c.a=1,c.b=e/d,c.c/=d):(c.b=1,c.a=d/e,c.c/=e);return c},intersect:function(a,b){var c=a.edge,d=b.edge;if(!c||!d||c.region.r==d.region.r)return null;var e=c.a*d.b-c.b*d.a;if(Math.abs(e)<1e-10)return null;var f=(c.c*d.b-d.c*c.b)/e,g=(d.c*c.a-c.c*d.a)/e,h=c.region.r,i=d.region.r,j,k;h.y<i.y||h.y==i.y&&h.x<i.x?(j=a,k=c):(j=b,k=d);var l=f>=k.region.r.x;if(l&&j.side=="l"||!l&&j.side=="r")return null;return{x:f,y:g}},rightOf:function(a,b){var c=a.edge,d=c.region.r,e=b.x>d.x;if(e&&a.side=="l")return 1;if(!e&&a.side=="r")return 0;if(c.a==1){var f=b.y-d.y,g=b.x-d.x,h=0,i=0;!e&&c.b<0||e&&c.b>=0?i=h=f>=c.b*g:(i=b.x+b.y*c.b>c.c,c.b<0&&(i=!i),i||(h=1));if(!h){var j=d.x-c.region.l.x;i=c.b*(g*g-f*f)<j*f*(1+2*g/j+c.b*c.b),c.b<0&&(i=!i)}}else{var k=c.c-c.a*b.x,l=b.y-k,m=b.x-d.x,n=k-d.y;i=l*l>m*m+n*n}return a.side=="l"?i:!i},endPoint:function(a,c,d){a.ep[c]=d;!a.ep[g[c]]||b(a)},distance:function(a,b){var c=a.x-b.x,d=a.y-b.y;return Math.sqrt(c*c+d*d)}},f={list:[],insert:function(a,b,c){a.vertex=b,a.ystar=b.y+c;for(var d=0,e=f.list,g=e.length;d<g;d++){var h=e[d];if(a.ystar>h.ystar||a.ystar==h.ystar&&b.x>h.vertex.x)continue;break}e.splice(d,0,a)},del:function(a){for(var b=0,c=f.list,d=c.length;b<d&&c[b]!=a;++b);c.splice(b,1)},empty:function(){return f.list.length==0},nextEvent:function(a){for(var b=0,c=f.list,d=c.length;b<d;++b)if(c[b]==a)return c[b+1];return null},min:function(){var a=f.list[0];return{x:a.vertex.x,y:a.ystar}},extractMin:function(){return f.list.shift()}};d.init(),c.bottomSite=c.list.shift();var h=c.list.shift(),i,j,k,l,m,n,o,p,q,r,s,t,u;for(;;){f.empty()||(i=f.min());if(h&&(f.empty()||h.y<i.y||h.y==i.y&&h.x<i.x))j=d.leftBound(h),k=d.right(j),o=d.rightRegion(j),t=e.bisect(o,h),n=d.createHalfEdge(t,"l"),d.insert(j,n),r=e.intersect(j,n),r&&(f.del(j),f.insert(j,r,e.distance(r,h))),j=n,n=d.createHalfEdge(t,"r"),d.insert(j,n),r=e.intersect(n,k),r&&f.insert(n,r,e.distance(r,h)),h=c.list.shift();else if(!f.empty())j=f.extractMin(),l=d.left(j),k=d.right(j),m=d.right(k),o=d.leftRegion(j),p=d.rightRegion(k),s=j.vertex,e.endPoint(j.edge,j.side,s),e.endPoint(k.edge,k.side,s),d.del(j),f.del(k),d.del(k),u="l",o.y>p.y&&(q=o,o=p,p=q,u="r"),t=e.bisect(o,p),n=d.createHalfEdge(t,u),d.insert(l,n),e.endPoint(t,g[u],s),r=e.intersect(l,n),r&&(f.del(l),f.insert(l,r,e.distance(r,o))),r=e.intersect(n,m),r&&f.insert(n,r,e.distance(r,o));else break}for(j=d.right(d.leftEnd);j!=d.rightEnd;j=d.right(j))b(j.edge)}function f(a,b,c,d){var e=a[0],f=b[0],g=c[0],h=d[0],i=a[1],j=b[1],k=c[1],l=d[1],m=e-g,n=f-e,o=h-g,p=i-k,q=j-i,r=l-k,s=(o*p-r*m)/(r*n-o*q);return[e+s*n,i+s*q]}function e(a,b,c){return(c[0]-b[0])*(a[1]-b[1])<(c[1]-b[1])*(a[0]-b[0])}function d(a,b,c,d){var e,f,g,h,i,j,k;e=d[a],f=e[0],g=e[1],e=d[b],h=e[0],i=e[1],e=d[c],j=e[0],k=e[1];return(k-g)*(h-f)-(i-g)*(j-f)>0}function c(a){var b=0,c=0;for(;;){if(a(b,c))return[b,c];b==0?(b=c+1,c=0):(b=b-1,c=c+1)}}d3.geom={},d3.geom.contour=function(d,e){var f=e||c(d),g=[],h=f[0],i=f[1],j=0,k=0,l=NaN,m=NaN,n=0;do n=0,d(h-1,i-1)&&(n+=1),d(h,i-1)&&(n+=2),d(h-1,i)&&(n+=4),d(h,i)&&(n+=8),n==6?(j=m==-1?-1:1,k=0):n==9?(j=0,k=l==1?-1:1):(j=a[n],k=b[n]),j!=l&&k!=m&&(g.push([h,i]),l=j,m=k),h+=j,i+=k;while(f[0]!=h||f[1]!=i);return g};var a=[1,0,1,1,-1,0,-1,1,0,0,0,0,-1,0,-1,NaN],b=[0,-1,0,0,0,-1,0,0,1,-1,1,1,0,-1,0,NaN];d3.geom.hull=function(a){if(a.length<3)return[];var b=a.length,c=b-1,e=[],f=[],g,h,i=0,j,k,l,m,n,o,p,q;for(g=1;g<b;++g)a[g][1]<a[i][1]?i=g:a[g][1]==a[i][1]&&(i=a[g][0]<a[i][0]?g:i);for(g=0;g<b;++g){if(g==i)continue;k=a[g][1]-a[i][1],j=a[g][0]-a[i][0],e.push({angle:Math.atan2(k,j),index:g})}e.sort(function(a,b){return a.angle-b.angle}),p=e[0].angle,o=e[0].index,n=0;for(g=1;g<c;++g)h=e[g].index,p==e[g].angle?(j=a[o][0]-a[i][0],k=a[o][1]-a[i][1],l=a[h][0]-a[i][0],m=a[h][1]-a[i][1],j*j+k*k>=l*l+m*m?e[g].index=-1:(e[n].index=-1,p=e[g].angle,n=g,o=h)):(p=e[g].angle,n=g,o=h);f.push(i);for(g=0,h=0;g<2;++h)e[h].index!=-1&&(f.push(e[h].index),g++);q=f.length;for(;h<c;++h){if(e[h].index==-1)continue;while(!d(f[q-2],f[q-1],e[h].index,a))--q;f[q++]=e[h].index}var r=[];for(g=0;g<q;++g)r.push(a[f[g]]);return r},d3.geom.polygon=function(a){a.area=function(){var b=0,c=a.length,d=a[c-1][0]*a[0][1],e=a[c-1][1]*a[0][0];while(++b<c)d+=a[b-1][0]*a[b][1],e+=a[b-1][1]*a[b][0];return(e-d)*.5},a.centroid=function(b){var c=-1,d=a.length-1,e=0,f=0,g,h,i;arguments.length||(b=1/(6*a.area()));while(++c<d)g=a[c],h=a[c+1],i=g[0]*h[1]-h[0]*g[1],e+=(g[0]+h[0])*i,f+=(g[1]+h[1])*i;return[e*b,f*b]},a.clip=function(b){var c,d=-1,g=a.length,h,i,j=a[g-1],k,l,m;while(++d<g){c=b.slice(),b.length=0,k=a[d],l=c[(i=c.length)-1],h=-1;while(++h<i)m=c[h],e(m,j,k)?(e(l,j,k)||b.push(f(l,m,j,k)),b.push(m)):e(l,j,k)&&b.push(f(l,m,j,k)),l=m;j=k}return b};return a},d3.geom.voronoi=function(a){var b=a.map(function(){return[]});h(a,function(a){var c,d,e,f,g,h;a.a==1&&a.b>=0?(c=a.ep.r,d=a.ep.l):(c=a.ep.l,d=a.ep.r),a.a==1?(g=c?c.y:-1e6,e=a.c-a.b*g,h=d?d.y:1e6,f=a.c-a.b*h):(e=c?c.x:-1e6,g=a.c-a.a*e,f=d?d.x:1e6,h=a.c-a.a*f);var i=[e,g],j=[f,h];b[a.region.l.index].push(i,j),b[a.region.r.index].push(i,j)});return b.map(function(b,c){var d=a[c][0],e=a[c][1];b.forEach(function(a){a.angle=Math.atan2(a[0]-d,a[1]-e)});return b.sort(function(a,b){return a.angle-b.angle}).filter(function(a,c){return!c||a.angle-b[c-1].angle>1e-10})})};var g={l:"r",r:"l"};d3.geom.delaunay=function(a){var b=a.map(function(){return[]}),c=[];h(a,function(c){b[c.region.l.index].push(a[c.region.r.index])}),b.forEach(function(b,d){var e=a[d],f=e[0],g=e[1];b.forEach(function(a){a.angle=Math.atan2(a[0]-f,a[1]-g)}),b.sort(function(a,b){return a.angle-b.angle});for(var h=0,i=b.length-1;h<i;h++)c.push([e,b[h],b[h+1]])});return c},d3.geom.quadtree=function(a){function n(a,b,c,d,e,f){var g=(c+e)*.5,h=(d+f)*.5,j=b[0]>=g,k=b[1]>=h,l=(k<<1)+j;a.leaf=!1,a=a.nodes[l]||(a.nodes[l]=i()),j?c=g:e=g,k?d=h:f=h,m(a,b,c,d,e,f)}function m(a,b,c,d,e,f){if(!isNaN(b[0])&&!isNaN(b[1]))if(a.leaf){var g=a.point;g?Math.abs(g[0]-b[0])+Math.abs(g[1]-b[1])<.01?n(a,b,c,d,e,f):(a.point=null,n(a,g,c,d,e,f),n(a,b,c,d,e,f)):a.point=b}else n(a,b,c,d,e,f)}var b,c=-1,d=a.length,e=Number.POSITIVE_INFINITY,f=e,g=Number.NEGATIVE_INFINITY,h=g;while(++c<d)b=a[c],b[0]<e&&(e=b[0]),b[1]<f&&(f=b[1]),b[0]>g&&(g=b[0]),b[1]>h&&(h=b[1]);var k=g-e,l=h-f;k>l?h=f+k:g=e+l;var o=i();c=-1;while(++c<d)m(o,a[c],e,f,g,h);o.visit=function(a){j(a,o,e,f,g,h)};return o}})()
View
15 d3.js
@@ -195,19 +195,10 @@ function d3_splitter(d) {
function d3_collapse(s) {
return s.replace(/(^\s+)|(\s+$)/g, "").replace(/\s+/g, " ");
}
-//
-// Note: assigning to the arguments array simultaneously changes the value of
-// the corresponding argument! However, the Google Closure compiler doesn't
-// realize this, and so can optimize-away our attempt to avoid side-effects.
-// This fix by Jason Davies has been tested to survive minimization.
-//
-// TODO The `this` argument probably shouldn't be the first argument to the
-// callback, anyway, since it's redundant. However, that will require a major
-// version bump due to backwards compatibility, so I'm not changing it right
-// away.
-//
function d3_call(callback) {
- callback.apply(this, (arguments[0] = this, arguments));
+ var f = callback;
+ arguments[0] = this;
+ f.apply(this, arguments);
return this;
}
/**
View
18 d3.layout.min.js
@@ -1,17 +1 @@
-(function(){function A(g){return g.reduce(B,0)}function C(g){for(var l=1,i=0,k=g[0].y,m,h=g.length;l<h;++l)if((m=g[l].y)>k){i=l;k=m}return i}function B(g,l){return g+l.y}function D(g){return g.children}function E(g){return g.value}function F(g,l){return l.value-g.value}d3.layout={};d3.layout.chord=function(){function g(){var e={},c=[],p=d3.range(b),o=[],q,r,u,s,t;k=[];m=[];q=0;for(s=-1;++s<b;){r=0;for(t=-1;++t<b;)r+=h[s][t];c.push(r);o.push(d3.range(b));q+=r}n&&p.sort(function(z,x){return n(c[z],
-c[x])});f&&o.forEach(function(z,x){z.sort(function(G,H){return f(h[x][G],h[x][H])})});q=(2*Math.PI-j*b)/q;r=0;for(s=-1;++s<b;){u=r;for(t=-1;++t<b;){var v=p[s],w=o[s][t],y=h[v][w];e[v+"-"+w]={index:v,subindex:w,startAngle:r,endAngle:r+=y*q,value:y}}m.push({index:v,startAngle:u,endAngle:r,value:(r-u)/q});r+=j}for(s=-1;++s<b;)for(t=s-1;++t<b;){p=e[s+"-"+t];o=e[t+"-"+s];if(p.value||o.value)k.push({source:p,target:o})}a&&l()}function l(){k.sort(function(e,c){e=Math.min(e.source.value,e.target.value);c=
-Math.min(c.source.value,c.target.value);return a(e,c)})}var i={},k,m,h,b,j=0,n,f,a;i.matrix=function(e){if(!arguments.length)return h;b=(h=e)&&h.length;k=m=null;return i};i.padding=function(e){if(!arguments.length)return j;j=e;k=m=null;return i};i.sortGroups=function(e){if(!arguments.length)return n;n=e;k=m=null;return i};i.sortSubgroups=function(e){if(!arguments.length)return f;f=e;k=null;return i};i.sortChords=function(e){if(!arguments.length)return a;a=e;k&&l();return i};i.chords=function(){k||
-g();return k};i.groups=function(){m||g();return m};return i};d3.layout.force=function(){function g(){var f=n.length,a,e,c,p,o,q,r;for(a=0;a<f;++a){e=n[a];c=e.source;p=e.target;q=p.x-c.x;r=p.y-c.y;if(o=Math.sqrt(q*q+r*r)){o=m/(e.distance*e.distance)*(o-h*e.distance)/o;q*=o;r*=o;if(!p.fixed){p.x-=q;p.y-=r}if(!c.fixed){c.x+=q;c.y+=r}}}i.tick.dispatch({type:"tick"});return(m*=0.99)<0.0050}var l={},i=d3.dispatch("tick"),k=[1,1],m=0.5,h=30,b,j,n;l.on=function(f,a){i[f].add(a);return l};l.nodes=function(f){if(!arguments.length)return b;
-b=f;return l};l.links=function(f){if(!arguments.length)return j;j=f;return l};l.size=function(f){if(!arguments.length)return k;k=f;return l};l.distance=function(f){if(!arguments.length)return h;h=f;return l};l.start=function(){var f,a,e,c=b.length;e=j.length;var p=k[0],o=k[1],q=[];for(f=0;f<c;++f){a=b[f];a.x=a.x||Math.random()*p;a.y=a.y||Math.random()*o;a.fixed=0;q[f]=[];for(a=0;a<c;++a)q[f][a]=Infinity;q[f][f]=0}for(f=0;f<e;++f){a=j[f];q[a.source][a.target]=1;q[a.target][a.source]=1;a.source=b[a.source];
-a.target=b[a.target]}for(e=0;e<c;++e)for(f=0;f<c;++f)for(a=0;a<c;++a)q[f][a]=Math.min(q[f][a],q[f][e]+q[e][a]);n=[];for(f=0;f<c;++f)for(a=f+1;a<c;++a)n.push({source:b[f],target:b[a],distance:q[f][a]*q[f][a]});n.sort(function(r,u){return r.distance-u.distance});d3.timer(g);return l};l.resume=function(){m=0.1;d3.timer(g);return l};l.stop=function(){m=0;return l};l.drag=function(){function f(){if(a){var c=d3.svg.mouse(e);a.x=c[0];a.y=c[1];l.resume()}}var a,e;this.on("mouseover",function(c){c.fixed=true}).on("mouseout",
-function(c){if(c!=a)c.fixed=false}).on("mousedown",function(c){(a=c).fixed=true;e=this;d3.event.preventDefault()});d3.select(window).on("mousemove",f).on("mouseup",function(){if(a){f();a.fixed=false;a=e=null}});return l};return l};d3.layout.partition=function(){function g(h,b,j,n){var f=h.children;h.x=b;h.y=h.depth*n;h.dx=j;h.dy=n;if(f){var a=-1,e=f.length,c;for(j/=h.value;++a<e;){g(c=f[a],b,h=c.value*j,n);b+=h}}}function l(h){h=h.children;var b=0;if(h)for(var j=-1,n=h.length;++j<n;)b=Math.max(b,
-l(h[j]));return 1+b}function i(h,b){var j=k.call(this,h,b);g(j[0],0,m[0],m[1]/l(j[0]));return j}var k=d3.layout.hierarchy(),m=[1,1];i.sort=d3.rebind(i,k.sort);i.children=d3.rebind(i,k.children);i.value=d3.rebind(i,k.value);i.size=function(h){if(!arguments.length)return m;m=h;return i};return i};d3.layout.pie=function(){function g(h){var b=+(typeof k=="function"?k.apply(this,arguments):k),j=(typeof m=="function"?m.apply(this,arguments):m)-k,n=d3.range(h.length);i!=null&&n.sort(function(e,c){return i(h[e],
-h[c])});var f=h.map(l);j/=f.reduce(function(e,c){return e+c},0);var a=n.map(function(e){return{value:d=f[e],startAngle:b,endAngle:b+=d*j}});return h.map(function(e,c){return a[n[c]]})}var l=Number,i=null,k=0,m=2*Math.PI;g.value=function(h){if(!arguments.length)return l;l=h;return g};g.sort=function(h){if(!arguments.length)return i;i=h;return g};g.startAngle=function(h){if(!arguments.length)return k;k=h;return g};g.endAngle=function(h){if(!arguments.length)return m;m=h;return g};return g};d3.layout.stack=
-function(){function g(k){var m=k.length,h=k[0].length,b,j,n,f=I[l](k);J[i](k,f);for(j=0;j<h;++j){b=1;for(n=k[f[0]][j].y0;b<m;++b)k[f[b]][j].y0=n+=k[f[b-1]][j].y}return k}var l="default",i="zero";g.order=function(k){if(!arguments.length)return l;l=k;return g};g.offset=function(k){if(!arguments.length)return i;i=k;return g};return g};var I={"inside-out":function(g){var l=g.length,i,k=g.map(C),m=g.map(A),h=d3.range(l).sort(function(a,e){return k[a]-k[e]}),b=0,j=0,n=[],f=[];for(g=0;g<l;g++){i=h[g];if(b<
-j){b+=m[i];n.push(i)}else{j+=m[i];f.push(i)}}return f.reverse().concat(n)},reverse:function(g){return d3.range(g.length).reverse()},"default":function(g){return d3.range(g.length)}},J={silhouette:function(g,l){var i=g.length,k=g[0].length,m=[],h=0,b,j,n;for(j=0;j<k;++j){for(n=b=0;b<i;b++)n+=g[b][j].y;if(n>h)h=n;m.push(n)}j=0;for(b=l[0];j<k;++j)g[b][j].y0=(h-m[j])/2},wiggle:function(g,l){var i=g.length,k=g[0],m=k.length,h,b,j,n,f,a=l[0],e,c,p,o,q,r;g[a][0].y0=q=r=0;for(b=1;b<m;++b){for(e=h=0;h<i;++h)e+=
-g[h][b].y;c=h=0;for(o=k[b].x-k[b-1].x;h<i;++h){j=0;n=l[h];for(p=(g[n][b].y-g[n][b-1].y)/(2*o);j<h;++j)p+=(g[f=l[j]][b].y-g[f][b-1].y)/o;c+=p*g[n][b].y}g[a][b].y0=q-=e?c/e*o:0;if(q<r)r=q}for(b=0;b<m;++b)g[a][b].y0-=r},zero:function(g,l){for(var i=0,k=g[0].length,m=l[0];i<k;++i)g[m][i].y0=0}};d3.layout.hierarchy=function(){function g(b,j,n){var f=m.call(i,b,j),a={depth:j,data:b};n.push(a);if(f){b=-1;var e=f.length,c=a.children=[],p=0;for(j+=1;++b<e;){d=g(f[b],j,n);if(d.value>0){c.push(d);p+=d.value;
-d.parent=a}}k&&c.sort(k);a.value=p}else a.value=h.call(i,b,j);return a}function l(b,j){var n=b.children,f=0;if(n)for(var a=-1,e=n.length,c=j+1;++a<e;)f+=l(n[a],c);else f=h.call(i,b.data,j);return b.value=f}function i(b){var j=[];g(b,0,j);return j}var k=F,m=D,h=E;i.sort=function(b){if(!arguments.length)return k;k=b;return i};i.children=function(b){if(!arguments.length)return m;m=b;return i};i.value=function(b){if(!arguments.length)return h;h=b;return i};i.revalue=function(b){l(b,0);return b};return i};
-d3.layout.treemap=function(){function g(a,e){var c=a.children;a.area=a.value*e;if(c)for(var p=-1,o=c.length;++p<o;)g(c[p],e)}function l(a){if(a.children){var e={x:a.x,y:a.y,dx:a.dx,dy:a.dy},c=[],p=a.children.slice(),o,q=Infinity,r=Math.min(e.dx,e.dy);for(c.area=0;(o=p.length)>0;){c.push(o=p[o-1]);c.area+=o.area;o=r;for(var u=c.area,s=void 0,t=0,v=Infinity,w=-1,y=c.length;++w<y;){s=c[w].area;if(s<v)v=s;if(s>t)t=s}u*=u;o*=o;if((o=Math.max(o*t/u,u/(o*v)))<=q){p.pop();q=o}else{c.area-=c.pop().area;k(c,
-r,e,false);r=Math.min(e.dx,e.dy);c.length=c.area=0;q=Infinity}}if(c.length){k(c,r,e,true);c.length=c.area=0}a.children.forEach(l)}}function i(a){if(a.children){var e={x:a.x,y:a.y,dx:a.dx,dy:a.dy},c=a.children.slice(),p,o=[];for(o.area=0;p=c.pop();){o.push(p);o.area+=p.area;if(p.z!=null){k(o,p.z?e.dx:e.dy,e,!c.length);o.length=o.area=0}}a.children.forEach(i)}}function k(a,e,c,p){var o=-1,q=a.length,r=c.x,u=c.y,s=e?b(a.area/e):0,t;if(e==c.dx){if(p||s>c.dy)s=c.dy;for(;++o<q;){t=a[o];t.x=r;t.y=u;t.dy=
-s;r+=t.dx=b(t.area/s)}t.z=true;t.dx+=c.x+c.dx-r;c.y+=s;c.dy-=s}else{if(p||s>c.dx)s=c.dx;for(;++o<q;){t=a[o];t.x=r;t.y=u;t.dx=s;u+=t.dy=b(t.area/s)}t.z=false;t.dy+=c.y+c.dy-u;c.x+=s;c.dx-=s}}function m(a){a=f||h(a);var e=a[0];e.x=0;e.y=0;e.dx=j[0];e.dy=j[1];f&&h.revalue(e);g(e,j[0]*j[1]/e.value);(f?i:l)(e);if(n)f=a;return a}var h=d3.layout.hierarchy(),b=Math.round,j=[1,1],n=false,f;m.sort=d3.rebind(m,h.sort);m.children=d3.rebind(m,h.children);m.value=d3.rebind(m,h.value);m.size=function(a){if(!arguments.length)return j;
-j=a;return m};m.round=function(a){if(!arguments.length)return b!=Number;b=a?Math.round:Number;return m};m.sticky=function(a){if(!arguments.length)return n;n=a;f=null;return m};return m}})();
+(function(){function i(a,b){return b.value-a.value}function h(a){return a.value}function g(a){return a.children}function f(a,b){return a+b.y}function e(a){var b=1,c=0,d=a[0].y,e,f=a.length;for(;b<f;++b)(e=a[b].y)>d&&(c=b,d=e);return c}function c(a){return a.reduce(f,0)}d3.layout={},d3.layout.chord=function(){function k(){b.sort(function(a,b){a=Math.min(a.source.value,a.target.value),b=Math.min(b.source.value,b.target.value);return i(a,b)})}function j(){var a={},j=[],l=d3.range(e),m=[],o,p,q,r,s;b=[],c=[],o=0,r=-1;while(++r<e){p=0,s=-1;while(++s<e)p+=d[r][s];j.push(p),m.push(d3.range(e)),o+=p}g&&l.sort(function(a,b){return g(j[a],j[b])}),h&&m.forEach(function(a,b){a.sort(function(a,c){return h(d[b][a],d[b][c])})}),o=(2*Math.PI-f*e)/o,p=0,r=-1;while(++r<e){q=p,s=-1;while(++s<e){var t=l[r],u=m[r][s],v=d[t][u];a[t+"-"+u]={index:t,subindex:u,startAngle:p,endAngle:p+=v*o,value:v}}c.push({index:t,startAngle:q,endAngle:p,value:(p-q)/o}),p+=f}r=-1;while(++r<e){s=r-1;while(++s<e){var w=a[r+"-"+s],x=a[s+"-"+r];(w.value||x.value)&&b.push({source:w,target:x})}}i&&k()}var a={},b,c,d,e,f=0,g,h,i;a.matrix=function(f){if(!arguments.length)return d;e=(d=f)&&d.length,b=c=null;return a},a.padding=function(d){if(!arguments.length)return f;f=d,b=c=null;return a},a.sortGroups=function(d){if(!arguments.length)return g;g=d,b=c=null;return a},a.sortSubgroups=function(c){if(!arguments.length)return h;h=c,b=null;return a},a.sortChords=function(c){if(!arguments.length)return i;i=c,b&&k();return a},a.chords=function(){b||j();return b},a.groups=function(){c||j();return c};return a},d3.layout.force=function(){function j(){var a=i.length,c,f,g,h,j,k,l;for(c=0;c<a;++c){f=i[c],g=f.source,h=f.target,k=h.x-g.x,l=h.y-g.y;if(j=Math.sqrt(k*k+l*l))j=d/(f.distance*f.distance)*(j-e*f.distance)/j,k*=j,l*=j,h.fixed||(h.x-=k,h.y-=l),g.fixed||(g.x+=k,g.y+=l)}b.tick.dispatch({type:"tick"});return(d*=.99)<.005}var a={},b=d3.dispatch("tick"),c=[1,1],d=.5,e=30,f,g,h,i;a.on=function(c,d){b[c].add(d);return a},a.nodes=function(b){if(!arguments.length)return g;g=b;return a},a.links=function(b){if(!arguments.length)return h;h=b;return a},a.size=function(b){if(!arguments.length)return c;c=b;return a},a.distance=function(b){if(!arguments.length)return e;e=b;return a},a.start=function(){var b,d,e,f=g.length,k=h.length,l=c[0],m=c[1],n,o=[];for(b=0;b<f;++b){n=g[b],n.x=n.x||Math.random()*l,n.y=n.y||Math.random()*m,n.fixed=0,o[b]=[];for(d=0;d<f;++d)o[b][d]=Infinity;o[b][b]=0}for(b=0;b<k;++b)n=h[b],o[n.source][n.target]=1,o[n.target][n.source]=1,n.source=g[n.source],n.target=g[n.target];for(e=0;e<f;++e)for(b=0;b<f;++b)for(d=0;d<f;++d)o[b][d]=Math.min(o[b][d],o[b][e]+o[e][d]);i=[];for(b=0;b<f;++b)for(d=b+1;d<f;++d)i.push({source:g[b],target:g[d],distance:o[b][d]*o[b][d]});i.sort(function(a,b){return a.distance-b.distance}),d3.timer(j);return a},a.resume=function(){d=.1,d3.timer(j);return a},a.stop=function(){d=0;return a},a.drag=function(){function f(){!b||(e(),b.fixed=!1,b=c=null)}function e(){if(!!b){var d=d3.svg.mouse(c);b.x=d[0],b.y=d[1],a.resume()}}function d(a){(b=a).fixed=!0,c=this,d3.event.preventDefault()}var b,c;this.on("mouseover",function(a){a.fixed=!0}).on("mouseout",function(a){a!=b&&(a.fixed=!1)}).on("mousedown",d),d3.select(window).on("mousemove",e).on("mouseup",f);return a};return a},d3.layout.partition=function(){function e(e,f){var g=a.call(this,e,f);c(g[0],0,b[0],b[1]/d(g[0]));return g}function d(a){var b=a.children,c=0;if(b){var e=-1,f=b.length;while(++e<f)c=Math.max(c,d(b[e]))}return 1+c}function c(a,b,d,e){var f=a.children;a.x=b,a.y=a.depth*e,a.dx=d,a.dy=e;if(f){var g=-1,h=f.length,i,j;d/=a.value;while(++g<h)c(i=f[g],b,j=i.value*d,e),b+=j}}var a=d3.layout.hierarchy(),b=[1,1];e.sort=d3.rebind(e,a.sort),e.children=d3.rebind(e,a.children),e.value=d3.rebind(e,a.value),e.size=function(a){if(!arguments.length)return b;b=a;return e};return e},d3.layout.pie=function(){function f(f,g){var h=+(typeof c=="function"?c.apply(this,arguments):c),i=(typeof e=="function"?e.apply(this,arguments):e)-c,j=d3.range(f.length);b!=null&&j.sort(function(a,c){return b(f[a],f[c])});var k=f.map(a);i/=k.reduce(function(a,b){return a+b},0);var l=j.map(function(a){return{value:d=k[a],startAngle:h,endAngle:h+=d*i}});return f.map(function(a,b){return l[j[b]]})}var a=Number,b=null,c=0,e=2*Math.PI;f.value=function(b){if(!arguments.length)return a;a=b;return f},f.sort=function(a){if(!arguments.length)return b;b=a;return f},f.startAngle=function(a){if(!arguments.length)return c;c=a;return f},f.endAngle=function(a){if(!arguments.length)return e;e=a;return f};return f},d3.layout.stack=function(){function e(e){var f=e.length,g=e[0].length,h,i,j,k=a[c](e);b[d](e,k);for(i=0;i<g;++i)for(h=1,j=e[k[0]][i].y0;h<f;++h)e[k[h]][i].y0=j+=e[k[h-1]][i].y;return e}var c="default",d="zero";e.order=function(a){if(!arguments.length)return c;c=a;return e},e.offset=function(a){if(!arguments.length)return d;d=a;return e};return e};var a={"inside-out":function(a){var b=a.length,d,f,g=a.map(e),h=a.map(c),i=d3.range(b).sort(function(a,b){return g[a]-g[b]}),j=0,k=0,l=[],m=[];for(d=0;d<b;d++)f=i[d],j<k?(j+=h[f],l.push(f)):(k+=h[f],m.push(f));return m.reverse().concat(l)},reverse:function(a){return d3.range(a.length).reverse()},"default":function(a){return d3.range(a.length)}},b={silhouette:function(a,b){var c=a.length,d=a[0].length,e=[],f=0,g,h,i;for(h=0;h<d;++h){for(g=0,i=0;g<c;g++)i+=a[g][h].y;i>f&&(f=i),e.push(i)}for(h=0,g=b[0];h<d;++h)a[g][h].y0=(f-e[h])/2},wiggle:function(a,b){var c=a.length,d=a[0],e=d.length,f=0,g,h,i,j,k,l=b[0],m,n,o,p,q,r;a[l][0].y0=q=r=0;for(h=1;h<e;++h){for(g=0,m=0;g<c;++g)m+=a[g][h].y;for(g=0,n=0,p=d[h].x-d[h-1].x;g<c;++g){for(i=0,j=b[g],o=(a[j][h].y-a[j][h-1].y)/(2*p);i<g;++i)o+=(a[k=b[i]][h].y-a[k][h-1].y)/p;n+=o*a[j][h].y}a[l][h].y0=q-=m?n/m*p:0,q<r&&(r=q)}for(h=0;h<e;++h)a[l][h].y0-=r},zero:function(a,b){var c=0,d=a[0].length,e=b[0];for(;c<d;++c)a[e][c].y0=0}};d3.layout.hierarchy=function(){function j(a){var b=[];e(a,0,b);return b}function f(a,b){var d=a.children,e=0;if(d){var g=-1,h=d.length,i=b+1;while(++g<h)e+=f(d[g],i)}else e=c.call(j,a.data,b);return a.value=e}function e(f,g,h){var i=b.call(j,f,g),k={depth:g,data:f};h.push(k);if(i){var l=-1,m=i.length,n=k.children=[],o=0,p=g+1;while(++l<m)d=e(i[l],p,h),d.value>0&&(n.push(d),o+=d.value,d.parent=k);a&&n.sort(a),k.value=o}else k.value=c.call(j,f,g);return k}var a=i,b=g,c=h;j.sort=function(b){if(!arguments.length)return a;a=b;return j},j.children=function(a){if(!arguments.length)return b;b=a;return j},j.value=function(a){if(!arguments.length)return c;c=a;return j},j.revalue=function(a){f(a,0);return a};return j},d3.layout.treemap=function(){function k(b){var i=e||a(b),j=i[0];j.x=0,j.y=0,j.dx=c[0],j.dy=c[1],e&&a.revalue(j),f(j,c[0]*c[1]/j.value),(e?h:g)(j),d&&(e=i);return i}function j(a,c,d,e){var f=-1,g=a.length,h=d.x,i=d.y,j=c?b(a.area/c):0,k;if(c==d.dx){if(e||j>d.dy)j=d.dy;while(++f<g)k=a[f],k.x=h,k.y=i,k.dy=j,h+=k.dx=b(k.area/j);k.z=!0,k.dx+=d.x+d.dx-h,d.y+=j,d.dy-=j}else{if(e||j>d.dx)j=d.dx;while(++f<g)k=a[f],k.x=h,k.y=i,k.dx=j,i+=k.dy=b(k.area/j);k.z=!1,k.dy+=d.y+d.dy-i,d.x+=j,d.dx-=j}}function i(a,b){var c=a.area,d,e=0,f=Infinity,g=-1,h=a.length;while(++g<h)d=a[g].area,d<f&&(f=d),d>e&&(e=d);c*=c,b*=b;return Math.max(b*e/c,c/(b*f))}function h(a){if(!!a.children){var b={x:a.x,y:a.y,dx:a.dx,dy:a.dy},c=a.children.slice(),d,e=[];e.area=0;while(d=c.pop())e.push(d),e.area+=d.area,d.z!=null&&(j(e,d.z?b.dx:b.dy,b,!c.length),e.length=e.area=0);a.children.forEach(h)}}function g(a){if(!!a.children){var b={x:a.x,y:a.y,dx:a.dx,dy:a.dy},c=[],d=a.children.slice(),e,f=Infinity,h,k=Math.min(b.dx,b.dy),l;c.area=0;while((l=d.length)>0)c.push(e=d[l-1]),c.area+=e.area,(h=i(c,k))<=f?(d.pop(),f=h):(c.area-=c.pop().area,j(c,k,b,!1),k=Math.min(b.dx,b.dy),c.length=c.area=0,f=Infinity);c.length&&(j(c,k,b,!0),c.length=c.area=0),a.children.forEach(g)}}function f(a,b){var c=a.children;a.area=a.value*b;if(c){var d=-1,e=c.length;while(++d<e)f(c[d],b)}}var a=d3.layout.hierarchy(),b=Math.round,c=[1,1],d=!1,e;k.sort=d3.rebind(k,a.sort),k.children=d3.rebind(k,a.children),k.value=d3.rebind(k,a.value),k.size=function(a){if(!arguments.length)return c;c=a;return k},k.round=function(a){if(!arguments.length)return b!=Number;b=a?Math.round:Number;return k},k.sticky=function(a){if(!arguments.length)return d;d=a,e=null;return k};return k}})()
View
72 d3.min.js
@@ -1,70 +1,2 @@
-(function(){function za(a){for(var b=-1,c=a.length,g=[];++b<c;)g.push(a[b]);return g}function w(a){return typeof a=="function"?a:function(){return a}}function Aa(a){return a==null}function ea(a){return a.replace(/(^\s+)|(\s+$)/g,"").replace(/\s+/g," ")}function fa(a){a.apply(this,(arguments[0]=this,arguments));return this}function Ba(){var a={},b=[];a.add=function(c){for(var g=0;g<b.length;g++)if(b[g].listener==c)return a;b.push({listener:c,on:true});return a};a.remove=function(c){for(var g=0;g<b.length;g++){var e=
-b[g];if(e.listener==c){e.on=false;b=b.slice(0,g).concat(b.slice(g+1));break}}return a};a.dispatch=function(){for(var c=b,g=0,e=c.length;g<e;g++){var d=c[g];d.on&&d.listener.apply(this,arguments)}};return a}function ga(a){for(var b=a.lastIndexOf("."),c=b>=0?a.substring(b):(b=a.length,""),g=[];b>0;)g.push(a.substring(b-=3,b+3));return g.reverse().join(",")+c}function ha(a){return function(b){return 1-a(1-b)}}function ia(a){return function(b){return 0.5*(b<0.5?a(2*b):2-a(2-2*b))}}function Ca(a){return a}
-function R(a){return function(b){return Math.pow(b,a)}}function Da(a){return 1-Math.cos(a*Math.PI/2)}function Ea(a){return a?Math.pow(2,10*(a-1))-0.0010:0}function Fa(a){return 1-Math.sqrt(1-a*a)}function Ga(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+0.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+0.9375:7.5625*(a-=2.625/2.75)*a+0.984375}function J(a,b,c){return{r:a,g:b,b:c,toString:Ha}}function Ha(){return"#"+S(this.r)+S(this.g)+S(this.b)}function S(a){return a<16?"0"+a.toString(16):a.toString(16)}
-function T(a,b,c){var g=0,e=0,d=0,f,h;if(f=/([a-z]+)\((.*)\)/i.exec(a)){h=f[2].split(",");switch(f[1]){case "hsl":return c(parseFloat(h[0]),parseFloat(h[1])/100,parseFloat(h[2])/100);case "rgb":return b(U(h[0]),U(h[1]),U(h[2]))}}if(c=G[a])return b(c.r,c.g,c.b);if(a!=null&&a.charAt(0)=="#"){if(a.length==4){g=a.charAt(1);g+=g;e=a.charAt(2);e+=e;d=a.charAt(3);d+=d}else if(a.length==7){g=a.substring(1,3);e=a.substring(3,5);d=a.substring(5,7)}g=parseInt(g,16);e=parseInt(e,16);d=parseInt(d,16)}return b(g,
-e,d)}function Ia(a,b,c){var g=Math.min(a/=255,b/=255,c/=255),e=Math.max(a,b,c),d=e-g,f=(e+g)/2;if(d){g=f<0.5?d/(e+g):d/(2-e-g);a=a==e?(b-c)/d+(b<c?6:0):b==e?(c-a)/d+2:(a-b)/d+4;a*=60}else g=a=0;return V(a,g,f)}function U(a){var b=parseFloat(a);return a.charAt(a.length-1)=="%"?Math.round(b*2.55):b}function V(a,b,c){return{h:a,s:b,l:c,toString:Ja}}function Ja(){return"hsl("+this.h+","+this.s*100+"%,"+this.l*100+"%)"}function W(a,b,c){function g(f){if(f>360)f-=360;else if(f<0)f+=360;if(f<60)return e+
-(d-e)*f/60;if(f<180)return d;if(f<240)return e+(d-e)*(240-f)/60;return e}var e,d;a%=360;if(a<0)a+=360;b=b<0?0:b>1?1:b;c=c<0?0:c>1?1:c;d=c<=0.5?c*(1+b):c+b-c*b;e=2*c-d;return J(Math.round(g(a+120)*255),Math.round(g(a)*255),Math.round(g(a-120)*255))}function z(a){function b(e){for(var d=[],f,h,i,k,j=0,p=a.length;j<p;j++){i=a[j];d.push(f=[]);f.parentNode=i.parentNode;f.parentData=i.parentData;for(var q=0,m=i.length;q<m;q++)if(k=i[q]){f.push(h=e(k));if(h&&"__data__"in k)h.__data__=k.__data__}else f.push(null)}return z(d)}
-function c(e){for(var d=[],f,h,i,k=0,j=a.length;k<j;k++){h=a[k];for(var p=0,q=h.length;p<q;p++)if(i=h[p]){d.push(f=e(i));f.parentNode=i;f.parentData=i.__data__}}return z(d)}function g(e){for(var d=0,f=a.length;d<f;d++)for(var h=a[d],i=0,k=h.length;i<k;i++){var j=h[i];if(j)return e.call(j,j.__data__,i)}return null}a.select=function(e){return b(function(d){return D(e,d)})};a.selectAll=function(e){return c(function(d){return ja(e,d)})};a.filter=function(e){for(var d=[],f,h,i,k=0,j=a.length;k<j;k++){h=
-a[k];d.push(f=[]);f.parentNode=h.parentNode;f.parentData=h.parentData;for(var p=0,q=h.length;p<q;p++)if((i=h[p])&&e.call(i,i.__data__,p))f.push(i)}return z(d)};a.map=function(e){for(var d,f,h=0,i=a.length;h<i;h++){d=a[h];for(var k=0,j=d.length;k<j;k++)if(f=d[k])f.__data__=e.call(f,f.__data__,k)}return a};a.data=function(e,d){function f(m,o){var l=0,r=m.length,s=o.length,u=Math.min(r,s),v=Math.max(r,s),t=[],A=[],x=[],y,B;if(d){u={};v=[];var E;B=o.length;for(l=0;l<r;l++){E=d.call(y=m[l],y.__data__,
-l);if(E in u)x[B++]=m[l];else{u[E]=y;v.push(E)}}for(l=0;l<s;l++){if(y=u[E=d.call(o,B=o[l],l)]){y.__data__=B;t[l]=y;A[l]=x[l]=null}else{A[l]={__data__:B};t[l]=x[l]=null}delete u[E]}for(l=0;l<r;l++)if(v[l]in u)x[l]=m[l]}else{for(;l<u;l++){y=m[l];B=o[l];if(y){y.__data__=B;t[l]=y;A[l]=x[l]=null}else{A[l]={__data__:B};t[l]=x[l]=null}}for(;l<s;l++){A[l]={__data__:o[l]};t[l]=x[l]=null}for(;l<v;l++){x[l]=m[l];A[l]=t[l]=null}}A.parentNode=t.parentNode=x.parentNode=m.parentNode;A.parentData=t.parentData=x.parentData=
-m.parentData;h.push(A);i.push(t);k.push(x)}var h=[],i=[],k=[],j=-1,p=a.length,q;if(typeof e=="function")for(;++j<p;)f(q=a[j],e.call(q,q.parentData,j));else for(;++j<p;)f(q=a[j],e);j=z(i);j.enter=function(){return Ka(h)};j.exit=function(){return z(k)};return j};a.each=function(e){for(var d=0,f=a.length;d<f;d++)for(var h=a[d],i=0,k=h.length;i<k;i++){var j=h[i];j&&e.call(j,j.__data__,i)}return a};a.empty=function(){return!g(function(){return true})};a.node=function(){return g(function(){return this})};
-a.attr=function(e,d){function f(){this.removeAttribute(e)}function h(){this.removeAttributeNS(e.space,e.local)}function i(){this.setAttribute(e,d)}function k(){this.setAttributeNS(e.space,e.local,d)}function j(){var q=d.apply(this,arguments);q==null?this.removeAttribute(e):this.setAttribute(e,q)}function p(){var q=d.apply(this,arguments);q==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,q)}e=d3.ns.qualify(e);if(arguments.length<2)return g(e.local?function(){return this.getAttributeNS(e.space,
-e.local)}:function(){return this.getAttribute(e)});return a.each(d==null?e.local?h:f:typeof d=="function"?e.local?p:j:e.local?k:i)};a.classed=function(e,d){function f(){var j=this.className;k.lastIndex=0;if(!k.test(j))this.className=ea(j+" "+e)}function h(){var j=ea(this.className.replace(k," "));this.className=j.length?j:null}function i(){(d.apply(this,arguments)?f:h).call(this)}var k=RegExp("(^|\\s+)"+d3.requote(e)+"(\\s+|$)","g");if(arguments.length<2)return g(function(){k.lastIndex=0;return k.test(this.className)});
-return a.each(typeof d=="function"?i:d?f:h)};a.style=function(e,d,f){function h(){this.style.removeProperty(e)}function i(){this.style.setProperty(e,d,f)}function k(){var j=d.apply(this,arguments);j==null?this.style.removeProperty(e):this.style.setProperty(e,j,f)}if(arguments.length<3)f=null;if(arguments.length<2)return g(function(){return window.getComputedStyle(this,null).getPropertyValue(e)});return a.each(d==null?h:typeof d=="function"?k:i)};a.property=function(e,d){function f(){delete this[e]}
-function h(){this[e]=d}function i(){var k=d.apply(this,arguments);if(k==null)delete this[e];else this[e]=k}e=d3.ns.qualify(e);if(arguments.length<2)return g(function(){return this[e]});return a.each(d==null?f:typeof d=="function"?i:h)};a.text=function(e){function d(){this.appendChild(document.createTextNode(e))}function f(){var h=e.apply(this,arguments);h!=null&&this.appendChild(document.createTextNode(h))}if(arguments.length<1)return g(function(){return this.textContent});a.each(function(){for(;this.lastChild;)this.removeChild(this.lastChild)});
-return e==null?a:a.each(typeof e=="function"?f:d)};a.html=function(e){function d(){this.innerHTML=e}function f(){this.innerHTML=e.apply(this,arguments)}if(arguments.length<1)return g(function(){return this.innerHTML});return a.each(typeof e=="function"?f:d)};a.append=function(e){function d(h){return h.appendChild(document.createElement(e))}function f(h){return h.appendChild(document.createElementNS(e.space,e.local))}e=d3.ns.qualify(e);return b(e.local?f:d)};a.insert=function(e,d){function f(i){return i.insertBefore(document.createElement(e),
-D(d,i))}function h(i){return i.insertBefore(document.createElementNS(e.space,e.local),D(d,i))}e=d3.ns.qualify(e);return b(e.local?h:f)};a.remove=function(){return b(function(e){var d=e.parentNode;d.removeChild(e);return d})};a.sort=function(e){e=La.apply(this,arguments);for(var d=0,f=a.length;d<f;d++){var h=a[d];h.sort(e);for(var i=1,k=h.length,j=h[0];i<k;i++){var p=h[i];if(p){j&&j.parentNode.insertBefore(p,j.nextSibling);j=p}}}return a};a.on=function(e,d){var f=e.indexOf("."),h=f==-1?e:e.substring(0,
-f),i="__on"+e;return a.each(function(k,j){function p(q){var m=d3.event;d3.event=q;try{d.call(this,k,j)}finally{d3.event=m}}this[i]&&this.removeEventListener(h,this[i],false);if(d)this.addEventListener(h,this[i]=p,false)})};a.transition=function(){return X(a)};a.call=fa;return a}function Ka(a){function b(c){for(var g=[],e,d,f,h,i=0,k=a.length;i<k;i++){f=a[i];g.push(e=[]);e.parentNode=f.parentNode;e.parentData=f.parentData;for(var j=0,p=f.length;j<p;j++)if(h=f[j]){e.push(d=c(f.parentNode));d.__data__=
-h.__data__}else e.push(null)}return z(g)}a.append=function(c){function g(d){return d.appendChild(document.createElement(c))}function e(d){return d.appendChild(document.createElementNS(c.space,c.local))}c=d3.ns.qualify(c);return b(c.local?e:g)};a.insert=function(c,g){function e(f){return f.insertBefore(document.createElement(c),D(g,f))}function d(f){return f.insertBefore(document.createElementNS(c.space,c.local),D(g,f))}c=d3.ns.qualify(c);return b(c.local?d:e)};return a}function La(a){if(!arguments.length)a=
-d3.ascending;return function(b,c){return a(b&&b.__data__,c&&c.__data__)}}function X(a){function b(m){var o=true,l=-1;a.each(function(){if(i[++l]!=2){var r=(m-k[l])/j[l],s=this.__transition__,u,v,t=d[l];if(r<1){o=false;if(r<0)return}else r=1;if(i[l]){if(!s||s.active!=g){i[l]=2;return}}else if(!s||s.active>g){i[l]=2;return}else{i[l]=1;h.start.dispatch.apply(this,arguments);t=d[l]={};s.active=g;for(v in e)t[v]=e[v].apply(this,arguments)}u=q(r);for(v in e)t[v].call(this,u);if(r==1){i[l]=2;if(s.active==
-g){r=s.owner;if(r==g){delete this.__transition__;f&&this.parentNode.removeChild(this)}Y=g;h.end.dispatch.apply(this,arguments);Y=0;s.owner=r}}}});return o}var c={},g=Y||++Ma,e={},d=[],f=false,h=d3.dispatch("start","end"),i=[],k=[],j=[],p,q=d3.ease("cubic-in-out");a.each(function(){(this.__transition__||(this.__transition__={})).owner=g});c.delay=function(m){var o=Infinity,l=-1;if(typeof m=="function")a.each(function(){var r=k[++l]=+m.apply(this,arguments);if(r<o)o=r});else{o=+m;a.each(function(){k[++l]=
-o})}ka(b,o);return c};c.duration=function(m){var o=-1;if(typeof m=="function"){p=0;a.each(function(){var l=j[++o]=+m.apply(this,arguments);if(l>p)p=l})}else{p=+m;a.each(function(){j[++o]=p})}return c};c.ease=function(m){q=typeof m=="function"?m:d3.ease.apply(d3,arguments);return c};c.attrTween=function(m,o){function l(s,u){var v=o.call(this,s,u,this.getAttribute(m));return function(t){this.setAttribute(m,v(t))}}function r(s,u){var v=o.call(this,s,u,this.getAttributeNS(m.space,m.local));return function(t){this.setAttributeNS(m.space,
-m.local,v(t))}}e["attr."+m]=m.local?r:l;return c};c.attr=function(m,o){return c.attrTween(m,la(o))};c.styleTween=function(m,o,l){if(arguments.length<3)l=null;e["style."+m]=function(r,s){var u=o.call(this,r,s,window.getComputedStyle(this,null).getPropertyValue(m));return function(v){this.style.setProperty(m,u(v),l)}};return c};c.style=function(m,o,l){if(arguments.length<3)l=null;return c.styleTween(m,la(o),l)};c.select=function(m){var o;m=X(a.select(m)).ease(q);o=-1;m.delay(function(){return k[++o]});
-o=-1;m.duration(function(){return j[++o]});return m};c.selectAll=function(m){var o;m=X(a.selectAll(m)).ease(q);o=-1;m.delay(function(l,r){return k[r?o:++o]});o=-1;m.duration(function(l,r){return j[r?o:++o]});return m};c.remove=function(){f=true;return c};c.each=function(m,o){h[m].add(o);return c};c.call=fa;return c.delay(0).duration(250)}function la(a){return typeof a=="function"?function(b,c,g){return d3.interpolate(g,String(a.call(this,b,c)))}:(a=String(a),function(b,c,g){return d3.interpolate(g,
-a)})}function ka(a,b){var c=Date.now(),g=false,e=c+b,d=F;if(isFinite(b)){for(;d;){if(d.callback==a){d.then=c;d.delay=b;g=true}else{var f=d.then+d.delay;if(f<e)e=f}d=d.next}g||(F={callback:a,then:c,delay:b,next:F});if(!K){clearTimeout(Z);Z=setTimeout(Na,Math.max(24,e-c))}}}function Na(){K=1;Z=0;ma(na)}function na(){for(var a,b=Date.now(),c=F;c;){a=b-c.then;if(a>c.delay)c.flush=c.callback(a);c=c.next}a=null;for(b=F;b;)b=b.flush?a?a.next=b.next:F=b.next:(a=b).next;a||(K=0);K&&ma(na)}function $(a){return Math.log(a)/
-Math.LN10}function oa(a){return-Math.log(-a)/Math.LN10}function Oa(a){return function(b){return Math.pow(b,a)}}function Pa(a){return function(b){return-Math.pow(-b,a)}}function Qa(a){return a.innerRadius}function Ra(a){return a.outerRadius}function pa(a){return a.startAngle}function qa(a){return a.endAngle}function aa(a,b,c,g){var e=[],d=-1,f=b.length,h=typeof c=="function",i=typeof g=="function",k;if(h&&i)for(;++d<f;)e.push([c.call(a,k=b[d],d),g.call(a,k,d)]);else if(h)for(;++d<f;)e.push([c.call(a,
-b[d],d),g]);else if(i)for(;++d<f;)e.push([c,g.call(a,b[d],d)]);else for(;++d<f;)e.push([c,g]);return e}function ra(a){return a[0]}function sa(a){return a[1]}function H(a){var b=[],c=0,g=a.length,e=a[0];for(b.push(e[0],",",e[1]);++c<g;)b.push("L",(e=a[c])[0],",",e[1]);return b.join("")}function ta(a,b){if(b.length<1||a.length!=b.length&&a.length!=b.length+2)return H(a);var c=a.length!=b.length,g="",e=a[0],d=a[1],f=b[0],h=f,i=1;if(c){g+="Q"+(d[0]-f[0]*2/3)+","+(d[1]-f[1]*2/3)+","+d[0]+","+d[1];e=a[1];
-i=2}if(b.length>1){h=b[1];d=a[i];i++;g+="C"+(e[0]+f[0])+","+(e[1]+f[1])+","+(d[0]-h[0])+","+(d[1]-h[1])+","+d[0]+","+d[1];for(e=2;e<b.length;e++,i++){d=a[i];h=b[e];g+="S"+(d[0]-h[0])+","+(d[1]-h[1])+","+d[0]+","+d[1]}}if(c){c=a[i];g+="Q"+(d[0]+h[0]*2/3)+","+(d[1]+h[1]*2/3)+","+c[0]+","+c[1]}return g}function ua(a,b){for(var c=[],g=(1-b)/2,e=a[0],d=a[1],f=a[2],h=2,i=a.length;++h<i;){c.push([g*(f[0]-e[0]),g*(f[1]-e[1])]);e=d;d=f;f=a[h]}c.push([g*(f[0]-e[0]),g*(f[1]-e[1])]);return c}function C(a,b){return a[0]*
-b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]}function L(a,b,c){a.push("C",C(va,b),",",C(va,c),",",C(wa,b),",",C(wa,c),",",C(M,b),",",C(M,c))}function Sa(){return 0}function Ta(a){return a.source}function Ua(a){return a.target}function Va(a){return a.radius}function Wa(){return 64}function Xa(){return"circle"}d3={version:"1.8.3"};if(!Date.now)Date.now=function(){return+new Date};if(!Object.create)Object.create=function(a){function b(){}b.prototype=a;return new b};var N=function(a){return Array.prototype.slice.call(a)};
-try{N(document.documentElement.childNodes)}catch(jb){N=za}d3.rebind=function(a,b){return function(){var c=b.apply(a,arguments);return arguments.length?a:c}};d3.ascending=function(a,b){return a<b?-1:a>b?1:0};d3.descending=function(a,b){return b<a?-1:b>a?1:0};d3.min=function(a,b){var c=0,g=a.length,e=a[0],d;if(arguments.length==1)for(;++c<g;){if(e>(d=a[c]))e=d}else for(e=b(a[0]);++c<g;)if(e>(d=b(a[c])))e=d;return e};d3.max=function(a,b){var c=0,g=a.length,e=a[0],d;if(arguments.length==1)for(;++c<g;){if(e<
-(d=a[c]))e=d}else for(e=b(e);++c<g;)if(e<(d=b(a[c])))e=d;return e};d3.nest=function(){function a(h,i){if(i>=g.length)return f?f.call(c,h):d?h.sort(d):h;for(var k=-1,j=h.length,p=g[i++],q,m,o={};++k<j;)if((q=p(m=h[k]))in o)o[q].push(m);else o[q]=[m];for(q in o)o[q]=a(o[q],i);return o}function b(h,i){if(i>=g.length)return h;var k=[],j=e[i++],p;for(p in h)k.push({key:p,values:b(h[p],i)});j&&k.sort(function(q,m){return j(q.key,m.key)});return k}var c={},g=[],e=[],d,f;c.map=function(h){return a(h,0)};
-c.entries=function(h){return b(a(h,0),0)};c.key=function(h){g.push(h);return c};c.sortKeys=function(h){e[g.length-1]=h;return c};c.sortValues=function(h){d=h;return c};c.rollup=function(h){f=h;return c};return c};d3.keys=function(a){var b=[],c;for(c in a)b.push(c);return b};d3.values=function(a){var b=[],c;for(c in a)b.push(a[c]);return b};d3.entries=function(a){var b=[],c;for(c in a)b.push({key:c,value:a[c]});return b};d3.merge=function(a){return Array.prototype.concat.apply([],a)};d3.split=function(a,
-b){var c=[],g=[],e,d=-1,f=a.length;if(arguments.length<2)b=Aa;for(;++d<f;)if(b.call(g,e=a[d],d))g=[];else{g.length||c.push(g);g.push(e)}return c};d3.range=function(a,b,c){if(arguments.length==1){b=a;a=0}if(c==null)c=1;if((b-a)/c==Infinity)throw Error("infinite range");var g=[],e=-1,d;if(c<0)for(;(d=a+c*++e)>b;)g.push(d);else for(;(d=a+c*++e)<b;)g.push(d);return g};d3.requote=function(a){return a.replace(Ya,"\\$&")};var Ya=/[\\\^\$\*\+\?\[\]\(\)\.\{\}]/g;d3.xhr=function(a,b,c){var g=new XMLHttpRequest;
-if(arguments.length<3)c=b;else b&&g.overrideMimeType&&g.overrideMimeType(b);g.open("GET",a,true);g.onreadystatechange=function(){if(g.readyState==4)c(g.status<300?g:null)};g.send(null)};d3.text=function(a,b,c){if(arguments.length<3){c=b;b=null}d3.xhr(a,b,function(g){c(g&&g.responseText)})};d3.json=function(a,b){d3.text(a,"application/json",function(c){b(c?JSON.parse(c):null)})};d3.html=function(a,b){d3.text(a,"text/html",function(c){if(c!=null){var g=document.createRange();g.selectNode(document.body);
-c=g.createContextualFragment(c)}b(c)})};d3.xml=function(a,b,c){if(arguments.length<3){c=b;b=null}d3.xhr(a,b,function(g){c(g&&g.responseXML)})};d3.ns={prefix:{svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},qualify:function(a){var b=a.indexOf(":");return b<0?a:{space:d3.ns.prefix[a.substring(0,b)],local:a.substring(b+1)}}};d3.dispatch=function(){for(var a={},
-b,c=0,g=arguments.length;c<g;c++){b=arguments[c];a[b]=Ba(b)}return a};d3.format=function(a){a=Za.exec(a);var b=a[1]||" ",c=a[3]||"",g=a[5],e=+a[6],d=a[7],f=a[8],h=a[9];if(f)f=f.substring(1);if(g){b="0";if(d)e-=Math.floor((e-1)/4)}if(h=="d")f="0";return function(i){i=+i;var k=i<0&&(i=-i)?"−":c;if(h=="d"&&i%1)return"";i=f?i.toFixed(f):""+i;if(g){var j=i.length+k.length;if(j<e)i=Array(e-j+1).join(b)+i;if(d)i=ga(i);i=k+i}else{if(d)i=ga(i);i=k+i;j=i.length;if(j<e)i=Array(e-j+1).join(b)+i}return i}};var Za=
-/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,$a=R(2),ab=R(3),bb={linear:function(){return Ca},poly:R,quad:function(){return $a},cubic:function(){return ab},sin:function(){return Da},exp:function(){return Ea},circle:function(){return Fa},elastic:function(a,b){var c;if(arguments.length<2)b=0.45;if(arguments.length<1){a=1;c=b/4}else c=b/(2*Math.PI)*Math.asin(1/a);return function(g){return 1+a*Math.pow(2,10*-g)*Math.sin((g-c)*2*Math.PI/b)}},back:function(a){a||(a=1.70158);
-return function(b){return b*b*((a+1)*b-a)}},bounce:function(){return Ga}},cb={"in":function(a){return a},out:ha,"in-out":ia,"out-in":function(a){return ia(ha(a))}};d3.ease=function(a){var b=a.indexOf("-"),c=b>=0?a.substring(0,b):a;b=b>=0?a.substring(b+1):"in";return cb[b](bb[c].apply(null,Array.prototype.slice.call(arguments,1)))};d3.event=null;d3.interpolate=function(a,b){if(typeof b=="number")return d3.interpolateNumber(+a,b);if(typeof b=="string")return b in G||/^(#|rgb\(|hsl\()/.test(b)?d3.interpolateRgb(String(a),
-b):d3.interpolateString(String(a),b);if(b instanceof Array)return d3.interpolateArray(a,b);return d3.interpolateObject(a,b)};d3.interpolateNumber=function(a,b){b-=a;return function(c){return a+b*c}};d3.interpolateRound=function(a,b){b-=a;return function(c){return Math.round(a+b*c)}};d3.interpolateString=function(a,b){var c,g,e=0,d=[],f=[],h,i;for(g=0;c=ba.exec(b);++g){c.index&&d.push(b.substring(e,c.index));f.push({i:d.length,x:c[0]});d.push(null);e=ba.lastIndex}e<b.length&&d.push(b.substring(e));
-g=0;for(h=f.length;(c=ba.exec(a))&&g<h;++g){i=f[g];if(i.x==c[0]){if(i.i)if(d[i.i+1]==null){d[i.i-1]+=i.x;d.splice(i.i,1);for(c=g+1;c<h;++c)f[c].i--}else{d[i.i-1]+=i.x+d[i.i+1];d.splice(i.i,2);for(c=g+1;c<h;++c)f[c].i-=2}else if(d[i.i+1]==null)d[i.i]=i.x;else{d[i.i]=i.x+d[i.i+1];d.splice(i.i+1,1);for(c=g+1;c<h;++c)f[c].i--}f.splice(g,1);h--;g--}else i.x=d3.interpolateNumber(parseFloat(c[0]),parseFloat(i.x))}for(;g<h;){i=f.pop();if(d[i.i+1]==null)d[i.i]=i.x;else{d[i.i]=i.x+d[i.i+1];d.splice(i.i+1,1)}h--}if(d.length==
-1)return d[0]==null?f[0].x:function(){return b};return function(k){for(g=0;g<h;++g)d[(i=f[g]).i]=i.x(k);return d.join("")}};d3.interpolateRgb=function(a,b){a=d3.rgb(a);b=d3.rgb(b);var c=a.r,g=a.g,e=a.b,d=b.r-c,f=b.g-g,h=b.b-e;return function(i){return"rgb("+Math.round(c+d*i)+","+Math.round(g+f*i)+","+Math.round(e+h*i)+")"}};d3.interpolateHsl=function(a,b){a=d3.hsl(a);b=d3.hsl(b);var c=a.h,g=a.s,e=a.l,d=b.h-c,f=b.s-g,h=b.l-e;return function(i){return W(c+d*i,g+f*i,e+h*i).toString()}};d3.interpolateArray=
-function(a,b){var c=[],g=[],e=a.length,d=b.length,f=Math.min(a.length,b.length),h;for(h=0;h<f;++h)c.push(d3.interpolate(a[h],b[h]));for(;h<e;++h)g[h]=a[h];for(;h<d;++h)g[h]=b[h];return function(i){for(h=0;h<f;++h)g[h]=c[h](i);return g}};d3.interpolateObject=function(a,b){var c={},g={},e;for(e in a)if(e in b)c[e]=(e in db||/\bcolor\b/.test(e)?d3.interpolateRgb:d3.interpolate)(a[e],b[e]);else g[e]=a[e];for(e in b)e in a||(g[e]=b[e]);return function(d){for(e in c)g[e]=c[e](d);return g}};var ba=/[-+]?(?:\d+\.\d+|\d+\.|\.\d+|\d+)(?:[eE][-]?\d+)?/g,
-db={background:1,fill:1,stroke:1};d3.rgb=function(a,b,c){return arguments.length==1?T(""+a,J,W):J(~~a,~~b,~~c)};var G={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",
-darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",
-firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",
-lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",
-mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",
-rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},
-ca;for(ca in G)G[ca]=T(G[ca],J,W);d3.hsl=function(a,b,c){return arguments.length==1?T(""+a,Ia,V):V(+a,+b,+c)};var D=function(a,b){return b.querySelector(a)},ja=function(a,b){return N(b.querySelectorAll(a))};if(typeof Sizzle=="function"){D=function(a,b){return Sizzle(a,b)[0]};ja=function(a,b){return Sizzle.uniqueSort(Sizzle(a,b))}}var O=z([[document]]);O[0].parentNode=document.documentElement;d3.select=function(a){return typeof a=="string"?O.select(a):z([[a]])};d3.selectAll=function(a){return typeof a==
-"string"?O.selectAll(a):z([N(a)])};d3.transition=O.transition;var Ma=0,Y=0,F=null,Z=0,K;d3.timer=function(a){ka(a,0)};var ma=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){setTimeout(a,17)};d3.scale={};d3.scale.linear=function(){function a(j){return k((j-c)*f)}function b(j){var p=Math.min(c,g),q=Math.max(c,g),m=q-p,o=Math.pow(10,Math.floor(Math.log(m/j)/Math.LN10));j/=m/o;
-if(j<=0.15)o*=10;else if(j<=0.35)o*=5;else if(j<=0.75)o*=2;return{start:Math.ceil(p/o)*o,stop:Math.floor(q/o)*o+o*0.5,step:o}}var c=0,g=1,e=0,d=1,f=1,h=1,i=d3.interpolate,k=i(e,d);a.invert=function(j){return(j-e)*h+c};a.domain=function(j){if(!arguments.length)return[c,g];c=+j[0];g=+j[1];f=1/(g-c);h=(g-c)/(d-e);return a};a.range=function(j){if(!arguments.length)return[e,d];e=j[0];d=j[1];h=(g-c)/(d-e);k=i(e,d);return a};a.rangeRound=function(j){return a.range(j).interpolate(d3.interpolateRound)};a.interpolate=
-function(j){if(!arguments.length)return i;k=(i=j)(e,d);return a};a.ticks=function(j){j=b(j);return d3.range(j.start,j.stop,j.step)};a.tickFormat=function(j){j=Math.max(0,-Math.floor(Math.log(b(j).step)/Math.LN10+0.01));return d3.format(",."+j+"f")};return a};d3.scale.log=function(){function a(e){return b(c(e))}var b=d3.scale.linear(),c=$,g=c.pow;a.invert=function(e){return g(b.invert(e))};a.domain=function(e){if(!arguments.length)return b.domain().map(g);c=(e[0]||e[1])<0?oa:$;g=c.pow;b.domain(e.map(c));
-return a};a.range=d3.rebind(a,b.range);a.rangeRound=d3.rebind(a,b.rangeRound);a.interpolate=d3.rebind(a,b.interpolate);a.ticks=function(){var e=b.domain(),d=[];if(e.every(isFinite)){var f=Math.floor(e[0]),h=Math.ceil(e[1]),i=g(e[0]);e=g(e[1]);if(n)for(d.push(g(f));f++<h;)for(var k=9;k>0;k--)d.push(g(f)*k);else{for(;f<h;f++)for(k=1;k<10;k++)d.push(g(f)*k);d.push(g(f))}for(f=0;d[f]<i;f++);for(h=d.length;d[h-1]>e;h--);d=d.slice(f,h)}return d};a.tickFormat=function(){return function(e){return e.toPrecision(1)}};
-return a};$.pow=function(a){return Math.pow(10,a)};oa.pow=function(a){return-Math.pow(10,-a)};d3.scale.pow=function(){function a(f){return b(e(f))}var b=d3.scale.linear(),c=d3.scale.linear(),g=1,e=Number,d=e;a.invert=function(f){return d(b.invert(f))};a.domain=function(f){if(!arguments.length)return b.domain().map(d);var h=(f[0]||f[1])<0?Pa:Oa;e=h(g);d=h(1/g);b.domain(f.map(e));c.domain(f);return a};a.range=d3.rebind(a,b.range);a.rangeRound=d3.rebind(a,b.rangeRound);a.interpolate=d3.rebind(a,b.interpolate);
-a.ticks=c.ticks;a.tickFormat=c.tickFormat;a.exponent=function(f){if(!arguments.length)return g;var h=a.domain();g=f;return a.domain(h)};return a};d3.scale.sqrt=function(){return d3.scale.pow().exponent(0.5)};d3.scale.ordinal=function(){function a(d){d=d in c?c[d]:c[d]=b.push(d)-1;return g[d%g.length]}var b=[],c={},g=[],e=0;a.domain=function(d){if(!arguments.length)return b;b=d;c={};for(var f=-1,h=-1,i=b.length;++f<i;){d=b[f];d in c||(c[d]=++h)}return a};a.range=function(d){if(!arguments.length)return g;
-g=d;return a};a.rangePoints=function(d,f){if(arguments.length<2)f=0;var h=d[0],i=d[1],k=(i-h)/(b.length-1+f);g=b.length==1?[(h+i)/2]:d3.range(h+k*f/2,i+k/2,k);e=0;return a};a.rangeBands=function(d,f){if(arguments.length<2)f=0;var h=d[0],i=d[1],k=(i-h)/(b.length+f);g=d3.range(h+k*f,i,k);e=k*(1-f);return a};a.rangeRoundBands=function(d,f){if(arguments.length<2)f=0;var h=d[0],i=d[1],k=i-h,j=Math.floor(k/(b.length+f));g=d3.range(h+Math.round((k-(b.length-f)*j)/2),i,j);e=Math.round(j*(1-f));return a};
-a.rangeBand=function(){return e};return a};d3.scale.category10=function(){return d3.scale.ordinal().range(eb)};d3.scale.category20=function(){return d3.scale.ordinal().range(fb)};d3.scale.category20b=function(){return d3.scale.ordinal().range(gb)};d3.scale.category20c=function(){return d3.scale.ordinal().range(hb)};var eb=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],fb=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896",
-"#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],gb=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],hb=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696",
-"#bdbdbd","#d9d9d9"];d3.scale.quantile=function(){function a(){for(var f=-1,h=d.length=e.length,i=g.length/h;++f<h;)d[f]=g[~~(f*i)]}function b(f){if(isNaN(f=+f))return NaN;for(var h=0,i=d.length-1;h<=i;){var k=h+i>>1,j=d[k];if(j<f)h=k+1;else if(j>f)i=k-1;else return k}return i<0?0:i}function c(f){return e[b(f)]}var g=[],e=[],d=[];c.domain=function(f){if(!arguments.length)return g;g=f.filter(function(h){return!isNaN(h)}).sort(d3.ascending);a();return c};c.range=function(f){if(!arguments.length)return e;
-e=f;a();return c};c.quantiles=function(){return d};return c};d3.scale.quantize=function(){function a(f){return d[Math.max(0,Math.min(e,Math.floor(g*(f-b))))]}var b=0,c=1,g=2,e=1,d=[0,1];a.domain=function(f){if(!arguments.length)return[b,c];b=f[0];c=f[1];g=d.length/(c-b);return a};a.range=function(f){if(!arguments.length)return d;d=f;g=d.length/(c-b);e=d.length-1;return a};return a};d3.svg={};d3.svg.arc=function(){function a(){var d=b.apply(this,arguments),f=c.apply(this,arguments),h=g.apply(this,
-arguments)+I,i=e.apply(this,arguments)+I,k=i-h,j=k<Math.PI?"0":"1",p=Math.cos(h);h=Math.sin(h);var q=Math.cos(i);i=Math.sin(i);return k>=ib?d?"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+-f+"A"+f+","+f+" 0 1,1 0,"+f+"M0,"+d+"A"+d+","+d+" 0 1,1 0,"+-d+"A"+d+","+d+" 0 1,1 0,"+d+"Z":"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+-f+"A"+f+","+f+" 0 1,1 0,"+f+"Z":d?"M"+f*p+","+f*h+"A"+f+","+f+" 0 "+j+",1 "+f*q+","+f*i+"L"+d*q+","+d*i+"A"+d+","+d+" 0 "+j+",0 "+d*p+","+d*h+"Z":"M"+f*p+","+f*h+"A"+f+","+f+" 0 "+j+",1 "+f*q+","+f*i+
-"L0,0Z"}var b=Qa,c=Ra,g=pa,e=qa;a.innerRadius=function(d){if(!arguments.length)return b;b=w(d);return a};a.outerRadius=function(d){if(!arguments.length)return c;c=w(d);return a};a.startAngle=function(d){if(!arguments.length)return g;g=w(d);return a};a.endAngle=function(d){if(!arguments.length)return e;e=w(d);return a};a.centroid=function(){var d=(b.apply(this,arguments)+c.apply(this,arguments))/2,f=(g.apply(this,arguments)+e.apply(this,arguments))/2+I;return[Math.cos(f)*d,Math.sin(f)*d]};return a};
-var I=-Math.PI/2,ib=2*Math.PI-1.0E-6;d3.svg.line=function(){function a(f){return f.length<1?null:"M"+e(aa(this,f,b,c),d)}var b=ra,c=sa,g="linear",e=P[g],d=0.7;a.x=function(f){if(!arguments.length)return b;b=f;return a};a.y=function(f){if(!arguments.length)return c;c=f;return a};a.interpolate=function(f){if(!arguments.length)return g;e=P[g=f];return a};a.tension=function(f){if(!arguments.length)return d;d=f;return a};return a};var P={linear:H,"step-before":function(a){var b=[],c=0,g=a.length,e=a[0];
-for(b.push(e[0],",",e[1]);++c<g;)b.push("V",(e=a[c])[1],"H",e[0]);return b.join("")},"step-after":function(a){var b=[],c=0,g=a.length,e=a[0];for(b.push(e[0],",",e[1]);++c<g;)b.push("H",(e=a[c])[0],"V",e[1]);return b.join("")},basis:function(a){if(a.length<3)return H(a);var b=[],c=1,g=a.length,e=a[0],d=e[0],f=e[1],h=[d,d,d,(e=a[1])[0]],i=[f,f,f,e[1]];b.push(d,",",f);for(L(b,h,i);++c<g;){e=a[c];h.shift();h.push(e[0]);i.shift();i.push(e[1]);L(b,h,i)}for(c=-1;++c<2;){h.shift();h.push(e[0]);i.shift();
-i.push(e[1]);L(b,h,i)}return b.join("")},"basis-closed":function(a){for(var b,c=-1,g=a.length,e=g+4,d,f=[],h=[];++c<4;){d=a[c%g];f.push(d[0]);h.push(d[1])}b=[C(M,f),",",C(M,h)];for(--c;++c<e;){d=a[c%g];f.shift();f.push(d[0]);h.shift();h.push(d[1]);L(b,f,h)}return b.join("")},cardinal:function(a,b){return a.length<3?H(a):a[0]+ta(a,ua(a,b))},"cardinal-closed":function(a,b){return a.length<3?H(a):a[0]+ta(a,ua([a[a.length-2]].concat(a,[a[1]]),b))}},va=[0,2/3,1/3,0],wa=[0,1/3,2/3,0],M=[0,1/6,2/3,1/6];
-d3.svg.area=function(){function a(h){return h.length<1?null:"M"+d(aa(this,h,b,g),f)+"L"+d(aa(this,h,b,c).reverse(),f)+"Z"}var b=ra,c=Sa,g=sa,e="linear",d=P[e],f=0.7;a.x=function(h){if(!arguments.length)return b;b=h;return a};a.y0=function(h){if(!arguments.length)return c;c=h;return a};a.y1=function(h){if(!arguments.length)return g;g=h;return a};a.interpolate=function(h){if(!arguments.length)return e;d=P[e=h];return a};a.tension=function(h){if(!arguments.length)return f;f=h;return a};return a};d3.svg.chord=
-function(){function a(h,i){var k=b(this,c,h,i),j=b(this,g,h,i);return"M"+k.p0+("A"+k.r+","+k.r+" 0 0,1 "+k.p1)+(k.a0==j.a0&&k.a1==j.a1?"Q 0,0 "+k.p0:"Q 0,0 "+j.p0+("A"+j.r+","+j.r+" 0 0,1 "+j.p1)+("Q 0,0 "+k.p0))+"Z"}function b(h,i,k,j){var p=i.call(h,k,j);i=e.call(h,p,j);k=d.call(h,p,j)+I;h=f.call(h,p,j)+I;return{r:i,a0:k,a1:h,p0:[i*Math.cos(k),i*Math.sin(k)],p1:[i*Math.cos(h),i*Math.sin(h)]}}var c=Ta,g=Ua,e=Va,d=pa,f=qa;a.radius=function(h){if(!arguments.length)return e;e=w(h);return a};a.source=
-function(h){if(!arguments.length)return c;c=w(h);return a};a.target=function(h){if(!arguments.length)return g;g=w(h);return a};a.startAngle=function(h){if(!arguments.length)return d;d=w(h);return a};a.endAngle=function(h){if(!arguments.length)return f;f=w(h);return a};return a};d3.svg.mouse=function(a){var b=(a.ownerSVGElement||a).createSVGPoint();if(da<0&&(window.scrollX||window.scrollY)){var c=d3.select(document.body).append("svg:svg").style("position","absolute").style("top",0).style("left",0),
-g=c[0][0].getScreenCTM();da=!(g.f||g.e);c.remove()}if(da){b.x=d3.event.pageX;b.y=d3.event.pageY}else{b.x=d3.event.clientX;b.y=d3.event.clientY}b=b.matrixTransform(a.getScreenCTM().inverse());return[b.x,b.y]};var da=/WebKit/.test(navigator.userAgent)?-1:0;d3.svg.symbol=function(){function a(g,e){return(xa[b.call(this,g,e)]||xa.circle)(c.call(this,g,e))}var b=Xa,c=Wa;a.type=function(g){if(!arguments.length)return b;b=w(g);return a};a.size=function(g){if(!arguments.length)return c;c=w(g);return a};return a};
-d3.svg.symbolTypes=["circle","cross","diamond","square","triangle-down","triangle-up"];var xa={circle:function(a){a=Math.sqrt(a/Math.PI);return"M0,"+a+"A"+a+","+a+" 0 1,1 0,"+-a+"A"+a+","+a+" 0 1,1 0,"+a+"Z"},cross:function(a){a=Math.sqrt(a/5)/2;return"M"+-3*a+","+-a+"H"+-a+"V"+-3*a+"H"+a+"V"+-a+"H"+3*a+"V"+a+"H"+a+"V"+3*a+"H"+-a+"V"+a+"H"+-3*a+"Z"},diamond:function(a){a=Math.sqrt(a/(2*ya));var b=a*ya;return"M0,"+-a+"L"+b+",0 0,"+a+" "+-b+",0Z"},square:function(a){a=Math.sqrt(a)/2;return"M"+-a+","+
--a+"L"+a+","+-a+" "+a+","+a+" "+-a+","+a+"Z"},"triangle-down":function(a){a=Math.sqrt(a/Q);var b=a*Q/2;return"M0,"+b+"L"+a+","+-b+" "+-a+","+-b+"Z"},"triangle-up":function(a){a=Math.sqrt(a/Q);var b=a*Q/2;return"M0,"+-b+"L"+a+","+b+" "+-a+","+b+"Z"}},Q=Math.sqrt(3),ya=Math.tan(30*Math.PI/180)})();
+(function(){function bU(){return"circle"}function bT(){return 64}function bR(a){return a.endAngle}function bQ(a){return a.startAngle}function bP(a){return a.radius}function bO(a){return a.target}function bN(a){return a.source}function bM(){return 0}function bL(a,b,c){a.push("C",bH(bI,b),",",bH(bI,c),",",bH(bJ,b),",",bH(bJ,c),",",bH(bK,b),",",bH(bK,c))}function bH(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]}function bG(a){var b,c=-1,d=a.length,e=d+4,f,g=[],h=[];while(++c<4)f=a[c%d],g.push(f[0]),h.push(f[1]);b=[bH(bK,g),",",bH(bK,h)],--c;while(++c<e)f=a[c%d],g.shift(),g.push(f[0]),h.shift(),h.push(f[1]),bL(b,g,h);return b.join("")}function bF(a){if(a.length<3)return by(a);var b=[],c=1,d=a.length,e=a[0],f=e[0],g=e[1],h=[f,f,f,(e=a[1])[0]],i=[g,g,g,e[1]];b.push(f,",",g),bL(b,h,i);while(++c<d)e=a[c],h.shift(),h.push(e[0]),i.shift(),i.push(e[1]),bL(b,h,i);c=-1;while(++c<2)h.shift(),h.push(e[0]),i.shift(),i.push(e[1]),bL(b,h,i);return b.join("")}function bE(a,b){var c=[],d=(1-b)/2,e=a[0],f=a[1],g=a[2],h=2,i=a.length;while(++h<i)c.push([d*(g[0]-e[0]),d*(g[1]-e[1])]),e=f,f=g,g=a[h];c.push([d*(g[0]-e[0]),d*(g[1]-e[1])]);return c}function bD(a,b){if(b.length<1||a.length!=b.length&&a.length!=b.length+2)return by(a);var c=a.length!=b.length,d="",e=a[0],f=a[1],g=b[0],h=g,i=1;c&&(d+="Q"+(f[0]-g[0]*2/3)+","+(f[1]-g[1]*2/3)+","+f[0]+","+f[1],e=a[1],i=2);if(b.length>1){h=b[1],f=a[i],i++,d+="C"+(e[0]+g[0])+","+(e[1]+g[1])+","+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1];for(var j=2;j<b.length;j++,i++)f=a[i],h=b[j],d+="S"+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1]}if(c){var k=a[i];d+="Q"+(f[0]+h[0]*2/3)+","+(f[1]+h[1]*2/3)+","+k[0]+","+k[1]}return d}function bC(a,b,c){return a.length<3?by(a):a[0]+bD(a,bE(a,b))}function bB(a,b){return a.length<3?by(a):a[0]+bD(a,bE([a[a.length-2]].concat(a,[a[1]]),b))}function bA(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("H",(e=a[c])[0],"V",e[1]);return b.join("")}function bz(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("V",(e=a[c])[1],"H",e[0]);return b.join("")}function by(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("L",(e=a[c])[0],",",e[1]);return b.join("")}function bw(a){return a[1]}function bv(a){return a[0]}function bu(a,b,c,d){var e=[],f=-1,g=b.length,h=typeof c=="function",i=typeof d=="function",j;if(h&&i)while(++f<g)e.push([c.call(a,j=b[f],f),d.call(a,j,f)]);else if(h)while(++f<g)e.push([c.call(a,b[f],f),d]);else if(i)while(++f<g)e.push([c,d.call(a,b[f],f)]);else while(++f<g)e.push([c,d]);return e}function bt(a){return a.endAngle}function bs(a){return a.startAngle}function br(a){return a.outerRadius}function bq(a){return a.innerRadius}function bj(a){return function(b){return-Math.pow(-b,a)}}function bi(a){return function(b){return Math.pow(b,a)}}function bh(a){return-Math.log(-a)/Math.LN10}function bg(a){return Math.log(a)/Math.LN10}function be(){var a=null,b=$;while(b)b=b.flush?a?a.next=b.next:$=b.next:(a=b).next;a||(ba=0)}function bd(){var a,b=Date.now(),c=null,d=$;while(d)a=b-d.then,a>d.delay&&(d.flush=d.callback(a)),d=(c=d).next;be(),ba&&bf(bd)}function bc(){ba=1,_=0,bf(bd)}function bb(a,b){var c=Date.now(),d=!1,e=c+b,f,g=$;if(!!isFinite(b)){while(g){if(g.callback==a)g.then=c,g.delay=b,d=!0;else{var h=g.then+g.delay;h<e&&(e=h)}f=g,g=g.next}d||($={callback:a,then:c,delay:b,next:$}),ba||(clearTimeout(_),_=setTimeout(bc,Math.max(24,e-c)))}}function Z(a){return typeof a=="function"?function(b,c,d){return d3.interpolate(d,String(a.call(this,b,c)))}:(a=String(a),function(b,c,d){return d3.interpolate(d,a)})}function Y(a){function n(b){var h=!0,l=-1;a.each(function(){if(i[++l]!=2){var a=(b-j[l])/k[l],n=this.__transition__,o,p,q=e[l];if(a<1){h=!1;if(a<0)return}else a=1;if(i[l]){if(!n||n.active!=c){i[l]=2;return}}else{if(!n||n.active>c){i[l]=2;return}i[l]=1,g.start.dispatch.apply(this,arguments),q=e[l]={},n.active=c;for(p in d)q[p]=d[p].apply(this,arguments)}o=m(a);for(p in d)q[p].call(this,o);if(a==1){i[l]=2;if(n.active==c){var r=n.owner;r==c&&(delete this.__transition__,f&&this.parentNode.removeChild(this)),X=c,g.end.dispatch.apply(this,arguments),X=0,n.owner=r}}}});return h}var b={},c=X||++W,d={},e=[],f=!1,g=d3.dispatch("start","end"),i=[],j=[],k=[],l,m=d3.ease("cubic-in-out");a.each(function(){(this.__transition__||(this.__transition__={})).owner=c}),b.delay=function(c){var d=Infinity,e=-1;typeof c=="function"?a.each(function(a,b){var f=j[++e]=+c.apply(this,arguments);f<d&&(d=f)}):(d=+c,a.each(function(a,b){j[++e]=d})),bb(n,d);return b},b.duration=function(c){var d=-1;typeof c=="function"?(l=0,a.each(function(a,b){var e=k[++d]=+c.apply(this,arguments);e>l&&(l=e)})):(l=+c,a.each(function(a,b){k[++d]=l}));return b},b.ease=function(a){m=typeof a=="function"?a:d3.ease.apply(d3,arguments);return b},b.attrTween=function(a,c){function f(b,d){var e=c.call(this,b,d,this.getAttributeNS(a.space,a.local));return function(b){this.setAttributeNS(a.space,a.local,e(b))}}function e(b,d){var e=c.call(this,b,d,this.getAttribute(a));return function(b){this.setAttribute(a,e(b))}}d["attr."+a]=a.local?f:e;return b},b.attr=function(a,c){return b.attrTween(a,Z(c))},b.styleTween=function(a,c,e){function f(b,d){var f=c.call(this,b,d,window.getComputedStyle(this,null).getPropertyValue(a));return function(b){this.style.setProperty(a,f(b),e)}}arguments.length<3&&(e=null),d["style."+a]=f;return b},b.style=function(a,c,d){arguments.length<3&&(d=null);return b.styleTween(a,Z(c),d)},b.select=function(b){var c,d=Y(a.select(b)).ease(m);c=-1,d.delay(function(a,b){return j[++c]}),c=-1,d.duration(function(a,b){return k[++c]});return d},b.selectAll=function(b){var c,d=Y(a.selectAll(b)).ease(m);c=-1,d.delay(function(a,b){return j[b?c:++c]}),c=-1,d.duration(function(a,b){return k[b?c:++c]});return d},b.remove=function(){f=!0;return b},b.each=function(a,c){g[a].add(c);return b},b.call=h;return b.delay(0).duration(250)}function V(a){arguments.length||(a=d3.ascending);return function(b,c){return a(b&&b.__data__,c&&c.__data__)}}function U(a){function b(b){var c=[],d,e,f,g;for(var h=0,i=a.length;h<i;h++){f=a[h],c.push(d=[]),d.parentNode=f.parentNode,d.parentData=f.parentData;for(var j=0,k=f.length;j<k;j++)(g=f[j])?(d.push(e=b(f.parentNode)),e.__data__=g.__data__):d.push(null)}return T(c)}a.append=function(a){function d(b){return b.appendChild(document.createElementNS(a.space,a.local))}function c(b){return b.appendChild(document.createElement(a))}a=d3.ns.qualify(a);return b(a.local?d:c)},a.insert=function(a,c){function e(b){return b.insertBefore(document.createElementNS(a.space,a.local),Q(c,b))}function d(b){return b.insertBefore(document.createElement(a),Q(c,b))}a=d3.ns.qualify(a);return b(a.local?e:d)};return a}function T(a){function d(b){for(var c=0,d=a.length;c<d;c++){var e=a[c];for(var f=0,g=e.length;f<g;f++){var h=e[f];if(h)return b.call(h,h.__data__,f)}}return null}function c(b){var c=[],d,e,f;for(var g=0,h=a.length;g<h;g++){e=a[g];for(var i=0,j=e.length;i<j;i++)if(f=e[i])c.push(d=b(f)),d.parentNode=f,d.parentData=f.__data__}return T(c)}function b(b){var c=[],d,e,f,g;for(var h=0,i=a.length;h<i;h++){f=a[h],c.push(d=[]),d.parentNode=f.parentNode,d.parentData=f.parentData;for(var j=0,k=f.length;j<k;j++)(g=f[j])?(d.push(e=b(g)),e&&"__data__"in g&&(e.__data__=g.__data__)):d.push(null)}return T(c)}a.select=function(a){return b(function(b){return Q(a,b)})},a.selectAll=function(a){return c(function(b){return R(a,b)})},a.filter=function(b){var c=[],d,e,f;for(var g=0,h=a.length;g<h;g++){e=a[g],c.push(d=[]),d.parentNode=e.parentNode,d.parentData=e.parentData;for(var i=0,j=e.length;i<j;i++)(f=e[i])&&b.call(f,f.__data__,i)&&d.push(f)}return T(c)},a.map=function(b){var c,d;for(var e=0,f=a.length;e<f;e++){c=a[e];for(var g=0,h=c.length;g<h;g++)if(d=c[g])d.__data__=b.call(d,d.__data__,g)}return a},a.data=function(b,c){function g(a,b){function q(a){return{__data__:a}}var g=0,h=a.length,i=b.length,j=Math.min(h,i),k=Math.max(h,i),l=[],m=[],n=[],o,p;if(c){var r={},s=[],t=[],u,v=b.length;for(g=0;g<h;g++)u=c.call(o=a[g],o.__data__,g),u in r?n[v++]=a[g]:(r[u]=o,t.push(u));for(g=0;g<i;g++)o=r[u=c.call(b,p=b[g],g)],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=q(p),l[g]=n[g]=null),delete r[u];for(g=0;g<h;g++)t[g]in r&&(n[g]=a[g])}else{for(;g<j;g++)o=a[g],p=b[g],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=q(p),l[g]=n[g]=null);for(;g<i;g++)m[g]=q(b[g]),l[g]=n[g]=null;for(;g<k;g++)n[g]=a[g],m[g]=l[g]=null}m.parentNode=l.parentNode=n.parentNode=a.parentNode,m.parentData=l.parentData=n.parentData=a.parentData,d.push(m),e.push(l),f.push(n)}var d=[],e=[],f=[],h=-1,i=a.length,j;if(typeof b=="function")while(++h<i)g(j=a[h],b.call(j,j.parentData,h));else while(++h<i)g(j=a[h],b);var k=T(e);k.enter=function(){return U(d)},k.exit=function(){return T(f)};return k},a.each=function(b){for(var c=0,d=a.length;c<d;c++){var e=a[c];for(var f=0,g=e.length;f<g;f++){var h=e[f];h&&b.call(h,h.__data__,f)}}return a},a.empty=function(){return!d(function(){return!0})},a.node=function(){return d(function(){return this})},a.attr=function(b,c){function j(){var a=c.apply(this,arguments);a==null?this.removeAttributeNS(b.space,b.local):this.setAttributeNS(b.space,b.local,a)}function i(){var a=c.apply(this,arguments);a==null?this.removeAttribute(b):this.setAttribute(b,a)}function h(){this.setAttributeNS(b.space,b.local,c)}function g(){this.setAttribute(b,c)}function f(){this.removeAttributeNS(b.space,b.local)}function e(){this.removeAttribute(b)}b=d3.ns.qualify(b);if(arguments.length<2)return d(b.local?function(){return this.getAttributeNS(b.space,b.local)}:function(){return this.getAttribute(b)});return a.each(c==null?b.local?f:e:typeof c=="function"?b.local?j:i:b.local?h:g)},a.classed=function(b,c){function i(){(c.apply(this,arguments)?f:h).call(this)}function h(){var a=g(this.className.replace(e," "));this.className=a.length?a:null}function f(){var a=this.className;e.lastIndex=0,e.test(a)||(this.className=g(a+" "+b))}var e=new RegExp("(^|\\s+)"+d3.requote(b)+"(\\s+|$)","g");if(arguments.length<2)return d(function(){e.lastIndex=0;return e.test(this.className)});return a.each(typeof c=="function"?i:c?f:h)},a.style=function(b,c,e){function h(){var a=c.apply(this,arguments);a==null?this.style.removeProperty(b):this.style.setProperty(b,a,e)}function g(){this.style.setProperty(b,c,e)}function f(){this.style.removeProperty(b)}arguments.length<3&&(e=null);if(arguments.length<2)return d(function(){return window.getComputedStyle(this,null).getPropertyValue(b)});return a.each(c==null?f:typeof c=="function"?h:g)},a.property=function(b,c){function g(){var a=c.apply(this,arguments);a==null?delete this[b]:this[b]=a}function f(){this[b]=c}function e(){delete this[b]}b=d3.ns.qualify(b);if(arguments.length<2)return d(function(){return this[b]});return a.each(c==null?e:typeof c=="function"?g:f)},a.text=function(b){function f(){var a=b.apply(this,arguments);a!=null&&this.appendChild(document.createTextNode(a))}function e(){this.appendChild(document.createTextNode(b))}function c(){while(this.lastChild)this.removeChild(this.lastChild)}if(arguments.length<1)return d(function(){return this.textContent});a.each(c);return b==null?a:a.each(typeof b=="function"?f:e)},a.html=function(b){function e(){this.innerHTML=b.apply(this,arguments)}function c(){this.innerHTML=b}if(arguments.length<1)return d(function(){return this.innerHTML});return a.each(typeof b=="function"?e:c)},a.append=function(a){function d(b){return b.appendChild(document.createElementNS(a.space,a.local))}function c(b){return b.appendChild(document.createElement(a))}a=d3.ns.qualify(a);return b(a.local?d:c)},a.insert=function(a,c){function e(b){return b.insertBefore(document.createElementNS(a.space,a.local),Q(c,b))}function d(b){return b.insertBefore(document.createElement(a),Q(c,b))}a=d3.ns.qualify(a);return b(a.local?e:d)},a.remove=function(){return b(function(a){var b=a.parentNode;b.removeChild(a);return b})},a.sort=function(b){b=V.apply(this,arguments);for(var c=0,d=a.length;c<d;c++){var e=a[c];e.sort(b);for(var f=1,g=e.length,h=e[0];f<g;f++){var i=e[f];i&&(h&&h.parentNode.insertBefore(i,h.nextSibling),h=i)}}return a},a.on=function(b,c){var d=b.indexOf("."),e=d==-1?b:b.substring(0,d),f="__on"+b;return a.each(function(a,b){function d(d){var e=d3.event;d3.event=d;try{c.call(this,a,b)}finally{d3.event=e}}this[f]&&this.removeEventListener(e,this[f],!1),c&&this.addEventListener(e,this[f]=d,!1)})},a.transition=function(){return Y(a)},a.call=h;return a}function P(a,b,c){function g(a){return Math.round(f(a)*255)}function f(a){a>360?a-=360:a<0&&(a+=360);if(a<60)return d+(e-d)*a/60;if(a<180)return e;if(a<240)return d+(e-d)*(240-a)/60;return d}var d,e;a=a%360,a<0&&(a+=360),b=b<0?0:b>1?1:b,c=c<0?0:c>1?1:c,e=c<=.5?c*(1+b):c+b-c*b,d=2*c-e;return F(g(a+120),g(a),g(a-120))}function O(){return"hsl("+this.h+","+this.s*100+"%,"+this.l*100+"%)"}function N(a,b,c){return{h:a,s:b,l:c,toString:O}}function K(a){var b=parseFloat(a);return a.charAt(a.length-1)=="%"?Math.round(b*2.55):b}function J(a,b,c){var d=Math.min(a/=255,b/=255,c/=255),e=Math.max(a,b,c),f=e-d,g,h,i=(e+d)/2;f?(h=i<.5?f/(e+d):f/(2-e-d),a==e?g=(b-c)/f+(b<c?6:0):b==e?g=(c-a)/f+2:g=(a-b)/f+4,g*=60):h=g=0;return N(g,h,i)}function I(a,b,c){var d=0,e=0,f=0,g,h,i;g=/([a-z]+)\((.*)\)/i.exec(a);if(g){h=g[2].split(",");switch(g[1]){case"hsl":return c(parseFloat(h[0]),parseFloat(h[1])/100,parseFloat(h[2])/100);case"rgb":return b(K(h[0]),K(h[1]),K(h[2]))}}if(i=L[a])return b(i.r,i.g,i.b);a!=null&&a.charAt(0)=="#"&&(a.length==4?(d=a.charAt(1),d+=d,e=a.charAt(2),e+=e,f=a.charAt(3),f+=f):a.length==7&&(d=a.substring(1,3),e=a.substring(3,5),f=a.substring(5,7)),d=parseInt(d,16),e=parseInt(e,16),f=parseInt(f,16));return b(d,e,f)}function H(a){return a<16?"0"+a.toString(16):a.toString(16)}function G(){return"#"+H(this.r)+H(this.g)+H(this.b)}function F(a,b,c){return{r:a,g:b,b:c,toString:G}}function E(a){return a in D||/\bcolor\b/.test(a)?d3.interpolateRgb:d3.interpolate}function A(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375}function z(a){a||(a=1.70158);return function(b){return b*b*((a+1)*b-a)}}function y(a,b){var c;arguments.length<2&&(b=.45),arguments.length<1?(a=1,c=b/4):c=b/(2*Math.PI)*Math.asin(1/a);return function(d){return 1+a*Math.pow(2,10*-d)*Math.sin((d-c)*2*Math.PI/b)}}function x(a){return 1-Math.sqrt(1-a*a)}function w(a){return a?Math.pow(2,10*(a-1))-.001:0}function v(a){return 1-Math.cos(a*Math.PI/2)}function u(a){return function(b){return Math.pow(b,a)}}function t(a){return a}function s(a){return function(b){return.5*(b<.5?a(2*b):2-a(2-2*b))}}function r(a){return function(b){return 1-a(1-b)}}function l(a){var b=a.lastIndexOf("."),c=b>=0?a.substring(b):(b=a.length,""),d=[];while(b>0)d.push(a.substring(b-=3,b+3));return d.reverse().join(",")+c}function j(a){var b={},c=[];b.add=function(a){for(var d=0;d<c.length;d++)if(c[d].listener==a)return b;c.push({listener:a,on:!0});return b},b.remove=function(a){for(var d=0;d<c.length;d++){var e=c[d];if(e.listener==a){e.on=!1,c=c.slice(0,d).concat(c.slice(d+1));break}}return b},b.dispatch=function(){var a=c;for(var b=0,d=a.length;b<d;b++){var e=a[b];e.on&&e.listener.apply(this,arguments)}};return b}function h(a){var b=a;arguments[0]=this,b.apply(this,arguments);return this}function g(a){return a.replace(/(^\s+)|(\s+$)/g,"").replace(/\s+/g," ")}function f(a){return a==null}function e(a){return typeof a=="function"?a:function(){return a}}function c(a){return Array.prototype.slice.call(a)}function b(a){var b=-1,c=a.length,d=[];while(++b<c)d.push(a[b]);return d}d3={version:"1.8.3"},Date.now||(Date.now=function(){return+(new Date)}),Object.create||(Object.create=function(a){function b(){}b.prototype=a;return new b});var a=c;try{a(document.documentElement.childNodes)[0].nodeType}catch(d){a=b}d3.rebind=function(a,b){return function(){var c=b.apply(a,arguments);return arguments.length?a:c}},d3.ascending=function(a,b){return a<b?-1:a>b?1:0},d3.descending=function(a,b){return b<a?-1:b>a?1:0},d3.min=function(a,b){var c=0,d=a.length,e=a[0],f;if(arguments.length==1)while(++c<d)e>(f=a[c])&&(e=f);else{e=b(a[0]);while(++c<d)e>(f=b(a[c]))&&(e=f)}return e},d3.max=function(a,b){var c=0,d=a.length,e=a[0],f;if(arguments.length==1)while(++c<d)e<(f=a[c])&&(e=f);else{e=b(e);while(++c<d)e<(f=b(a[c]))&&(e=f)}return e},d3.nest=function(){function g(a,d){if(d>=b.length)return a;var e=[],f=c[d++],h;for(h in a)e.push({key:h,values:g(a[h],d)});f&&e.sort(function(a,b){return f(a.key,b.key)});return e}function f(c,g){if(g>=b.length)return e?e.call(a,c):d?c.sort(d):c;var h=-1,i=c.length,j=b[g++],k,l,m={};while(++h<i)(k=j(l=c[h]))in m?m[k].push(l):m[k]=[l];for(k in m)m[k]=f(m[k],g);return m}var a={},b=[],c=[],d,e;a.map=function(a){return f(a,0)},a.entries=function(a){return g(f(a,0),0)},a.key=function(c){b.push(c);return a},a.sortKeys=function(d){c[b.length-1]=d;return a},a.sortValues=function(b){d=b;return a},a.rollup=function(b){e=b;return a};return a},d3.keys=function(a){var b=[];for(var c in a)b.push(c);return b},d3.values=function(a){var b=[];for(var c in a)b.push(a[c]);return b},d3.entries=function(a){var b=[];for(var c in a)b.push({key:c,value:a[c]});return b},d3.merge=function(a){return Array.prototype.concat.apply([],a)},d3.split=function(a,b){var c=[],d=[],e,g=-1,h=a.length;arguments.length<2&&(b=f);while(++g<h)b.call(d,e=a[g],g)?d=[]:(d.length||c.push(d),d.push(e));return c},d3.range=function(a,b,c){arguments.length==1&&(b=a,a=0),c==null&&(c=1);if((b-a)/c==Infinity)throw new Error("infinite range");var d=[],e=-1,f;if(c<0)while((f=a+c*++e)>b)d.push(f);else while((f=a+c*++e)<b)d.push(f);return d},d3.requote=function(a){return a.replace(i,"\\$&")};var i=/[\\\^\$\*\+\?\[\]\(\)\.\{\}]/g;d3.xhr=function(a,b,c){var d=new XMLHttpRequest;arguments.length<3?c=b:b&&d.overrideMimeType&&d.overrideMimeType(b),d.open("GET",a,!0),d.onreadystatechange=function(){d.readyState==4&&c(d.status<300?d:null)},d.send(null)},d3.text=function(a,b,c){function d(a){c(a&&a.responseText)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.json=function(a,b){d3.text(a,"application/json",function(a){b(a?JSON.parse(a):null)})},d3.html=function(a,b){d3.text(a,"text/html",function(a){if(a!=null){var c=document.createRange();c.selectNode(document.body),a=c.createContextualFragment(a)}b(a)})},d3.xml=function(a,b,c){function d(a){c(a&&a.responseXML)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.ns={prefix:{svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},qualify:function(a){var b=a.indexOf(":");return b<0?a:{space:d3.ns.prefix[a.substring(0,b)],local:a.substring(b+1)}}},d3.dispatch=function(a){var b={},c;for(var d=0,e=arguments.length;d<e;d++)c=arguments[d],b[c]=j(c);return b},d3.format=function(a){var b=k.exec(a),c=b[1]||" ",d=b[3]||"",e=b[5],f=+b[6],g=b[7],h=b[8],i=b[9];h&&(h=h.substring(1)),e&&(c="0",g&&(f-=Math.floor((f-1)/4))),i=="d"&&(h="0");return function(a){var b=+a,j=b<0&&(b=-b)?"−":d;if(i=="d"&&b%1)return"";h?a=b.toFixed(h):a=""+b;if(e){var k=a.length+j.length;k<f&&(a=Array(f-k+1).join(c)+a),g&&(a=l(a)),a=j+a}else{g&&(a=l(a)),a=j+a;var k=a.length;k<f&&(a=Array(f-k+1).join(c)+a)}return a}};var k=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,m=u(2),o=u(3),p={linear:function(){return t},poly:u,quad:function(){return m},cubic:function(){return o},sin:function(){return v},exp:function(){return w},circle:function(){return x},elastic:y,back:z,bounce:function(){return A}},q={"in":function(a){return a},out:r,"in-out":s,"out-in":function(a){return s(r(a))}};d3.ease=function(a){var b=a.indexOf("-"),c=b>=0?a.substring(0,b):a,d=b>=0?a.substring(b+1):"in";return q[d](p[c].apply(null,Array.prototype.slice.call(arguments,1)))},d3.event=null,d3.interpolate=function(a,b){if(typeof b=="number")return d3.interpolateNumber(+a,b);if(typeof b=="string")return b in L||/^(#|rgb\(|hsl\()/.test(b)?d3.interpolateRgb(String(a),b):d3.interpolateString(String(a),b);if(b instanceof Array)return d3.interpolateArray(a,b);return d3.interpolateObject(a,b)},d3.interpolateNumber=function(a,b){b-=a;return function(c){return a+b*c}},d3.interpolateRound=function(a,b){b-=a;return function(c){return Math.round(a+b*c)}},d3.interpolateString=function(a,b){var c,d,e,f=0,g=0,h=[],i=[],j,k;for(d=0;c=B.exec(b);++d)c.index&&h.push(b.substring(f,g=c.index)),i.push({i:h.length,x:c[0]}),h.push(null),f=B.lastIndex;f<b.length&&h.push(b.substring(f));for(d=0,j=i.length;(c=B.exec(a))&&d<j;++d){k=i[d];if(k.x==c[0]){if(k.i)if(h[k.i+1]==null){h[k.i-1]+=k.x,h.splice(k.i,1);for(e=d+1;e<j;++e)i[e].i--}else{h[k.i-1]+=k.x+h[k.i+1],h.splice(k.i,2);for(e=d+1;e<j;++e)i[e].i-=2}else if(h[k.i+1]==null)h[k.i]=k.x;else{h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1);for(e=d+1;e<j;++e)i[e].i--}i.splice(d,1),j--,d--}else k.x=d3.interpolateNumber(parseFloat(c[0]),parseFloat(k.x))}while(d<j)k=i.pop(),h[k.i+1]==null?h[k.i]=k.x:(h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1)),j--;if(h.length==1)return h[0]==null?i[0].x:function(){return b};return function(a){for(d=0;d<j;++d)h[(k=i[d]).i]=k.x(a);return h.join("")}},d3.interpolateRgb=function(a,b){a=d3.rgb(a),b=d3.rgb(b);var c=a.r,d=a.g,e=a.b,f=b.r-c,g=b.g-d,h=b.b-e;return function(a){return"rgb("+Math.round(c+f*a)+","+Math.round(d+g*a)+","+Math.round(e+h*a)+")"}},d3.interpolateHsl=function(a,b){a=d3.hsl(a),b=d3.hsl(b);var c=a.h,d=a.s,e=a.l,f=b.h-c,g=b.s-d,h=b.l-e;return function(a){return P(c+f*a,d+g*a,e+h*a).toString()}},d3.interpolateArray=function(a,b){var c=[],d=[],e=a.length,f=b.length,g=Math.min(a.length,b.length),h;for(h=0;h<g;++h)c.push(d3.interpolate(a[h],b[h]));for(;h<e;++h)d[h]=a[h];for(;h<f;++h)d[h]=b[h];return function(a){for(h=0;h<g;++h)d[h]=c[h](a);return d}},d3.interpolateObject=function(a,b){var c={},d={},e;for(e in a)e in b?c[e]=E(e)(a[e],b[e]):d[e]=a[e];for(e in b)e in a||(d[e]=b[e]);return function(a){for(e in c)d[e]=c[e](a);return d}};var B=/[-+]?(?:\d+\.\d+|\d+\.|\.\d+|\d+)(?:[eE][-]?\d+)?/g,C=/[-+]?\d*\.?\d*(?:[eE][-]?\d+)?(.*)/,D={background:1,fill:1,stroke:1};d3.rgb=function(a,b,c){return arguments.length==1?I(""+a,F,P):F(~~a,~~b,~~c)};var L={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};for(var M in L)L[M]=I(L[M],F,P);d3.hsl=function(a,b,c){return arguments.length==1?I(""+a,J,N):N(+a,+b,+c)};var Q=function(a,b){return b.querySelector(a)},R=function(b,c){return a(c.querySelectorAll(b))};typeof Sizzle=="function"&&(Q=function(a,b){return Sizzle(a,b)[0]},R=function(a,b){return Sizzle.uniqueSort(Sizzle(a,b))});var S=T([[document]]);S[0].parentNode=document.documentElement,d3.select=function(a){return typeof a=="string"?S.select(a):T([[a]])},d3.selectAll=function(b){return typeof b=="string"?S.selectAll(b):T([a(b)])},d3.transition=S.transition;var W=0,X=0,$=null,_=0,ba;d3.timer=function(a){bb(a,0)};var bf=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){setTimeout(a,17)};d3.scale={},d3.scale.linear=function(){function j(c){var d=Math.min(a,b),e=Math.max(a,b),f=e-d,g=Math.pow(10,Math.floor(Math.log(f/c)/Math.LN10)),h=c/(f/g);h<=.15?g*=10:h<=.35?g*=5:h<=.75&&(g*=2);return{start:Math.ceil(d/g)*g,stop:Math.floor(e/g)*g+g*.5,step:g}}function i(b){return h((b-a)*e)}var a=0,b=1,c=0,d=1,e=1,f=1,g=d3.interpolate,h=g(c,d);i.invert=function(b){return(b-c)*f+a},i.domain=function(g){if(!arguments.length)return[a,b];a=+g[0],b=+g[1],e=1/(b-a),f=(b-a)/(d-c);return i},i.range=function(e){if(!arguments.length)return[c,d];c=e[0],d=e[1],f=(b-a)/(d-c),h=g(c,d);return i},i.rangeRound=function(a){return i.range(a).interpolate(d3.interpolateRound)},i.interpolate=function(a){if(!arguments.length)return g;h=(g=a)(c,d);return i},i.ticks=function(a){var b=j(a);return d3.range(b.start,b.stop,b.step)},i.tickFormat=function(a){var b=Math.max(0,-Math.floor(Math.log(j(a).step)/Math.LN10+.01));return d3.format(",."+b+"f")};return i},d3.scale.log=function(){function d(c){return a(b(c))}var a=d3.scale.linear(),b=bg,c=b.pow;d.invert=function(b){return c(a.invert(b))},d.domain=function(e){if(!arguments.length)return a.domain().map(c);b=(e[0]||e[1])<0?bh:bg,c=b.pow,a.domain(e.map(b));return d},d.range=d3.rebind(d,a.range),d.rangeRound=d3.rebind(d,a.rangeRound),d.interpolate=d3.rebind(d,a.interpolate),d.ticks=function(){var b=a.domain(),d=[];if(b.every(isFinite)){var e=Math.floor(b[0]),f=Math.ceil(b[1]),g=c(b[0]),h=c(b[1]);if(n){d.push(c(e));for(;e++<f;)for(var i=9;i>0;i--)d.push(c(e)*i)}else{for(;e<f;e++)for(var i=1;i<10;i++)d.push(c(e)*i);d.push(c(e))}for(e=0;d[e]<g;e++);for(f=d.length;d[f-1]>h;f--);d=d.slice(e,f)}return d},d.tickFormat=function(){return function(a){return a.toPrecision(1)}};return d},bg.pow=function(a){return Math.pow(10,a)},bh.pow=function(a){return-Math.pow(10,-a)},d3.scale.pow=function(){function f(b){return a(d(b))}var a=d3.scale.linear(),b=d3.scale.linear(),c=1,d=Number,e=d;f.invert=function(b){return e(a.invert(b))},f.domain=function(g){if(!arguments.length)return a.domain().map(e);var h=(g[0]||g[1])<0?bj:bi;d=h(c),e=h(1/c),a.domain(g.map(d)),b.domain(g);return f},f.range=d3.rebind(f,a.range),f.rangeRound=d3.rebind(f,a.rangeRound),f.interpolate=d3.rebind(f,a.interpolate),f.ticks=b.ticks,f.tickFormat=b.tickFormat,f.exponent=function(a){if(!arguments.length)return c;var b=f.domain();c=a;return f.domain(b)};return f},d3.scale.sqrt=function(){return d3.scale.pow().exponent(.5)},d3.scale.ordinal=function(){function e(d){var e=d in b?b[d]:b[d]=a.push(d)-1;return c[e%c.length]}var a=[],b={},c=[],d=0;e.domain=function(c){if(!arguments.length)return a;a=c,b={};var d=-1,f=-1,g=a.length;while(++d<g)c=a[d],c in b||(b[c]=++f);return e},e.range=function(a){if(!arguments.length)return c;c=a;return e},e.rangePoints=function(b,f){arguments.length<2&&(f=0);var g=b[0],h=b[1],i=(h-g)/(a.length-1+f);c=a.length==1?[(g+h)/2]:d3.range(g+i*f/2,h+i/2,i),d=0;return e},e.rangeBands=function(b,f){arguments.length<2&&(f=0);var g=b[0],h=b[1],i=(h-g)/(a.length+f);c=d3.range(g+i*f,h,i),d=i*(1-f);return e},e.rangeRoundBands=function(b,f){arguments.length<2&&(f=0);var g=b[0],h=b[1],i=h-g,j=Math.floor(i/(a.length+f)),k=i-(a.length-f)*j;c=d3.range(g+Math.round(k/2),h,j),d=Math.round(j*(1-f));return e},e.rangeBand=function(){return d};return e},d3.scale.category10=function(){return d3.scale.ordinal().range(bk)},d3.scale.category20=function(){return d3.scale.ordinal().range(bl)},d3.scale.category20b=function(){return d3.scale.ordinal().range(bm)},d3.scale.category20c=function(){return d3.scale.ordinal().range(bn)};var bk=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],bl=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],bm=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],bn=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"];d3.scale.quantile=function(){function f(a){return b[e(a)]}function e(a){if(isNaN(a=+a))return NaN;var b=0,d=c.length-1;while(b<=d){var e=b+d>>1,f=c[e];if(f<a)b=e+1;else if(f>a)d=e-1;else return e}return d<0?0:d}function d(){var d=-1,e=c.length=b.length,f=a.length/e;while(++d<e)c[d]=a[~~(d*f)]}var a=[],b=[],c=[];f.domain=function(b){if(!arguments.length)return a;a=b.filter(function(a){return!isNaN(a)}).sort(d3.ascending),d();return f},f.range=function(a){if(!arguments.length)return b;b=a,d();return f},f.quantiles=function(){return c};return f},d3.scale.quantize=function(){function f(b){return e[Math.max(0,Math.min(d,Math.floor(c*(b-a))))]}var a=0,b=1,c=2,d=1,e=[0,1];f.domain=function(d){if(!arguments.length)return[a,b];a=d[0],b=d[1],c=e.length/(b-a);return f},f.range=function(g){if(!arguments.length)return e;e=g,c=e.length/(b-a),d=e.length-1;return f};return f},d3.svg={},d3.svg.arc=function(){function f(){var e=a.apply(this,arguments),f=b.apply(this,arguments),g=c.apply(this,arguments)+bo,h=d.apply(this,arguments)+bo,i=h-g,j=i<Math.PI?"0":"1",k=Math.cos(g),l=Math.sin(g),m=Math.cos(h),n=Math.sin(h);return i>=bp?e?"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"M0,"+e+"A"+e+","+e+" 0 1,1 0,"+ -e+"A"+e+","+e+" 0 1,1 0,"+e+"Z":"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"Z":e?"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L"+e*m+","+e*n+"A"+e+","+e+" 0 "+j+",0 "+e*k+","+e*l+"Z":"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L0,0"+"Z"}var a=bq,b=br,c=bs,d=bt;f.innerRadius=function(b){if(!arguments.length)return a;a=e(b);return f},f.outerRadius=function(a){if(!arguments.length)return b;b=e(a);return f},f.startAngle=function(a){if(!arguments.length)return c;c=e(a);return f},f.endAngle=function(a){if(!arguments.length)return d;d=e(a);return f},f.centroid=function(){var e=(a.apply(this,arguments)+b.apply(this,arguments))/2,f=(c.apply(this,arguments)+d.apply(this,arguments))/2+bo;return[Math.cos(f)*e,Math.sin(f)*e]};return f};var bo=-Math.PI/2,bp=2*Math.PI-1e-6;d3.svg.line=function(){function f(c){return c.length<1?null:"M"+d(bu(this,c,a,b),e)}var a=bv,b=bw,c="linear",d=bx[c],e=.7;f.x=function(b){if(!arguments.length)return a;a=b;return f},f.y=function(a){if(!arguments.length)return b;b=a;return f},f.interpolate=function(a){if(!arguments.length)return c;d=bx[c=a];return f},f.tension=function(a){if(!arguments.length)return e;e=a;return f};return f};var bx={linear:by,"step-before":bz,"step-after":bA,basis:bF,"basis-closed":bG,cardinal:bC,"cardinal-closed":bB}
+,bI=[0,2/3,1/3,0],bJ=[0,1/3,2/3,0],bK=[0,1/6,2/3,1/6];d3.svg.area=function(){function g(d){return d.length<1?null:"M"+e(bu(this,d,a,c),f)+"L"+e(bu(this,d,a,b).reverse(),f)+"Z"}var a=bv,b=bM,c=bw,d="linear",e=bx[d],f=.7;g.x=function(b){if(!arguments.length)return a;a=b;return g},g.y0=function(a){if(!arguments.length)return b;b=a;return g},g.y1=function(a){if(!arguments.length)return c;c=a;return g},g.interpolate=function(a){if(!arguments.length)return d;e=bx[d=a];return g},g.tension=function(a){if(!arguments.length)return f;f=a;return g};return g},d3.svg.chord=function(){function k(a,b,c,d){return"Q 0,0 "+d}function j(a,b){return"A"+a+","+a+" 0 0,1 "+b}function i(a,b){return a.a0==b.a0&&a.a1==b.a1}function h(a,b,e,g){var h=b.call(a,e,g),i=c.call(a,h,g),j=d.call(a,h,g)+bo,k=f.call(a,h,g)+bo;return{r:i,a0:j,a1:k,p0:[i*Math.cos(j),i*Math.sin(j)],p1:[i*Math.cos(k),i*Math.sin(k)]}}function g(c,d){var e=h(this,a,c,d),f=h(this,b,c,d);return"M"+e.p0+j(e.r,e.p1)+(i(e,f)?k(e.r,e.p1,e.r,e.p0):k(e.r,e.p1,f.r,f.p0)+j(f.r,f.p1)+k(f.r,f.p1,e.r,e.p0))+"Z"}var a=bN,b=bO,c=bP,d=bs,f=bt;g.radius=function(a){if(!arguments.length)return c;c=e(a);return g},g.source=function(b){if(!arguments.length)return a;a=e(b);return g},g.target=function(a){if(!arguments.length)return b;b=e(a);return g},g.startAngle=function(a){if(!arguments.length)return d;d=e(a);return g},g.endAngle=function(a){if(!arguments.length)return f;f=e(a);return g};return g},d3.svg.mouse=function(a){var b=(a.ownerSVGElement||a).createSVGPoint();if(bS<0&&(window.scrollX||window.scrollY)){var c=d3.select(document.body).append("svg:svg").style("position","absolute").style("top",0).style("left",0),d=c[0][0].getScreenCTM();bS=!d.f&&!d.e,c.remove()}bS?(b.x=d3.event.pageX,b.y=d3.event.pageY):(b.x=d3.event.clientX,b.y=d3.event.clientY),b=b.matrixTransform(a.getScreenCTM().inverse());return[b.x,b.y]};var bS=/WebKit/.test(navigator.userAgent)?-1:0;d3.svg.symbol=function(){function c(c,d){return(bV[a.call(this,c,d)]||bV.circle)(b.call(this,c,d))}var a=bU,b=bT;c.type=function(b){if(!arguments.length)return a;a=e(b);return c},c.size=function(a){if(!arguments.length)return b;b=e(a);return c};return c},d3.svg.symbolTypes=["circle","cross","diamond","square","triangle-down","triangle-up"];var bV={circle:function(a){var b=Math.sqrt(a/Math.PI);return"M0,"+b+"A"+b+","+b+" 0 1,1 0,"+ -b+"A"+b+","+b+" 0 1,1 0,"+b+"Z"},cross:function(a){var b=Math.sqrt(a/5)/2;return"M"+ -3*b+","+ -b+"H"+ -b+"V"+ -3*b+"H"+b+"V"+ -b+"H"+3*b+"V"+b+"H"+b+"V"+3*b+"H"+ -b+"V"+b+"H"+ -3*b+"Z"},diamond:function(a){var b=Math.sqrt(a/(2*bX)),c=b*bX;return"M0,"+ -b+"L"+c+",0"+" 0,"+b+" "+ -c+",0"+"Z"},square:function(a){var b=Math.sqrt(a)/2;return"M"+ -b+","+ -b+"L"+b+","+ -b+" "+b+","+b+" "+ -b+","+b+"Z"},"triangle-down":function(a){var b=Math.sqrt(a/bW),c=b*bW/2;return"M0,"+c+"L"+b+","+ -c+" "+ -b+","+ -c+"Z"},"triangle-up":function(a){var b=Math.sqrt(a/bW),c=b*bW/2;return"M0,"+ -c+"L"+b+","+c+" "+ -b+","+c+"Z"}},bW=Math.sqrt(3),bX=Math.tan(30*Math.PI/180)})()
View
9 d3.time.min.js
@@ -1,8 +1 @@
-(function(){function j(a,b,c,f){for(var d,h=0,i=b.length,k=c.length;h<i;){if(f>=k)return-1;d=b.charCodeAt(h++);if(d==37){d=t[b.charAt(h++)];if(!d||(f=d(a,c,f))<0)return-1}else if(d!=c.charCodeAt(f++))return-1}return f}function m(a,b,c){e.lastIndex=0;return(b=e.exec(b.substring(c,c+2)))?(a.setDate(+b[0]),c+b[0].length):-1}function n(a,b,c){e.lastIndex=0;return(b=e.exec(b.substring(c,c+2)))?(a.setHours(+b[0]),c+b[0].length):-1}d3.time={};d3.time.format=function(a){function b(f){for(var d=[],h=-1,i=
-0,k,o;++h<c;)if(a.charCodeAt(h)==37){d.push(a.substring(i,h),(o=l[k=a.charAt(++h)])?o(f):k);i=h+1}d.push(a.substring(i,h));return d.join("")}var c=a.length;b.parse=function(f){var d=new Date(1900,0,1);if(j(d,a,f,0)!=f.length)return null;if(d.hour12){f=d.getHours()%12;d.setHours(d.hour12pm?f+12:f)}delete d.hour12;delete d.hour12pm;return d};b.toString=function(){return a};return b};var g=d3.format("02d"),u=d3.format("03d"),v=d3.format("04d"),w=d3.format("2d"),l={a:function(a){return p[a.getDay()].substring(0,
-3)},A:function(a){return p[a.getDay()]},b:function(a){return q[a.getMonth()].substring(0,3)},B:function(a){return q[a.getMonth()]},c:d3.time.format("%a %b %e %H:%M:%S %Y"),d:function(a){return g(a.getDate())},e:function(a){return w(a.getDate())},H:function(a){return g(a.getHours())},I:function(a){return g(a.getHours()%12||12)},j:function(a){return u(1+~~((a-new Date(a.getFullYear(),0,1))/864E5))},m:function(a){return g(a.getMonth()+1)},M:function(a){return g(a.getMinutes())},p:function(a){return a.getHours()>=
-12?"PM":"AM"},S:function(a){return g(a.getSeconds())},U:function(a){var b=new Date(a.getFullYear(),0,1);return g(~~(((a-b)/864E5+b.getDay())/7))},w:function(a){return a.getDay()},W:function(a){var b=new Date(a.getFullYear(),0,1);return g(~~(((a-b)/864E5+(b.getDay()+6)%7)/7))},x:d3.time.format("%m/%d/%y"),X:d3.time.format("%H:%M:%S"),y:function(a){return g(a.getYear()%100)},Y:function(a){return v(a.getFullYear()%1E4)},Z:function(a){a=a.getTimezoneOffset();var b=Math.abs(a)%60;return(a>0?"-":"+")+g(~~(Math.abs(a)/
-60))+g(b)},"%":function(){return"%"}},t={a:function(a,b,c){return b.substring(c,c+=3).toLowerCase()in x?c:-1},A:function(a,b,c){r.lastIndex=0;return(a=r.exec(b.substring(c,c+10)))?c+a[0].length:-1},b:function(a,b,c){b=y[b.substring(c,c+=3).toLowerCase()];return b==null?-1:(a.setMonth(b),c)},B:function(a,b,c){s.lastIndex=0;return(b=s.exec(b.substring(c,c+12)))?(a.setMonth(z[b[0].toLowerCase()]),c+b[0].length):-1},c:function(a,b,c){return j(a,l.c.toString(),b,c)},d:m,e:m,H:n,I:function(a,b,c){a.hour12=
-true;return n(a,b,c)},m:function(a,b,c){e.lastIndex=0;return(b=e.exec(b.substring(c,c+2)))?(a.setMonth(b[0]-1),c+b[0].length):-1},M:function(a,b,c){e.lastIndex=0;return(b=e.exec(b.substring(c,c+2)))?(a.setMinutes(+b[0]),c+b[0].length):-1},p:function(a,b,c){b=A[b.substring(c,c+=2).toLowerCase()];return b==null?-1:(a.hour12pm=b,c)},S:function(a,b,c){e.lastIndex=0;return(b=e.exec(b.substring(c,c+2)))?(a.setSeconds(+b[0]),c+b[0].length):-1},x:function(a,b,c){return j(a,l.x.toString(),b,c)},X:function(a,
-b,c){return j(a,l.X.toString(),b,c)},y:function(a,b,c){e.lastIndex=0;return(b=e.exec(b.substring(c,c+2)))?(a.setFullYear(~~((new Date).getFullYear()/1E3)*1E3+ +b[0]),c+b[0].length):-1},Y:function(a,b,c){e.lastIndex=0;return(b=e.exec(b.substring(c,c+4)))?(a.setFullYear(b[0]),c+b[0].length):-1}},x={sun:3,mon:3,tue:3,wed:3,thu:3,fri:3,sat:3},r=/^(?:Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday)/ig,p=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],y={jan:0,feb:1,mar:2,
-apr:3,may:4,jun:5,jul:6,aug:7,sep:8,oct:9,nov:10,dec:11},s=/^(?:January|February|March|April|May|June|July|August|September|October|November|December)/ig,z={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},q=["January","February","March","April","May","June","July","August","September","October","November","December"],e=/\s*\d+/,A={am:0,pm:1}})();
+(function(){function K(a){var c=a.getTimezoneOffset(),d=c>0?"-":"+",e=~~(Math.abs(c)/60),f=Math.abs(c)%60;return d+b(e)+b(f)}function J(a){var c=new Date(a.getFullYear(),0,1);return b(~~(((a-c)/864e5+(c.getDay()+6)%7)/7))}function I(a){var c=new Date(a.getFullYear(),0,1);return b(~~(((a-c)/864e5+c.getDay())/7))}function H(a){return c(1+~~((a-new Date(a.getFullYear(),0,1))/864e5))}function F(a,b,c){var d=G[b.substring(c,c+=2).toLowerCase()];return d==null?-1:(a.hour12pm=d,c)}function D(a,b,c){E.lastIndex=0;var d=E.exec(b.substring(c,c+2));return d?(a.setSeconds(+d[0]),c+=d[0].length):-1}function C(a,b,c){E.lastIndex=0;var d=E.exec(b.substring(c,c+2));return d?(a.setMinutes(+d[0]),c+=d[0].length):-1}function B(a,b,c){a.hour12=!0;return A(a,b,c)}function A(a,b,c){E.lastIndex=0;var d=E.exec(b.substring(c,c+2));return d?(a.setHours(+d[0]),c+=d[0].length):-1}function z(a,b,c){E.lastIndex=0;var d=E.exec(b.substring(c,c+2));return d?(a.setDate(+d[0]),c+=d[0].length):-1}function y(a,b,c){E.lastIndex=0;var d=E.exec(b.substring(c,c+2));return d?(a.setMonth(d[0]-1),c+=d[0].length):-1}function x(){return~~((new Date).getFullYear()/1e3)*1e3}function w(a,b,c){E.lastIndex=0;var d=E.exec(b.substring(c,c+2));return d?(a.setFullYear(x()+ +d[0]),c+=d[0].length):-1}function v(a,b,c){E.lastIndex=0;var d=E.exec(b.substring(c,c+4));return d?(a.setFullYear(d[0]),c+=d[0].length):-1}function u(b,c,d){return a(b,f.X.toString(),c,d)}function t(b,c,d){return a(b,f.x.toString(),c,d)}function s(b,c,d){return a(b,f.c.toString(),c,d)}function o(a,b,c){p.lastIndex=0;var d=p.exec(b.substring(c,c+12));return d?(a.setMonth(q[d[0].toLowerCase()]),c+=d[0].length):-1}function m(a,b,c){var d=n[b.substring(c,c+=3).toLowerCase()];return d==null?-1:(a.setMonth(d),c)}function j(a,b,c){k.lastIndex=0;var d=k.exec(b.substring(c,c+10));return d?c+=d[0].length:-1}function h(a,b,c){return b.substring(c,c+=3).toLowerCase()in i?c:-1}function a(a,b,c,d){var e,f,h=0,i=b.length,j=c.length;while(h<i){if(d>=j)return-1;e=b.charCodeAt(h++);if(e==37){f=g[b.charAt(h++)];if(!f||(d=f(a,c,d))<0)return-1}else if(e!=c.charCodeAt(d++))return-1}return d}d3.time={},d3.time.format=function(b){function d(a){var d=[],e=-1,g=0,h,i;while(++e<c)b.charCodeAt(e)==37&&(d.push(b.substring(g,e),(i=f[h=b.charAt(++e)])?i(a):h),g=e+1);d.push(b.substring(g,e));return d.join("")}var c=b.length;d.parse=function(c){var d=new Date(1900,0,1),e=a(d,b,c,0);if(e!=c.length)return null;if(d.hour12){var f=d.getHours()%12;d.setHours(d.hour12pm?f+12:f)}delete d.hour12,delete d.hour12pm;return d},d.toString=function(){return b};return d};var b=d3.format("02d"),c=d3.format("03d"),d=d3.format("04d"),e=d3.format("2d"),f={a:function(a){return l[a.getDay()].substring(0,3)},A:function(a){return l[a.getDay()]},b:function(a){return r[a.getMonth()].substring(0,3)},B:function(a){return r[a.getMonth()]},c:d3.time.format("%a %b %e %H:%M:%S %Y"),d:function(a){return b(a.getDate())},e:function(a){return e(a.getDate())},H:function(a){return b(a.getHours())},I:function(a){return b(a.getHours()%12||12)},j:H,m:function(a){return b(a.getMonth()+1)},M:function(a){return b(a.getMinutes())},p:function(a){return a.getHours()>=12?"PM":"AM"},S:function(a){return b(a.getSeconds())},U:I,w:function(a){return a.getDay()},W:J,x:d3.time.format("%m/%d/%y"),X:d3.time.format("%H:%M:%S"),y:function(a){return b(a.getYear()%100)},Y:function(a){return d(a.getFullYear()%1e4)},Z:K,"%":function(a){return"%"}},g={a:h,A:j,b:m,B:o,c:s,d:z,e:z,H:A,I:B,m:y,M:C,p:F,S:D,x:t,X:u,y:w,Y:v},i={sun:3,mon:3,tue:3,wed:3,thu:3,fri:3,sat:3},k=/^(?:Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday)/ig,l=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],n={jan:0,feb:1,mar:2,apr:3,may:4,jun:5,jul:6,aug:7,sep:8,oct:9,nov:10,dec:11},p=/^(?:January|February|March|April|May|June|July|August|September|October|November|December)/ig,q={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},r=["January","February","March","April","May","June","July","August","September","October","November","December"],E=/\s*\d+/,G={am:0,pm:1}})()
View
202 lib/google-compiler/COPYING
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
View
278 lib/google-compiler/README
@@ -1,278 +0,0 @@
-/*
- * Copyright 2009 The Closure Compiler Authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-//
-// Contents
-//
-
-The Closure Compiler performs checking, instrumentation, and
-optimizations on JavaScript code. The purpose of this README is to
-explain how to build and run the Closure Compiler.
-
-The Closure Compiler requires Java 6 or higher.
-http://www.java.com/
-
-
-//
-// Building The Closure Compiler
-//
-
-There are three ways to get a Closure Compiler executable.
-
-1) Use one we built for you.
-
-Pre-built Closure binaries can be found at
-http://code.google.com/p/closure-compiler/downloads/list
-
-
-2) Check out the source and build it with Apache Ant.
-
-First, check out the full source tree of the Closure Compiler. There
-are instructions on how to do this at the project site.
-http://code.google.com/p/closure-compiler/source/checkout
-
-Apache Ant is a cross-platform build tool.
-http://ant.apache.org/
-
-At the root of the source tree, there is an Ant file named
-build.xml. To use it, navigate to the same directory and type the
-command
-
-ant jar
-
-This will produce a jar file called "build/compiler.jar".
-
-
-3) Check out the source and build it with Eclipse.
-
-Eclipse is a cross-platform IDE.
-http://www.eclipse.org/
-
-Under Eclipse's File menu, click "New > Project ..." and create a
-"Java Project." You will see an options screen. Give the project a
-name, select "Create project from existing source," and choose the
-root of the checked-out source tree as the existing directory. Verify
-that you are using JRE version 6 or higher.
-
-Eclipse can use the build.xml file to discover rules. When you
-navigate to the build.xml file, you will see all the build rules in
-the "Outline" pane. Run the "jar" rule to build the compiler in
-build/compiler.jar.
-
-
-//
-// Running The Closure Compiler
-//
-
-Once you have the jar binary, running the Closure Compiler is straightforward.
-
-On the command line, type
-
-java -jar compiler.jar
-
-This starts the compiler in interactive mode. Type
-
-var x = 17 + 25;
-
-then hit "Enter", then hit "Ctrl-Z" (on Windows) or "Ctrl-D" (on Mac or Linux)
-and "Enter" again. The Compiler will respond:
-
-var x=42;
-
-The Closure Compiler has many options for reading input from a file,
-writing output to a file, checking your code, and running
-optimizations. To learn more, type
-
-java -jar compiler.jar --help
-
-You can read more detailed documentation about the many flags at
-http://code.google.com/closure/compiler/docs/gettingstarted_app.html
-
-
-//
-// Compiling Multiple Scripts
-//
-
-If you have multiple scripts, you should compile them all together with
-one compile command.
-
-java -jar compiler.jar --js=in1.js --js=in2.js ... --js_output_file=out.js
-
-The Closure Compiler will concatenate the files in the order they're
-passed at the command line.
-
-If you need to compile many, many scripts together, you may start to
-run into problems with managing dependencies between scripts. You
-should check out the Closure Library. It contains functions for
-enforcing dependencies between scripts, and a tool called calcdeps.py
-that knows how to give scripts to the Closure Compiler in the right
-order.
-
-http://code.google.com/p/closure-library/
-
-//
-// Licensing
-//
-
-Unless otherwise stated, all source files are licensed under
-the Apache License, Version 2.0.
-
-
------
-Code under:
-src/com/google/javascript/rhino
-test/com/google/javascript/rhino
-
-URL: http://www.mozilla.org/rhino
-Version: 1.5R3, with heavy modifications
-License: Netscape Public License and MPL / GPL dual license
-
-Description: A partial copy of Mozilla Rhino. Mozilla Rhino is an
-implementation of JavaScript for the JVM. The JavaScript parser and
-the parse tree data structures were extracted and modified
-significantly for use by Google's JavaScript compiler.
-
-Local Modifications: The packages have been renamespaced. All code not
-relavant to parsing has been removed. A JSDoc parser and static typing
-system have been added.
-
-
------
-Code in:
-lib/libtrunk_rhino_parser_jarjared.jar
-
-Rhino
-URL: http://www.mozilla.org/rhino
-Version: Trunk
-License: Netscape Public License and MPL / GPL dual license
-
-Description: Mozilla Rhino is an implementation of JavaScript for the JVM.
-
-Local Modifications: None. We've used JarJar to renamespace the code
-post-compilation. See:
-http://code.google.com/p/jarjar/
-
-
------
-Code in:
-lib/args4j.jar
-
-Args4j
-URL: https://args4j.dev.java.net/
-Version: 2.0.12
-License: MIT
-
-Description:
-args4j is a small Java class library that makes it easy to parse command line
-options/arguments in your CUI application.
-
-Local Modifications: None.
-
-
------
-Code in:
-lib/guava.jar
-
-Guava Libraries
-URL: http://code.google.com/p/guava-libraries/
-Version: R7
-License: Apache License 2.0
-
-Description: Google's core Java libraries.
-
-Local Modifications: None.
-
-
------
-Code in:
-lib/jsr305.jar
-
-Annotations for software defect detection
-URL: http://code.google.com/p/jsr-305/
-Version: svn revision 47
-License: BSD License
-
-Description: Annotations for software defect detection.
-
-Local Modifications: None.
-
-
-----
-Code in:
-lib/junit.jar
-
-JUnit
-URL: http://sourceforge.net/projects/junit/
-Version: 4.8.2
-License: Common Public License 1.0
-
-Description: A framework for writing and running automated tests in Java.
-
-Local Modifications: None.
-
-
----
-Code in:
-lib/protobuf-java.jar
-
-Protocol Buffers
-URL: http://code.google.com/p/protobuf/
-Version: 2.3.0
-License: New BSD License
-
-Description: Supporting libraries for protocol buffers,
-an encoding of structured data.
-
-Local Modifications: None
-
-
----
-Code in:
-lib/ant.jar
-lib/ant-launcher.jar
-
-URL: http://ant.apache.org/bindownload.cgi
-Version: 1.8.1
-License: Apache License 2.0
-Description:
- Ant is a Java based build tool. In theory it is kind of like "make"
- without make's wrinkles and with the full portability of pure java code.
-
-Local Modifications: None
-
-
----
-Code in:
-lib/json.jar
-URL: http://json.org/java/index.html
-Version: JSON version 20090211
-License: MIT license
-Description:
-JSON is a set of java files for use in transmitting data in JSON format.
-
-Local Modifications: None
-
----
-Code in:
-tools/maven-ant-tasks-2.1.1.jar
-URL: http://maven.apache.org
-Version 2.1.1
-License: Apache License 2.0
-Description:
- Maven Ant tasks are used to manage dependencies and to install/deploy to
- maven repositories.
-
-Local Modifications: None
View
BIN  lib/google-compiler/compiler.jar
Binary file not shown
View
4 lib/uglifyjs/.gitignore
@@ -0,0 +1,4 @@
+.DS_Store
+.tmp*~
+*.local.*
+.pinf-*
View
782 lib/uglifyjs/README.html
@@ -0,0 +1,782 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+lang="en" xml:lang="en">
+<head>
+<title>UglifyJS -- a JavaScript parser/compressor/beautifier</title>
+<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
+<meta name="generator" content="Org-mode"/>
+<meta name="generated" content="2011-02-28 22:35:00 EET"/>
+<meta name="author" content="Mihai Bazon"/>
+<meta name="description" content="a JavaScript parser/compressor/beautifier in JavaScript"/>
+<meta name="keywords" content="javascript, js, parser, compiler, compressor, mangle, minify, minifier"/>
+<style type="text/css">
+ <!--/*--><![CDATA[/*><!--*/
+ html { font-family: Times, serif; font-size: 12pt; }
+ .title { text-align: center; }
+ .todo { color: red; }
+ .done { color: green; }
+ .tag { background-color: #add8e6; font-weight:normal }
+ .target { }
+ .timestamp { color: #bebebe; }
+ .timestamp-kwd { color: #5f9ea0; }
+ p.verse { margin-left: 3% }
+ pre {
+ border: 1pt solid #AEBDCC;
+ background-color: #F3F5F7;
+ padding: 5pt;
+ font-family: courier, monospace;
+ font-size: 90%;
+ overflow:auto;
+ }
+ table { border-collapse: collapse; }
+ td, th { vertical-align: top; }
+ dt { font-weight: bold; }
+ div.figure { padding: 0.5em; }
+ div.figure p { text-align: center; }
+ textarea { overflow-x: auto; }
+ .linenr { font-size:smaller }
+ .code-highlighted {background-color:#ffff00;}
+ .org-info-js_info-navigation { border-style:none; }
+ #org-info-js_console-label { font-size:10px; font-weight:bold;
+ white-space:nowrap; }
+ .org-info-js_search-highlight {background-color:#ffff00; color:#000000;
+ font-weight:bold; }
+ /*]]>*/-->
+</style>
+<link rel="stylesheet" type="text/css" href="docstyle.css" />
+<script type="text/javascript">
+<!--/*--><![CDATA[/*><!--*/
+ function CodeHighlightOn(elem, id)
+ {
+ var target = document.getElementById(id);
+ if(null != target) {
+ elem.cacheClassElem = elem.className;
+ elem.cacheClassTarget = target.className;
+ target.className = "code-highlighted";
+ elem.className = "code-highlighted";
+ }
+ }
+ function CodeHighlightOff(elem, id)
+ {
+ var target = document.getElementById(id);
+ if(elem.cacheClassElem)
+ elem.className = elem.cacheClassElem;
+ if(elem.cacheClassTarget)
+ target.className = elem.cacheClassTarget;
+ }
+/*]]>*///-->
+</script>
+
+</head>
+<body>
+<div id="content">
+
+<h1 class="title">UglifyJS &ndash; a JavaScript parser/compressor/beautifier</h1>
+
+
+<div id="table-of-contents">
+<h2>Table of Contents</h2>
+<div id="text-table-of-contents">
+<ul>
+<li><a href="#sec-1">1 UglifyJS &mdash; a JavaScript parser/compressor/beautifier </a>
+<ul>
+<li><a href="#sec-1_1">1.1 Unsafe transformations </a>
+<ul>
+<li><a href="#sec-1_1_1">1.1.1 Calls involving the global Array constructor </a></li>
+</ul>
+</li>
+<li><a href="#sec-1_2">1.2 Usage </a>
+<ul>
+<li><a href="#sec-1_2_1">1.2.1 API </a></li>
+<li><a href="#sec-1_2_2">1.2.2 Beautifier shortcoming &ndash; no more comments </a></li>
+</ul>
+</li>
+<li><a href="#sec-1_3">1.3 Compression &ndash; how good is it? </a></li>
+<li><a href="#sec-1_4">1.4 Bugs? </a></li>
+<li><a href="#sec-1_5">1.5 Links </a></li>
+<li><a href="#sec-1_6">1.6 License </a></li>
+</ul>
+</li>
+</ul>
+</div>
+</div>
+
+<div id="outline-container-1" class="outline-2">
+<h2 id="sec-1"><span class="section-number-2">1</span> UglifyJS &mdash; a JavaScript parser/compressor/beautifier </h2>
+<div class="outline-text-2" id="text-1">
+
+
+<p>
+<b>Update</b>: please read the section on <a href="#sec-1_1">unsafe transformations</a>.
+</p>
+<p>
+This package implements a general-purpose JavaScript
+parser/compressor/beautifier toolkit. It is developed on <a href="http://nodejs.org/">NodeJS</a>, but it
+should work on any JavaScript platform supporting the CommonJS module system
+(and if your platform of choice doesn't support CommonJS, you can easily
+implement it, or discard the <code>exports.*</code> lines from UglifyJS sources).
+</p>
+<p>
+The tokenizer/parser generates an abstract syntax tree from JS code. You
+can then traverse the AST to learn more about the code, or do various
+manipulations on it. This part is implemented in <a href="../lib/parse-js.js">parse-js.js</a> and it's a
+port to JavaScript of the excellent <a href="http://marijn.haverbeke.nl/parse-js/">parse-js</a> Common Lisp library from <a href="http://marijn.haverbeke.nl/">Marijn Haverbeke</a>.
+</p>
+<p>
+( See <a href="http://github.com/mishoo/cl-uglify-js">cl-uglify-js</a> if you're looking for the Common Lisp version of
+UglifyJS. )
+</p>
+<p>
+The second part of this package, implemented in <a href="../lib/process.js">process.js</a>, inspects and
+manipulates the AST generated by the parser to provide the following:
+</p>
+<ul>
+<li>
+ability to re-generate JavaScript code from the AST. Optionally
+indented&mdash;you can use this if you want to “beautify” a program that has
+been compressed, so that you can inspect the source. But you can also run
+our code generator to print out an AST without any whitespace, so you
+achieve compression as well.
+
+</li>
+<li>
+shorten variable names (usually to single characters). Our mangler will
+analyze the code and generate proper variable names, depending on scope
+and usage, and is smart enough to deal with globals defined elsewhere, or
+with <code>eval()</code> calls or <code>with{}</code> statements. In short, if <code>eval()</code> or
+<code>with{}</code> are used in some scope, then all variables in that scope and any
+variables in the parent scopes will remain unmangled, and any references
+to such variables remain unmangled as well.
+
+</li>
+<li>
+various small optimizations that may lead to faster code but certainly
+lead to smaller code. Where possible, we do the following:
+
+<ul>
+<li>
+foo["bar"] ==&gt; foo.bar
+
+</li>
+<li>
+remove block brackets <code>{}</code>
+
+</li>
+<li>
+join consecutive var declarations:
+var a = 10; var b = 20; ==&gt; var a=10,b=20;
+
+</li>
+<li>
+resolve simple constant expressions: 1 +2 * 3 ==&gt; 7. We only do the
+replacement if the result occupies less bytes; for example 1/3 would
+translate to 0.333333333333, so in this case we don't replace it.
+
+</li>
+<li>
+consecutive statements in blocks are merged into a sequence; in many
+cases, this leaves blocks with a single statement, so then we can remove
+the block brackets.
+
+</li>
+<li>
+various optimizations for IF statements:
+
+<ul>
+<li>
+if (foo) bar(); else baz(); ==&gt; foo?bar():baz();
+</li>
+<li>
+if (!foo) bar(); else baz(); ==&gt; foo?baz():bar();
+</li>
+<li>
+if (foo) bar(); ==&gt; foo&amp;&amp;bar();
+</li>
+<li>
+if (!foo) bar(); ==&gt; foo||bar();
+</li>
+<li>
+if (foo) return bar(); else return baz(); ==&gt; return foo?bar():baz();
+</li>
+<li>
+if (foo) return bar(); else something(); ==&gt; {if(foo)return bar();something()}
+
+</li>
+</ul>
+</li>
+<li>
+remove some unreachable code and warn about it (code that follows a
+<code>return</code>, <code>throw</code>, <code>break</code> or <code>continue</code> statement, except
+function/variable declarations).
+</li>
+</ul>
+</li>
+</ul>
+
+
+
+</div>
+
+<div id="outline-container-1_1" class="outline-3">
+<h3 id="sec-1_1"><span class="section-number-3">1.1</span> <span class="target">Unsafe transformations</span> </h3>
+<div class="outline-text-3" id="text-1_1">
+
+
+<p>
+UglifyJS tries its best to achieve great compression while leaving the
+semantics of the code intact. In general, if your code logic is broken by
+UglifyJS then it's a bug in UglifyJS and you should report it and I should
+fix it. :-)
+</p>
+<p>
+However, I opted to include the following potentially unsafe transformations
+as default behavior. Discussion is welcome, if you have ideas of how to
+handle this better, or any objections to these optimizations, please let me
+know.
+</p>
+
+</div>
+
+<div id="outline-container-1_1_1" class="outline-4">
+<h4 id="sec-1_1_1"><span class="section-number-4">1.1.1</span> Calls involving the global Array constructor </h4>
+<div class="outline-text-4" id="text-1_1_1">
+
+
+<p>
+The following transformations occur:
+</p>
+
+
+
+<pre class="src src-espresso"><span style="color: #afeeee; font-weight: bold;">new</span> <span style="color: #87ceeb; font-weight: bold;">Array</span>(1, 2, 3, 4) =&gt; [1,2,3,4]
+Array(a, b, c) =&gt; [a,b,c]
+<span style="color: #afeeee; font-weight: bold;">new</span> <span style="color: #87ceeb; font-weight: bold;">Array</span>(5) =&gt; Array(5)
+<span style="color: #afeeee; font-weight: bold;">new</span> <span style="color: #87ceeb; font-weight: bold;">Array</span>(a) =&gt; Array(a)
+</pre>
+
+
+
+<p>
+These are all safe if the Array name isn't redefined. JavaScript does allow
+one to globally redefine Array (and pretty much everything, in fact) but I
+personally don't see why would anyone do that.
+</p>
+<p>
+UglifyJS does handle the case where Array is redefined locally, or even
+globally but with a <code>function</code> or <code>var</code> declaration. Therefore, in the
+following cases UglifyJS <b>doesn't touch</b> calls or instantiations of Array:
+</p>
+
+
+
+<pre class="src src-espresso"><span style="color: #add8e6;">// </span><span style="color: #add8e6;">case 1. globally declared variable
+</span> <span style="color: #afeeee; font-weight: bold;">var</span> <span style="color: #40e0d0; font-weight: bold;">Array</span>;
+ <span style="color: #afeeee; font-weight: bold;">new</span> <span style="color: #87ceeb; font-weight: bold;">Array</span>(1, 2, 3);
+ Array(a, b);
+
+ <span style="color: #add8e6;">// </span><span style="color: #add8e6;">or (can be declared later)
+</span> <span style="color: #afeeee; font-weight: bold;">new</span> <span style="color: #87ceeb; font-weight: bold;">Array</span>(1, 2, 3);
+ <span style="color: #afeeee; font-weight: bold;">var</span> <span style="color: #40e0d0; font-weight: bold;">Array</span>;
+
+ <span style="color: #add8e6;">// </span><span style="color: #add8e6;">or (can be a function)
+</span> <span style="color: #afeeee; font-weight: bold;">new</span> <span style="color: #87ceeb; font-weight: bold;">Array</span>(1, 2, 3);
+ <span style="color: #afeeee; font-weight: bold;">function</span> <span style="color: #7fffd4; font-weight: bold;">Array</span>() { ... }
+
+<span style="color: #add8e6;">// </span><span style="color: #add8e6;">case 2. declared in a function
+</span> (<span style="color: #afeeee; font-weight: bold;">function</span>(){
+ a = <span style="color: #afeeee; font-weight: bold;">new</span> <span style="color: #87ceeb; font-weight: bold;">Array</span>(1, 2, 3);
+ b = Array(5, 6);
+ <span style="color: #afeeee; font-weight: bold;">var</span> <span style="color: #40e0d0; font-weight: bold;">Array</span>;
+ })();
+
+ <span style="color: #add8e6;">// </span><span style="color: #add8e6;">or
+</span> (<span style="color: #afeeee; font-weight: bold;">function</span>(<span style="color: #40e0d0; font-weight: bold;">Array</span>){
+ <span style="color: #afeeee; font-weight: bold;">return</span> Array(5, 6, 7);
+ })();
+
+ <span style="color: #add8e6;">// </span><span style="color: #add8e6;">or
+</span> (<span style="color: #afeeee; font-weight: bold;">function</span>(){
+ <span style="color: #afeeee; font-weight: bold;">return</span> <span style="color: #afeeee; font-weight: bold;">new</span> <span style="color: #87ceeb; font-weight: bold;">Array</span>(1, 2, 3, 4);
+ <span style="color: #afeeee; font-weight: bold;">function</span> <span style="color: #7fffd4; font-weight: bold;">Array</span>() { ... }
+ })();
+
+ <span style="color: #add8e6;">// </span><span style="color: #add8e6;">etc.
+</span></pre>
+
+
+
+</div>
+</div>
+
+</div>
+
+<div id="outline-container-1_2" class="outline-3">
+<h3 id="sec-1_2"><span class="section-number-3">1.2</span> Usage </h3>
+<div class="outline-text-3" id="text-1_2">
+
+
+<p>
+There is a helper script now &mdash; <code>bin/uglifyjs</code> &mdash; that uses the library to
+compress a script using the maximum compression settings. Synopsis:
+</p>
+
+
+
+<pre class="src src-sh">uglifyjs [ options... ] [ filename ]
+</pre>
+
+
+
+<p>
+<code>filename</code> should be the last argument and should name the file from which
+to read the JavaScript code. If you don't specify it, it will read code
+from STDIN.
+</p>
+<p>
+Supported options:
+</p>
+<ul>
+<li>
+<code>-b</code> or <code>--beautify</code> &mdash; output indented code; when passed, additional
+options control the beautifier:
+
+<ul>
+<li>
+<code>-i N</code> or <code>--indent N</code> &mdash; indentation level (number of spaces)
+
+</li>
+<li>
+<code>-q</code> or <code>--quote-keys</code> &mdash; quote keys in literal objects (by default,
+only keys that cannot be identifier names will be quotes).
+
+</li>
+</ul>
+</li>
+<li>
+<code>--ascii</code> &mdash; pass this argument to encode non-ASCII characters as
+<code>\uXXXX</code> sequences. By default UglifyJS won't bother to do it and will
+output Unicode characters instead. (the output is always encoded in UTF8,
+but if you pass this option you'll only get ASCII).
+
+</li>
+<li>
+<code>-nm</code> or <code>--no-mangle</code> &mdash; don't mangle variable names
+
+</li>
+<li>
+<code>-ns</code> or <code>--no-squeeze</code> &mdash; don't call <code>ast_squeeze()</code> (which does various
+optimizations that result in smaller, less readable code).
+
+</li>
+<li>
+<code>-mt</code> or <code>--mangle-toplevel</code> &mdash; mangle names in the toplevel scope too
+(by default we don't do this).
+
+</li>
+<li>
+<code>--no-seqs</code> &mdash; when <code>ast_squeeze()</code> is called (thus, unless you pass
+<code>--no-squeeze</code>) it will reduce consecutive statements in blocks into a
+sequence. For example, "a = 10; b = 20; foo();" will be written as
+"a=10,b=20,foo();". In various occasions, this allows us to discard the
+block brackets (since the block becomes a single statement). This is ON
+by default because it seems safe and saves a few hundred bytes on some
+libs that I tested it on, but pass <code>--no-seqs</code> to disable it.
+
+</li>
+<li>
+<code>--no-dead-code</code> &mdash; by default, UglifyJS will remove code that is
+obviously unreachable (code that follows a <code>return</code>, <code>throw</code>, <code>break</code> or
+<code>continue</code> statement and is not a function/variable declaration). Pass
+this option to disable this optimization.
+
+</li>
+<li>
+<code>-nc</code> or <code>--no-copyright</code> &mdash; by default, <code>uglifyjs</code> will keep the initial
+comment tokens in the generated code (assumed to be copyright information
+etc.). If you pass this it will discard it.
+
+</li>
+<li>
+<code>-o filename</code> or <code>--output filename</code> &mdash; put the result in <code>filename</code>. If
+this isn't given, the result goes to standard output (or see next one).
+
+</li>
+<li>
+<code>--overwrite</code> &mdash; if the code is read from a file (not from STDIN) and you
+pass <code>--overwrite</code> then the output will be written in the same file.
+
+</li>
+<li>
+<code>--ast</code> &mdash; pass this if you want to get the Abstract Syntax Tree instead
+of JavaScript as output. Useful for debugging or learning more about the
+internals.
+
+</li>
+<li>
+<code>-v</code> or <code>--verbose</code> &mdash; output some notes on STDERR (for now just how long
+each operation takes).
+
+</li>
+<li>
+<code>--extra</code> &mdash; enable additional optimizations that have not yet been
+extensively tested. These might, or might not, break your code. If you
+find a bug using this option, please report a test case.
+
+</li>
+<li>
+<code>--unsafe</code> &mdash; enable other additional optimizations that are known to be
+unsafe in some contrived situations, but could still be generally useful.
+For now only this:
+
+<ul>
+<li>
+foo.toString() ==&gt; foo+""
+
+</li>
+</ul>
+</li>
+<li>
+<code>--max-line-len</code> (default 32K characters) &mdash; add a newline after around
+32K characters. I've seen both FF and Chrome croak when all the code was
+on a single line of around 670K. Pass &ndash;max-line-len 0 to disable this
+safety feature.
+
+</li>
+<li>
+<code>--reserved-names</code> &mdash; some libraries rely on certain names to be used, as
+pointed out in issue #92 and #81, so this option allow you to exclude such
+names from the mangler. For example, to keep names <code>require</code> and <code>$super</code>
+intact you'd specify &ndash;reserved-names "require,$super".
+</li>
+</ul>
+
+
+
+</div>
+
+<div id="outline-container-1_2_1" class="outline-4">
+<h4 id="sec-1_2_1"><span class="section-number-4">1.2.1</span> API </h4>
+<div class="outline-text-4" id="text-1_2_1">
+
+
+<p>
+Symlink the <b>lib</b> directory as <b>~/.node_libraries/uglifyjs</b>, so that the
+<b>require</b> calls in the following sample will work:
+</p>
+
+
+
+<pre class="src src-espresso"><span style="color: #afeeee; font-weight: bold;">var</span> <span style="color: #40e0d0; font-weight: bold;">jsp</span> = require(<span style="color: #87cefa;">"uglifyjs/parse-js"</span>);
+<span style="color: #afeeee; font-weight: bold;">var</span> <span style="color: #40e0d0; font-weight: bold;">pro</span> = require(<span style="color: #87cefa;">"uglifyjs/process"</span>);
+
+<span style="color: #afeeee; font-weight: bold;">var</span> <span style="color: #40e0d0; font-weight: bold;">orig_code</span> = <span style="color: #87cefa;">"... JS code here"</span>;
+<span style="color: #afeeee; font-weight: bold;">var</span> <span style="color: #40e0d0; font-weight: bold;">ast</span> = jsp.parse(orig_code); <span style="color: #add8e6;">// </span><span style="color: #add8e6;">parse code and get the initial AST
+</span>ast = pro.ast_mangle(ast); <span style="color: #add8e6;">// </span><span style="color: #add8e6;">get a new AST with mangled names
+</span>ast = pro.ast_squeeze(ast); <span style="color: #add8e6;">// </span><span style="color: #add8e6;">get an AST with compression optimizations
+</span><span style="color: #afeeee; font-weight: bold;">var</span> <span style="color: #40e0d0; font-weight: bold;">final_code</span> = pro.gen_code(ast); <span style="color: #add8e6;">// </span><span style="color: #add8e6;">compressed code here
+</span></pre>
+
+
+
+<p>
+The above performs the full compression that is possible right now. As you
+can see, there are a sequence of steps which you can apply. For example if
+you want compressed output but for some reason you don't want to mangle
+variable names, you would simply skip the line that calls
+<code>pro.ast_mangle(ast)</code>.
+</p>
+<p>
+Some of these functions take optional arguments. Here's a description:
+</p>
+<ul>
+<li>
+<code>jsp.parse(code, strict_semicolons)</code> &ndash; parses JS code and returns an AST.
+<code>strict_semicolons</code> is optional and defaults to <code>false</code>. If you pass
+<code>true</code> then the parser will throw an error when it expects a semicolon and
+it doesn't find it. For most JS code you don't want that, but it's useful
+if you want to strictly sanitize your code.
+
+</li>
+<li>
+<code>pro.ast_mangle(ast, options)</code> &ndash; generates a new AST containing mangled
+(compressed) variable and function names. It supports the following
+options:
+
+<ul>
+<li>
+<code>toplevel</code> &ndash; mangle toplevel names (by default we don't touch them).
+</li>
+<li>
+<code>except</code> &ndash; an array of names to exclude from compression.
+
+</li>
+</ul>
+</li>
+<li>
+<code>pro.ast_squeeze(ast, options)</code> &ndash; employs further optimizations designed
+to reduce the size of the code that <code>gen_code</code> would generate from the
+AST. Returns a new AST. <code>options</code> can be a hash; the supported options
+are:
+
+<ul>
+<li>
+<code>make_seqs</code> (default true) which will cause consecutive statements in a
+block to be merged using the "sequence" (comma) operator
+
+</li>
+<li>
+<code>dead_code</code> (default true) which will remove unreachable code.
+
+</li>
+</ul>
+</li>
+<li>
+<code>pro.gen_code(ast, options)</code> &ndash; generates JS code from the AST. By
+default it's minified, but using the <code>options</code> argument you can get nicely
+formatted output. <code>options</code> is, well, optional :-) and if you pass it it
+must be an object and supports the following properties (below you can see
+the default values):
+
+<ul>
+<li>
+<code>beautify: false</code> &ndash; pass <code>true</code> if you want indented output
+</li>
+<li>
+<code>indent_start: 0</code> (only applies when <code>beautify</code> is <code>true</code>) &ndash; initial
+indentation in spaces
+</li>
+<li>
+<code>indent_level: 4</code> (only applies when <code>beautify</code> is <code>true</code>) --
+indentation level, in spaces (pass an even number)
+</li>
+<li>
+<code>quote_keys: false</code> &ndash; if you pass <code>true</code> it will quote all keys in
+literal objects
+</li>
+<li>
+<code>space_colon: false</code> (only applies when <code>beautify</code> is <code>true</code>) &ndash; wether
+to put a space before the colon in object literals
+</li>
+<li>
+<code>ascii_only: false</code> &ndash; pass <code>true</code> if you want to encode non-ASCII
+characters as <code>\uXXXX</code>.
+</li>
+</ul>
+</li>
+</ul>
+
+
+</div>
+
+</div>
+
+<div id="outline-container-1_2_2" class="outline-4">
+<h4 id="sec-1_2_2"><span class="section-number-4">1.2.2</span> Beautifier shortcoming &ndash; no more comments </h4>
+<div class="outline-text-4" id="text-1_2_2">
+
+
+<p>
+The beautifier can be used as a general purpose indentation tool. It's
+useful when you want to make a minified file readable. One limitation,
+though, is that it discards all comments, so you don't really want to use it
+to reformat your code, unless you don't have, or don't care about, comments.
+</p>
+<p>
+In fact it's not the beautifier who discards comments &mdash; they are dumped at
+the parsing stage, when we build the initial AST. Comments don't really
+make sense in the AST, and while we could add nodes for them, it would be
+inconvenient because we'd have to add special rules to ignore them at all
+the processing stages.
+</p>
+</div>
+</div>
+
+</div>
+
+<div id="outline-container-1_3" class="outline-3">
+<h3 id="sec-1_3"><span class="section-number-3">1.3</span> Compression &ndash; how good is it? </h3>
+<div class="outline-text-3" id="text-1_3">
+
+
+<p>
+(XXX: this is somewhat outdated. On the jQuery source code we beat Closure
+by 168 bytes (560 after gzip) and by many seconds.)
+</p>
+<p>
+There are a few popular JS minifiers nowadays &ndash; the two most well known
+being the GoogleClosure (GCL) compiler and the YUI compressor. For some
+reason they are both written in Java. I didn't really hope to beat any of
+them, but finally I did &ndash; UglifyJS compresses better than the YUI
+compressor, and safer than GoogleClosure.
+</p>
+<p>
+I tested it on two big libraries. <a href="http://www.dynarchlib.com/">DynarchLIB</a> is my own, and it's big enough
+to contain probably all the JavaScript tricks known to mankind. <a href="http://jquery.com/">jQuery</a> is
+definitely the most popular JavaScript library (to some people, it's a
+synonym to JavaScript itself).
+</p>
+<p>
+I cannot swear that there are no bugs in the generated codes, but they
+appear to work fine.
+</p>
+<p>
+Compression results:
+</p>
+<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
+<caption></caption>
+<colgroup><col align="left" /><col align="right" /><col align="right" /><col align="left" /><col align="left" />
+</colgroup>
+<thead>
+<tr><th scope="col">Library</th><th scope="col">Orig. size</th><th scope="col">UglifyJS</th><th scope="col">YUI</th><th scope="col">GCL</th></tr>
+</thead>
+<tbody>
+<tr><td>DynarchLIB</td><td>636896</td><td>241441</td><td>246452 (+5011)</td><td>240439 (-1002) (buggy)</td></tr>
+<tr><td>jQuery</td><td>163855</td><td>72006</td><td>79702 (+7696)</td><td>71858 (-148)</td></tr>
+</tbody>
+</table>
+
+
+<p>
+UglifyJS is the fastest to run. On my laptop UglifyJS takes 1.35s for
+DynarchLIB, while YUI takes 2.7s and GCL takes 6.5s.
+</p>
+<p>
+GoogleClosure does a lot of smart ass optimizations. I had to strive really
+hard to get close to it. It should be possible to even beat it, but then
+again, GCL has a gazillion lines of code and runs terribly slow, so I'm not
+sure it worths spending the effort to save a few bytes. Also, GCL doesn't
+cope with <code>eval()</code> or <code>with{}</code> &ndash; it just dumps a warning and proceeds to
+mangle names anyway; my DynarchLIB compiled with it is buggy because of
+this.
+</p>
+<p>
+UglifyJS consists of ~1100 lines of code for the tokenizer/parser, and ~1100
+lines for the compressor and code generator. That should make it very
+maintainable and easily extensible, so I would say it has a good place in
+this field and it's bound to become the de-facto standard JS minifier. And
+I shall rule the world. :-) Use it, and <b>spread the word</b>!
+</p>
+</div>
+
+</div>
+
+<div id="outline-container-1_4" class="outline-3">
+<h3 id="sec-1_4"><span class="section-number-3">1.4</span> Bugs? </h3>
+<div class="outline-text-3" id="text-1_4">
+
+
+<p>
+Unfortunately, for the time being there is no automated test suite. But I
+ran the compressor manually on non-trivial code, and then I tested that the
+generated code works as expected. A few hundred times.
+</p>
+<p>
+DynarchLIB was started in times when there was no good JS minifier.
+Therefore I was quite religious about trying to write short code manually,
+and as such DL contains a lot of syntactic hacks<sup><a class="footref" name="fnr.1" href="#fn.1">1</a></sup> such as “foo == bar ? a
+= 10 : b = 20”, though the more readable version would clearly be to use
+“if/else”.
+</p>
+<p>
+Since the parser/compressor runs fine on DL and jQuery, I'm quite confident
+that it's solid enough for production use. If you can identify any bugs,
+I'd love to hear about them (<a href="http://groups.google.com/group/uglifyjs">use the Google Group</a> or email me directly).
+</p>
+</div>
+
+</div>
+
+<div id="outline-container-1_5" class="outline-3">
+<h3 id="sec-1_5"><span class="section-number-3">1.5</span> Links </h3>
+<div class="outline-text-3" id="text-1_5">
+
+
+<ul>
+<li>
+Project at GitHub: <a href="http://github.com/mishoo/UglifyJS">http://github.com/mishoo/UglifyJS</a>
+</li>
+<li>
+Google Group: <a href="http://groups.google.com/group/uglifyjs">http://groups.google.com/group/uglifyjs</a>
+</li>
+<li>
+Common Lisp JS parser: <a href="http://marijn.haverbeke.nl/parse-js/">http://marijn.haverbeke.nl/parse-js/</a>
+</li>
+<li>
+JS-to-Lisp compiler: <a href="http://github.com/marijnh/js">http://github.com/marijnh/js</a>
+</li>
+<li>
+Common Lisp JS uglifier: <a href="http://github.com/mishoo/cl-uglify-js">http://github.com/mishoo/cl-uglify-js</a>
+</li>
+</ul>
+
+
+</div>
+
+</div>
+
+<div id="outline-container-1_6" class="outline-3">
+<h3 id="sec-1_6"><span class="section-number-3">1.6</span> License </h3>
+<div class="outline-text-3" id="text-1_6">
+
+
+<p>
+UglifyJS is released under the BSD license:
+</p>
+
+
+
+<pre class="example">Copyright 2010 (c) Mihai Bazon &lt;mihai.bazon@gmail.com&gt;
+Based on parse-js (http://marijn.haverbeke.nl/parse-js/).
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+ * Redistributions of source code must retain the above
+ copyright notice, this list of conditions and the following
+ disclaimer.
+
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials
+ provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “AS IS” AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+</pre>
+
+
+
+
+</div>
+</div>
+</div>
+<div id="footnotes">
+<h2 class="footnotes">Footnotes: </h2>
+<div id="text-footnotes">
+<p class="footnote"><sup><a class="footnum" name="fn.1" href="#fnr.1">1</a></sup> I even reported a few bugs and suggested some fixes in the original
+<a href="http://marijn.haverbeke.nl/parse-js/">parse-js</a> library, and Marijn pushed fixes literally in minutes.
+</p>
+</div>
+</div>
+<div id="postamble">
+<p class="author"> Author: Mihai Bazon
+</p>
+<p class="date"> Date: 2011-02-28 22:35:00 EET</p>
+<p class="creator">HTML generated by org-mode 7.01trans in emacs 23</p>
+</div>
+</div>
+</body>
+</html>
View
408 lib/uglifyjs/README.org
@@ -0,0 +1,408 @@
+#+TITLE: UglifyJS -- a JavaScript parser/compressor/beautifier
+#+KEYWORDS: javascript, js, parser, compiler, compressor, mangle, minify, minifier
+#+DESCRIPTION: a JavaScript parser/compressor/beautifier in JavaScript
+#+STYLE: <link rel="stylesheet" type="text/css" href="docstyle.css" />
+#+AUTHOR: Mihai Bazon
+#+EMAIL: mihai.bazon@gmail.com
+
+* UglifyJS --- a JavaScript parser/compressor/beautifier
+
+*Update*: please read the section on [[unsafe transformations]].
+
+This package implements a general-purpose JavaScript
+parser/compressor/beautifier toolkit. It is developed on [[http://nodejs.org/][NodeJS]], but it
+should work on any JavaScript platform supporting the CommonJS module system
+(and if your platform of choice doesn't support CommonJS, you can easily
+implement it, or discard the =exports.*= lines from UglifyJS sources).
+
+The tokenizer/parser generates an abstract syntax tree from JS code. You
+can then traverse the AST to learn more about the code, or do various
+manipulations on it. This part is implemented in [[../lib/parse-js.js][parse-js.js]] and it's a
+port to JavaScript of the excellent [[http://marijn.haverbeke.nl/parse-js/][parse-js]] Common Lisp library from [[http://marijn.haverbeke.nl/][Marijn
+Haverbeke]].
+
+( See [[http://github.com/mishoo/cl-uglify-js][cl-uglify-js]] if you're looking for the Common Lisp version of
+UglifyJS. )
+
+The second part of this package, implemented in [[../lib/process.js][process.js]], inspects and
+manipulates the AST generated by the parser to provide the following:
+
+- ability to re-generate JavaScript code from the AST. Optionally
+ indented---you can use this if you want to “beautify” a program that has
+ been compressed, so that you can inspect the source. But you can also run
+ our code generator to print out an AST without any whitespace, so you
+ achieve compression as well.
+
+- shorten variable names (usually to single characters). Our mangler will
+ analyze the code and generate proper variable names, depending on scope
+ and usage, and is smart enough to deal with globals defined elsewhere, or
+ with =eval()= calls or =with{}= statements. In short, if =eval()= or
+ =with{}= are used in some scope, then all variables in that scope and any
+ variables in the parent scopes will remain unmangled, and any references
+ to such variables remain unmangled as well.
+
+- various small optimizations that may lead to faster code but certainly
+ lead to smaller code. Where possible, we do the following:
+
+ - foo["bar"] ==> foo.bar
+
+ - remove block brackets ={}=
+
+ - join consecutive var declarations:
+ var a = 10; var b = 20; ==> var a=10,b=20;
+
+ - resolve simple constant expressions: 1 +2 * 3 ==> 7. We only do the
+ replacement if the result occupies less bytes; for example 1/3 would
+ translate to 0.333333333333, so in this case we don't replace it.
+
+ - consecutive statements in blocks are merged into a sequence; in many
+ cases, this leaves blocks with a single statement, so then we can remove
+ the block brackets.
+
+ - various optimizations for IF statements:
+
+ - if (foo) bar(); else baz(); ==> foo?bar():baz();
+ - if (!foo) bar(); else baz(); ==> foo?baz():bar();
+ - if (foo) bar(); ==> foo&&bar();
+ - if (!foo) bar(); ==> foo||bar();
+ - if (foo) return bar(); else return baz(); ==> return foo?bar():baz();
+ - if (foo) return bar(); else something(); ==> {if(foo)return bar();something()}
+
+ - remove some unreachable code and warn about it (code that follows a
+ =return=, =throw=, =break= or =continue= statement, except
+ function/variable declarations).
+
+** <<Unsafe transformations>>
+
+UglifyJS tries its best to achieve great compression while leaving the
+semantics of the code intact. In general, if your code logic is broken by
+UglifyJS then it's a bug in UglifyJS and you should report it and I should
+fix it. :-)
+
+However, I opted to include the following potentially unsafe transformations
+as default behavior. Discussion is welcome, if you have ideas of how to
+handle this better, or any objections to these optimizations, please let me
+know.
+
+*** Calls involving the global Array constructor
+
+The following transformations occur:
+
+#+BEGIN_SRC espresso
+new Array(1, 2, 3, 4) => [1,2,3,4]
+Array(a, b, c) => [a,b,c]
+new Array(5) => Array(5)
+new Array(a) => Array(a)
+#+END_SRC
+
+These are all safe if the Array name isn't redefined. JavaScript does allow
+one to globally redefine Array (and pretty much everything, in fact) but I
+personally don't see why would anyone do that.
+
+UglifyJS does handle the case where Array is redefined locally, or even
+globally but with a =function= or =var= declaration. Therefore, in the
+following cases UglifyJS *doesn't touch* calls or instantiations of Array:
+
+#+BEGIN_SRC espresso
+// case 1. globally declared variable
+ var Array;
+ new Array(1, 2, 3);
+ Array(a, b);
+
+ // or (can be declared later)
+ new Array(1, 2, 3);
+ var Array;
+
+ // or (can be a function)
+ new Array(1, 2, 3);
+ function Array() { ... }
+
+// case 2. declared in a function
+ (function(){
+ a = new Array(1, 2, 3);
+ b = Array(5, 6);
+ var Array;
+ })();
+
+ // or
+ (function(Array){
+ return Array(5, 6, 7);
+ })();
+
+ // or
+ (function(){
+ return new Array(1, 2, 3, 4);
+ function Array() { ... }
+ })();
+
+ // etc.
+#+END_SRC
+
+** Usage
+
+There is a helper script now --- =bin/uglifyjs= --- that uses the library to
+compress a script using the maximum compression settings. Synopsis:
+
+#+BEGIN_SRC sh
+uglifyjs [ options... ] [ filename ]
+#+END_SRC
+
+=filename= should be the last argument and should name the file from which
+to read the JavaScript code. If you don't specify it, it will read code
+from STDIN.
+
+Supported options:
+
+- =-b= or =--beautify= --- output indented code; when passed, additional
+ options control the beautifier:
+
+ - =-i N= or =--indent N= --- indentation level (number of spaces)
+
+ - =-q= or =--quote-keys= --- quote keys in literal objects (by default,
+ only keys that cannot be identifier names will be quotes).
+
+- =--ascii= --- pass this argument to encode non-ASCII characters as
+ =\uXXXX= sequences. By default UglifyJS won't bother to do it and will
+ output Unicode characters instead. (the output is always encoded in UTF8,
+ but if you pass this option you'll only get ASCII).
+
+- =-nm= or =--no-mangle= --- don't mangle variable names
+
+- =-ns= or =--no-squeeze= --- don't call =ast_squeeze()= (which does various
+ optimizations that result in smaller, less readable code).
+
+- =-mt= or =--mangle-toplevel= --- mangle names in the toplevel scope too
+ (by default we don't do this).
+
+- =--no-seqs= --- when =ast_squeeze()= is called (thus, unless you pass
+ =--no-squeeze=) it will reduce consecutive statements in blocks into a
+ sequence. For example, "a = 10; b = 20; foo();" will be written as
+ "a=10,b=20,foo();". In various occasions, this allows us to discard the
+ block brackets (since the block becomes a single statement). This is ON
+ by default because it seems safe and saves a few hundred bytes on some
+ libs that I tested it on, but pass =--no-seqs= to disable it.
+
+- =--no-dead-code= --- by default, UglifyJS will remove code that is
+ obviously unreachable (code that follows a =return=, =throw=, =break= or
+ =continue= statement and is not a function/variable declaration). Pass
+ this option to disable this optimization.
+
+- =-nc= or =--no-copyright= --- by default, =uglifyjs= will keep the initial
+ comment tokens in the generated code (assumed to be copyright information
+ etc.). If you pass this it will discard it.
+
+- =-o filename= or =--output filename= --- put the result in =filename=. If
+ this isn't given, the result goes to standard output (or see next one).
+
+- =--overwrite= --- if the code is read from a file (not from STDIN) and you
+ pass =--overwrite= then the output will be written in the same file.
+
+- =--ast= --- pass this if you want to get the Abstract Syntax Tree instead
+ of JavaScript as output. Useful for debugging or learning more about the
+ internals.
+
+- =-v= or =--verbose= --- output some notes on STDERR (for now just how long
+ each operation takes).
+
+- =--extra= --- enable additional optimizations that have not yet been
+ extensively tested. These might, or might not, break your code. If you
+ find a bug using this option, please report a test case.
+
+- =--unsafe= --- enable other additional optimizations that are known to be
+ unsafe in some contrived situations, but could still be generally useful.
+ For now only this:
+
+ - foo.toString() ==> foo+""
+
+- =--max-line-len= (default 32K characters) --- add a newline after around
+ 32K characters. I've seen both FF and Chrome croak when all the code was
+ on a single line of around 670K. Pass --max-line-len 0 to disable this
+ safety feature.
+
+- =--reserved-names= --- some libraries rely on certain names to be used, as
+ pointed out in issue #92 and #81, so this option allow you to exclude such
+ names from the mangler. For example, to keep names =require= and =$super=
+ intact you'd specify --reserved-names "require,$super".
+
+*** API
+
+Symlink the *lib* directory as *~/.node\_libraries/uglifyjs*, so that the
+*require* calls in the following sample will work:
+
+#+BEGIN_SRC espresso
+var jsp = require("uglifyjs/parse-js");
+var pro = require("uglifyjs/process");
+
+var orig_code = "... JS code here";
+var ast = jsp.parse(orig_code); // parse code and get the initial AST
+ast = pro.ast_mangle(ast); // get a new AST with mangled names
+ast = pro.ast_squeeze(ast); // get an AST with compression optimizations
+var final_code = pro.gen_code(ast); // compressed code here
+#+END_SRC
+
+The above performs the full compression that is possible right now. As you
+can see, there are a sequence of steps which you can apply. For example if
+you want compressed output but for some reason you don't want to mangle
+variable names, you would simply skip the line that calls
+=pro.ast_mangle(ast)=.
+
+Some of these functions take optional arguments. Here's a description:
+
+- =jsp.parse(code, strict_semicolons)= -- parses JS code and returns an AST.
+ =strict_semicolons= is optional and defaults to =false=. If you pass
+ =true= then the parser will throw an error when it expects a semicolon and
+ it doesn't find it. For most JS code you don't want that, but it's useful
+ if you want to strictly sanitize your code.
+
+- =pro.ast_mangle(ast, options)= -- generates a new AST containing mangled
+ (compressed) variable and function names. It supports the following
+ options:
+
+ - =toplevel= -- mangle toplevel names (by default we don't touch them).
+ - =except= -- an array of names to exclude from compression.
+
+- =pro.ast_squeeze(ast, options)= -- employs further optimizations designed
+ to reduce the size of the code that =gen_code= would generate from the
+ AST. Returns a new AST. =options= can be a hash; the supported options
+ are:
+
+ - =make_seqs= (default true) which will cause consecutive statements in a
+ block to be merged using the "sequence" (comma) operator
+
+ - =dead_code= (default true) which will remove unreachable code.
+
+- =pro.gen_code(ast, options)= -- generates JS code from the AST. By
+ default it's minified, but using the =options= argument you can get nicely
+ formatted output. =options= is, well, optional :-) and if you pass it it
+ must be an object and supports the following properties (below you can see
+ the default values):
+
+ - =beautify: false= -- pass =true= if you want indented output
+ - =indent_start: 0= (only applies when =beautify= is =true=) -- initial
+ indentation in spaces
+ - =indent_level: 4= (only applies when =beautify= is =true=) --
+ indentation level, in spaces (pass an even number)
+ - =quote_keys: false= -- if you pass =true= it will quote all keys in
+ literal objects
+ - =space_colon: false= (only applies when =beautify= is =true=) -- wether
+ to put a space before the colon in object literals
+ - =ascii_only: false= -- pass =true= if you want to encode non-ASCII
+ characters as =\uXXXX=.
+
+*** Beautifier shortcoming -- no more comments
+
+The beautifier can be used as a general purpose indentation tool. It's
+useful when you want to make a minified file readable. One limitation,
+though, is that it discards all comments, so you don't really want to use it
+to reformat your code, unless you don't have, or don't care about, comments.
+
+In fact it's not the beautifier who discards comments --- they are dumped at
+the parsing stage, when we build the initial AST. Comments don't really
+make sense in the AST, and while we could add nodes for them, it would be
+inconvenient because we'd have to add special rules to ignore them at all
+the processing stages.
+
+** Compression -- how good is it?
+
+(XXX: this is somewhat outdated. On the jQuery source code we beat Closure
+by 168 bytes (560 after gzip) and by many seconds.)
+
+There are a few popular JS minifiers nowadays -- the two most well known
+being the GoogleClosure (GCL) compiler and the YUI compressor. For some
+reason they are both written in Java. I didn't really hope to beat any of
+them, but finally I did -- UglifyJS compresses better than the YUI
+compressor, and safer than GoogleClosure.
+
+I tested it on two big libraries. [[http://www.dynarchlib.com/][DynarchLIB]] is my own, and it's big enough
+to contain probably all the JavaScript tricks known to mankind. [[http://jquery.com/][jQuery]] is
+definitely the most popular JavaScript library (to some people, it's a
+synonym to JavaScript itself).
+
+I cannot swear that there are no bugs in the generated codes, but they
+appear to work fine.
+
+Compression results:
+
+| Library | Orig. size | UglifyJS | YUI | GCL |
+|------------+------------+----------+----------------+------------------------|
+| DynarchLIB | 636896 | 241441 | 246452 (+5011) | 240439 (-1002) (buggy) |
+| jQuery | 163855 | 72006 | 79702 (+7696) | 71858 (-148) |
+
+UglifyJS is the fastest to run. On my laptop UglifyJS takes 1.35s for
+DynarchLIB, while YUI takes 2.7s and GCL takes 6.5s.
+
+GoogleClosure does a lot of smart ass optimizations. I had to strive really
+hard to get close to it. It should be possible to even beat it, but then
+again, GCL has a gazillion lines of code and runs terribly slow, so I'm not
+sure it worths spending the effort to save a few bytes. Also, GCL doesn't
+cope with =eval()= or =with{}= -- it just dumps a warning and proceeds to
+mangle names anyway; my DynarchLIB compiled with it is buggy because of
+this.
+
+UglifyJS consists of ~1100 lines of code for the tokenizer/parser, and ~1100
+lines for the compressor and code generator. That should make it very
+maintainable and easily extensible, so I would say it has a good place in
+this field and it's bound to become the de-facto standard JS minifier. And
+I shall rule the world. :-) Use it, and *spread the word*!
+
+** Bugs?
+
+Unfortunately, for the time being there is no automated test suite. But I
+ran the compressor manually on non-trivial code, and then I tested that the
+generated code works as expected. A few hundred times.
+
+DynarchLIB was started in times when there was no good JS minifier.
+Therefore I was quite religious about trying to write short code manually,
+and as such DL contains a lot of syntactic hacks[1] such as “foo == bar ? a
+= 10 : b = 20”, though the more readable version would clearly be to use
+“if/else”.
+
+Since the parser/compressor runs fine on DL and jQuery, I'm quite confident
+that it's solid enough for production use. If you can identify any bugs,
+I'd love to hear about them ([[http://groups.google.com/group/uglifyjs][use the Google Group]] or email me directly).
+
+[1] I even reported a few bugs and suggested some fixes in the original
+ [[http://marijn.haverbeke.nl/parse-js/][parse-js]] library, and Marijn pushed fixes literally in minutes.
+
+** Links
+
+- Project at GitHub: [[http://github.com/mishoo/UglifyJS][http://github.com/mishoo/UglifyJS]]
+- Google Group: [[http://groups.google.com/group/uglifyjs][http://groups.google.com/group/uglifyjs]]
+- Common Lisp JS parser: [[http://marijn.haverbeke.nl/parse-js/][http://marijn.haverbeke.nl/parse-js/]]
+- JS-to-Lisp compiler: [[http://github.com/marijnh/js][http://github.com/marijnh/js]]
+- Common Lisp JS uglifier: [[http://github.com/mishoo/cl-uglify-js][http://github.com/mishoo/cl-uglify-js]]
+
+** License
+
+UglifyJS is released under the BSD license:
+
+#+BEGIN_EXAMPLE
+Copyright 2010 (c) Mihai Bazon <mihai.bazon@gmail.com>
+Based on parse-js (http://marijn.haverbeke.nl/parse-js/).
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+ * Redistributions of source code must retain the above
+ copyright notice, this list of conditions and the following
+ disclaimer.
+
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials
+ provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “AS IS” AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+#+END_EXAMPLE
View
212 lib/uglifyjs/bin/uglifyjs
@@ -0,0 +1,212 @@
+#! /usr/bin/env node
+// -*- js2 -*-
+
+global.sys = require(/^v0\.[012]/.test(process.version) ? "sys" : "util");
+var fs = require("fs");
+var uglify = require("../../UglifyJS"), // symlink ~/.node_libraries/uglify-js.js to ../uglify-js.js
+ jsp = uglify.parser,
+ pro = uglify.uglify;
+
+var options = {
+ ast: false,
+ mangle: true,
+ mangle_toplevel: false,
+ squeeze: true,
+ make_seqs: true,
+ dead_code: true,
+ verbose: false,
+ show_copyright: true,