浏览代码

Merge remote-tracking branch 'remotes/mrdoob/dev' into dev

alteredq 13 年之前
父节点
当前提交
aaf3fd8b87
共有 100 个文件被更改,包括 337 次插入8012 次删除
  1. 2 1
      .gitignore
  2. 11 10
      build/Three.js
  3. 109 108
      build/custom/ThreeCanvas.js
  4. 1 1
      build/custom/ThreeExtras.js
  5. 79 78
      build/custom/ThreeWebGL.js
  6. 7 2
      docs/api/core/Vector3.html
  7. 17 9
      examples/js/SimplexNoise.js
  8. 1 1
      examples/js/loaders/VTKLoader.js
  9. 63 76
      gui/js/UI.js
  10. 2 2
      gui/js/ui/Sidebar.Properties.Geometry.js
  11. 18 3
      gui/js/ui/Sidebar.Properties.Material.js
  12. 9 9
      gui/js/ui/Sidebar.Properties.Object3D.js
  13. 3 0
      gui/js/ui/Viewport.js
  14. 14 4
      src/core/Ray.js
  15. 1 1
      src/extras/ImageUtils.js
  16. 0 1
      utils/node_modules/argsparser/.gitignore
  17. 0 4
      utils/node_modules/argsparser/Makefile
  18. 0 1
      utils/node_modules/argsparser/index.js
  19. 0 41
      utils/node_modules/argsparser/lib/argsparser.js
  20. 0 19
      utils/node_modules/argsparser/package.json
  21. 0 34
      utils/node_modules/argsparser/readme.md
  22. 0 39
      utils/node_modules/argsparser/test/test.js
  23. 0 4
      utils/node_modules/uglify-js/.npmignore
  24. 0 981
      utils/node_modules/uglify-js/README.html
  25. 0 578
      utils/node_modules/uglify-js/README.org
  26. 0 332
      utils/node_modules/uglify-js/bin/uglifyjs
  27. 0 75
      utils/node_modules/uglify-js/docstyle.css
  28. 0 2599
      utils/node_modules/uglify-js/lib/consolidator.js
  29. 0 75
      utils/node_modules/uglify-js/lib/object-ast.js
  30. 0 203
      utils/node_modules/uglify-js/lib/parse-js.js
  31. 0 2011
      utils/node_modules/uglify-js/lib/process.js
  32. 0 73
      utils/node_modules/uglify-js/lib/squeeze-more.js
  33. 0 24
      utils/node_modules/uglify-js/package.json
  34. 0 24
      utils/node_modules/uglify-js/package.json~
  35. 0 28
      utils/node_modules/uglify-js/test/beautify.js
  36. 0 403
      utils/node_modules/uglify-js/test/testparser.js
  37. 0 1
      utils/node_modules/uglify-js/test/unit/compress/expected/array1.js
  38. 0 1
      utils/node_modules/uglify-js/test/unit/compress/expected/array2.js
  39. 0 1
      utils/node_modules/uglify-js/test/unit/compress/expected/array3.js
  40. 0 1
      utils/node_modules/uglify-js/test/unit/compress/expected/array4.js
  41. 0 1
      utils/node_modules/uglify-js/test/unit/compress/expected/assignment.js
  42. 0 1
      utils/node_modules/uglify-js/test/unit/compress/expected/concatstring.js
  43. 0 1
      utils/node_modules/uglify-js/test/unit/compress/expected/const.js
  44. 0 1
      utils/node_modules/uglify-js/test/unit/compress/expected/empty-blocks.js
  45. 0 1
      utils/node_modules/uglify-js/test/unit/compress/expected/forstatement.js
  46. 0 1
      utils/node_modules/uglify-js/test/unit/compress/expected/if.js
  47. 0 1
      utils/node_modules/uglify-js/test/unit/compress/expected/ifreturn.js
  48. 0 1
      utils/node_modules/uglify-js/test/unit/compress/expected/ifreturn2.js
  49. 0 1
      utils/node_modules/uglify-js/test/unit/compress/expected/issue10.js
  50. 0 1
      utils/node_modules/uglify-js/test/unit/compress/expected/issue11.js
  51. 0 1
      utils/node_modules/uglify-js/test/unit/compress/expected/issue13.js
  52. 0 1
      utils/node_modules/uglify-js/test/unit/compress/expected/issue14.js
  53. 0 1
      utils/node_modules/uglify-js/test/unit/compress/expected/issue16.js
  54. 0 1
      utils/node_modules/uglify-js/test/unit/compress/expected/issue17.js
  55. 0 1
      utils/node_modules/uglify-js/test/unit/compress/expected/issue20.js
  56. 0 1
      utils/node_modules/uglify-js/test/unit/compress/expected/issue21.js
  57. 0 1
      utils/node_modules/uglify-js/test/unit/compress/expected/issue25.js
  58. 0 1
      utils/node_modules/uglify-js/test/unit/compress/expected/issue27.js
  59. 0 1
      utils/node_modules/uglify-js/test/unit/compress/expected/issue278.js
  60. 0 1
      utils/node_modules/uglify-js/test/unit/compress/expected/issue28.js
  61. 0 1
      utils/node_modules/uglify-js/test/unit/compress/expected/issue29.js
  62. 0 1
      utils/node_modules/uglify-js/test/unit/compress/expected/issue30.js
  63. 0 1
      utils/node_modules/uglify-js/test/unit/compress/expected/issue34.js
  64. 0 1
      utils/node_modules/uglify-js/test/unit/compress/expected/issue4.js
  65. 0 1
      utils/node_modules/uglify-js/test/unit/compress/expected/issue48.js
  66. 0 1
      utils/node_modules/uglify-js/test/unit/compress/expected/issue50.js
  67. 0 1
      utils/node_modules/uglify-js/test/unit/compress/expected/issue53.js
  68. 0 1
      utils/node_modules/uglify-js/test/unit/compress/expected/issue54.1.js
  69. 0 1
      utils/node_modules/uglify-js/test/unit/compress/expected/issue68.js
  70. 0 1
      utils/node_modules/uglify-js/test/unit/compress/expected/issue69.js
  71. 0 1
      utils/node_modules/uglify-js/test/unit/compress/expected/issue9.js
  72. 0 1
      utils/node_modules/uglify-js/test/unit/compress/expected/mangle.js
  73. 0 1
      utils/node_modules/uglify-js/test/unit/compress/expected/null_string.js
  74. 0 1
      utils/node_modules/uglify-js/test/unit/compress/expected/strict-equals.js
  75. 0 1
      utils/node_modules/uglify-js/test/unit/compress/expected/var.js
  76. 0 1
      utils/node_modules/uglify-js/test/unit/compress/expected/whitespace.js
  77. 0 1
      utils/node_modules/uglify-js/test/unit/compress/expected/with.js
  78. 0 3
      utils/node_modules/uglify-js/test/unit/compress/test/array1.js
  79. 0 4
      utils/node_modules/uglify-js/test/unit/compress/test/array2.js
  80. 0 4
      utils/node_modules/uglify-js/test/unit/compress/test/array3.js
  81. 0 6
      utils/node_modules/uglify-js/test/unit/compress/test/array4.js
  82. 0 20
      utils/node_modules/uglify-js/test/unit/compress/test/assignment.js
  83. 0 3
      utils/node_modules/uglify-js/test/unit/compress/test/concatstring.js
  84. 0 5
      utils/node_modules/uglify-js/test/unit/compress/test/const.js
  85. 0 4
      utils/node_modules/uglify-js/test/unit/compress/test/empty-blocks.js
  86. 0 10
      utils/node_modules/uglify-js/test/unit/compress/test/forstatement.js
  87. 0 6
      utils/node_modules/uglify-js/test/unit/compress/test/if.js
  88. 0 9
      utils/node_modules/uglify-js/test/unit/compress/test/ifreturn.js
  89. 0 16
      utils/node_modules/uglify-js/test/unit/compress/test/ifreturn2.js
  90. 0 1
      utils/node_modules/uglify-js/test/unit/compress/test/issue10.js
  91. 0 3
      utils/node_modules/uglify-js/test/unit/compress/test/issue11.js
  92. 0 1
      utils/node_modules/uglify-js/test/unit/compress/test/issue13.js
  93. 0 1
      utils/node_modules/uglify-js/test/unit/compress/test/issue14.js
  94. 0 1
      utils/node_modules/uglify-js/test/unit/compress/test/issue16.js
  95. 0 4
      utils/node_modules/uglify-js/test/unit/compress/test/issue17.js
  96. 0 1
      utils/node_modules/uglify-js/test/unit/compress/test/issue20.js
  97. 0 6
      utils/node_modules/uglify-js/test/unit/compress/test/issue21.js
  98. 0 7
      utils/node_modules/uglify-js/test/unit/compress/test/issue25.js
  99. 0 1
      utils/node_modules/uglify-js/test/unit/compress/test/issue27.js
  100. 0 1
      utils/node_modules/uglify-js/test/unit/compress/test/issue278.js

+ 2 - 1
.gitignore

@@ -1,3 +1,4 @@
 .DS_Store
 *.swp
-.project
+.project
+utils/node_modules/*

+ 11 - 10
build/Three.js

@@ -29,10 +29,11 @@ THREE.EventTarget=function(){var a={};this.addEventListener=function(b,c){a[b]==
 THREE.Frustum.prototype.setFromMatrix=function(a){var b,c=this.planes,d=a.elements,a=d[0];b=d[1];var e=d[2],f=d[3],g=d[4],h=d[5],i=d[6],j=d[7],l=d[8],o=d[9],m=d[10],p=d[11],r=d[12],n=d[13],q=d[14],d=d[15];c[0].set(f-a,j-g,p-l,d-r);c[1].set(f+a,j+g,p+l,d+r);c[2].set(f+b,j+h,p+o,d+n);c[3].set(f-b,j-h,p-o,d-n);c[4].set(f-e,j-i,p-m,d-q);c[5].set(f+e,j+i,p+m,d+q);for(a=0;a<6;a++){b=c[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};
 THREE.Frustum.prototype.contains=function(a){for(var b=this.planes,c=a.matrixWorld,d=c.elements,c=-a.geometry.boundingSphere.radius*c.getMaxScaleOnAxis(),e=0;e<6;e++){a=b[e].x*d[12]+b[e].y*d[13]+b[e].z*d[14]+b[e].w;if(a<=c)return false}return true};THREE.Frustum.__v1=new THREE.Vector3;
 THREE.Ray=function(a,b,c,d){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.near=c||0;this.far=d||Infinity;var e=new THREE.Vector3,f=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,j=new THREE.Vector3,l=new THREE.Vector3,o=new THREE.Vector3,m=new THREE.Vector3,p=function(a,b){return a.distance-b.distance},r=new THREE.Vector3,n=new THREE.Vector3,q=new THREE.Vector3,t,u,w,s=function(a,b,c){r.sub(c,a);t=r.dot(b);u=n.add(a,q.copy(b).multiplyScalar(t));
-return w=c.distanceTo(u)},x,F,C,z,v,H,I,N,R=function(a,b,c,d){r.sub(d,b);n.sub(c,b);q.sub(a,b);x=r.dot(r);F=r.dot(n);C=r.dot(q);z=n.dot(n);v=n.dot(q);H=1/(x*z-F*F);I=(z*C-F*v)*H;N=(x*v-F*C)*H;return I>=0&&N>=0&&I+N<1},Y=1.0E-4;this.setPrecision=function(a){Y=a};this.intersectObject=function(a){var b,c=[];if(a instanceof THREE.Particle){w=s(this.origin,this.direction,a.matrixWorld.getPosition());if(w>a.scale.x)return[];b={distance:w,point:a.position,face:null,object:a};c.push(b)}else if(a instanceof
-THREE.Mesh){var d=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),a.matrixWorld.getColumnZ().length()),d=a.geometry.boundingSphere.radius*Math.max(d.x,Math.max(d.y,d.z));w=s(this.origin,this.direction,a.matrixWorld.getPosition());if(w>d)return c;var k,n,r,q=a.geometry,t=q.vertices,u;a.matrixRotationWorld.extractRotation(a.matrixWorld);d=0;for(k=q.faces.length;d<k;d++){b=q.faces[d];i.copy(this.origin);j.copy(this.direction);u=a.matrixWorld;l=u.multiplyVector3(l.copy(b.centroid)).subSelf(i);
-o=a.matrixRotationWorld.multiplyVector3(o.copy(b.normal));n=j.dot(o);if(!(Math.abs(n)<Y)){r=o.dot(l)/n;if(!(r<0)&&(a.doubleSided||(a.flipSided?n>0:n<0))){m.add(i,j.multiplyScalar(r));w=i.distanceTo(m);if(!(w<this.near)&&!(w>this.far))if(b instanceof THREE.Face3){e=u.multiplyVector3(e.copy(t[b.a]));f=u.multiplyVector3(f.copy(t[b.b]));g=u.multiplyVector3(g.copy(t[b.c]));if(R(m,e,f,g)){b={distance:w,point:m.clone(),face:b,object:a};c.push(b)}}else if(b instanceof THREE.Face4){e=u.multiplyVector3(e.copy(t[b.a]));
-f=u.multiplyVector3(f.copy(t[b.b]));g=u.multiplyVector3(g.copy(t[b.c]));h=u.multiplyVector3(h.copy(t[b.d]));if(R(m,e,f,h)||R(m,f,g,h)){b={distance:w,point:m.clone(),face:b,object:a};c.push(b)}}}}}}c.sort(p);return c};this.intersectObjects=function(a){for(var b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,this.intersectObject(a[c]));b.sort(p);return b}};
+return w=c.distanceTo(u)},x,F,C,z,v,H,I,N,R=function(a,b,c,d){r.sub(d,b);n.sub(c,b);q.sub(a,b);x=r.dot(r);F=r.dot(n);C=r.dot(q);z=n.dot(n);v=n.dot(q);H=1/(x*z-F*F);I=(z*C-F*v)*H;N=(x*v-F*C)*H;return I>=0&&N>=0&&I+N<1},Y=1.0E-4;this.setPrecision=function(a){Y=a};this.intersectObject=function(a,b){var c,d=[];if(b===true)for(var k=0,n=a.children.length;k<n;k++)Array.prototype.push.apply(d,this.intersectObject(a.children[k],b));if(a instanceof THREE.Particle){w=s(this.origin,this.direction,a.matrixWorld.getPosition());
+if(w>a.scale.x)return[];c={distance:w,point:a.position,face:null,object:a};d.push(c)}else if(a instanceof THREE.Mesh){k=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),a.matrixWorld.getColumnZ().length());k=a.geometry.boundingSphere.radius*Math.max(k.x,Math.max(k.y,k.z));w=s(this.origin,this.direction,a.matrixWorld.getPosition());if(w>k)return d;var r,q,t=a.geometry,u=t.vertices,v;a.matrixRotationWorld.extractRotation(a.matrixWorld);k=0;for(n=t.faces.length;k<
+n;k++){c=t.faces[k];i.copy(this.origin);j.copy(this.direction);v=a.matrixWorld;l=v.multiplyVector3(l.copy(c.centroid)).subSelf(i);o=a.matrixRotationWorld.multiplyVector3(o.copy(c.normal));r=j.dot(o);if(!(Math.abs(r)<Y)){q=o.dot(l)/r;if(!(q<0)&&(a.doubleSided||(a.flipSided?r>0:r<0))){m.add(i,j.multiplyScalar(q));w=i.distanceTo(m);if(!(w<this.near)&&!(w>this.far))if(c instanceof THREE.Face3){e=v.multiplyVector3(e.copy(u[c.a]));f=v.multiplyVector3(f.copy(u[c.b]));g=v.multiplyVector3(g.copy(u[c.c]));
+if(R(m,e,f,g)){c={distance:w,point:m.clone(),face:c,object:a};d.push(c)}}else if(c instanceof THREE.Face4){e=v.multiplyVector3(e.copy(u[c.a]));f=v.multiplyVector3(f.copy(u[c.b]));g=v.multiplyVector3(g.copy(u[c.c]));h=v.multiplyVector3(h.copy(u[c.d]));if(R(m,e,f,h)||R(m,f,g,h)){c={distance:w,point:m.clone(),face:c,object:a};d.push(c)}}}}}}d.sort(p);return d};this.intersectObjects=function(a,b){for(var c=[],d=0,e=a.length;d<e;d++)Array.prototype.push.apply(c,this.intersectObject(a[d],b));c.sort(p);
+return c}};
 THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b,c,d,e,f,g,h=true;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(f,g,l,o){h=false;b=f;c=g;d=l;e=o;a()};this.addPoint=function(f,g){if(h){h=false;b=f;c=g;d=f;e=g}else{b=b<f?b:f;c=c<g?c:g;d=d>f?d:f;e=e>g?
 e:g}a()};this.add3Points=function(f,g,l,o,m,p){if(h){h=false;b=f<l?f<m?f:m:l<m?l:m;c=g<o?g<p?g:p:o<p?o:p;d=f>l?f>m?f:m:l>m?l:m;e=g>o?g>p?g:p:o>p?o:p}else{b=f<l?f<m?f<b?f:b:m<b?m:b:l<m?l<b?l:b:m<b?m:b;c=g<o?g<p?g<c?g:c:p<c?p:c:o<p?o<c?o:c:p<c?p:c;d=f>l?f>m?f>d?f:d:m>d?m:d:l>m?l>d?l:d:m>d?m:d;e=g>o?g>p?g>e?g:e:p>e?p:e:o>p?o>e?o:e:p>e?p:e}a()};this.addRectangle=function(f){if(h){h=false;b=f.getLeft();c=f.getTop();d=f.getRight();e=f.getBottom()}else{b=b<f.getLeft()?b:f.getLeft();c=c<f.getTop()?c:f.getTop();
 d=d>f.getRight()?d:f.getRight();e=e>f.getBottom()?e:f.getBottom()}a()};this.inflate=function(f){b=b-f;c=c-f;d=d+f;e=e+f;a()};this.minSelf=function(f){b=b>f.getLeft()?b:f.getLeft();c=c>f.getTop()?c:f.getTop();d=d<f.getRight()?d:f.getRight();e=e<f.getBottom()?e:f.getBottom();a()};this.intersects=function(a){return d<a.getLeft()||b>a.getRight()||e<a.getTop()||c>a.getBottom()?false:true};this.empty=function(){h=true;e=d=c=b=0;a()};this.isEmpty=function(){return h}};
@@ -309,9 +310,9 @@ var i=a.colors,j=i.length,l=a.__vertexArray,m=a.__colorArray,n=a.__sortArray,o=a
 if(h.boundTo===void 0||h.boundTo==="vertices"){f=0;e=h.value.length;if(h.size===1)for(d=0;d<e;d++){g=n[d][1];h.array[d]=h.value[g]}else if(h.size===2)for(d=0;d<e;d++){g=n[d][1];g=h.value[g];h.array[f]=g.x;h.array[f+1]=g.y;f=f+2}else if(h.size===3)if(h.type==="c")for(d=0;d<e;d++){g=n[d][1];g=h.value[g];h.array[f]=g.r;h.array[f+1]=g.g;h.array[f+2]=g.b;f=f+3}else for(d=0;d<e;d++){g=n[d][1];g=h.value[g];h.array[f]=g.x;h.array[f+1]=g.y;h.array[f+2]=g.z;f=f+3}else if(h.size===4)for(d=0;d<e;d++){g=n[d][1];
 g=h.value[g];h.array[f]=g.x;h.array[f+1]=g.y;h.array[f+2]=g.z;h.array[f+3]=g.w;f=f+4}}}}}else{if(o)for(d=0;d<g;d++){e=h[d];f=d*3;l[f]=e.x;l[f+1]=e.y;l[f+2]=e.z}if(p)for(d=0;d<j;d++){e=i[d];f=d*3;m[f]=e.r;m[f+1]=e.g;m[f+2]=e.b}if(r){i=0;for(j=r.length;i<j;i++){h=r[i];if(h.needsUpdate&&(h.boundTo===void 0||h.boundTo==="vertices")){e=h.value.length;f=0;if(h.size===1)for(d=0;d<e;d++)h.array[d]=h.value[d];else if(h.size===2)for(d=0;d<e;d++){g=h.value[d];h.array[f]=g.x;h.array[f+1]=g.y;f=f+2}else if(h.size===
 3)if(h.type==="c")for(d=0;d<e;d++){g=h.value[d];h.array[f]=g.r;h.array[f+1]=g.g;h.array[f+2]=g.b;f=f+3}else for(d=0;d<e;d++){g=h.value[d];h.array[f]=g.x;h.array[f+1]=g.y;h.array[f+2]=g.z;f=f+3}else if(h.size===4)for(d=0;d<e;d++){g=h.value[d];h.array[f]=g.x;h.array[f+1]=g.y;h.array[f+2]=g.z;h.array[f+3]=g.w;f=f+4}}}}}if(o||c.sortParticles){k.bindBuffer(k.ARRAY_BUFFER,a.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,l,b)}if(p||c.sortParticles){k.bindBuffer(k.ARRAY_BUFFER,a.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,
-m,b)}if(r){i=0;for(j=r.length;i<j;i++){h=r[i];if(h.needsUpdate||c.sortParticles){k.bindBuffer(k.ARRAY_BUFFER,h.buffer);k.bufferData(k.ARRAY_BUFFER,h.array,b)}}}}function g(a,b){return b.z-a.z}function h(a,b){return b[1]-a[1]}function i(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++){fa=S=null;K=ca=$=Z=oa=Na=X=-1;la=true;a[d].render(b,c,ab,Ba);fa=S=null;K=ca=$=Z=oa=Na=X=-1;la=true}}function j(a,b,c,d,e,f,g,h){var i,k,j,l;if(b){k=a.length-1;l=b=-1}else{k=0;b=a.length;l=1}for(var m=k;m!==b;m=m+l){i=
-a[m];if(i.render){k=i.object;j=i.buffer;if(h)i=h;else{i=i[c];if(!i)continue;g&&D.setBlending(i.blending,i.blendEquation,i.blendSrc,i.blendDst);D.setDepthTest(i.depthTest);D.setDepthWrite(i.depthWrite);u(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}D.setObjectFaces(k);j instanceof THREE.BufferGeometry?D.renderBufferDirect(d,e,f,i,j,k):D.renderBuffer(d,e,f,i,j,k)}}}function l(a,b,c,d,e,f,g){for(var h,i,k=0,j=a.length;k<j;k++){h=a[k];i=h.object;if(i.visible){if(g)h=g;else{h=h[b];if(!h)continue;
-f&&D.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);D.setDepthTest(h.depthTest);D.setDepthWrite(h.depthWrite);u(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}D.renderImmediateObject(c,d,e,h,i)}}}function o(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function m(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return true;return false}function p(a){for(var b in a.attributes)a.attributes[b].needsUpdate=false}function r(a,b){for(var c=a.length-
+m,b)}if(r){i=0;for(j=r.length;i<j;i++){h=r[i];if(h.needsUpdate||c.sortParticles){k.bindBuffer(k.ARRAY_BUFFER,h.buffer);k.bufferData(k.ARRAY_BUFFER,h.array,b)}}}}function g(a,b){return b.z-a.z}function h(a,b){return b[1]-a[1]}function i(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++){fa=S=null;K=ca=$=Z=oa=Na=X=-1;la=true;a[d].render(b,c,ab,Ba);fa=S=null;K=ca=$=Z=oa=Na=X=-1;la=true}}function j(a,b,c,d,e,f,g,h){var k,i,j,l;if(b){i=a.length-1;l=b=-1}else{i=0;b=a.length;l=1}for(var m=i;m!==b;m=m+l){k=
+a[m];if(k.render){i=k.object;j=k.buffer;if(h)k=h;else{k=k[c];if(!k)continue;g&&D.setBlending(k.blending,k.blendEquation,k.blendSrc,k.blendDst);D.setDepthTest(k.depthTest);D.setDepthWrite(k.depthWrite);u(k.polygonOffset,k.polygonOffsetFactor,k.polygonOffsetUnits)}D.setObjectFaces(i);j instanceof THREE.BufferGeometry?D.renderBufferDirect(d,e,f,k,j,i):D.renderBuffer(d,e,f,k,j,i)}}}function l(a,b,c,d,e,f,g){for(var h,k,i=0,j=a.length;i<j;i++){h=a[i];k=h.object;if(k.visible){if(g)h=g;else{h=h[b];if(!h)continue;
+f&&D.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);D.setDepthTest(h.depthTest);D.setDepthWrite(h.depthWrite);u(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}D.renderImmediateObject(c,d,e,h,k)}}}function o(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function m(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return true;return false}function p(a){for(var b in a.attributes)a.attributes[b].needsUpdate=false}function r(a,b){for(var c=a.length-
 1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function n(a,b){for(var c=a.length-1;c>=0;c--)a[c]===b&&a.splice(c,1)}function q(a,b,c,d,e){if(d.needsUpdate){d.program&&D.deallocateMaterial(d);D.initMaterial(d,b,c,e);d.needsUpdate=false}if(d.morphTargets&&!e.__webglMorphTargetInfluences)e.__webglMorphTargetInfluences=new Float32Array(D.maxMorphTargets);var f=false,g=d.program,h=g.uniforms,i=d.uniforms;if(g!==S){k.useProgram(g);S=g;f=true}if(d.id!==K){K=d.id;f=true}if(f||a!==fa){k.uniformMatrix4fv(h.projectionMatrix,
 false,a._projectionMatrixArray);a!==fa&&(fa=a)}if(f){if(c&&d.fog){i.fogColor.value=c.color;if(c instanceof THREE.Fog){i.fogNear.value=c.near;i.fogFar.value=c.far}else if(c instanceof THREE.FogExp2)i.fogDensity.value=c.density}if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(la){for(var j,l=0,m=0,n=0,o,p,r,q=ob,t=q.directional.colors,u=q.directional.positions,v=q.point.colors,w=q.point.positions,x=q.point.distances,F=q.spot.colors,B=q.spot.positions,H=q.spot.distances,
 Z=q.spot.directions,I=q.spot.angles,G=q.spot.exponents,N=0,M=0,X=0,O=r=0,c=O=0,f=b.length;c<f;c++){j=b[c];if(!j.onlyShadow&&j.visible){o=j.color;p=j.intensity;r=j.distance;if(j instanceof THREE.AmbientLight)if(D.gammaInput){l=l+o.r*o.r;m=m+o.g*o.g;n=n+o.b*o.b}else{l=l+o.r;m=m+o.g;n=n+o.b}else if(j instanceof THREE.DirectionalLight){r=N*3;if(D.gammaInput){t[r]=o.r*o.r*p*p;t[r+1]=o.g*o.g*p*p;t[r+2]=o.b*o.b*p*p}else{t[r]=o.r*p;t[r+1]=o.g*p;t[r+2]=o.b*p}Da.copy(j.matrixWorld.getPosition());Da.subSelf(j.target.matrixWorld.getPosition());
@@ -368,8 +369,8 @@ s;p.opaque=null}else{p.opaque=s;p.transparent=null}}}else if(s)if(s.transparent)
 null}}}if(a.overrideMaterial){d=a.overrideMaterial;this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst);this.setDepthTest(d.depthTest);this.setDepthWrite(d.depthWrite);u(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits);j(a.__webglObjects,false,"",b,n,o,true,d);l(a.__webglObjectsImmediate,"",b,n,o,false,d)}else{this.setBlending(THREE.NormalBlending);j(a.__webglObjects,true,"opaque",b,n,o,false);l(a.__webglObjectsImmediate,"opaque",b,n,o,false);j(a.__webglObjects,false,"transparent",
 b,n,o,true);l(a.__webglObjectsImmediate,"transparent",b,n,o,true)}i(this.renderPluginsPost,a,b);if(c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter)if(c instanceof THREE.WebGLRenderTargetCube){k.bindTexture(k.TEXTURE_CUBE_MAP,c.__webglTexture);k.generateMipmap(k.TEXTURE_CUBE_MAP);k.bindTexture(k.TEXTURE_CUBE_MAP,null)}else{k.bindTexture(k.TEXTURE_2D,c.__webglTexture);k.generateMipmap(k.TEXTURE_2D);k.bindTexture(k.TEXTURE_2D,null)}this.setDepthTest(true);this.setDepthWrite(true)};
 this.renderImmediateObject=function(a,b,c,d,e){var f=q(a,b,c,d,e);ca=-1;D.setObjectFaces(e);e.immediateRenderCallback?e.immediateRenderCallback(f,k,ya):e.render(function(a){D.renderBufferImmediate(a,f,d)})};this.initWebGLObjects=function(a){if(!a.__webglObjects){a.__webglObjects=[];a.__webglObjectsImmediate=[];a.__webglSprites=[];a.__webglFlares=[]}for(;a.__objectsAdded.length;){var g=a.__objectsAdded[0],h=a,i=void 0,j=void 0,l=void 0;if(!g.__webglInit){g.__webglInit=true;g._modelViewMatrix=new THREE.Matrix4;
-g._normalMatrix=new THREE.Matrix3;if(g instanceof THREE.Mesh){j=g.geometry;if(j instanceof THREE.Geometry){if(j.geometryGroups===void 0){var q=j,s=void 0,t=void 0,u=void 0,v=void 0,w=void 0,x=void 0,z=void 0,F={},C=q.morphTargets.length,B=q.morphNormals.length;q.geometryGroups={};s=0;for(t=q.faces.length;s<t;s++){u=q.faces[s];v=u.materialIndex;x=v!==void 0?v:-1;F[x]===void 0&&(F[x]={hash:x,counter:0});z=F[x].hash+"_"+F[x].counter;q.geometryGroups[z]===void 0&&(q.geometryGroups[z]={faces3:[],faces4:[],
-materialIndex:v,vertices:0,numMorphTargets:C,numMorphNormals:B});w=u instanceof THREE.Face3?3:4;if(q.geometryGroups[z].vertices+w>65535){F[x].counter=F[x].counter+1;z=F[x].hash+"_"+F[x].counter;q.geometryGroups[z]===void 0&&(q.geometryGroups[z]={faces3:[],faces4:[],materialIndex:v,vertices:0,numMorphTargets:C,numMorphNormals:B})}u instanceof THREE.Face3?q.geometryGroups[z].faces3.push(s):q.geometryGroups[z].faces4.push(s);q.geometryGroups[z].vertices=q.geometryGroups[z].vertices+w}q.geometryGroupsList=
+g._normalMatrix=new THREE.Matrix3;if(g instanceof THREE.Mesh){j=g.geometry;if(j instanceof THREE.Geometry){if(j.geometryGroups===void 0){var q=j,s=void 0,t=void 0,v=void 0,u=void 0,w=void 0,x=void 0,z=void 0,F={},C=q.morphTargets.length,B=q.morphNormals.length;q.geometryGroups={};s=0;for(t=q.faces.length;s<t;s++){v=q.faces[s];u=v.materialIndex;x=u!==void 0?u:-1;F[x]===void 0&&(F[x]={hash:x,counter:0});z=F[x].hash+"_"+F[x].counter;q.geometryGroups[z]===void 0&&(q.geometryGroups[z]={faces3:[],faces4:[],
+materialIndex:u,vertices:0,numMorphTargets:C,numMorphNormals:B});w=v instanceof THREE.Face3?3:4;if(q.geometryGroups[z].vertices+w>65535){F[x].counter=F[x].counter+1;z=F[x].hash+"_"+F[x].counter;q.geometryGroups[z]===void 0&&(q.geometryGroups[z]={faces3:[],faces4:[],materialIndex:u,vertices:0,numMorphTargets:C,numMorphNormals:B})}v instanceof THREE.Face3?q.geometryGroups[z].faces3.push(s):q.geometryGroups[z].faces4.push(s);q.geometryGroups[z].vertices=q.geometryGroups[z].vertices+w}q.geometryGroupsList=
 [];var H=void 0;for(H in q.geometryGroups){q.geometryGroups[H].id=O++;q.geometryGroupsList.push(q.geometryGroups[H])}}for(i in j.geometryGroups){l=j.geometryGroups[i];if(!l.__webglVertexBuffer){var K=l;K.__webglVertexBuffer=k.createBuffer();K.__webglNormalBuffer=k.createBuffer();K.__webglTangentBuffer=k.createBuffer();K.__webglColorBuffer=k.createBuffer();K.__webglUVBuffer=k.createBuffer();K.__webglUV2Buffer=k.createBuffer();K.__webglSkinVertexABuffer=k.createBuffer();K.__webglSkinVertexBBuffer=k.createBuffer();
 K.__webglSkinIndicesBuffer=k.createBuffer();K.__webglSkinWeightsBuffer=k.createBuffer();K.__webglFaceBuffer=k.createBuffer();K.__webglLineBuffer=k.createBuffer();var Z=void 0,I=void 0;if(K.numMorphTargets){K.__webglMorphTargetsBuffers=[];Z=0;for(I=K.numMorphTargets;Z<I;Z++)K.__webglMorphTargetsBuffers.push(k.createBuffer())}if(K.numMorphNormals){K.__webglMorphNormalsBuffers=[];Z=0;for(I=K.numMorphNormals;Z<I;Z++)K.__webglMorphNormalsBuffers.push(k.createBuffer())}D.info.memory.geometries++;var G=
 l,N=g,X=N.geometry,M=G.faces3,$=G.faces4,S=M.length*3+$.length*4,Q=M.length*1+$.length*2,R=M.length*3+$.length*4,P=c(N,G),aa=e(P),Y=d(P),fa=P.vertexColors?P.vertexColors:false;G.__vertexArray=new Float32Array(S*3);if(Y)G.__normalArray=new Float32Array(S*3);if(X.hasTangents)G.__tangentArray=new Float32Array(S*4);if(fa)G.__colorArray=new Float32Array(S*3);if(aa){if(X.faceUvs.length>0||X.faceVertexUvs.length>0)G.__uvArray=new Float32Array(S*2);if(X.faceUvs.length>1||X.faceVertexUvs.length>1)G.__uv2Array=
@@ -464,7 +465,7 @@ w.vertexNormals[2].copy(g);s.vertexNormals[0].copy(f);s.vertexNormals[3].copy(g)
 f.lerpSelf(e.vertexNormals[2],0.5);g=e.vertexNormals[3].clone();g.lerpSelf(e.vertexNormals[0],0.5);w.vertexNormals[2].copy(f);w.vertexNormals[3].copy(g);s.vertexNormals[0].copy(g);s.vertexNormals[1].copy(f)}if(e.vertexColors.length===4){f=e.vertexColors[1].clone();f.lerpSelf(e.vertexColors[2],0.5);g=e.vertexColors[3].clone();g.lerpSelf(e.vertexColors[0],0.5);w.vertexColors[2].copy(f);w.vertexColors[3].copy(g);s.vertexColors[0].copy(g);s.vertexColors[1].copy(f)}e=1}x.push(w,s);a.vertices.push(p,l);
 f=0;for(g=a.faceVertexUvs.length;f<g;f++)if(a.faceVertexUvs[f].length){j=a.faceVertexUvs[f][c];s=j[0];h=j[1];w=j[2];j=j[3];if(e===0){l=s.clone();l.lerpSelf(h,0.5);o=w.clone();o.lerpSelf(j,0.5);s=[s.clone(),l.clone(),o.clone(),j.clone()];h=[l.clone(),h.clone(),w.clone(),o.clone()]}else{l=h.clone();l.lerpSelf(w,0.5);o=j.clone();o.lerpSelf(s,0.5);s=[s.clone(),h.clone(),l.clone(),o.clone()];h=[o.clone(),l.clone(),w.clone(),j.clone()]}F[f].push(s,h)}}else{x.push(e);f=0;for(g=a.faceVertexUvs.length;f<g;f++)F[f].push(a.faceVertexUvs[f][c])}}}a.faces=
 x;a.faceVertexUvs=F}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
-THREE.ImageUtils={crossOrigin:"anonymous",loadTexture:function(a,b,c,d){var e=new THREE.Texture(void 0,b),b=new THREE.ImageLoader;b.addEventListener("load",function(a){e.image=a.content;e.needsUpdate=true;c&&c()});b.addEventListener("error",function(a){d&&d(a.message)});b.crossOrigin=this.crossOrigin;b.load(a);return e},loadTextureCube:function(a,b,c){var d,e=[],f=new THREE.Texture(e,b),b=e.loadCount=0;for(d=a.length;b<d;++b){e[b]=new Image;e[b].onload=function(){e.loadCount=e.loadCount+1;if(e.loadCount===
+THREE.ImageUtils={crossOrigin:"anonymous",loadTexture:function(a,b,c,d){var e=new THREE.Texture(void 0,b),b=new THREE.ImageLoader;b.addEventListener("load",function(a){e.image=a.content;e.needsUpdate=true;c&&c(e)});b.addEventListener("error",function(a){d&&d(a.message)});b.crossOrigin=this.crossOrigin;b.load(a);return e},loadTextureCube:function(a,b,c){var d,e=[],f=new THREE.Texture(e,b),b=e.loadCount=0;for(d=a.length;b<d;++b){e[b]=new Image;e[b].onload=function(){e.loadCount=e.loadCount+1;if(e.loadCount===
 6){f.needsUpdate=true;c&&c()}};e[b].crossOrigin=this.crossOrigin;e[b].src=a[b]}return f},getNormalMap:function(a,b){var c=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]},b=b|1,d=a.width,e=a.height,f=document.createElement("canvas");f.width=d;f.height=e;var g=f.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,0,d,e).data,i=g.createImageData(d,e),j=i.data,l=0;l<d;l++)for(var o=0;o<e;o++){var m=o-1<0?0:o-1,p=o+1>e-1?e-1:o+1,r=l-1<0?0:l-1,n=l+1>d-
 1?d-1:l+1,q=[],t=[0,0,h[(o*d+l)*4]/255*b];q.push([-1,0,h[(o*d+r)*4]/255*b]);q.push([-1,-1,h[(m*d+r)*4]/255*b]);q.push([0,-1,h[(m*d+l)*4]/255*b]);q.push([1,-1,h[(m*d+n)*4]/255*b]);q.push([1,0,h[(o*d+n)*4]/255*b]);q.push([1,1,h[(p*d+n)*4]/255*b]);q.push([0,1,h[(p*d+l)*4]/255*b]);q.push([-1,1,h[(p*d+r)*4]/255*b]);m=[];r=q.length;for(p=0;p<r;p++){var n=q[p],u=q[(p+1)%r],n=[n[0]-t[0],n[1]-t[1],n[2]-t[2]],u=[u[0]-t[0],u[1]-t[1],u[2]-t[2]];m.push(c([n[1]*u[2]-n[2]*u[1],n[2]*u[0]-n[0]*u[2],n[0]*u[1]-n[1]*
 u[0]]))}q=[0,0,0];for(p=0;p<m.length;p++){q[0]=q[0]+m[p][0];q[1]=q[1]+m[p][1];q[2]=q[2]+m[p][2]}q[0]=q[0]/m.length;q[1]=q[1]/m.length;q[2]=q[2]/m.length;t=(o*d+l)*4;j[t]=(q[0]+1)/2*255|0;j[t+1]=(q[1]+1)/2*255|0;j[t+2]=q[2]*255|0;j[t+3]=255}g.putImageData(i,0,0);return f},generateDataTexture:function(a,b,c){for(var d=a*b,e=new Uint8Array(3*d),f=Math.floor(c.r*255),g=Math.floor(c.g*255),c=Math.floor(c.b*255),h=0;h<d;h++){e[h*3]=f;e[h*3+1]=g;e[h*3+2]=c}a=new THREE.DataTexture(e,a,b,THREE.RGBFormat);

+ 109 - 108
build/custom/ThreeCanvas.js

@@ -13,54 +13,55 @@ THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;
 a;this.z=this.z+a;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x=this.x-a.x;this.y=this.y-a.y;this.z=this.z-a.z;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x=this.x*a.x;this.y=this.y*a.y;this.z=this.z*a.z;return this},multiplyScalar:function(a){this.x=this.x*a;this.y=this.y*a;this.z=this.z*a;return this},divideSelf:function(a){this.x=this.x/a.x;this.y=
 this.y/a.y;this.z=this.z/a.z;return this},divideScalar:function(a){if(a){this.x=this.x/a;this.y=this.y/a;this.z=this.z/a}else this.z=this.y=this.x=0;return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},
 setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x=this.x+(a.x-this.x)*b;this.y=this.y+(a.y-this.y)*b;this.z=this.z+(a.z-this.z)*b;return this},cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},crossSelf:function(a){var b=this.x,c=this.y,d=this.z;this.x=c*a.z-d*a.y;this.y=d*a.x-b*a.z;this.z=b*a.y-c*a.x;return this},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){return(new THREE.Vector3).sub(this,
-a).lengthSq()},getPositionFromMatrix:function(a){this.x=a.elements[12];this.y=a.elements[13];this.z=a.elements[14];return this},setEulerFromRotationMatrix:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.elements,f=d[0],e=d[4],g=d[8],m=d[1],k=d[5],l=d[9],h=d[2],n=d[6],d=d[10];switch(b||"XYZ"){case "YXZ":this.x=Math.asin(-c(l));if(Math.abs(l)<0.99999){this.y=Math.atan2(g,d);this.z=Math.atan2(m,k)}else{this.y=Math.atan2(-h,f);this.z=0}break;case "ZXY":this.x=Math.asin(c(n));if(Math.abs(n)<
-0.99999){this.y=Math.atan2(-h,d);this.z=Math.atan2(-e,k)}else{this.y=0;this.z=Math.atan2(g,f)}break;case "ZYX":this.y=Math.asin(-c(h));if(Math.abs(h)<0.99999){this.x=Math.atan2(n,d);this.z=Math.atan2(m,f)}else{this.x=0;this.z=Math.atan2(-e,k)}break;case "YZX":this.z=Math.asin(c(m));if(Math.abs(m)<0.99999){this.x=Math.atan2(-l,k);this.y=Math.atan2(-h,f)}else{this.x=0;this.y=Math.atan2(h,d)}break;case "XZY":this.z=Math.asin(-c(e));if(Math.abs(e)<0.99999){this.x=Math.atan2(n,k);this.y=Math.atan2(g,f)}else{this.x=
-Math.atan2(-g,d);this.y=0}break;default:this.y=Math.asin(c(g));if(Math.abs(g)<0.99999){this.x=Math.atan2(-l,d);this.z=Math.atan2(-e,f)}else{this.x=Math.atan2(m,k);this.z=0}}return this},setEulerFromQuaternion:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.x*a.x,f=a.y*a.y,e=a.z*a.z,g=a.w*a.w;switch(b){case "YXZ":this.x=Math.asin(c(2*(a.x*a.w-a.y*a.z)));this.y=Math.atan2(2*(a.x*a.z+a.y*a.w),g-d-f+e);this.z=Math.atan2(2*(a.x*a.y+a.z*a.w),g-d+f-e);break;case "ZXY":this.x=Math.asin(c(2*
+a).lengthSq()},getPositionFromMatrix:function(a){this.x=a.elements[12];this.y=a.elements[13];this.z=a.elements[14];return this},setEulerFromRotationMatrix:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.elements,f=d[0],e=d[4],g=d[8],m=d[1],k=d[5],j=d[9],h=d[2],n=d[6],d=d[10];switch(b||"XYZ"){case "YXZ":this.x=Math.asin(-c(j));if(Math.abs(j)<0.99999){this.y=Math.atan2(g,d);this.z=Math.atan2(m,k)}else{this.y=Math.atan2(-h,f);this.z=0}break;case "ZXY":this.x=Math.asin(c(n));if(Math.abs(n)<
+0.99999){this.y=Math.atan2(-h,d);this.z=Math.atan2(-e,k)}else{this.y=0;this.z=Math.atan2(g,f)}break;case "ZYX":this.y=Math.asin(-c(h));if(Math.abs(h)<0.99999){this.x=Math.atan2(n,d);this.z=Math.atan2(m,f)}else{this.x=0;this.z=Math.atan2(-e,k)}break;case "YZX":this.z=Math.asin(c(m));if(Math.abs(m)<0.99999){this.x=Math.atan2(-j,k);this.y=Math.atan2(-h,f)}else{this.x=0;this.y=Math.atan2(h,d)}break;case "XZY":this.z=Math.asin(-c(e));if(Math.abs(e)<0.99999){this.x=Math.atan2(n,k);this.y=Math.atan2(g,f)}else{this.x=
+Math.atan2(-g,d);this.y=0}break;default:this.y=Math.asin(c(g));if(Math.abs(g)<0.99999){this.x=Math.atan2(-j,d);this.z=Math.atan2(-e,f)}else{this.x=Math.atan2(m,k);this.z=0}}return this},setEulerFromQuaternion:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.x*a.x,f=a.y*a.y,e=a.z*a.z,g=a.w*a.w;switch(b){case "YXZ":this.x=Math.asin(c(2*(a.x*a.w-a.y*a.z)));this.y=Math.atan2(2*(a.x*a.z+a.y*a.w),g-d-f+e);this.z=Math.atan2(2*(a.x*a.y+a.z*a.w),g-d+f-e);break;case "ZXY":this.x=Math.asin(c(2*
 (a.x*a.w+a.y*a.z)));this.y=Math.atan2(2*(a.y*a.w-a.z*a.x),g-d-f+e);this.z=Math.atan2(2*(a.z*a.w-a.x*a.y),g-d+f-e);break;case "ZYX":this.x=Math.atan2(2*(a.x*a.w+a.z*a.y),g-d-f+e);this.y=Math.asin(c(2*(a.y*a.w-a.x*a.z)));this.z=Math.atan2(2*(a.x*a.y+a.z*a.w),g+d-f-e);break;case "YZX":this.x=Math.atan2(2*(a.x*a.w-a.z*a.y),g-d+f-e);this.y=Math.atan2(2*(a.y*a.w-a.x*a.z),g+d-f-e);this.z=Math.asin(c(2*(a.x*a.y+a.z*a.w)));break;case "XZY":this.x=Math.atan2(2*(a.x*a.w+a.y*a.z),g-d+f-e);this.y=Math.atan2(2*
 (a.x*a.z+a.y*a.w),g+d-f-e);this.z=Math.asin(c(2*(a.z*a.w-a.x*a.y)));break;default:this.x=Math.atan2(2*(a.x*a.w-a.y*a.z),g-d-f+e);this.y=Math.asin(c(2*(a.x*a.z+a.y*a.w)));this.z=Math.atan2(2*(a.z*a.w-a.x*a.y),g+d-f-e)}return this},getScaleFromMatrix:function(a){var b=this.set(a.elements[0],a.elements[1],a.elements[2]).length(),c=this.set(a.elements[4],a.elements[5],a.elements[6]).length(),a=this.set(a.elements[8],a.elements[9],a.elements[10]).length();this.x=b;this.y=c;this.z=a},equals:function(a){return a.x===
 this.x&&a.y===this.y&&a.z===this.z},isZero:function(){return this.lengthSq()<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==void 0?d:1};
 THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w!==void 0?a.w:1;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x=this.x+a.x;this.y=this.y+a.y;this.z=this.z+a.z;this.w=this.w+a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x=
 this.x-a.x;this.y=this.y-a.y;this.z=this.z-a.z;this.w=this.w-a.w;return this},multiplyScalar:function(a){this.x=this.x*a;this.y=this.y*a;this.z=this.z*a;this.w=this.w*a;return this},divideScalar:function(a){if(a){this.x=this.x/a;this.y=this.y/a;this.z=this.z/a;this.w=this.w/a}else{this.z=this.y=this.x=0;this.w=1}return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
 normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x=this.x+(a.x-this.x)*b;this.y=this.y+(a.y-this.y)*b;this.z=this.z+(a.z-this.z)*b;this.w=this.w+(a.w-this.w)*b;return this},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},setAxisAngleFromQuaternion:function(a){this.w=2*Math.acos(a.w);var b=Math.sqrt(1-a.w*a.w);if(b<1.0E-4){this.x=1;this.z=this.y=0}else{this.x=a.x/b;this.y=
-a.y/b;this.z=a.z/b}return this},setAxisAngleFromRotationMatrix:function(a){var b,c,d,a=a.elements,f=a[0];d=a[4];var e=a[8],g=a[1],m=a[5],k=a[9];c=a[2];b=a[6];var l=a[10];if(Math.abs(d-g)<0.01&&Math.abs(e-c)<0.01&&Math.abs(k-b)<0.01){if(Math.abs(d+g)<0.1&&Math.abs(e+c)<0.1&&Math.abs(k+b)<0.1&&Math.abs(f+m+l-3)<0.1){this.set(1,0,0,0);return this}a=Math.PI;f=(f+1)/2;m=(m+1)/2;l=(l+1)/2;d=(d+g)/4;e=(e+c)/4;k=(k+b)/4;if(f>m&&f>l)if(f<0.01){b=0;d=c=0.707106781}else{b=Math.sqrt(f);c=d/b;d=e/b}else if(m>
-l)if(m<0.01){b=0.707106781;c=0;d=0.707106781}else{c=Math.sqrt(m);b=d/c;d=k/c}else if(l<0.01){c=b=0.707106781;d=0}else{d=Math.sqrt(l);b=e/d;c=k/d}this.set(b,c,d,a);return this}a=Math.sqrt((b-k)*(b-k)+(e-c)*(e-c)+(g-d)*(g-d));Math.abs(a)<0.0010&&(a=1);this.x=(b-k)/a;this.y=(e-c)/a;this.z=(g-d)/a;this.w=Math.acos((f+m+l-1)/2);return this}};
+a.y/b;this.z=a.z/b}return this},setAxisAngleFromRotationMatrix:function(a){var b,c,d,a=a.elements,f=a[0];d=a[4];var e=a[8],g=a[1],m=a[5],k=a[9];c=a[2];b=a[6];var j=a[10];if(Math.abs(d-g)<0.01&&Math.abs(e-c)<0.01&&Math.abs(k-b)<0.01){if(Math.abs(d+g)<0.1&&Math.abs(e+c)<0.1&&Math.abs(k+b)<0.1&&Math.abs(f+m+j-3)<0.1){this.set(1,0,0,0);return this}a=Math.PI;f=(f+1)/2;m=(m+1)/2;j=(j+1)/2;d=(d+g)/4;e=(e+c)/4;k=(k+b)/4;if(f>m&&f>j)if(f<0.01){b=0;d=c=0.707106781}else{b=Math.sqrt(f);c=d/b;d=e/b}else if(m>
+j)if(m<0.01){b=0.707106781;c=0;d=0.707106781}else{c=Math.sqrt(m);b=d/c;d=k/c}else if(j<0.01){c=b=0.707106781;d=0}else{d=Math.sqrt(j);b=e/d;c=k/d}this.set(b,c,d,a);return this}a=Math.sqrt((b-k)*(b-k)+(e-c)*(e-c)+(g-d)*(g-d));Math.abs(a)<0.0010&&(a=1);this.x=(b-k)/a;this.y=(e-c)/a;this.z=(g-d)/a;this.w=Math.acos((f+m+j-1)/2);return this}};
 THREE.EventTarget=function(){var a={};this.addEventListener=function(b,c){a[b]===void 0&&(a[b]=[]);a[b].indexOf(c)===-1&&a[b].push(c)};this.dispatchEvent=function(b){for(var c in a[b.type])a[b.type][c](b)};this.removeEventListener=function(b,c){var d=a[b].indexOf(c);d!==-1&&a[b].splice(d,1)}};THREE.Frustum=function(){this.planes=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4]};
-THREE.Frustum.prototype.setFromMatrix=function(a){var b,c=this.planes,d=a.elements,a=d[0];b=d[1];var f=d[2],e=d[3],g=d[4],m=d[5],k=d[6],l=d[7],h=d[8],n=d[9],j=d[10],o=d[11],q=d[12],i=d[13],p=d[14],d=d[15];c[0].set(e-a,l-g,o-h,d-q);c[1].set(e+a,l+g,o+h,d+q);c[2].set(e+b,l+m,o+n,d+i);c[3].set(e-b,l-m,o-n,d-i);c[4].set(e-f,l-k,o-j,d-p);c[5].set(e+f,l+k,o+j,d+p);for(a=0;a<6;a++){b=c[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};
+THREE.Frustum.prototype.setFromMatrix=function(a){var b,c=this.planes,d=a.elements,a=d[0];b=d[1];var f=d[2],e=d[3],g=d[4],m=d[5],k=d[6],j=d[7],h=d[8],n=d[9],i=d[10],o=d[11],q=d[12],l=d[13],p=d[14],d=d[15];c[0].set(e-a,j-g,o-h,d-q);c[1].set(e+a,j+g,o+h,d+q);c[2].set(e+b,j+m,o+n,d+l);c[3].set(e-b,j-m,o-n,d-l);c[4].set(e-f,j-k,o-i,d-p);c[5].set(e+f,j+k,o+i,d+p);for(a=0;a<6;a++){b=c[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};
 THREE.Frustum.prototype.contains=function(a){for(var b=this.planes,c=a.matrixWorld,d=c.elements,c=-a.geometry.boundingSphere.radius*c.getMaxScaleOnAxis(),f=0;f<6;f++){a=b[f].x*d[12]+b[f].y*d[13]+b[f].z*d[14]+b[f].w;if(a<=c)return false}return true};THREE.Frustum.__v1=new THREE.Vector3;
-THREE.Ray=function(a,b,c,d){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.near=c||0;this.far=d||Infinity;var f=new THREE.Vector3,e=new THREE.Vector3,g=new THREE.Vector3,m=new THREE.Vector3,k=new THREE.Vector3,l=new THREE.Vector3,h=new THREE.Vector3,n=new THREE.Vector3,j=new THREE.Vector3,o=function(a,b){return a.distance-b.distance},q=new THREE.Vector3,i=new THREE.Vector3,p=new THREE.Vector3,r,s,v,A=function(a,b,c){q.sub(c,a);r=q.dot(b);s=i.add(a,p.copy(b).multiplyScalar(r));
-return v=c.distanceTo(s)},w,B,x,F,u,z,D,H,P=function(a,b,c,d){q.sub(d,b);i.sub(c,b);p.sub(a,b);w=q.dot(q);B=q.dot(i);x=q.dot(p);F=i.dot(i);u=i.dot(p);z=1/(w*F-B*B);D=(F*x-B*u)*z;H=(w*u-B*x)*z;return D>=0&&H>=0&&D+H<1},M=1.0E-4;this.setPrecision=function(a){M=a};this.intersectObject=function(a){var b,c=[];if(a instanceof THREE.Particle){v=A(this.origin,this.direction,a.matrixWorld.getPosition());if(v>a.scale.x)return[];b={distance:v,point:a.position,face:null,object:a};c.push(b)}else if(a instanceof
-THREE.Mesh){var d=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),a.matrixWorld.getColumnZ().length()),d=a.geometry.boundingSphere.radius*Math.max(d.x,Math.max(d.y,d.z));v=A(this.origin,this.direction,a.matrixWorld.getPosition());if(v>d)return c;var i,q,y,S=a.geometry,p=S.vertices,r;a.matrixRotationWorld.extractRotation(a.matrixWorld);d=0;for(i=S.faces.length;d<i;d++){b=S.faces[d];k.copy(this.origin);l.copy(this.direction);r=a.matrixWorld;h=r.multiplyVector3(h.copy(b.centroid)).subSelf(k);
-n=a.matrixRotationWorld.multiplyVector3(n.copy(b.normal));q=l.dot(n);if(!(Math.abs(q)<M)){y=n.dot(h)/q;if(!(y<0)&&(a.doubleSided||(a.flipSided?q>0:q<0))){j.add(k,l.multiplyScalar(y));v=k.distanceTo(j);if(!(v<this.near)&&!(v>this.far))if(b instanceof THREE.Face3){f=r.multiplyVector3(f.copy(p[b.a]));e=r.multiplyVector3(e.copy(p[b.b]));g=r.multiplyVector3(g.copy(p[b.c]));if(P(j,f,e,g)){b={distance:v,point:j.clone(),face:b,object:a};c.push(b)}}else if(b instanceof THREE.Face4){f=r.multiplyVector3(f.copy(p[b.a]));
-e=r.multiplyVector3(e.copy(p[b.b]));g=r.multiplyVector3(g.copy(p[b.c]));m=r.multiplyVector3(m.copy(p[b.d]));if(P(j,f,e,m)||P(j,e,g,m)){b={distance:v,point:j.clone(),face:b,object:a};c.push(b)}}}}}}c.sort(o);return c};this.intersectObjects=function(a){for(var b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,this.intersectObject(a[c]));b.sort(o);return b}};
+THREE.Ray=function(a,b,c,d){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.near=c||0;this.far=d||Infinity;var f=new THREE.Vector3,e=new THREE.Vector3,g=new THREE.Vector3,m=new THREE.Vector3,k=new THREE.Vector3,j=new THREE.Vector3,h=new THREE.Vector3,n=new THREE.Vector3,i=new THREE.Vector3,o=function(a,b){return a.distance-b.distance},q=new THREE.Vector3,l=new THREE.Vector3,p=new THREE.Vector3,r,s,v,A=function(a,b,c){q.sub(c,a);r=q.dot(b);s=l.add(a,p.copy(b).multiplyScalar(r));
+return v=c.distanceTo(s)},w,B,x,F,u,z,D,H,P=function(a,b,c,d){q.sub(d,b);l.sub(c,b);p.sub(a,b);w=q.dot(q);B=q.dot(l);x=q.dot(p);F=l.dot(l);u=l.dot(p);z=1/(w*F-B*B);D=(F*x-B*u)*z;H=(w*u-B*x)*z;return D>=0&&H>=0&&D+H<1},M=1.0E-4;this.setPrecision=function(a){M=a};this.intersectObject=function(a,b){var c,d=[];if(b===true)for(var l=0,q=a.children.length;l<q;l++)Array.prototype.push.apply(d,this.intersectObject(a.children[l],b));if(a instanceof THREE.Particle){v=A(this.origin,this.direction,a.matrixWorld.getPosition());
+if(v>a.scale.x)return[];c={distance:v,point:a.position,face:null,object:a};d.push(c)}else if(a instanceof THREE.Mesh){l=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),a.matrixWorld.getColumnZ().length());l=a.geometry.boundingSphere.radius*Math.max(l.x,Math.max(l.y,l.z));v=A(this.origin,this.direction,a.matrixWorld.getPosition());if(v>l)return d;var y,S,p=a.geometry,r=p.vertices,s;a.matrixRotationWorld.extractRotation(a.matrixWorld);l=0;for(q=p.faces.length;l<
+q;l++){c=p.faces[l];k.copy(this.origin);j.copy(this.direction);s=a.matrixWorld;h=s.multiplyVector3(h.copy(c.centroid)).subSelf(k);n=a.matrixRotationWorld.multiplyVector3(n.copy(c.normal));y=j.dot(n);if(!(Math.abs(y)<M)){S=n.dot(h)/y;if(!(S<0)&&(a.doubleSided||(a.flipSided?y>0:y<0))){i.add(k,j.multiplyScalar(S));v=k.distanceTo(i);if(!(v<this.near)&&!(v>this.far))if(c instanceof THREE.Face3){f=s.multiplyVector3(f.copy(r[c.a]));e=s.multiplyVector3(e.copy(r[c.b]));g=s.multiplyVector3(g.copy(r[c.c]));
+if(P(i,f,e,g)){c={distance:v,point:i.clone(),face:c,object:a};d.push(c)}}else if(c instanceof THREE.Face4){f=s.multiplyVector3(f.copy(r[c.a]));e=s.multiplyVector3(e.copy(r[c.b]));g=s.multiplyVector3(g.copy(r[c.c]));m=s.multiplyVector3(m.copy(r[c.d]));if(P(i,f,e,m)||P(i,e,g,m)){c={distance:v,point:i.clone(),face:c,object:a};d.push(c)}}}}}}d.sort(o);return d};this.intersectObjects=function(a,b){for(var c=[],d=0,e=a.length;d<e;d++)Array.prototype.push.apply(c,this.intersectObject(a[d],b));c.sort(o);
+return c}};
 THREE.Rectangle=function(){function a(){e=d-b;g=f-c}var b,c,d,f,e,g,m=true;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return e};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(e,g,h,n){m=false;b=e;c=g;d=h;f=n;a()};this.addPoint=function(e,g){if(m){m=false;b=e;c=g;d=e;f=g}else{b=b<e?b:e;c=c<g?c:g;d=d>e?d:e;f=f>g?
-f:g}a()};this.add3Points=function(e,g,h,n,j,o){if(m){m=false;b=e<h?e<j?e:j:h<j?h:j;c=g<n?g<o?g:o:n<o?n:o;d=e>h?e>j?e:j:h>j?h:j;f=g>n?g>o?g:o:n>o?n:o}else{b=e<h?e<j?e<b?e:b:j<b?j:b:h<j?h<b?h:b:j<b?j:b;c=g<n?g<o?g<c?g:c:o<c?o:c:n<o?n<c?n:c:o<c?o:c;d=e>h?e>j?e>d?e:d:j>d?j:d:h>j?h>d?h:d:j>d?j:d;f=g>n?g>o?g>f?g:f:o>f?o:f:n>o?n>f?n:f:o>f?o:f}a()};this.addRectangle=function(e){if(m){m=false;b=e.getLeft();c=e.getTop();d=e.getRight();f=e.getBottom()}else{b=b<e.getLeft()?b:e.getLeft();c=c<e.getTop()?c:e.getTop();
+f:g}a()};this.add3Points=function(e,g,h,n,i,o){if(m){m=false;b=e<h?e<i?e:i:h<i?h:i;c=g<n?g<o?g:o:n<o?n:o;d=e>h?e>i?e:i:h>i?h:i;f=g>n?g>o?g:o:n>o?n:o}else{b=e<h?e<i?e<b?e:b:i<b?i:b:h<i?h<b?h:b:i<b?i:b;c=g<n?g<o?g<c?g:c:o<c?o:c:n<o?n<c?n:c:o<c?o:c;d=e>h?e>i?e>d?e:d:i>d?i:d:h>i?h>d?h:d:i>d?i:d;f=g>n?g>o?g>f?g:f:o>f?o:f:n>o?n>f?n:f:o>f?o:f}a()};this.addRectangle=function(e){if(m){m=false;b=e.getLeft();c=e.getTop();d=e.getRight();f=e.getBottom()}else{b=b<e.getLeft()?b:e.getLeft();c=c<e.getTop()?c:e.getTop();
 d=d>e.getRight()?d:e.getRight();f=f>e.getBottom()?f:e.getBottom()}a()};this.inflate=function(e){b=b-e;c=c-e;d=d+e;f=f+e;a()};this.minSelf=function(e){b=b>e.getLeft()?b:e.getLeft();c=c>e.getTop()?c:e.getTop();d=d<e.getRight()?d:e.getRight();f=f<e.getBottom()?f:e.getBottom();a()};this.intersects=function(a){return d<a.getLeft()||b>a.getRight()||f<a.getTop()||c>a.getBottom()?false:true};this.empty=function(){m=true;f=d=c=b=0;a()};this.isEmpty=function(){return m}};
 THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,d,f){return d+(a-b)*(f-d)/(c-b)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(0.5-Math.random())},sign:function(a){return a<0?-1:a>0?1:0}};THREE.Matrix3=function(){this.elements=new Float32Array(9)};
-THREE.Matrix3.prototype={constructor:THREE.Matrix3,getInverse:function(a){var b=a.elements,a=b[10]*b[5]-b[6]*b[9],c=-b[10]*b[1]+b[2]*b[9],d=b[6]*b[1]-b[2]*b[5],f=-b[10]*b[4]+b[6]*b[8],e=b[10]*b[0]-b[2]*b[8],g=-b[6]*b[0]+b[2]*b[4],m=b[9]*b[4]-b[5]*b[8],k=-b[9]*b[0]+b[1]*b[8],l=b[5]*b[0]-b[1]*b[4],b=b[0]*a+b[1]*f+b[2]*m;b===0&&console.warn("Matrix3.getInverse(): determinant == 0");var b=1/b,h=this.elements;h[0]=b*a;h[1]=b*c;h[2]=b*d;h[3]=b*f;h[4]=b*e;h[5]=b*g;h[6]=b*m;h[7]=b*k;h[8]=b*l;return this},
-transpose:function(){var a,b=this.elements;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};THREE.Matrix4=function(a,b,c,d,f,e,g,m,k,l,h,n,j,o,q,i){this.elements=new Float32Array(16);this.set(a!==void 0?a:1,b||0,c||0,d||0,f||0,e!==void 0?e:1,g||0,m||0,k||0,l||0,h!==void 0?h:1,n||0,j||0,o||0,q||0,i!==void 0?i:1)};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,f,e,g,m,k,l,h,n,j,o,q,i){var p=this.elements;p[0]=a;p[4]=b;p[8]=c;p[12]=d;p[1]=f;p[5]=e;p[9]=g;p[13]=m;p[2]=k;p[6]=l;p[10]=h;p[14]=n;p[3]=j;p[7]=o;p[11]=q;p[15]=i;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){a=a.elements;this.set(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15]);return this},lookAt:function(a,b,c){var d=this.elements,
-f=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;f.cross(c,g).normalize();if(f.length()===0){g.x=g.x+1.0E-4;f.cross(c,g).normalize()}e.cross(g,f);d[0]=f.x;d[4]=e.x;d[8]=g.x;d[1]=f.y;d[5]=e.y;d[9]=g.y;d[2]=f.z;d[6]=e.z;d[10]=g.z;return this},multiply:function(a,b){var c=a.elements,d=b.elements,f=this.elements,e=c[0],g=c[4],m=c[8],k=c[12],l=c[1],h=c[5],n=c[9],j=c[13],o=c[2],q=c[6],i=c[10],p=c[14],r=c[3],s=c[7],v=c[11],c=c[15],A=d[0],w=d[4],
-B=d[8],x=d[12],F=d[1],u=d[5],z=d[9],D=d[13],H=d[2],P=d[6],M=d[10],t=d[14],E=d[3],G=d[7],N=d[11],d=d[15];f[0]=e*A+g*F+m*H+k*E;f[4]=e*w+g*u+m*P+k*G;f[8]=e*B+g*z+m*M+k*N;f[12]=e*x+g*D+m*t+k*d;f[1]=l*A+h*F+n*H+j*E;f[5]=l*w+h*u+n*P+j*G;f[9]=l*B+h*z+n*M+j*N;f[13]=l*x+h*D+n*t+j*d;f[2]=o*A+q*F+i*H+p*E;f[6]=o*w+q*u+i*P+p*G;f[10]=o*B+q*z+i*M+p*N;f[14]=o*x+q*D+i*t+p*d;f[3]=r*A+s*F+v*H+c*E;f[7]=r*w+s*u+v*P+c*G;f[11]=r*B+s*z+v*M+c*N;f[15]=r*x+s*D+v*t+c*d;return this},multiplySelf:function(a){return this.multiply(this,
+THREE.Matrix3.prototype={constructor:THREE.Matrix3,getInverse:function(a){var b=a.elements,a=b[10]*b[5]-b[6]*b[9],c=-b[10]*b[1]+b[2]*b[9],d=b[6]*b[1]-b[2]*b[5],f=-b[10]*b[4]+b[6]*b[8],e=b[10]*b[0]-b[2]*b[8],g=-b[6]*b[0]+b[2]*b[4],m=b[9]*b[4]-b[5]*b[8],k=-b[9]*b[0]+b[1]*b[8],j=b[5]*b[0]-b[1]*b[4],b=b[0]*a+b[1]*f+b[2]*m;b===0&&console.warn("Matrix3.getInverse(): determinant == 0");var b=1/b,h=this.elements;h[0]=b*a;h[1]=b*c;h[2]=b*d;h[3]=b*f;h[4]=b*e;h[5]=b*g;h[6]=b*m;h[7]=b*k;h[8]=b*j;return this},
+transpose:function(){var a,b=this.elements;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};THREE.Matrix4=function(a,b,c,d,f,e,g,m,k,j,h,n,i,o,q,l){this.elements=new Float32Array(16);this.set(a!==void 0?a:1,b||0,c||0,d||0,f||0,e!==void 0?e:1,g||0,m||0,k||0,j||0,h!==void 0?h:1,n||0,i||0,o||0,q||0,l!==void 0?l:1)};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,f,e,g,m,k,j,h,n,i,o,q,l){var p=this.elements;p[0]=a;p[4]=b;p[8]=c;p[12]=d;p[1]=f;p[5]=e;p[9]=g;p[13]=m;p[2]=k;p[6]=j;p[10]=h;p[14]=n;p[3]=i;p[7]=o;p[11]=q;p[15]=l;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){a=a.elements;this.set(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15]);return this},lookAt:function(a,b,c){var d=this.elements,
+f=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;f.cross(c,g).normalize();if(f.length()===0){g.x=g.x+1.0E-4;f.cross(c,g).normalize()}e.cross(g,f);d[0]=f.x;d[4]=e.x;d[8]=g.x;d[1]=f.y;d[5]=e.y;d[9]=g.y;d[2]=f.z;d[6]=e.z;d[10]=g.z;return this},multiply:function(a,b){var c=a.elements,d=b.elements,f=this.elements,e=c[0],g=c[4],m=c[8],k=c[12],j=c[1],h=c[5],n=c[9],i=c[13],o=c[2],q=c[6],l=c[10],p=c[14],r=c[3],s=c[7],v=c[11],c=c[15],A=d[0],w=d[4],
+B=d[8],x=d[12],F=d[1],u=d[5],z=d[9],D=d[13],H=d[2],P=d[6],M=d[10],t=d[14],E=d[3],G=d[7],N=d[11],d=d[15];f[0]=e*A+g*F+m*H+k*E;f[4]=e*w+g*u+m*P+k*G;f[8]=e*B+g*z+m*M+k*N;f[12]=e*x+g*D+m*t+k*d;f[1]=j*A+h*F+n*H+i*E;f[5]=j*w+h*u+n*P+i*G;f[9]=j*B+h*z+n*M+i*N;f[13]=j*x+h*D+n*t+i*d;f[2]=o*A+q*F+l*H+p*E;f[6]=o*w+q*u+l*P+p*G;f[10]=o*B+q*z+l*M+p*N;f[14]=o*x+q*D+l*t+p*d;f[3]=r*A+s*F+v*H+c*E;f[7]=r*w+s*u+v*P+c*G;f[11]=r*B+s*z+v*M+c*N;f[15]=r*x+s*D+v*t+c*d;return this},multiplySelf:function(a){return this.multiply(this,
 a)},multiplyToArray:function(a,b,c){var d=this.elements;this.multiply(a,b);c[0]=d[0];c[1]=d[1];c[2]=d[2];c[3]=d[3];c[4]=d[4];c[5]=d[5];c[6]=d[6];c[7]=d[7];c[8]=d[8];c[9]=d[9];c[10]=d[10];c[11]=d[11];c[12]=d[12];c[13]=d[13];c[14]=d[14];c[15]=d[15];return this},multiplyScalar:function(a){var b=this.elements;b[0]=b[0]*a;b[4]=b[4]*a;b[8]=b[8]*a;b[12]=b[12]*a;b[1]=b[1]*a;b[5]=b[5]*a;b[9]=b[9]*a;b[13]=b[13]*a;b[2]=b[2]*a;b[6]=b[6]*a;b[10]=b[10]*a;b[14]=b[14]*a;b[3]=b[3]*a;b[7]=b[7]*a;b[11]=b[11]*a;b[15]=
 b[15]*a;return this},multiplyVector3:function(a){var b=this.elements,c=a.x,d=a.y,f=a.z,e=1/(b[3]*c+b[7]*d+b[11]*f+b[15]);a.x=(b[0]*c+b[4]*d+b[8]*f+b[12])*e;a.y=(b[1]*c+b[5]*d+b[9]*f+b[13])*e;a.z=(b[2]*c+b[6]*d+b[10]*f+b[14])*e;return a},multiplyVector4:function(a){var b=this.elements,c=a.x,d=a.y,f=a.z,e=a.w;a.x=b[0]*c+b[4]*d+b[8]*f+b[12]*e;a.y=b[1]*c+b[5]*d+b[9]*f+b[13]*e;a.z=b[2]*c+b[6]*d+b[10]*f+b[14]*e;a.w=b[3]*c+b[7]*d+b[11]*f+b[15]*e;return a},rotateAxis:function(a){var b=this.elements,c=a.x,
-d=a.y,f=a.z;a.x=c*b[0]+d*b[4]+f*b[8];a.y=c*b[1]+d*b[5]+f*b[9];a.z=c*b[2]+d*b[6]+f*b[10];a.normalize();return a},crossVector:function(a){var b=this.elements,c=new THREE.Vector4;c.x=b[0]*a.x+b[4]*a.y+b[8]*a.z+b[12]*a.w;c.y=b[1]*a.x+b[5]*a.y+b[9]*a.z+b[13]*a.w;c.z=b[2]*a.x+b[6]*a.y+b[10]*a.z+b[14]*a.w;c.w=a.w?b[3]*a.x+b[7]*a.y+b[11]*a.z+b[15]*a.w:1;return c},determinant:function(){var a=this.elements,b=a[0],c=a[4],d=a[8],f=a[12],e=a[1],g=a[5],m=a[9],k=a[13],l=a[2],h=a[6],n=a[10],j=a[14],o=a[3],q=a[7],
-i=a[11],a=a[15];return f*m*h*o-d*k*h*o-f*g*n*o+c*k*n*o+d*g*j*o-c*m*j*o-f*m*l*q+d*k*l*q+f*e*n*q-b*k*n*q-d*e*j*q+b*m*j*q+f*g*l*i-c*k*l*i-f*e*h*i+b*k*h*i+c*e*j*i-b*g*j*i-d*g*l*a+c*m*l*a+d*e*h*a-b*m*h*a-c*e*n*a+b*g*n*a},transpose:function(){var a=this.elements,b;b=a[1];a[1]=a[4];a[4]=b;b=a[2];a[2]=a[8];a[8]=b;b=a[6];a[6]=a[9];a[9]=b;b=a[3];a[3]=a[12];a[12]=b;b=a[7];a[7]=a[13];a[13]=b;b=a[11];a[11]=a[14];a[14]=b;return this},flattenToArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[1];a[2]=b[2];
+d=a.y,f=a.z;a.x=c*b[0]+d*b[4]+f*b[8];a.y=c*b[1]+d*b[5]+f*b[9];a.z=c*b[2]+d*b[6]+f*b[10];a.normalize();return a},crossVector:function(a){var b=this.elements,c=new THREE.Vector4;c.x=b[0]*a.x+b[4]*a.y+b[8]*a.z+b[12]*a.w;c.y=b[1]*a.x+b[5]*a.y+b[9]*a.z+b[13]*a.w;c.z=b[2]*a.x+b[6]*a.y+b[10]*a.z+b[14]*a.w;c.w=a.w?b[3]*a.x+b[7]*a.y+b[11]*a.z+b[15]*a.w:1;return c},determinant:function(){var a=this.elements,b=a[0],c=a[4],d=a[8],f=a[12],e=a[1],g=a[5],m=a[9],k=a[13],j=a[2],h=a[6],n=a[10],i=a[14],o=a[3],q=a[7],
+l=a[11],a=a[15];return f*m*h*o-d*k*h*o-f*g*n*o+c*k*n*o+d*g*i*o-c*m*i*o-f*m*j*q+d*k*j*q+f*e*n*q-b*k*n*q-d*e*i*q+b*m*i*q+f*g*j*l-c*k*j*l-f*e*h*l+b*k*h*l+c*e*i*l-b*g*i*l-d*g*j*a+c*m*j*a+d*e*h*a-b*m*h*a-c*e*n*a+b*g*n*a},transpose:function(){var a=this.elements,b;b=a[1];a[1]=a[4];a[4]=b;b=a[2];a[2]=a[8];a[8]=b;b=a[6];a[6]=a[9];a[9]=b;b=a[3];a[3]=a[12];a[12]=b;b=a[7];a[7]=a[13];a[13]=b;b=a[11];a[11]=a[14];a[14]=b;return this},flattenToArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[1];a[2]=b[2];
 a[3]=b[3];a[4]=b[4];a[5]=b[5];a[6]=b[6];a[7]=b[7];a[8]=b[8];a[9]=b[9];a[10]=b[10];a[11]=b[11];a[12]=b[12];a[13]=b[13];a[14]=b[14];a[15]=b[15];return a},flattenToArrayOffset:function(a,b){var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];a[b+9]=c[9];a[b+10]=c[10];a[b+11]=c[11];a[b+12]=c[12];a[b+13]=c[13];a[b+14]=c[14];a[b+15]=c[15];return a},getPosition:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[12],a[13],
-a[14])},setPosition:function(a){var b=this.elements;b[12]=a.x;b[13]=a.y;b[14]=a.z;return this},getColumnX:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[0],a[1],a[2])},getColumnY:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[4],a[5],a[6])},getColumnZ:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[8],a[9],a[10])},getInverse:function(a){var b=this.elements,c=a.elements,d=c[0],f=c[4],e=c[8],g=c[12],m=c[1],k=c[5],l=c[9],h=c[13],n=c[2],j=c[6],o=c[10],q=
-c[14],i=c[3],p=c[7],r=c[11],c=c[15];b[0]=l*q*p-h*o*p+h*j*r-k*q*r-l*j*c+k*o*c;b[4]=g*o*p-e*q*p-g*j*r+f*q*r+e*j*c-f*o*c;b[8]=e*h*p-g*l*p+g*k*r-f*h*r-e*k*c+f*l*c;b[12]=g*l*j-e*h*j-g*k*o+f*h*o+e*k*q-f*l*q;b[1]=h*o*i-l*q*i-h*n*r+m*q*r+l*n*c-m*o*c;b[5]=e*q*i-g*o*i+g*n*r-d*q*r-e*n*c+d*o*c;b[9]=g*l*i-e*h*i-g*m*r+d*h*r+e*m*c-d*l*c;b[13]=e*h*n-g*l*n+g*m*o-d*h*o-e*m*q+d*l*q;b[2]=k*q*i-h*j*i+h*n*p-m*q*p-k*n*c+m*j*c;b[6]=g*j*i-f*q*i-g*n*p+d*q*p+f*n*c-d*j*c;b[10]=f*h*i-g*k*i+g*m*p-d*h*p-f*m*c+d*k*c;b[14]=g*k*n-
-f*h*n-g*m*j+d*h*j+f*m*q-d*k*q;b[3]=l*j*i-k*o*i-l*n*p+m*o*p+k*n*r-m*j*r;b[7]=f*o*i-e*j*i+e*n*p-d*o*p-f*n*r+d*j*r;b[11]=e*k*i-f*l*i-e*m*p+d*l*p+f*m*r-d*k*r;b[15]=f*l*n-e*k*n+e*m*j-d*l*j-f*m*o+d*k*o;this.multiplyScalar(1/a.determinant());return this},setRotationFromEuler:function(a,b){var c=this.elements,d=a.x,f=a.y,e=a.z,g=Math.cos(d),d=Math.sin(d),m=Math.cos(f),f=Math.sin(f),k=Math.cos(e),e=Math.sin(e);switch(b){case "YXZ":var l=m*k,h=m*e,n=f*k,j=f*e;c[0]=l+j*d;c[4]=n*d-h;c[8]=g*f;c[1]=g*e;c[5]=g*
-k;c[9]=-d;c[2]=h*d-n;c[6]=j+l*d;c[10]=g*m;break;case "ZXY":l=m*k;h=m*e;n=f*k;j=f*e;c[0]=l-j*d;c[4]=-g*e;c[8]=n+h*d;c[1]=h+n*d;c[5]=g*k;c[9]=j-l*d;c[2]=-g*f;c[6]=d;c[10]=g*m;break;case "ZYX":l=g*k;h=g*e;n=d*k;j=d*e;c[0]=m*k;c[4]=n*f-h;c[8]=l*f+j;c[1]=m*e;c[5]=j*f+l;c[9]=h*f-n;c[2]=-f;c[6]=d*m;c[10]=g*m;break;case "YZX":l=g*m;h=g*f;n=d*m;j=d*f;c[0]=m*k;c[4]=j-l*e;c[8]=n*e+h;c[1]=e;c[5]=g*k;c[9]=-d*k;c[2]=-f*k;c[6]=h*e+n;c[10]=l-j*e;break;case "XZY":l=g*m;h=g*f;n=d*m;j=d*f;c[0]=m*k;c[4]=-e;c[8]=f*k;
-c[1]=l*e+j;c[5]=g*k;c[9]=h*e-n;c[2]=n*e-h;c[6]=d*k;c[10]=j*e+l;break;default:l=g*k;h=g*e;n=d*k;j=d*e;c[0]=m*k;c[4]=-m*e;c[8]=f;c[1]=h+n*f;c[5]=l-j*f;c[9]=-d*m;c[2]=j-l*f;c[6]=n+h*f;c[10]=g*m}return this},setRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,f=a.z,e=a.w,g=c+c,m=d+d,k=f+f,a=c*g,l=c*m,c=c*k,h=d*m,d=d*k,f=f*k,g=e*g,m=e*m,e=e*k;b[0]=1-(h+f);b[4]=l-e;b[8]=c+m;b[1]=l+e;b[5]=1-(a+f);b[9]=d-g;b[2]=c-m;b[6]=d+g;b[10]=1-(a+h);return this},compose:function(a,b,c){var d=this.elements,
+a[14])},setPosition:function(a){var b=this.elements;b[12]=a.x;b[13]=a.y;b[14]=a.z;return this},getColumnX:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[0],a[1],a[2])},getColumnY:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[4],a[5],a[6])},getColumnZ:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[8],a[9],a[10])},getInverse:function(a){var b=this.elements,c=a.elements,d=c[0],f=c[4],e=c[8],g=c[12],m=c[1],k=c[5],j=c[9],h=c[13],n=c[2],i=c[6],o=c[10],q=
+c[14],l=c[3],p=c[7],r=c[11],c=c[15];b[0]=j*q*p-h*o*p+h*i*r-k*q*r-j*i*c+k*o*c;b[4]=g*o*p-e*q*p-g*i*r+f*q*r+e*i*c-f*o*c;b[8]=e*h*p-g*j*p+g*k*r-f*h*r-e*k*c+f*j*c;b[12]=g*j*i-e*h*i-g*k*o+f*h*o+e*k*q-f*j*q;b[1]=h*o*l-j*q*l-h*n*r+m*q*r+j*n*c-m*o*c;b[5]=e*q*l-g*o*l+g*n*r-d*q*r-e*n*c+d*o*c;b[9]=g*j*l-e*h*l-g*m*r+d*h*r+e*m*c-d*j*c;b[13]=e*h*n-g*j*n+g*m*o-d*h*o-e*m*q+d*j*q;b[2]=k*q*l-h*i*l+h*n*p-m*q*p-k*n*c+m*i*c;b[6]=g*i*l-f*q*l-g*n*p+d*q*p+f*n*c-d*i*c;b[10]=f*h*l-g*k*l+g*m*p-d*h*p-f*m*c+d*k*c;b[14]=g*k*n-
+f*h*n-g*m*i+d*h*i+f*m*q-d*k*q;b[3]=j*i*l-k*o*l-j*n*p+m*o*p+k*n*r-m*i*r;b[7]=f*o*l-e*i*l+e*n*p-d*o*p-f*n*r+d*i*r;b[11]=e*k*l-f*j*l-e*m*p+d*j*p+f*m*r-d*k*r;b[15]=f*j*n-e*k*n+e*m*i-d*j*i-f*m*o+d*k*o;this.multiplyScalar(1/a.determinant());return this},setRotationFromEuler:function(a,b){var c=this.elements,d=a.x,f=a.y,e=a.z,g=Math.cos(d),d=Math.sin(d),m=Math.cos(f),f=Math.sin(f),k=Math.cos(e),e=Math.sin(e);switch(b){case "YXZ":var j=m*k,h=m*e,n=f*k,i=f*e;c[0]=j+i*d;c[4]=n*d-h;c[8]=g*f;c[1]=g*e;c[5]=g*
+k;c[9]=-d;c[2]=h*d-n;c[6]=i+j*d;c[10]=g*m;break;case "ZXY":j=m*k;h=m*e;n=f*k;i=f*e;c[0]=j-i*d;c[4]=-g*e;c[8]=n+h*d;c[1]=h+n*d;c[5]=g*k;c[9]=i-j*d;c[2]=-g*f;c[6]=d;c[10]=g*m;break;case "ZYX":j=g*k;h=g*e;n=d*k;i=d*e;c[0]=m*k;c[4]=n*f-h;c[8]=j*f+i;c[1]=m*e;c[5]=i*f+j;c[9]=h*f-n;c[2]=-f;c[6]=d*m;c[10]=g*m;break;case "YZX":j=g*m;h=g*f;n=d*m;i=d*f;c[0]=m*k;c[4]=i-j*e;c[8]=n*e+h;c[1]=e;c[5]=g*k;c[9]=-d*k;c[2]=-f*k;c[6]=h*e+n;c[10]=j-i*e;break;case "XZY":j=g*m;h=g*f;n=d*m;i=d*f;c[0]=m*k;c[4]=-e;c[8]=f*k;
+c[1]=j*e+i;c[5]=g*k;c[9]=h*e-n;c[2]=n*e-h;c[6]=d*k;c[10]=i*e+j;break;default:j=g*k;h=g*e;n=d*k;i=d*e;c[0]=m*k;c[4]=-m*e;c[8]=f;c[1]=h+n*f;c[5]=j-i*f;c[9]=-d*m;c[2]=i-j*f;c[6]=n+h*f;c[10]=g*m}return this},setRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,f=a.z,e=a.w,g=c+c,m=d+d,k=f+f,a=c*g,j=c*m,c=c*k,h=d*m,d=d*k,f=f*k,g=e*g,m=e*m,e=e*k;b[0]=1-(h+f);b[4]=j-e;b[8]=c+m;b[1]=j+e;b[5]=1-(a+f);b[9]=d-g;b[2]=c-m;b[6]=d+g;b[10]=1-(a+h);return this},compose:function(a,b,c){var d=this.elements,
 f=THREE.Matrix4.__m1,e=THREE.Matrix4.__m2;f.identity();f.setRotationFromQuaternion(b);e.makeScale(c.x,c.y,c.z);this.multiply(f,e);d[12]=a.x;d[13]=a.y;d[14]=a.z;return this},decompose:function(a,b,c){var d=this.elements,f=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;f.set(d[0],d[1],d[2]);e.set(d[4],d[5],d[6]);g.set(d[8],d[9],d[10]);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;
 c.x=f.length();c.y=e.length();c.z=g.length();a.x=d[12];a.y=d[13];a.z=d[14];d=THREE.Matrix4.__m1;d.copy(this);d.elements[0]=d.elements[0]/c.x;d.elements[1]=d.elements[1]/c.x;d.elements[2]=d.elements[2]/c.x;d.elements[4]=d.elements[4]/c.y;d.elements[5]=d.elements[5]/c.y;d.elements[6]=d.elements[6]/c.y;d.elements[8]=d.elements[8]/c.z;d.elements[9]=d.elements[9]/c.z;d.elements[10]=d.elements[10]/c.z;b.setFromRotationMatrix(d);return[a,b,c]},extractPosition:function(a){var b=this.elements,a=a.elements;
 b[12]=a[12];b[13]=a[13];b[14]=a[14];return this},extractRotation:function(a){var b=this.elements,a=a.elements,c=THREE.Matrix4.__v1,d=1/c.set(a[0],a[1],a[2]).length(),f=1/c.set(a[4],a[5],a[6]).length(),c=1/c.set(a[8],a[9],a[10]).length();b[0]=a[0]*d;b[1]=a[1]*d;b[2]=a[2]*d;b[4]=a[4]*f;b[5]=a[5]*f;b[6]=a[6]*f;b[8]=a[8]*c;b[9]=a[9]*c;b[10]=a[10]*c;return this},translate:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[12]=b[0]*c+b[4]*d+b[8]*a+b[12];b[13]=b[1]*c+b[5]*d+b[9]*a+b[13];b[14]=b[2]*c+b[6]*
-d+b[10]*a+b[14];b[15]=b[3]*c+b[7]*d+b[11]*a+b[15];return this},rotateX:function(a){var b=this.elements,c=b[4],d=b[5],f=b[6],e=b[7],g=b[8],m=b[9],k=b[10],l=b[11],h=Math.cos(a),a=Math.sin(a);b[4]=h*c+a*g;b[5]=h*d+a*m;b[6]=h*f+a*k;b[7]=h*e+a*l;b[8]=h*g-a*c;b[9]=h*m-a*d;b[10]=h*k-a*f;b[11]=h*l-a*e;return this},rotateY:function(a){var b=this.elements,c=b[0],d=b[1],f=b[2],e=b[3],g=b[8],m=b[9],k=b[10],l=b[11],h=Math.cos(a),a=Math.sin(a);b[0]=h*c-a*g;b[1]=h*d-a*m;b[2]=h*f-a*k;b[3]=h*e-a*l;b[8]=h*g+a*c;b[9]=
-h*m+a*d;b[10]=h*k+a*f;b[11]=h*l+a*e;return this},rotateZ:function(a){var b=this.elements,c=b[0],d=b[1],f=b[2],e=b[3],g=b[4],m=b[5],k=b[6],l=b[7],h=Math.cos(a),a=Math.sin(a);b[0]=h*c+a*g;b[1]=h*d+a*m;b[2]=h*f+a*k;b[3]=h*e+a*l;b[4]=h*g-a*c;b[5]=h*m-a*d;b[6]=h*k-a*f;b[7]=h*l-a*e;return this},rotateByAxis:function(a,b){var c=this.elements;if(a.x===1&&a.y===0&&a.z===0)return this.rotateX(b);if(a.x===0&&a.y===1&&a.z===0)return this.rotateY(b);if(a.x===0&&a.y===0&&a.z===1)return this.rotateZ(b);var d=a.x,
-f=a.y,e=a.z,g=Math.sqrt(d*d+f*f+e*e),d=d/g,f=f/g,e=e/g,g=d*d,m=f*f,k=e*e,l=Math.cos(b),h=Math.sin(b),n=1-l,j=d*f*n,o=d*e*n,n=f*e*n,d=d*h,q=f*h,h=e*h,e=g+(1-g)*l,g=j+h,f=o-q,j=j-h,m=m+(1-m)*l,h=n+d,o=o+q,n=n-d,k=k+(1-k)*l,l=c[0],d=c[1],q=c[2],i=c[3],p=c[4],r=c[5],s=c[6],v=c[7],A=c[8],w=c[9],B=c[10],x=c[11];c[0]=e*l+g*p+f*A;c[1]=e*d+g*r+f*w;c[2]=e*q+g*s+f*B;c[3]=e*i+g*v+f*x;c[4]=j*l+m*p+h*A;c[5]=j*d+m*r+h*w;c[6]=j*q+m*s+h*B;c[7]=j*i+m*v+h*x;c[8]=o*l+n*p+k*A;c[9]=o*d+n*r+k*w;c[10]=o*q+n*s+k*B;c[11]=
-o*i+n*v+k*x;return this},scale:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[0]=b[0]*c;b[4]=b[4]*d;b[8]=b[8]*a;b[1]=b[1]*c;b[5]=b[5]*d;b[9]=b[9]*a;b[2]=b[2]*c;b[6]=b[6]*d;b[10]=b[10]*a;b[3]=b[3]*c;b[7]=b[7]*d;b[11]=b[11]*a;return this},getMaxScaleOnAxis:function(){var a=this.elements;return Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1]+a[2]*a[2],Math.max(a[4]*a[4]+a[5]*a[5]+a[6]*a[6],a[8]*a[8]+a[9]*a[9]+a[10]*a[10])))},makeTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},
-makeRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},makeRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},makeRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),f=1-c,e=a.x,g=a.y,m=a.z,k=f*e,l=f*g;this.set(k*e+c,k*g-d*m,k*m+d*g,0,k*g+d*m,l*g+c,l*m-d*e,0,k*m-
-d*g,l*m+d*e,f*m*m+c,0,0,0,0,1);return this},makeScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},makeFrustum:function(a,b,c,d,f,e){var g=this.elements;g[0]=2*f/(b-a);g[4]=0;g[8]=(b+a)/(b-a);g[12]=0;g[1]=0;g[5]=2*f/(d-c);g[9]=(d+c)/(d-c);g[13]=0;g[2]=0;g[6]=0;g[10]=-(e+f)/(e-f);g[14]=-2*e*f/(e-f);g[3]=0;g[7]=0;g[11]=-1;g[15]=0;return this},makePerspective:function(a,b,c,d){var a=c*Math.tan(a*Math.PI/360),f=-a;return this.makeFrustum(f*b,a*b,f,a,c,d)},makeOrthographic:function(a,
-b,c,d,f,e){var g=this.elements,m=b-a,k=c-d,l=e-f;g[0]=2/m;g[4]=0;g[8]=0;g[12]=-((b+a)/m);g[1]=0;g[5]=2/k;g[9]=0;g[13]=-((c+d)/k);g[2]=0;g[6]=0;g[10]=-2/l;g[14]=-((e+f)/l);g[3]=0;g[7]=0;g[11]=0;g[15]=1;return this},clone:function(){var a=this.elements;return new THREE.Matrix4(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15])}};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;
+d+b[10]*a+b[14];b[15]=b[3]*c+b[7]*d+b[11]*a+b[15];return this},rotateX:function(a){var b=this.elements,c=b[4],d=b[5],f=b[6],e=b[7],g=b[8],m=b[9],k=b[10],j=b[11],h=Math.cos(a),a=Math.sin(a);b[4]=h*c+a*g;b[5]=h*d+a*m;b[6]=h*f+a*k;b[7]=h*e+a*j;b[8]=h*g-a*c;b[9]=h*m-a*d;b[10]=h*k-a*f;b[11]=h*j-a*e;return this},rotateY:function(a){var b=this.elements,c=b[0],d=b[1],f=b[2],e=b[3],g=b[8],m=b[9],k=b[10],j=b[11],h=Math.cos(a),a=Math.sin(a);b[0]=h*c-a*g;b[1]=h*d-a*m;b[2]=h*f-a*k;b[3]=h*e-a*j;b[8]=h*g+a*c;b[9]=
+h*m+a*d;b[10]=h*k+a*f;b[11]=h*j+a*e;return this},rotateZ:function(a){var b=this.elements,c=b[0],d=b[1],f=b[2],e=b[3],g=b[4],m=b[5],k=b[6],j=b[7],h=Math.cos(a),a=Math.sin(a);b[0]=h*c+a*g;b[1]=h*d+a*m;b[2]=h*f+a*k;b[3]=h*e+a*j;b[4]=h*g-a*c;b[5]=h*m-a*d;b[6]=h*k-a*f;b[7]=h*j-a*e;return this},rotateByAxis:function(a,b){var c=this.elements;if(a.x===1&&a.y===0&&a.z===0)return this.rotateX(b);if(a.x===0&&a.y===1&&a.z===0)return this.rotateY(b);if(a.x===0&&a.y===0&&a.z===1)return this.rotateZ(b);var d=a.x,
+f=a.y,e=a.z,g=Math.sqrt(d*d+f*f+e*e),d=d/g,f=f/g,e=e/g,g=d*d,m=f*f,k=e*e,j=Math.cos(b),h=Math.sin(b),n=1-j,i=d*f*n,o=d*e*n,n=f*e*n,d=d*h,q=f*h,h=e*h,e=g+(1-g)*j,g=i+h,f=o-q,i=i-h,m=m+(1-m)*j,h=n+d,o=o+q,n=n-d,k=k+(1-k)*j,j=c[0],d=c[1],q=c[2],l=c[3],p=c[4],r=c[5],s=c[6],v=c[7],A=c[8],w=c[9],B=c[10],x=c[11];c[0]=e*j+g*p+f*A;c[1]=e*d+g*r+f*w;c[2]=e*q+g*s+f*B;c[3]=e*l+g*v+f*x;c[4]=i*j+m*p+h*A;c[5]=i*d+m*r+h*w;c[6]=i*q+m*s+h*B;c[7]=i*l+m*v+h*x;c[8]=o*j+n*p+k*A;c[9]=o*d+n*r+k*w;c[10]=o*q+n*s+k*B;c[11]=
+o*l+n*v+k*x;return this},scale:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[0]=b[0]*c;b[4]=b[4]*d;b[8]=b[8]*a;b[1]=b[1]*c;b[5]=b[5]*d;b[9]=b[9]*a;b[2]=b[2]*c;b[6]=b[6]*d;b[10]=b[10]*a;b[3]=b[3]*c;b[7]=b[7]*d;b[11]=b[11]*a;return this},getMaxScaleOnAxis:function(){var a=this.elements;return Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1]+a[2]*a[2],Math.max(a[4]*a[4]+a[5]*a[5]+a[6]*a[6],a[8]*a[8]+a[9]*a[9]+a[10]*a[10])))},makeTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},
+makeRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},makeRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},makeRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),f=1-c,e=a.x,g=a.y,m=a.z,k=f*e,j=f*g;this.set(k*e+c,k*g-d*m,k*m+d*g,0,k*g+d*m,j*g+c,j*m-d*e,0,k*m-
+d*g,j*m+d*e,f*m*m+c,0,0,0,0,1);return this},makeScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},makeFrustum:function(a,b,c,d,f,e){var g=this.elements;g[0]=2*f/(b-a);g[4]=0;g[8]=(b+a)/(b-a);g[12]=0;g[1]=0;g[5]=2*f/(d-c);g[9]=(d+c)/(d-c);g[13]=0;g[2]=0;g[6]=0;g[10]=-(e+f)/(e-f);g[14]=-2*e*f/(e-f);g[3]=0;g[7]=0;g[11]=-1;g[15]=0;return this},makePerspective:function(a,b,c,d){var a=c*Math.tan(a*Math.PI/360),f=-a;return this.makeFrustum(f*b,a*b,f,a,c,d)},makeOrthographic:function(a,
+b,c,d,f,e){var g=this.elements,m=b-a,k=c-d,j=e-f;g[0]=2/m;g[4]=0;g[8]=0;g[12]=-((b+a)/m);g[1]=0;g[5]=2/k;g[9]=0;g[13]=-((c+d)/k);g[2]=0;g[6]=0;g[10]=-2/j;g[14]=-((e+f)/j);g[3]=0;g[7]=0;g[11]=0;g[15]=1;return this},clone:function(){var a=this.elements;return new THREE.Matrix4(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15])}};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;
 THREE.Matrix4.__m2=new THREE.Matrix4;
 THREE.Object3D=function(){this.id=THREE.Object3DCount++;this.name="";this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=false;this.renderDepth=null;this.rotationAutoUpdate=true;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
 true;this.quaternion=new THREE.Quaternion;this.useQuaternion=false;this.boundRadius=0;this.boundRadiusScale=1;this.visible=true;this.receiveShadow=this.castShadow=false;this.frustumCulled=true;this._vector=new THREE.Vector3};
@@ -69,24 +70,24 @@ this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.s
 b.parent;b!==void 0&&b instanceof THREE.Scene&&b.__addObject(a)}},remove:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=void 0;this.children.splice(b,1);for(b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.__removeObject(a)}},getChildByName:function(a,b){var c,d,f;c=0;for(d=this.children.length;c<d;c++){f=this.children[c];if(f.name===a)return f;if(b){f=f.getChildByName(a,b);if(f!==void 0)return f}}},updateMatrix:function(){this.matrix.setPosition(this.position);
 this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=true},updateMatrixWorld:function(a){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||a){this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,
 this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=false;a=true}for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)},worldToLocal:function(a){return THREE.Object3D.__m1.getInverse(this.matrixWorld).multiplyVector3(a)},localToWorld:function(a){return this.matrixWorld.multiplyVector3(a)}};THREE.Object3D.__m1=new THREE.Matrix4;THREE.Object3DCount=0;
-THREE.Projector=function(){function a(){var a=g[e]=g[e]||new THREE.RenderableObject;e++;return a}function b(){var a=l[k]=l[k]||new THREE.RenderableVertex;k++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,g=b.z+b.w,f=-a.z+a.w,h=-b.z+b.w;if(e>=0&&g>=0&&f>=0&&h>=0)return true;if(e<0&&g<0||f<0&&h<0)return false;e<0?c=Math.max(c,e/(e-g)):g<0&&(d=Math.min(d,e/(e-g)));f<0?c=Math.max(c,f/(f-h)):h<0&&(d=Math.min(d,f/(f-h)));if(d<c)return false;a.lerpSelf(b,c);b.lerpSelf(a,1-
-d);return true}var f,e,g=[],m,k,l=[],h,n,j=[],o,q=[],i,p,r=[],s,v,A=[],w={objects:[],sprites:[],lights:[],elements:[]},B=new THREE.Vector3,x=new THREE.Vector4,F=new THREE.Matrix4,u=new THREE.Matrix4,z=new THREE.Frustum,D=new THREE.Vector4,H=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);F.multiply(b.projectionMatrix,b.matrixWorldInverse);F.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
+THREE.Projector=function(){function a(){var a=g[e]=g[e]||new THREE.RenderableObject;e++;return a}function b(){var a=j[k]=j[k]||new THREE.RenderableVertex;k++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,g=b.z+b.w,f=-a.z+a.w,h=-b.z+b.w;if(e>=0&&g>=0&&f>=0&&h>=0)return true;if(e<0&&g<0||f<0&&h<0)return false;e<0?c=Math.max(c,e/(e-g)):g<0&&(d=Math.min(d,e/(e-g)));f<0?c=Math.max(c,f/(f-h)):h<0&&(d=Math.min(d,f/(f-h)));if(d<c)return false;a.lerpSelf(b,c);b.lerpSelf(a,1-
+d);return true}var f,e,g=[],m,k,j=[],h,n,i=[],o,q=[],l,p,r=[],s,v,A=[],w={objects:[],sprites:[],lights:[],elements:[]},B=new THREE.Vector3,x=new THREE.Vector4,F=new THREE.Matrix4,u=new THREE.Matrix4,z=new THREE.Frustum,D=new THREE.Vector4,H=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);F.multiply(b.projectionMatrix,b.matrixWorldInverse);F.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
 F.multiply(b.matrixWorld,b.projectionMatrixInverse);F.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){e=0;w.objects.length=0;w.sprites.length=0;w.lights.length=0;var g=function(b){if(b.visible!==false){if((b instanceof THREE.Mesh||b instanceof THREE.Line)&&(b.frustumCulled===false||z.contains(b))){B.copy(b.matrixWorld.getPosition());
 F.multiplyVector3(B);f=a();f.object=b;f.z=B.z;w.objects.push(f)}else if(b instanceof THREE.Sprite||b instanceof THREE.Particle){B.copy(b.matrixWorld.getPosition());F.multiplyVector3(B);f=a();f.object=b;f.z=B.z;w.sprites.push(f)}else b instanceof THREE.Light&&w.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&w.objects.sort(c);return w};this.projectScene=function(a,e,g){var f=e.near,G=e.far,B=false,Q,O,y,S,L,U,T,W,C,J,I,K,R,ja,da;v=p=o=n=0;w.elements.length=0;if(e.parent===
 void 0){console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it...");a.add(e)}a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);F.multiply(e.projectionMatrix,e.matrixWorldInverse);z.setFromMatrix(F);w=this.projectGraph(a,false);a=0;for(Q=w.objects.length;a<Q;a++){C=w.objects[a].object;J=C.matrixWorld;k=0;if(C instanceof THREE.Mesh){I=C.geometry;K=C.geometry.materials;S=I.vertices;R=I.faces;ja=I.faceVertexUvs;I=C.matrixRotationWorld.extractRotation(J);O=0;for(y=
-S.length;O<y;O++){m=b();m.positionWorld.copy(S[O]);J.multiplyVector3(m.positionWorld);m.positionScreen.copy(m.positionWorld);F.multiplyVector4(m.positionScreen);m.positionScreen.x=m.positionScreen.x/m.positionScreen.w;m.positionScreen.y=m.positionScreen.y/m.positionScreen.w;m.visible=m.positionScreen.z>f&&m.positionScreen.z<G}S=0;for(O=R.length;S<O;S++){y=R[S];if(y instanceof THREE.Face3){L=l[y.a];U=l[y.b];T=l[y.c];if(L.visible&&U.visible&&T.visible){B=(T.positionScreen.x-L.positionScreen.x)*(U.positionScreen.y-
-L.positionScreen.y)-(T.positionScreen.y-L.positionScreen.y)*(U.positionScreen.x-L.positionScreen.x)<0;if(C.doubleSided||B!=C.flipSided){W=j[n]=j[n]||new THREE.RenderableFace3;n++;h=W;h.v1.copy(L);h.v2.copy(U);h.v3.copy(T)}else continue}else continue}else if(y instanceof THREE.Face4){L=l[y.a];U=l[y.b];T=l[y.c];W=l[y.d];if(L.visible&&U.visible&&T.visible&&W.visible){B=(W.positionScreen.x-L.positionScreen.x)*(U.positionScreen.y-L.positionScreen.y)-(W.positionScreen.y-L.positionScreen.y)*(U.positionScreen.x-
+S.length;O<y;O++){m=b();m.positionWorld.copy(S[O]);J.multiplyVector3(m.positionWorld);m.positionScreen.copy(m.positionWorld);F.multiplyVector4(m.positionScreen);m.positionScreen.x=m.positionScreen.x/m.positionScreen.w;m.positionScreen.y=m.positionScreen.y/m.positionScreen.w;m.visible=m.positionScreen.z>f&&m.positionScreen.z<G}S=0;for(O=R.length;S<O;S++){y=R[S];if(y instanceof THREE.Face3){L=j[y.a];U=j[y.b];T=j[y.c];if(L.visible&&U.visible&&T.visible){B=(T.positionScreen.x-L.positionScreen.x)*(U.positionScreen.y-
+L.positionScreen.y)-(T.positionScreen.y-L.positionScreen.y)*(U.positionScreen.x-L.positionScreen.x)<0;if(C.doubleSided||B!=C.flipSided){W=i[n]=i[n]||new THREE.RenderableFace3;n++;h=W;h.v1.copy(L);h.v2.copy(U);h.v3.copy(T)}else continue}else continue}else if(y instanceof THREE.Face4){L=j[y.a];U=j[y.b];T=j[y.c];W=j[y.d];if(L.visible&&U.visible&&T.visible&&W.visible){B=(W.positionScreen.x-L.positionScreen.x)*(U.positionScreen.y-L.positionScreen.y)-(W.positionScreen.y-L.positionScreen.y)*(U.positionScreen.x-
 L.positionScreen.x)<0||(U.positionScreen.x-T.positionScreen.x)*(W.positionScreen.y-T.positionScreen.y)-(U.positionScreen.y-T.positionScreen.y)*(W.positionScreen.x-T.positionScreen.x)<0;if(C.doubleSided||B!=C.flipSided){da=q[o]=q[o]||new THREE.RenderableFace4;o++;h=da;h.v1.copy(L);h.v2.copy(U);h.v3.copy(T);h.v4.copy(W)}else continue}else continue}h.normalWorld.copy(y.normal);!B&&(C.flipSided||C.doubleSided)&&h.normalWorld.negate();I.multiplyVector3(h.normalWorld);h.centroidWorld.copy(y.centroid);J.multiplyVector3(h.centroidWorld);
 h.centroidScreen.copy(h.centroidWorld);F.multiplyVector3(h.centroidScreen);T=y.vertexNormals;L=0;for(U=T.length;L<U;L++){W=h.vertexNormalsWorld[L];W.copy(T[L]);!B&&(C.flipSided||C.doubleSided)&&W.negate();I.multiplyVector3(W)}L=0;for(U=ja.length;L<U;L++)if(da=ja[L][S]){T=0;for(W=da.length;T<W;T++)h.uvs[L][T]=da[T]}h.material=C.material;h.faceMaterial=y.materialIndex!==null?K[y.materialIndex]:null;h.z=h.centroidScreen.z;w.elements.push(h)}}else if(C instanceof THREE.Line){u.multiply(F,J);S=C.geometry.vertices;
-L=b();L.positionScreen.copy(S[0]);u.multiplyVector4(L.positionScreen);J=C.type===THREE.LinePieces?2:1;O=1;for(y=S.length;O<y;O++){L=b();L.positionScreen.copy(S[O]);u.multiplyVector4(L.positionScreen);if(!((O+1)%J>0)){U=l[k-2];D.copy(L.positionScreen);H.copy(U.positionScreen);if(d(D,H)){D.multiplyScalar(1/D.w);H.multiplyScalar(1/H.w);K=r[p]=r[p]||new THREE.RenderableLine;p++;i=K;i.v1.positionScreen.copy(D);i.v2.positionScreen.copy(H);i.z=Math.max(D.z,H.z);i.material=C.material;w.elements.push(i)}}}}}a=
+L=b();L.positionScreen.copy(S[0]);u.multiplyVector4(L.positionScreen);J=C.type===THREE.LinePieces?2:1;O=1;for(y=S.length;O<y;O++){L=b();L.positionScreen.copy(S[O]);u.multiplyVector4(L.positionScreen);if(!((O+1)%J>0)){U=j[k-2];D.copy(L.positionScreen);H.copy(U.positionScreen);if(d(D,H)){D.multiplyScalar(1/D.w);H.multiplyScalar(1/H.w);K=r[p]=r[p]||new THREE.RenderableLine;p++;l=K;l.v1.positionScreen.copy(D);l.v2.positionScreen.copy(H);l.z=Math.max(D.z,H.z);l.material=C.material;w.elements.push(l)}}}}}a=
 0;for(Q=w.sprites.length;a<Q;a++){C=w.sprites[a].object;J=C.matrixWorld;if(C instanceof THREE.Particle){x.set(J.elements[12],J.elements[13],J.elements[14],1);F.multiplyVector4(x);x.z=x.z/x.w;if(x.z>0&&x.z<1){f=A[v]=A[v]||new THREE.RenderableParticle;v++;s=f;s.x=x.x/x.w;s.y=x.y/x.w;s.z=x.z;s.rotation=C.rotation.z;s.scale.x=C.scale.x*Math.abs(s.x-(x.x+e.projectionMatrix.elements[0])/(x.w+e.projectionMatrix.elements[12]));s.scale.y=C.scale.y*Math.abs(s.y-(x.y+e.projectionMatrix.elements[5])/(x.w+e.projectionMatrix.elements[13]));
 s.material=C.material;w.elements.push(s)}}}g&&w.elements.sort(c);return w}};THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==void 0?d:1};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a,b){var c=b||"XYZ",d=Math.cos(a.x/2),f=Math.cos(a.y/2),e=Math.cos(a.z/2),g=Math.sin(a.x/2),m=Math.sin(a.y/2),k=Math.sin(a.z/2);switch(c){case "YXZ":this.x=g*f*e+d*m*k;this.y=d*m*e-g*f*k;this.z=d*f*k-g*m*e;this.w=d*f*e+g*m*k;break;case "ZXY":this.x=g*f*e-d*m*k;this.y=d*m*e+g*f*
 k;this.z=d*f*k+g*m*e;this.w=d*f*e-g*m*k;break;case "ZYX":this.x=g*f*e-d*m*k;this.y=d*m*e+g*f*k;this.z=d*f*k-g*m*e;this.w=d*f*e+g*m*k;break;case "YZX":this.x=g*f*e+d*m*k;this.y=d*m*e+g*f*k;this.z=d*f*k-g*m*e;this.w=d*f*e-g*m*k;break;case "XZY":this.x=g*f*e-d*m*k;this.y=d*m*e-g*f*k;this.z=d*f*k+g*m*e;this.w=d*f*e+g*m*k;break;default:this.x=g*f*e+d*m*k;this.y=d*m*e-g*f*k;this.z=d*f*k+g*m*e;this.w=d*f*e-g*m*k}return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);this.x=a.x*d;this.y=a.y*
-d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=a.elements,c=b[0],a=b[4],d=b[8],f=b[1],e=b[5],g=b[9],m=b[2],k=b[6],b=b[10],l=c+e+b;if(l>0){c=0.5/Math.sqrt(l+1);this.w=0.25/c;this.x=(k-g)*c;this.y=(d-m)*c;this.z=(f-a)*c}else if(c>e&&c>b){c=2*Math.sqrt(1+c-e-b);this.w=(k-g)/c;this.x=0.25*c;this.y=(a+f)/c;this.z=(d+m)/c}else if(e>b){c=2*Math.sqrt(1+e-c-b);this.w=(d-m)/c;this.x=(a+f)/c;this.y=0.25*c;this.z=(g+k)/c}else{c=2*Math.sqrt(1+b-c-e);this.w=(f-a)/c;this.x=
+d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=a.elements,c=b[0],a=b[4],d=b[8],f=b[1],e=b[5],g=b[9],m=b[2],k=b[6],b=b[10],j=c+e+b;if(j>0){c=0.5/Math.sqrt(j+1);this.w=0.25/c;this.x=(k-g)*c;this.y=(d-m)*c;this.z=(f-a)*c}else if(c>e&&c>b){c=2*Math.sqrt(1+c-e-b);this.w=(k-g)/c;this.x=0.25*c;this.y=(a+f)/c;this.z=(d+m)/c}else if(e>b){c=2*Math.sqrt(1+e-c-b);this.w=(d-m)/c;this.x=(a+f)/c;this.y=0.25*c;this.z=(g+k)/c}else{c=2*Math.sqrt(1+b-c-e);this.w=(f-a)/c;this.x=
 (d+m)/c;this.y=(g+k)/c;this.z=0.25*c}return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x=this.x*-1;this.y=this.y*-1;this.z=this.z*-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a===0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x=this.x*a;this.y=
 this.y*a;this.z=this.z*a;this.w=this.w*a}return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,f=this.w,e=a.x,g=a.y,m=a.z,a=a.w;this.x=b*a+f*e+c*m-d*g;this.y=c*a+f*g+d*e-b*m;this.z=d*a+f*m+b*g-c*e;this.w=f*a-b*e-c*g-d*m;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,
-e=this.x,g=this.y,m=this.z,k=this.w,l=k*c+g*f-m*d,h=k*d+m*c-e*f,n=k*f+e*d-g*c,c=-e*c-g*d-m*f;b.x=l*k+c*-e+h*-m-n*-g;b.y=h*k+c*-g+n*-e-l*-m;b.z=n*k+c*-m+l*-g-h*-e;return b},slerpSelf:function(a,b){var c=this.x,d=this.y,f=this.z,e=this.w,g=e*a.w+c*a.x+d*a.y+f*a.z;if(g<0){this.w=-a.w;this.x=-a.x;this.y=-a.y;this.z=-a.z;g=-g}else this.copy(a);if(g>=1){this.w=e;this.x=c;this.y=d;this.z=f;return this}var m=Math.acos(g),k=Math.sqrt(1-g*g);if(Math.abs(k)<0.0010){this.w=0.5*(e+this.w);this.x=0.5*(c+this.x);
+e=this.x,g=this.y,m=this.z,k=this.w,j=k*c+g*f-m*d,h=k*d+m*c-e*f,n=k*f+e*d-g*c,c=-e*c-g*d-m*f;b.x=j*k+c*-e+h*-m-n*-g;b.y=h*k+c*-g+n*-e-j*-m;b.z=n*k+c*-m+j*-g-h*-e;return b},slerpSelf:function(a,b){var c=this.x,d=this.y,f=this.z,e=this.w,g=e*a.w+c*a.x+d*a.y+f*a.z;if(g<0){this.w=-a.w;this.x=-a.x;this.y=-a.y;this.z=-a.z;g=-g}else this.copy(a);if(g>=1){this.w=e;this.x=c;this.y=d;this.z=f;return this}var m=Math.acos(g),k=Math.sqrt(1-g*g);if(Math.abs(k)<0.0010){this.w=0.5*(e+this.w);this.x=0.5*(c+this.x);
 this.y=0.5*(d+this.y);this.z=0.5*(f+this.z);return this}g=Math.sin((1-b)*m)/k;m=Math.sin(b*m)/k;this.w=e*g+this.w*m;this.x=c*g+this.x*m;this.y=d*g+this.y*m;this.z=f*g+this.z*m;return this},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)}};
 THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(f<0){c.w=-b.w;c.x=-b.x;c.y=-b.y;c.z=-b.z;f=-f}else c.copy(b);if(Math.abs(f)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var b=Math.acos(f),e=Math.sqrt(1-f*f);if(Math.abs(e)<0.0010){c.w=0.5*(a.w+c.w);c.x=0.5*(a.x+c.x);c.y=0.5*(a.y+c.y);c.z=0.5*(a.z+c.z);return c}f=Math.sin((1-d)*b)/e;d=Math.sin(d*b)/e;c.w=a.w*f+c.w*d;c.x=a.x*f+c.x*d;c.y=a.y*f+c.y*d;c.z=a.z*f+c.z*d;return c};THREE.Vertex=function(){console.warn("THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead.")};
 THREE.Face3=function(a,b,c,d,f,e){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=e;this.centroid=new THREE.Vector3};
@@ -101,9 +102,9 @@ b;a++){c=this.faces[a];d=this.vertices[c.a];f=this.vertices[c.b];e=this.vertices
 else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal);d[c.d].addSelf(c.normal)}}a=0;
 for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},computeMorphNormals:function(){var a,b,c,d,f;c=0;for(d=this.faces.length;c<d;c++){f=this.faces[c];f.__originalFaceNormal?
 f.__originalFaceNormal.copy(f.normal):f.__originalFaceNormal=f.normal.clone();if(!f.__originalVertexNormals)f.__originalVertexNormals=[];a=0;for(b=f.vertexNormals.length;a<b;a++)f.__originalVertexNormals[a]?f.__originalVertexNormals[a].copy(f.vertexNormals[a]):f.__originalVertexNormals[a]=f.vertexNormals[a].clone()}var e=new THREE.Geometry;e.faces=this.faces;a=0;for(b=this.morphTargets.length;a<b;a++){if(!this.morphNormals[a]){this.morphNormals[a]={};this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=
-[];var g=this.morphNormals[a].faceNormals,m=this.morphNormals[a].vertexNormals,k,l;c=0;for(d=this.faces.length;c<d;c++){f=this.faces[c];k=new THREE.Vector3;l=f instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3};g.push(k);m.push(l)}}g=this.morphNormals[a];e.vertices=this.morphTargets[a].vertices;e.computeFaceNormals();e.computeVertexNormals();c=0;for(d=this.faces.length;c<d;c++){f=this.faces[c];
-k=g.faceNormals[c];l=g.vertexNormals[c];k.copy(f.normal);if(f instanceof THREE.Face3){l.a.copy(f.vertexNormals[0]);l.b.copy(f.vertexNormals[1]);l.c.copy(f.vertexNormals[2])}else{l.a.copy(f.vertexNormals[0]);l.b.copy(f.vertexNormals[1]);l.c.copy(f.vertexNormals[2]);l.d.copy(f.vertexNormals[3])}}}c=0;for(d=this.faces.length;c<d;c++){f=this.faces[c];f.normal=f.__originalFaceNormal;f.vertexNormals=f.__originalVertexNormals}},computeTangents:function(){function a(a,b,c,d,e,f,L){m=a.vertices[b];k=a.vertices[c];
-l=a.vertices[d];h=g[e];n=g[f];j=g[L];o=k.x-m.x;q=l.x-m.x;i=k.y-m.y;p=l.y-m.y;r=k.z-m.z;s=l.z-m.z;v=n.u-h.u;A=j.u-h.u;w=n.v-h.v;B=j.v-h.v;x=1/(v*B-A*w);D.set((B*o-w*q)*x,(B*i-w*p)*x,(B*r-w*s)*x);H.set((v*q-A*o)*x,(v*p-A*i)*x,(v*s-A*r)*x);u[b].addSelf(D);u[c].addSelf(D);u[d].addSelf(D);z[b].addSelf(H);z[c].addSelf(H);z[d].addSelf(H)}var b,c,d,f,e,g,m,k,l,h,n,j,o,q,i,p,r,s,v,A,w,B,x,F,u=[],z=[],D=new THREE.Vector3,H=new THREE.Vector3,P=new THREE.Vector3,M=new THREE.Vector3,t=new THREE.Vector3;b=0;for(c=
+[];var g=this.morphNormals[a].faceNormals,m=this.morphNormals[a].vertexNormals,k,j;c=0;for(d=this.faces.length;c<d;c++){f=this.faces[c];k=new THREE.Vector3;j=f instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3};g.push(k);m.push(j)}}g=this.morphNormals[a];e.vertices=this.morphTargets[a].vertices;e.computeFaceNormals();e.computeVertexNormals();c=0;for(d=this.faces.length;c<d;c++){f=this.faces[c];
+k=g.faceNormals[c];j=g.vertexNormals[c];k.copy(f.normal);if(f instanceof THREE.Face3){j.a.copy(f.vertexNormals[0]);j.b.copy(f.vertexNormals[1]);j.c.copy(f.vertexNormals[2])}else{j.a.copy(f.vertexNormals[0]);j.b.copy(f.vertexNormals[1]);j.c.copy(f.vertexNormals[2]);j.d.copy(f.vertexNormals[3])}}}c=0;for(d=this.faces.length;c<d;c++){f=this.faces[c];f.normal=f.__originalFaceNormal;f.vertexNormals=f.__originalVertexNormals}},computeTangents:function(){function a(a,b,c,d,e,f,L){m=a.vertices[b];k=a.vertices[c];
+j=a.vertices[d];h=g[e];n=g[f];i=g[L];o=k.x-m.x;q=j.x-m.x;l=k.y-m.y;p=j.y-m.y;r=k.z-m.z;s=j.z-m.z;v=n.u-h.u;A=i.u-h.u;w=n.v-h.v;B=i.v-h.v;x=1/(v*B-A*w);D.set((B*o-w*q)*x,(B*l-w*p)*x,(B*r-w*s)*x);H.set((v*q-A*o)*x,(v*p-A*l)*x,(v*s-A*r)*x);u[b].addSelf(D);u[c].addSelf(D);u[d].addSelf(D);z[b].addSelf(H);z[c].addSelf(H);z[d].addSelf(H)}var b,c,d,f,e,g,m,k,j,h,n,i,o,q,l,p,r,s,v,A,w,B,x,F,u=[],z=[],D=new THREE.Vector3,H=new THREE.Vector3,P=new THREE.Vector3,M=new THREE.Vector3,t=new THREE.Vector3;b=0;for(c=
 this.vertices.length;b<c;b++){u[b]=new THREE.Vector3;z[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){e=this.faces[b];g=this.faceVertexUvs[0][b];if(e instanceof THREE.Face3)a(this,e.a,e.b,e.c,0,1,2);else if(e instanceof THREE.Face4){a(this,e.a,e.b,e.d,0,1,3);a(this,e.b,e.c,e.d,1,2,3)}}var E=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){e=this.faces[b];for(d=0;d<e.vertexNormals.length;d++){t.copy(e.vertexNormals[d]);f=e[E[d]];F=u[f];P.copy(F);P.subSelf(t.multiplyScalar(t.dot(F))).normalize();
 M.cross(e.vertexNormals[d],F);f=M.dot(z[f]);f=f<0?-1:1;e.vertexTangents[d]=new THREE.Vector4(P.x,P.y,P.z,f)}}this.hasTangents=true},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3};if(this.vertices.length>0){var a;a=this.vertices[0];this.boundingBox.min.copy(a);this.boundingBox.max.copy(a);for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,f=this.vertices.length;d<f;d++){a=this.vertices[d];if(a.x<b.x)b.x=a.x;else if(a.x>c.x)c.x=
 a.x;if(a.y<b.y)b.y=a.y;else if(a.y>c.y)c.y=a.y;if(a.z<b.z)b.z=a.z;else if(a.z>c.z)c.z=a.z}}else{this.boundingBox.min.set(0,0,0);this.boundingBox.max.set(0,0,0)}},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere={radius:0};for(var a,b=0,c=0,d=this.vertices.length;c<d;c++){a=this.vertices[c].length();a>b&&(b=a)}this.boundingSphere.radius=b},mergeVertices:function(){var a={},b=[],c=[],d,f=Math.pow(10,4),e,g,m;e=0;for(g=this.vertices.length;e<g;e++){d=this.vertices[e];d=[Math.round(d.x*
@@ -120,61 +121,61 @@ THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THRE
 THREE.Loader.prototype={constructor:THREE.Loader,crossOrigin:"anonymous",addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ",b=a.total?b+((100*a.loaded/
 a.total).toFixed(0)+"%"):b+((a.loaded/1E3).toFixed(2)+" KB");this.statusDomElement.innerHTML=b},extractUrlBase:function(a){a=a.split("/");a.pop();return(a.length<1?".":a.join("/"))+"/"},initMaterials:function(a,b,c){a.materials=[];for(var d=0;d<b.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(b[d],c)},hasNormals:function(a){var b,c,d=a.materials.length;for(c=0;c<d;c++){b=a.materials[c];if(b instanceof THREE.ShaderMaterial)return true}return false},createMaterial:function(a,b){function c(a){a=
 Math.log(a)/Math.LN2;return Math.floor(a)==a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function f(a,b){var e=new Image;e.onload=function(){if(!c(this.width)||!c(this.height)){var b=d(this.width),e=d(this.height);a.image.width=b;a.image.height=e;a.image.getContext("2d").drawImage(this,0,0,b,e)}else a.image=this;a.needsUpdate=true};e.crossOrigin=m.crossOrigin;e.src=b}function e(a,c,d,e,g,h){var m=document.createElement("canvas");a[c]=new THREE.Texture(m);a[c].sourceFile=
-d;if(e){a[c].repeat.set(e[0],e[1]);if(e[0]!=1)a[c].wrapS=THREE.RepeatWrapping;if(e[1]!=1)a[c].wrapT=THREE.RepeatWrapping}g&&a[c].offset.set(g[0],g[1]);if(h){e={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(e[h[0]]!==void 0)a[c].wrapS=e[h[0]];if(e[h[1]]!==void 0)a[c].wrapT=e[h[1]]}f(a[c],b+"/"+d)}function g(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var m=this,k="MeshLambertMaterial",l={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};
-if(a.shading){var h=a.shading.toLowerCase();h==="phong"?k="MeshPhongMaterial":h==="basic"&&(k="MeshBasicMaterial")}if(a.blending!==void 0&&THREE[a.blending]!==void 0)l.blending=THREE[a.blending];if(a.transparent!==void 0||a.opacity<1)l.transparent=a.transparent;if(a.depthTest!==void 0)l.depthTest=a.depthTest;if(a.depthWrite!==void 0)l.depthWrite=a.depthWrite;if(a.vertexColors!==void 0)if(a.vertexColors=="face")l.vertexColors=THREE.FaceColors;else if(a.vertexColors)l.vertexColors=THREE.VertexColors;
-if(a.colorDiffuse)l.color=g(a.colorDiffuse);else if(a.DbgColor)l.color=a.DbgColor;if(a.colorSpecular)l.specular=g(a.colorSpecular);if(a.colorAmbient)l.ambient=g(a.colorAmbient);if(a.transparency)l.opacity=a.transparency;if(a.specularCoef)l.shininess=a.specularCoef;a.mapDiffuse&&b&&e(l,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&e(l,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&e(l,"normalMap",a.mapNormal,a.mapNormalRepeat,
-a.mapNormalOffset,a.mapNormalWrap);a.mapSpecular&&b&&e(l,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){k=THREE.ShaderUtils.lib.normal;h=THREE.UniformsUtils.clone(k.uniforms);h.tNormal.texture=l.normalMap;if(a.mapNormalFactor)h.uNormalScale.value=a.mapNormalFactor;if(l.map){h.tDiffuse.texture=l.map;h.enableDiffuse.value=true}if(l.specularMap){h.tSpecular.texture=l.specularMap;h.enableSpecular.value=true}if(l.lightMap){h.tAO.texture=l.lightMap;
-h.enableAO.value=true}h.uDiffuseColor.value.setHex(l.color);h.uSpecularColor.value.setHex(l.specular);h.uAmbientColor.value.setHex(l.ambient);h.uShininess.value=l.shininess;if(l.opacity!==void 0)h.uOpacity.value=l.opacity;l=new THREE.ShaderMaterial({fragmentShader:k.fragmentShader,vertexShader:k.vertexShader,uniforms:h,lights:true,fog:true})}else l=new THREE[k](l);if(a.DbgName!==void 0)l.name=a.DbgName;return l}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};
+d;if(e){a[c].repeat.set(e[0],e[1]);if(e[0]!=1)a[c].wrapS=THREE.RepeatWrapping;if(e[1]!=1)a[c].wrapT=THREE.RepeatWrapping}g&&a[c].offset.set(g[0],g[1]);if(h){e={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(e[h[0]]!==void 0)a[c].wrapS=e[h[0]];if(e[h[1]]!==void 0)a[c].wrapT=e[h[1]]}f(a[c],b+"/"+d)}function g(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var m=this,k="MeshLambertMaterial",j={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};
+if(a.shading){var h=a.shading.toLowerCase();h==="phong"?k="MeshPhongMaterial":h==="basic"&&(k="MeshBasicMaterial")}if(a.blending!==void 0&&THREE[a.blending]!==void 0)j.blending=THREE[a.blending];if(a.transparent!==void 0||a.opacity<1)j.transparent=a.transparent;if(a.depthTest!==void 0)j.depthTest=a.depthTest;if(a.depthWrite!==void 0)j.depthWrite=a.depthWrite;if(a.vertexColors!==void 0)if(a.vertexColors=="face")j.vertexColors=THREE.FaceColors;else if(a.vertexColors)j.vertexColors=THREE.VertexColors;
+if(a.colorDiffuse)j.color=g(a.colorDiffuse);else if(a.DbgColor)j.color=a.DbgColor;if(a.colorSpecular)j.specular=g(a.colorSpecular);if(a.colorAmbient)j.ambient=g(a.colorAmbient);if(a.transparency)j.opacity=a.transparency;if(a.specularCoef)j.shininess=a.specularCoef;a.mapDiffuse&&b&&e(j,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&e(j,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&e(j,"normalMap",a.mapNormal,a.mapNormalRepeat,
+a.mapNormalOffset,a.mapNormalWrap);a.mapSpecular&&b&&e(j,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){k=THREE.ShaderUtils.lib.normal;h=THREE.UniformsUtils.clone(k.uniforms);h.tNormal.texture=j.normalMap;if(a.mapNormalFactor)h.uNormalScale.value=a.mapNormalFactor;if(j.map){h.tDiffuse.texture=j.map;h.enableDiffuse.value=true}if(j.specularMap){h.tSpecular.texture=j.specularMap;h.enableSpecular.value=true}if(j.lightMap){h.tAO.texture=j.lightMap;
+h.enableAO.value=true}h.uDiffuseColor.value.setHex(j.color);h.uSpecularColor.value.setHex(j.specular);h.uAmbientColor.value.setHex(j.ambient);h.uShininess.value=j.shininess;if(j.opacity!==void 0)h.uOpacity.value=j.opacity;j=new THREE.ShaderMaterial({fragmentShader:k.fragmentShader,vertexShader:k.vertexShader,uniforms:h,lights:true,fog:true})}else j=new THREE[k](j);if(a.DbgName!==void 0)j.name=a.DbgName;return j}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};
 THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.load=function(a,b,c,d){var c=c?c:this.extractUrlBase(a),d=d?d:this.extractUrlBase(a),f=this.showProgress?THREE.Loader.prototype.updateProgress:null;this.onLoadStart();this.loadAjaxJSON(this,a,b,c,d,f)};
 THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,b,c,d,f,e){var g=new XMLHttpRequest;g.onreadystatechange=function(){if(g.readyState==4)if(g.status==200||g.status==0){var m=JSON.parse(g.responseText);a.loadAjaxBuffers(m,c,f,d,e)}else console.error("THREE.BinaryLoader: Couldn't load ["+b+"] ["+g.status+"]")};g.open("GET",b,true);g.overrideMimeType&&g.overrideMimeType("text/plain; charset=x-user-defined");g.setRequestHeader("Content-Type","text/plain");g.send(null)};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,f){var e=new XMLHttpRequest,g=c+"/"+a.buffers,m=0;e.onreadystatechange=function(){if(e.readyState==4)e.status==200||e.status==0?THREE.BinaryLoader.prototype.createBinModel(e.response,b,d,a.materials):console.error("THREE.BinaryLoader: Couldn't load ["+g+"] ["+e.status+"]");else if(e.readyState==3){if(f){m==0&&(m=e.getResponseHeader("Content-Length"));f({total:m,loaded:e.responseText.length})}}else e.readyState==2&&(m=e.getResponseHeader("Content-Length"))};
 e.open("GET",g,true);e.responseType="arraybuffer";e.send(null)};
-THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var f=function(b){var c,f,k,l,h,n,j,o,q,i,p,r,s,v,A;function w(a){return a%4?4-a%4:0}function B(a,b){return(new Uint8Array(a,b,1))[0]}function x(a,b){return(new Uint32Array(a,b,1))[0]}function F(b,c){var d,e,f,g,h,m,l,k,i=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=i[d*3];f=i[d*3+1];g=i[d*3+2];h=G[e*2];e=G[e*2+1];m=G[f*2];l=G[f*2+1];f=G[g*2];k=G[g*2+1];g=M.faceVertexUvs[0];var j=[];j.push(new THREE.UV(h,e));j.push(new THREE.UV(m,l));j.push(new THREE.UV(f,
-k));g.push(j)}}function u(b,c){var d,e,f,g,h,m,l,k,i,j,n=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=n[d*4];f=n[d*4+1];g=n[d*4+2];h=n[d*4+3];m=G[e*2];e=G[e*2+1];l=G[f*2];i=G[f*2+1];k=G[g*2];j=G[g*2+1];g=G[h*2];f=G[h*2+1];h=M.faceVertexUvs[0];var o=[];o.push(new THREE.UV(m,e));o.push(new THREE.UV(l,i));o.push(new THREE.UV(k,j));o.push(new THREE.UV(g,f));h.push(o)}}function z(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),m=new Uint16Array(a,d,b),d=0;d<b;d++){e=c[d*3];f=c[d*3+1];g=c[d*3+2];h=m[d];
-M.faces.push(new THREE.Face3(e,f,g,null,null,h))}}function D(b,c,d){for(var e,f,g,h,m,c=new Uint32Array(a,c,4*b),l=new Uint16Array(a,d,b),d=0;d<b;d++){e=c[d*4];f=c[d*4+1];g=c[d*4+2];h=c[d*4+3];m=l[d];M.faces.push(new THREE.Face4(e,f,g,h,null,null,m))}}function H(b,c,d,e){for(var f,g,h,m,l,k,i,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),j=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*3];g=c[e*3+1];h=c[e*3+2];l=d[e*3];k=d[e*3+1];i=d[e*3+2];m=j[e];var n=E[k*3],o=E[k*3+1];k=E[k*3+2];var p=E[i*3],
-q=E[i*3+1];i=E[i*3+2];M.faces.push(new THREE.Face3(f,g,h,[new THREE.Vector3(E[l*3],E[l*3+1],E[l*3+2]),new THREE.Vector3(n,o,k),new THREE.Vector3(p,q,i)],null,m))}}function P(b,c,d,e){for(var f,g,h,m,l,k,i,j,n,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),o=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*4];g=c[e*4+1];h=c[e*4+2];m=c[e*4+3];k=d[e*4];i=d[e*4+1];j=d[e*4+2];n=d[e*4+3];l=o[e];var p=E[i*3],q=E[i*3+1];i=E[i*3+2];var r=E[j*3],t=E[j*3+1];j=E[j*3+2];var s=E[n*3],z=E[n*3+1];n=E[n*3+2];M.faces.push(new THREE.Face4(f,
-g,h,m,[new THREE.Vector3(E[k*3],E[k*3+1],E[k*3+2]),new THREE.Vector3(p,q,i),new THREE.Vector3(r,t,j),new THREE.Vector3(s,z,n)],null,l))}}var M=this,t=0,E=[],G=[],N,Q,O;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(M,d,b);(function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d=d+String.fromCharCode(a[b+e]);return d})(a,t,12);c=B(a,t+12);B(a,t+13);B(a,t+14);B(a,t+15);f=B(a,t+16);k=B(a,t+17);l=B(a,t+18);h=B(a,t+19);n=x(a,t+20);j=x(a,t+20+4);o=x(a,t+20+8);b=x(a,t+20+12);q=
-x(a,t+20+16);i=x(a,t+20+20);p=x(a,t+20+24);r=x(a,t+20+28);s=x(a,t+20+32);v=x(a,t+20+36);A=x(a,t+20+40);t=t+c;c=f*3+h;O=f*4+h;N=b*c;Q=q*(c+k*3);f=i*(c+l*3);h=p*(c+k*3+l*3);c=r*O;k=s*(O+k*4);l=v*(O+l*4);t=t+function(b){var b=new Float32Array(a,b,n*3),c,d,e,f;for(c=0;c<n;c++){d=b[c*3];e=b[c*3+1];f=b[c*3+2];M.vertices.push(new THREE.Vector3(d,e,f))}return n*3*Float32Array.BYTES_PER_ELEMENT}(t);t=t+function(b){if(j){var b=new Int8Array(a,b,j*3),c,d,e,f;for(c=0;c<j;c++){d=b[c*3];e=b[c*3+1];f=b[c*3+2];E.push(d/
-127,e/127,f/127)}}return j*3*Int8Array.BYTES_PER_ELEMENT}(t);t=t+w(j*3);t=t+function(b){if(o){var b=new Float32Array(a,b,o*2),c,d,e;for(c=0;c<o;c++){d=b[c*2];e=b[c*2+1];G.push(d,e)}}return o*2*Float32Array.BYTES_PER_ELEMENT}(t);N=t+N+w(b*2);Q=N+Q+w(q*2);f=Q+f+w(i*2);h=f+h+w(p*2);c=h+c+w(r*2);k=c+k+w(s*2);l=k+l+w(v*2);(function(a){if(i){var b=a+i*Uint32Array.BYTES_PER_ELEMENT*3;z(i,a,b+i*Uint32Array.BYTES_PER_ELEMENT*3);F(i,b)}})(Q);(function(a){if(p){var b=a+p*Uint32Array.BYTES_PER_ELEMENT*3,c=b+
-p*Uint32Array.BYTES_PER_ELEMENT*3;H(p,a,b,c+p*Uint32Array.BYTES_PER_ELEMENT*3);F(p,c)}})(f);(function(a){if(v){var b=a+v*Uint32Array.BYTES_PER_ELEMENT*4;D(v,a,b+v*Uint32Array.BYTES_PER_ELEMENT*4);u(v,b)}})(k);(function(a){if(A){var b=a+A*Uint32Array.BYTES_PER_ELEMENT*4,c=b+A*Uint32Array.BYTES_PER_ELEMENT*4;P(A,a,b,c+A*Uint32Array.BYTES_PER_ELEMENT*4);u(A,c)}})(l);b&&z(b,t,t+b*Uint32Array.BYTES_PER_ELEMENT*3);(function(a){if(q){var b=a+q*Uint32Array.BYTES_PER_ELEMENT*3;H(q,a,b,b+q*Uint32Array.BYTES_PER_ELEMENT*
+THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var f=function(b){var c,f,k,j,h,n,i,o,q,l,p,r,s,v,A;function w(a){return a%4?4-a%4:0}function B(a,b){return(new Uint8Array(a,b,1))[0]}function x(a,b){return(new Uint32Array(a,b,1))[0]}function F(b,c){var d,e,f,g,h,m,j,k,l=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=l[d*3];f=l[d*3+1];g=l[d*3+2];h=G[e*2];e=G[e*2+1];m=G[f*2];j=G[f*2+1];f=G[g*2];k=G[g*2+1];g=M.faceVertexUvs[0];var i=[];i.push(new THREE.UV(h,e));i.push(new THREE.UV(m,j));i.push(new THREE.UV(f,
+k));g.push(i)}}function u(b,c){var d,e,f,g,h,m,j,k,l,i,n=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=n[d*4];f=n[d*4+1];g=n[d*4+2];h=n[d*4+3];m=G[e*2];e=G[e*2+1];j=G[f*2];l=G[f*2+1];k=G[g*2];i=G[g*2+1];g=G[h*2];f=G[h*2+1];h=M.faceVertexUvs[0];var o=[];o.push(new THREE.UV(m,e));o.push(new THREE.UV(j,l));o.push(new THREE.UV(k,i));o.push(new THREE.UV(g,f));h.push(o)}}function z(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),m=new Uint16Array(a,d,b),d=0;d<b;d++){e=c[d*3];f=c[d*3+1];g=c[d*3+2];h=m[d];
+M.faces.push(new THREE.Face3(e,f,g,null,null,h))}}function D(b,c,d){for(var e,f,g,h,m,c=new Uint32Array(a,c,4*b),j=new Uint16Array(a,d,b),d=0;d<b;d++){e=c[d*4];f=c[d*4+1];g=c[d*4+2];h=c[d*4+3];m=j[d];M.faces.push(new THREE.Face4(e,f,g,h,null,null,m))}}function H(b,c,d,e){for(var f,g,h,m,j,k,l,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),i=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*3];g=c[e*3+1];h=c[e*3+2];j=d[e*3];k=d[e*3+1];l=d[e*3+2];m=i[e];var n=E[k*3],o=E[k*3+1];k=E[k*3+2];var p=E[l*3],
+q=E[l*3+1];l=E[l*3+2];M.faces.push(new THREE.Face3(f,g,h,[new THREE.Vector3(E[j*3],E[j*3+1],E[j*3+2]),new THREE.Vector3(n,o,k),new THREE.Vector3(p,q,l)],null,m))}}function P(b,c,d,e){for(var f,g,h,m,j,k,l,i,n,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),o=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*4];g=c[e*4+1];h=c[e*4+2];m=c[e*4+3];k=d[e*4];l=d[e*4+1];i=d[e*4+2];n=d[e*4+3];j=o[e];var p=E[l*3],q=E[l*3+1];l=E[l*3+2];var r=E[i*3],s=E[i*3+1];i=E[i*3+2];var t=E[n*3],z=E[n*3+1];n=E[n*3+2];M.faces.push(new THREE.Face4(f,
+g,h,m,[new THREE.Vector3(E[k*3],E[k*3+1],E[k*3+2]),new THREE.Vector3(p,q,l),new THREE.Vector3(r,s,i),new THREE.Vector3(t,z,n)],null,j))}}var M=this,t=0,E=[],G=[],N,Q,O;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(M,d,b);(function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d=d+String.fromCharCode(a[b+e]);return d})(a,t,12);c=B(a,t+12);B(a,t+13);B(a,t+14);B(a,t+15);f=B(a,t+16);k=B(a,t+17);j=B(a,t+18);h=B(a,t+19);n=x(a,t+20);i=x(a,t+20+4);o=x(a,t+20+8);b=x(a,t+20+12);q=
+x(a,t+20+16);l=x(a,t+20+20);p=x(a,t+20+24);r=x(a,t+20+28);s=x(a,t+20+32);v=x(a,t+20+36);A=x(a,t+20+40);t=t+c;c=f*3+h;O=f*4+h;N=b*c;Q=q*(c+k*3);f=l*(c+j*3);h=p*(c+k*3+j*3);c=r*O;k=s*(O+k*4);j=v*(O+j*4);t=t+function(b){var b=new Float32Array(a,b,n*3),c,d,e,f;for(c=0;c<n;c++){d=b[c*3];e=b[c*3+1];f=b[c*3+2];M.vertices.push(new THREE.Vector3(d,e,f))}return n*3*Float32Array.BYTES_PER_ELEMENT}(t);t=t+function(b){if(i){var b=new Int8Array(a,b,i*3),c,d,e,f;for(c=0;c<i;c++){d=b[c*3];e=b[c*3+1];f=b[c*3+2];E.push(d/
+127,e/127,f/127)}}return i*3*Int8Array.BYTES_PER_ELEMENT}(t);t=t+w(i*3);t=t+function(b){if(o){var b=new Float32Array(a,b,o*2),c,d,e;for(c=0;c<o;c++){d=b[c*2];e=b[c*2+1];G.push(d,e)}}return o*2*Float32Array.BYTES_PER_ELEMENT}(t);N=t+N+w(b*2);Q=N+Q+w(q*2);f=Q+f+w(l*2);h=f+h+w(p*2);c=h+c+w(r*2);k=c+k+w(s*2);j=k+j+w(v*2);(function(a){if(l){var b=a+l*Uint32Array.BYTES_PER_ELEMENT*3;z(l,a,b+l*Uint32Array.BYTES_PER_ELEMENT*3);F(l,b)}})(Q);(function(a){if(p){var b=a+p*Uint32Array.BYTES_PER_ELEMENT*3,c=b+
+p*Uint32Array.BYTES_PER_ELEMENT*3;H(p,a,b,c+p*Uint32Array.BYTES_PER_ELEMENT*3);F(p,c)}})(f);(function(a){if(v){var b=a+v*Uint32Array.BYTES_PER_ELEMENT*4;D(v,a,b+v*Uint32Array.BYTES_PER_ELEMENT*4);u(v,b)}})(k);(function(a){if(A){var b=a+A*Uint32Array.BYTES_PER_ELEMENT*4,c=b+A*Uint32Array.BYTES_PER_ELEMENT*4;P(A,a,b,c+A*Uint32Array.BYTES_PER_ELEMENT*4);u(A,c)}})(j);b&&z(b,t,t+b*Uint32Array.BYTES_PER_ELEMENT*3);(function(a){if(q){var b=a+q*Uint32Array.BYTES_PER_ELEMENT*3;H(q,a,b,b+q*Uint32Array.BYTES_PER_ELEMENT*
 3)}})(N);r&&D(r,h,h+r*Uint32Array.BYTES_PER_ELEMENT*4);(function(a){if(s){var b=a+s*Uint32Array.BYTES_PER_ELEMENT*4;P(s,a,b,b+s*Uint32Array.BYTES_PER_ELEMENT*4)}})(c);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(new f(c))};THREE.ImageLoader=function(){THREE.EventTarget.call(this);this.crossOrigin=null};
 THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,load:function(a){var b=this,c=new Image;c.addEventListener("load",function(){b.dispatchEvent({type:"load",content:c})},false);c.addEventListener("error",function(){b.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},false);if(b.crossOrigin)c.crossOrigin=b.crossOrigin;c.src=a}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;
 THREE.JSONLoader.prototype.load=function(a,b,c){c=c?c:this.extractUrlBase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
 THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,f){var e=new XMLHttpRequest,g=0;e.onreadystatechange=function(){if(e.readyState===e.DONE)if(e.status===200||e.status===0){if(e.responseText){var m=JSON.parse(e.responseText);a.createModel(m,c,d)}else console.warn("THREE.JSONLoader: ["+b+"] seems to be unreachable or file there is empty");a.onLoadComplete()}else console.error("THREE.JSONLoader: Couldn't load ["+b+"] ["+e.status+"]");else if(e.readyState===e.LOADING){if(f){g===0&&(g=e.getResponseHeader("Content-Length"));
 f({total:g,loaded:e.responseText.length})}}else e.readyState===e.HEADERS_RECEIVED&&(g=e.getResponseHeader("Content-Length"))};e.open("GET",b,true);e.overrideMimeType&&e.overrideMimeType("text/plain; charset=x-user-defined");e.setRequestHeader("Content-Type","text/plain");e.send(null)};
-THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,f=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){var c,f,k,l,h,n,j,o,q,i,p,r,s,v,A=a.faces;n=a.vertices;var w=a.normals,B=a.colors,x=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&x++;for(c=0;c<x;c++){d.faceUvs[c]=[];d.faceVertexUvs[c]=[]}l=0;for(h=n.length;l<h;){j=new THREE.Vector3;j.x=n[l++]*b;j.y=n[l++]*b;j.z=n[l++]*b;d.vertices.push(j)}l=0;for(h=A.length;l<h;){b=A[l++];n=b&1;k=b&2;c=b&
-4;f=b&8;o=b&16;j=b&32;i=b&64;b=b&128;if(n){p=new THREE.Face4;p.a=A[l++];p.b=A[l++];p.c=A[l++];p.d=A[l++];n=4}else{p=new THREE.Face3;p.a=A[l++];p.b=A[l++];p.c=A[l++];n=3}if(k){k=A[l++];p.materialIndex=k}k=d.faces.length;if(c)for(c=0;c<x;c++){r=a.uvs[c];q=A[l++];v=r[q*2];q=r[q*2+1];d.faceUvs[c][k]=new THREE.UV(v,q)}if(f)for(c=0;c<x;c++){r=a.uvs[c];s=[];for(f=0;f<n;f++){q=A[l++];v=r[q*2];q=r[q*2+1];s[f]=new THREE.UV(v,q)}d.faceVertexUvs[c][k]=s}if(o){o=A[l++]*3;f=new THREE.Vector3;f.x=w[o++];f.y=w[o++];
-f.z=w[o];p.normal=f}if(j)for(c=0;c<n;c++){o=A[l++]*3;f=new THREE.Vector3;f.x=w[o++];f.y=w[o++];f.z=w[o];p.vertexNormals.push(f)}if(i){j=A[l++];j=new THREE.Color(B[j]);p.color=j}if(b)for(c=0;c<n;c++){j=A[l++];j=new THREE.Color(B[j]);p.vertexColors.push(j)}d.faces.push(p)}})(f);(function(){var b,c,f,k;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b=b+2){f=a.skinWeights[b];k=a.skinWeights[b+1];d.skinWeights.push(new THREE.Vector4(f,k,0,0))}}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b=
-b+2){f=a.skinIndices[b];k=a.skinIndices[b+1];d.skinIndices.push(new THREE.Vector4(f,k,0,0))}}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,f,k,l,h,n;c=0;for(f=a.morphTargets.length;c<f;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];h=d.morphTargets[c].vertices;n=a.morphTargets[c].vertices;k=0;for(l=n.length;k<l;k=k+3){var j=new THREE.Vector3;j.x=n[k]*b;j.y=n[k+1]*b;j.z=n[k+2]*b;h.push(j)}}}if(a.morphColors!==
-void 0){c=0;for(f=a.morphColors.length;c<f;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];l=d.morphColors[c].colors;h=a.morphColors[c].colors;b=0;for(k=h.length;b<k;b=b+3){n=new THREE.Color(16755200);n.setRGB(h[b],h[b+1],h[b+2]);l.push(n)}}}})(f);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();b(d)};THREE.GeometryLoader=function(){THREE.EventTarget.call(this);this.path=this.crossOrigin=null};
+THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,f=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){var c,f,k,j,h,n,i,o,q,l,p,r,s,v,A=a.faces;n=a.vertices;var w=a.normals,B=a.colors,x=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&x++;for(c=0;c<x;c++){d.faceUvs[c]=[];d.faceVertexUvs[c]=[]}j=0;for(h=n.length;j<h;){i=new THREE.Vector3;i.x=n[j++]*b;i.y=n[j++]*b;i.z=n[j++]*b;d.vertices.push(i)}j=0;for(h=A.length;j<h;){b=A[j++];n=b&1;k=b&2;c=b&
+4;f=b&8;o=b&16;i=b&32;l=b&64;b=b&128;if(n){p=new THREE.Face4;p.a=A[j++];p.b=A[j++];p.c=A[j++];p.d=A[j++];n=4}else{p=new THREE.Face3;p.a=A[j++];p.b=A[j++];p.c=A[j++];n=3}if(k){k=A[j++];p.materialIndex=k}k=d.faces.length;if(c)for(c=0;c<x;c++){r=a.uvs[c];q=A[j++];v=r[q*2];q=r[q*2+1];d.faceUvs[c][k]=new THREE.UV(v,q)}if(f)for(c=0;c<x;c++){r=a.uvs[c];s=[];for(f=0;f<n;f++){q=A[j++];v=r[q*2];q=r[q*2+1];s[f]=new THREE.UV(v,q)}d.faceVertexUvs[c][k]=s}if(o){o=A[j++]*3;f=new THREE.Vector3;f.x=w[o++];f.y=w[o++];
+f.z=w[o];p.normal=f}if(i)for(c=0;c<n;c++){o=A[j++]*3;f=new THREE.Vector3;f.x=w[o++];f.y=w[o++];f.z=w[o];p.vertexNormals.push(f)}if(l){i=A[j++];i=new THREE.Color(B[i]);p.color=i}if(b)for(c=0;c<n;c++){i=A[j++];i=new THREE.Color(B[i]);p.vertexColors.push(i)}d.faces.push(p)}})(f);(function(){var b,c,f,k;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b=b+2){f=a.skinWeights[b];k=a.skinWeights[b+1];d.skinWeights.push(new THREE.Vector4(f,k,0,0))}}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b=
+b+2){f=a.skinIndices[b];k=a.skinIndices[b+1];d.skinIndices.push(new THREE.Vector4(f,k,0,0))}}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,f,k,j,h,n;c=0;for(f=a.morphTargets.length;c<f;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];h=d.morphTargets[c].vertices;n=a.morphTargets[c].vertices;k=0;for(j=n.length;k<j;k=k+3){var i=new THREE.Vector3;i.x=n[k]*b;i.y=n[k+1]*b;i.z=n[k+2]*b;h.push(i)}}}if(a.morphColors!==
+void 0){c=0;for(f=a.morphColors.length;c<f;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];j=d.morphColors[c].colors;h=a.morphColors[c].colors;b=0;for(k=h.length;b<k;b=b+3){n=new THREE.Color(16755200);n.setRGB(h[b],h[b+1],h[b+2]);j.push(n)}}}})(f);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();b(d)};THREE.GeometryLoader=function(){THREE.EventTarget.call(this);this.path=this.crossOrigin=null};
 THREE.GeometryLoader.prototype={constructor:THREE.GeometryLoader,load:function(a){var b=this,c=null;if(b.path===null){var d=a.split("/");d.pop();b.path=d.length<1?".":d.join("/")}d=new XMLHttpRequest;d.addEventListener("load",function(d){d.target.responseText?c=b.parse(JSON.parse(d.target.responseText),f):b.dispatchEvent({type:"error",message:"Invalid file ["+a+"]"})},false);d.addEventListener("error",function(){b.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},false);d.open("GET",
-a,true);d.send(null);var f=new THREE.LoadingMonitor;f.addEventListener("load",function(){b.dispatchEvent({type:"load",content:c})});f.add(d)},parse:function(a,b){var c=this,d=new THREE.Geometry,f=a.scale!==void 0?1/a.scale:1;if(a.materials){d.materials=[];for(var e=0;e<a.materials.length;++e){var g=a.materials[e],m=function(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==a},k=function(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))},l=function(a,d,e,f,g,h){a[d]=new THREE.Texture;a[d].sourceFile=
-e;if(f){a[d].repeat.set(f[0],f[1]);if(f[0]!=1)a[d].wrapS=THREE.RepeatWrapping;if(f[1]!=1)a[d].wrapT=THREE.RepeatWrapping}g&&a[d].offset.set(g[0],g[1]);if(h){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(f[h[0]]!==void 0)a[d].wrapS=f[h[0]];if(f[h[1]]!==void 0)a[d].wrapT=f[h[1]]}var l=a[d],a=new THREE.ImageLoader;a.addEventListener("load",function(a){a=a.content;if(!m(a.width)||!m(a.height)){var b=k(a.width),c=k(a.height);l.image=document.createElement("canvas");l.image.width=
-b;l.image.height=c;l.image.getContext("2d").drawImage(a,0,0,b,c)}else l.image=a;l.needsUpdate=true});a.crossOrigin=c.crossOrigin;a.load(c.path+"/"+e);b&&b.add(a)},h=function(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255},n="MeshLambertMaterial",j={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:g.wireframe};if(g.shading){var o=g.shading.toLowerCase();o==="phong"?n="MeshPhongMaterial":o==="basic"&&(n="MeshBasicMaterial")}if(g.blending!==void 0&&THREE[g.blending]!==void 0)j.blending=
-THREE[g.blending];if(g.transparent!==void 0||g.opacity<1)j.transparent=g.transparent;if(g.depthTest!==void 0)j.depthTest=g.depthTest;if(g.depthWrite!==void 0)j.depthWrite=g.depthWrite;if(g.vertexColors!==void 0)if(g.vertexColors=="face")j.vertexColors=THREE.FaceColors;else if(g.vertexColors)j.vertexColors=THREE.VertexColors;if(g.colorDiffuse)j.color=h(g.colorDiffuse);else if(g.DbgColor)j.color=g.DbgColor;if(g.colorSpecular)j.specular=h(g.colorSpecular);if(g.colorAmbient)j.ambient=h(g.colorAmbient);
-if(g.transparency)j.opacity=g.transparency;if(g.specularCoef)j.shininess=g.specularCoef;g.mapDiffuse&&l(j,"map",g.mapDiffuse,g.mapDiffuseRepeat,g.mapDiffuseOffset,g.mapDiffuseWrap);g.mapLight&&l(j,"lightMap",g.mapLight,g.mapLightRepeat,g.mapLightOffset,g.mapLightWrap);g.mapNormal&&l(j,"normalMap",g.mapNormal,g.mapNormalRepeat,g.mapNormalOffset,g.mapNormalWrap);g.mapSpecular&&l(j,"specularMap",g.mapSpecular,g.mapSpecularRepeat,g.mapSpecularOffset,g.mapSpecularWrap);if(g.mapNormal){l=THREE.ShaderUtils.lib.normal;
-h=THREE.UniformsUtils.clone(l.uniforms);h.tNormal.texture=j.normalMap;if(g.mapNormalFactor)h.uNormalScale.value=g.mapNormalFactor;if(j.map){h.tDiffuse.texture=j.map;h.enableDiffuse.value=true}if(j.specularMap){h.tSpecular.texture=j.specularMap;h.enableSpecular.value=true}if(j.lightMap){h.tAO.texture=j.lightMap;h.enableAO.value=true}h.uDiffuseColor.value.setHex(j.color);h.uSpecularColor.value.setHex(j.specular);h.uAmbientColor.value.setHex(j.ambient);h.uShininess.value=j.shininess;if(j.opacity!==void 0)h.uOpacity.value=
-j.opacity;j=new THREE.ShaderMaterial({fragmentShader:l.fragmentShader,vertexShader:l.vertexShader,uniforms:h,lights:true,fog:true})}else j=new THREE[n](j);if(g.DbgName!==void 0)j.name=g.DbgName;d.materials[e]=j}}var g=a.faces,q=a.vertices,j=a.normals,l=a.colors,h=0;if(a.uvs)for(e=0;e<a.uvs.length;e++)a.uvs[e].length&&h++;for(e=0;e<h;e++){d.faceUvs[e]=[];d.faceVertexUvs[e]=[]}n=0;for(o=q.length;n<o;){var i=new THREE.Vector3;i.x=q[n++]*f;i.y=q[n++]*f;i.z=q[n++]*f;d.vertices.push(i)}n=0;for(o=g.length;n<
-o;){var p=g[n++],r=p&2,e=p&4,s=p&8,v=p&16,q=p&32,A=p&64,i=p&128;if(p&1){p=new THREE.Face4;p.a=g[n++];p.b=g[n++];p.c=g[n++];p.d=g[n++];var w=4}else{p=new THREE.Face3;p.a=g[n++];p.b=g[n++];p.c=g[n++];w=3}if(r){r=g[n++];p.materialIndex=r}var B=d.faces.length;if(e)for(e=0;e<h;e++){var x=a.uvs[e],r=g[n++],F=x[r*2],r=x[r*2+1];d.faceUvs[e][B]=new THREE.UV(F,r)}if(s)for(e=0;e<h;e++){for(var x=a.uvs[e],s=[],u=0;u<w;u++){r=g[n++];F=x[r*2];r=x[r*2+1];s[u]=new THREE.UV(F,r)}d.faceVertexUvs[e][B]=s}if(v){v=g[n++]*
-3;r=new THREE.Vector3;r.x=j[v++];r.y=j[v++];r.z=j[v];p.normal=r}if(q)for(e=0;e<w;e++){v=g[n++]*3;r=new THREE.Vector3;r.x=j[v++];r.y=j[v++];r.z=j[v];p.vertexNormals.push(r)}if(A){q=g[n++];p.color=new THREE.Color(l[q])}if(i)for(e=0;e<w;e++){q=g[n++];p.vertexColors.push(new THREE.Color(l[q]))}d.faces.push(p)}if(a.skinWeights){e=0;for(g=a.skinWeights.length;e<g;e=e+2)d.skinWeights.push(new THREE.Vector4(a.skinWeights[e],a.skinWeights[e+1],0,0))}if(a.skinIndices){e=0;for(g=a.skinIndices.length;e<g;e=e+
-2){j=0;d.skinIndices.push(new THREE.Vector4(a.skinIndices[e],a.skinIndices[e+1],j,0))}}d.bones=a.bones;d.animation=a.animation;if(a.morphTargets){e=0;for(g=a.morphTargets.length;e<g;e++){d.morphTargets[e]={};d.morphTargets[e].name=a.morphTargets[e].name;d.morphTargets[e].vertices=[];j=d.morphTargets[e].vertices;l=a.morphTargets[e].vertices;r=0;for(h=l.length;r<h;r=r+3){i=new THREE.Vector3;i.x=l[r]*f;i.y=l[r+1]*f;i.z=l[r+2]*f;j.push(i)}}}if(a.morphColors){e=0;for(g=a.morphColors.length;e<g;e++){d.morphColors[e]=
-{};d.morphColors[e].name=a.morphColors[e].name;d.morphColors[e].colors=[];f=d.morphColors[e].colors;l=a.morphColors[e].colors;j=0;for(h=l.length;j<h;j=j+3){n=new THREE.Color(16755200);n.setRGB(l[j],l[j+1],l[j+2]);f.push(n)}}}d.computeCentroids();d.computeFaceNormals();return d}};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
+a,true);d.send(null);var f=new THREE.LoadingMonitor;f.addEventListener("load",function(){b.dispatchEvent({type:"load",content:c})});f.add(d)},parse:function(a,b){var c=this,d=new THREE.Geometry,f=a.scale!==void 0?1/a.scale:1;if(a.materials){d.materials=[];for(var e=0;e<a.materials.length;++e){var g=a.materials[e],m=function(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==a},k=function(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))},j=function(a,d,e,f,g,h){a[d]=new THREE.Texture;a[d].sourceFile=
+e;if(f){a[d].repeat.set(f[0],f[1]);if(f[0]!=1)a[d].wrapS=THREE.RepeatWrapping;if(f[1]!=1)a[d].wrapT=THREE.RepeatWrapping}g&&a[d].offset.set(g[0],g[1]);if(h){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(f[h[0]]!==void 0)a[d].wrapS=f[h[0]];if(f[h[1]]!==void 0)a[d].wrapT=f[h[1]]}var j=a[d],a=new THREE.ImageLoader;a.addEventListener("load",function(a){a=a.content;if(!m(a.width)||!m(a.height)){var b=k(a.width),c=k(a.height);j.image=document.createElement("canvas");j.image.width=
+b;j.image.height=c;j.image.getContext("2d").drawImage(a,0,0,b,c)}else j.image=a;j.needsUpdate=true});a.crossOrigin=c.crossOrigin;a.load(c.path+"/"+e);b&&b.add(a)},h=function(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255},n="MeshLambertMaterial",i={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:g.wireframe};if(g.shading){var o=g.shading.toLowerCase();o==="phong"?n="MeshPhongMaterial":o==="basic"&&(n="MeshBasicMaterial")}if(g.blending!==void 0&&THREE[g.blending]!==void 0)i.blending=
+THREE[g.blending];if(g.transparent!==void 0||g.opacity<1)i.transparent=g.transparent;if(g.depthTest!==void 0)i.depthTest=g.depthTest;if(g.depthWrite!==void 0)i.depthWrite=g.depthWrite;if(g.vertexColors!==void 0)if(g.vertexColors=="face")i.vertexColors=THREE.FaceColors;else if(g.vertexColors)i.vertexColors=THREE.VertexColors;if(g.colorDiffuse)i.color=h(g.colorDiffuse);else if(g.DbgColor)i.color=g.DbgColor;if(g.colorSpecular)i.specular=h(g.colorSpecular);if(g.colorAmbient)i.ambient=h(g.colorAmbient);
+if(g.transparency)i.opacity=g.transparency;if(g.specularCoef)i.shininess=g.specularCoef;g.mapDiffuse&&j(i,"map",g.mapDiffuse,g.mapDiffuseRepeat,g.mapDiffuseOffset,g.mapDiffuseWrap);g.mapLight&&j(i,"lightMap",g.mapLight,g.mapLightRepeat,g.mapLightOffset,g.mapLightWrap);g.mapNormal&&j(i,"normalMap",g.mapNormal,g.mapNormalRepeat,g.mapNormalOffset,g.mapNormalWrap);g.mapSpecular&&j(i,"specularMap",g.mapSpecular,g.mapSpecularRepeat,g.mapSpecularOffset,g.mapSpecularWrap);if(g.mapNormal){j=THREE.ShaderUtils.lib.normal;
+h=THREE.UniformsUtils.clone(j.uniforms);h.tNormal.texture=i.normalMap;if(g.mapNormalFactor)h.uNormalScale.value=g.mapNormalFactor;if(i.map){h.tDiffuse.texture=i.map;h.enableDiffuse.value=true}if(i.specularMap){h.tSpecular.texture=i.specularMap;h.enableSpecular.value=true}if(i.lightMap){h.tAO.texture=i.lightMap;h.enableAO.value=true}h.uDiffuseColor.value.setHex(i.color);h.uSpecularColor.value.setHex(i.specular);h.uAmbientColor.value.setHex(i.ambient);h.uShininess.value=i.shininess;if(i.opacity!==void 0)h.uOpacity.value=
+i.opacity;i=new THREE.ShaderMaterial({fragmentShader:j.fragmentShader,vertexShader:j.vertexShader,uniforms:h,lights:true,fog:true})}else i=new THREE[n](i);if(g.DbgName!==void 0)i.name=g.DbgName;d.materials[e]=i}}var g=a.faces,q=a.vertices,i=a.normals,j=a.colors,h=0;if(a.uvs)for(e=0;e<a.uvs.length;e++)a.uvs[e].length&&h++;for(e=0;e<h;e++){d.faceUvs[e]=[];d.faceVertexUvs[e]=[]}n=0;for(o=q.length;n<o;){var l=new THREE.Vector3;l.x=q[n++]*f;l.y=q[n++]*f;l.z=q[n++]*f;d.vertices.push(l)}n=0;for(o=g.length;n<
+o;){var p=g[n++],r=p&2,e=p&4,s=p&8,v=p&16,q=p&32,A=p&64,l=p&128;if(p&1){p=new THREE.Face4;p.a=g[n++];p.b=g[n++];p.c=g[n++];p.d=g[n++];var w=4}else{p=new THREE.Face3;p.a=g[n++];p.b=g[n++];p.c=g[n++];w=3}if(r){r=g[n++];p.materialIndex=r}var B=d.faces.length;if(e)for(e=0;e<h;e++){var x=a.uvs[e],r=g[n++],F=x[r*2],r=x[r*2+1];d.faceUvs[e][B]=new THREE.UV(F,r)}if(s)for(e=0;e<h;e++){for(var x=a.uvs[e],s=[],u=0;u<w;u++){r=g[n++];F=x[r*2];r=x[r*2+1];s[u]=new THREE.UV(F,r)}d.faceVertexUvs[e][B]=s}if(v){v=g[n++]*
+3;r=new THREE.Vector3;r.x=i[v++];r.y=i[v++];r.z=i[v];p.normal=r}if(q)for(e=0;e<w;e++){v=g[n++]*3;r=new THREE.Vector3;r.x=i[v++];r.y=i[v++];r.z=i[v];p.vertexNormals.push(r)}if(A){q=g[n++];p.color=new THREE.Color(j[q])}if(l)for(e=0;e<w;e++){q=g[n++];p.vertexColors.push(new THREE.Color(j[q]))}d.faces.push(p)}if(a.skinWeights){e=0;for(g=a.skinWeights.length;e<g;e=e+2)d.skinWeights.push(new THREE.Vector4(a.skinWeights[e],a.skinWeights[e+1],0,0))}if(a.skinIndices){e=0;for(g=a.skinIndices.length;e<g;e=e+
+2){i=0;d.skinIndices.push(new THREE.Vector4(a.skinIndices[e],a.skinIndices[e+1],i,0))}}d.bones=a.bones;d.animation=a.animation;if(a.morphTargets){e=0;for(g=a.morphTargets.length;e<g;e++){d.morphTargets[e]={};d.morphTargets[e].name=a.morphTargets[e].name;d.morphTargets[e].vertices=[];i=d.morphTargets[e].vertices;j=a.morphTargets[e].vertices;r=0;for(h=j.length;r<h;r=r+3){l=new THREE.Vector3;l.x=j[r]*f;l.y=j[r+1]*f;l.z=j[r+2]*f;i.push(l)}}}if(a.morphColors){e=0;for(g=a.morphColors.length;e<g;e++){d.morphColors[e]=
+{};d.morphColors[e].name=a.morphColors[e].name;d.morphColors[e].colors=[];f=d.morphColors[e].colors;j=a.morphColors[e].colors;i=0;for(h=j.length;i<h;i=i+3){n=new THREE.Color(16755200);n.setRGB(j[i],j[i+1],j[i+2]);f.push(n)}}}d.computeCentroids();d.computeFaceNormals();return d}};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
 THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
 THREE.SceneLoader.prototype.load=function(a,b){var c=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(d.readyState===4)if(d.status===200||d.status===0){var f=JSON.parse(d.responseText);c.createScene(f,b,a)}else console.error("THREE.SceneLoader: Couldn't load ["+a+"] ["+d.status+"]")};d.open("GET",a,true);d.overrideMimeType&&d.overrideMimeType("text/plain; charset=x-user-defined");d.setRequestHeader("Content-Type","text/plain");d.send(null)};
-THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return b=="relativeToHTML"?a:l+"/"+a}function f(){var a;for(j in t.objects)if(!y.objects[j]){r=t.objects[j];if(r.geometry!==void 0){if(D=y.geometries[r.geometry]){a=false;H=y.materials[r.materials[0]];(a=H instanceof THREE.ShaderMaterial)&&D.computeTangents();w=r.position;B=r.rotation;x=r.quaternion;F=r.scale;s=r.matrix;x=0;r.materials.length==0&&(H=new THREE.MeshFaceMaterial);r.materials.length>1&&(H=new THREE.MeshFaceMaterial);
-a=new THREE.Mesh(D,H);a.name=j;if(s){a.matrixAutoUpdate=false;a.matrix.set(s[0],s[1],s[2],s[3],s[4],s[5],s[6],s[7],s[8],s[9],s[10],s[11],s[12],s[13],s[14],s[15])}else{a.position.set(w[0],w[1],w[2]);if(x){a.quaternion.set(x[0],x[1],x[2],x[3]);a.useQuaternion=true}else a.rotation.set(B[0],B[1],B[2]);a.scale.set(F[0],F[1],F[2])}a.visible=r.visible;a.doubleSided=r.doubleSided;a.castShadow=r.castShadow;a.receiveShadow=r.receiveShadow;y.scene.add(a);y.objects[j]=a}}else{w=r.position;B=r.rotation;x=r.quaternion;
-F=r.scale;x=0;a=new THREE.Object3D;a.name=j;a.position.set(w[0],w[1],w[2]);if(x){a.quaternion.set(x[0],x[1],x[2],x[3]);a.useQuaternion=true}else a.rotation.set(B[0],B[1],B[2]);a.scale.set(F[0],F[1],F[2]);a.visible=r.visible!==void 0?r.visible:false;y.scene.add(a);y.objects[j]=a;y.empties[j]=a}}}function e(a){return function(b){y.geometries[a]=b;f();G=G-1;k.onLoadComplete();m()}}function g(a){return function(b){y.geometries[a]=b}}function m(){k.callbackProgress({totalModels:Q,totalTextures:O,loadedModels:Q-
-G,loadedTextures:O-N},y);k.onLoadProgress();G===0&&N===0&&b(y)}var k=this,l=THREE.Loader.prototype.extractUrlBase(c),h,n,j,o,q,i,p,r,s,v,A,w,B,x,F,u,z,D,H,P,M,t,E,G,N,Q,O,y;t=a;c=new THREE.BinaryLoader;E=new THREE.JSONLoader;N=G=0;y={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(t.transform){a=t.transform.position;v=t.transform.rotation;u=t.transform.scale;a&&y.scene.position.set(a[0],a[1],a[2]);v&&y.scene.rotation.set(v[0],v[1],
+THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return b=="relativeToHTML"?a:j+"/"+a}function f(){var a;for(i in t.objects)if(!y.objects[i]){r=t.objects[i];if(r.geometry!==void 0){if(D=y.geometries[r.geometry]){a=false;H=y.materials[r.materials[0]];(a=H instanceof THREE.ShaderMaterial)&&D.computeTangents();w=r.position;B=r.rotation;x=r.quaternion;F=r.scale;s=r.matrix;x=0;r.materials.length==0&&(H=new THREE.MeshFaceMaterial);r.materials.length>1&&(H=new THREE.MeshFaceMaterial);
+a=new THREE.Mesh(D,H);a.name=i;if(s){a.matrixAutoUpdate=false;a.matrix.set(s[0],s[1],s[2],s[3],s[4],s[5],s[6],s[7],s[8],s[9],s[10],s[11],s[12],s[13],s[14],s[15])}else{a.position.set(w[0],w[1],w[2]);if(x){a.quaternion.set(x[0],x[1],x[2],x[3]);a.useQuaternion=true}else a.rotation.set(B[0],B[1],B[2]);a.scale.set(F[0],F[1],F[2])}a.visible=r.visible;a.doubleSided=r.doubleSided;a.castShadow=r.castShadow;a.receiveShadow=r.receiveShadow;y.scene.add(a);y.objects[i]=a}}else{w=r.position;B=r.rotation;x=r.quaternion;
+F=r.scale;x=0;a=new THREE.Object3D;a.name=i;a.position.set(w[0],w[1],w[2]);if(x){a.quaternion.set(x[0],x[1],x[2],x[3]);a.useQuaternion=true}else a.rotation.set(B[0],B[1],B[2]);a.scale.set(F[0],F[1],F[2]);a.visible=r.visible!==void 0?r.visible:false;y.scene.add(a);y.objects[i]=a;y.empties[i]=a}}}function e(a){return function(b){y.geometries[a]=b;f();G=G-1;k.onLoadComplete();m()}}function g(a){return function(b){y.geometries[a]=b}}function m(){k.callbackProgress({totalModels:Q,totalTextures:O,loadedModels:Q-
+G,loadedTextures:O-N},y);k.onLoadProgress();G===0&&N===0&&b(y)}var k=this,j=THREE.Loader.prototype.extractUrlBase(c),h,n,i,o,q,l,p,r,s,v,A,w,B,x,F,u,z,D,H,P,M,t,E,G,N,Q,O,y;t=a;c=new THREE.BinaryLoader;E=new THREE.JSONLoader;N=G=0;y={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(t.transform){a=t.transform.position;v=t.transform.rotation;u=t.transform.scale;a&&y.scene.position.set(a[0],a[1],a[2]);v&&y.scene.rotation.set(v[0],v[1],
 v[2]);u&&y.scene.scale.set(u[0],u[1],u[2]);if(a||v||u){y.scene.updateMatrix();y.scene.updateMatrixWorld()}}a=function(a){return function(){N=N-a;m();k.onLoadComplete()}};for(q in t.cameras){u=t.cameras[q];u.type==="perspective"?P=new THREE.PerspectiveCamera(u.fov,u.aspect,u.near,u.far):u.type==="ortho"&&(P=new THREE.OrthographicCamera(u.left,u.right,u.top,u.bottom,u.near,u.far));w=u.position;v=u.target;u=u.up;P.position.set(w[0],w[1],w[2]);P.target=new THREE.Vector3(v[0],v[1],v[2]);u&&P.up.set(u[0],
-u[1],u[2]);y.cameras[q]=P}for(o in t.lights){v=t.lights[o];q=v.color!==void 0?v.color:16777215;P=v.intensity!==void 0?v.intensity:1;if(v.type==="directional"){w=v.direction;A=new THREE.DirectionalLight(q,P);A.position.set(w[0],w[1],w[2]);A.position.normalize()}else if(v.type==="point"){w=v.position;A=v.distance;A=new THREE.PointLight(q,P,A);A.position.set(w[0],w[1],w[2])}else v.type==="ambient"&&(A=new THREE.AmbientLight(q));y.scene.add(A);y.lights[o]=A}for(i in t.fogs){o=t.fogs[i];o.type==="linear"?
-M=new THREE.Fog(0,o.near,o.far):o.type==="exp2"&&(M=new THREE.FogExp2(0,o.density));u=o.color;M.color.setRGB(u[0],u[1],u[2]);y.fogs[i]=M}if(y.cameras&&t.defaults.camera)y.currentCamera=y.cameras[t.defaults.camera];if(y.fogs&&t.defaults.fog)y.scene.fog=y.fogs[t.defaults.fog];u=t.defaults.bgcolor;y.bgColor=new THREE.Color;y.bgColor.setRGB(u[0],u[1],u[2]);y.bgColorAlpha=t.defaults.bgalpha;for(h in t.geometries){i=t.geometries[h];if(i.type=="bin_mesh"||i.type=="ascii_mesh"){G=G+1;k.onLoadStart()}}Q=G;
-for(h in t.geometries){i=t.geometries[h];if(i.type==="cube"){D=new THREE.CubeGeometry(i.width,i.height,i.depth,i.segmentsWidth,i.segmentsHeight,i.segmentsDepth,null,i.flipped,i.sides);y.geometries[h]=D}else if(i.type==="plane"){D=new THREE.PlaneGeometry(i.width,i.height,i.segmentsWidth,i.segmentsHeight);y.geometries[h]=D}else if(i.type==="sphere"){D=new THREE.SphereGeometry(i.radius,i.segmentsWidth,i.segmentsHeight);y.geometries[h]=D}else if(i.type==="cylinder"){D=new THREE.CylinderGeometry(i.topRad,
-i.botRad,i.height,i.radSegs,i.heightSegs);y.geometries[h]=D}else if(i.type==="torus"){D=new THREE.TorusGeometry(i.radius,i.tube,i.segmentsR,i.segmentsT);y.geometries[h]=D}else if(i.type==="icosahedron"){D=new THREE.IcosahedronGeometry(i.radius,i.subdivisions);y.geometries[h]=D}else if(i.type==="bin_mesh")c.load(d(i.url,t.urlBaseType),e(h));else if(i.type==="ascii_mesh")E.load(d(i.url,t.urlBaseType),e(h));else if(i.type==="embedded_mesh"){i=t.embeds[i.id];i.metadata=t.metadata;i&&E.createModel(i,g(h),
-"")}}for(p in t.textures){h=t.textures[p];if(h.url instanceof Array){N=N+h.url.length;for(i=0;i<h.url.length;i++)k.onLoadStart()}else{N=N+1;k.onLoadStart()}}O=N;for(p in t.textures){h=t.textures[p];if(h.mapping!==void 0&&THREE[h.mapping]!==void 0)h.mapping=new THREE[h.mapping];if(h.url instanceof Array){i=h.url.length;M=[];for(c=0;c<i;c++)M[c]=d(h.url[c],t.urlBaseType);i=THREE.ImageUtils.loadTextureCube(M,h.mapping,a(i))}else{i=THREE.ImageUtils.loadTexture(d(h.url,t.urlBaseType),h.mapping,a(1));if(THREE[h.minFilter]!==
-void 0)i.minFilter=THREE[h.minFilter];if(THREE[h.magFilter]!==void 0)i.magFilter=THREE[h.magFilter];if(h.repeat){i.repeat.set(h.repeat[0],h.repeat[1]);if(h.repeat[0]!==1)i.wrapS=THREE.RepeatWrapping;if(h.repeat[1]!==1)i.wrapT=THREE.RepeatWrapping}h.offset&&i.offset.set(h.offset[0],h.offset[1]);if(h.wrap){M={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(M[h.wrap[0]]!==void 0)i.wrapS=M[h.wrap[0]];if(M[h.wrap[1]]!==void 0)i.wrapT=M[h.wrap[1]]}}y.textures[p]=i}for(n in t.materials){s=
+u[1],u[2]);y.cameras[q]=P}for(o in t.lights){v=t.lights[o];q=v.color!==void 0?v.color:16777215;P=v.intensity!==void 0?v.intensity:1;if(v.type==="directional"){w=v.direction;A=new THREE.DirectionalLight(q,P);A.position.set(w[0],w[1],w[2]);A.position.normalize()}else if(v.type==="point"){w=v.position;A=v.distance;A=new THREE.PointLight(q,P,A);A.position.set(w[0],w[1],w[2])}else v.type==="ambient"&&(A=new THREE.AmbientLight(q));y.scene.add(A);y.lights[o]=A}for(l in t.fogs){o=t.fogs[l];o.type==="linear"?
+M=new THREE.Fog(0,o.near,o.far):o.type==="exp2"&&(M=new THREE.FogExp2(0,o.density));u=o.color;M.color.setRGB(u[0],u[1],u[2]);y.fogs[l]=M}if(y.cameras&&t.defaults.camera)y.currentCamera=y.cameras[t.defaults.camera];if(y.fogs&&t.defaults.fog)y.scene.fog=y.fogs[t.defaults.fog];u=t.defaults.bgcolor;y.bgColor=new THREE.Color;y.bgColor.setRGB(u[0],u[1],u[2]);y.bgColorAlpha=t.defaults.bgalpha;for(h in t.geometries){l=t.geometries[h];if(l.type=="bin_mesh"||l.type=="ascii_mesh"){G=G+1;k.onLoadStart()}}Q=G;
+for(h in t.geometries){l=t.geometries[h];if(l.type==="cube"){D=new THREE.CubeGeometry(l.width,l.height,l.depth,l.segmentsWidth,l.segmentsHeight,l.segmentsDepth,null,l.flipped,l.sides);y.geometries[h]=D}else if(l.type==="plane"){D=new THREE.PlaneGeometry(l.width,l.height,l.segmentsWidth,l.segmentsHeight);y.geometries[h]=D}else if(l.type==="sphere"){D=new THREE.SphereGeometry(l.radius,l.segmentsWidth,l.segmentsHeight);y.geometries[h]=D}else if(l.type==="cylinder"){D=new THREE.CylinderGeometry(l.topRad,
+l.botRad,l.height,l.radSegs,l.heightSegs);y.geometries[h]=D}else if(l.type==="torus"){D=new THREE.TorusGeometry(l.radius,l.tube,l.segmentsR,l.segmentsT);y.geometries[h]=D}else if(l.type==="icosahedron"){D=new THREE.IcosahedronGeometry(l.radius,l.subdivisions);y.geometries[h]=D}else if(l.type==="bin_mesh")c.load(d(l.url,t.urlBaseType),e(h));else if(l.type==="ascii_mesh")E.load(d(l.url,t.urlBaseType),e(h));else if(l.type==="embedded_mesh"){l=t.embeds[l.id];l.metadata=t.metadata;l&&E.createModel(l,g(h),
+"")}}for(p in t.textures){h=t.textures[p];if(h.url instanceof Array){N=N+h.url.length;for(l=0;l<h.url.length;l++)k.onLoadStart()}else{N=N+1;k.onLoadStart()}}O=N;for(p in t.textures){h=t.textures[p];if(h.mapping!==void 0&&THREE[h.mapping]!==void 0)h.mapping=new THREE[h.mapping];if(h.url instanceof Array){l=h.url.length;M=[];for(c=0;c<l;c++)M[c]=d(h.url[c],t.urlBaseType);l=THREE.ImageUtils.loadTextureCube(M,h.mapping,a(l))}else{l=THREE.ImageUtils.loadTexture(d(h.url,t.urlBaseType),h.mapping,a(1));if(THREE[h.minFilter]!==
+void 0)l.minFilter=THREE[h.minFilter];if(THREE[h.magFilter]!==void 0)l.magFilter=THREE[h.magFilter];if(h.repeat){l.repeat.set(h.repeat[0],h.repeat[1]);if(h.repeat[0]!==1)l.wrapS=THREE.RepeatWrapping;if(h.repeat[1]!==1)l.wrapT=THREE.RepeatWrapping}h.offset&&l.offset.set(h.offset[0],h.offset[1]);if(h.wrap){M={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(M[h.wrap[0]]!==void 0)l.wrapS=M[h.wrap[0]];if(M[h.wrap[1]]!==void 0)l.wrapT=M[h.wrap[1]]}}y.textures[p]=l}for(n in t.materials){s=
 t.materials[n];for(z in s.parameters)if(z==="envMap"||z==="map"||z==="lightMap")s.parameters[z]=y.textures[s.parameters[z]];else if(z==="shading")s.parameters[z]=s.parameters[z]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(z==="blending")s.parameters[z]=s.parameters[z]in THREE?THREE[s.parameters[z]]:THREE.NormalBlending;else if(z==="combine")s.parameters[z]=s.parameters[z]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(z==="vertexColors")if(s.parameters[z]=="face")s.parameters[z]=
-THREE.FaceColors;else if(s.parameters[z])s.parameters[z]=THREE.VertexColors;if(s.parameters.opacity!==void 0&&s.parameters.opacity<1)s.parameters.transparent=true;if(s.parameters.normalMap){p=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(p.uniforms);h=s.parameters.color;i=s.parameters.specular;M=s.parameters.ambient;c=s.parameters.shininess;a.tNormal.texture=y.textures[s.parameters.normalMap];if(s.parameters.normalMapFactor)a.uNormalScale.value=s.parameters.normalMapFactor;if(s.parameters.map){a.tDiffuse.texture=
-s.parameters.map;a.enableDiffuse.value=true}if(s.parameters.lightMap){a.tAO.texture=s.parameters.lightMap;a.enableAO.value=true}if(s.parameters.specularMap){a.tSpecular.texture=y.textures[s.parameters.specularMap];a.enableSpecular.value=true}a.uDiffuseColor.value.setHex(h);a.uSpecularColor.value.setHex(i);a.uAmbientColor.value.setHex(M);a.uShininess.value=c;if(s.parameters.opacity)a.uOpacity.value=s.parameters.opacity;H=new THREE.ShaderMaterial({fragmentShader:p.fragmentShader,vertexShader:p.vertexShader,
+THREE.FaceColors;else if(s.parameters[z])s.parameters[z]=THREE.VertexColors;if(s.parameters.opacity!==void 0&&s.parameters.opacity<1)s.parameters.transparent=true;if(s.parameters.normalMap){p=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(p.uniforms);h=s.parameters.color;l=s.parameters.specular;M=s.parameters.ambient;c=s.parameters.shininess;a.tNormal.texture=y.textures[s.parameters.normalMap];if(s.parameters.normalMapFactor)a.uNormalScale.value=s.parameters.normalMapFactor;if(s.parameters.map){a.tDiffuse.texture=
+s.parameters.map;a.enableDiffuse.value=true}if(s.parameters.lightMap){a.tAO.texture=s.parameters.lightMap;a.enableAO.value=true}if(s.parameters.specularMap){a.tSpecular.texture=y.textures[s.parameters.specularMap];a.enableSpecular.value=true}a.uDiffuseColor.value.setHex(h);a.uSpecularColor.value.setHex(l);a.uAmbientColor.value.setHex(M);a.uShininess.value=c;if(s.parameters.opacity)a.uOpacity.value=s.parameters.opacity;H=new THREE.ShaderMaterial({fragmentShader:p.fragmentShader,vertexShader:p.vertexShader,
 uniforms:a,lights:true,fog:true})}else H=new THREE[s.type](s.parameters);y.materials[n]=H}f();k.callbackSync(y);m()};THREE.TextureLoader=function(){THREE.EventTarget.call(this);this.crossOrigin=null};
 THREE.TextureLoader.prototype={constructor:THREE.TextureLoader,load:function(a){var b=this,c=new Image;c.addEventListener("load",function(){var a=new THREE.Texture(c);a.needsUpdate=true;b.dispatchEvent({type:"load",content:a})},false);c.addEventListener("error",function(){b.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},false);if(b.crossOrigin)c.crossOrigin=b.crossOrigin;c.src=a}};
 THREE.Material=function(a){a=a||{};this.id=THREE.MaterialCount++;this.name="";this.opacity=a.opacity!==void 0?a.opacity:1;this.transparent=a.transparent!==void 0?a.transparent:false;this.blending=a.blending!==void 0?a.blending:THREE.NormalBlending;this.blendSrc=a.blendSrc!==void 0?a.blendSrc:THREE.SrcAlphaFactor;this.blendDst=a.blendDst!==void 0?a.blendDst:THREE.OneMinusSrcAlphaFactor;this.blendEquation=a.blendEquation!==void 0?a.blendEquation:THREE.AddEquation;this.depthTest=a.depthTest!==void 0?
@@ -198,7 +199,7 @@ THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial;TH
 THREE.Texture=function(a,b,c,d,f,e,g,m){this.id=THREE.TextureCount++;this.image=a;this.mapping=b!==void 0?b:new THREE.UVMapping;this.wrapS=c!==void 0?c:THREE.ClampToEdgeWrapping;this.wrapT=d!==void 0?d:THREE.ClampToEdgeWrapping;this.magFilter=f!==void 0?f:THREE.LinearFilter;this.minFilter=e!==void 0?e:THREE.LinearMipMapLinearFilter;this.format=g!==void 0?g:THREE.RGBAFormat;this.type=m!==void 0?m:THREE.UnsignedByteType;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.generateMipmaps=
 true;this.needsUpdate=this.premultiplyAlpha=false;this.onUpdate=null};THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var a=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter,this.format,this.type);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a}};THREE.TextureCount=0;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.UVMapping=function(){};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};
 THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.UnsignedByteType=9;THREE.ByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;
-THREE.UnsignedShort4444Type=16;THREE.UnsignedShort5551Type=17;THREE.UnsignedShort565Type=18;THREE.AlphaFormat=19;THREE.RGBFormat=20;THREE.RGBAFormat=21;THREE.LuminanceFormat=22;THREE.LuminanceAlphaFormat=23;THREE.DataTexture=function(a,b,c,d,f,e,g,m,k,l){THREE.Texture.call(this,null,e,g,m,k,l,d,f);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
+THREE.UnsignedShort4444Type=16;THREE.UnsignedShort5551Type=17;THREE.UnsignedShort565Type=18;THREE.AlphaFormat=19;THREE.RGBFormat=20;THREE.RGBAFormat=21;THREE.LuminanceFormat=22;THREE.LuminanceAlphaFormat=23;THREE.DataTexture=function(a,b,c,d,f,e,g,m,k,j){THREE.Texture.call(this,null,e,g,m,k,j,d,f);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
 THREE.DataTexture.prototype.clone=function(){var a=new THREE.DataTexture(this.image.data,this.image.width,this.image.height,this.format,this.type,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a};THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;
 THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.material=b!==void 0?b:new THREE.LineBasicMaterial({color:Math.random()*16777215});this.type=c!==void 0?c:THREE.LineStrip;this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere())};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
 THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b!==void 0?b:new THREE.MeshBasicMaterial({color:Math.random()*16777215,wireframe:true});if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius;if(this.geometry.morphTargets.length){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var c=0;c<this.geometry.morphTargets.length;c++){this.morphTargetInfluences.push(0);
@@ -211,35 +212,35 @@ THREE.SpriteAlignment.topLeft=new THREE.Vector2(1,-1);THREE.SpriteAlignment.topC
 THREE.SpriteAlignment.bottomRight=new THREE.Vector2(-1,1);THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=null;this.matrixAutoUpdate=false;this.__objects=[];this.__lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;
 THREE.Scene.prototype.__addObject=function(a){if(a instanceof THREE.Light)this.__lights.indexOf(a)===-1&&this.__lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.__objects.indexOf(a)===-1){this.__objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);b!==-1&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.__addObject(a.children[b])};
 THREE.Scene.prototype.__removeObject=function(a){if(a instanceof THREE.Light){var b=this.__lights.indexOf(a);b!==-1&&this.__lights.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.__objects.indexOf(a);if(b!==-1){this.__objects.splice(b,1);this.__objectsRemoved.push(a);b=this.__objectsAdded.indexOf(a);b!==-1&&this.__objectsAdded.splice(b,1)}}for(b=0;b<a.children.length;b++)this.__removeObject(a.children[b])};
-THREE.CanvasRenderer=function(a){function b(a){if(s!=a)i.globalAlpha=s=a}function c(a){if(v!=a){switch(a){case THREE.NormalBlending:i.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:i.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:i.globalCompositeOperation="darker"}v=a}}function d(a){if(A!=a)i.strokeStyle=A=a}function f(a){if(w!=a)i.fillStyle=w=a}console.log("THREE.CanvasRenderer",THREE.REVISION);var a=a||{},e=this,g,m,k,l=new THREE.Projector,h=a.canvas!==
-void 0?a.canvas:document.createElement("canvas"),n,j,o,q,i=h.getContext("2d"),p=new THREE.Color(0),r=0,s=1,v=0,A=null,w=null,B=null,x=null,F=null,u,z,D,H,P=new THREE.RenderableVertex,M=new THREE.RenderableVertex,t,E,G,N,Q,O,y,S,L,U,T,W,C=new THREE.Color,J=new THREE.Color,I=new THREE.Color,K=new THREE.Color,R=new THREE.Color,ja=[],da=[],ea,fa,ca,ka,za,Aa,Ba,Ca,Da,Ea,la=new THREE.Rectangle,$=new THREE.Rectangle,Z=new THREE.Rectangle,xa=false,Y=new THREE.Color,ma=new THREE.Color,na=new THREE.Color,V=
-new THREE.Vector3,ra,sa,ya,aa,ta,ua,a=16;ra=document.createElement("canvas");ra.width=ra.height=2;sa=ra.getContext("2d");sa.fillStyle="rgba(0,0,0,1)";sa.fillRect(0,0,2,2);ya=sa.getImageData(0,0,2,2);aa=ya.data;ta=document.createElement("canvas");ta.width=ta.height=a;ua=ta.getContext("2d");ua.translate(-a/2,-a/2);ua.scale(a,a);a--;this.domElement=h;this.sortElements=this.sortObjects=this.autoClear=true;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){n=a;j=b;o=Math.floor(n/2);q=Math.floor(j/
-2);h.width=n;h.height=j;la.set(-o,-q,o,q);$.set(-o,-q,o,q);s=1;v=0;F=x=B=w=A=null};this.setClearColor=function(a,b){p.copy(a);r=b!==void 0?b:1;$.set(-o,-q,o,q)};this.setClearColorHex=function(a,b){p.setHex(a);r=b!==void 0?b:1;$.set(-o,-q,o,q)};this.clear=function(){i.setTransform(1,0,0,-1,o,q);if(!$.isEmpty()){$.minSelf(la);$.inflate(2);r<1&&i.clearRect(Math.floor($.getX()),Math.floor($.getY()),Math.floor($.getWidth()),Math.floor($.getHeight()));if(r>0){c(THREE.NormalBlending);b(1);f("rgba("+Math.floor(p.r*
-255)+","+Math.floor(p.g*255)+","+Math.floor(p.b*255)+","+r+")");i.fillRect(Math.floor($.getX()),Math.floor($.getY()),Math.floor($.getWidth()),Math.floor($.getHeight()))}$.empty()}};this.render=function(a,h){function j(a){var b,c,d,e;Y.setRGB(0,0,0);ma.setRGB(0,0,0);na.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++){d=a[b];e=d.color;if(d instanceof THREE.AmbientLight){Y.r=Y.r+e.r;Y.g=Y.g+e.g;Y.b=Y.b+e.b}else if(d instanceof THREE.DirectionalLight){ma.r=ma.r+e.r;ma.g=ma.g+e.g;ma.b=ma.b+e.b}else if(d instanceof
-THREE.PointLight){na.r=na.r+e.r;na.g=na.g+e.g;na.b=na.b+e.b}}}function n(a,b,c,d){var e,f,g,h,l,k;e=0;for(f=a.length;e<f;e++){g=a[e];h=g.color;if(g instanceof THREE.DirectionalLight){l=g.matrixWorld.getPosition();k=c.dot(l);if(!(k<=0)){k=k*g.intensity;d.r=d.r+h.r*k;d.g=d.g+h.g*k;d.b=d.b+h.b*k}}else if(g instanceof THREE.PointLight){l=g.matrixWorld.getPosition();k=c.dot(V.sub(l,b).normalize());if(!(k<=0)){k=k*(g.distance==0?1:1-Math.min(b.distanceTo(l)/g.distance,1));if(k!=0){k=k*g.intensity;d.r=d.r+
-h.r*k;d.g=d.g+h.g*k;d.b=d.b+h.b*k}}}}}function p(a,e,g){b(g.opacity);c(g.blending);var h,k,l,m,j,n;if(g instanceof THREE.ParticleBasicMaterial){if(g.map){m=g.map.image;j=m.width>>1;n=m.height>>1;g=e.scale.x*o;l=e.scale.y*q;h=g*j;k=l*n;Z.set(a.x-h,a.y-k,a.x+h,a.y+k);if(la.intersects(Z)){i.save();i.translate(a.x,a.y);i.rotate(-e.rotation);i.scale(g,-l);i.translate(-j,-n);i.drawImage(m,0,0);i.restore()}}}else if(g instanceof THREE.ParticleCanvasMaterial){h=e.scale.x*o;k=e.scale.y*q;Z.set(a.x-h,a.y-k,
-a.x+h,a.y+k);if(la.intersects(Z)){d(g.color.getContextStyle());f(g.color.getContextStyle());i.save();i.translate(a.x,a.y);i.rotate(-e.rotation);i.scale(h,k);g.program(i);i.restore()}}}function r(a,e,f,g){b(g.opacity);c(g.blending);i.beginPath();i.moveTo(a.positionScreen.x,a.positionScreen.y);i.lineTo(e.positionScreen.x,e.positionScreen.y);i.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(B!=a)i.lineWidth=B=a;a=g.linecap;if(x!=a)i.lineCap=x=a;a=g.linejoin;if(F!=a)i.lineJoin=F=
-a;d(g.color.getContextStyle());i.stroke();Z.inflate(g.linewidth*2)}}function s(a,d,f,g,l,m,i,j){e.info.render.vertices=e.info.render.vertices+3;e.info.render.faces++;b(j.opacity);c(j.blending);t=a.positionScreen.x;E=a.positionScreen.y;G=d.positionScreen.x;N=d.positionScreen.y;Q=f.positionScreen.x;O=f.positionScreen.y;v(t,E,G,N,Q,O);if(j instanceof THREE.MeshBasicMaterial)if(j.map){if(j.map.mapping instanceof THREE.UVMapping){ka=i.uvs[0];Fa(t,E,G,N,Q,O,ka[g].u,ka[g].v,ka[l].u,ka[l].v,ka[m].u,ka[m].v,
-j.map)}}else if(j.envMap){if(j.envMap.mapping instanceof THREE.SphericalReflectionMapping){a=h.matrixWorldInverse;V.copy(i.vertexNormalsWorld[g]);za=(V.x*a.elements[0]+V.y*a.elements[4]+V.z*a.elements[8])*0.5+0.5;Aa=-(V.x*a.elements[1]+V.y*a.elements[5]+V.z*a.elements[9])*0.5+0.5;V.copy(i.vertexNormalsWorld[l]);Ba=(V.x*a.elements[0]+V.y*a.elements[4]+V.z*a.elements[8])*0.5+0.5;Ca=-(V.x*a.elements[1]+V.y*a.elements[5]+V.z*a.elements[9])*0.5+0.5;V.copy(i.vertexNormalsWorld[m]);Da=(V.x*a.elements[0]+
-V.y*a.elements[4]+V.z*a.elements[8])*0.5+0.5;Ea=-(V.x*a.elements[1]+V.y*a.elements[5]+V.z*a.elements[9])*0.5+0.5;Fa(t,E,G,N,Q,O,za,Aa,Ba,Ca,Da,Ea,j.envMap)}}else j.wireframe?ha(j.color,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):ga(j.color);else if(j instanceof THREE.MeshLambertMaterial)if(xa)if(!j.wireframe&&j.shading==THREE.SmoothShading&&i.vertexNormalsWorld.length==3){J.r=I.r=K.r=Y.r;J.g=I.g=K.g=Y.g;J.b=I.b=K.b=Y.b;n(k,i.v1.positionWorld,i.vertexNormalsWorld[0],J);n(k,i.v2.positionWorld,
-i.vertexNormalsWorld[1],I);n(k,i.v3.positionWorld,i.vertexNormalsWorld[2],K);J.r=Math.max(0,Math.min(j.color.r*J.r,1));J.g=Math.max(0,Math.min(j.color.g*J.g,1));J.b=Math.max(0,Math.min(j.color.b*J.b,1));I.r=Math.max(0,Math.min(j.color.r*I.r,1));I.g=Math.max(0,Math.min(j.color.g*I.g,1));I.b=Math.max(0,Math.min(j.color.b*I.b,1));K.r=Math.max(0,Math.min(j.color.r*K.r,1));K.g=Math.max(0,Math.min(j.color.g*K.g,1));K.b=Math.max(0,Math.min(j.color.b*K.b,1));R.r=(I.r+K.r)*0.5;R.g=(I.g+K.g)*0.5;R.b=(I.b+K.b)*
-0.5;ca=va(J,I,K,R);pa(t,E,G,N,Q,O,0,0,1,0,0,1,ca)}else{C.r=Y.r;C.g=Y.g;C.b=Y.b;n(k,i.centroidWorld,i.normalWorld,C);C.r=Math.max(0,Math.min(j.color.r*C.r,1));C.g=Math.max(0,Math.min(j.color.g*C.g,1));C.b=Math.max(0,Math.min(j.color.b*C.b,1));j.wireframe?ha(C,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):ga(C)}else j.wireframe?ha(j.color,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):ga(j.color);else if(j instanceof THREE.MeshDepthMaterial){ea=h.near;fa=h.far;J.r=J.g=J.b=
-1-oa(a.positionScreen.z,ea,fa);I.r=I.g=I.b=1-oa(d.positionScreen.z,ea,fa);K.r=K.g=K.b=1-oa(f.positionScreen.z,ea,fa);R.r=(I.r+K.r)*0.5;R.g=(I.g+K.g)*0.5;R.b=(I.b+K.b)*0.5;ca=va(J,I,K,R);pa(t,E,G,N,Q,O,0,0,1,0,0,1,ca)}else if(j instanceof THREE.MeshNormalMaterial){C.r=qa(i.normalWorld.x);C.g=qa(i.normalWorld.y);C.b=qa(i.normalWorld.z);j.wireframe?ha(C,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):ga(C)}}function w(a,d,f,g,l,m,j,i,o){e.info.render.vertices=e.info.render.vertices+4;e.info.render.faces++;
-b(i.opacity);c(i.blending);if(i.map||i.envMap){s(a,d,g,0,1,3,j,i,o);s(l,f,m,1,2,3,j,i,o)}else{t=a.positionScreen.x;E=a.positionScreen.y;G=d.positionScreen.x;N=d.positionScreen.y;Q=f.positionScreen.x;O=f.positionScreen.y;y=g.positionScreen.x;S=g.positionScreen.y;L=l.positionScreen.x;U=l.positionScreen.y;T=m.positionScreen.x;W=m.positionScreen.y;if(i instanceof THREE.MeshBasicMaterial){A(t,E,G,N,Q,O,y,S);i.wireframe?ha(i.color,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):ga(i.color)}else if(i instanceof
-THREE.MeshLambertMaterial)if(xa)if(!i.wireframe&&i.shading==THREE.SmoothShading&&j.vertexNormalsWorld.length==4){J.r=I.r=K.r=R.r=Y.r;J.g=I.g=K.g=R.g=Y.g;J.b=I.b=K.b=R.b=Y.b;n(k,j.v1.positionWorld,j.vertexNormalsWorld[0],J);n(k,j.v2.positionWorld,j.vertexNormalsWorld[1],I);n(k,j.v4.positionWorld,j.vertexNormalsWorld[3],K);n(k,j.v3.positionWorld,j.vertexNormalsWorld[2],R);J.r=Math.max(0,Math.min(i.color.r*J.r,1));J.g=Math.max(0,Math.min(i.color.g*J.g,1));J.b=Math.max(0,Math.min(i.color.b*J.b,1));I.r=
+THREE.CanvasRenderer=function(a){function b(a){if(s!=a)l.globalAlpha=s=a}function c(a){if(v!=a){switch(a){case THREE.NormalBlending:l.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:l.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:l.globalCompositeOperation="darker"}v=a}}function d(a){if(A!=a)l.strokeStyle=A=a}function f(a){if(w!=a)l.fillStyle=w=a}console.log("THREE.CanvasRenderer",THREE.REVISION);var a=a||{},e=this,g,m,k,j=new THREE.Projector,h=a.canvas!==
+void 0?a.canvas:document.createElement("canvas"),n,i,o,q,l=h.getContext("2d"),p=new THREE.Color(0),r=0,s=1,v=0,A=null,w=null,B=null,x=null,F=null,u,z,D,H,P=new THREE.RenderableVertex,M=new THREE.RenderableVertex,t,E,G,N,Q,O,y,S,L,U,T,W,C=new THREE.Color,J=new THREE.Color,I=new THREE.Color,K=new THREE.Color,R=new THREE.Color,ja=[],da=[],ea,fa,ca,ka,za,Aa,Ba,Ca,Da,Ea,la=new THREE.Rectangle,$=new THREE.Rectangle,Z=new THREE.Rectangle,xa=false,Y=new THREE.Color,ma=new THREE.Color,na=new THREE.Color,V=
+new THREE.Vector3,ra,sa,ya,aa,ta,ua,a=16;ra=document.createElement("canvas");ra.width=ra.height=2;sa=ra.getContext("2d");sa.fillStyle="rgba(0,0,0,1)";sa.fillRect(0,0,2,2);ya=sa.getImageData(0,0,2,2);aa=ya.data;ta=document.createElement("canvas");ta.width=ta.height=a;ua=ta.getContext("2d");ua.translate(-a/2,-a/2);ua.scale(a,a);a--;this.domElement=h;this.sortElements=this.sortObjects=this.autoClear=true;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){n=a;i=b;o=Math.floor(n/2);q=Math.floor(i/
+2);h.width=n;h.height=i;la.set(-o,-q,o,q);$.set(-o,-q,o,q);s=1;v=0;F=x=B=w=A=null};this.setClearColor=function(a,b){p.copy(a);r=b!==void 0?b:1;$.set(-o,-q,o,q)};this.setClearColorHex=function(a,b){p.setHex(a);r=b!==void 0?b:1;$.set(-o,-q,o,q)};this.clear=function(){l.setTransform(1,0,0,-1,o,q);if(!$.isEmpty()){$.minSelf(la);$.inflate(2);r<1&&l.clearRect(Math.floor($.getX()),Math.floor($.getY()),Math.floor($.getWidth()),Math.floor($.getHeight()));if(r>0){c(THREE.NormalBlending);b(1);f("rgba("+Math.floor(p.r*
+255)+","+Math.floor(p.g*255)+","+Math.floor(p.b*255)+","+r+")");l.fillRect(Math.floor($.getX()),Math.floor($.getY()),Math.floor($.getWidth()),Math.floor($.getHeight()))}$.empty()}};this.render=function(a,h){function i(a){var b,c,d,e;Y.setRGB(0,0,0);ma.setRGB(0,0,0);na.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++){d=a[b];e=d.color;if(d instanceof THREE.AmbientLight){Y.r=Y.r+e.r;Y.g=Y.g+e.g;Y.b=Y.b+e.b}else if(d instanceof THREE.DirectionalLight){ma.r=ma.r+e.r;ma.g=ma.g+e.g;ma.b=ma.b+e.b}else if(d instanceof
+THREE.PointLight){na.r=na.r+e.r;na.g=na.g+e.g;na.b=na.b+e.b}}}function n(a,b,c,d){var e,f,g,h,j,k;e=0;for(f=a.length;e<f;e++){g=a[e];h=g.color;if(g instanceof THREE.DirectionalLight){j=g.matrixWorld.getPosition();k=c.dot(j);if(!(k<=0)){k=k*g.intensity;d.r=d.r+h.r*k;d.g=d.g+h.g*k;d.b=d.b+h.b*k}}else if(g instanceof THREE.PointLight){j=g.matrixWorld.getPosition();k=c.dot(V.sub(j,b).normalize());if(!(k<=0)){k=k*(g.distance==0?1:1-Math.min(b.distanceTo(j)/g.distance,1));if(k!=0){k=k*g.intensity;d.r=d.r+
+h.r*k;d.g=d.g+h.g*k;d.b=d.b+h.b*k}}}}}function p(a,e,g){b(g.opacity);c(g.blending);var h,k,j,m,i,n;if(g instanceof THREE.ParticleBasicMaterial){if(g.map){m=g.map.image;i=m.width>>1;n=m.height>>1;g=e.scale.x*o;j=e.scale.y*q;h=g*i;k=j*n;Z.set(a.x-h,a.y-k,a.x+h,a.y+k);if(la.intersects(Z)){l.save();l.translate(a.x,a.y);l.rotate(-e.rotation);l.scale(g,-j);l.translate(-i,-n);l.drawImage(m,0,0);l.restore()}}}else if(g instanceof THREE.ParticleCanvasMaterial){h=e.scale.x*o;k=e.scale.y*q;Z.set(a.x-h,a.y-k,
+a.x+h,a.y+k);if(la.intersects(Z)){d(g.color.getContextStyle());f(g.color.getContextStyle());l.save();l.translate(a.x,a.y);l.rotate(-e.rotation);l.scale(h,k);g.program(l);l.restore()}}}function r(a,e,f,g){b(g.opacity);c(g.blending);l.beginPath();l.moveTo(a.positionScreen.x,a.positionScreen.y);l.lineTo(e.positionScreen.x,e.positionScreen.y);l.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(B!=a)l.lineWidth=B=a;a=g.linecap;if(x!=a)l.lineCap=x=a;a=g.linejoin;if(F!=a)l.lineJoin=F=
+a;d(g.color.getContextStyle());l.stroke();Z.inflate(g.linewidth*2)}}function s(a,d,f,g,j,m,l,i){e.info.render.vertices=e.info.render.vertices+3;e.info.render.faces++;b(i.opacity);c(i.blending);t=a.positionScreen.x;E=a.positionScreen.y;G=d.positionScreen.x;N=d.positionScreen.y;Q=f.positionScreen.x;O=f.positionScreen.y;v(t,E,G,N,Q,O);if(i instanceof THREE.MeshBasicMaterial)if(i.map){if(i.map.mapping instanceof THREE.UVMapping){ka=l.uvs[0];Fa(t,E,G,N,Q,O,ka[g].u,ka[g].v,ka[j].u,ka[j].v,ka[m].u,ka[m].v,
+i.map)}}else if(i.envMap){if(i.envMap.mapping instanceof THREE.SphericalReflectionMapping){a=h.matrixWorldInverse;V.copy(l.vertexNormalsWorld[g]);za=(V.x*a.elements[0]+V.y*a.elements[4]+V.z*a.elements[8])*0.5+0.5;Aa=-(V.x*a.elements[1]+V.y*a.elements[5]+V.z*a.elements[9])*0.5+0.5;V.copy(l.vertexNormalsWorld[j]);Ba=(V.x*a.elements[0]+V.y*a.elements[4]+V.z*a.elements[8])*0.5+0.5;Ca=-(V.x*a.elements[1]+V.y*a.elements[5]+V.z*a.elements[9])*0.5+0.5;V.copy(l.vertexNormalsWorld[m]);Da=(V.x*a.elements[0]+
+V.y*a.elements[4]+V.z*a.elements[8])*0.5+0.5;Ea=-(V.x*a.elements[1]+V.y*a.elements[5]+V.z*a.elements[9])*0.5+0.5;Fa(t,E,G,N,Q,O,za,Aa,Ba,Ca,Da,Ea,i.envMap)}}else i.wireframe?ha(i.color,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):ga(i.color);else if(i instanceof THREE.MeshLambertMaterial)if(xa)if(!i.wireframe&&i.shading==THREE.SmoothShading&&l.vertexNormalsWorld.length==3){J.r=I.r=K.r=Y.r;J.g=I.g=K.g=Y.g;J.b=I.b=K.b=Y.b;n(k,l.v1.positionWorld,l.vertexNormalsWorld[0],J);n(k,l.v2.positionWorld,
+l.vertexNormalsWorld[1],I);n(k,l.v3.positionWorld,l.vertexNormalsWorld[2],K);J.r=Math.max(0,Math.min(i.color.r*J.r,1));J.g=Math.max(0,Math.min(i.color.g*J.g,1));J.b=Math.max(0,Math.min(i.color.b*J.b,1));I.r=Math.max(0,Math.min(i.color.r*I.r,1));I.g=Math.max(0,Math.min(i.color.g*I.g,1));I.b=Math.max(0,Math.min(i.color.b*I.b,1));K.r=Math.max(0,Math.min(i.color.r*K.r,1));K.g=Math.max(0,Math.min(i.color.g*K.g,1));K.b=Math.max(0,Math.min(i.color.b*K.b,1));R.r=(I.r+K.r)*0.5;R.g=(I.g+K.g)*0.5;R.b=(I.b+K.b)*
+0.5;ca=va(J,I,K,R);pa(t,E,G,N,Q,O,0,0,1,0,0,1,ca)}else{C.r=Y.r;C.g=Y.g;C.b=Y.b;n(k,l.centroidWorld,l.normalWorld,C);C.r=Math.max(0,Math.min(i.color.r*C.r,1));C.g=Math.max(0,Math.min(i.color.g*C.g,1));C.b=Math.max(0,Math.min(i.color.b*C.b,1));i.wireframe?ha(C,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):ga(C)}else i.wireframe?ha(i.color,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):ga(i.color);else if(i instanceof THREE.MeshDepthMaterial){ea=h.near;fa=h.far;J.r=J.g=J.b=
+1-oa(a.positionScreen.z,ea,fa);I.r=I.g=I.b=1-oa(d.positionScreen.z,ea,fa);K.r=K.g=K.b=1-oa(f.positionScreen.z,ea,fa);R.r=(I.r+K.r)*0.5;R.g=(I.g+K.g)*0.5;R.b=(I.b+K.b)*0.5;ca=va(J,I,K,R);pa(t,E,G,N,Q,O,0,0,1,0,0,1,ca)}else if(i instanceof THREE.MeshNormalMaterial){C.r=qa(l.normalWorld.x);C.g=qa(l.normalWorld.y);C.b=qa(l.normalWorld.z);i.wireframe?ha(C,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):ga(C)}}function w(a,d,f,g,j,m,l,i,o){e.info.render.vertices=e.info.render.vertices+4;e.info.render.faces++;
+b(i.opacity);c(i.blending);if(i.map||i.envMap){s(a,d,g,0,1,3,l,i,o);s(j,f,m,1,2,3,l,i,o)}else{t=a.positionScreen.x;E=a.positionScreen.y;G=d.positionScreen.x;N=d.positionScreen.y;Q=f.positionScreen.x;O=f.positionScreen.y;y=g.positionScreen.x;S=g.positionScreen.y;L=j.positionScreen.x;U=j.positionScreen.y;T=m.positionScreen.x;W=m.positionScreen.y;if(i instanceof THREE.MeshBasicMaterial){A(t,E,G,N,Q,O,y,S);i.wireframe?ha(i.color,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):ga(i.color)}else if(i instanceof
+THREE.MeshLambertMaterial)if(xa)if(!i.wireframe&&i.shading==THREE.SmoothShading&&l.vertexNormalsWorld.length==4){J.r=I.r=K.r=R.r=Y.r;J.g=I.g=K.g=R.g=Y.g;J.b=I.b=K.b=R.b=Y.b;n(k,l.v1.positionWorld,l.vertexNormalsWorld[0],J);n(k,l.v2.positionWorld,l.vertexNormalsWorld[1],I);n(k,l.v4.positionWorld,l.vertexNormalsWorld[3],K);n(k,l.v3.positionWorld,l.vertexNormalsWorld[2],R);J.r=Math.max(0,Math.min(i.color.r*J.r,1));J.g=Math.max(0,Math.min(i.color.g*J.g,1));J.b=Math.max(0,Math.min(i.color.b*J.b,1));I.r=
 Math.max(0,Math.min(i.color.r*I.r,1));I.g=Math.max(0,Math.min(i.color.g*I.g,1));I.b=Math.max(0,Math.min(i.color.b*I.b,1));K.r=Math.max(0,Math.min(i.color.r*K.r,1));K.g=Math.max(0,Math.min(i.color.g*K.g,1));K.b=Math.max(0,Math.min(i.color.b*K.b,1));R.r=Math.max(0,Math.min(i.color.r*R.r,1));R.g=Math.max(0,Math.min(i.color.g*R.g,1));R.b=Math.max(0,Math.min(i.color.b*R.b,1));ca=va(J,I,K,R);v(t,E,G,N,y,S);pa(t,E,G,N,y,S,0,0,1,0,0,1,ca);v(L,U,Q,O,T,W);pa(L,U,Q,O,T,W,1,0,1,1,0,1,ca)}else{C.r=Y.r;C.g=Y.g;
-C.b=Y.b;n(k,j.centroidWorld,j.normalWorld,C);C.r=Math.max(0,Math.min(i.color.r*C.r,1));C.g=Math.max(0,Math.min(i.color.g*C.g,1));C.b=Math.max(0,Math.min(i.color.b*C.b,1));A(t,E,G,N,Q,O,y,S);i.wireframe?ha(C,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):ga(C)}else{A(t,E,G,N,Q,O,y,S);i.wireframe?ha(i.color,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):ga(i.color)}else if(i instanceof THREE.MeshNormalMaterial){C.r=qa(j.normalWorld.x);C.g=qa(j.normalWorld.y);C.b=qa(j.normalWorld.z);
-A(t,E,G,N,Q,O,y,S);i.wireframe?ha(C,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):ga(C)}else if(i instanceof THREE.MeshDepthMaterial){ea=h.near;fa=h.far;J.r=J.g=J.b=1-oa(a.positionScreen.z,ea,fa);I.r=I.g=I.b=1-oa(d.positionScreen.z,ea,fa);K.r=K.g=K.b=1-oa(g.positionScreen.z,ea,fa);R.r=R.g=R.b=1-oa(f.positionScreen.z,ea,fa);ca=va(J,I,K,R);v(t,E,G,N,y,S);pa(t,E,G,N,y,S,0,0,1,0,0,1,ca);v(L,U,Q,O,T,W);pa(L,U,Q,O,T,W,1,0,1,1,0,1,ca)}}}function v(a,b,c,d,e,f){i.beginPath();i.moveTo(a,b);
-i.lineTo(c,d);i.lineTo(e,f);i.lineTo(a,b)}function A(a,b,c,d,e,f,g,h){i.beginPath();i.moveTo(a,b);i.lineTo(c,d);i.lineTo(e,f);i.lineTo(g,h);i.lineTo(a,b)}function ha(a,b,c,e){if(B!=b)i.lineWidth=B=b;if(x!=c)i.lineCap=x=c;if(F!=e)i.lineJoin=F=e;d(a.getContextStyle());i.stroke();Z.inflate(b*2)}function ga(a){f(a.getContextStyle());i.fill()}function Fa(a,b,c,d,e,g,h,k,l,j,m,n,o){if(!(o.image===void 0||o.image.width===0)){if(o.needsUpdate===true||ja[o.id]===void 0){var p=o.wrapS==THREE.RepeatWrapping,
-q=o.wrapT==THREE.RepeatWrapping;ja[o.id]=i.createPattern(o.image,p&&q?"repeat":p&&!q?"repeat-x":!p&&q?"repeat-y":"no-repeat");o.needsUpdate=false}f(ja[o.id]);var p=o.offset.x/o.repeat.x,q=o.offset.y/o.repeat.y,r=o.image.width*o.repeat.x,s=o.image.height*o.repeat.y,h=(h+p)*r,k=(k+q)*s,c=c-a,d=d-b,e=e-a,g=g-b,l=(l+p)*r-h,j=(j+q)*s-k,m=(m+p)*r-h,n=(n+q)*s-k,p=l*n-m*j;if(p==0){if(da[o.id]===void 0){b=document.createElement("canvas");b.width=o.image.width;b.height=o.image.height;b=b.getContext("2d");b.drawImage(o.image,
-0,0);da[o.id]=b.getImageData(0,0,o.image.width,o.image.height).data}b=da[o.id];h=(Math.floor(h)+Math.floor(k)*o.image.width)*4;C.setRGB(b[h]/255,b[h+1]/255,b[h+2]/255);ga(C)}else{p=1/p;o=(n*c-j*e)*p;j=(n*d-j*g)*p;c=(l*e-m*c)*p;d=(l*g-m*d)*p;a=a-o*h-c*k;h=b-j*h-d*k;i.save();i.transform(o,j,c,d,a,h);i.fill();i.restore()}}}function pa(a,b,c,d,e,f,g,h,k,j,l,m,n){var o,p;o=n.width-1;p=n.height-1;g=g*o;h=h*p;c=c-a;d=d-b;e=e-a;f=f-b;k=k*o-g;j=j*p-h;l=l*o-g;m=m*p-h;p=1/(k*m-l*j);o=(m*c-j*e)*p;j=(m*d-j*f)*
-p;c=(k*e-l*c)*p;d=(k*f-l*d)*p;a=a-o*g-c*h;b=b-j*g-d*h;i.save();i.transform(o,j,c,d,a,b);i.clip();i.drawImage(n,0,0);i.restore()}function va(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),i=~~(c.r*255),j=~~(c.g*255),c=~~(c.b*255),k=~~(d.r*255),l=~~(d.g*255),d=~~(d.b*255);aa[0]=e<0?0:e>255?255:e;aa[1]=f<0?0:f>255?255:f;aa[2]=a<0?0:a>255?255:a;aa[4]=g<0?0:g>255?255:g;aa[5]=h<0?0:h>255?255:h;aa[6]=b<0?0:b>255?255:b;aa[8]=i<0?0:i>255?255:i;aa[9]=j<0?0:
-j>255?255:j;aa[10]=c<0?0:c>255?255:c;aa[12]=k<0?0:k>255?255:k;aa[13]=l<0?0:l>255?255:l;aa[14]=d<0?0:d>255?255:d;sa.putImageData(ya,0,0);ua.drawImage(ra,0,0);return ta}function oa(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function qa(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function ia(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;if(e!=0){e=1/Math.sqrt(e);c=c*e;d=d*e;b.x=b.x+c;b.y=b.y+d;a.x=a.x-c;a.y=a.y-d}}var wa,Ga,X,ba;this.autoClear?this.clear():i.setTransform(1,0,0,-1,o,q);e.info.render.vertices=0;e.info.render.faces=
-0;g=l.projectScene(a,h,this.sortElements);m=g.elements;k=g.lights;(xa=k.length>0)&&j(k);wa=0;for(Ga=m.length;wa<Ga;wa++){X=m[wa];ba=X.material;ba=ba instanceof THREE.MeshFaceMaterial?X.faceMaterial:ba;if(!(ba===void 0||ba.visible===false)){Z.empty();if(X instanceof THREE.RenderableParticle){u=X;u.x=u.x*o;u.y=u.y*q;p(u,X,ba,a)}else if(X instanceof THREE.RenderableLine){u=X.v1;z=X.v2;u.positionScreen.x=u.positionScreen.x*o;u.positionScreen.y=u.positionScreen.y*q;z.positionScreen.x=z.positionScreen.x*
+C.b=Y.b;n(k,l.centroidWorld,l.normalWorld,C);C.r=Math.max(0,Math.min(i.color.r*C.r,1));C.g=Math.max(0,Math.min(i.color.g*C.g,1));C.b=Math.max(0,Math.min(i.color.b*C.b,1));A(t,E,G,N,Q,O,y,S);i.wireframe?ha(C,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):ga(C)}else{A(t,E,G,N,Q,O,y,S);i.wireframe?ha(i.color,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):ga(i.color)}else if(i instanceof THREE.MeshNormalMaterial){C.r=qa(l.normalWorld.x);C.g=qa(l.normalWorld.y);C.b=qa(l.normalWorld.z);
+A(t,E,G,N,Q,O,y,S);i.wireframe?ha(C,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):ga(C)}else if(i instanceof THREE.MeshDepthMaterial){ea=h.near;fa=h.far;J.r=J.g=J.b=1-oa(a.positionScreen.z,ea,fa);I.r=I.g=I.b=1-oa(d.positionScreen.z,ea,fa);K.r=K.g=K.b=1-oa(g.positionScreen.z,ea,fa);R.r=R.g=R.b=1-oa(f.positionScreen.z,ea,fa);ca=va(J,I,K,R);v(t,E,G,N,y,S);pa(t,E,G,N,y,S,0,0,1,0,0,1,ca);v(L,U,Q,O,T,W);pa(L,U,Q,O,T,W,1,0,1,1,0,1,ca)}}}function v(a,b,c,d,e,f){l.beginPath();l.moveTo(a,b);
+l.lineTo(c,d);l.lineTo(e,f);l.lineTo(a,b)}function A(a,b,c,d,e,f,g,h){l.beginPath();l.moveTo(a,b);l.lineTo(c,d);l.lineTo(e,f);l.lineTo(g,h);l.lineTo(a,b)}function ha(a,b,c,e){if(B!=b)l.lineWidth=B=b;if(x!=c)l.lineCap=x=c;if(F!=e)l.lineJoin=F=e;d(a.getContextStyle());l.stroke();Z.inflate(b*2)}function ga(a){f(a.getContextStyle());l.fill()}function Fa(a,b,c,d,e,g,h,i,k,j,m,n,o){if(!(o.image===void 0||o.image.width===0)){if(o.needsUpdate===true||ja[o.id]===void 0){var p=o.wrapS==THREE.RepeatWrapping,
+q=o.wrapT==THREE.RepeatWrapping;ja[o.id]=l.createPattern(o.image,p&&q?"repeat":p&&!q?"repeat-x":!p&&q?"repeat-y":"no-repeat");o.needsUpdate=false}f(ja[o.id]);var p=o.offset.x/o.repeat.x,q=o.offset.y/o.repeat.y,r=o.image.width*o.repeat.x,s=o.image.height*o.repeat.y,h=(h+p)*r,i=(i+q)*s,c=c-a,d=d-b,e=e-a,g=g-b,k=(k+p)*r-h,j=(j+q)*s-i,m=(m+p)*r-h,n=(n+q)*s-i,p=k*n-m*j;if(p==0){if(da[o.id]===void 0){b=document.createElement("canvas");b.width=o.image.width;b.height=o.image.height;b=b.getContext("2d");b.drawImage(o.image,
+0,0);da[o.id]=b.getImageData(0,0,o.image.width,o.image.height).data}b=da[o.id];h=(Math.floor(h)+Math.floor(i)*o.image.width)*4;C.setRGB(b[h]/255,b[h+1]/255,b[h+2]/255);ga(C)}else{p=1/p;o=(n*c-j*e)*p;j=(n*d-j*g)*p;c=(k*e-m*c)*p;d=(k*g-m*d)*p;a=a-o*h-c*i;h=b-j*h-d*i;l.save();l.transform(o,j,c,d,a,h);l.fill();l.restore()}}}function pa(a,b,c,d,e,f,g,h,i,j,k,m,n){var o,p;o=n.width-1;p=n.height-1;g=g*o;h=h*p;c=c-a;d=d-b;e=e-a;f=f-b;i=i*o-g;j=j*p-h;k=k*o-g;m=m*p-h;p=1/(i*m-k*j);o=(m*c-j*e)*p;j=(m*d-j*f)*
+p;c=(i*e-k*c)*p;d=(i*f-k*d)*p;a=a-o*g-c*h;b=b-j*g-d*h;l.save();l.transform(o,j,c,d,a,b);l.clip();l.drawImage(n,0,0);l.restore()}function va(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),i=~~(c.r*255),j=~~(c.g*255),c=~~(c.b*255),k=~~(d.r*255),l=~~(d.g*255),d=~~(d.b*255);aa[0]=e<0?0:e>255?255:e;aa[1]=f<0?0:f>255?255:f;aa[2]=a<0?0:a>255?255:a;aa[4]=g<0?0:g>255?255:g;aa[5]=h<0?0:h>255?255:h;aa[6]=b<0?0:b>255?255:b;aa[8]=i<0?0:i>255?255:i;aa[9]=j<0?0:
+j>255?255:j;aa[10]=c<0?0:c>255?255:c;aa[12]=k<0?0:k>255?255:k;aa[13]=l<0?0:l>255?255:l;aa[14]=d<0?0:d>255?255:d;sa.putImageData(ya,0,0);ua.drawImage(ra,0,0);return ta}function oa(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function qa(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function ia(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;if(e!=0){e=1/Math.sqrt(e);c=c*e;d=d*e;b.x=b.x+c;b.y=b.y+d;a.x=a.x-c;a.y=a.y-d}}var wa,Ga,X,ba;this.autoClear?this.clear():l.setTransform(1,0,0,-1,o,q);e.info.render.vertices=0;e.info.render.faces=
+0;g=j.projectScene(a,h,this.sortElements);m=g.elements;k=g.lights;(xa=k.length>0)&&i(k);wa=0;for(Ga=m.length;wa<Ga;wa++){X=m[wa];ba=X.material;ba=ba instanceof THREE.MeshFaceMaterial?X.faceMaterial:ba;if(!(ba===void 0||ba.visible===false)){Z.empty();if(X instanceof THREE.RenderableParticle){u=X;u.x=u.x*o;u.y=u.y*q;p(u,X,ba,a)}else if(X instanceof THREE.RenderableLine){u=X.v1;z=X.v2;u.positionScreen.x=u.positionScreen.x*o;u.positionScreen.y=u.positionScreen.y*q;z.positionScreen.x=z.positionScreen.x*
 o;z.positionScreen.y=z.positionScreen.y*q;Z.addPoint(u.positionScreen.x,u.positionScreen.y);Z.addPoint(z.positionScreen.x,z.positionScreen.y);la.intersects(Z)&&r(u,z,X,ba,a)}else if(X instanceof THREE.RenderableFace3){u=X.v1;z=X.v2;D=X.v3;u.positionScreen.x=u.positionScreen.x*o;u.positionScreen.y=u.positionScreen.y*q;z.positionScreen.x=z.positionScreen.x*o;z.positionScreen.y=z.positionScreen.y*q;D.positionScreen.x=D.positionScreen.x*o;D.positionScreen.y=D.positionScreen.y*q;if(ba.overdraw){ia(u.positionScreen,
 z.positionScreen);ia(z.positionScreen,D.positionScreen);ia(D.positionScreen,u.positionScreen)}Z.add3Points(u.positionScreen.x,u.positionScreen.y,z.positionScreen.x,z.positionScreen.y,D.positionScreen.x,D.positionScreen.y);la.intersects(Z)&&s(u,z,D,0,1,2,X,ba,a)}else if(X instanceof THREE.RenderableFace4){u=X.v1;z=X.v2;D=X.v3;H=X.v4;u.positionScreen.x=u.positionScreen.x*o;u.positionScreen.y=u.positionScreen.y*q;z.positionScreen.x=z.positionScreen.x*o;z.positionScreen.y=z.positionScreen.y*q;D.positionScreen.x=
 D.positionScreen.x*o;D.positionScreen.y=D.positionScreen.y*q;H.positionScreen.x=H.positionScreen.x*o;H.positionScreen.y=H.positionScreen.y*q;P.positionScreen.copy(z.positionScreen);M.positionScreen.copy(H.positionScreen);if(ba.overdraw){ia(u.positionScreen,z.positionScreen);ia(z.positionScreen,H.positionScreen);ia(H.positionScreen,u.positionScreen);ia(D.positionScreen,P.positionScreen);ia(D.positionScreen,M.positionScreen)}Z.addPoint(u.positionScreen.x,u.positionScreen.y);Z.addPoint(z.positionScreen.x,
-z.positionScreen.y);Z.addPoint(D.positionScreen.x,D.positionScreen.y);Z.addPoint(H.positionScreen.x,H.positionScreen.y);la.intersects(Z)&&w(u,z,D,H,P,M,X,ba,a)}$.addRectangle(Z)}}i.setTransform(1,0,0,1,0,0)}};THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=true};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
+z.positionScreen.y);Z.addPoint(D.positionScreen.x,D.positionScreen.y);Z.addPoint(H.positionScreen.x,H.positionScreen.y);la.intersects(Z)&&w(u,z,D,H,P,M,X,ba,a)}$.addRectangle(Z)}}l.setTransform(1,0,0,1,0,0)}};THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=true};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
 THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterial=this.material=null;this.uvs=[[]];this.z=null};
 THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterial=this.material=null;this.uvs=[[]];this.z=null};THREE.RenderableObject=function(){this.z=this.object=null};
 THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null};

+ 1 - 1
build/custom/ThreeExtras.js

@@ -21,7 +21,7 @@ b.vertices.length+1;v=e.clone();p=e.clone();m>=o&&m>=q&&m>=r||q>=o&&q>=m&&q>=r?(
 f.lerpSelf(e.vertexColors[1],0.5),g=e.vertexColors[2].clone(),g.lerpSelf(e.vertexColors[3],0.5),v.vertexColors[1].copy(f),v.vertexColors[2].copy(g),p.vertexColors[0].copy(f),p.vertexColors[3].copy(g)),e=0):(m=l.clone(),m.lerpSelf(n,0.5),l=k.clone(),l.lerpSelf(j,0.5),v.a=f,v.b=g,v.c=s,v.d=t,p.a=t,p.b=s,p.c=h,p.d=i,4===e.vertexNormals.length&&(f=e.vertexNormals[1].clone(),f.lerpSelf(e.vertexNormals[2],0.5),g=e.vertexNormals[3].clone(),g.lerpSelf(e.vertexNormals[0],0.5),v.vertexNormals[2].copy(f),v.vertexNormals[3].copy(g),
 p.vertexNormals[0].copy(g),p.vertexNormals[1].copy(f)),4===e.vertexColors.length&&(f=e.vertexColors[1].clone(),f.lerpSelf(e.vertexColors[2],0.5),g=e.vertexColors[3].clone(),g.lerpSelf(e.vertexColors[0],0.5),v.vertexColors[2].copy(f),v.vertexColors[3].copy(g),p.vertexColors[0].copy(g),p.vertexColors[1].copy(f)),e=1);x.push(v,p);b.vertices.push(m,l);f=0;for(g=b.faceVertexUvs.length;f<g;f++)b.faceVertexUvs[f].length&&(j=b.faceVertexUvs[f][c],p=j[0],h=j[1],v=j[2],j=j[3],0===e?(l=p.clone(),l.lerpSelf(h,
 0.5),n=v.clone(),n.lerpSelf(j,0.5),p=[p.clone(),l.clone(),n.clone(),j.clone()],h=[l.clone(),h.clone(),v.clone(),n.clone()]):(l=h.clone(),l.lerpSelf(v,0.5),n=j.clone(),n.lerpSelf(p,0.5),p=[p.clone(),h.clone(),l.clone(),n.clone()],h=[n.clone(),l.clone(),v.clone(),j.clone()]),z[f].push(p,h))}else{x.push(e);f=0;for(g=b.faceVertexUvs.length;f<g;f++)z[f].push(b.faceVertexUvs[f][c])}b.faces=x;b.faceVertexUvs=z}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
-THREE.ImageUtils={crossOrigin:"anonymous",loadTexture:function(b,a,c,d){var e=new THREE.Texture(void 0,a),a=new THREE.ImageLoader;a.addEventListener("load",function(a){e.image=a.content;e.needsUpdate=!0;c&&c()});a.addEventListener("error",function(a){d&&d(a.message)});a.crossOrigin=this.crossOrigin;a.load(b);return e},loadTextureCube:function(b,a,c){var d,e=[],f=new THREE.Texture(e,a),a=e.loadCount=0;for(d=b.length;a<d;++a)e[a]=new Image,e[a].onload=function(){e.loadCount+=1;6===e.loadCount&&(f.needsUpdate=
+THREE.ImageUtils={crossOrigin:"anonymous",loadTexture:function(b,a,c,d){var e=new THREE.Texture(void 0,a),a=new THREE.ImageLoader;a.addEventListener("load",function(a){e.image=a.content;e.needsUpdate=!0;c&&c(e)});a.addEventListener("error",function(a){d&&d(a.message)});a.crossOrigin=this.crossOrigin;a.load(b);return e},loadTextureCube:function(b,a,c){var d,e=[],f=new THREE.Texture(e,a),a=e.loadCount=0;for(d=b.length;a<d;++a)e[a]=new Image,e[a].onload=function(){e.loadCount+=1;6===e.loadCount&&(f.needsUpdate=
 !0,c&&c())},e[a].crossOrigin=this.crossOrigin,e[a].src=b[a];return f},getNormalMap:function(b,a){var c=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]},a=a|1,d=b.width,e=b.height,f=document.createElement("canvas");f.width=d;f.height=e;var g=f.getContext("2d");g.drawImage(b,0,0);for(var h=g.getImageData(0,0,d,e).data,i=g.createImageData(d,e),j=i.data,l=0;l<d;l++)for(var n=0;n<e;n++){var k=0>n-1?0:n-1,m=n+1>e-1?e-1:n+1,o=0>l-1?0:l-1,q=l+1>d-1?d-1:l+1,r=[],s=[0,
 0,h[4*(n*d+l)]/255*a];r.push([-1,0,h[4*(n*d+o)]/255*a]);r.push([-1,-1,h[4*(k*d+o)]/255*a]);r.push([0,-1,h[4*(k*d+l)]/255*a]);r.push([1,-1,h[4*(k*d+q)]/255*a]);r.push([1,0,h[4*(n*d+q)]/255*a]);r.push([1,1,h[4*(m*d+q)]/255*a]);r.push([0,1,h[4*(m*d+l)]/255*a]);r.push([-1,1,h[4*(m*d+o)]/255*a]);k=[];o=r.length;for(m=0;m<o;m++){var q=r[m],t=r[(m+1)%o],q=[q[0]-s[0],q[1]-s[1],q[2]-s[2]],t=[t[0]-s[0],t[1]-s[1],t[2]-s[2]];k.push(c([q[1]*t[2]-q[2]*t[1],q[2]*t[0]-q[0]*t[2],q[0]*t[1]-q[1]*t[0]]))}r=[0,0,0];for(m=
 0;m<k.length;m++)r[0]+=k[m][0],r[1]+=k[m][1],r[2]+=k[m][2];r[0]/=k.length;r[1]/=k.length;r[2]/=k.length;s=4*(n*d+l);j[s]=255*((r[0]+1)/2)|0;j[s+1]=255*((r[1]+1)/2)|0;j[s+2]=255*r[2]|0;j[s+3]=255}g.putImageData(i,0,0);return f},generateDataTexture:function(b,a,c){for(var d=b*a,e=new Uint8Array(3*d),f=Math.floor(255*c.r),g=Math.floor(255*c.g),c=Math.floor(255*c.b),h=0;h<d;h++)e[3*h]=f,e[3*h+1]=g,e[3*h+2]=c;b=new THREE.DataTexture(e,b,a,THREE.RGBFormat);b.needsUpdate=!0;return b}};

+ 79 - 78
build/custom/ThreeWebGL.js

@@ -27,11 +27,12 @@ k)if(l<0.01){b=0.707106781;c=0;d=0.707106781}else{c=Math.sqrt(l);b=d/c;d=m/c}els
 THREE.EventTarget=function(){var a={};this.addEventListener=function(b,c){a[b]===void 0&&(a[b]=[]);a[b].indexOf(c)===-1&&a[b].push(c)};this.dispatchEvent=function(b){for(var c in a[b.type])a[b.type][c](b)};this.removeEventListener=function(b,c){var d=a[b].indexOf(c);d!==-1&&a[b].splice(d,1)}};THREE.Frustum=function(){this.planes=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4]};
 THREE.Frustum.prototype.setFromMatrix=function(a){var b,c=this.planes,d=a.elements,a=d[0];b=d[1];var f=d[2],e=d[3],h=d[4],l=d[5],m=d[6],k=d[7],i=d[8],o=d[9],j=d[10],w=d[11],r=d[12],n=d[13],q=d[14],d=d[15];c[0].set(e-a,k-h,w-i,d-r);c[1].set(e+a,k+h,w+i,d+r);c[2].set(e+b,k+l,w+o,d+n);c[3].set(e-b,k-l,w-o,d-n);c[4].set(e-f,k-m,w-j,d-q);c[5].set(e+f,k+m,w+j,d+q);for(a=0;a<6;a++){b=c[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};
 THREE.Frustum.prototype.contains=function(a){for(var b=this.planes,c=a.matrixWorld,d=c.elements,c=-a.geometry.boundingSphere.radius*c.getMaxScaleOnAxis(),f=0;f<6;f++){a=b[f].x*d[12]+b[f].y*d[13]+b[f].z*d[14]+b[f].w;if(a<=c)return false}return true};THREE.Frustum.__v1=new THREE.Vector3;
-THREE.Ray=function(a,b,c,d){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.near=c||0;this.far=d||Infinity;var f=new THREE.Vector3,e=new THREE.Vector3,h=new THREE.Vector3,l=new THREE.Vector3,m=new THREE.Vector3,k=new THREE.Vector3,i=new THREE.Vector3,o=new THREE.Vector3,j=new THREE.Vector3,w=function(a,b){return a.distance-b.distance},r=new THREE.Vector3,n=new THREE.Vector3,q=new THREE.Vector3,p,s,B,A=function(a,b,c){r.sub(c,a);p=r.dot(b);s=n.add(a,q.copy(b).multiplyScalar(p));
-return B=c.distanceTo(s)},u,J,D,M,E,Q,G,R,T=function(a,b,c,d){r.sub(d,b);n.sub(c,b);q.sub(a,b);u=r.dot(r);J=r.dot(n);D=r.dot(q);M=n.dot(n);E=n.dot(q);Q=1/(u*M-J*J);G=(M*D-J*E)*Q;R=(u*E-J*D)*Q;return G>=0&&R>=0&&G+R<1},S=1.0E-4;this.setPrecision=function(a){S=a};this.intersectObject=function(a){var b,c=[];if(a instanceof THREE.Particle){B=A(this.origin,this.direction,a.matrixWorld.getPosition());if(B>a.scale.x)return[];b={distance:B,point:a.position,face:null,object:a};c.push(b)}else if(a instanceof
-THREE.Mesh){var d=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),a.matrixWorld.getColumnZ().length()),d=a.geometry.boundingSphere.radius*Math.max(d.x,Math.max(d.y,d.z));B=A(this.origin,this.direction,a.matrixWorld.getPosition());if(B>d)return c;var g,n,r,q=a.geometry,p=q.vertices,s;a.matrixRotationWorld.extractRotation(a.matrixWorld);d=0;for(g=q.faces.length;d<g;d++){b=q.faces[d];m.copy(this.origin);k.copy(this.direction);s=a.matrixWorld;i=s.multiplyVector3(i.copy(b.centroid)).subSelf(m);
-o=a.matrixRotationWorld.multiplyVector3(o.copy(b.normal));n=k.dot(o);if(!(Math.abs(n)<S)){r=o.dot(i)/n;if(!(r<0)&&(a.doubleSided||(a.flipSided?n>0:n<0))){j.add(m,k.multiplyScalar(r));B=m.distanceTo(j);if(!(B<this.near)&&!(B>this.far))if(b instanceof THREE.Face3){f=s.multiplyVector3(f.copy(p[b.a]));e=s.multiplyVector3(e.copy(p[b.b]));h=s.multiplyVector3(h.copy(p[b.c]));if(T(j,f,e,h)){b={distance:B,point:j.clone(),face:b,object:a};c.push(b)}}else if(b instanceof THREE.Face4){f=s.multiplyVector3(f.copy(p[b.a]));
-e=s.multiplyVector3(e.copy(p[b.b]));h=s.multiplyVector3(h.copy(p[b.c]));l=s.multiplyVector3(l.copy(p[b.d]));if(T(j,f,e,l)||T(j,e,h,l)){b={distance:B,point:j.clone(),face:b,object:a};c.push(b)}}}}}}c.sort(w);return c};this.intersectObjects=function(a){for(var b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,this.intersectObject(a[c]));b.sort(w);return b}};
+THREE.Ray=function(a,b,c,d){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.near=c||0;this.far=d||Infinity;var f=new THREE.Vector3,e=new THREE.Vector3,h=new THREE.Vector3,l=new THREE.Vector3,m=new THREE.Vector3,k=new THREE.Vector3,i=new THREE.Vector3,o=new THREE.Vector3,j=new THREE.Vector3,w=function(a,b){return a.distance-b.distance},r=new THREE.Vector3,n=new THREE.Vector3,q=new THREE.Vector3,p,u,B,A=function(a,b,c){r.sub(c,a);p=r.dot(b);u=n.add(a,q.copy(b).multiplyScalar(p));
+return B=c.distanceTo(u)},s,J,D,M,E,Q,G,R,T=function(a,b,c,d){r.sub(d,b);n.sub(c,b);q.sub(a,b);s=r.dot(r);J=r.dot(n);D=r.dot(q);M=n.dot(n);E=n.dot(q);Q=1/(s*M-J*J);G=(M*D-J*E)*Q;R=(s*E-J*D)*Q;return G>=0&&R>=0&&G+R<1},S=1.0E-4;this.setPrecision=function(a){S=a};this.intersectObject=function(a,b){var c,d=[];if(b===true)for(var g=0,n=a.children.length;g<n;g++)Array.prototype.push.apply(d,this.intersectObject(a.children[g],b));if(a instanceof THREE.Particle){B=A(this.origin,this.direction,a.matrixWorld.getPosition());
+if(B>a.scale.x)return[];c={distance:B,point:a.position,face:null,object:a};d.push(c)}else if(a instanceof THREE.Mesh){g=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),a.matrixWorld.getColumnZ().length());g=a.geometry.boundingSphere.radius*Math.max(g.x,Math.max(g.y,g.z));B=A(this.origin,this.direction,a.matrixWorld.getPosition());if(B>g)return d;var r,q,p=a.geometry,u=p.vertices,s;a.matrixRotationWorld.extractRotation(a.matrixWorld);g=0;for(n=p.faces.length;g<
+n;g++){c=p.faces[g];m.copy(this.origin);k.copy(this.direction);s=a.matrixWorld;i=s.multiplyVector3(i.copy(c.centroid)).subSelf(m);o=a.matrixRotationWorld.multiplyVector3(o.copy(c.normal));r=k.dot(o);if(!(Math.abs(r)<S)){q=o.dot(i)/r;if(!(q<0)&&(a.doubleSided||(a.flipSided?r>0:r<0))){j.add(m,k.multiplyScalar(q));B=m.distanceTo(j);if(!(B<this.near)&&!(B>this.far))if(c instanceof THREE.Face3){f=s.multiplyVector3(f.copy(u[c.a]));e=s.multiplyVector3(e.copy(u[c.b]));h=s.multiplyVector3(h.copy(u[c.c]));
+if(T(j,f,e,h)){c={distance:B,point:j.clone(),face:c,object:a};d.push(c)}}else if(c instanceof THREE.Face4){f=s.multiplyVector3(f.copy(u[c.a]));e=s.multiplyVector3(e.copy(u[c.b]));h=s.multiplyVector3(h.copy(u[c.c]));l=s.multiplyVector3(l.copy(u[c.d]));if(T(j,f,e,l)||T(j,e,h,l)){c={distance:B,point:j.clone(),face:c,object:a};d.push(c)}}}}}}d.sort(w);return d};this.intersectObjects=function(a,b){for(var c=[],d=0,g=a.length;d<g;d++)Array.prototype.push.apply(c,this.intersectObject(a[d],b));c.sort(w);
+return c}};
 THREE.Rectangle=function(){function a(){e=d-b;h=f-c}var b,c,d,f,e,h,l=true;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return e};this.getHeight=function(){return h};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(e,h,i,o){l=false;b=e;c=h;d=i;f=o;a()};this.addPoint=function(e,h){if(l){l=false;b=e;c=h;d=e;f=h}else{b=b<e?b:e;c=c<h?c:h;d=d>e?d:e;f=f>h?
 f:h}a()};this.add3Points=function(e,h,i,o,j,w){if(l){l=false;b=e<i?e<j?e:j:i<j?i:j;c=h<o?h<w?h:w:o<w?o:w;d=e>i?e>j?e:j:i>j?i:j;f=h>o?h>w?h:w:o>w?o:w}else{b=e<i?e<j?e<b?e:b:j<b?j:b:i<j?i<b?i:b:j<b?j:b;c=h<o?h<w?h<c?h:c:w<c?w:c:o<w?o<c?o:c:w<c?w:c;d=e>i?e>j?e>d?e:d:j>d?j:d:i>j?i>d?i:d:j>d?j:d;f=h>o?h>w?h>f?h:f:w>f?w:f:o>w?o>f?o:f:w>f?w:f}a()};this.addRectangle=function(e){if(l){l=false;b=e.getLeft();c=e.getTop();d=e.getRight();f=e.getBottom()}else{b=b<e.getLeft()?b:e.getLeft();c=c<e.getTop()?c:e.getTop();
 d=d>e.getRight()?d:e.getRight();f=f>e.getBottom()?f:e.getBottom()}a()};this.inflate=function(e){b=b-e;c=c-e;d=d+e;f=f+e;a()};this.minSelf=function(e){b=b>e.getLeft()?b:e.getLeft();c=c>e.getTop()?c:e.getTop();d=d<e.getRight()?d:e.getRight();f=f<e.getBottom()?f:e.getBottom();a()};this.intersects=function(a){return d<a.getLeft()||b>a.getRight()||f<a.getTop()||c>a.getBottom()?false:true};this.empty=function(){l=true;f=d=c=b=0;a()};this.isEmpty=function(){return l}};
@@ -39,8 +40,8 @@ THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b
 THREE.Matrix3.prototype={constructor:THREE.Matrix3,getInverse:function(a){var b=a.elements,a=b[10]*b[5]-b[6]*b[9],c=-b[10]*b[1]+b[2]*b[9],d=b[6]*b[1]-b[2]*b[5],f=-b[10]*b[4]+b[6]*b[8],e=b[10]*b[0]-b[2]*b[8],h=-b[6]*b[0]+b[2]*b[4],l=b[9]*b[4]-b[5]*b[8],m=-b[9]*b[0]+b[1]*b[8],k=b[5]*b[0]-b[1]*b[4],b=b[0]*a+b[1]*f+b[2]*l;b===0&&console.warn("Matrix3.getInverse(): determinant == 0");var b=1/b,i=this.elements;i[0]=b*a;i[1]=b*c;i[2]=b*d;i[3]=b*f;i[4]=b*e;i[5]=b*h;i[6]=b*l;i[7]=b*m;i[8]=b*k;return this},
 transpose:function(){var a,b=this.elements;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};THREE.Matrix4=function(a,b,c,d,f,e,h,l,m,k,i,o,j,w,r,n){this.elements=new Float32Array(16);this.set(a!==void 0?a:1,b||0,c||0,d||0,f||0,e!==void 0?e:1,h||0,l||0,m||0,k||0,i!==void 0?i:1,o||0,j||0,w||0,r||0,n!==void 0?n:1)};
 THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,f,e,h,l,m,k,i,o,j,w,r,n){var q=this.elements;q[0]=a;q[4]=b;q[8]=c;q[12]=d;q[1]=f;q[5]=e;q[9]=h;q[13]=l;q[2]=m;q[6]=k;q[10]=i;q[14]=o;q[3]=j;q[7]=w;q[11]=r;q[15]=n;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){a=a.elements;this.set(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15]);return this},lookAt:function(a,b,c){var d=this.elements,
-f=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(a,b).normalize();if(h.length()===0)h.z=1;f.cross(c,h).normalize();if(f.length()===0){h.x=h.x+1.0E-4;f.cross(c,h).normalize()}e.cross(h,f);d[0]=f.x;d[4]=e.x;d[8]=h.x;d[1]=f.y;d[5]=e.y;d[9]=h.y;d[2]=f.z;d[6]=e.z;d[10]=h.z;return this},multiply:function(a,b){var c=a.elements,d=b.elements,f=this.elements,e=c[0],h=c[4],l=c[8],m=c[12],k=c[1],i=c[5],o=c[9],j=c[13],w=c[2],r=c[6],n=c[10],q=c[14],p=c[3],s=c[7],B=c[11],c=c[15],A=d[0],u=d[4],
-J=d[8],D=d[12],M=d[1],E=d[5],Q=d[9],G=d[13],R=d[2],T=d[6],S=d[10],y=d[14],L=d[3],Z=d[7],F=d[11],d=d[15];f[0]=e*A+h*M+l*R+m*L;f[4]=e*u+h*E+l*T+m*Z;f[8]=e*J+h*Q+l*S+m*F;f[12]=e*D+h*G+l*y+m*d;f[1]=k*A+i*M+o*R+j*L;f[5]=k*u+i*E+o*T+j*Z;f[9]=k*J+i*Q+o*S+j*F;f[13]=k*D+i*G+o*y+j*d;f[2]=w*A+r*M+n*R+q*L;f[6]=w*u+r*E+n*T+q*Z;f[10]=w*J+r*Q+n*S+q*F;f[14]=w*D+r*G+n*y+q*d;f[3]=p*A+s*M+B*R+c*L;f[7]=p*u+s*E+B*T+c*Z;f[11]=p*J+s*Q+B*S+c*F;f[15]=p*D+s*G+B*y+c*d;return this},multiplySelf:function(a){return this.multiply(this,
+f=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(a,b).normalize();if(h.length()===0)h.z=1;f.cross(c,h).normalize();if(f.length()===0){h.x=h.x+1.0E-4;f.cross(c,h).normalize()}e.cross(h,f);d[0]=f.x;d[4]=e.x;d[8]=h.x;d[1]=f.y;d[5]=e.y;d[9]=h.y;d[2]=f.z;d[6]=e.z;d[10]=h.z;return this},multiply:function(a,b){var c=a.elements,d=b.elements,f=this.elements,e=c[0],h=c[4],l=c[8],m=c[12],k=c[1],i=c[5],o=c[9],j=c[13],w=c[2],r=c[6],n=c[10],q=c[14],p=c[3],u=c[7],B=c[11],c=c[15],A=d[0],s=d[4],
+J=d[8],D=d[12],M=d[1],E=d[5],Q=d[9],G=d[13],R=d[2],T=d[6],S=d[10],y=d[14],L=d[3],Z=d[7],F=d[11],d=d[15];f[0]=e*A+h*M+l*R+m*L;f[4]=e*s+h*E+l*T+m*Z;f[8]=e*J+h*Q+l*S+m*F;f[12]=e*D+h*G+l*y+m*d;f[1]=k*A+i*M+o*R+j*L;f[5]=k*s+i*E+o*T+j*Z;f[9]=k*J+i*Q+o*S+j*F;f[13]=k*D+i*G+o*y+j*d;f[2]=w*A+r*M+n*R+q*L;f[6]=w*s+r*E+n*T+q*Z;f[10]=w*J+r*Q+n*S+q*F;f[14]=w*D+r*G+n*y+q*d;f[3]=p*A+u*M+B*R+c*L;f[7]=p*s+u*E+B*T+c*Z;f[11]=p*J+u*Q+B*S+c*F;f[15]=p*D+u*G+B*y+c*d;return this},multiplySelf:function(a){return this.multiply(this,
 a)},multiplyToArray:function(a,b,c){var d=this.elements;this.multiply(a,b);c[0]=d[0];c[1]=d[1];c[2]=d[2];c[3]=d[3];c[4]=d[4];c[5]=d[5];c[6]=d[6];c[7]=d[7];c[8]=d[8];c[9]=d[9];c[10]=d[10];c[11]=d[11];c[12]=d[12];c[13]=d[13];c[14]=d[14];c[15]=d[15];return this},multiplyScalar:function(a){var b=this.elements;b[0]=b[0]*a;b[4]=b[4]*a;b[8]=b[8]*a;b[12]=b[12]*a;b[1]=b[1]*a;b[5]=b[5]*a;b[9]=b[9]*a;b[13]=b[13]*a;b[2]=b[2]*a;b[6]=b[6]*a;b[10]=b[10]*a;b[14]=b[14]*a;b[3]=b[3]*a;b[7]=b[7]*a;b[11]=b[11]*a;b[15]=
 b[15]*a;return this},multiplyVector3:function(a){var b=this.elements,c=a.x,d=a.y,f=a.z,e=1/(b[3]*c+b[7]*d+b[11]*f+b[15]);a.x=(b[0]*c+b[4]*d+b[8]*f+b[12])*e;a.y=(b[1]*c+b[5]*d+b[9]*f+b[13])*e;a.z=(b[2]*c+b[6]*d+b[10]*f+b[14])*e;return a},multiplyVector4:function(a){var b=this.elements,c=a.x,d=a.y,f=a.z,e=a.w;a.x=b[0]*c+b[4]*d+b[8]*f+b[12]*e;a.y=b[1]*c+b[5]*d+b[9]*f+b[13]*e;a.z=b[2]*c+b[6]*d+b[10]*f+b[14]*e;a.w=b[3]*c+b[7]*d+b[11]*f+b[15]*e;return a},rotateAxis:function(a){var b=this.elements,c=a.x,
 d=a.y,f=a.z;a.x=c*b[0]+d*b[4]+f*b[8];a.y=c*b[1]+d*b[5]+f*b[9];a.z=c*b[2]+d*b[6]+f*b[10];a.normalize();return a},crossVector:function(a){var b=this.elements,c=new THREE.Vector4;c.x=b[0]*a.x+b[4]*a.y+b[8]*a.z+b[12]*a.w;c.y=b[1]*a.x+b[5]*a.y+b[9]*a.z+b[13]*a.w;c.z=b[2]*a.x+b[6]*a.y+b[10]*a.z+b[14]*a.w;c.w=a.w?b[3]*a.x+b[7]*a.y+b[11]*a.z+b[15]*a.w:1;return c},determinant:function(){var a=this.elements,b=a[0],c=a[4],d=a[8],f=a[12],e=a[1],h=a[5],l=a[9],m=a[13],k=a[2],i=a[6],o=a[10],j=a[14],w=a[3],r=a[7],
@@ -56,7 +57,7 @@ c.x=f.length();c.y=e.length();c.z=h.length();a.x=d[12];a.y=d[13];a.z=d[14];d=THR
 b[12]=a[12];b[13]=a[13];b[14]=a[14];return this},extractRotation:function(a){var b=this.elements,a=a.elements,c=THREE.Matrix4.__v1,d=1/c.set(a[0],a[1],a[2]).length(),f=1/c.set(a[4],a[5],a[6]).length(),c=1/c.set(a[8],a[9],a[10]).length();b[0]=a[0]*d;b[1]=a[1]*d;b[2]=a[2]*d;b[4]=a[4]*f;b[5]=a[5]*f;b[6]=a[6]*f;b[8]=a[8]*c;b[9]=a[9]*c;b[10]=a[10]*c;return this},translate:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[12]=b[0]*c+b[4]*d+b[8]*a+b[12];b[13]=b[1]*c+b[5]*d+b[9]*a+b[13];b[14]=b[2]*c+b[6]*
 d+b[10]*a+b[14];b[15]=b[3]*c+b[7]*d+b[11]*a+b[15];return this},rotateX:function(a){var b=this.elements,c=b[4],d=b[5],f=b[6],e=b[7],h=b[8],l=b[9],m=b[10],k=b[11],i=Math.cos(a),a=Math.sin(a);b[4]=i*c+a*h;b[5]=i*d+a*l;b[6]=i*f+a*m;b[7]=i*e+a*k;b[8]=i*h-a*c;b[9]=i*l-a*d;b[10]=i*m-a*f;b[11]=i*k-a*e;return this},rotateY:function(a){var b=this.elements,c=b[0],d=b[1],f=b[2],e=b[3],h=b[8],l=b[9],m=b[10],k=b[11],i=Math.cos(a),a=Math.sin(a);b[0]=i*c-a*h;b[1]=i*d-a*l;b[2]=i*f-a*m;b[3]=i*e-a*k;b[8]=i*h+a*c;b[9]=
 i*l+a*d;b[10]=i*m+a*f;b[11]=i*k+a*e;return this},rotateZ:function(a){var b=this.elements,c=b[0],d=b[1],f=b[2],e=b[3],h=b[4],l=b[5],m=b[6],k=b[7],i=Math.cos(a),a=Math.sin(a);b[0]=i*c+a*h;b[1]=i*d+a*l;b[2]=i*f+a*m;b[3]=i*e+a*k;b[4]=i*h-a*c;b[5]=i*l-a*d;b[6]=i*m-a*f;b[7]=i*k-a*e;return this},rotateByAxis:function(a,b){var c=this.elements;if(a.x===1&&a.y===0&&a.z===0)return this.rotateX(b);if(a.x===0&&a.y===1&&a.z===0)return this.rotateY(b);if(a.x===0&&a.y===0&&a.z===1)return this.rotateZ(b);var d=a.x,
-f=a.y,e=a.z,h=Math.sqrt(d*d+f*f+e*e),d=d/h,f=f/h,e=e/h,h=d*d,l=f*f,m=e*e,k=Math.cos(b),i=Math.sin(b),o=1-k,j=d*f*o,w=d*e*o,o=f*e*o,d=d*i,r=f*i,i=e*i,e=h+(1-h)*k,h=j+i,f=w-r,j=j-i,l=l+(1-l)*k,i=o+d,w=w+r,o=o-d,m=m+(1-m)*k,k=c[0],d=c[1],r=c[2],n=c[3],q=c[4],p=c[5],s=c[6],B=c[7],A=c[8],u=c[9],J=c[10],D=c[11];c[0]=e*k+h*q+f*A;c[1]=e*d+h*p+f*u;c[2]=e*r+h*s+f*J;c[3]=e*n+h*B+f*D;c[4]=j*k+l*q+i*A;c[5]=j*d+l*p+i*u;c[6]=j*r+l*s+i*J;c[7]=j*n+l*B+i*D;c[8]=w*k+o*q+m*A;c[9]=w*d+o*p+m*u;c[10]=w*r+o*s+m*J;c[11]=
+f=a.y,e=a.z,h=Math.sqrt(d*d+f*f+e*e),d=d/h,f=f/h,e=e/h,h=d*d,l=f*f,m=e*e,k=Math.cos(b),i=Math.sin(b),o=1-k,j=d*f*o,w=d*e*o,o=f*e*o,d=d*i,r=f*i,i=e*i,e=h+(1-h)*k,h=j+i,f=w-r,j=j-i,l=l+(1-l)*k,i=o+d,w=w+r,o=o-d,m=m+(1-m)*k,k=c[0],d=c[1],r=c[2],n=c[3],q=c[4],p=c[5],u=c[6],B=c[7],A=c[8],s=c[9],J=c[10],D=c[11];c[0]=e*k+h*q+f*A;c[1]=e*d+h*p+f*s;c[2]=e*r+h*u+f*J;c[3]=e*n+h*B+f*D;c[4]=j*k+l*q+i*A;c[5]=j*d+l*p+i*s;c[6]=j*r+l*u+i*J;c[7]=j*n+l*B+i*D;c[8]=w*k+o*q+m*A;c[9]=w*d+o*p+m*s;c[10]=w*r+o*u+m*J;c[11]=
 w*n+o*B+m*D;return this},scale:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[0]=b[0]*c;b[4]=b[4]*d;b[8]=b[8]*a;b[1]=b[1]*c;b[5]=b[5]*d;b[9]=b[9]*a;b[2]=b[2]*c;b[6]=b[6]*d;b[10]=b[10]*a;b[3]=b[3]*c;b[7]=b[7]*d;b[11]=b[11]*a;return this},getMaxScaleOnAxis:function(){var a=this.elements;return Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1]+a[2]*a[2],Math.max(a[4]*a[4]+a[5]*a[5]+a[6]*a[6],a[8]*a[8]+a[9]*a[9]+a[10]*a[10])))},makeTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},
 makeRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},makeRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},makeRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),f=1-c,e=a.x,h=a.y,l=a.z,m=f*e,k=f*h;this.set(m*e+c,m*h-d*l,m*l+d*h,0,m*h+d*l,k*h+c,k*l-d*e,0,m*l-
 d*h,k*l+d*e,f*l*l+c,0,0,0,0,1);return this},makeScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},makeFrustum:function(a,b,c,d,f,e){var h=this.elements;h[0]=2*f/(b-a);h[4]=0;h[8]=(b+a)/(b-a);h[12]=0;h[1]=0;h[5]=2*f/(d-c);h[9]=(d+c)/(d-c);h[13]=0;h[2]=0;h[6]=0;h[10]=-(e+f)/(e-f);h[14]=-2*e*f/(e-f);h[3]=0;h[7]=0;h[11]=-1;h[15]=0;return this},makePerspective:function(a,b,c,d){var a=c*Math.tan(a*Math.PI/360),f=-a;return this.makeFrustum(f*b,a*b,f,a,c,d)},makeOrthographic:function(a,
@@ -70,17 +71,17 @@ b.parent;b!==void 0&&b instanceof THREE.Scene&&b.__addObject(a)}},remove:functio
 this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=true},updateMatrixWorld:function(a){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||a){this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,
 this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=false;a=true}for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)},worldToLocal:function(a){return THREE.Object3D.__m1.getInverse(this.matrixWorld).multiplyVector3(a)},localToWorld:function(a){return this.matrixWorld.multiplyVector3(a)}};THREE.Object3D.__m1=new THREE.Matrix4;THREE.Object3DCount=0;
 THREE.Projector=function(){function a(){var a=h[e]=h[e]||new THREE.RenderableObject;e++;return a}function b(){var a=k[m]=k[m]||new THREE.RenderableVertex;m++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;if(e>=0&&f>=0&&g>=0&&h>=0)return true;if(e<0&&f<0||g<0&&h<0)return false;e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f)));g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h)));if(d<c)return false;a.lerpSelf(b,c);b.lerpSelf(a,1-
-d);return true}var f,e,h=[],l,m,k=[],i,o,j=[],w,r=[],n,q,p=[],s,B,A=[],u={objects:[],sprites:[],lights:[],elements:[]},J=new THREE.Vector3,D=new THREE.Vector4,M=new THREE.Matrix4,E=new THREE.Matrix4,Q=new THREE.Frustum,G=new THREE.Vector4,R=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);M.multiply(b.projectionMatrix,b.matrixWorldInverse);M.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
-M.multiply(b.matrixWorld,b.projectionMatrixInverse);M.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){e=0;u.objects.length=0;u.sprites.length=0;u.lights.length=0;var h=function(b){if(b.visible!==false){if((b instanceof THREE.Mesh||b instanceof THREE.Line)&&(b.frustumCulled===false||Q.contains(b))){J.copy(b.matrixWorld.getPosition());
-M.multiplyVector3(J);f=a();f.object=b;f.z=J.z;u.objects.push(f)}else if(b instanceof THREE.Sprite||b instanceof THREE.Particle){J.copy(b.matrixWorld.getPosition());M.multiplyVector3(J);f=a();f.object=b;f.z=J.z;u.sprites.push(f)}else b instanceof THREE.Light&&u.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)h(b.children[c])}};h(b);d&&u.objects.sort(c);return u};this.projectScene=function(a,e,f){var h=e.near,J=e.far,F=false,g,W,I,za,H,na,ca,ga,oa,Ba,Ha,Ia,Sa,Ua,Na;B=q=w=o=0;u.elements.length=
-0;if(e.parent===void 0){console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it...");a.add(e)}a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);M.multiply(e.projectionMatrix,e.matrixWorldInverse);Q.setFromMatrix(M);u=this.projectGraph(a,false);a=0;for(g=u.objects.length;a<g;a++){oa=u.objects[a].object;Ba=oa.matrixWorld;m=0;if(oa instanceof THREE.Mesh){Ha=oa.geometry;Ia=oa.geometry.materials;za=Ha.vertices;Sa=Ha.faces;Ua=Ha.faceVertexUvs;Ha=oa.matrixRotationWorld.extractRotation(Ba);
+d);return true}var f,e,h=[],l,m,k=[],i,o,j=[],w,r=[],n,q,p=[],u,B,A=[],s={objects:[],sprites:[],lights:[],elements:[]},J=new THREE.Vector3,D=new THREE.Vector4,M=new THREE.Matrix4,E=new THREE.Matrix4,Q=new THREE.Frustum,G=new THREE.Vector4,R=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);M.multiply(b.projectionMatrix,b.matrixWorldInverse);M.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
+M.multiply(b.matrixWorld,b.projectionMatrixInverse);M.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){e=0;s.objects.length=0;s.sprites.length=0;s.lights.length=0;var h=function(b){if(b.visible!==false){if((b instanceof THREE.Mesh||b instanceof THREE.Line)&&(b.frustumCulled===false||Q.contains(b))){J.copy(b.matrixWorld.getPosition());
+M.multiplyVector3(J);f=a();f.object=b;f.z=J.z;s.objects.push(f)}else if(b instanceof THREE.Sprite||b instanceof THREE.Particle){J.copy(b.matrixWorld.getPosition());M.multiplyVector3(J);f=a();f.object=b;f.z=J.z;s.sprites.push(f)}else b instanceof THREE.Light&&s.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)h(b.children[c])}};h(b);d&&s.objects.sort(c);return s};this.projectScene=function(a,e,f){var h=e.near,J=e.far,F=false,g,W,I,za,H,na,ca,ga,oa,Ba,Ha,Ia,Sa,Ua,Na;B=q=w=o=0;s.elements.length=
+0;if(e.parent===void 0){console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it...");a.add(e)}a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);M.multiply(e.projectionMatrix,e.matrixWorldInverse);Q.setFromMatrix(M);s=this.projectGraph(a,false);a=0;for(g=s.objects.length;a<g;a++){oa=s.objects[a].object;Ba=oa.matrixWorld;m=0;if(oa instanceof THREE.Mesh){Ha=oa.geometry;Ia=oa.geometry.materials;za=Ha.vertices;Sa=Ha.faces;Ua=Ha.faceVertexUvs;Ha=oa.matrixRotationWorld.extractRotation(Ba);
 W=0;for(I=za.length;W<I;W++){l=b();l.positionWorld.copy(za[W]);Ba.multiplyVector3(l.positionWorld);l.positionScreen.copy(l.positionWorld);M.multiplyVector4(l.positionScreen);l.positionScreen.x=l.positionScreen.x/l.positionScreen.w;l.positionScreen.y=l.positionScreen.y/l.positionScreen.w;l.visible=l.positionScreen.z>h&&l.positionScreen.z<J}za=0;for(W=Sa.length;za<W;za++){I=Sa[za];if(I instanceof THREE.Face3){H=k[I.a];na=k[I.b];ca=k[I.c];if(H.visible&&na.visible&&ca.visible){F=(ca.positionScreen.x-
 H.positionScreen.x)*(na.positionScreen.y-H.positionScreen.y)-(ca.positionScreen.y-H.positionScreen.y)*(na.positionScreen.x-H.positionScreen.x)<0;if(oa.doubleSided||F!=oa.flipSided){ga=j[o]=j[o]||new THREE.RenderableFace3;o++;i=ga;i.v1.copy(H);i.v2.copy(na);i.v3.copy(ca)}else continue}else continue}else if(I instanceof THREE.Face4){H=k[I.a];na=k[I.b];ca=k[I.c];ga=k[I.d];if(H.visible&&na.visible&&ca.visible&&ga.visible){F=(ga.positionScreen.x-H.positionScreen.x)*(na.positionScreen.y-H.positionScreen.y)-
 (ga.positionScreen.y-H.positionScreen.y)*(na.positionScreen.x-H.positionScreen.x)<0||(na.positionScreen.x-ca.positionScreen.x)*(ga.positionScreen.y-ca.positionScreen.y)-(na.positionScreen.y-ca.positionScreen.y)*(ga.positionScreen.x-ca.positionScreen.x)<0;if(oa.doubleSided||F!=oa.flipSided){Na=r[w]=r[w]||new THREE.RenderableFace4;w++;i=Na;i.v1.copy(H);i.v2.copy(na);i.v3.copy(ca);i.v4.copy(ga)}else continue}else continue}i.normalWorld.copy(I.normal);!F&&(oa.flipSided||oa.doubleSided)&&i.normalWorld.negate();
 Ha.multiplyVector3(i.normalWorld);i.centroidWorld.copy(I.centroid);Ba.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);M.multiplyVector3(i.centroidScreen);ca=I.vertexNormals;H=0;for(na=ca.length;H<na;H++){ga=i.vertexNormalsWorld[H];ga.copy(ca[H]);!F&&(oa.flipSided||oa.doubleSided)&&ga.negate();Ha.multiplyVector3(ga)}H=0;for(na=Ua.length;H<na;H++)if(Na=Ua[H][za]){ca=0;for(ga=Na.length;ca<ga;ca++)i.uvs[H][ca]=Na[ca]}i.material=oa.material;i.faceMaterial=I.materialIndex!==null?
-Ia[I.materialIndex]:null;i.z=i.centroidScreen.z;u.elements.push(i)}}else if(oa instanceof THREE.Line){E.multiply(M,Ba);za=oa.geometry.vertices;H=b();H.positionScreen.copy(za[0]);E.multiplyVector4(H.positionScreen);Ba=oa.type===THREE.LinePieces?2:1;W=1;for(I=za.length;W<I;W++){H=b();H.positionScreen.copy(za[W]);E.multiplyVector4(H.positionScreen);if(!((W+1)%Ba>0)){na=k[m-2];G.copy(H.positionScreen);R.copy(na.positionScreen);if(d(G,R)){G.multiplyScalar(1/G.w);R.multiplyScalar(1/R.w);Ia=p[q]=p[q]||new THREE.RenderableLine;
-q++;n=Ia;n.v1.positionScreen.copy(G);n.v2.positionScreen.copy(R);n.z=Math.max(G.z,R.z);n.material=oa.material;u.elements.push(n)}}}}}a=0;for(g=u.sprites.length;a<g;a++){oa=u.sprites[a].object;Ba=oa.matrixWorld;if(oa instanceof THREE.Particle){D.set(Ba.elements[12],Ba.elements[13],Ba.elements[14],1);M.multiplyVector4(D);D.z=D.z/D.w;if(D.z>0&&D.z<1){h=A[B]=A[B]||new THREE.RenderableParticle;B++;s=h;s.x=D.x/D.w;s.y=D.y/D.w;s.z=D.z;s.rotation=oa.rotation.z;s.scale.x=oa.scale.x*Math.abs(s.x-(D.x+e.projectionMatrix.elements[0])/
-(D.w+e.projectionMatrix.elements[12]));s.scale.y=oa.scale.y*Math.abs(s.y-(D.y+e.projectionMatrix.elements[5])/(D.w+e.projectionMatrix.elements[13]));s.material=oa.material;u.elements.push(s)}}}f&&u.elements.sort(c);return u}};THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==void 0?d:1};
+Ia[I.materialIndex]:null;i.z=i.centroidScreen.z;s.elements.push(i)}}else if(oa instanceof THREE.Line){E.multiply(M,Ba);za=oa.geometry.vertices;H=b();H.positionScreen.copy(za[0]);E.multiplyVector4(H.positionScreen);Ba=oa.type===THREE.LinePieces?2:1;W=1;for(I=za.length;W<I;W++){H=b();H.positionScreen.copy(za[W]);E.multiplyVector4(H.positionScreen);if(!((W+1)%Ba>0)){na=k[m-2];G.copy(H.positionScreen);R.copy(na.positionScreen);if(d(G,R)){G.multiplyScalar(1/G.w);R.multiplyScalar(1/R.w);Ia=p[q]=p[q]||new THREE.RenderableLine;
+q++;n=Ia;n.v1.positionScreen.copy(G);n.v2.positionScreen.copy(R);n.z=Math.max(G.z,R.z);n.material=oa.material;s.elements.push(n)}}}}}a=0;for(g=s.sprites.length;a<g;a++){oa=s.sprites[a].object;Ba=oa.matrixWorld;if(oa instanceof THREE.Particle){D.set(Ba.elements[12],Ba.elements[13],Ba.elements[14],1);M.multiplyVector4(D);D.z=D.z/D.w;if(D.z>0&&D.z<1){h=A[B]=A[B]||new THREE.RenderableParticle;B++;u=h;u.x=D.x/D.w;u.y=D.y/D.w;u.z=D.z;u.rotation=oa.rotation.z;u.scale.x=oa.scale.x*Math.abs(u.x-(D.x+e.projectionMatrix.elements[0])/
+(D.w+e.projectionMatrix.elements[12]));u.scale.y=oa.scale.y*Math.abs(u.y-(D.y+e.projectionMatrix.elements[5])/(D.w+e.projectionMatrix.elements[13]));u.material=oa.material;s.elements.push(u)}}}f&&s.elements.sort(c);return s}};THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==void 0?d:1};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a,b){var c=b||"XYZ",d=Math.cos(a.x/2),f=Math.cos(a.y/2),e=Math.cos(a.z/2),h=Math.sin(a.x/2),l=Math.sin(a.y/2),m=Math.sin(a.z/2);switch(c){case "YXZ":this.x=h*f*e+d*l*m;this.y=d*l*e-h*f*m;this.z=d*f*m-h*l*e;this.w=d*f*e+h*l*m;break;case "ZXY":this.x=h*f*e-d*l*m;this.y=d*l*e+h*f*
 m;this.z=d*f*m+h*l*e;this.w=d*f*e-h*l*m;break;case "ZYX":this.x=h*f*e-d*l*m;this.y=d*l*e+h*f*m;this.z=d*f*m-h*l*e;this.w=d*f*e+h*l*m;break;case "YZX":this.x=h*f*e+d*l*m;this.y=d*l*e+h*f*m;this.z=d*f*m-h*l*e;this.w=d*f*e-h*l*m;break;case "XZY":this.x=h*f*e-d*l*m;this.y=d*l*e-h*f*m;this.z=d*f*m+h*l*e;this.w=d*f*e+h*l*m;break;default:this.x=h*f*e+d*l*m;this.y=d*l*e-h*f*m;this.z=d*f*m+h*l*e;this.w=d*f*e-h*l*m}return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);this.x=a.x*d;this.y=a.y*
 d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=a.elements,c=b[0],a=b[4],d=b[8],f=b[1],e=b[5],h=b[9],l=b[2],m=b[6],b=b[10],k=c+e+b;if(k>0){c=0.5/Math.sqrt(k+1);this.w=0.25/c;this.x=(m-h)*c;this.y=(d-l)*c;this.z=(f-a)*c}else if(c>e&&c>b){c=2*Math.sqrt(1+c-e-b);this.w=(m-h)/c;this.x=0.25*c;this.y=(a+f)/c;this.z=(d+l)/c}else if(e>b){c=2*Math.sqrt(1+e-c-b);this.w=(d-l)/c;this.x=(a+f)/c;this.y=0.25*c;this.z=(h+m)/c}else{c=2*Math.sqrt(1+b-c-e);this.w=(f-a)/c;this.x=
@@ -103,7 +104,7 @@ for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;
 f.__originalFaceNormal.copy(f.normal):f.__originalFaceNormal=f.normal.clone();if(!f.__originalVertexNormals)f.__originalVertexNormals=[];a=0;for(b=f.vertexNormals.length;a<b;a++)f.__originalVertexNormals[a]?f.__originalVertexNormals[a].copy(f.vertexNormals[a]):f.__originalVertexNormals[a]=f.vertexNormals[a].clone()}var e=new THREE.Geometry;e.faces=this.faces;a=0;for(b=this.morphTargets.length;a<b;a++){if(!this.morphNormals[a]){this.morphNormals[a]={};this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=
 [];var h=this.morphNormals[a].faceNormals,l=this.morphNormals[a].vertexNormals,m,k;c=0;for(d=this.faces.length;c<d;c++){f=this.faces[c];m=new THREE.Vector3;k=f instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3};h.push(m);l.push(k)}}h=this.morphNormals[a];e.vertices=this.morphTargets[a].vertices;e.computeFaceNormals();e.computeVertexNormals();c=0;for(d=this.faces.length;c<d;c++){f=this.faces[c];
 m=h.faceNormals[c];k=h.vertexNormals[c];m.copy(f.normal);if(f instanceof THREE.Face3){k.a.copy(f.vertexNormals[0]);k.b.copy(f.vertexNormals[1]);k.c.copy(f.vertexNormals[2])}else{k.a.copy(f.vertexNormals[0]);k.b.copy(f.vertexNormals[1]);k.c.copy(f.vertexNormals[2]);k.d.copy(f.vertexNormals[3])}}}c=0;for(d=this.faces.length;c<d;c++){f=this.faces[c];f.normal=f.__originalFaceNormal;f.vertexNormals=f.__originalVertexNormals}},computeTangents:function(){function a(a,b,c,d,e,f,y){l=a.vertices[b];m=a.vertices[c];
-k=a.vertices[d];i=h[e];o=h[f];j=h[y];w=m.x-l.x;r=k.x-l.x;n=m.y-l.y;q=k.y-l.y;p=m.z-l.z;s=k.z-l.z;B=o.u-i.u;A=j.u-i.u;u=o.v-i.v;J=j.v-i.v;D=1/(B*J-A*u);G.set((J*w-u*r)*D,(J*n-u*q)*D,(J*p-u*s)*D);R.set((B*r-A*w)*D,(B*q-A*n)*D,(B*s-A*p)*D);E[b].addSelf(G);E[c].addSelf(G);E[d].addSelf(G);Q[b].addSelf(R);Q[c].addSelf(R);Q[d].addSelf(R)}var b,c,d,f,e,h,l,m,k,i,o,j,w,r,n,q,p,s,B,A,u,J,D,M,E=[],Q=[],G=new THREE.Vector3,R=new THREE.Vector3,T=new THREE.Vector3,S=new THREE.Vector3,y=new THREE.Vector3;b=0;for(c=
+k=a.vertices[d];i=h[e];o=h[f];j=h[y];w=m.x-l.x;r=k.x-l.x;n=m.y-l.y;q=k.y-l.y;p=m.z-l.z;u=k.z-l.z;B=o.u-i.u;A=j.u-i.u;s=o.v-i.v;J=j.v-i.v;D=1/(B*J-A*s);G.set((J*w-s*r)*D,(J*n-s*q)*D,(J*p-s*u)*D);R.set((B*r-A*w)*D,(B*q-A*n)*D,(B*u-A*p)*D);E[b].addSelf(G);E[c].addSelf(G);E[d].addSelf(G);Q[b].addSelf(R);Q[c].addSelf(R);Q[d].addSelf(R)}var b,c,d,f,e,h,l,m,k,i,o,j,w,r,n,q,p,u,B,A,s,J,D,M,E=[],Q=[],G=new THREE.Vector3,R=new THREE.Vector3,T=new THREE.Vector3,S=new THREE.Vector3,y=new THREE.Vector3;b=0;for(c=
 this.vertices.length;b<c;b++){E[b]=new THREE.Vector3;Q[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){e=this.faces[b];h=this.faceVertexUvs[0][b];if(e instanceof THREE.Face3)a(this,e.a,e.b,e.c,0,1,2);else if(e instanceof THREE.Face4){a(this,e.a,e.b,e.d,0,1,3);a(this,e.b,e.c,e.d,1,2,3)}}var L=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){e=this.faces[b];for(d=0;d<e.vertexNormals.length;d++){y.copy(e.vertexNormals[d]);f=e[L[d]];M=E[f];T.copy(M);T.subSelf(y.multiplyScalar(y.dot(M))).normalize();
 S.cross(e.vertexNormals[d],M);f=S.dot(Q[f]);f=f<0?-1:1;e.vertexTangents[d]=new THREE.Vector4(T.x,T.y,T.z,f)}}this.hasTangents=true},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3};if(this.vertices.length>0){var a;a=this.vertices[0];this.boundingBox.min.copy(a);this.boundingBox.max.copy(a);for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,f=this.vertices.length;d<f;d++){a=this.vertices[d];if(a.x<b.x)b.x=a.x;else if(a.x>c.x)c.x=
 a.x;if(a.y<b.y)b.y=a.y;else if(a.y>c.y)c.y=a.y;if(a.z<b.z)b.z=a.z;else if(a.z>c.z)c.z=a.z}}else{this.boundingBox.min.set(0,0,0);this.boundingBox.max.set(0,0,0)}},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere={radius:0};for(var a,b=0,c=0,d=this.vertices.length;c<d;c++){a=this.vertices[c].length();a>b&&(b=a)}this.boundingSphere.radius=b},mergeVertices:function(){var a={},b=[],c=[],d,f=Math.pow(10,4),e,h,l;e=0;for(h=this.vertices.length;e<h;e++){d=this.vertices[e];d=[Math.round(d.x*
@@ -135,22 +136,22 @@ THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.const
 THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,b,c,d,f,e){var h=new XMLHttpRequest;h.onreadystatechange=function(){if(h.readyState==4)if(h.status==200||h.status==0){var l=JSON.parse(h.responseText);a.loadAjaxBuffers(l,c,f,d,e)}else console.error("THREE.BinaryLoader: Couldn't load ["+b+"] ["+h.status+"]")};h.open("GET",b,true);h.overrideMimeType&&h.overrideMimeType("text/plain; charset=x-user-defined");h.setRequestHeader("Content-Type","text/plain");h.send(null)};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,f){var e=new XMLHttpRequest,h=c+"/"+a.buffers,l=0;e.onreadystatechange=function(){if(e.readyState==4)e.status==200||e.status==0?THREE.BinaryLoader.prototype.createBinModel(e.response,b,d,a.materials):console.error("THREE.BinaryLoader: Couldn't load ["+h+"] ["+e.status+"]");else if(e.readyState==3){if(f){l==0&&(l=e.getResponseHeader("Content-Length"));f({total:l,loaded:e.responseText.length})}}else e.readyState==2&&(l=e.getResponseHeader("Content-Length"))};
 e.open("GET",h,true);e.responseType="arraybuffer";e.send(null)};
-THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var f=function(b){var c,f,m,k,i,o,j,w,r,n,q,p,s,B,A;function u(a){return a%4?4-a%4:0}function J(a,b){return(new Uint8Array(a,b,1))[0]}function D(a,b){return(new Uint32Array(a,b,1))[0]}function M(b,c){var d,g,e,f,h,i,l,j,k=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){g=k[d*3];e=k[d*3+1];f=k[d*3+2];h=Z[g*2];g=Z[g*2+1];i=Z[e*2];l=Z[e*2+1];e=Z[f*2];j=Z[f*2+1];f=S.faceVertexUvs[0];var m=[];m.push(new THREE.UV(h,g));m.push(new THREE.UV(i,l));m.push(new THREE.UV(e,
+THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var f=function(b){var c,f,m,k,i,o,j,w,r,n,q,p,u,B,A;function s(a){return a%4?4-a%4:0}function J(a,b){return(new Uint8Array(a,b,1))[0]}function D(a,b){return(new Uint32Array(a,b,1))[0]}function M(b,c){var d,g,e,f,h,i,l,j,k=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){g=k[d*3];e=k[d*3+1];f=k[d*3+2];h=Z[g*2];g=Z[g*2+1];i=Z[e*2];l=Z[e*2+1];e=Z[f*2];j=Z[f*2+1];f=S.faceVertexUvs[0];var m=[];m.push(new THREE.UV(h,g));m.push(new THREE.UV(i,l));m.push(new THREE.UV(e,
 j));f.push(m)}}function E(b,c){var d,g,e,f,h,i,l,j,k,m,o=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){g=o[d*4];e=o[d*4+1];f=o[d*4+2];h=o[d*4+3];i=Z[g*2];g=Z[g*2+1];l=Z[e*2];k=Z[e*2+1];j=Z[f*2];m=Z[f*2+1];f=Z[h*2];e=Z[h*2+1];h=S.faceVertexUvs[0];var n=[];n.push(new THREE.UV(i,g));n.push(new THREE.UV(l,k));n.push(new THREE.UV(j,m));n.push(new THREE.UV(f,e));h.push(n)}}function Q(b,c,d){for(var g,e,f,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++){g=c[d*3];e=c[d*3+1];f=c[d*3+2];h=i[d];
 S.faces.push(new THREE.Face3(g,e,f,null,null,h))}}function G(b,c,d){for(var g,e,f,h,i,c=new Uint32Array(a,c,4*b),l=new Uint16Array(a,d,b),d=0;d<b;d++){g=c[d*4];e=c[d*4+1];f=c[d*4+2];h=c[d*4+3];i=l[d];S.faces.push(new THREE.Face4(g,e,f,h,null,null,i))}}function R(b,c,d,g){for(var e,f,h,i,l,j,k,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),m=new Uint16Array(a,g,b),g=0;g<b;g++){e=c[g*3];f=c[g*3+1];h=c[g*3+2];l=d[g*3];j=d[g*3+1];k=d[g*3+2];i=m[g];var o=L[j*3],n=L[j*3+1];j=L[j*3+2];var q=L[k*3],
-r=L[k*3+1];k=L[k*3+2];S.faces.push(new THREE.Face3(e,f,h,[new THREE.Vector3(L[l*3],L[l*3+1],L[l*3+2]),new THREE.Vector3(o,n,j),new THREE.Vector3(q,r,k)],null,i))}}function T(b,c,d,g){for(var e,f,h,i,l,j,k,m,o,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),n=new Uint16Array(a,g,b),g=0;g<b;g++){e=c[g*4];f=c[g*4+1];h=c[g*4+2];i=c[g*4+3];j=d[g*4];k=d[g*4+1];m=d[g*4+2];o=d[g*4+3];l=n[g];var q=L[k*3],r=L[k*3+1];k=L[k*3+2];var p=L[m*3],s=L[m*3+1];m=L[m*3+2];var w=L[o*3],u=L[o*3+1];o=L[o*3+2];S.faces.push(new THREE.Face4(e,
-f,h,i,[new THREE.Vector3(L[j*3],L[j*3+1],L[j*3+2]),new THREE.Vector3(q,r,k),new THREE.Vector3(p,s,m),new THREE.Vector3(w,u,o)],null,l))}}var S=this,y=0,L=[],Z=[],F,g,W;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(S,d,b);(function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",g=0;g<c;g++)d=d+String.fromCharCode(a[b+g]);return d})(a,y,12);c=J(a,y+12);J(a,y+13);J(a,y+14);J(a,y+15);f=J(a,y+16);m=J(a,y+17);k=J(a,y+18);i=J(a,y+19);o=D(a,y+20);j=D(a,y+20+4);w=D(a,y+20+8);b=D(a,y+20+12);r=
-D(a,y+20+16);n=D(a,y+20+20);q=D(a,y+20+24);p=D(a,y+20+28);s=D(a,y+20+32);B=D(a,y+20+36);A=D(a,y+20+40);y=y+c;c=f*3+i;W=f*4+i;F=b*c;g=r*(c+m*3);f=n*(c+k*3);i=q*(c+m*3+k*3);c=p*W;m=s*(W+m*4);k=B*(W+k*4);y=y+function(b){var b=new Float32Array(a,b,o*3),c,d,g,e;for(c=0;c<o;c++){d=b[c*3];g=b[c*3+1];e=b[c*3+2];S.vertices.push(new THREE.Vector3(d,g,e))}return o*3*Float32Array.BYTES_PER_ELEMENT}(y);y=y+function(b){if(j){var b=new Int8Array(a,b,j*3),c,d,g,e;for(c=0;c<j;c++){d=b[c*3];g=b[c*3+1];e=b[c*3+2];L.push(d/
-127,g/127,e/127)}}return j*3*Int8Array.BYTES_PER_ELEMENT}(y);y=y+u(j*3);y=y+function(b){if(w){var b=new Float32Array(a,b,w*2),c,d,g;for(c=0;c<w;c++){d=b[c*2];g=b[c*2+1];Z.push(d,g)}}return w*2*Float32Array.BYTES_PER_ELEMENT}(y);F=y+F+u(b*2);g=F+g+u(r*2);f=g+f+u(n*2);i=f+i+u(q*2);c=i+c+u(p*2);m=c+m+u(s*2);k=m+k+u(B*2);(function(a){if(n){var b=a+n*Uint32Array.BYTES_PER_ELEMENT*3;Q(n,a,b+n*Uint32Array.BYTES_PER_ELEMENT*3);M(n,b)}})(g);(function(a){if(q){var b=a+q*Uint32Array.BYTES_PER_ELEMENT*3,c=b+
+r=L[k*3+1];k=L[k*3+2];S.faces.push(new THREE.Face3(e,f,h,[new THREE.Vector3(L[l*3],L[l*3+1],L[l*3+2]),new THREE.Vector3(o,n,j),new THREE.Vector3(q,r,k)],null,i))}}function T(b,c,d,g){for(var e,f,h,i,l,j,k,m,o,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),n=new Uint16Array(a,g,b),g=0;g<b;g++){e=c[g*4];f=c[g*4+1];h=c[g*4+2];i=c[g*4+3];j=d[g*4];k=d[g*4+1];m=d[g*4+2];o=d[g*4+3];l=n[g];var q=L[k*3],r=L[k*3+1];k=L[k*3+2];var p=L[m*3],u=L[m*3+1];m=L[m*3+2];var w=L[o*3],s=L[o*3+1];o=L[o*3+2];S.faces.push(new THREE.Face4(e,
+f,h,i,[new THREE.Vector3(L[j*3],L[j*3+1],L[j*3+2]),new THREE.Vector3(q,r,k),new THREE.Vector3(p,u,m),new THREE.Vector3(w,s,o)],null,l))}}var S=this,y=0,L=[],Z=[],F,g,W;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(S,d,b);(function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",g=0;g<c;g++)d=d+String.fromCharCode(a[b+g]);return d})(a,y,12);c=J(a,y+12);J(a,y+13);J(a,y+14);J(a,y+15);f=J(a,y+16);m=J(a,y+17);k=J(a,y+18);i=J(a,y+19);o=D(a,y+20);j=D(a,y+20+4);w=D(a,y+20+8);b=D(a,y+20+12);r=
+D(a,y+20+16);n=D(a,y+20+20);q=D(a,y+20+24);p=D(a,y+20+28);u=D(a,y+20+32);B=D(a,y+20+36);A=D(a,y+20+40);y=y+c;c=f*3+i;W=f*4+i;F=b*c;g=r*(c+m*3);f=n*(c+k*3);i=q*(c+m*3+k*3);c=p*W;m=u*(W+m*4);k=B*(W+k*4);y=y+function(b){var b=new Float32Array(a,b,o*3),c,d,g,e;for(c=0;c<o;c++){d=b[c*3];g=b[c*3+1];e=b[c*3+2];S.vertices.push(new THREE.Vector3(d,g,e))}return o*3*Float32Array.BYTES_PER_ELEMENT}(y);y=y+function(b){if(j){var b=new Int8Array(a,b,j*3),c,d,g,e;for(c=0;c<j;c++){d=b[c*3];g=b[c*3+1];e=b[c*3+2];L.push(d/
+127,g/127,e/127)}}return j*3*Int8Array.BYTES_PER_ELEMENT}(y);y=y+s(j*3);y=y+function(b){if(w){var b=new Float32Array(a,b,w*2),c,d,g;for(c=0;c<w;c++){d=b[c*2];g=b[c*2+1];Z.push(d,g)}}return w*2*Float32Array.BYTES_PER_ELEMENT}(y);F=y+F+s(b*2);g=F+g+s(r*2);f=g+f+s(n*2);i=f+i+s(q*2);c=i+c+s(p*2);m=c+m+s(u*2);k=m+k+s(B*2);(function(a){if(n){var b=a+n*Uint32Array.BYTES_PER_ELEMENT*3;Q(n,a,b+n*Uint32Array.BYTES_PER_ELEMENT*3);M(n,b)}})(g);(function(a){if(q){var b=a+q*Uint32Array.BYTES_PER_ELEMENT*3,c=b+
 q*Uint32Array.BYTES_PER_ELEMENT*3;R(q,a,b,c+q*Uint32Array.BYTES_PER_ELEMENT*3);M(q,c)}})(f);(function(a){if(B){var b=a+B*Uint32Array.BYTES_PER_ELEMENT*4;G(B,a,b+B*Uint32Array.BYTES_PER_ELEMENT*4);E(B,b)}})(m);(function(a){if(A){var b=a+A*Uint32Array.BYTES_PER_ELEMENT*4,c=b+A*Uint32Array.BYTES_PER_ELEMENT*4;T(A,a,b,c+A*Uint32Array.BYTES_PER_ELEMENT*4);E(A,c)}})(k);b&&Q(b,y,y+b*Uint32Array.BYTES_PER_ELEMENT*3);(function(a){if(r){var b=a+r*Uint32Array.BYTES_PER_ELEMENT*3;R(r,a,b,b+r*Uint32Array.BYTES_PER_ELEMENT*
-3)}})(F);p&&G(p,i,i+p*Uint32Array.BYTES_PER_ELEMENT*4);(function(a){if(s){var b=a+s*Uint32Array.BYTES_PER_ELEMENT*4;T(s,a,b,b+s*Uint32Array.BYTES_PER_ELEMENT*4)}})(c);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(new f(c))};THREE.ImageLoader=function(){THREE.EventTarget.call(this);this.crossOrigin=null};
+3)}})(F);p&&G(p,i,i+p*Uint32Array.BYTES_PER_ELEMENT*4);(function(a){if(u){var b=a+u*Uint32Array.BYTES_PER_ELEMENT*4;T(u,a,b,b+u*Uint32Array.BYTES_PER_ELEMENT*4)}})(c);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(new f(c))};THREE.ImageLoader=function(){THREE.EventTarget.call(this);this.crossOrigin=null};
 THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,load:function(a){var b=this,c=new Image;c.addEventListener("load",function(){b.dispatchEvent({type:"load",content:c})},false);c.addEventListener("error",function(){b.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},false);if(b.crossOrigin)c.crossOrigin=b.crossOrigin;c.src=a}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;
 THREE.JSONLoader.prototype.load=function(a,b,c){c=c?c:this.extractUrlBase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
 THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,f){var e=new XMLHttpRequest,h=0;e.onreadystatechange=function(){if(e.readyState===e.DONE)if(e.status===200||e.status===0){if(e.responseText){var l=JSON.parse(e.responseText);a.createModel(l,c,d)}else console.warn("THREE.JSONLoader: ["+b+"] seems to be unreachable or file there is empty");a.onLoadComplete()}else console.error("THREE.JSONLoader: Couldn't load ["+b+"] ["+e.status+"]");else if(e.readyState===e.LOADING){if(f){h===0&&(h=e.getResponseHeader("Content-Length"));
 f({total:h,loaded:e.responseText.length})}}else e.readyState===e.HEADERS_RECEIVED&&(h=e.getResponseHeader("Content-Length"))};e.open("GET",b,true);e.overrideMimeType&&e.overrideMimeType("text/plain; charset=x-user-defined");e.setRequestHeader("Content-Type","text/plain");e.send(null)};
-THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,f=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){var c,f,m,k,i,o,j,w,r,n,q,p,s,B,A=a.faces;o=a.vertices;var u=a.normals,J=a.colors,D=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&D++;for(c=0;c<D;c++){d.faceUvs[c]=[];d.faceVertexUvs[c]=[]}k=0;for(i=o.length;k<i;){j=new THREE.Vector3;j.x=o[k++]*b;j.y=o[k++]*b;j.z=o[k++]*b;d.vertices.push(j)}k=0;for(i=A.length;k<i;){b=A[k++];o=b&1;m=b&2;c=b&
-4;f=b&8;w=b&16;j=b&32;n=b&64;b=b&128;if(o){q=new THREE.Face4;q.a=A[k++];q.b=A[k++];q.c=A[k++];q.d=A[k++];o=4}else{q=new THREE.Face3;q.a=A[k++];q.b=A[k++];q.c=A[k++];o=3}if(m){m=A[k++];q.materialIndex=m}m=d.faces.length;if(c)for(c=0;c<D;c++){p=a.uvs[c];r=A[k++];B=p[r*2];r=p[r*2+1];d.faceUvs[c][m]=new THREE.UV(B,r)}if(f)for(c=0;c<D;c++){p=a.uvs[c];s=[];for(f=0;f<o;f++){r=A[k++];B=p[r*2];r=p[r*2+1];s[f]=new THREE.UV(B,r)}d.faceVertexUvs[c][m]=s}if(w){w=A[k++]*3;f=new THREE.Vector3;f.x=u[w++];f.y=u[w++];
-f.z=u[w];q.normal=f}if(j)for(c=0;c<o;c++){w=A[k++]*3;f=new THREE.Vector3;f.x=u[w++];f.y=u[w++];f.z=u[w];q.vertexNormals.push(f)}if(n){j=A[k++];j=new THREE.Color(J[j]);q.color=j}if(b)for(c=0;c<o;c++){j=A[k++];j=new THREE.Color(J[j]);q.vertexColors.push(j)}d.faces.push(q)}})(f);(function(){var b,c,f,m;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b=b+2){f=a.skinWeights[b];m=a.skinWeights[b+1];d.skinWeights.push(new THREE.Vector4(f,m,0,0))}}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b=
+THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,f=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){var c,f,m,k,i,o,j,w,r,n,q,p,u,B,A=a.faces;o=a.vertices;var s=a.normals,J=a.colors,D=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&D++;for(c=0;c<D;c++){d.faceUvs[c]=[];d.faceVertexUvs[c]=[]}k=0;for(i=o.length;k<i;){j=new THREE.Vector3;j.x=o[k++]*b;j.y=o[k++]*b;j.z=o[k++]*b;d.vertices.push(j)}k=0;for(i=A.length;k<i;){b=A[k++];o=b&1;m=b&2;c=b&
+4;f=b&8;w=b&16;j=b&32;n=b&64;b=b&128;if(o){q=new THREE.Face4;q.a=A[k++];q.b=A[k++];q.c=A[k++];q.d=A[k++];o=4}else{q=new THREE.Face3;q.a=A[k++];q.b=A[k++];q.c=A[k++];o=3}if(m){m=A[k++];q.materialIndex=m}m=d.faces.length;if(c)for(c=0;c<D;c++){p=a.uvs[c];r=A[k++];B=p[r*2];r=p[r*2+1];d.faceUvs[c][m]=new THREE.UV(B,r)}if(f)for(c=0;c<D;c++){p=a.uvs[c];u=[];for(f=0;f<o;f++){r=A[k++];B=p[r*2];r=p[r*2+1];u[f]=new THREE.UV(B,r)}d.faceVertexUvs[c][m]=u}if(w){w=A[k++]*3;f=new THREE.Vector3;f.x=s[w++];f.y=s[w++];
+f.z=s[w];q.normal=f}if(j)for(c=0;c<o;c++){w=A[k++]*3;f=new THREE.Vector3;f.x=s[w++];f.y=s[w++];f.z=s[w];q.vertexNormals.push(f)}if(n){j=A[k++];j=new THREE.Color(J[j]);q.color=j}if(b)for(c=0;c<o;c++){j=A[k++];j=new THREE.Color(J[j]);q.vertexColors.push(j)}d.faces.push(q)}})(f);(function(){var b,c,f,m;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b=b+2){f=a.skinWeights[b];m=a.skinWeights[b+1];d.skinWeights.push(new THREE.Vector4(f,m,0,0))}}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b=
 b+2){f=a.skinIndices[b];m=a.skinIndices[b+1];d.skinIndices.push(new THREE.Vector4(f,m,0,0))}}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,f,m,k,i,o;c=0;for(f=a.morphTargets.length;c<f;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];i=d.morphTargets[c].vertices;o=a.morphTargets[c].vertices;m=0;for(k=o.length;m<k;m=m+3){var j=new THREE.Vector3;j.x=o[m]*b;j.y=o[m+1]*b;j.z=o[m+2]*b;i.push(j)}}}if(a.morphColors!==
 void 0){c=0;for(f=a.morphColors.length;c<f;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];k=d.morphColors[c].colors;i=a.morphColors[c].colors;b=0;for(m=i.length;b<m;b=b+3){o=new THREE.Color(16755200);o.setRGB(i[b],i[b+1],i[b+2]);k.push(o)}}}})(f);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();b(d)};THREE.GeometryLoader=function(){THREE.EventTarget.call(this);this.path=this.crossOrigin=null};
 THREE.GeometryLoader.prototype={constructor:THREE.GeometryLoader,load:function(a){var b=this,c=null;if(b.path===null){var d=a.split("/");d.pop();b.path=d.length<1?".":d.join("/")}d=new XMLHttpRequest;d.addEventListener("load",function(d){d.target.responseText?c=b.parse(JSON.parse(d.target.responseText),f):b.dispatchEvent({type:"error",message:"Invalid file ["+a+"]"})},false);d.addEventListener("error",function(){b.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},false);d.open("GET",
@@ -161,27 +162,27 @@ THREE[h.blending];if(h.transparent!==void 0||h.opacity<1)j.transparent=h.transpa
 if(h.transparency)j.opacity=h.transparency;if(h.specularCoef)j.shininess=h.specularCoef;h.mapDiffuse&&k(j,"map",h.mapDiffuse,h.mapDiffuseRepeat,h.mapDiffuseOffset,h.mapDiffuseWrap);h.mapLight&&k(j,"lightMap",h.mapLight,h.mapLightRepeat,h.mapLightOffset,h.mapLightWrap);h.mapNormal&&k(j,"normalMap",h.mapNormal,h.mapNormalRepeat,h.mapNormalOffset,h.mapNormalWrap);h.mapSpecular&&k(j,"specularMap",h.mapSpecular,h.mapSpecularRepeat,h.mapSpecularOffset,h.mapSpecularWrap);if(h.mapNormal){k=THREE.ShaderUtils.lib.normal;
 i=THREE.UniformsUtils.clone(k.uniforms);i.tNormal.texture=j.normalMap;if(h.mapNormalFactor)i.uNormalScale.value=h.mapNormalFactor;if(j.map){i.tDiffuse.texture=j.map;i.enableDiffuse.value=true}if(j.specularMap){i.tSpecular.texture=j.specularMap;i.enableSpecular.value=true}if(j.lightMap){i.tAO.texture=j.lightMap;i.enableAO.value=true}i.uDiffuseColor.value.setHex(j.color);i.uSpecularColor.value.setHex(j.specular);i.uAmbientColor.value.setHex(j.ambient);i.uShininess.value=j.shininess;if(j.opacity!==void 0)i.uOpacity.value=
 j.opacity;j=new THREE.ShaderMaterial({fragmentShader:k.fragmentShader,vertexShader:k.vertexShader,uniforms:i,lights:true,fog:true})}else j=new THREE[o](j);if(h.DbgName!==void 0)j.name=h.DbgName;d.materials[e]=j}}var h=a.faces,r=a.vertices,j=a.normals,k=a.colors,i=0;if(a.uvs)for(e=0;e<a.uvs.length;e++)a.uvs[e].length&&i++;for(e=0;e<i;e++){d.faceUvs[e]=[];d.faceVertexUvs[e]=[]}o=0;for(w=r.length;o<w;){var n=new THREE.Vector3;n.x=r[o++]*f;n.y=r[o++]*f;n.z=r[o++]*f;d.vertices.push(n)}o=0;for(w=h.length;o<
-w;){var q=h[o++],p=q&2,e=q&4,s=q&8,B=q&16,r=q&32,A=q&64,n=q&128;if(q&1){q=new THREE.Face4;q.a=h[o++];q.b=h[o++];q.c=h[o++];q.d=h[o++];var u=4}else{q=new THREE.Face3;q.a=h[o++];q.b=h[o++];q.c=h[o++];u=3}if(p){p=h[o++];q.materialIndex=p}var J=d.faces.length;if(e)for(e=0;e<i;e++){var D=a.uvs[e],p=h[o++],M=D[p*2],p=D[p*2+1];d.faceUvs[e][J]=new THREE.UV(M,p)}if(s)for(e=0;e<i;e++){for(var D=a.uvs[e],s=[],E=0;E<u;E++){p=h[o++];M=D[p*2];p=D[p*2+1];s[E]=new THREE.UV(M,p)}d.faceVertexUvs[e][J]=s}if(B){B=h[o++]*
-3;p=new THREE.Vector3;p.x=j[B++];p.y=j[B++];p.z=j[B];q.normal=p}if(r)for(e=0;e<u;e++){B=h[o++]*3;p=new THREE.Vector3;p.x=j[B++];p.y=j[B++];p.z=j[B];q.vertexNormals.push(p)}if(A){r=h[o++];q.color=new THREE.Color(k[r])}if(n)for(e=0;e<u;e++){r=h[o++];q.vertexColors.push(new THREE.Color(k[r]))}d.faces.push(q)}if(a.skinWeights){e=0;for(h=a.skinWeights.length;e<h;e=e+2)d.skinWeights.push(new THREE.Vector4(a.skinWeights[e],a.skinWeights[e+1],0,0))}if(a.skinIndices){e=0;for(h=a.skinIndices.length;e<h;e=e+
+w;){var q=h[o++],p=q&2,e=q&4,u=q&8,B=q&16,r=q&32,A=q&64,n=q&128;if(q&1){q=new THREE.Face4;q.a=h[o++];q.b=h[o++];q.c=h[o++];q.d=h[o++];var s=4}else{q=new THREE.Face3;q.a=h[o++];q.b=h[o++];q.c=h[o++];s=3}if(p){p=h[o++];q.materialIndex=p}var J=d.faces.length;if(e)for(e=0;e<i;e++){var D=a.uvs[e],p=h[o++],M=D[p*2],p=D[p*2+1];d.faceUvs[e][J]=new THREE.UV(M,p)}if(u)for(e=0;e<i;e++){for(var D=a.uvs[e],u=[],E=0;E<s;E++){p=h[o++];M=D[p*2];p=D[p*2+1];u[E]=new THREE.UV(M,p)}d.faceVertexUvs[e][J]=u}if(B){B=h[o++]*
+3;p=new THREE.Vector3;p.x=j[B++];p.y=j[B++];p.z=j[B];q.normal=p}if(r)for(e=0;e<s;e++){B=h[o++]*3;p=new THREE.Vector3;p.x=j[B++];p.y=j[B++];p.z=j[B];q.vertexNormals.push(p)}if(A){r=h[o++];q.color=new THREE.Color(k[r])}if(n)for(e=0;e<s;e++){r=h[o++];q.vertexColors.push(new THREE.Color(k[r]))}d.faces.push(q)}if(a.skinWeights){e=0;for(h=a.skinWeights.length;e<h;e=e+2)d.skinWeights.push(new THREE.Vector4(a.skinWeights[e],a.skinWeights[e+1],0,0))}if(a.skinIndices){e=0;for(h=a.skinIndices.length;e<h;e=e+
 2){j=0;d.skinIndices.push(new THREE.Vector4(a.skinIndices[e],a.skinIndices[e+1],j,0))}}d.bones=a.bones;d.animation=a.animation;if(a.morphTargets){e=0;for(h=a.morphTargets.length;e<h;e++){d.morphTargets[e]={};d.morphTargets[e].name=a.morphTargets[e].name;d.morphTargets[e].vertices=[];j=d.morphTargets[e].vertices;k=a.morphTargets[e].vertices;p=0;for(i=k.length;p<i;p=p+3){n=new THREE.Vector3;n.x=k[p]*f;n.y=k[p+1]*f;n.z=k[p+2]*f;j.push(n)}}}if(a.morphColors){e=0;for(h=a.morphColors.length;e<h;e++){d.morphColors[e]=
 {};d.morphColors[e].name=a.morphColors[e].name;d.morphColors[e].colors=[];f=d.morphColors[e].colors;k=a.morphColors[e].colors;j=0;for(i=k.length;j<i;j=j+3){o=new THREE.Color(16755200);o.setRGB(k[j],k[j+1],k[j+2]);f.push(o)}}}d.computeCentroids();d.computeFaceNormals();return d}};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
 THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
 THREE.SceneLoader.prototype.load=function(a,b){var c=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(d.readyState===4)if(d.status===200||d.status===0){var f=JSON.parse(d.responseText);c.createScene(f,b,a)}else console.error("THREE.SceneLoader: Couldn't load ["+a+"] ["+d.status+"]")};d.open("GET",a,true);d.overrideMimeType&&d.overrideMimeType("text/plain; charset=x-user-defined");d.setRequestHeader("Content-Type","text/plain");d.send(null)};
-THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return b=="relativeToHTML"?a:k+"/"+a}function f(){var a;for(j in y.objects)if(!I.objects[j]){p=y.objects[j];if(p.geometry!==void 0){if(G=I.geometries[p.geometry]){a=false;R=I.materials[p.materials[0]];(a=R instanceof THREE.ShaderMaterial)&&G.computeTangents();u=p.position;J=p.rotation;D=p.quaternion;M=p.scale;s=p.matrix;D=0;p.materials.length==0&&(R=new THREE.MeshFaceMaterial);p.materials.length>1&&(R=new THREE.MeshFaceMaterial);
-a=new THREE.Mesh(G,R);a.name=j;if(s){a.matrixAutoUpdate=false;a.matrix.set(s[0],s[1],s[2],s[3],s[4],s[5],s[6],s[7],s[8],s[9],s[10],s[11],s[12],s[13],s[14],s[15])}else{a.position.set(u[0],u[1],u[2]);if(D){a.quaternion.set(D[0],D[1],D[2],D[3]);a.useQuaternion=true}else a.rotation.set(J[0],J[1],J[2]);a.scale.set(M[0],M[1],M[2])}a.visible=p.visible;a.doubleSided=p.doubleSided;a.castShadow=p.castShadow;a.receiveShadow=p.receiveShadow;I.scene.add(a);I.objects[j]=a}}else{u=p.position;J=p.rotation;D=p.quaternion;
-M=p.scale;D=0;a=new THREE.Object3D;a.name=j;a.position.set(u[0],u[1],u[2]);if(D){a.quaternion.set(D[0],D[1],D[2],D[3]);a.useQuaternion=true}else a.rotation.set(J[0],J[1],J[2]);a.scale.set(M[0],M[1],M[2]);a.visible=p.visible!==void 0?p.visible:false;I.scene.add(a);I.objects[j]=a;I.empties[j]=a}}}function e(a){return function(b){I.geometries[a]=b;f();Z=Z-1;m.onLoadComplete();l()}}function h(a){return function(b){I.geometries[a]=b}}function l(){m.callbackProgress({totalModels:g,totalTextures:W,loadedModels:g-
-Z,loadedTextures:W-F},I);m.onLoadProgress();Z===0&&F===0&&b(I)}var m=this,k=THREE.Loader.prototype.extractUrlBase(c),i,o,j,w,r,n,q,p,s,B,A,u,J,D,M,E,Q,G,R,T,S,y,L,Z,F,g,W,I;y=a;c=new THREE.BinaryLoader;L=new THREE.JSONLoader;F=Z=0;I={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(y.transform){a=y.transform.position;B=y.transform.rotation;E=y.transform.scale;a&&I.scene.position.set(a[0],a[1],a[2]);B&&I.scene.rotation.set(B[0],B[1],
-B[2]);E&&I.scene.scale.set(E[0],E[1],E[2]);if(a||B||E){I.scene.updateMatrix();I.scene.updateMatrixWorld()}}a=function(a){return function(){F=F-a;l();m.onLoadComplete()}};for(r in y.cameras){E=y.cameras[r];E.type==="perspective"?T=new THREE.PerspectiveCamera(E.fov,E.aspect,E.near,E.far):E.type==="ortho"&&(T=new THREE.OrthographicCamera(E.left,E.right,E.top,E.bottom,E.near,E.far));u=E.position;B=E.target;E=E.up;T.position.set(u[0],u[1],u[2]);T.target=new THREE.Vector3(B[0],B[1],B[2]);E&&T.up.set(E[0],
-E[1],E[2]);I.cameras[r]=T}for(w in y.lights){B=y.lights[w];r=B.color!==void 0?B.color:16777215;T=B.intensity!==void 0?B.intensity:1;if(B.type==="directional"){u=B.direction;A=new THREE.DirectionalLight(r,T);A.position.set(u[0],u[1],u[2]);A.position.normalize()}else if(B.type==="point"){u=B.position;A=B.distance;A=new THREE.PointLight(r,T,A);A.position.set(u[0],u[1],u[2])}else B.type==="ambient"&&(A=new THREE.AmbientLight(r));I.scene.add(A);I.lights[w]=A}for(n in y.fogs){w=y.fogs[n];w.type==="linear"?
+THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return b=="relativeToHTML"?a:k+"/"+a}function f(){var a;for(j in y.objects)if(!I.objects[j]){p=y.objects[j];if(p.geometry!==void 0){if(G=I.geometries[p.geometry]){a=false;R=I.materials[p.materials[0]];(a=R instanceof THREE.ShaderMaterial)&&G.computeTangents();s=p.position;J=p.rotation;D=p.quaternion;M=p.scale;u=p.matrix;D=0;p.materials.length==0&&(R=new THREE.MeshFaceMaterial);p.materials.length>1&&(R=new THREE.MeshFaceMaterial);
+a=new THREE.Mesh(G,R);a.name=j;if(u){a.matrixAutoUpdate=false;a.matrix.set(u[0],u[1],u[2],u[3],u[4],u[5],u[6],u[7],u[8],u[9],u[10],u[11],u[12],u[13],u[14],u[15])}else{a.position.set(s[0],s[1],s[2]);if(D){a.quaternion.set(D[0],D[1],D[2],D[3]);a.useQuaternion=true}else a.rotation.set(J[0],J[1],J[2]);a.scale.set(M[0],M[1],M[2])}a.visible=p.visible;a.doubleSided=p.doubleSided;a.castShadow=p.castShadow;a.receiveShadow=p.receiveShadow;I.scene.add(a);I.objects[j]=a}}else{s=p.position;J=p.rotation;D=p.quaternion;
+M=p.scale;D=0;a=new THREE.Object3D;a.name=j;a.position.set(s[0],s[1],s[2]);if(D){a.quaternion.set(D[0],D[1],D[2],D[3]);a.useQuaternion=true}else a.rotation.set(J[0],J[1],J[2]);a.scale.set(M[0],M[1],M[2]);a.visible=p.visible!==void 0?p.visible:false;I.scene.add(a);I.objects[j]=a;I.empties[j]=a}}}function e(a){return function(b){I.geometries[a]=b;f();Z=Z-1;m.onLoadComplete();l()}}function h(a){return function(b){I.geometries[a]=b}}function l(){m.callbackProgress({totalModels:g,totalTextures:W,loadedModels:g-
+Z,loadedTextures:W-F},I);m.onLoadProgress();Z===0&&F===0&&b(I)}var m=this,k=THREE.Loader.prototype.extractUrlBase(c),i,o,j,w,r,n,q,p,u,B,A,s,J,D,M,E,Q,G,R,T,S,y,L,Z,F,g,W,I;y=a;c=new THREE.BinaryLoader;L=new THREE.JSONLoader;F=Z=0;I={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(y.transform){a=y.transform.position;B=y.transform.rotation;E=y.transform.scale;a&&I.scene.position.set(a[0],a[1],a[2]);B&&I.scene.rotation.set(B[0],B[1],
+B[2]);E&&I.scene.scale.set(E[0],E[1],E[2]);if(a||B||E){I.scene.updateMatrix();I.scene.updateMatrixWorld()}}a=function(a){return function(){F=F-a;l();m.onLoadComplete()}};for(r in y.cameras){E=y.cameras[r];E.type==="perspective"?T=new THREE.PerspectiveCamera(E.fov,E.aspect,E.near,E.far):E.type==="ortho"&&(T=new THREE.OrthographicCamera(E.left,E.right,E.top,E.bottom,E.near,E.far));s=E.position;B=E.target;E=E.up;T.position.set(s[0],s[1],s[2]);T.target=new THREE.Vector3(B[0],B[1],B[2]);E&&T.up.set(E[0],
+E[1],E[2]);I.cameras[r]=T}for(w in y.lights){B=y.lights[w];r=B.color!==void 0?B.color:16777215;T=B.intensity!==void 0?B.intensity:1;if(B.type==="directional"){s=B.direction;A=new THREE.DirectionalLight(r,T);A.position.set(s[0],s[1],s[2]);A.position.normalize()}else if(B.type==="point"){s=B.position;A=B.distance;A=new THREE.PointLight(r,T,A);A.position.set(s[0],s[1],s[2])}else B.type==="ambient"&&(A=new THREE.AmbientLight(r));I.scene.add(A);I.lights[w]=A}for(n in y.fogs){w=y.fogs[n];w.type==="linear"?
 S=new THREE.Fog(0,w.near,w.far):w.type==="exp2"&&(S=new THREE.FogExp2(0,w.density));E=w.color;S.color.setRGB(E[0],E[1],E[2]);I.fogs[n]=S}if(I.cameras&&y.defaults.camera)I.currentCamera=I.cameras[y.defaults.camera];if(I.fogs&&y.defaults.fog)I.scene.fog=I.fogs[y.defaults.fog];E=y.defaults.bgcolor;I.bgColor=new THREE.Color;I.bgColor.setRGB(E[0],E[1],E[2]);I.bgColorAlpha=y.defaults.bgalpha;for(i in y.geometries){n=y.geometries[i];if(n.type=="bin_mesh"||n.type=="ascii_mesh"){Z=Z+1;m.onLoadStart()}}g=Z;
 for(i in y.geometries){n=y.geometries[i];if(n.type==="cube"){G=new THREE.CubeGeometry(n.width,n.height,n.depth,n.segmentsWidth,n.segmentsHeight,n.segmentsDepth,null,n.flipped,n.sides);I.geometries[i]=G}else if(n.type==="plane"){G=new THREE.PlaneGeometry(n.width,n.height,n.segmentsWidth,n.segmentsHeight);I.geometries[i]=G}else if(n.type==="sphere"){G=new THREE.SphereGeometry(n.radius,n.segmentsWidth,n.segmentsHeight);I.geometries[i]=G}else if(n.type==="cylinder"){G=new THREE.CylinderGeometry(n.topRad,
 n.botRad,n.height,n.radSegs,n.heightSegs);I.geometries[i]=G}else if(n.type==="torus"){G=new THREE.TorusGeometry(n.radius,n.tube,n.segmentsR,n.segmentsT);I.geometries[i]=G}else if(n.type==="icosahedron"){G=new THREE.IcosahedronGeometry(n.radius,n.subdivisions);I.geometries[i]=G}else if(n.type==="bin_mesh")c.load(d(n.url,y.urlBaseType),e(i));else if(n.type==="ascii_mesh")L.load(d(n.url,y.urlBaseType),e(i));else if(n.type==="embedded_mesh"){n=y.embeds[n.id];n.metadata=y.metadata;n&&L.createModel(n,h(i),
 "")}}for(q in y.textures){i=y.textures[q];if(i.url instanceof Array){F=F+i.url.length;for(n=0;n<i.url.length;n++)m.onLoadStart()}else{F=F+1;m.onLoadStart()}}W=F;for(q in y.textures){i=y.textures[q];if(i.mapping!==void 0&&THREE[i.mapping]!==void 0)i.mapping=new THREE[i.mapping];if(i.url instanceof Array){n=i.url.length;S=[];for(c=0;c<n;c++)S[c]=d(i.url[c],y.urlBaseType);n=THREE.ImageUtils.loadTextureCube(S,i.mapping,a(n))}else{n=THREE.ImageUtils.loadTexture(d(i.url,y.urlBaseType),i.mapping,a(1));if(THREE[i.minFilter]!==
-void 0)n.minFilter=THREE[i.minFilter];if(THREE[i.magFilter]!==void 0)n.magFilter=THREE[i.magFilter];if(i.repeat){n.repeat.set(i.repeat[0],i.repeat[1]);if(i.repeat[0]!==1)n.wrapS=THREE.RepeatWrapping;if(i.repeat[1]!==1)n.wrapT=THREE.RepeatWrapping}i.offset&&n.offset.set(i.offset[0],i.offset[1]);if(i.wrap){S={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(S[i.wrap[0]]!==void 0)n.wrapS=S[i.wrap[0]];if(S[i.wrap[1]]!==void 0)n.wrapT=S[i.wrap[1]]}}I.textures[q]=n}for(o in y.materials){s=
-y.materials[o];for(Q in s.parameters)if(Q==="envMap"||Q==="map"||Q==="lightMap")s.parameters[Q]=I.textures[s.parameters[Q]];else if(Q==="shading")s.parameters[Q]=s.parameters[Q]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(Q==="blending")s.parameters[Q]=s.parameters[Q]in THREE?THREE[s.parameters[Q]]:THREE.NormalBlending;else if(Q==="combine")s.parameters[Q]=s.parameters[Q]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(Q==="vertexColors")if(s.parameters[Q]=="face")s.parameters[Q]=
-THREE.FaceColors;else if(s.parameters[Q])s.parameters[Q]=THREE.VertexColors;if(s.parameters.opacity!==void 0&&s.parameters.opacity<1)s.parameters.transparent=true;if(s.parameters.normalMap){q=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(q.uniforms);i=s.parameters.color;n=s.parameters.specular;S=s.parameters.ambient;c=s.parameters.shininess;a.tNormal.texture=I.textures[s.parameters.normalMap];if(s.parameters.normalMapFactor)a.uNormalScale.value=s.parameters.normalMapFactor;if(s.parameters.map){a.tDiffuse.texture=
-s.parameters.map;a.enableDiffuse.value=true}if(s.parameters.lightMap){a.tAO.texture=s.parameters.lightMap;a.enableAO.value=true}if(s.parameters.specularMap){a.tSpecular.texture=I.textures[s.parameters.specularMap];a.enableSpecular.value=true}a.uDiffuseColor.value.setHex(i);a.uSpecularColor.value.setHex(n);a.uAmbientColor.value.setHex(S);a.uShininess.value=c;if(s.parameters.opacity)a.uOpacity.value=s.parameters.opacity;R=new THREE.ShaderMaterial({fragmentShader:q.fragmentShader,vertexShader:q.vertexShader,
-uniforms:a,lights:true,fog:true})}else R=new THREE[s.type](s.parameters);I.materials[o]=R}f();m.callbackSync(I);l()};THREE.TextureLoader=function(){THREE.EventTarget.call(this);this.crossOrigin=null};
+void 0)n.minFilter=THREE[i.minFilter];if(THREE[i.magFilter]!==void 0)n.magFilter=THREE[i.magFilter];if(i.repeat){n.repeat.set(i.repeat[0],i.repeat[1]);if(i.repeat[0]!==1)n.wrapS=THREE.RepeatWrapping;if(i.repeat[1]!==1)n.wrapT=THREE.RepeatWrapping}i.offset&&n.offset.set(i.offset[0],i.offset[1]);if(i.wrap){S={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(S[i.wrap[0]]!==void 0)n.wrapS=S[i.wrap[0]];if(S[i.wrap[1]]!==void 0)n.wrapT=S[i.wrap[1]]}}I.textures[q]=n}for(o in y.materials){u=
+y.materials[o];for(Q in u.parameters)if(Q==="envMap"||Q==="map"||Q==="lightMap")u.parameters[Q]=I.textures[u.parameters[Q]];else if(Q==="shading")u.parameters[Q]=u.parameters[Q]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(Q==="blending")u.parameters[Q]=u.parameters[Q]in THREE?THREE[u.parameters[Q]]:THREE.NormalBlending;else if(Q==="combine")u.parameters[Q]=u.parameters[Q]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(Q==="vertexColors")if(u.parameters[Q]=="face")u.parameters[Q]=
+THREE.FaceColors;else if(u.parameters[Q])u.parameters[Q]=THREE.VertexColors;if(u.parameters.opacity!==void 0&&u.parameters.opacity<1)u.parameters.transparent=true;if(u.parameters.normalMap){q=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(q.uniforms);i=u.parameters.color;n=u.parameters.specular;S=u.parameters.ambient;c=u.parameters.shininess;a.tNormal.texture=I.textures[u.parameters.normalMap];if(u.parameters.normalMapFactor)a.uNormalScale.value=u.parameters.normalMapFactor;if(u.parameters.map){a.tDiffuse.texture=
+u.parameters.map;a.enableDiffuse.value=true}if(u.parameters.lightMap){a.tAO.texture=u.parameters.lightMap;a.enableAO.value=true}if(u.parameters.specularMap){a.tSpecular.texture=I.textures[u.parameters.specularMap];a.enableSpecular.value=true}a.uDiffuseColor.value.setHex(i);a.uSpecularColor.value.setHex(n);a.uAmbientColor.value.setHex(S);a.uShininess.value=c;if(u.parameters.opacity)a.uOpacity.value=u.parameters.opacity;R=new THREE.ShaderMaterial({fragmentShader:q.fragmentShader,vertexShader:q.vertexShader,
+uniforms:a,lights:true,fog:true})}else R=new THREE[u.type](u.parameters);I.materials[o]=R}f();m.callbackSync(I);l()};THREE.TextureLoader=function(){THREE.EventTarget.call(this);this.crossOrigin=null};
 THREE.TextureLoader.prototype={constructor:THREE.TextureLoader,load:function(a){var b=this,c=new Image;c.addEventListener("load",function(){var a=new THREE.Texture(c);a.needsUpdate=true;b.dispatchEvent({type:"load",content:a})},false);c.addEventListener("error",function(){b.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},false);if(b.crossOrigin)c.crossOrigin=b.crossOrigin;c.src=a}};
 THREE.Material=function(a){a=a||{};this.id=THREE.MaterialCount++;this.name="";this.opacity=a.opacity!==void 0?a.opacity:1;this.transparent=a.transparent!==void 0?a.transparent:false;this.blending=a.blending!==void 0?a.blending:THREE.NormalBlending;this.blendSrc=a.blendSrc!==void 0?a.blendSrc:THREE.SrcAlphaFactor;this.blendDst=a.blendDst!==void 0?a.blendDst:THREE.OneMinusSrcAlphaFactor;this.blendEquation=a.blendEquation!==void 0?a.blendEquation:THREE.AddEquation;this.depthTest=a.depthTest!==void 0?
 a.depthTest:true;this.depthWrite=a.depthWrite!==void 0?a.depthWrite:true;this.polygonOffset=a.polygonOffset!==void 0?a.polygonOffset:false;this.polygonOffsetFactor=a.polygonOffsetFactor!==void 0?a.polygonOffsetFactor:0;this.polygonOffsetUnits=a.polygonOffsetUnits!==void 0?a.polygonOffsetUnits:0;this.alphaTest=a.alphaTest!==void 0?a.alphaTest:0;this.overdraw=a.overdraw!==void 0?a.overdraw:false;this.needsUpdate=this.visible=true};THREE.MaterialCount=0;THREE.NoShading=0;THREE.FlatShading=1;
@@ -274,13 +275,13 @@ if(i.boundTo===void 0||i.boundTo==="vertices"){f=0;e=i.value.length;if(i.size===
 h=i.value[h];i.array[f]=h.x;i.array[f+1]=h.y;i.array[f+2]=h.z;i.array[f+3]=h.w;f=f+4}}}}}else{if(n)for(d=0;d<h;d++){e=i[d];f=d*3;k[f]=e.x;k[f+1]=e.y;k[f+2]=e.z}if(q)for(d=0;d<l;d++){e=j[d];f=d*3;m[f]=e.r;m[f+1]=e.g;m[f+2]=e.b}if(r){j=0;for(l=r.length;j<l;j++){i=r[j];if(i.needsUpdate&&(i.boundTo===void 0||i.boundTo==="vertices")){e=i.value.length;f=0;if(i.size===1)for(d=0;d<e;d++)i.array[d]=i.value[d];else if(i.size===2)for(d=0;d<e;d++){h=i.value[d];i.array[f]=h.x;i.array[f+1]=h.y;f=f+2}else if(i.size===
 3)if(i.type==="c")for(d=0;d<e;d++){h=i.value[d];i.array[f]=h.r;i.array[f+1]=h.g;i.array[f+2]=h.b;f=f+3}else for(d=0;d<e;d++){h=i.value[d];i.array[f]=h.x;i.array[f+1]=h.y;i.array[f+2]=h.z;f=f+3}else if(i.size===4)for(d=0;d<e;d++){h=i.value[d];i.array[f]=h.x;i.array[f+1]=h.y;i.array[f+2]=h.z;i.array[f+3]=h.w;f=f+4}}}}}if(n||c.sortParticles){g.bindBuffer(g.ARRAY_BUFFER,a.__webglVertexBuffer);g.bufferData(g.ARRAY_BUFFER,k,b)}if(q||c.sortParticles){g.bindBuffer(g.ARRAY_BUFFER,a.__webglColorBuffer);g.bufferData(g.ARRAY_BUFFER,
 m,b)}if(r){j=0;for(l=r.length;j<l;j++){i=r[j];if(i.needsUpdate||c.sortParticles){g.bindBuffer(g.ARRAY_BUFFER,i.buffer);g.bufferData(g.ARRAY_BUFFER,i.array,b)}}}}function h(a,b){return b.z-a.z}function l(a,b){return b[1]-a[1]}function m(a,b,c){if(a.length)for(var d=0,g=a.length;d<g;d++){ga=za=null;na=ca=Ha=Ba=nb=Xa=Ia=-1;ob=true;a[d].render(b,c,$b,ac);ga=za=null;na=ca=Ha=Ba=nb=Xa=Ia=-1;ob=true}}function k(a,b,c,d,g,f,e,h){var i,j,l,k;if(b){j=a.length-1;k=b=-1}else{j=0;b=a.length;k=1}for(var m=j;m!==
-b;m=m+k){i=a[m];if(i.render){j=i.object;l=i.buffer;if(h)i=h;else{i=i[c];if(!i)continue;e&&F.setBlending(i.blending,i.blendEquation,i.blendSrc,i.blendDst);F.setDepthTest(i.depthTest);F.setDepthWrite(i.depthWrite);s(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}F.setObjectFaces(j);l instanceof THREE.BufferGeometry?F.renderBufferDirect(d,g,f,i,l,j):F.renderBuffer(d,g,f,i,l,j)}}}function i(a,b,c,d,g,f,e){for(var h,i,j=0,l=a.length;j<l;j++){h=a[j];i=h.object;if(i.visible){if(e)h=e;else{h=
-h[b];if(!h)continue;f&&F.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);F.setDepthTest(h.depthTest);F.setDepthWrite(h.depthWrite);s(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}F.renderImmediateObject(c,d,g,h,i)}}}function o(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function j(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return true;return false}function w(a){for(var b in a.attributes)a.attributes[b].needsUpdate=false}function r(a,
+b;m=m+k){i=a[m];if(i.render){j=i.object;l=i.buffer;if(h)i=h;else{i=i[c];if(!i)continue;e&&F.setBlending(i.blending,i.blendEquation,i.blendSrc,i.blendDst);F.setDepthTest(i.depthTest);F.setDepthWrite(i.depthWrite);u(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}F.setObjectFaces(j);l instanceof THREE.BufferGeometry?F.renderBufferDirect(d,g,f,i,l,j):F.renderBuffer(d,g,f,i,l,j)}}}function i(a,b,c,d,g,f,e){for(var h,i,j=0,l=a.length;j<l;j++){h=a[j];i=h.object;if(i.visible){if(e)h=e;else{h=
+h[b];if(!h)continue;f&&F.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);F.setDepthTest(h.depthTest);F.setDepthWrite(h.depthWrite);u(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}F.renderImmediateObject(c,d,g,h,i)}}}function o(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function j(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return true;return false}function w(a){for(var b in a.attributes)a.attributes[b].needsUpdate=false}function r(a,
 b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function n(a,b){for(var c=a.length-1;c>=0;c--)a[c]===b&&a.splice(c,1)}function q(a,b,c,d,f){if(d.needsUpdate){d.program&&F.deallocateMaterial(d);F.initMaterial(d,b,c,f);d.needsUpdate=false}if(d.morphTargets&&!f.__webglMorphTargetInfluences)f.__webglMorphTargetInfluences=new Float32Array(F.maxMorphTargets);var e=false,h=d.program,i=h.uniforms,j=d.uniforms;if(h!==za){g.useProgram(h);za=h;e=true}if(d.id!==na){na=d.id;e=true}if(e||a!==ga){g.uniformMatrix4fv(i.projectionMatrix,
-false,a._projectionMatrixArray);a!==ga&&(ga=a)}if(e){if(c&&d.fog){j.fogColor.value=c.color;if(c instanceof THREE.Fog){j.fogNear.value=c.near;j.fogFar.value=c.far}else if(c instanceof THREE.FogExp2)j.fogDensity.value=c.density}if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(ob){for(var l,k=0,m=0,o=0,n,q,r,p=bc,s=p.directional.colors,w=p.directional.positions,u=p.point.colors,y=p.point.positions,B=p.point.distances,E=p.spot.colors,I=p.spot.positions,J=p.spot.distances,
-L=p.spot.directions,Q=p.spot.angles,G=p.spot.exponents,R=0,S=0,T=0,H=r=0,c=H=0,e=b.length;c<e;c++){l=b[c];if(!l.onlyShadow&&l.visible){n=l.color;q=l.intensity;r=l.distance;if(l instanceof THREE.AmbientLight)if(F.gammaInput){k=k+n.r*n.r;m=m+n.g*n.g;o=o+n.b*n.b}else{k=k+n.r;m=m+n.g;o=o+n.b}else if(l instanceof THREE.DirectionalLight){r=R*3;if(F.gammaInput){s[r]=n.r*n.r*q*q;s[r+1]=n.g*n.g*q*q;s[r+2]=n.b*n.b*q*q}else{s[r]=n.r*q;s[r+1]=n.g*q;s[r+2]=n.b*q}Ca.copy(l.matrixWorld.getPosition());Ca.subSelf(l.target.matrixWorld.getPosition());
-Ca.normalize();w[r]=Ca.x;w[r+1]=Ca.y;w[r+2]=Ca.z;R=R+1}else if(l instanceof THREE.PointLight){H=S*3;if(F.gammaInput){u[H]=n.r*n.r*q*q;u[H+1]=n.g*n.g*q*q;u[H+2]=n.b*n.b*q*q}else{u[H]=n.r*q;u[H+1]=n.g*q;u[H+2]=n.b*q}n=l.matrixWorld.getPosition();y[H]=n.x;y[H+1]=n.y;y[H+2]=n.z;B[S]=r;S=S+1}else if(l instanceof THREE.SpotLight){H=T*3;if(F.gammaInput){E[H]=n.r*n.r*q*q;E[H+1]=n.g*n.g*q*q;E[H+2]=n.b*n.b*q*q}else{E[H]=n.r*q;E[H+1]=n.g*q;E[H+2]=n.b*q}n=l.matrixWorld.getPosition();I[H]=n.x;I[H+1]=n.y;I[H+2]=
-n.z;J[T]=r;Ca.copy(n);Ca.subSelf(l.target.matrixWorld.getPosition());Ca.normalize();L[H]=Ca.x;L[H+1]=Ca.y;L[H+2]=Ca.z;Q[T]=Math.cos(l.angle);G[T]=l.exponent;T=T+1}}}c=R*3;for(e=s.length;c<e;c++)s[c]=0;c=S*3;for(e=u.length;c<e;c++)u[c]=0;c=T*3;for(e=E.length;c<e;c++)E[c]=0;p.directional.length=R;p.point.length=S;p.spot.length=T;p.ambient[0]=k;p.ambient[1]=m;p.ambient[2]=o;ob=false}c=bc;j.ambientLightColor.value=c.ambient;j.directionalLightColor.value=c.directional.colors;j.directionalLightDirection.value=
+false,a._projectionMatrixArray);a!==ga&&(ga=a)}if(e){if(c&&d.fog){j.fogColor.value=c.color;if(c instanceof THREE.Fog){j.fogNear.value=c.near;j.fogFar.value=c.far}else if(c instanceof THREE.FogExp2)j.fogDensity.value=c.density}if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(ob){for(var l,k=0,m=0,o=0,n,r,q,p=bc,u=p.directional.colors,w=p.directional.positions,s=p.point.colors,y=p.point.positions,B=p.point.distances,E=p.spot.colors,I=p.spot.positions,J=p.spot.distances,
+L=p.spot.directions,Q=p.spot.angles,G=p.spot.exponents,R=0,S=0,T=0,H=q=0,c=H=0,e=b.length;c<e;c++){l=b[c];if(!l.onlyShadow&&l.visible){n=l.color;r=l.intensity;q=l.distance;if(l instanceof THREE.AmbientLight)if(F.gammaInput){k=k+n.r*n.r;m=m+n.g*n.g;o=o+n.b*n.b}else{k=k+n.r;m=m+n.g;o=o+n.b}else if(l instanceof THREE.DirectionalLight){q=R*3;if(F.gammaInput){u[q]=n.r*n.r*r*r;u[q+1]=n.g*n.g*r*r;u[q+2]=n.b*n.b*r*r}else{u[q]=n.r*r;u[q+1]=n.g*r;u[q+2]=n.b*r}Ca.copy(l.matrixWorld.getPosition());Ca.subSelf(l.target.matrixWorld.getPosition());
+Ca.normalize();w[q]=Ca.x;w[q+1]=Ca.y;w[q+2]=Ca.z;R=R+1}else if(l instanceof THREE.PointLight){H=S*3;if(F.gammaInput){s[H]=n.r*n.r*r*r;s[H+1]=n.g*n.g*r*r;s[H+2]=n.b*n.b*r*r}else{s[H]=n.r*r;s[H+1]=n.g*r;s[H+2]=n.b*r}n=l.matrixWorld.getPosition();y[H]=n.x;y[H+1]=n.y;y[H+2]=n.z;B[S]=q;S=S+1}else if(l instanceof THREE.SpotLight){H=T*3;if(F.gammaInput){E[H]=n.r*n.r*r*r;E[H+1]=n.g*n.g*r*r;E[H+2]=n.b*n.b*r*r}else{E[H]=n.r*r;E[H+1]=n.g*r;E[H+2]=n.b*r}n=l.matrixWorld.getPosition();I[H]=n.x;I[H+1]=n.y;I[H+2]=
+n.z;J[T]=q;Ca.copy(n);Ca.subSelf(l.target.matrixWorld.getPosition());Ca.normalize();L[H]=Ca.x;L[H+1]=Ca.y;L[H+2]=Ca.z;Q[T]=Math.cos(l.angle);G[T]=l.exponent;T=T+1}}}c=R*3;for(e=u.length;c<e;c++)u[c]=0;c=S*3;for(e=s.length;c<e;c++)s[c]=0;c=T*3;for(e=E.length;c<e;c++)E[c]=0;p.directional.length=R;p.point.length=S;p.spot.length=T;p.ambient[0]=k;p.ambient[1]=m;p.ambient[2]=o;ob=false}c=bc;j.ambientLightColor.value=c.ambient;j.directionalLightColor.value=c.directional.colors;j.directionalLightDirection.value=
 c.directional.positions;j.pointLightColor.value=c.point.colors;j.pointLightPosition.value=c.point.positions;j.pointLightDistance.value=c.point.distances;j.spotLightColor.value=c.spot.colors;j.spotLightPosition.value=c.spot.positions;j.spotLightDistance.value=c.spot.distances;j.spotLightDirection.value=c.spot.directions;j.spotLightAngle.value=c.spot.angles;j.spotLightExponent.value=c.spot.exponents}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){j.opacity.value=
 d.opacity;F.gammaInput?j.diffuse.value.copyGammaToLinear(d.color):j.diffuse.value=d.color;(j.map.texture=d.map)&&j.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y);j.lightMap.texture=d.lightMap;j.envMap.texture=d.envMap;j.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1;j.reflectivity.value=d.reflectivity;j.refractionRatio.value=d.refractionRatio;j.combine.value=d.combine;j.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping}if(d instanceof
 THREE.LineBasicMaterial){j.diffuse.value=d.color;j.opacity.value=d.opacity}else if(d instanceof THREE.ParticleBasicMaterial){j.psColor.value=d.color;j.opacity.value=d.opacity;j.size.value=d.size;j.scale.value=M.height/2;j.map.texture=d.map}else if(d instanceof THREE.MeshPhongMaterial){j.shininess.value=d.shininess;if(F.gammaInput){j.ambient.value.copyGammaToLinear(d.ambient);j.emissive.value.copyGammaToLinear(d.emissive);j.specular.value.copyGammaToLinear(d.specular)}else{j.ambient.value=d.ambient;
@@ -289,12 +290,12 @@ d.opacity;if(f.receiveShadow&&!d._shadowPass&&j.shadowMatrix){e=c=0;for(l=b.leng
 switch(m){case "i":g.uniform1i(k,l);break;case "f":g.uniform1f(k,l);break;case "v2":g.uniform2f(k,l.x,l.y);break;case "v3":g.uniform3f(k,l.x,l.y,l.z);break;case "v4":g.uniform4f(k,l.x,l.y,l.z,l.w);break;case "c":g.uniform3f(k,l.r,l.g,l.b);break;case "fv1":g.uniform1fv(k,l);break;case "fv":g.uniform3fv(k,l);break;case "v2v":if(!e._array)e._array=new Float32Array(2*l.length);m=0;for(o=l.length;m<o;m++){p=m*2;e._array[p]=l[m].x;e._array[p+1]=l[m].y}g.uniform2fv(k,e._array);break;case "v3v":if(!e._array)e._array=
 new Float32Array(3*l.length);m=0;for(o=l.length;m<o;m++){p=m*3;e._array[p]=l[m].x;e._array[p+1]=l[m].y;e._array[p+2]=l[m].z}g.uniform3fv(k,e._array);break;case "v4v":if(!e._array)e._array=new Float32Array(4*l.length);m=0;for(o=l.length;m<o;m++){p=m*4;e._array[p]=l[m].x;e._array[p+1]=l[m].y;e._array[p+2]=l[m].z;e._array[p+3]=l[m].w}g.uniform4fv(k,e._array);break;case "m4":if(!e._array)e._array=new Float32Array(16);l.flattenToArray(e._array);g.uniformMatrix4fv(k,false,e._array);break;case "m4v":if(!e._array)e._array=
 new Float32Array(16*l.length);m=0;for(o=l.length;m<o;m++)l[m].flattenToArrayOffset(e._array,m*16);g.uniformMatrix4fv(k,false,e._array);break;case "t":g.uniform1i(k,l);k=e.texture;if(!k)continue;if(k.image instanceof Array&&k.image.length===6){e=k;if(e.image.length===6)if(e.needsUpdate){if(!e.image.__webglTextureCube)e.image.__webglTextureCube=g.createTexture();g.activeTexture(g.TEXTURE0+l);g.bindTexture(g.TEXTURE_CUBE_MAP,e.image.__webglTextureCube);l=[];for(k=0;k<6;k++){m=l;o=k;if(F.autoScaleCubemaps){p=
-e.image[k];w=Kc;if(!(p.width<=w&&p.height<=w)){u=Math.max(p.width,p.height);s=Math.floor(p.width*w/u);w=Math.floor(p.height*w/u);u=document.createElement("canvas");u.width=s;u.height=w;u.getContext("2d").drawImage(p,0,0,p.width,p.height,0,0,s,w);p=u}}else p=e.image[k];m[o]=p}k=l[0];m=(k.width&k.width-1)===0&&(k.height&k.height-1)===0;o=D(e.format);p=D(e.type);A(g.TEXTURE_CUBE_MAP,e,m);for(k=0;k<6;k++)g.texImage2D(g.TEXTURE_CUBE_MAP_POSITIVE_X+k,0,o,o,p,l[k]);e.generateMipmaps&&m&&g.generateMipmap(g.TEXTURE_CUBE_MAP);
+e.image[k];w=Kc;if(!(p.width<=w&&p.height<=w)){s=Math.max(p.width,p.height);u=Math.floor(p.width*w/s);w=Math.floor(p.height*w/s);s=document.createElement("canvas");s.width=u;s.height=w;s.getContext("2d").drawImage(p,0,0,p.width,p.height,0,0,u,w);p=s}}else p=e.image[k];m[o]=p}k=l[0];m=(k.width&k.width-1)===0&&(k.height&k.height-1)===0;o=D(e.format);p=D(e.type);A(g.TEXTURE_CUBE_MAP,e,m);for(k=0;k<6;k++)g.texImage2D(g.TEXTURE_CUBE_MAP_POSITIVE_X+k,0,o,o,p,l[k]);e.generateMipmaps&&m&&g.generateMipmap(g.TEXTURE_CUBE_MAP);
 e.needsUpdate=false;if(e.onUpdate)e.onUpdate()}else{g.activeTexture(g.TEXTURE0+l);g.bindTexture(g.TEXTURE_CUBE_MAP,e.image.__webglTextureCube)}}else if(k instanceof THREE.WebGLRenderTargetCube){e=k;g.activeTexture(g.TEXTURE0+l);g.bindTexture(g.TEXTURE_CUBE_MAP,e.__webglTexture)}else F.setTexture(k,l);break;case "tv":if(!e._array){e._array=[];m=0;for(o=e.texture.length;m<o;m++)e._array[m]=l+m}g.uniform1iv(k,e._array);m=0;for(o=e.texture.length;m<o;m++)(k=e.texture[m])&&F.setTexture(k,e._array[m])}}if((d instanceof
 THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&i.cameraPosition!==null){b=a.matrixWorld.getPosition();g.uniform3f(i.cameraPosition,b.x,b.y,b.z)}(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&i.viewMatrix!==null&&g.uniformMatrix4fv(i.viewMatrix,false,a._viewMatrixArray);d.skinning&&g.uniformMatrix4fv(i.boneGlobalMatrices,false,f.boneMatrices)}g.uniformMatrix4fv(i.modelViewMatrix,false,f._modelViewMatrix.elements);
-i.normalMatrix&&g.uniformMatrix3fv(i.normalMatrix,false,f._normalMatrix.elements);i.objectMatrix!==null&&g.uniformMatrix4fv(i.objectMatrix,false,f.matrixWorld.elements);return h}function p(a,b){a._modelViewMatrix.multiply(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getInverse(a._modelViewMatrix);a._normalMatrix.transpose()}function s(a,b,c){if(sc!==a){a?g.enable(g.POLYGON_OFFSET_FILL):g.disable(g.POLYGON_OFFSET_FILL);sc=a}if(a&&(tc!==b||uc!==c)){g.polygonOffset(b,c);tc=b;uc=c}}function B(a,
+i.normalMatrix&&g.uniformMatrix3fv(i.normalMatrix,false,f._normalMatrix.elements);i.objectMatrix!==null&&g.uniformMatrix4fv(i.objectMatrix,false,f.matrixWorld.elements);return h}function p(a,b){a._modelViewMatrix.multiply(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getInverse(a._modelViewMatrix);a._normalMatrix.transpose()}function u(a,b,c){if(sc!==a){a?g.enable(g.POLYGON_OFFSET_FILL):g.disable(g.POLYGON_OFFSET_FILL);sc=a}if(a&&(tc!==b||uc!==c)){g.polygonOffset(b,c);tc=b;uc=c}}function B(a,
 b){var c;a==="fragment"?c=g.createShader(g.FRAGMENT_SHADER):a==="vertex"&&(c=g.createShader(g.VERTEX_SHADER));g.shaderSource(c,b);g.compileShader(c);if(!g.getShaderParameter(c,g.COMPILE_STATUS)){console.error(g.getShaderInfoLog(c));console.error(b);return null}return c}function A(a,b,c){if(c){g.texParameteri(a,g.TEXTURE_WRAP_S,D(b.wrapS));g.texParameteri(a,g.TEXTURE_WRAP_T,D(b.wrapT));g.texParameteri(a,g.TEXTURE_MAG_FILTER,D(b.magFilter));g.texParameteri(a,g.TEXTURE_MIN_FILTER,D(b.minFilter))}else{g.texParameteri(a,
-g.TEXTURE_WRAP_S,g.CLAMP_TO_EDGE);g.texParameteri(a,g.TEXTURE_WRAP_T,g.CLAMP_TO_EDGE);g.texParameteri(a,g.TEXTURE_MAG_FILTER,J(b.magFilter));g.texParameteri(a,g.TEXTURE_MIN_FILTER,J(b.minFilter))}}function u(a,b){g.bindRenderbuffer(g.RENDERBUFFER,a);if(b.depthBuffer&&!b.stencilBuffer){g.renderbufferStorage(g.RENDERBUFFER,g.DEPTH_COMPONENT16,b.width,b.height);g.framebufferRenderbuffer(g.FRAMEBUFFER,g.DEPTH_ATTACHMENT,g.RENDERBUFFER,a)}else if(b.depthBuffer&&b.stencilBuffer){g.renderbufferStorage(g.RENDERBUFFER,
+g.TEXTURE_WRAP_S,g.CLAMP_TO_EDGE);g.texParameteri(a,g.TEXTURE_WRAP_T,g.CLAMP_TO_EDGE);g.texParameteri(a,g.TEXTURE_MAG_FILTER,J(b.magFilter));g.texParameteri(a,g.TEXTURE_MIN_FILTER,J(b.minFilter))}}function s(a,b){g.bindRenderbuffer(g.RENDERBUFFER,a);if(b.depthBuffer&&!b.stencilBuffer){g.renderbufferStorage(g.RENDERBUFFER,g.DEPTH_COMPONENT16,b.width,b.height);g.framebufferRenderbuffer(g.FRAMEBUFFER,g.DEPTH_ATTACHMENT,g.RENDERBUFFER,a)}else if(b.depthBuffer&&b.stencilBuffer){g.renderbufferStorage(g.RENDERBUFFER,
 g.DEPTH_STENCIL,b.width,b.height);g.framebufferRenderbuffer(g.FRAMEBUFFER,g.DEPTH_STENCIL_ATTACHMENT,g.RENDERBUFFER,a)}else g.renderbufferStorage(g.RENDERBUFFER,g.RGBA4,b.width,b.height)}function J(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return g.NEAREST;default:return g.LINEAR}}function D(a){switch(a){case THREE.RepeatWrapping:return g.REPEAT;case THREE.ClampToEdgeWrapping:return g.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return g.MIRRORED_REPEAT;
 case THREE.NearestFilter:return g.NEAREST;case THREE.NearestMipMapNearestFilter:return g.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return g.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return g.LINEAR;case THREE.LinearMipMapNearestFilter:return g.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return g.LINEAR_MIPMAP_LINEAR;case THREE.UnsignedByteType:return g.UNSIGNED_BYTE;case THREE.UnsignedShort4444Type:return g.UNSIGNED_SHORT_4_4_4_4;case THREE.UnsignedShort5551Type:return g.UNSIGNED_SHORT_5_5_5_1;
 case THREE.UnsignedShort565Type:return g.UNSIGNED_SHORT_5_6_5;case THREE.ByteType:return g.BYTE;case THREE.ShortType:return g.SHORT;case THREE.UnsignedShortType:return g.UNSIGNED_SHORT;case THREE.IntType:return g.INT;case THREE.UnsignedIntType:return g.UNSIGNED_INT;case THREE.FloatType:return g.FLOAT;case THREE.AlphaFormat:return g.ALPHA;case THREE.RGBFormat:return g.RGB;case THREE.RGBAFormat:return g.RGBA;case THREE.LuminanceFormat:return g.LUMINANCE;case THREE.LuminanceAlphaFormat:return g.LUMINANCE_ALPHA;
@@ -312,7 +313,7 @@ void 0;for(d in c.__webglCustomAttributesList)g.deleteBuffer(c.__webglCustomAttr
 g.deleteBuffer(a.__webglColorBuffer);F.info.memory.geometries--}}};this.deallocateTexture=function(a){if(a.__webglInit){a.__webglInit=false;g.deleteTexture(a.__webglTexture);F.info.memory.textures--}};this.deallocateRenderTarget=function(a){if(a&&a.__webglTexture){g.deleteTexture(a.__webglTexture);if(a instanceof THREE.WebGLRenderTargetCube)for(var b=0;b<6;b++){g.deleteFramebuffer(a.__webglFramebuffer[b]);g.deleteRenderbuffer(a.__webglRenderbuffer[b])}else{g.deleteFramebuffer(a.__webglFramebuffer);
 g.deleteRenderbuffer(a.__webglRenderbuffer)}}};this.deallocateMaterial=function(a){var b=a.program;if(b){a.program=void 0;var c,d,e=false,a=0;for(c=W.length;a<c;a++){d=W[a];if(d.program===b){d.usedTimes--;d.usedTimes===0&&(e=true);break}}if(e){e=[];a=0;for(c=W.length;a<c;a++){d=W[a];d.program!==b&&e.push(d)}W=e;g.deleteProgram(b);F.info.memory.programs--}}};this.updateShadowMap=function(a,b){za=null;na=ca=nb=Xa=Ia=-1;ob=true;Ha=Ba=-1;this.shadowMapPlugin.update(a,b)};this.renderBufferImmediate=function(a,
 b,c){if(a.hasPositions&&!a.__webglVertexBuffer)a.__webglVertexBuffer=g.createBuffer();if(a.hasNormals&&!a.__webglNormalBuffer)a.__webglNormalBuffer=g.createBuffer();if(a.hasUvs&&!a.__webglUvBuffer)a.__webglUvBuffer=g.createBuffer();if(a.hasColors&&!a.__webglColorBuffer)a.__webglColorBuffer=g.createBuffer();if(a.hasPositions){g.bindBuffer(g.ARRAY_BUFFER,a.__webglVertexBuffer);g.bufferData(g.ARRAY_BUFFER,a.positionArray,g.DYNAMIC_DRAW);g.enableVertexAttribArray(b.attributes.position);g.vertexAttribPointer(b.attributes.position,
-3,g.FLOAT,false,0,0)}if(a.hasNormals){g.bindBuffer(g.ARRAY_BUFFER,a.__webglNormalBuffer);if(c.shading===THREE.FlatShading){var d,e,f,h,i,j,l,k,m,n,o,q=a.count*3;for(o=0;o<q;o=o+9){n=a.normalArray;d=n[o];e=n[o+1];f=n[o+2];h=n[o+3];j=n[o+4];k=n[o+5];i=n[o+6];l=n[o+7];m=n[o+8];d=(d+h+i)/3;e=(e+j+l)/3;f=(f+k+m)/3;n[o]=d;n[o+1]=e;n[o+2]=f;n[o+3]=d;n[o+4]=e;n[o+5]=f;n[o+6]=d;n[o+7]=e;n[o+8]=f}}g.bufferData(g.ARRAY_BUFFER,a.normalArray,g.DYNAMIC_DRAW);g.enableVertexAttribArray(b.attributes.normal);g.vertexAttribPointer(b.attributes.normal,
+3,g.FLOAT,false,0,0)}if(a.hasNormals){g.bindBuffer(g.ARRAY_BUFFER,a.__webglNormalBuffer);if(c.shading===THREE.FlatShading){var d,e,f,h,i,j,l,k,m,n,o,r=a.count*3;for(o=0;o<r;o=o+9){n=a.normalArray;d=n[o];e=n[o+1];f=n[o+2];h=n[o+3];j=n[o+4];k=n[o+5];i=n[o+6];l=n[o+7];m=n[o+8];d=(d+h+i)/3;e=(e+j+l)/3;f=(f+k+m)/3;n[o]=d;n[o+1]=e;n[o+2]=f;n[o+3]=d;n[o+4]=e;n[o+5]=f;n[o+6]=d;n[o+7]=e;n[o+8]=f}}g.bufferData(g.ARRAY_BUFFER,a.normalArray,g.DYNAMIC_DRAW);g.enableVertexAttribArray(b.attributes.normal);g.vertexAttribPointer(b.attributes.normal,
 3,g.FLOAT,false,0,0)}if(a.hasUvs&&c.map){g.bindBuffer(g.ARRAY_BUFFER,a.__webglUvBuffer);g.bufferData(g.ARRAY_BUFFER,a.uvArray,g.DYNAMIC_DRAW);g.enableVertexAttribArray(b.attributes.uv);g.vertexAttribPointer(b.attributes.uv,2,g.FLOAT,false,0,0)}if(a.hasColors&&c.vertexColors!==THREE.NoColors){g.bindBuffer(g.ARRAY_BUFFER,a.__webglColorBuffer);g.bufferData(g.ARRAY_BUFFER,a.colorArray,g.DYNAMIC_DRAW);g.enableVertexAttribArray(b.attributes.color);g.vertexAttribPointer(b.attributes.color,3,g.FLOAT,false,
 0,0)}g.drawArrays(g.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){if(d.visible!==false){c=q(a,b,c,d,f);a=c.attributes;b=false;d=e.id*16777215+c.id*2+(d.wireframe?1:0);if(d!==ca){ca=d;b=true}if(f instanceof THREE.Mesh){f=e.offsets;d=0;for(c=f.length;d<c;++d){if(b){g.bindBuffer(g.ARRAY_BUFFER,e.vertexPositionBuffer);g.vertexAttribPointer(a.position,e.vertexPositionBuffer.itemSize,g.FLOAT,false,0,f[d].index*12);if(a.normal>=0&&e.vertexNormalBuffer){g.bindBuffer(g.ARRAY_BUFFER,
 e.vertexNormalBuffer);g.vertexAttribPointer(a.normal,e.vertexNormalBuffer.itemSize,g.FLOAT,false,0,f[d].index*12)}if(a.uv>=0&&e.vertexUvBuffer)if(e.vertexUvBuffer){g.bindBuffer(g.ARRAY_BUFFER,e.vertexUvBuffer);g.vertexAttribPointer(a.uv,e.vertexUvBuffer.itemSize,g.FLOAT,false,0,f[d].index*8);g.enableVertexAttribArray(a.uv)}else g.disableVertexAttribArray(a.uv);if(a.color>=0&&e.vertexColorBuffer){g.bindBuffer(g.ARRAY_BUFFER,e.vertexColorBuffer);g.vertexAttribPointer(a.color,e.vertexColorBuffer.itemSize,
@@ -325,16 +326,16 @@ c.size,g.FLOAT,false,0,0)}}}if(b.color>=0){g.bindBuffer(g.ARRAY_BUFFER,e.__webgl
 false,0,0);g.enableVertexAttribArray(b.uv)}else g.disableVertexAttribArray(b.uv);if(b.uv2>=0)if(e.__webglUV2Buffer){g.bindBuffer(g.ARRAY_BUFFER,e.__webglUV2Buffer);g.vertexAttribPointer(b.uv2,2,g.FLOAT,false,0,0);g.enableVertexAttribArray(b.uv2)}else g.disableVertexAttribArray(b.uv2);if(d.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0){g.bindBuffer(g.ARRAY_BUFFER,e.__webglSkinVertexABuffer);g.vertexAttribPointer(b.skinVertexA,4,g.FLOAT,false,0,0);g.bindBuffer(g.ARRAY_BUFFER,
 e.__webglSkinVertexBBuffer);g.vertexAttribPointer(b.skinVertexB,4,g.FLOAT,false,0,0);g.bindBuffer(g.ARRAY_BUFFER,e.__webglSkinIndicesBuffer);g.vertexAttribPointer(b.skinIndex,4,g.FLOAT,false,0,0);g.bindBuffer(g.ARRAY_BUFFER,e.__webglSkinWeightsBuffer);g.vertexAttribPointer(b.skinWeight,4,g.FLOAT,false,0,0)}}if(f instanceof THREE.Mesh){if(d.wireframe){d=d.wireframeLinewidth;if(d!==Hb){g.lineWidth(d);Hb=d}a&&g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer);g.drawElements(g.LINES,e.__webglLineCount,
 g.UNSIGNED_SHORT,0)}else{a&&g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer);g.drawElements(g.TRIANGLES,e.__webglFaceCount,g.UNSIGNED_SHORT,0)}F.info.render.calls++;F.info.render.vertices=F.info.render.vertices+e.__webglFaceCount;F.info.render.faces=F.info.render.faces+e.__webglFaceCount/3}else if(f instanceof THREE.Line){f=f.type===THREE.LineStrip?g.LINE_STRIP:g.LINES;d=d.linewidth;if(d!==Hb){g.lineWidth(d);Hb=d}g.drawArrays(f,0,e.__webglLineCount);F.info.render.calls++}else if(f instanceof
-THREE.ParticleSystem){g.drawArrays(g.POINTS,0,e.__webglParticleCount);F.info.render.calls++;F.info.render.points=F.info.render.points+e.__webglParticleCount}else if(f instanceof THREE.Ribbon){g.drawArrays(g.TRIANGLE_STRIP,0,e.__webglVertexCount);F.info.render.calls++}}};this.render=function(a,b,c,d){var e,f,j,l,n=a.__lights,o=a.fog;na=-1;ob=true;if(b.parent===void 0){console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it...");a.add(b)}this.autoUpdateScene&&a.updateMatrixWorld();
+THREE.ParticleSystem){g.drawArrays(g.POINTS,0,e.__webglParticleCount);F.info.render.calls++;F.info.render.points=F.info.render.points+e.__webglParticleCount}else if(f instanceof THREE.Ribbon){g.drawArrays(g.TRIANGLE_STRIP,0,e.__webglVertexCount);F.info.render.calls++}}};this.render=function(a,b,c,d){var e,f,j,l,o=a.__lights,n=a.fog;na=-1;ob=true;if(b.parent===void 0){console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it...");a.add(b)}this.autoUpdateScene&&a.updateMatrixWorld();
 if(!b._viewMatrixArray)b._viewMatrixArray=new Float32Array(16);if(!b._projectionMatrixArray)b._projectionMatrixArray=new Float32Array(16);b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);b.projectionMatrix.flattenToArray(b._projectionMatrixArray);Rb.multiply(b.projectionMatrix,b.matrixWorldInverse);dc.setFromMatrix(Rb);this.autoUpdateObjects&&this.initWebGLObjects(a);m(this.renderPluginsPre,a,b);F.info.render.calls=0;F.info.render.vertices=0;F.info.render.faces=
-0;F.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);l=a.__webglObjects;d=0;for(e=l.length;d<e;d++){f=l[d];j=f.object;f.render=false;if(j.visible&&(!(j instanceof THREE.Mesh||j instanceof THREE.ParticleSystem)||!j.frustumCulled||dc.contains(j))){p(j,b);var q=f,r=q.object,w=q.buffer,u=void 0,u=u=void 0,u=r.material;if(u instanceof THREE.MeshFaceMaterial){u=w.materialIndex;if(u>=0){u=r.geometry.materials[u];if(u.transparent){q.transparent=
-u;q.opaque=null}else{q.opaque=u;q.transparent=null}}}else if(u)if(u.transparent){q.transparent=u;q.opaque=null}else{q.opaque=u;q.transparent=null}f.render=true;if(this.sortObjects)if(j.renderDepth)f.z=j.renderDepth;else{Oa.copy(j.matrixWorld.getPosition());Rb.multiplyVector3(Oa);f.z=Oa.z}}}this.sortObjects&&l.sort(h);l=a.__webglObjectsImmediate;d=0;for(e=l.length;d<e;d++){f=l[d];j=f.object;if(j.visible){p(j,b);j=f.object.material;if(j.transparent){f.transparent=j;f.opaque=null}else{f.opaque=j;f.transparent=
-null}}}if(a.overrideMaterial){d=a.overrideMaterial;this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst);this.setDepthTest(d.depthTest);this.setDepthWrite(d.depthWrite);s(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits);k(a.__webglObjects,false,"",b,n,o,true,d);i(a.__webglObjectsImmediate,"",b,n,o,false,d)}else{this.setBlending(THREE.NormalBlending);k(a.__webglObjects,true,"opaque",b,n,o,false);i(a.__webglObjectsImmediate,"opaque",b,n,o,false);k(a.__webglObjects,false,"transparent",
-b,n,o,true);i(a.__webglObjectsImmediate,"transparent",b,n,o,true)}m(this.renderPluginsPost,a,b);if(c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter)if(c instanceof THREE.WebGLRenderTargetCube){g.bindTexture(g.TEXTURE_CUBE_MAP,c.__webglTexture);g.generateMipmap(g.TEXTURE_CUBE_MAP);g.bindTexture(g.TEXTURE_CUBE_MAP,null)}else{g.bindTexture(g.TEXTURE_2D,c.__webglTexture);g.generateMipmap(g.TEXTURE_2D);g.bindTexture(g.TEXTURE_2D,null)}this.setDepthTest(true);this.setDepthWrite(true)};
+0;F.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);l=a.__webglObjects;d=0;for(e=l.length;d<e;d++){f=l[d];j=f.object;f.render=false;if(j.visible&&(!(j instanceof THREE.Mesh||j instanceof THREE.ParticleSystem)||!j.frustumCulled||dc.contains(j))){p(j,b);var r=f,q=r.object,w=r.buffer,s=void 0,s=s=void 0,s=q.material;if(s instanceof THREE.MeshFaceMaterial){s=w.materialIndex;if(s>=0){s=q.geometry.materials[s];if(s.transparent){r.transparent=
+s;r.opaque=null}else{r.opaque=s;r.transparent=null}}}else if(s)if(s.transparent){r.transparent=s;r.opaque=null}else{r.opaque=s;r.transparent=null}f.render=true;if(this.sortObjects)if(j.renderDepth)f.z=j.renderDepth;else{Oa.copy(j.matrixWorld.getPosition());Rb.multiplyVector3(Oa);f.z=Oa.z}}}this.sortObjects&&l.sort(h);l=a.__webglObjectsImmediate;d=0;for(e=l.length;d<e;d++){f=l[d];j=f.object;if(j.visible){p(j,b);j=f.object.material;if(j.transparent){f.transparent=j;f.opaque=null}else{f.opaque=j;f.transparent=
+null}}}if(a.overrideMaterial){d=a.overrideMaterial;this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst);this.setDepthTest(d.depthTest);this.setDepthWrite(d.depthWrite);u(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits);k(a.__webglObjects,false,"",b,o,n,true,d);i(a.__webglObjectsImmediate,"",b,o,n,false,d)}else{this.setBlending(THREE.NormalBlending);k(a.__webglObjects,true,"opaque",b,o,n,false);i(a.__webglObjectsImmediate,"opaque",b,o,n,false);k(a.__webglObjects,false,"transparent",
+b,o,n,true);i(a.__webglObjectsImmediate,"transparent",b,o,n,true)}m(this.renderPluginsPost,a,b);if(c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter)if(c instanceof THREE.WebGLRenderTargetCube){g.bindTexture(g.TEXTURE_CUBE_MAP,c.__webglTexture);g.generateMipmap(g.TEXTURE_CUBE_MAP);g.bindTexture(g.TEXTURE_CUBE_MAP,null)}else{g.bindTexture(g.TEXTURE_2D,c.__webglTexture);g.generateMipmap(g.TEXTURE_2D);g.bindTexture(g.TEXTURE_2D,null)}this.setDepthTest(true);this.setDepthWrite(true)};
 this.renderImmediateObject=function(a,b,c,d,e){var f=q(a,b,c,d,e);ca=-1;F.setObjectFaces(e);e.immediateRenderCallback?e.immediateRenderCallback(f,g,dc):e.render(function(a){F.renderBufferImmediate(a,f,d)})};this.initWebGLObjects=function(a){if(!a.__webglObjects){a.__webglObjects=[];a.__webglObjectsImmediate=[];a.__webglSprites=[];a.__webglFlares=[]}for(;a.__objectsAdded.length;){var h=a.__objectsAdded[0],i=a,l=void 0,k=void 0,m=void 0;if(!h.__webglInit){h.__webglInit=true;h._modelViewMatrix=new THREE.Matrix4;
-h._normalMatrix=new THREE.Matrix3;if(h instanceof THREE.Mesh){k=h.geometry;if(k instanceof THREE.Geometry){if(k.geometryGroups===void 0){var q=k,p=void 0,s=void 0,u=void 0,y=void 0,D=void 0,A=void 0,B=void 0,E={},I=q.morphTargets.length,J=q.morphNormals.length;q.geometryGroups={};p=0;for(s=q.faces.length;p<s;p++){u=q.faces[p];y=u.materialIndex;A=y!==void 0?y:-1;E[A]===void 0&&(E[A]={hash:A,counter:0});B=E[A].hash+"_"+E[A].counter;q.geometryGroups[B]===void 0&&(q.geometryGroups[B]={faces3:[],faces4:[],
-materialIndex:y,vertices:0,numMorphTargets:I,numMorphNormals:J});D=u instanceof THREE.Face3?3:4;if(q.geometryGroups[B].vertices+D>65535){E[A].counter=E[A].counter+1;B=E[A].hash+"_"+E[A].counter;q.geometryGroups[B]===void 0&&(q.geometryGroups[B]={faces3:[],faces4:[],materialIndex:y,vertices:0,numMorphTargets:I,numMorphNormals:J})}u instanceof THREE.Face3?q.geometryGroups[B].faces3.push(p):q.geometryGroups[B].faces4.push(p);q.geometryGroups[B].vertices=q.geometryGroups[B].vertices+D}q.geometryGroupsList=
-[];var L=void 0;for(L in q.geometryGroups){q.geometryGroups[L].id=oa++;q.geometryGroupsList.push(q.geometryGroups[L])}}for(l in k.geometryGroups){m=k.geometryGroups[l];if(!m.__webglVertexBuffer){var H=m;H.__webglVertexBuffer=g.createBuffer();H.__webglNormalBuffer=g.createBuffer();H.__webglTangentBuffer=g.createBuffer();H.__webglColorBuffer=g.createBuffer();H.__webglUVBuffer=g.createBuffer();H.__webglUV2Buffer=g.createBuffer();H.__webglSkinVertexABuffer=g.createBuffer();H.__webglSkinVertexBBuffer=
+h._normalMatrix=new THREE.Matrix3;if(h instanceof THREE.Mesh){k=h.geometry;if(k instanceof THREE.Geometry){if(k.geometryGroups===void 0){var p=k,q=void 0,s=void 0,u=void 0,y=void 0,D=void 0,A=void 0,B=void 0,E={},I=p.morphTargets.length,J=p.morphNormals.length;p.geometryGroups={};q=0;for(s=p.faces.length;q<s;q++){u=p.faces[q];y=u.materialIndex;A=y!==void 0?y:-1;E[A]===void 0&&(E[A]={hash:A,counter:0});B=E[A].hash+"_"+E[A].counter;p.geometryGroups[B]===void 0&&(p.geometryGroups[B]={faces3:[],faces4:[],
+materialIndex:y,vertices:0,numMorphTargets:I,numMorphNormals:J});D=u instanceof THREE.Face3?3:4;if(p.geometryGroups[B].vertices+D>65535){E[A].counter=E[A].counter+1;B=E[A].hash+"_"+E[A].counter;p.geometryGroups[B]===void 0&&(p.geometryGroups[B]={faces3:[],faces4:[],materialIndex:y,vertices:0,numMorphTargets:I,numMorphNormals:J})}u instanceof THREE.Face3?p.geometryGroups[B].faces3.push(q):p.geometryGroups[B].faces4.push(q);p.geometryGroups[B].vertices=p.geometryGroups[B].vertices+D}p.geometryGroupsList=
+[];var L=void 0;for(L in p.geometryGroups){p.geometryGroups[L].id=oa++;p.geometryGroupsList.push(p.geometryGroups[L])}}for(l in k.geometryGroups){m=k.geometryGroups[l];if(!m.__webglVertexBuffer){var H=m;H.__webglVertexBuffer=g.createBuffer();H.__webglNormalBuffer=g.createBuffer();H.__webglTangentBuffer=g.createBuffer();H.__webglColorBuffer=g.createBuffer();H.__webglUVBuffer=g.createBuffer();H.__webglUV2Buffer=g.createBuffer();H.__webglSkinVertexABuffer=g.createBuffer();H.__webglSkinVertexBBuffer=
 g.createBuffer();H.__webglSkinIndicesBuffer=g.createBuffer();H.__webglSkinWeightsBuffer=g.createBuffer();H.__webglFaceBuffer=g.createBuffer();H.__webglLineBuffer=g.createBuffer();var M=void 0,Q=void 0;if(H.numMorphTargets){H.__webglMorphTargetsBuffers=[];M=0;for(Q=H.numMorphTargets;M<Q;M++)H.__webglMorphTargetsBuffers.push(g.createBuffer())}if(H.numMorphNormals){H.__webglMorphNormalsBuffers=[];M=0;for(Q=H.numMorphNormals;M<Q;M++)H.__webglMorphNormalsBuffers.push(g.createBuffer())}F.info.memory.geometries++;
 var G=m,S=h,R=S.geometry,T=G.faces3,Z=G.faces4,W=T.length*3+Z.length*4,ca=T.length*1+Z.length*2,na=T.length*3+Z.length*4,ga=c(S,G),za=f(ga),Ba=d(ga),Ha=ga.vertexColors?ga.vertexColors:false;G.__vertexArray=new Float32Array(W*3);if(Ba)G.__normalArray=new Float32Array(W*3);if(R.hasTangents)G.__tangentArray=new Float32Array(W*4);if(Ha)G.__colorArray=new Float32Array(W*3);if(za){if(R.faceUvs.length>0||R.faceVertexUvs.length>0)G.__uvArray=new Float32Array(W*2);if(R.faceUvs.length>1||R.faceVertexUvs.length>
 1)G.__uv2Array=new Float32Array(W*2)}if(S.geometry.skinWeights.length&&S.geometry.skinIndices.length){G.__skinVertexAArray=new Float32Array(W*4);G.__skinVertexBArray=new Float32Array(W*4);G.__skinIndexArray=new Float32Array(W*4);G.__skinWeightArray=new Float32Array(W*4)}G.__faceArray=new Uint16Array(ca*3);G.__lineArray=new Uint16Array(na*2);var Ca=void 0,Ia=void 0;if(G.numMorphTargets){G.__morphTargetsArrays=[];Ca=0;for(Ia=G.numMorphTargets;Ca<Ia;Ca++)G.__morphTargetsArrays.push(new Float32Array(W*
@@ -378,16 +379,16 @@ Fb.__webglColorBuffer);g.bufferData(g.ARRAY_BUFFER,Ec,Vc)}}Y.verticesNeedUpdate=
 fa=void 0;if(tb.verticesNeedUpdate){for(qc=0;qc<hd;qc++){Fc=Yc[qc];ma=qc*3;Hc[ma]=Fc.x;Hc[ma+1]=Fc.y;Hc[ma+2]=Fc.z}g.bindBuffer(g.ARRAY_BUFFER,tb.__webglVertexBuffer);g.bufferData(g.ARRAY_BUFFER,Hc,Sc)}if(jd){for(rc=0;rc<id;rc++){Gc=Zc[rc];ma=rc*3;Ic[ma]=Gc.r;Ic[ma+1]=Gc.g;Ic[ma+2]=Gc.b}g.bindBuffer(g.ARRAY_BUFFER,tb.__webglColorBuffer);g.bufferData(g.ARRAY_BUFFER,Ic,Sc)}if(Tc){Jc=0;for($c=Tc.length;Jc<$c;Jc++){fa=Tc[Jc];if(fa.needsUpdate&&(fa.boundTo===void 0||fa.boundTo==="vertices")){ma=0;Zb=fa.value.length;
 if(fa.size===1)for(ya=0;ya<Zb;ya++)fa.array[ya]=fa.value[ya];else if(fa.size===2)for(ya=0;ya<Zb;ya++){Ga=fa.value[ya];fa.array[ma]=Ga.x;fa.array[ma+1]=Ga.y;ma=ma+2}else if(fa.size===3)if(fa.type==="c")for(ya=0;ya<Zb;ya++){Ga=fa.value[ya];fa.array[ma]=Ga.r;fa.array[ma+1]=Ga.g;fa.array[ma+2]=Ga.b;ma=ma+3}else for(ya=0;ya<Zb;ya++){Ga=fa.value[ya];fa.array[ma]=Ga.x;fa.array[ma+1]=Ga.y;fa.array[ma+2]=Ga.z;ma=ma+3}else if(fa.size===4)for(ya=0;ya<Zb;ya++){Ga=fa.value[ya];fa.array[ma]=Ga.x;fa.array[ma+1]=
 Ga.y;fa.array[ma+2]=Ga.z;fa.array[ma+3]=Ga.w;ma=ma+4}g.bindBuffer(g.ARRAY_BUFFER,fa.buffer);g.bufferData(g.ARRAY_BUFFER,fa.array,Sc)}}}}Y.verticesNeedUpdate=false;Y.colorsNeedUpdate=false;Fa.attributes&&w(Fa)}else if(Va instanceof THREE.ParticleSystem){Fa=c(Va,gc);Tb=Fa.attributes&&j(Fa);(Y.verticesNeedUpdate||Y.colorsNeedUpdate||Va.sortParticles||Tb)&&e(Y,g.DYNAMIC_DRAW,Va);Y.verticesNeedUpdate=false;Y.colorsNeedUpdate=false;Fa.attributes&&w(Fa)}}};this.initMaterial=function(a,b,c,d){var e,f,h;a instanceof
-THREE.MeshDepthMaterial?h="depth":a instanceof THREE.MeshNormalMaterial?h="normal":a instanceof THREE.MeshBasicMaterial?h="basic":a instanceof THREE.MeshLambertMaterial?h="lambert":a instanceof THREE.MeshPhongMaterial?h="phong":a instanceof THREE.LineBasicMaterial?h="basic":a instanceof THREE.ParticleBasicMaterial&&(h="particle_basic");if(h){var i=THREE.ShaderLib[h];a.uniforms=THREE.UniformsUtils.clone(i.uniforms);a.vertexShader=i.vertexShader;a.fragmentShader=i.fragmentShader}var j,k,l,m,n;j=m=n=
-i=0;for(k=b.length;j<k;j++){l=b[j];if(!l.onlyShadow){l instanceof THREE.DirectionalLight&&m++;l instanceof THREE.PointLight&&n++;l instanceof THREE.SpotLight&&i++}}if(n+i+m<=Z){k=m;l=n;m=i}else{k=Math.ceil(Z*m/(n+m));m=l=Z-k}var o=0,i=0;for(n=b.length;i<n;i++){j=b[i];if(j.castShadow){j instanceof THREE.SpotLight&&o++;j instanceof THREE.DirectionalLight&&!j.shadowCascade&&o++}}var q=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)q=d.bones.length;var p;a:{j=a.fragmentShader;n=a.vertexShader;var i=
-a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,maxBones:q,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:k,maxPointLights:l,maxSpotLights:m,maxShadows:o,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapDebug:this.shadowMapDebug,
-shadowMapCascade:this.shadowMapCascade,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:d&&d.doubleSided},r,d=[];if(h)d.push(h);else{d.push(j);d.push(n)}for(r in c){d.push(r);d.push(c[r])}h=d.join();r=0;for(d=W.length;r<d;r++){k=W[r];if(k.code===h){k.usedTimes++;p=k.program;break a}}r=g.createProgram();d=["precision "+E+" float;",ec>0?"#define VERTEX_TEXTURES":"",F.gammaInput?"#define GAMMA_INPUT":"",F.gammaOutput?"#define GAMMA_OUTPUT":"",F.physicallyBasedShading?
+THREE.MeshDepthMaterial?h="depth":a instanceof THREE.MeshNormalMaterial?h="normal":a instanceof THREE.MeshBasicMaterial?h="basic":a instanceof THREE.MeshLambertMaterial?h="lambert":a instanceof THREE.MeshPhongMaterial?h="phong":a instanceof THREE.LineBasicMaterial?h="basic":a instanceof THREE.ParticleBasicMaterial&&(h="particle_basic");if(h){var i=THREE.ShaderLib[h];a.uniforms=THREE.UniformsUtils.clone(i.uniforms);a.vertexShader=i.vertexShader;a.fragmentShader=i.fragmentShader}var j,k,l,m,o;j=m=o=
+i=0;for(k=b.length;j<k;j++){l=b[j];if(!l.onlyShadow){l instanceof THREE.DirectionalLight&&m++;l instanceof THREE.PointLight&&o++;l instanceof THREE.SpotLight&&i++}}if(o+i+m<=Z){k=m;l=o;m=i}else{k=Math.ceil(Z*m/(o+m));m=l=Z-k}var n=0,i=0;for(o=b.length;i<o;i++){j=b[i];if(j.castShadow){j instanceof THREE.SpotLight&&n++;j instanceof THREE.DirectionalLight&&!j.shadowCascade&&n++}}var r=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)r=d.bones.length;var p;a:{j=a.fragmentShader;o=a.vertexShader;var i=
+a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,maxBones:r,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:k,maxPointLights:l,maxSpotLights:m,maxShadows:n,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapDebug:this.shadowMapDebug,
+shadowMapCascade:this.shadowMapCascade,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:d&&d.doubleSided},q,d=[];if(h)d.push(h);else{d.push(j);d.push(o)}for(q in c){d.push(q);d.push(c[q])}h=d.join();q=0;for(d=W.length;q<d;q++){k=W[q];if(k.code===h){k.usedTimes++;p=k.program;break a}}q=g.createProgram();d=["precision "+E+" float;",ec>0?"#define VERTEX_TEXTURES":"",F.gammaInput?"#define GAMMA_INPUT":"",F.gammaOutput?"#define GAMMA_OUTPUT":"",F.physicallyBasedShading?
 "#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.morphNormals?"#define USE_MORPHNORMALS":"",c.perPixel?
 "#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
 k=["precision "+E+" float;","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",F.gammaInput?"#define GAMMA_INPUT":"",F.gammaOutput?"#define GAMMA_OUTPUT":"",F.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":
 "",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");
-j=B("fragment",k+j);d=B("vertex",d+n);g.attachShader(r,d);g.attachShader(r,j);g.linkProgram(r);g.getProgramParameter(r,g.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+g.getProgramParameter(r,g.VALIDATE_STATUS)+", gl error ["+g.getError()+"]");g.deleteShader(j);g.deleteShader(d);r.uniforms={};r.attributes={};var s,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","boneGlobalMatrices","morphTargetInfluences"];for(s in i)d.push(s);
-s=d;d=0;for(i=s.length;d<i;d++){n=s[d];r.uniforms[n]=g.getUniformLocation(r,n)}d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(s=0;s<c.maxMorphTargets;s++)d.push("morphTarget"+s);for(s=0;s<c.maxMorphNormals;s++)d.push("morphNormal"+s);for(p in b)d.push(p);p=d;s=0;for(b=p.length;s<b;s++){c=p[s];r.attributes[c]=g.getAttribLocation(r,c)}r.id=I++;W.push({program:r,code:h,usedTimes:1});F.info.memory.programs=W.length;p=r}a.program=p;p=a.program.attributes;
+j=B("fragment",k+j);d=B("vertex",d+o);g.attachShader(q,d);g.attachShader(q,j);g.linkProgram(q);g.getProgramParameter(q,g.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+g.getProgramParameter(q,g.VALIDATE_STATUS)+", gl error ["+g.getError()+"]");g.deleteShader(j);g.deleteShader(d);q.uniforms={};q.attributes={};var s,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","boneGlobalMatrices","morphTargetInfluences"];for(s in i)d.push(s);
+s=d;d=0;for(i=s.length;d<i;d++){o=s[d];q.uniforms[o]=g.getUniformLocation(q,o)}d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(s=0;s<c.maxMorphTargets;s++)d.push("morphTarget"+s);for(s=0;s<c.maxMorphNormals;s++)d.push("morphNormal"+s);for(p in b)d.push(p);p=d;s=0;for(b=p.length;s<b;s++){c=p[s];q.attributes[c]=g.getAttribLocation(q,c)}q.id=I++;W.push({program:q,code:h,usedTimes:1});F.info.memory.programs=W.length;p=q}a.program=p;p=a.program.attributes;
 p.position>=0&&g.enableVertexAttribArray(p.position);p.color>=0&&g.enableVertexAttribArray(p.color);p.normal>=0&&g.enableVertexAttribArray(p.normal);p.tangent>=0&&g.enableVertexAttribArray(p.tangent);if(a.skinning&&p.skinVertexA>=0&&p.skinVertexB>=0&&p.skinIndex>=0&&p.skinWeight>=0){g.enableVertexAttribArray(p.skinVertexA);g.enableVertexAttribArray(p.skinVertexB);g.enableVertexAttribArray(p.skinIndex);g.enableVertexAttribArray(p.skinWeight)}if(a.attributes)for(f in a.attributes)p[f]!==void 0&&p[f]>=
 0&&g.enableVertexAttribArray(p[f]);if(a.morphTargets){a.numSupportedMorphTargets=0;b="morphTarget";for(f=0;f<this.maxMorphTargets;f++){s=b+f;if(p[s]>=0){g.enableVertexAttribArray(p[s]);a.numSupportedMorphTargets++}}}if(a.morphNormals){a.numSupportedMorphNormals=0;b="morphNormal";for(f=0;f<this.maxMorphNormals;f++){s=b+f;if(p[s]>=0){g.enableVertexAttribArray(p[s]);a.numSupportedMorphNormals++}}}a.uniformsList=[];for(e in a.uniforms)a.uniformsList.push([a.uniforms[e],e])};this.setFaceCulling=function(a,
 b){if(a){!b||b==="ccw"?g.frontFace(g.CCW):g.frontFace(g.CW);a==="back"?g.cullFace(g.BACK):a==="front"?g.cullFace(g.FRONT):g.cullFace(g.FRONT_AND_BACK);g.enable(g.CULL_FACE)}else g.disable(g.CULL_FACE)};this.setObjectFaces=function(a){if(Ba!==a.doubleSided){a.doubleSided?g.disable(g.CULL_FACE):g.enable(g.CULL_FACE);Ba=a.doubleSided}if(Ha!==a.flipSided){a.flipSided?g.frontFace(g.CW):g.frontFace(g.CCW);Ha=a.flipSided}};this.setDepthTest=function(a){if(Xa!==a){a?g.enable(g.DEPTH_TEST):g.disable(g.DEPTH_TEST);
@@ -395,8 +396,8 @@ Xa=a}};this.setDepthWrite=function(a){if(nb!==a){g.depthMask(a);nb=a}};this.setB
 g.SRC_COLOR);break;case THREE.CustomBlending:g.enable(g.BLEND);break;default:g.enable(g.BLEND);g.blendEquationSeparate(g.FUNC_ADD,g.FUNC_ADD);g.blendFuncSeparate(g.SRC_ALPHA,g.ONE_MINUS_SRC_ALPHA,g.ONE,g.ONE_MINUS_SRC_ALPHA)}Ia=a}if(a===THREE.CustomBlending){if(b!==Sa){g.blendEquation(D(b));Sa=b}if(c!==Ua||d!==Na){g.blendFunc(D(c),D(d));Ua=c;Na=d}}else Na=Ua=Sa=null};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit){a.__webglInit=true;a.__webglTexture=g.createTexture();F.info.memory.textures++}g.activeTexture(g.TEXTURE0+
 b);g.bindTexture(g.TEXTURE_2D,a.__webglTexture);g.pixelStorei(g.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);var c=a.image,d=(c.width&c.width-1)===0&&(c.height&c.height-1)===0,e=D(a.format),f=D(a.type);A(g.TEXTURE_2D,a,d);a instanceof THREE.DataTexture?g.texImage2D(g.TEXTURE_2D,0,e,c.width,c.height,0,e,f,c.data):g.texImage2D(g.TEXTURE_2D,0,e,e,f,a.image);a.generateMipmaps&&d&&g.generateMipmap(g.TEXTURE_2D);a.needsUpdate=false;if(a.onUpdate)a.onUpdate()}else{g.activeTexture(g.TEXTURE0+b);g.bindTexture(g.TEXTURE_2D,
 a.__webglTexture)}};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=true;if(a.stencilBuffer===void 0)a.stencilBuffer=true;a.__webglTexture=g.createTexture();var c=(a.width&a.width-1)===0&&(a.height&a.height-1)===0,d=D(a.format),e=D(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];g.bindTexture(g.TEXTURE_CUBE_MAP,a.__webglTexture);A(g.TEXTURE_CUBE_MAP,a,c);for(var f=0;f<6;f++){a.__webglFramebuffer[f]=
-g.createFramebuffer();a.__webglRenderbuffer[f]=g.createRenderbuffer();g.texImage2D(g.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var h=a,i=g.TEXTURE_CUBE_MAP_POSITIVE_X+f;g.bindFramebuffer(g.FRAMEBUFFER,a.__webglFramebuffer[f]);g.framebufferTexture2D(g.FRAMEBUFFER,g.COLOR_ATTACHMENT0,i,h.__webglTexture,0);u(a.__webglRenderbuffer[f],a)}c&&g.generateMipmap(g.TEXTURE_CUBE_MAP)}else{a.__webglFramebuffer=g.createFramebuffer();a.__webglRenderbuffer=g.createRenderbuffer();g.bindTexture(g.TEXTURE_2D,
-a.__webglTexture);A(g.TEXTURE_2D,a,c);g.texImage2D(g.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null);d=g.TEXTURE_2D;g.bindFramebuffer(g.FRAMEBUFFER,a.__webglFramebuffer);g.framebufferTexture2D(g.FRAMEBUFFER,g.COLOR_ATTACHMENT0,d,a.__webglTexture,0);u(a.__webglRenderbuffer,a);c&&g.generateMipmap(g.TEXTURE_2D)}b?g.bindTexture(g.TEXTURE_CUBE_MAP,null):g.bindTexture(g.TEXTURE_2D,null);g.bindRenderbuffer(g.RENDERBUFFER,null);g.bindFramebuffer(g.FRAMEBUFFER,null)}if(a){b=b?a.__webglFramebuffer[a.activeCubeFace]:
+g.createFramebuffer();a.__webglRenderbuffer[f]=g.createRenderbuffer();g.texImage2D(g.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var h=a,i=g.TEXTURE_CUBE_MAP_POSITIVE_X+f;g.bindFramebuffer(g.FRAMEBUFFER,a.__webglFramebuffer[f]);g.framebufferTexture2D(g.FRAMEBUFFER,g.COLOR_ATTACHMENT0,i,h.__webglTexture,0);s(a.__webglRenderbuffer[f],a)}c&&g.generateMipmap(g.TEXTURE_CUBE_MAP)}else{a.__webglFramebuffer=g.createFramebuffer();a.__webglRenderbuffer=g.createRenderbuffer();g.bindTexture(g.TEXTURE_2D,
+a.__webglTexture);A(g.TEXTURE_2D,a,c);g.texImage2D(g.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null);d=g.TEXTURE_2D;g.bindFramebuffer(g.FRAMEBUFFER,a.__webglFramebuffer);g.framebufferTexture2D(g.FRAMEBUFFER,g.COLOR_ATTACHMENT0,d,a.__webglTexture,0);s(a.__webglRenderbuffer,a);c&&g.generateMipmap(g.TEXTURE_2D)}b?g.bindTexture(g.TEXTURE_CUBE_MAP,null):g.bindTexture(g.TEXTURE_2D,null);g.bindRenderbuffer(g.RENDERBUFFER,null);g.bindFramebuffer(g.FRAMEBUFFER,null)}if(a){b=b?a.__webglFramebuffer[a.activeCubeFace]:
 a.__webglFramebuffer;c=a.width;a=a.height;e=d=0}else{b=null;c=Jb;a=Kb;d=Ib;e=cc}if(b!==H){g.bindFramebuffer(g.FRAMEBUFFER,b);g.viewport(d,e,c,a);H=b}$b=c;ac=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};
 THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=c.wrapS!==void 0?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==void 0?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==void 0?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==void 0?c.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=c.format!==void 0?c.format:THREE.RGBAFormat;this.type=c.type!==void 0?c.type:
 THREE.UnsignedByteType;this.depthBuffer=c.depthBuffer!==void 0?c.depthBuffer:true;this.stencilBuffer=c.stencilBuffer!==void 0?c.stencilBuffer:true;this.generateMipmaps=true};
@@ -422,29 +423,29 @@ THREE.LensFlarePlugin=function(){function a(a){var c=b.createProgram(),d=b.creat
 0;d[r++]=1;d[r++]=1;d[r++]=1;d[r++]=1;d[r++]=-1;d[r++]=1;d[r++]=0;d[r++]=1;r=0;f[r++]=0;f[r++]=1;f[r++]=2;f[r++]=0;f[r++]=2;f[r++]=3;e=b.createBuffer();h=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,e);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);l=b.createTexture();m=b.createTexture();b.bindTexture(b.TEXTURE_2D,l);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,
 b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.bindTexture(b.TEXTURE_2D,m);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);
 b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);if(b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0){k=false;i=a(THREE.ShaderFlares.lensFlare)}else{k=true;i=a(THREE.ShaderFlares.lensFlareVertexTexture)}o={};j={};o.vertex=b.getAttribLocation(i,"position");o.uv=b.getAttribLocation(i,"uv");j.renderType=b.getUniformLocation(i,"renderType");j.map=b.getUniformLocation(i,"map");j.occlusionMap=b.getUniformLocation(i,"occlusionMap");j.opacity=b.getUniformLocation(i,"opacity");j.color=b.getUniformLocation(i,
-"color");j.scale=b.getUniformLocation(i,"scale");j.rotation=b.getUniformLocation(i,"rotation");j.screenPosition=b.getUniformLocation(i,"screenPosition");w=false};this.render=function(a,d,f,p){var a=a.__webglFlares,s=a.length;if(s){var B=new THREE.Vector3,A=p/f,u=f*0.5,J=p*0.5,D=16/p,M=new THREE.Vector2(D*A,D),E=new THREE.Vector3(1,1,0),Q=new THREE.Vector2(1,1),G=j,D=o;b.useProgram(i);if(!w){b.enableVertexAttribArray(o.vertex);b.enableVertexAttribArray(o.uv);w=true}b.uniform1i(G.occlusionMap,0);b.uniform1i(G.map,
-1);b.bindBuffer(b.ARRAY_BUFFER,e);b.vertexAttribPointer(D.vertex,2,b.FLOAT,false,16,0);b.vertexAttribPointer(D.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.disable(b.CULL_FACE);b.depthMask(false);var R,T,S,y,L;for(R=0;R<s;R++){D=16/p;M.set(D*A,D);y=a[R];B.set(y.matrixWorld.elements[12],y.matrixWorld.elements[13],y.matrixWorld.elements[14]);d.matrixWorldInverse.multiplyVector3(B);d.projectionMatrix.multiplyVector3(B);E.copy(B);Q.x=E.x*u+u;Q.y=E.y*J+J;if(k||Q.x>0&&Q.x<f&&Q.y>0&&
+"color");j.scale=b.getUniformLocation(i,"scale");j.rotation=b.getUniformLocation(i,"rotation");j.screenPosition=b.getUniformLocation(i,"screenPosition");w=false};this.render=function(a,d,f,p){var a=a.__webglFlares,u=a.length;if(u){var B=new THREE.Vector3,A=p/f,s=f*0.5,J=p*0.5,D=16/p,M=new THREE.Vector2(D*A,D),E=new THREE.Vector3(1,1,0),Q=new THREE.Vector2(1,1),G=j,D=o;b.useProgram(i);if(!w){b.enableVertexAttribArray(o.vertex);b.enableVertexAttribArray(o.uv);w=true}b.uniform1i(G.occlusionMap,0);b.uniform1i(G.map,
+1);b.bindBuffer(b.ARRAY_BUFFER,e);b.vertexAttribPointer(D.vertex,2,b.FLOAT,false,16,0);b.vertexAttribPointer(D.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.disable(b.CULL_FACE);b.depthMask(false);var R,T,S,y,L;for(R=0;R<u;R++){D=16/p;M.set(D*A,D);y=a[R];B.set(y.matrixWorld.elements[12],y.matrixWorld.elements[13],y.matrixWorld.elements[14]);d.matrixWorldInverse.multiplyVector3(B);d.projectionMatrix.multiplyVector3(B);E.copy(B);Q.x=E.x*s+s;Q.y=E.y*J+J;if(k||Q.x>0&&Q.x<f&&Q.y>0&&
 Q.y<p){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,l);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,Q.x-8,Q.y-8,16,16,0);b.uniform1i(G.renderType,0);b.uniform2f(G.scale,M.x,M.y);b.uniform3f(G.screenPosition,E.x,E.y,E.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,m);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,Q.x-8,Q.y-8,16,16,0);b.uniform1i(G.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);
 b.bindTexture(b.TEXTURE_2D,l);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);y.positionScreen.copy(E);y.customUpdateCallback?y.customUpdateCallback(y):y.updateLensFlares();b.uniform1i(G.renderType,2);b.enable(b.BLEND);T=0;for(S=y.lensFlares.length;T<S;T++){L=y.lensFlares[T];if(L.opacity>0.0010&&L.scale>0.0010){E.x=L.x;E.y=L.y;E.z=L.z;D=L.size*L.scale/p;M.x=D*A;M.y=D;b.uniform3f(G.screenPosition,E.x,E.y,E.z);b.uniform2f(G.scale,M.x,M.y);b.uniform1f(G.rotation,L.rotation);b.uniform1f(G.opacity,L.opacity);
 b.uniform3f(G.color,L.color.r,L.color.g,L.color.b);c.setBlending(L.blending,L.blendEquation,L.blendSrc,L.blendDst);c.setTexture(L.texture,1);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}}}}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(true)}}};
 THREE.ShadowMapPlugin=function(){var a,b,c,d,f=new THREE.Frustum,e=new THREE.Matrix4,h=new THREE.Vector3,l=new THREE.Vector3;this.init=function(e){a=e.context;b=e;var e=THREE.ShaderLib.depthRGBA,f=THREE.UniformsUtils.clone(e.uniforms);c=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f});d=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f,morphTargets:true});c._shadowPass=true;d._shadowPass=true};this.render=
-function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(m,k){var i,o,j,w,r,n,q,p,s,B=[];w=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);a.enable(a.CULL_FACE);b.shadowMapCullFrontFaces?a.cullFace(a.FRONT):a.cullFace(a.BACK);b.setDepthTest(true);i=0;for(o=m.__lights.length;i<o;i++){j=m.__lights[i];if(j.castShadow)if(j instanceof THREE.DirectionalLight&&j.shadowCascade)for(r=0;r<j.shadowCascadeCount;r++){var A;if(j.shadowCascadeArray[r])A=j.shadowCascadeArray[r];
-else{s=j;q=r;A=new THREE.DirectionalLight;A.isVirtual=true;A.onlyShadow=true;A.castShadow=true;A.shadowCameraNear=s.shadowCameraNear;A.shadowCameraFar=s.shadowCameraFar;A.shadowCameraLeft=s.shadowCameraLeft;A.shadowCameraRight=s.shadowCameraRight;A.shadowCameraBottom=s.shadowCameraBottom;A.shadowCameraTop=s.shadowCameraTop;A.shadowCameraVisible=s.shadowCameraVisible;A.shadowDarkness=s.shadowDarkness;A.shadowBias=s.shadowCascadeBias[q];A.shadowMapWidth=s.shadowCascadeWidth[q];A.shadowMapHeight=s.shadowCascadeHeight[q];
-A.pointsWorld=[];A.pointsFrustum=[];p=A.pointsWorld;n=A.pointsFrustum;for(var u=0;u<8;u++){p[u]=new THREE.Vector3;n[u]=new THREE.Vector3}p=s.shadowCascadeNearZ[q];s=s.shadowCascadeFarZ[q];n[0].set(-1,-1,p);n[1].set(1,-1,p);n[2].set(-1,1,p);n[3].set(1,1,p);n[4].set(-1,-1,s);n[5].set(1,-1,s);n[6].set(-1,1,s);n[7].set(1,1,s);A.originalCamera=k;n=new THREE.Gyroscope;n.position=j.shadowCascadeOffset;n.add(A);n.add(A.target);k.add(n);j.shadowCascadeArray[r]=A;console.log("Created virtualLight",A)}q=j;p=
-r;s=q.shadowCascadeArray[p];s.position.copy(q.position);s.target.position.copy(q.target.position);s.lookAt(s.target);s.shadowCameraVisible=q.shadowCameraVisible;s.shadowDarkness=q.shadowDarkness;s.shadowBias=q.shadowCascadeBias[p];n=q.shadowCascadeNearZ[p];q=q.shadowCascadeFarZ[p];s=s.pointsFrustum;s[0].z=n;s[1].z=n;s[2].z=n;s[3].z=n;s[4].z=q;s[5].z=q;s[6].z=q;s[7].z=q;B[w]=A;w++}else{B[w]=j;w++}}i=0;for(o=B.length;i<o;i++){j=B[i];if(!j.shadowMap){j.shadowMap=new THREE.WebGLRenderTarget(j.shadowMapWidth,
+function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(m,k){var i,o,j,w,r,n,q,p,u,B=[];w=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);a.enable(a.CULL_FACE);b.shadowMapCullFrontFaces?a.cullFace(a.FRONT):a.cullFace(a.BACK);b.setDepthTest(true);i=0;for(o=m.__lights.length;i<o;i++){j=m.__lights[i];if(j.castShadow)if(j instanceof THREE.DirectionalLight&&j.shadowCascade)for(r=0;r<j.shadowCascadeCount;r++){var A;if(j.shadowCascadeArray[r])A=j.shadowCascadeArray[r];
+else{u=j;q=r;A=new THREE.DirectionalLight;A.isVirtual=true;A.onlyShadow=true;A.castShadow=true;A.shadowCameraNear=u.shadowCameraNear;A.shadowCameraFar=u.shadowCameraFar;A.shadowCameraLeft=u.shadowCameraLeft;A.shadowCameraRight=u.shadowCameraRight;A.shadowCameraBottom=u.shadowCameraBottom;A.shadowCameraTop=u.shadowCameraTop;A.shadowCameraVisible=u.shadowCameraVisible;A.shadowDarkness=u.shadowDarkness;A.shadowBias=u.shadowCascadeBias[q];A.shadowMapWidth=u.shadowCascadeWidth[q];A.shadowMapHeight=u.shadowCascadeHeight[q];
+A.pointsWorld=[];A.pointsFrustum=[];p=A.pointsWorld;n=A.pointsFrustum;for(var s=0;s<8;s++){p[s]=new THREE.Vector3;n[s]=new THREE.Vector3}p=u.shadowCascadeNearZ[q];u=u.shadowCascadeFarZ[q];n[0].set(-1,-1,p);n[1].set(1,-1,p);n[2].set(-1,1,p);n[3].set(1,1,p);n[4].set(-1,-1,u);n[5].set(1,-1,u);n[6].set(-1,1,u);n[7].set(1,1,u);A.originalCamera=k;n=new THREE.Gyroscope;n.position=j.shadowCascadeOffset;n.add(A);n.add(A.target);k.add(n);j.shadowCascadeArray[r]=A;console.log("Created virtualLight",A)}q=j;p=
+r;u=q.shadowCascadeArray[p];u.position.copy(q.position);u.target.position.copy(q.target.position);u.lookAt(u.target);u.shadowCameraVisible=q.shadowCameraVisible;u.shadowDarkness=q.shadowDarkness;u.shadowBias=q.shadowCascadeBias[p];n=q.shadowCascadeNearZ[p];q=q.shadowCascadeFarZ[p];u=u.pointsFrustum;u[0].z=n;u[1].z=n;u[2].z=n;u[3].z=n;u[4].z=q;u[5].z=q;u[6].z=q;u[7].z=q;B[w]=A;w++}else{B[w]=j;w++}}i=0;for(o=B.length;i<o;i++){j=B[i];if(!j.shadowMap){j.shadowMap=new THREE.WebGLRenderTarget(j.shadowMapWidth,
 j.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat});j.shadowMapSize=new THREE.Vector2(j.shadowMapWidth,j.shadowMapHeight);j.shadowMatrix=new THREE.Matrix4}if(!j.shadowCamera){if(j instanceof THREE.SpotLight)j.shadowCamera=new THREE.PerspectiveCamera(j.shadowCameraFov,j.shadowMapWidth/j.shadowMapHeight,j.shadowCameraNear,j.shadowCameraFar);else if(j instanceof THREE.DirectionalLight)j.shadowCamera=new THREE.OrthographicCamera(j.shadowCameraLeft,j.shadowCameraRight,
-j.shadowCameraTop,j.shadowCameraBottom,j.shadowCameraNear,j.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}m.add(j.shadowCamera);b.autoUpdateScene&&m.updateMatrixWorld()}if(j.shadowCameraVisible&&!j.cameraHelper){j.cameraHelper=new THREE.CameraHelper(j.shadowCamera);j.shadowCamera.add(j.cameraHelper)}if(j.isVirtual&&A.originalCamera==k){r=k;w=j.shadowCamera;n=j.pointsFrustum;s=j.pointsWorld;h.set(Infinity,Infinity,Infinity);l.set(-Infinity,-Infinity,-Infinity);for(q=
-0;q<8;q++){p=s[q];p.copy(n[q]);THREE.ShadowMapPlugin.__projector.unprojectVector(p,r);w.matrixWorldInverse.multiplyVector3(p);if(p.x<h.x)h.x=p.x;if(p.x>l.x)l.x=p.x;if(p.y<h.y)h.y=p.y;if(p.y>l.y)l.y=p.y;if(p.z<h.z)h.z=p.z;if(p.z>l.z)l.z=p.z}w.left=h.x;w.right=l.x;w.top=l.y;w.bottom=h.y;w.updateProjectionMatrix()}w=j.shadowMap;n=j.shadowMatrix;r=j.shadowCamera;r.position.copy(j.matrixWorld.getPosition());r.lookAt(j.target.matrixWorld.getPosition());r.updateMatrixWorld();r.matrixWorldInverse.getInverse(r.matrixWorld);
+j.shadowCameraTop,j.shadowCameraBottom,j.shadowCameraNear,j.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}m.add(j.shadowCamera);b.autoUpdateScene&&m.updateMatrixWorld()}if(j.shadowCameraVisible&&!j.cameraHelper){j.cameraHelper=new THREE.CameraHelper(j.shadowCamera);j.shadowCamera.add(j.cameraHelper)}if(j.isVirtual&&A.originalCamera==k){r=k;w=j.shadowCamera;n=j.pointsFrustum;u=j.pointsWorld;h.set(Infinity,Infinity,Infinity);l.set(-Infinity,-Infinity,-Infinity);for(q=
+0;q<8;q++){p=u[q];p.copy(n[q]);THREE.ShadowMapPlugin.__projector.unprojectVector(p,r);w.matrixWorldInverse.multiplyVector3(p);if(p.x<h.x)h.x=p.x;if(p.x>l.x)l.x=p.x;if(p.y<h.y)h.y=p.y;if(p.y>l.y)l.y=p.y;if(p.z<h.z)h.z=p.z;if(p.z>l.z)l.z=p.z}w.left=h.x;w.right=l.x;w.top=l.y;w.bottom=h.y;w.updateProjectionMatrix()}w=j.shadowMap;n=j.shadowMatrix;r=j.shadowCamera;r.position.copy(j.matrixWorld.getPosition());r.lookAt(j.target.matrixWorld.getPosition());r.updateMatrixWorld();r.matrixWorldInverse.getInverse(r.matrixWorld);
 if(j.cameraHelper)j.cameraHelper.lines.visible=j.shadowCameraVisible;j.shadowCameraVisible&&j.cameraHelper.update();n.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);n.multiplySelf(r.projectionMatrix);n.multiplySelf(r.matrixWorldInverse);if(!r._viewMatrixArray)r._viewMatrixArray=new Float32Array(16);if(!r._projectionMatrixArray)r._projectionMatrixArray=new Float32Array(16);r.matrixWorldInverse.flattenToArray(r._viewMatrixArray);r.projectionMatrix.flattenToArray(r._projectionMatrixArray);e.multiply(r.projectionMatrix,
-r.matrixWorldInverse);f.setFromMatrix(e);b.setRenderTarget(w);b.clear();s=m.__webglObjects;j=0;for(w=s.length;j<w;j++){q=s[j];n=q.object;q.render=false;if(n.visible&&n.castShadow&&(!(n instanceof THREE.Mesh)||!n.frustumCulled||f.contains(n))){n._modelViewMatrix.multiply(r.matrixWorldInverse,n.matrixWorld);q.render=true}}j=0;for(w=s.length;j<w;j++){q=s[j];if(q.render){n=q.object;q=q.buffer;p=n.customDepthMaterial?n.customDepthMaterial:n.geometry.morphTargets.length?d:c;q instanceof THREE.BufferGeometry?
-b.renderBufferDirect(r,m.__lights,null,p,q,n):b.renderBuffer(r,m.__lights,null,p,q,n)}}s=m.__webglObjectsImmediate;j=0;for(w=s.length;j<w;j++){q=s[j];n=q.object;if(n.visible&&n.castShadow){n._modelViewMatrix.multiply(r.matrixWorldInverse,n.matrixWorld);b.renderImmediateObject(r,m.__lights,null,c,n)}}}i=b.getClearColor();o=b.getClearAlpha();a.clearColor(i.r,i.g,i.b,o);a.enable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;
+r.matrixWorldInverse);f.setFromMatrix(e);b.setRenderTarget(w);b.clear();u=m.__webglObjects;j=0;for(w=u.length;j<w;j++){q=u[j];n=q.object;q.render=false;if(n.visible&&n.castShadow&&(!(n instanceof THREE.Mesh)||!n.frustumCulled||f.contains(n))){n._modelViewMatrix.multiply(r.matrixWorldInverse,n.matrixWorld);q.render=true}}j=0;for(w=u.length;j<w;j++){q=u[j];if(q.render){n=q.object;q=q.buffer;p=n.customDepthMaterial?n.customDepthMaterial:n.geometry.morphTargets.length?d:c;q instanceof THREE.BufferGeometry?
+b.renderBufferDirect(r,m.__lights,null,p,q,n):b.renderBuffer(r,m.__lights,null,p,q,n)}}u=m.__webglObjectsImmediate;j=0;for(w=u.length;j<w;j++){q=u[j];n=q.object;if(n.visible&&n.castShadow){n._modelViewMatrix.multiply(r.matrixWorldInverse,n.matrixWorld);b.renderImmediateObject(r,m.__lights,null,c,n)}}}i=b.getClearColor();o=b.getClearAlpha();a.clearColor(i.r,i.g,i.b,o);a.enable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;
 THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d,f,e,h,l,m,k,i;this.init=function(a){b=a.context;c=a;d=new Float32Array(16);f=new Uint16Array(6);a=0;d[a++]=-1;d[a++]=-1;d[a++]=0;d[a++]=1;d[a++]=1;d[a++]=-1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=0;d[a++]=-1;d[a++]=1;d[a++]=0;a=d[a++]=0;f[a++]=0;f[a++]=1;f[a++]=2;f[a++]=0;f[a++]=2;f[a++]=3;e=b.createBuffer();h=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,e);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
 h);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,j=b.createProgram(),w=b.createShader(b.FRAGMENT_SHADER),r=b.createShader(b.VERTEX_SHADER);b.shaderSource(w,a.fragmentShader);b.shaderSource(r,a.vertexShader);b.compileShader(w);b.compileShader(r);b.attachShader(j,w);b.attachShader(j,r);b.linkProgram(j);l=j;m={};k={};m.position=b.getAttribLocation(l,"position");m.uv=b.getAttribLocation(l,"uv");k.uvOffset=b.getUniformLocation(l,"uvOffset");k.uvScale=b.getUniformLocation(l,
 "uvScale");k.rotation=b.getUniformLocation(l,"rotation");k.scale=b.getUniformLocation(l,"scale");k.alignment=b.getUniformLocation(l,"alignment");k.color=b.getUniformLocation(l,"color");k.map=b.getUniformLocation(l,"map");k.opacity=b.getUniformLocation(l,"opacity");k.useScreenCoordinates=b.getUniformLocation(l,"useScreenCoordinates");k.affectedByDistance=b.getUniformLocation(l,"affectedByDistance");k.screenPosition=b.getUniformLocation(l,"screenPosition");k.modelViewMatrix=b.getUniformLocation(l,"modelViewMatrix");
-k.projectionMatrix=b.getUniformLocation(l,"projectionMatrix");i=false};this.render=function(d,f,w,r){var d=d.__webglSprites,n=d.length;if(n){var q=m,p=k,s=r/w,w=w*0.5,B=r*0.5,A=true;b.useProgram(l);if(!i){b.enableVertexAttribArray(q.position);b.enableVertexAttribArray(q.uv);i=true}b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(true);b.bindBuffer(b.ARRAY_BUFFER,e);b.vertexAttribPointer(q.position,2,b.FLOAT,false,16,0);b.vertexAttribPointer(q.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
-h);b.uniformMatrix4fv(p.projectionMatrix,false,f._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(p.map,0);for(var u,J=[],q=0;q<n;q++){u=d[q];if(u.visible&&u.opacity!==0)if(u.useScreenCoordinates)u.z=-u.position.z;else{u._modelViewMatrix.multiply(f.matrixWorldInverse,u.matrixWorld);u.z=-u._modelViewMatrix.elements[14]}}d.sort(a);for(q=0;q<n;q++){u=d[q];if(u.visible&&u.opacity!==0&&u.map&&u.map.image&&u.map.image.width){if(u.useScreenCoordinates){b.uniform1i(p.useScreenCoordinates,1);
-b.uniform3f(p.screenPosition,(u.position.x-w)/w,(B-u.position.y)/B,Math.max(0,Math.min(1,u.position.z)))}else{b.uniform1i(p.useScreenCoordinates,0);b.uniform1i(p.affectedByDistance,u.affectedByDistance?1:0);b.uniformMatrix4fv(p.modelViewMatrix,false,u._modelViewMatrix.elements)}f=u.map.image.width/(u.scaleByViewport?r:1);J[0]=f*s*u.scale.x;J[1]=f*u.scale.y;b.uniform2f(p.uvScale,u.uvScale.x,u.uvScale.y);b.uniform2f(p.uvOffset,u.uvOffset.x,u.uvOffset.y);b.uniform2f(p.alignment,u.alignment.x,u.alignment.y);
-b.uniform1f(p.opacity,u.opacity);b.uniform3f(p.color,u.color.r,u.color.g,u.color.b);b.uniform1f(p.rotation,u.rotation);b.uniform2fv(p.scale,J);if(u.mergeWith3D&&!A){b.enable(b.DEPTH_TEST);A=true}else if(!u.mergeWith3D&&A){b.disable(b.DEPTH_TEST);A=false}c.setBlending(u.blending,u.blendEquation,u.blendSrc,u.blendDst);c.setTexture(u.map,0);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(true)}}};
+k.projectionMatrix=b.getUniformLocation(l,"projectionMatrix");i=false};this.render=function(d,f,w,r){var d=d.__webglSprites,n=d.length;if(n){var q=m,p=k,u=r/w,w=w*0.5,B=r*0.5,A=true;b.useProgram(l);if(!i){b.enableVertexAttribArray(q.position);b.enableVertexAttribArray(q.uv);i=true}b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(true);b.bindBuffer(b.ARRAY_BUFFER,e);b.vertexAttribPointer(q.position,2,b.FLOAT,false,16,0);b.vertexAttribPointer(q.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
+h);b.uniformMatrix4fv(p.projectionMatrix,false,f._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(p.map,0);for(var s,J=[],q=0;q<n;q++){s=d[q];if(s.visible&&s.opacity!==0)if(s.useScreenCoordinates)s.z=-s.position.z;else{s._modelViewMatrix.multiply(f.matrixWorldInverse,s.matrixWorld);s.z=-s._modelViewMatrix.elements[14]}}d.sort(a);for(q=0;q<n;q++){s=d[q];if(s.visible&&s.opacity!==0&&s.map&&s.map.image&&s.map.image.width){if(s.useScreenCoordinates){b.uniform1i(p.useScreenCoordinates,1);
+b.uniform3f(p.screenPosition,(s.position.x-w)/w,(B-s.position.y)/B,Math.max(0,Math.min(1,s.position.z)))}else{b.uniform1i(p.useScreenCoordinates,0);b.uniform1i(p.affectedByDistance,s.affectedByDistance?1:0);b.uniformMatrix4fv(p.modelViewMatrix,false,s._modelViewMatrix.elements)}f=s.map.image.width/(s.scaleByViewport?r:1);J[0]=f*u*s.scale.x;J[1]=f*s.scale.y;b.uniform2f(p.uvScale,s.uvScale.x,s.uvScale.y);b.uniform2f(p.uvOffset,s.uvOffset.x,s.uvOffset.y);b.uniform2f(p.alignment,s.alignment.x,s.alignment.y);
+b.uniform1f(p.opacity,s.opacity);b.uniform3f(p.color,s.color.r,s.color.g,s.color.b);b.uniform1f(p.rotation,s.rotation);b.uniform2fv(p.scale,J);if(s.mergeWith3D&&!A){b.enable(b.DEPTH_TEST);A=true}else if(!s.mergeWith3D&&A){b.disable(b.DEPTH_TEST);A=false}c.setBlending(s.blending,s.blendEquation,s.blendSrc,s.blendDst);c.setTexture(s.map,0);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(true)}}};
 THREE.ShaderFlares={lensFlareVertexTexture:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = (       visibility.r / 9.0 ) *\n( 1.0 - visibility.g / 9.0 ) *\n(       visibility.b / 9.0 ) *\n( 1.0 - visibility.a / 9.0 );\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"precision mediump float;\nuniform sampler2D map;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},
 lensFlare:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"precision mediump float;\nuniform sampler2D map;\nuniform sampler2D occlusionMap;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nfloat visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;\nvisibility = ( 1.0 - visibility / 4.0 );\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * visibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"}};
 THREE.ShaderSprite={sprite:{vertexShader:"uniform int useScreenCoordinates;\nuniform int affectedByDistance;\nuniform vec3 screenPosition;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 alignment;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position + alignment;\nvec2 rotatedPosition;\nrotatedPosition.x = ( cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y ) * scale.x;\nrotatedPosition.y = ( sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y ) * scale.y;\nvec4 finalPosition;\nif( useScreenCoordinates != 0 ) {\nfinalPosition = vec4( screenPosition.xy + rotatedPosition, screenPosition.z, 1.0 );\n} else {\nfinalPosition = projectionMatrix * modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition * ( affectedByDistance == 1 ? 1.0 : finalPosition.z );\n}\ngl_Position = finalPosition;\n}",

+ 7 - 2
docs/api/core/Vector3.html

@@ -146,16 +146,21 @@ Sets this vector to cross product of *a* and *b*.
 Sets this vector to cross product of itself and *v*.
 </div>
 
-<h3>.setPositionFromMatrix( [page:Matrix4 m] ) [page:Vector3]</h3>
+<h3>.getPositionFromMatrix( [page:Matrix4 m] ) [page:Vector3]</h3>
 <div>
 Sets this vector extracting position from matrix transform.
 </div>
 
-<h3>.setRotationFromMatrix( [page:Matrix4 m] ) [page:Vector3]</h3>
+<h3>.getRotationFromMatrix( [page:Matrix4 m] ) [page:Vector3]</h3>
 <div>
 Sets this vector extracting Euler angles rotation from matrix transform.
 </div>
 
+<h3>.getScaleFromMatrix( [page:Matrix4 m] ) [page:Vector3]</h3>
+<div>
+Sets this vector extracting scale from matrix transform.
+</div>
+
 <h3>.equals( [page:Vector3 v] ) [page:Vector3]</h3>
 <div>
 Checks for strict equality of this vector and *v*.

+ 17 - 9
examples/js/SimplexNoise.js

@@ -53,6 +53,14 @@ SimplexNoise.prototype.dot = function(g, x, y) {
 	return g[0]*x + g[1]*y;
 };
 
+SimplexNoise.prototype.dot3 = function(g, x, y, z) {
+  return g[0]*x + g[1]*y + g[2]*z; 
+}
+
+SimplexNoise.prototype.dot4 = function(g, x, y, z, w) {
+  return g[0]*x + g[1]*y + g[2]*z + g[3]*w;
+};
+
 SimplexNoise.prototype.noise = function(xin, yin) { 
   var n0, n1, n2; // Noise contributions from the three corners 
   // Skew the input space to determine which simplex cell we're in 
@@ -166,25 +174,25 @@ SimplexNoise.prototype.noise3d = function(xin, yin, zin) {
   if(t0<0) n0 = 0.0; 
   else { 
     t0 *= t0; 
-    n0 = t0 * t0 * this.dot(this.grad3[gi0], x0, y0, z0); 
+    n0 = t0 * t0 * this.dot3(this.grad3[gi0], x0, y0, z0); 
   }
   var t1 = 0.6 - x1*x1 - y1*y1 - z1*z1; 
   if(t1<0) n1 = 0.0; 
   else { 
     t1 *= t1; 
-    n1 = t1 * t1 * this.dot(this.grad3[gi1], x1, y1, z1); 
+    n1 = t1 * t1 * this.dot3(this.grad3[gi1], x1, y1, z1); 
   } 
   var t2 = 0.6 - x2*x2 - y2*y2 - z2*z2; 
   if(t2<0) n2 = 0.0; 
   else { 
     t2 *= t2; 
-    n2 = t2 * t2 * this.dot(this.grad3[gi2], x2, y2, z2); 
+    n2 = t2 * t2 * this.dot3(this.grad3[gi2], x2, y2, z2); 
   } 
   var t3 = 0.6 - x3*x3 - y3*y3 - z3*z3; 
   if(t3<0) n3 = 0.0; 
   else { 
     t3 *= t3; 
-    n3 = t3 * t3 * this.dot(this.grad3[gi3], x3, y3, z3); 
+    n3 = t3 * t3 * this.dot3(this.grad3[gi3], x3, y3, z3); 
   } 
   // Add contributions from each corner to get the final noise value. 
   // The result is scaled to stay just inside [-1,1] 
@@ -286,30 +294,30 @@ SimplexNoise.prototype.noise4d = function( x, y, z, w ) {
    if(t0<0) n0 = 0.0;
    else {
      t0 *= t0;
-     n0 = t0 * t0 * this.dot(grad4[gi0], x0, y0, z0, w0);
+     n0 = t0 * t0 * this.dot4(grad4[gi0], x0, y0, z0, w0);
    }
   var t1 = 0.6 - x1*x1 - y1*y1 - z1*z1 - w1*w1;
    if(t1<0) n1 = 0.0;
    else {
      t1 *= t1;
-     n1 = t1 * t1 * this.dot(grad4[gi1], x1, y1, z1, w1);
+     n1 = t1 * t1 * this.dot4(grad4[gi1], x1, y1, z1, w1);
    }
   var t2 = 0.6 - x2*x2 - y2*y2 - z2*z2 - w2*w2;
    if(t2<0) n2 = 0.0;
    else {
      t2 *= t2;
-     n2 = t2 * t2 * this.dot(grad4[gi2], x2, y2, z2, w2);
+     n2 = t2 * t2 * this.dot4(grad4[gi2], x2, y2, z2, w2);
    }   var t3 = 0.6 - x3*x3 - y3*y3 - z3*z3 - w3*w3;
    if(t3<0) n3 = 0.0;
    else {
      t3 *= t3;
-     n3 = t3 * t3 * this.dot(grad4[gi3], x3, y3, z3, w3);
+     n3 = t3 * t3 * this.dot4(grad4[gi3], x3, y3, z3, w3);
    }
   var t4 = 0.6 - x4*x4 - y4*y4 - z4*z4 - w4*w4;
    if(t4<0) n4 = 0.0;
    else {
      t4 *= t4;
-     n4 = t4 * t4 * this.dot(grad4[gi4], x4, y4, z4, w4);
+     n4 = t4 * t4 * this.dot4(grad4[gi4], x4, y4, z4, w4);
    }
    // Sum up and scale the result to cover the range [-1,1]
    return 27.0 * (n0 + n1 + n2 + n3 + n4);

+ 1 - 1
examples/js/loaders/VTKLoader.js

@@ -66,7 +66,7 @@ THREE.VTKLoader.prototype = {
 
 		// float float float
 
-		pattern = /([\d|\.|\+|\-|e]+)[ ]+([\d|\.|\+|\-|e]+)[ ]+([\d|\.|\+|\-|e]+)/g;
+		pattern = /([\+|\-]?[\d]+[\.][\d|\-|e]+)[ ]+([\+|\-]?[\d]+[\.][\d|\-|e]+)[ ]+([\+|\-]?[\d]+[\.][\d|\-|e]+)/g;
 
 		while ( ( result = pattern.exec( data ) ) != null ) {
 

+ 63 - 76
gui/js/UI.js

@@ -198,7 +198,7 @@ UI.Panel = function ( position ) {
 	this.dom = document.createElement( 'div' );
 	this.dom.style.position = position || 'relative';
 
-	this.dom.addEventListener( 'mousedown', function ( event ) { event.preventDefault() }, false );
+	// this.dom.addEventListener( 'mousedown', function ( event ) { event.preventDefault() }, false );
 
 	return this;
 };
@@ -243,99 +243,58 @@ UI.Text.prototype.setText = function ( value ) {
 };
 
 
-// IntNumber
+// Color
 
-UI.IntNumber = function ( position ) {
+UI.Color = function ( position ) {
 
 	UI.Element.call( this );
 
 	this.dom = document.createElement( 'span' );
 	this.dom.style.position = position || 'relative';
-	this.dom.textContent = '0.00';
-	this.dom.style.marginTop = '2px';
-	this.dom.style.color = '#0080f0';
-	this.dom.style.fontSize = '12px';
-	this.dom.style.textDecoration = 'underline';
-
-	this.onChangeCallback = null;
-
-	var scope = this;
-	var onMouseDownValue, onMouseDownScreenX, onMouseDownScreenY;
-
-	var onMouseDown = function ( event ) {
-
-		event.preventDefault();
-
-		onMouseDownValue = parseInt( scope.dom.textContent );
-		onMouseDownScreenX = event.screenX;
-		onMouseDownScreenY = event.screenY;
-
-		document.addEventListener( 'mousemove', onMouseMove, false );
-		document.addEventListener( 'mouseup', onMouseUp, false );
-
-	}
-
-	var onMouseMove = function ( event ) {
-
-		var dx = event.screenX - onMouseDownScreenX;
-		var dy = event.screenY - onMouseDownScreenY;
-
-		scope.dom.textContent = ( onMouseDownValue + ( dx - dy ) / ( event.shiftKey ? 10 : 100 ) ).toFixed( 0 );
-		scope.onChangeCallback();
-
-	}
-
-	var onMouseUp = function ( event ) {
-
-		document.removeEventListener( 'mousemove', onMouseMove, false );
-		document.removeEventListener( 'mouseup', onMouseUp, false );
-
-	}
-
-	this.dom.addEventListener( 'mousedown', onMouseDown, false );
+	this.dom.style.width = '64px';
+	this.dom.style.height = '16px';
+	this.dom.style.backgroundColor = '#000000';
 
 	return this;
 
 };
 
-UI.IntNumber.prototype = new UI.Element();
-UI.IntNumber.prototype.constructor = UI.IntNumber;
-
-UI.IntNumber.prototype.getValue = function () {
+UI.Color.prototype = new UI.Element();
+UI.Color.prototype.constructor = UI.Color;
 
-	return parseInt( this.dom.textContent );
+UI.Color.prototype.getValue = function () {
 
-};
-
-UI.IntNumber.prototype.setValue = function ( value ) {
-
-	this.dom.textContent = value.toFixed( 0 );
-	return this;
+	return this.dom.style.backgroundColor;
 
 };
 
-UI.IntNumber.prototype.onChange = function ( callback ) {
+UI.Color.prototype.setValue = function ( value ) {
 
-	this.onChangeCallback = callback;
+	this.dom.style.backgroundColor = value;
 	return this;
 
 };
 
 
+// Number
 
-// FloatNumber
-
-UI.FloatNumber = function ( position ) {
+UI.Number = function ( position ) {
 
 	UI.Element.call( this );
 
-	this.dom = document.createElement( 'span' );
+	this.dom = document.createElement( 'input' );
 	this.dom.style.position = position || 'relative';
-	this.dom.textContent = '0.00';
-	this.dom.style.marginTop = '2px';
+	this.dom.style.marginTop = '0px';
 	this.dom.style.color = '#0080f0';
 	this.dom.style.fontSize = '12px';
 	this.dom.style.textDecoration = 'underline';
+	this.dom.style.backgroundColor = 'transparent';
+	this.dom.style.border = '0px';
+
+	this.dom.value = '0.00';
+
+	this.min = - Infinity;
+	this.max = Infinity;
 
 	this.onChangeCallback = null;
 
@@ -344,9 +303,9 @@ UI.FloatNumber = function ( position ) {
 
 	var onMouseDown = function ( event ) {
 
-		event.preventDefault();
+		// event.preventDefault();
 
-		onMouseDownValue = parseFloat( scope.dom.textContent );
+		onMouseDownValue = parseFloat( scope.dom.value );
 		onMouseDownScreenX = event.screenX;
 		onMouseDownScreenY = event.screenY;
 
@@ -357,10 +316,12 @@ UI.FloatNumber = function ( position ) {
 
 	var onMouseMove = function ( event ) {
 
-		var dx = event.screenX - onMouseDownScreenX;
-		var dy = event.screenY - onMouseDownScreenY;
+		var distance = ( event.screenX - onMouseDownScreenX ) - ( event.screenY - onMouseDownScreenY );
+		var amount = event.shiftKey ? 10 : 100;
+
+		var number = onMouseDownValue + ( distance / amount );
 
-		scope.dom.textContent = ( onMouseDownValue + ( dx - dy ) / ( event.shiftKey ? 10 : 100 ) ).toFixed( 2 );
+		scope.dom.value = Math.min( scope.max, Math.max( scope.min, number ) ).toFixed( 2 );
 		scope.onChangeCallback();
 
 	}
@@ -373,28 +334,54 @@ UI.FloatNumber = function ( position ) {
 	}
 
 	this.dom.addEventListener( 'mousedown', onMouseDown, false );
+	this.dom.addEventListener( 'change', function ( event ) {
+
+		var number = parseFloat( scope.dom.value );
+
+		if ( number !== NaN ) {
+
+			scope.dom.value = number.toFixed( 2 );
+			scope.onChangeCallback();
+
+		}
+
+	}, false );
 
 	return this;
 
 };
 
-UI.FloatNumber.prototype = new UI.Element();
-UI.FloatNumber.prototype.constructor = UI.FloatNumber;
+UI.Number.prototype = new UI.Element();
+UI.Number.prototype.constructor = UI.Number;
+
+UI.Number.prototype.getValue = function () {
 
-UI.FloatNumber.prototype.getValue = function () {
+	return parseFloat( this.dom.value );
+
+};
 
-	return parseFloat( this.dom.textContent );
+UI.Number.prototype.setValue = function ( value ) {
+
+	this.dom.value = value.toFixed( 2 );
+	return this;
+
+};
+
+UI.Number.prototype.setMin = function ( value ) {
+
+	this.min = value;
+	return this;
 
 };
 
-UI.FloatNumber.prototype.setValue = function ( value ) {
+UI.Number.prototype.setMax = function ( value ) {
 
-	this.dom.textContent = value.toFixed( 2 );
+	this.max = value;
 	return this;
 
 };
 
-UI.FloatNumber.prototype.onChange = function ( callback ) {
+UI.Number.prototype.onChange = function ( callback ) {
 
 	this.onChangeCallback = callback;
 	return this;

+ 2 - 2
gui/js/ui/Sidebar.Properties.Geometry.js

@@ -109,9 +109,9 @@ Sidebar.Properties.Geometry = function ( signals ) {
 			var hasFaceColor = face.color;
 			var hasFaceVertexColor = face.vertexColors[ 0 ] !== undefined;
 
-			var faceType = 0
-			faceType = setBit( faceType, 0, ! isTriangle );
+			var faceType = 0;
 			
+			faceType = setBit( faceType, 0, ! isTriangle );			
 			// faceType = setBit( faceType, 1, hasMaterial );
 			// faceType = setBit( faceType, 2, hasFaceUv );
 			// faceType = setBit( faceType, 3, hasFaceVertexUv );

+ 18 - 3
gui/js/ui/Sidebar.Properties.Material.js

@@ -17,17 +17,30 @@ Sidebar.Properties.Material = function ( signals ) {
 	container.add( new UI.HorizontalRule() );
 
 	container.add( new UI.Text().setText( 'Color' ).setColor( '#666' ) );
-	var materialColor = new UI.Text( 'absolute' ).setLeft( '90px' ).setColor( '#444' ).setFontSize( '12px' );
+	
+	var materialColor = new UI.Color( 'absolute' ).setLeft( '90px' );
 	container.add( materialColor );
 	container.add( new UI.HorizontalRule() );
 
+	container.add( new UI.Text().setText( 'Ambient' ).setColor( '#666' ) );
+	
+	var materialAmbient = new UI.Color( 'absolute' ).setLeft( '90px' );
+	container.add( materialAmbient );
+	container.add( new UI.HorizontalRule() );
+
+	container.add( new UI.Text().setText( 'Specular' ).setColor( '#666' ) );
+	
+	var materialSpecular = new UI.Color( 'absolute' ).setLeft( '90px' );
+	container.add( materialSpecular );
+	container.add( new UI.HorizontalRule() );
+
 	container.add( new UI.Text().setText( 'Map' ).setColor( '#666' ) );
 	var materialMap = new UI.Text( 'absolute' ).setLeft( '90px' ).setColor( '#444' ).setFontSize( '12px' );
 	container.add( materialMap );
 	container.add( new UI.HorizontalRule() );
 
 	container.add( new UI.Text().setText( 'Opacity' ).setColor( '#666' ) );
-	var materialOpacity = new UI.FloatNumber( 'absolute' ).setLeft( '90px' ).setFontSize( '12px' ).onChange( update );
+	var materialOpacity = new UI.Number( 'absolute' ).setLeft( '90px' ).setWidth( '60px' ).setMin( 0 ).setMax( 1 ).onChange( update );
 	container.add( materialOpacity );
 	container.add( new UI.HorizontalRule() );
 
@@ -61,7 +74,9 @@ Sidebar.Properties.Material = function ( signals ) {
 
 			materialName.setText( object.material.name );
 			materialClass.setText( getMaterialInstanceName( object.material ) );
-			materialColor.setText( '#' + object.material.color.getHex().toString(16) );
+			materialColor.setValue( '#' + object.material.color.getHex().toString( 16 ) );
+			if ( object.material.ambient ) materialAmbient.setValue( '#' + object.material.ambient.getHex().toString( 16 ) );
+			if ( object.material.specular ) materialSpecular.setValue( '#' + object.material.specular.getHex().toString( 16 ) );
 			materialMap.setText( object.material.map );
 			materialOpacity.setValue( object.material.opacity );
 			materialTransparent.setText( object.material.transparent );

+ 9 - 9
gui/js/ui/Sidebar.Properties.Object3D.js

@@ -12,23 +12,23 @@ Sidebar.Properties.Object3D = function ( signals ) {
 	container.add( new UI.HorizontalRule() );
 
 	container.add( new UI.Text().setText( 'Position' ).setColor( '#666' ) );
-	var positionX = new UI.FloatNumber( 'absolute' ).setLeft( '90px' ).onChange( update );
-	var positionY = new UI.FloatNumber( 'absolute' ).setLeft( '160px' ).onChange( update );
-	var positionZ = new UI.FloatNumber( 'absolute' ).setLeft( '230px' ).onChange( update );
+	var positionX = new UI.Number( 'absolute' ).setLeft( '90px' ).setWidth( '50px' ).onChange( update );
+	var positionY = new UI.Number( 'absolute' ).setLeft( '150px' ).setWidth( '50px' ).onChange( update );
+	var positionZ = new UI.Number( 'absolute' ).setLeft( '210px' ).setWidth( '50px' ).onChange( update );
 	container.add( positionX, positionY, positionZ );
 	container.add( new UI.HorizontalRule() );
 
 	container.add( new UI.Text().setText( 'Rotation' ).setColor( '#666' ) );
-	var rotationX = new UI.FloatNumber( 'absolute' ).setLeft( '90px' ).onChange( update );
-	var rotationY = new UI.FloatNumber( 'absolute' ).setLeft( '160px' ).onChange( update );
-	var rotationZ = new UI.FloatNumber( 'absolute' ).setLeft( '230px' ).onChange( update );
+	var rotationX = new UI.Number( 'absolute' ).setLeft( '90px' ).setWidth( '50px' ).onChange( update );
+	var rotationY = new UI.Number( 'absolute' ).setLeft( '150px' ).setWidth( '50px' ).onChange( update );
+	var rotationZ = new UI.Number( 'absolute' ).setLeft( '210px' ).setWidth( '50px' ).onChange( update );
 	container.add( rotationX, rotationY, rotationZ );
 	container.add( new UI.HorizontalRule() );
 
 	container.add( new UI.Text().setText( 'Scale' ).setColor( '#666' ) );
-	var scaleX = new UI.FloatNumber( 'absolute' ).setValue( 1 ).setLeft( '90px' ).onChange( update );
-	var scaleY = new UI.FloatNumber( 'absolute' ).setValue( 1 ).setLeft( '160px' ).onChange( update );
-	var scaleZ = new UI.FloatNumber( 'absolute' ).setValue( 1 ).setLeft( '230px' ).onChange( update );
+	var scaleX = new UI.Number( 'absolute' ).setValue( 1 ).setLeft( '90px' ).setWidth( '50px' ).onChange( update );
+	var scaleY = new UI.Number( 'absolute' ).setValue( 1 ).setLeft( '150px' ).setWidth( '50px' ).onChange( update );
+	var scaleZ = new UI.Number( 'absolute' ).setValue( 1 ).setLeft( '210px' ).setWidth( '50px' ).onChange( update );
 	container.add( scaleX, scaleY, scaleZ );
 	container.add( new UI.Break(), new UI.Break(), new UI.Break() );
 

+ 3 - 0
gui/js/ui/Viewport.js

@@ -121,6 +121,9 @@ var Viewport = function ( signals ) {
 
 	signals.objectChanged.add( function ( object ) {
 
+		object.updateMatrix();
+		object.updateMatrixWorld();
+
 		selectionBox.matrixWorld.copy( object.matrixWorld );
 
 		render();

+ 14 - 4
src/core/Ray.js

@@ -80,10 +80,20 @@ THREE.Ray = function ( origin, direction, near, far ) {
 
 	};
 
-	this.intersectObject = function ( object ) {
+	this.intersectObject = function ( object, recursive ) {
 
 		var intersect, intersects = [];
 
+		if ( recursive === true ) {
+
+			for ( var i = 0, l = object.children.length; i < l; i ++ ) {
+
+				Array.prototype.push.apply( intersects, this.intersectObject( object.children[ i ], recursive ) );
+
+			}
+
+		}
+
 		if ( object instanceof THREE.Particle ) {
 
 			distance = distanceFromIntersection( this.origin, this.direction, object.matrixWorld.getPosition() );
@@ -125,7 +135,7 @@ THREE.Ray = function ( origin, direction, near, far ) {
 			// Checking faces
 
 			var f, fl, face, dot, scalar,
-			rangeSq = this.range*this.range,
+			rangeSq = this.range * this.range,
 			geometry = object.geometry,
 			vertices = geometry.vertices,
 			objMatrix;
@@ -226,13 +236,13 @@ THREE.Ray = function ( origin, direction, near, far ) {
 
 	};
 
-	this.intersectObjects = function ( objects ) {
+	this.intersectObjects = function ( objects, recursive ) {
 
 		var intersects = [];
 
 		for ( var i = 0, l = objects.length; i < l; i ++ ) {
 
-			Array.prototype.push.apply( intersects, this.intersectObject( objects[ i ] ) );
+			Array.prototype.push.apply( intersects, this.intersectObject( objects[ i ], recursive ) );
 
 		}
 

+ 1 - 1
src/extras/ImageUtils.js

@@ -18,7 +18,7 @@ THREE.ImageUtils = {
 			texture.image = event.content;
 			texture.needsUpdate = true;
 			
-			if ( onLoad ) onLoad();
+			if ( onLoad ) onLoad( texture );
 
 		} );
 

+ 0 - 1
utils/node_modules/argsparser/.gitignore

@@ -1 +0,0 @@
-.DS_Store

+ 0 - 4
utils/node_modules/argsparser/Makefile

@@ -1,4 +0,0 @@
-test:
-	node test/test.js
-
-.PHONY: test

+ 0 - 1
utils/node_modules/argsparser/index.js

@@ -1 +0,0 @@
-module.exports = require('./lib/argsparser');

+ 0 - 41
utils/node_modules/argsparser/lib/argsparser.js

@@ -1,41 +0,0 @@
-/**
- * Parser arguments array
- * @param {Array} args optional arguments arrray.
- * @return {Object} opts key value hash.
- * @export
- */
-exports.parse = function(args) {
-    // args is optional, default is process.argv
-    args = args || process.argv;
-
-    var opts = {}, curSwitch;
-
-    args.forEach(function(arg) {
-        // its a switch
-        if (/^(-|--)/.test(arg) || !curSwitch) {
-            opts[arg] = true;
-            curSwitch = arg;
-        // this arg is a data
-        } else {
-            if (arg === 'false') {
-                arg = false;
-            } else if (arg === 'true') {
-                arg = true;
-            } else if (!isNaN(arg)) {
-                arg = Number(arg);
-            }
-
-            // it was a boolean switch per default, 
-            // now it has got a val
-            if (typeof opts[curSwitch] === 'boolean') {
-                opts[curSwitch] = arg;
-            } else if (Array.isArray(opts[curSwitch])) {
-                opts[curSwitch].push(arg);
-            } else {
-                opts[curSwitch] = [opts[curSwitch], arg];
-            }
-        }
-    });
-
-    return opts;
-};

+ 0 - 19
utils/node_modules/argsparser/package.json

@@ -1,19 +0,0 @@
-{
-    "name": "argsparser",
-    "description": "A tiny command line arguments parser",
-    "version": "0.0.6",
-    "author": "Oleg Slobodskoi <[email protected]>",
-    "repository": {
-        "type": "git",
-        "url": "http://github.com/kof/node-argsparser.git"
-    },
-    "keywords": [ "arguments", "options", "command line", "parser" ],
-    "engines": { "node": ">= 0.2.0" },
-    "scripts": { "test": "node ./test/test.js"  },
-    "licenses": [
-        { 
-            "type": "MIT",
-            "url" : "http://www.opensource.org/licenses/mit-license.php"
-        }
-    ]
-}

+ 0 - 34
utils/node_modules/argsparser/readme.md

@@ -1,34 +0,0 @@
-## Yet another tiny arguments parser for node
-
-## Features
- * extremely tiny
- * instead to parse all possible spellings, it uses just some simple rules
-
-## How this parser works
-The target is to get a key-value object from an array. A key can be the first element or element prefixed by "-" and "--" (switch). 
-So the parser loops through the array and looks for keys. After he could detect an a key all next elements will be added as a value of this key until he find another key.
-If there is no value, then the key is true (boolean). If there are a lot of values, then the key is an array.
-
-## Examples
-
-node script.js -> {"node": "script.js"}
-
-node script.js -o -> {"node": "script.js", "-o": true}
-
-node script.js -o test -> {"node": "script.js", "-o": "test"}
-
-node script.js -a testa --b testb -> {node: "script.js", "-a": "testa", "--b": "testb"}
- 
-node script.js -paths /test.js /test1.js -> {node: "script.js", "-paths": ["/test.js", "/test1.js"]}
-
-## Usage
-
-    // per default it parses process.argv
-    var args = require( "argsparser" ).parse(); // {"node": "/path/to/your/script.js"}
-    
-    // optional you can pass your own arguments array
-    var args = require( "argsparser" ).parse(["-a", "test"]); // {"-a": "test"}
-
-    
-## Installation
-    npm install argsparser    

+ 0 - 39
utils/node_modules/argsparser/test/test.js

@@ -1,39 +0,0 @@
-var a = require('assert'),
-    util = require('util'),
-    parse = require('../lib/argsparser').parse;
-
-util.print('Run tests...\n');
-
-a.deepEqual(parse(), {node: __filename}, 'node script.js');
-
-a.deepEqual(parse(['-o']), {'-o': true}, 'node script.js -o');
-
-a.deepEqual(parse(['-o', 'true']), {'-o': true}, 'node script.js -o true');
-
-a.deepEqual(parse(['-o', 'false']), {'-o': false}, 'node script.js -o false');
-
-a.deepEqual(parse(['-o', '123']), {'-o': 123}, 'node script.js -o 123');
-
-a.deepEqual(parse(['--token', 'bla--bla']), {'--token': 'bla--bla'}, 'node script.js --token bla--bla');
-
-a.deepEqual(parse(['-o', '123.456']), {'-o': 123.456}, 'node script.js -o 123.456');
-
-a.deepEqual(parse(['-o', 'test']), {'-o': 'test'}, 'node script.js -o test');
-
-a.deepEqual(parse(['-a', 'testa', '-b', 'testb']), {'-a': 'testa', '-b': 'testb'}, 'node script.js -a testa -b testb');
-
-a.deepEqual(parse(['--a', 'testa', '--b', 'testb']), {'--a': 'testa', '--b': 'testb'}, 'node script.js --a testa --b testb ');
-
-a.deepEqual(parse(['-a', 'testa', '--b', 'testb']), {'-a': 'testa', '--b': 'testb'}, 'node script.js -a testa --b testb');
-
-a.deepEqual(parse(['--a', 'testa', '-b', 'testb']), {'--a': 'testa', '-b': 'testb'}, 'node script.js --a testa -b testb');
-
-a.deepEqual(parse(['-paths', '/test.js', '/test1.js']), {'-paths': ['/test.js', '/test1.js']}, 'node script.js -paths /test.js /test1.js');
-
-a.deepEqual(parse(['--paths', '/test.js', '/test1.js']), {'--paths': ['/test.js', '/test1.js']}, 'node script.js --paths /test.js /test1.js');
-
-a.deepEqual(parse(['--paths', '/test.js', '/test1.js', '-a', 'testa']), {'--paths': ['/test.js', '/test1.js'], '-a': 'testa'}, 'node script.js --paths /test.js /test1.js -a testa');
-
-a.deepEqual(parse(['--port', '80', '8080']), {'--port': [80, 8080]}, 'node server.js --port 80 8080');
-
-util.print('All tests ok\n');

+ 0 - 4
utils/node_modules/uglify-js/.npmignore

@@ -1,4 +0,0 @@
-.DS_Store
-.tmp*~
-*.local.*
-.pinf-*

+ 0 - 981
utils/node_modules/uglify-js/README.html

@@ -1,981 +0,0 @@
-<?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 &ndash; 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-12-09 14:59:08 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; }
-  .right  {margin-left:auto; margin-right:0px;  text-align:right;}
-  .left   {margin-left:0px;  margin-right:auto; text-align:left;}
-  .center {margin-left:auto; margin-right:auto; text-align:center;}
-  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;  }
-  th.right  { text-align:center;  }
-  th.left   { text-align:center;   }
-  th.center { text-align:center; }
-  td.right  { text-align:right;  }
-  td.left   { text-align:left;   }
-  td.center { text-align:center; }
-  dt { font-weight: bold; }
-  div.figure { padding: 0.5em; }
-  div.figure p { text-align: center; }
-  div.inlinetask {
-    padding:10px;
-    border:2px solid gray;
-    margin:10px;
-    background: #ffffcc;
-  }
-  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="preamble">
-
-</div>
-
-<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>
-<li><a href="#sec-1-1-2">1.1.2 <code>obj.toString()</code> ==&gt; <code>obj+“”</code> </a></li>
-</ul>
-</li>
-<li><a href="#sec-1-2">1.2 Install (NPM) </a></li>
-<li><a href="#sec-1-3">1.3 Install latest code from GitHub </a></li>
-<li><a href="#sec-1-4">1.4 Usage </a>
-<ul>
-<li><a href="#sec-1-4-1">1.4.1 API </a></li>
-<li><a href="#sec-1-4-2">1.4.2 Beautifier shortcoming &ndash; no more comments </a></li>
-<li><a href="#sec-1-4-3">1.4.3 Use as a code pre-processor </a></li>
-</ul>
-</li>
-<li><a href="#sec-1-5">1.5 Compression &ndash; how good is it? </a></li>
-<li><a href="#sec-1-6">1.6 Bugs? </a></li>
-<li><a href="#sec-1-7">1.7 Links </a></li>
-<li><a href="#sec-1-8">1.8 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>
-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>
-<li>act a limited version of a pre-processor (c.f. the pre-processor of
-    C/C++) to allow you to safely replace selected global symbols with
-    specified values.  When combined with the optimisations above this can
-    make UglifyJS operate slightly more like a compilation process, in
-    that when certain symbols are replaced by constant values, entire code
-    blocks may be optimised away as unreachable.
-</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>
-The following transformations can in theory break code, although they're
-probably safe in most practical cases.  To enable them you need to pass the
-<code>--unsafe</code> flag.
-</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-js"><span class="org-keyword">new</span> <span class="org-type">Array</span>(1, 2, 3, 4)  =&gt; [1,2,3,4]
-Array(a, b, c)         =&gt; [a,b,c]
-<span class="org-keyword">new</span> <span class="org-type">Array</span>(5)           =&gt; Array(5)
-<span class="org-keyword">new</span> <span class="org-type">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-js"><span class="org-comment-delimiter">// </span><span class="org-comment">case 1.  globally declared variable</span>
-  <span class="org-keyword">var</span> <span class="org-variable-name">Array</span>;
-  <span class="org-keyword">new</span> <span class="org-type">Array</span>(1, 2, 3);
-  Array(a, b);
-
-  <span class="org-comment-delimiter">// </span><span class="org-comment">or (can be declared later)</span>
-  <span class="org-keyword">new</span> <span class="org-type">Array</span>(1, 2, 3);
-  <span class="org-keyword">var</span> <span class="org-variable-name">Array</span>;
-
-  <span class="org-comment-delimiter">// </span><span class="org-comment">or (can be a function)</span>
-  <span class="org-keyword">new</span> <span class="org-type">Array</span>(1, 2, 3);
-  <span class="org-keyword">function</span> <span class="org-function-name">Array</span>() { ... }
-
-<span class="org-comment-delimiter">// </span><span class="org-comment">case 2.  declared in a function</span>
-  (<span class="org-keyword">function</span>(){
-    a = <span class="org-keyword">new</span> <span class="org-type">Array</span>(1, 2, 3);
-    b = Array(5, 6);
-    <span class="org-keyword">var</span> <span class="org-variable-name">Array</span>;
-  })();
-
-  <span class="org-comment-delimiter">// </span><span class="org-comment">or</span>
-  (<span class="org-keyword">function</span>(<span class="org-variable-name">Array</span>){
-    <span class="org-keyword">return</span> Array(5, 6, 7);
-  })();
-
-  <span class="org-comment-delimiter">// </span><span class="org-comment">or</span>
-  (<span class="org-keyword">function</span>(){
-    <span class="org-keyword">return</span> <span class="org-keyword">new</span> <span class="org-type">Array</span>(1, 2, 3, 4);
-    <span class="org-keyword">function</span> <span class="org-function-name">Array</span>() { ... }
-  })();
-
-  <span class="org-comment-delimiter">// </span><span class="org-comment">etc.</span>
-</pre>
-
-
-</div>
-
-</div>
-
-<div id="outline-container-1-1-2" class="outline-4">
-<h4 id="sec-1-1-2"><span class="section-number-4">1.1.2</span> <code>obj.toString()</code> ==&gt; <code>obj+“”</code> </h4>
-<div class="outline-text-4" id="text-1-1-2">
-
-
-</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> Install (NPM) </h3>
-<div class="outline-text-3" id="text-1-2">
-
-
-<p>
-UglifyJS is now available through NPM &mdash; <code>npm install uglify-js</code> should do
-the job.
-</p>
-</div>
-
-</div>
-
-<div id="outline-container-1-3" class="outline-3">
-<h3 id="sec-1-3"><span class="section-number-3">1.3</span> Install latest code from GitHub </h3>
-<div class="outline-text-3" id="text-1-3">
-
-
-
-
-
-<pre class="src src-sh"><span class="org-comment-delimiter">## </span><span class="org-comment">clone the repository</span>
-mkdir -p /where/you/wanna/put/it
-<span class="org-builtin">cd</span> /where/you/wanna/put/it
-git clone git://github.com/mishoo/UglifyJS.git
-
-<span class="org-comment-delimiter">## </span><span class="org-comment">make the module available to Node</span>
-mkdir -p ~/.node_libraries/
-<span class="org-builtin">cd</span> ~/.node_libraries/
-ln -s /where/you/wanna/put/it/UglifyJS/uglify-js.js
-
-<span class="org-comment-delimiter">## </span><span class="org-comment">and if you want the CLI script too:</span>
-mkdir -p ~/bin
-<span class="org-builtin">cd</span> ~/bin
-ln -s /where/you/wanna/put/it/UglifyJS/bin/uglifyjs
-  <span class="org-comment-delimiter"># </span><span class="org-comment">(then add ~/bin to your $PATH if it's not there already)</span>
-</pre>
-
-
-</div>
-
-</div>
-
-<div id="outline-container-1-4" class="outline-3">
-<h3 id="sec-1-4"><span class="section-number-3">1.4</span> Usage </h3>
-<div class="outline-text-3" id="text-1-4">
-
-
-<p>
-There is a command-line tool that exposes the functionality of this library
-for your shell-scripting needs:
-</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 names.
-
-</li>
-<li><code>-nmf</code> or <code>--no-mangle-functions</code> &ndash; in case you want to mangle variable
-  names, but not touch function 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>-d SYMBOL[=VALUE]</code> or <code>--define SYMBOL[=VALUE]</code> &mdash; will replace
-  all instances of the specified symbol where used as an identifier
-  (except where symbol has properly declared by a var declaration or
-  use as function parameter or similar) with the specified value. This
-  argument may be specified multiple times to define multiple
-  symbols - if no value is specified the symbol will be replaced with
-  the value <code>true</code>, or you can specify a numeric value (such as
-  <code>1024</code>), a quoted string value (such as ="object"= or
-  ='https://github.com'<code>), or the name of another symbol or keyword   (such as =null</code> or <code>document</code>).
-  This allows you, for example, to assign meaningful names to key
-  constant values but discard the symbolic names in the uglified
-  version for brevity/efficiency, or when used wth care, allows
-  UglifyJS to operate as a form of <b>conditional compilation</b>
-  whereby defining appropriate values may, by dint of the constant
-  folding and dead code removal features above, remove entire
-  superfluous code blocks (e.g. completely remove instrumentation or
-  trace code for production use).
-  Where string values are being defined, the handling of quotes are
-  likely to be subject to the specifics of your command shell
-  environment, so you may need to experiment with quoting styles
-  depending on your platform, or you may find the option
-  <code>--define-from-module</code> more suitable for use.
-
-</li>
-<li><code>-define-from-module SOMEMODULE</code> &mdash; will load the named module (as
-  per the NodeJS <code>require()</code> function) and iterate all the exported
-  properties of the module defining them as symbol names to be defined
-  (as if by the <code>--define</code> option) per the name of each property
-  (i.e. without the module name prefix) and given the value of the
-  property. This is a much easier way to handle and document groups of
-  symbols to be defined rather than a large number of <code>--define</code>
-  options.
-
-</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 these:
-
-<ul>
-<li>foo.toString()  ==&gt;  foo+""
-</li>
-<li>new Array(x,&hellip;)  ==&gt; [x,&hellip;]
-</li>
-<li>new Array(x) ==&gt; Array(x)
-
-</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>
-<li><code>--inline-script</code> &ndash; when you want to include the output literally in an
-  HTML <code>&lt;script&gt;</code> tag you can use this option to prevent <code>&lt;/script</code> from
-  showing up in the output.
-
-</li>
-<li><code>--lift-vars</code> &ndash; when you pass this, UglifyJS will apply the following
-  transformations (see the notes in API, <code>ast_lift_variables</code>):
-
-<ul>
-<li>put all <code>var</code> declarations at the start of the scope
-</li>
-<li>make sure a variable is declared only once
-</li>
-<li>discard unused function arguments
-</li>
-<li>discard unused inner (named) functions
-</li>
-<li>finally, try to merge assignments into that one <code>var</code> declaration, if
-    possible.
-</li>
-</ul>
-
-</li>
-</ul>
-
-
-
-</div>
-
-<div id="outline-container-1-4-1" class="outline-4">
-<h4 id="sec-1-4-1"><span class="section-number-4">1.4.1</span> API </h4>
-<div class="outline-text-4" id="text-1-4-1">
-
-
-<p>
-To use the library from JavaScript, you'd do the following (example for
-NodeJS):
-</p>
-
-
-
-<pre class="src src-js"><span class="org-keyword">var</span> <span class="org-variable-name">jsp</span> = require(<span class="org-string">"uglify-js"</span>).parser;
-<span class="org-keyword">var</span> <span class="org-variable-name">pro</span> = require(<span class="org-string">"uglify-js"</span>).uglify;
-
-<span class="org-keyword">var</span> <span class="org-variable-name">orig_code</span> = <span class="org-string">"... JS code here"</span>;
-<span class="org-keyword">var</span> <span class="org-variable-name">ast</span> = jsp.parse(orig_code); <span class="org-comment-delimiter">// </span><span class="org-comment">parse code and get the initial AST</span>
-ast = pro.ast_mangle(ast); <span class="org-comment-delimiter">// </span><span class="org-comment">get a new AST with mangled names</span>
-ast = pro.ast_squeeze(ast); <span class="org-comment-delimiter">// </span><span class="org-comment">get an AST with compression optimizations</span>
-<span class="org-keyword">var</span> <span class="org-variable-name">final_code</span> = pro.gen_code(ast); <span class="org-comment-delimiter">// </span><span class="org-comment">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_lift_variables(ast)</code> &ndash; merge and move <code>var</code> declarations to the
-  scop of the scope; discard unused function arguments or variables; discard
-  unused (named) inner functions.  It also tries to merge assignments
-  following the <code>var</code> declaration into it.
-
-<p>
-  If your code is very hand-optimized concerning <code>var</code> declarations, this
-  lifting variable declarations might actually increase size.  For me it
-  helps out.  On jQuery it adds 865 bytes (243 after gzip).  YMMV.  Also
-  note that (since it's not enabled by default) this operation isn't yet
-  heavily tested (please report if you find issues!).
-</p>
-<p>
-  Note that although it might increase the image size (on jQuery it gains
-  865 bytes, 243 after gzip) it's technically more correct: in certain
-  situations, dead code removal might drop variable declarations, which
-  would not happen if the variables are lifted in advance.
-</p>
-<p>
-  Here's an example of what it does:
-</p></li>
-</ul>
-
-
-
-
-
-<pre class="src src-js"><span class="org-keyword">function</span> <span class="org-function-name">f</span>(<span class="org-variable-name">a</span>, <span class="org-variable-name">b</span>, <span class="org-variable-name">c</span>, <span class="org-variable-name">d</span>, <span class="org-variable-name">e</span>) {
-    <span class="org-keyword">var</span> <span class="org-variable-name">q</span>;
-    <span class="org-keyword">var</span> <span class="org-variable-name">w</span>;
-    w = 10;
-    q = 20;
-    <span class="org-keyword">for</span> (<span class="org-keyword">var</span> <span class="org-variable-name">i</span> = 1; i &lt; 10; ++i) {
-        <span class="org-keyword">var</span> <span class="org-variable-name">boo</span> = foo(a);
-    }
-    <span class="org-keyword">for</span> (<span class="org-keyword">var</span> <span class="org-variable-name">i</span> = 0; i &lt; 1; ++i) {
-        <span class="org-keyword">var</span> <span class="org-variable-name">boo</span> = bar(c);
-    }
-    <span class="org-keyword">function</span> <span class="org-function-name">foo</span>(){ ... }
-    <span class="org-keyword">function</span> <span class="org-function-name">bar</span>(){ ... }
-    <span class="org-keyword">function</span> <span class="org-function-name">baz</span>(){ ... }
-}
-
-<span class="org-comment-delimiter">// </span><span class="org-comment">transforms into ==&gt;</span>
-
-<span class="org-keyword">function</span> <span class="org-function-name">f</span>(<span class="org-variable-name">a</span>, <span class="org-variable-name">b</span>, <span class="org-variable-name">c</span>) {
-    <span class="org-keyword">var</span> <span class="org-variable-name">i</span>, <span class="org-variable-name">boo</span>, <span class="org-variable-name">w</span> = 10, <span class="org-variable-name">q</span> = 20;
-    <span class="org-keyword">for</span> (i = 1; i &lt; 10; ++i) {
-        boo = foo(a);
-    }
-    <span class="org-keyword">for</span> (i = 0; i &lt; 1; ++i) {
-        boo = bar(c);
-    }
-    <span class="org-keyword">function</span> <span class="org-function-name">foo</span>() { ... }
-    <span class="org-keyword">function</span> <span class="org-function-name">bar</span>() { ... }
-}
-</pre>
-
-
-<ul>
-<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>
-<li><code>defines</code> &ndash; an object with properties named after symbols to
-    replace (see the <code>--define</code> option for the script) and the values
-    representing the AST replacement value.
-
-</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>
-<li><code>inline_script: false</code> &ndash; pass <code>true</code> to escape occurrences of
-    <code>&lt;/script</code> in strings
-</li>
-</ul>
-
-</li>
-</ul>
-
-
-</div>
-
-</div>
-
-<div id="outline-container-1-4-2" class="outline-4">
-<h4 id="sec-1-4-2"><span class="section-number-4">1.4.2</span> Beautifier shortcoming &ndash; no more comments </h4>
-<div class="outline-text-4" id="text-1-4-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 id="outline-container-1-4-3" class="outline-4">
-<h4 id="sec-1-4-3"><span class="section-number-4">1.4.3</span> Use as a code pre-processor </h4>
-<div class="outline-text-4" id="text-1-4-3">
-
-
-<p>
-The <code>--define</code> option can be used, particularly when combined with the
-constant folding logic, as a form of pre-processor to enable or remove
-particular constructions, such as might be used for instrumenting
-development code, or to produce variations aimed at a specific
-platform.
-</p>
-<p>
-The code below illustrates the way this can be done, and how the
-symbol replacement is performed.
-</p>
-
-
-
-<pre class="src src-js">CLAUSE1: <span class="org-keyword">if</span> (<span class="org-keyword">typeof</span> DEVMODE === <span class="org-string">'undefined'</span>) {
-    DEVMODE = <span class="org-constant">true</span>;
-}
-
-<span class="org-function-name">CLAUSE2</span>: <span class="org-keyword">function</span> init() {
-    <span class="org-keyword">if</span> (DEVMODE) {
-        console.log(<span class="org-string">"init() called"</span>);
-    }
-    ....
-    DEVMODE &amp;amp;&amp;amp; console.log(<span class="org-string">"init() complete"</span>);
-}
-
-<span class="org-function-name">CLAUSE3</span>: <span class="org-keyword">function</span> reportDeviceStatus(<span class="org-variable-name">device</span>) {
-    <span class="org-keyword">var</span> <span class="org-variable-name">DEVMODE</span> = device.mode, <span class="org-variable-name">DEVNAME</span> = device.name;
-    <span class="org-keyword">if</span> (DEVMODE === <span class="org-string">'open'</span>) {
-        ....
-    }
-}
-</pre>
-
-
-<p>
-When the above code is normally executed, the undeclared global
-variable <code>DEVMODE</code> will be assigned the value <b>true</b> (see <code>CLAUSE1</code>)
-and so the <code>init()</code> function (<code>CLAUSE2</code>) will write messages to the
-console log when executed, but in <code>CLAUSE3</code> a locally declared
-variable will mask access to the <code>DEVMODE</code> global symbol.
-</p>
-<p>
-If the above code is processed by UglifyJS with an argument of
-<code>--define DEVMODE=false</code> then UglifyJS will replace <code>DEVMODE</code> with the
-boolean constant value <b>false</b> within <code>CLAUSE1</code> and <code>CLAUSE2</code>, but it
-will leave <code>CLAUSE3</code> as it stands because there <code>DEVMODE</code> resolves to
-a validly declared variable.
-</p>
-<p>
-And more so, the constant-folding features of UglifyJS will recognise
-that the <code>if</code> condition of <code>CLAUSE1</code> is thus always false, and so will
-remove the test and body of <code>CLAUSE1</code> altogether (including the
-otherwise slightly problematical statement <code>false = true;</code> which it
-will have formed by replacing <code>DEVMODE</code> in the body).  Similarly,
-within <code>CLAUSE2</code> both calls to <code>console.log()</code> will be removed
-altogether.
-</p>
-<p>
-In this way you can mimic, to a limited degree, the functionality of
-the C/C++ pre-processor to enable or completely remove blocks
-depending on how certain symbols are defined - perhaps using UglifyJS
-to generate different versions of source aimed at different
-environments
-</p>
-<p>
-It is recommmended (but not made mandatory) that symbols designed for
-this purpose are given names consisting of <code>UPPER_CASE_LETTERS</code> to
-distinguish them from other (normal) symbols and avoid the sort of
-clash that <code>CLAUSE3</code> above illustrates.
-</p>
-</div>
-</div>
-
-</div>
-
-<div id="outline-container-1-5" class="outline-3">
-<h3 id="sec-1-5"><span class="section-number-3">1.5</span> Compression &ndash; how good is it? </h3>
-<div class="outline-text-3" id="text-1-5">
-
-
-<p>
-Here are updated statistics.  (I also updated my Google Closure and YUI
-installations).
-</p>
-<p>
-We're still a lot better than YUI in terms of compression, though slightly
-slower.  We're still a lot faster than Closure, and compression after gzip
-is comparable.
-</p>
-<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
-<caption></caption>
-<colgroup><col class="left" /><col class="left" /><col class="right" /><col class="left" /><col class="right" /><col class="left" /><col class="right" />
-</colgroup>
-<thead>
-<tr><th scope="col" class="left">File</th><th scope="col" class="left">UglifyJS</th><th scope="col" class="right">UglifyJS+gzip</th><th scope="col" class="left">Closure</th><th scope="col" class="right">Closure+gzip</th><th scope="col" class="left">YUI</th><th scope="col" class="right">YUI+gzip</th></tr>
-</thead>
-<tbody>
-<tr><td class="left">jquery-1.6.2.js</td><td class="left">91001 (0:01.59)</td><td class="right">31896</td><td class="left">90678 (0:07.40)</td><td class="right">31979</td><td class="left">101527 (0:01.82)</td><td class="right">34646</td></tr>
-<tr><td class="left">paper.js</td><td class="left">142023 (0:01.65)</td><td class="right">43334</td><td class="left">134301 (0:07.42)</td><td class="right">42495</td><td class="left">173383 (0:01.58)</td><td class="right">48785</td></tr>
-<tr><td class="left">prototype.js</td><td class="left">88544 (0:01.09)</td><td class="right">26680</td><td class="left">86955 (0:06.97)</td><td class="right">26326</td><td class="left">92130 (0:00.79)</td><td class="right">28624</td></tr>
-<tr><td class="left">thelib-full.js (DynarchLIB)</td><td class="left">251939 (0:02.55)</td><td class="right">72535</td><td class="left">249911 (0:09.05)</td><td class="right">72696</td><td class="left">258869 (0:01.94)</td><td class="right">76584</td></tr>
-</tbody>
-</table>
-
-
-</div>
-
-</div>
-
-<div id="outline-container-1-6" class="outline-3">
-<h3 id="sec-1-6"><span class="section-number-3">1.6</span> Bugs? </h3>
-<div class="outline-text-3" id="text-1-6">
-
-
-<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-7" class="outline-3">
-<h3 id="sec-1-7"><span class="section-number-3">1.7</span> Links </h3>
-<div class="outline-text-3" id="text-1-7">
-
-
-<ul>
-<li>Twitter: <a href="http://twitter.com/UglifyJS">@UglifyJS</a>
-</li>
-<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-8" class="outline-3">
-<h3 id="sec-1-8"><span class="section-number-3">1.8</span> License </h3>
-<div class="outline-text-3" id="text-1-8">
-
-
-<p>
-UglifyJS is released under the BSD license:
-</p>
-
-
-
-<pre class="example">Copyright 2010 (c) Mihai Bazon &lt;[email protected]&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 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>
-
-</div>
-</div>
-</div>
-
-<div id="postamble">
-<p class="date">Date: 2011-12-09 14:59:08 EET</p>
-<p class="author">Author: Mihai Bazon</p>
-<p class="creator">Org version 7.7 with Emacs version 23</p>
-<a href="http://validator.w3.org/check?uri=referer">Validate XHTML 1.0</a>
-
-</div>
-</body>
-</html>

+ 0 - 578
utils/node_modules/uglify-js/README.org

@@ -1,578 +0,0 @@
-#+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: [email protected]
-
-* UglifyJS --- a JavaScript parser/compressor/beautifier
-
-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).
-
-  - act a limited version of a pre-processor (c.f. the pre-processor of
-    C/C++) to allow you to safely replace selected global symbols with
-    specified values.  When combined with the optimisations above this can
-    make UglifyJS operate slightly more like a compilation process, in
-    that when certain symbols are replaced by constant values, entire code
-    blocks may be optimised away as unreachable.
-
-** <<Unsafe transformations>>
-
-The following transformations can in theory break code, although they're
-probably safe in most practical cases.  To enable them you need to pass the
-=--unsafe= flag.
-
-*** Calls involving the global Array constructor
-
-The following transformations occur:
-
-#+BEGIN_SRC js
-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 js
-// 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
-
-*** =obj.toString()= ==> =obj+“”=
-
-** Install (NPM)
-
-UglifyJS is now available through NPM --- =npm install uglify-js= should do
-the job.
-
-** Install latest code from GitHub
-
-#+BEGIN_SRC sh
-## clone the repository
-mkdir -p /where/you/wanna/put/it
-cd /where/you/wanna/put/it
-git clone git://github.com/mishoo/UglifyJS.git
-
-## make the module available to Node
-mkdir -p ~/.node_libraries/
-cd ~/.node_libraries/
-ln -s /where/you/wanna/put/it/UglifyJS/uglify-js.js
-
-## and if you want the CLI script too:
-mkdir -p ~/bin
-cd ~/bin
-ln -s /where/you/wanna/put/it/UglifyJS/bin/uglifyjs
-  # (then add ~/bin to your $PATH if it's not there already)
-#+END_SRC
-
-** Usage
-
-There is a command-line tool that exposes the functionality of this library
-for your shell-scripting needs:
-
-#+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).
-
-- =-c= or =----consolidate-primitive-values= --- consolidates null, Boolean,
-  and String values. Known as aliasing in the Closure Compiler. Worsens the
-  data compression ratio of gzip.
-
-- =--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 names.
-
-- =-nmf= or =--no-mangle-functions= -- in case you want to mangle variable
-  names, but not touch function 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).
-
-- =-d SYMBOL[=VALUE]= or =--define SYMBOL[=VALUE]= --- will replace
-  all instances of the specified symbol where used as an identifier
-  (except where symbol has properly declared by a var declaration or
-  use as function parameter or similar) with the specified value. This
-  argument may be specified multiple times to define multiple
-  symbols - if no value is specified the symbol will be replaced with
-  the value =true=, or you can specify a numeric value (such as
-  =1024=), a quoted string value (such as ="object"= or
-  ='https://github.com'=), or the name of another symbol or keyword
-  (such as =null= or =document=).
-  This allows you, for example, to assign meaningful names to key
-  constant values but discard the symbolic names in the uglified
-  version for brevity/efficiency, or when used wth care, allows
-  UglifyJS to operate as a form of *conditional compilation*
-  whereby defining appropriate values may, by dint of the constant
-  folding and dead code removal features above, remove entire
-  superfluous code blocks (e.g. completely remove instrumentation or
-  trace code for production use).
-  Where string values are being defined, the handling of quotes are
-  likely to be subject to the specifics of your command shell
-  environment, so you may need to experiment with quoting styles
-  depending on your platform, or you may find the option
-  =--define-from-module= more suitable for use.
-
-- =-define-from-module SOMEMODULE= --- will load the named module (as
-  per the NodeJS =require()= function) and iterate all the exported
-  properties of the module defining them as symbol names to be defined
-  (as if by the =--define= option) per the name of each property
-  (i.e. without the module name prefix) and given the value of the
-  property. This is a much easier way to handle and document groups of
-  symbols to be defined rather than a large number of =--define=
-  options.
-
-- =--unsafe= --- enable other additional optimizations that are known to be
-  unsafe in some contrived situations, but could still be generally useful.
-  For now only these:
-
-  - foo.toString()  ==>  foo+""
-  - new Array(x,...)  ==> [x,...]
-  - new Array(x) ==> Array(x)
-
-- =--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".
-
-- =--inline-script= -- when you want to include the output literally in an
-  HTML =<script>= tag you can use this option to prevent =</script= from
-  showing up in the output.
-
-- =--lift-vars= -- when you pass this, UglifyJS will apply the following
-  transformations (see the notes in API, =ast_lift_variables=):
-
-  - put all =var= declarations at the start of the scope
-  - make sure a variable is declared only once
-  - discard unused function arguments
-  - discard unused inner (named) functions
-  - finally, try to merge assignments into that one =var= declaration, if
-    possible.
-
-*** API
-
-To use the library from JavaScript, you'd do the following (example for
-NodeJS):
-
-#+BEGIN_SRC js
-var jsp = require("uglify-js").parser;
-var pro = require("uglify-js").uglify;
-
-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_lift_variables(ast)= -- merge and move =var= declarations to the
-  scop of the scope; discard unused function arguments or variables; discard
-  unused (named) inner functions.  It also tries to merge assignments
-  following the =var= declaration into it.
-
-  If your code is very hand-optimized concerning =var= declarations, this
-  lifting variable declarations might actually increase size.  For me it
-  helps out.  On jQuery it adds 865 bytes (243 after gzip).  YMMV.  Also
-  note that (since it's not enabled by default) this operation isn't yet
-  heavily tested (please report if you find issues!).
-
-  Note that although it might increase the image size (on jQuery it gains
-  865 bytes, 243 after gzip) it's technically more correct: in certain
-  situations, dead code removal might drop variable declarations, which
-  would not happen if the variables are lifted in advance.
-
-  Here's an example of what it does:
-
-#+BEGIN_SRC js
-function f(a, b, c, d, e) {
-    var q;
-    var w;
-    w = 10;
-    q = 20;
-    for (var i = 1; i < 10; ++i) {
-        var boo = foo(a);
-    }
-    for (var i = 0; i < 1; ++i) {
-        var boo = bar(c);
-    }
-    function foo(){ ... }
-    function bar(){ ... }
-    function baz(){ ... }
-}
-
-// transforms into ==>
-
-function f(a, b, c) {
-    var i, boo, w = 10, q = 20;
-    for (i = 1; i < 10; ++i) {
-        boo = foo(a);
-    }
-    for (i = 0; i < 1; ++i) {
-        boo = bar(c);
-    }
-    function foo() { ... }
-    function bar() { ... }
-}
-#+END_SRC
-
-- =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.
-  - =defines= -- an object with properties named after symbols to
-    replace (see the =--define= option for the script) and the values
-    representing the AST replacement value.
-
-- =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=.
-  - =inline_script: false= -- pass =true= to escape occurrences of
-    =</script= in strings
-
-*** 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.
-
-*** Use as a code pre-processor
-
-The =--define= option can be used, particularly when combined with the
-constant folding logic, as a form of pre-processor to enable or remove
-particular constructions, such as might be used for instrumenting
-development code, or to produce variations aimed at a specific
-platform.
-
-The code below illustrates the way this can be done, and how the
-symbol replacement is performed.
-
-#+BEGIN_SRC js
-CLAUSE1: if (typeof DEVMODE === 'undefined') {
-    DEVMODE = true;
-}
-
-CLAUSE2: function init() {
-    if (DEVMODE) {
-        console.log("init() called");
-    }
-    ....
-    DEVMODE &amp;&amp; console.log("init() complete");
-}
-
-CLAUSE3: function reportDeviceStatus(device) {
-    var DEVMODE = device.mode, DEVNAME = device.name;
-    if (DEVMODE === 'open') {
-        ....
-    }
-}
-#+END_SRC
-
-When the above code is normally executed, the undeclared global
-variable =DEVMODE= will be assigned the value *true* (see =CLAUSE1=)
-and so the =init()= function (=CLAUSE2=) will write messages to the
-console log when executed, but in =CLAUSE3= a locally declared
-variable will mask access to the =DEVMODE= global symbol.
-
-If the above code is processed by UglifyJS with an argument of
-=--define DEVMODE=false= then UglifyJS will replace =DEVMODE= with the
-boolean constant value *false* within =CLAUSE1= and =CLAUSE2=, but it
-will leave =CLAUSE3= as it stands because there =DEVMODE= resolves to
-a validly declared variable.
-
-And more so, the constant-folding features of UglifyJS will recognise
-that the =if= condition of =CLAUSE1= is thus always false, and so will
-remove the test and body of =CLAUSE1= altogether (including the
-otherwise slightly problematical statement =false = true;= which it
-will have formed by replacing =DEVMODE= in the body).  Similarly,
-within =CLAUSE2= both calls to =console.log()= will be removed
-altogether.
-
-In this way you can mimic, to a limited degree, the functionality of
-the C/C++ pre-processor to enable or completely remove blocks
-depending on how certain symbols are defined - perhaps using UglifyJS
-to generate different versions of source aimed at different
-environments
-
-It is recommmended (but not made mandatory) that symbols designed for
-this purpose are given names consisting of =UPPER_CASE_LETTERS= to
-distinguish them from other (normal) symbols and avoid the sort of
-clash that =CLAUSE3= above illustrates.
-
-** Compression -- how good is it?
-
-Here are updated statistics.  (I also updated my Google Closure and YUI
-installations).
-
-We're still a lot better than YUI in terms of compression, though slightly
-slower.  We're still a lot faster than Closure, and compression after gzip
-is comparable.
-
-| File                        | UglifyJS         | UglifyJS+gzip | Closure          | Closure+gzip | YUI              | YUI+gzip |
-|-----------------------------+------------------+---------------+------------------+--------------+------------------+----------|
-| jquery-1.6.2.js             | 91001 (0:01.59)  |         31896 | 90678 (0:07.40)  |        31979 | 101527 (0:01.82) |    34646 |
-| paper.js                    | 142023 (0:01.65) |         43334 | 134301 (0:07.42) |        42495 | 173383 (0:01.58) |    48785 |
-| prototype.js                | 88544 (0:01.09)  |         26680 | 86955 (0:06.97)  |        26326 | 92130 (0:00.79)  |    28624 |
-| thelib-full.js (DynarchLIB) | 251939 (0:02.55) |         72535 | 249911 (0:09.05) |        72696 | 258869 (0:01.94) |    76584 |
-
-** 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
-
-- Twitter: [[http://twitter.com/UglifyJS][@UglifyJS]]
-- 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 <[email protected]>
-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

+ 0 - 332
utils/node_modules/uglify-js/bin/uglifyjs

@@ -1,332 +0,0 @@
-#!/usr/bin/env node
-// -*- js -*-
-
-global.sys = require(/^v0\.[012]/.test(process.version) ? "sys" : "util");
-var fs = require("fs");
-var uglify = require("uglify-js"), // symlink ~/.node_libraries/uglify-js.js to ../uglify-js.js
-    consolidator = uglify.consolidator,
-    jsp = uglify.parser,
-    pro = uglify.uglify;
-
-var options = {
-        ast: false,
-        consolidate: false,
-        mangle: true,
-        mangle_toplevel: false,
-        no_mangle_functions: false,
-        squeeze: true,
-        make_seqs: true,
-        dead_code: true,
-        verbose: false,
-        show_copyright: true,
-        out_same_file: false,
-        max_line_length: 32 * 1024,
-        unsafe: false,
-        reserved_names: null,
-        defines: { },
-        lift_vars: false,
-        codegen_options: {
-                ascii_only: false,
-                beautify: false,
-                indent_level: 4,
-                indent_start: 0,
-                quote_keys: false,
-                space_colon: false,
-                inline_script: false
-        },
-        make: false,
-        output: true            // stdout
-};
-
-var args = jsp.slice(process.argv, 2);
-var filename;
-
-out: while (args.length > 0) {
-        var v = args.shift();
-        switch (v) {
-            case "-b":
-            case "--beautify":
-                options.codegen_options.beautify = true;
-                break;
-            case "-c":
-            case "--consolidate-primitive-values":
-                options.consolidate = true;
-                break;
-            case "-i":
-            case "--indent":
-                options.codegen_options.indent_level = args.shift();
-                break;
-            case "-q":
-            case "--quote-keys":
-                options.codegen_options.quote_keys = true;
-                break;
-            case "-mt":
-            case "--mangle-toplevel":
-                options.mangle_toplevel = true;
-                break;
-            case "-nmf":
-            case "--no-mangle-functions":
-                options.no_mangle_functions = true;
-                break;
-            case "--no-mangle":
-            case "-nm":
-                options.mangle = false;
-                break;
-            case "--no-squeeze":
-            case "-ns":
-                options.squeeze = false;
-                break;
-            case "--no-seqs":
-                options.make_seqs = false;
-                break;
-            case "--no-dead-code":
-                options.dead_code = false;
-                break;
-            case "--no-copyright":
-            case "-nc":
-                options.show_copyright = false;
-                break;
-            case "-o":
-            case "--output":
-                options.output = args.shift();
-                break;
-            case "--overwrite":
-                options.out_same_file = true;
-                break;
-            case "-v":
-            case "--verbose":
-                options.verbose = true;
-                break;
-            case "--ast":
-                options.ast = true;
-                break;
-            case "--unsafe":
-                options.unsafe = true;
-                break;
-            case "--max-line-len":
-                options.max_line_length = parseInt(args.shift(), 10);
-                break;
-            case "--reserved-names":
-                options.reserved_names = args.shift().split(",");
-                break;
-            case "--lift-vars":
-                options.lift_vars = true;
-                break;
-            case "-d":
-            case "--define":
-                 var defarg = args.shift();
-                 try {
-                     var defsym = function(sym) {
-                             // KEYWORDS_ATOM doesn't include NaN or Infinity - should we check
-                             // for them too ?? We don't check reserved words and the like as the
-                             // define values are only substituted AFTER parsing
-                             if (jsp.KEYWORDS_ATOM.hasOwnProperty(sym)) {
-                                 throw "Don't define values for inbuilt constant '"+sym+"'";
-                             }
-                             return sym;
-                         },
-                         defval = function(v) {
-                             if (v.match(/^"(.*)"$/) || v.match(/^'(.*)'$/)) {
-                                 return [ "string", RegExp.$1 ];
-                             }
-                             else if (!isNaN(parseFloat(v))) {
-                                 return [ "num", parseFloat(v) ];
-                             }
-                             else if (v.match(/^[a-z\$_][a-z\$_0-9]*$/i)) {
-                                 return [ "name", v ];
-                             }
-                             else if (!v.match(/"/)) {
-                                 return [ "string", v ];
-                             }
-                             else if (!v.match(/'/)) {
-                                 return [ "string", v ];
-                             }
-                             throw "Can't understand the specified value: "+v;
-                         };
-                     if (defarg.match(/^([a-z_\$][a-z_\$0-9]*)(=(.*))?$/i)) {
-                         var sym = defsym(RegExp.$1),
-                             val = RegExp.$2 ? defval(RegExp.$2.substr(1)) : [ 'name', 'true' ];
-                         options.defines[sym] = val;
-                     }
-                     else {
-                         throw "The --define option expects SYMBOL[=value]";
-                     }
-                 } catch(ex) {
-                     sys.print("ERROR: In option --define "+defarg+"\n"+ex+"\n");
-                     process.exit(1);
-                 }
-                 break;
-            case "--define-from-module":
-                var defmodarg = args.shift(),
-                    defmodule = require(defmodarg),
-                    sym,
-                    val;
-                for (sym in defmodule) {
-                    if (defmodule.hasOwnProperty(sym)) {
-                        options.defines[sym] = function(val) {
-                            if (typeof val == "string")
-                                return [ "string", val ];
-                            if (typeof val == "number")
-                                return [ "num", val ];
-                            if (val === true)
-                                return [ 'name', 'true' ];
-                            if (val === false)
-                                return [ 'name', 'false' ];
-                            if (val === null)
-                                return [ 'name', 'null' ];
-                            if (val === undefined)
-                                return [ 'name', 'undefined' ];
-                            sys.print("ERROR: In option --define-from-module "+defmodarg+"\n");
-                            sys.print("ERROR: Unknown object type for: "+sym+"="+val+"\n");
-                            process.exit(1);
-                            return null;
-                        }(defmodule[sym]);
-                    }
-                }
-                break;
-            case "--ascii":
-                options.codegen_options.ascii_only = true;
-                break;
-            case "--make":
-                options.make = true;
-                break;
-            case "--inline-script":
-                options.codegen_options.inline_script = true;
-                break;
-            default:
-                filename = v;
-                break out;
-        }
-}
-
-if (options.verbose) {
-        pro.set_logger(function(msg){
-                sys.debug(msg);
-        });
-}
-
-jsp.set_logger(function(msg){
-        sys.debug(msg);
-});
-
-if (options.make) {
-        options.out_same_file = false; // doesn't make sense in this case
-        var makefile = JSON.parse(fs.readFileSync(filename || "Makefile.uglify.js").toString());
-        output(makefile.files.map(function(file){
-                var code = fs.readFileSync(file.name);
-                if (file.module) {
-                        code = "!function(exports, global){global = this;\n" + code + "\n;this." + file.module + " = exports;}({})";
-                }
-                else if (file.hide) {
-                        code = "(function(){" + code + "}());";
-                }
-                return squeeze_it(code);
-        }).join("\n"));
-}
-else if (filename) {
-        fs.readFile(filename, "utf8", function(err, text){
-                if (err) throw err;
-                output(squeeze_it(text));
-        });
-}
-else {
-        var stdin = process.openStdin();
-        stdin.setEncoding("utf8");
-        var text = "";
-        stdin.on("data", function(chunk){
-                text += chunk;
-        });
-        stdin.on("end", function() {
-                output(squeeze_it(text));
-        });
-}
-
-function output(text) {
-        var out;
-        if (options.out_same_file && filename)
-                options.output = filename;
-        if (options.output === true) {
-                out = process.stdout;
-        } else {
-                out = fs.createWriteStream(options.output, {
-                        flags: "w",
-                        encoding: "utf8",
-                        mode: 0644
-                });
-        }
-        out.write(text.replace(/;*$/, ";"));
-        if (options.output !== true) {
-                out.end();
-        }
-};
-
-// --------- main ends here.
-
-function show_copyright(comments) {
-        var ret = "";
-        for (var i = 0; i < comments.length; ++i) {
-                var c = comments[i];
-                if (c.type == "comment1") {
-                        ret += "//" + c.value + "\n";
-                } else {
-                        ret += "/*" + c.value + "*/";
-                }
-        }
-        return ret;
-};
-
-function squeeze_it(code) {
-        var result = "";
-        if (options.show_copyright) {
-                var tok = jsp.tokenizer(code), c;
-                c = tok();
-                result += show_copyright(c.comments_before);
-        }
-        try {
-                var ast = time_it("parse", function(){ return jsp.parse(code); });
-                if (options.consolidate) ast = time_it("consolidate", function(){
-                        return consolidator.ast_consolidate(ast);
-                });
-                if (options.lift_vars) {
-                        ast = time_it("lift", function(){ return pro.ast_lift_variables(ast); });
-                }
-                if (options.mangle) ast = time_it("mangle", function(){
-                        return pro.ast_mangle(ast, {
-                                toplevel     : options.mangle_toplevel,
-                                defines      : options.defines,
-                                except       : options.reserved_names,
-                                no_functions : options.no_mangle_functions
-                        });
-                });
-                if (options.squeeze) ast = time_it("squeeze", function(){
-                        ast = pro.ast_squeeze(ast, {
-                                make_seqs  : options.make_seqs,
-                                dead_code  : options.dead_code,
-                                keep_comps : !options.unsafe
-                        });
-                        if (options.unsafe)
-                                ast = pro.ast_squeeze_more(ast);
-                        return ast;
-                });
-                if (options.ast)
-                        return sys.inspect(ast, null, null);
-                result += time_it("generate", function(){ return pro.gen_code(ast, options.codegen_options) });
-                if (!options.codegen_options.beautify && options.max_line_length) {
-                        result = time_it("split", function(){ return pro.split_lines(result, options.max_line_length) });
-                }
-                return result;
-        } catch(ex) {
-                sys.debug(ex.stack);
-                sys.debug(sys.inspect(ex));
-                sys.debug(JSON.stringify(ex));
-                process.exit(1);
-        }
-};
-
-function time_it(name, cont) {
-        if (!options.verbose)
-                return cont();
-        var t1 = new Date().getTime();
-        try { return cont(); }
-        finally { sys.debug("// " + name + ": " + ((new Date().getTime() - t1) / 1000).toFixed(3) + " sec."); }
-};

+ 0 - 75
utils/node_modules/uglify-js/docstyle.css

@@ -1,75 +0,0 @@
-html { font-family: "Lucida Grande","Trebuchet MS",sans-serif; font-size: 12pt; }
-body { max-width: 60em; }
-.title  { text-align: center; }
-.todo   { color: red; }
-.done   { color: green; }
-.tag    { background-color:lightblue; font-weight:normal }
-.target { }
-.timestamp { color: grey }
-.timestamp-kwd { color: CadetBlue }
-p.verse { margin-left: 3% }
-pre {
-  border: 1pt solid #AEBDCC;
-  background-color: #F3F5F7;
-  padding: 5pt;
-  font-family: monospace;
-  font-size: 90%;
-  overflow:auto;
-}
-pre.src {
-  background-color: #eee; color: #112; border: 1px solid #000;
-}
-table { border-collapse: collapse; }
-td, th { vertical-align: top; }
-dt { font-weight: bold; }
-div.figure { padding: 0.5em; }
-div.figure p { text-align: center; }
-.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; }
-
-sup {
-  vertical-align: baseline;
-  position: relative;
-  top: -0.5em;
-  font-size: 80%;
-}
-
-sup a:link, sup a:visited {
-  text-decoration: none;
-  color: #c00;
-}
-
-sup a:before { content: "["; color: #999; }
-sup a:after { content: "]"; color: #999; }
-
-h1.title { border-bottom: 4px solid #000; padding-bottom: 5px; margin-bottom: 2em; }
-
-#postamble {
-  color: #777;
-  font-size: 90%;
-  padding-top: 1em; padding-bottom: 1em; border-top: 1px solid #999;
-  margin-top: 2em;
-  padding-left: 2em;
-  padding-right: 2em;
-  text-align: right;
-}
-
-#postamble p { margin: 0; }
-
-#footnotes { border-top: 1px solid #000; }
-
-h1 { font-size: 200% }
-h2 { font-size: 175% }
-h3 { font-size: 150% }
-h4 { font-size: 125% }
-
-h1, h2, h3, h4 { font-family: "Bookman",Georgia,"Times New Roman",serif; font-weight: normal; }
-
-@media print {
-  html { font-size: 11pt; }
-}

+ 0 - 2599
utils/node_modules/uglify-js/lib/consolidator.js

@@ -1,2599 +0,0 @@
-/**
- * @preserve Copyright 2012 Robert Gust-Bardon <http://robert.gust-bardon.org/>.
- * All rights reserved.
- *
- * 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.
- */
-
-/**
- * @fileoverview Enhances <a href="https://github.com/mishoo/UglifyJS/"
- * >UglifyJS</a> with consolidation of null, Boolean, and String values.
- * <p>Also known as aliasing, this feature has been deprecated in <a href=
- * "http://closure-compiler.googlecode.com/">the Closure Compiler</a> since its
- * initial release, where it is unavailable from the <abbr title=
- * "command line interface">CLI</a>. The Closure Compiler allows one to log and
- * influence this process. In contrast, this implementation does not introduce
- * any variable declarations in global code and derives String values from
- * identifier names used as property accessors.</p>
- * <p>Consolidating literals may worsen the data compression ratio when an <a
- * href="http://tools.ietf.org/html/rfc2616#section-3.5">encoding
- * transformation</a> is applied. For instance, <a href=
- * "http://code.jquery.com/jquery-1.7.1.js">jQuery 1.7.1</a> takes 248235 bytes.
- * Building it with <a href="https://github.com/mishoo/UglifyJS/tarball/v1.2.5">
- * UglifyJS v1.2.5</a> results in 93647 bytes (37.73% of the original) which are
- * then compressed to 33154 bytes (13.36% of the original) using <a href=
- * "http://linux.die.net/man/1/gzip">gzip(1)</a>. Building it with the same
- * version of UglifyJS 1.2.5 patched with the implementation of consolidation
- * results in 80784 bytes (a decrease of 12863 bytes, i.e. 13.74%, in comparison
- * to the aforementioned 93647 bytes) which are then compressed to 34013 bytes
- * (an increase of 859 bytes, i.e. 2.59%, in comparison to the aforementioned
- * 33154 bytes).</p>
- * <p>Written in <a href="http://es5.github.com/#x4.2.2">the strict variant</a>
- * of <a href="http://es5.github.com/">ECMA-262 5.1 Edition</a>. Encoded in <a
- * href="http://tools.ietf.org/html/rfc3629">UTF-8</a>. Follows <a href=
- * "http://google-styleguide.googlecode.com/svn-history/r76/trunk/javascriptguide.xml"
- * >Revision 2.28 of the Google JavaScript Style Guide</a> (except for the
- * discouraged use of the {@code function} tag and the {@code namespace} tag).
- * 100% typed for the <a href=
- * "http://closure-compiler.googlecode.com/files/compiler-20120123.tar.gz"
- * >Closure Compiler Version 1741</a>.</p>
- * <p>Should you find this software useful, please consider <a href=
- * "https://paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=JZLW72X8FD4WG"
- * >a donation</a>.</p>
- * @author follow.me@RGustBardon (Robert Gust-Bardon)
- * @supported Tested with:
- *     <ul>
- *     <li><a href="http://nodejs.org/dist/v0.6.10/">Node v0.6.10</a>,</li>
- *     <li><a href="https://github.com/mishoo/UglifyJS/tarball/v1.2.5">UglifyJS
- *       v1.2.5</a>.</li>
- *     </ul>
- */
-
-/*global console:false, exports:true, module:false, require:false */
-/*jshint sub:true */
-/**
- * Consolidates null, Boolean, and String values found inside an <abbr title=
- * "abstract syntax tree">AST</abbr>.
- * @param {!TSyntacticCodeUnit} oAbstractSyntaxTree An array-like object
- *     representing an <abbr title="abstract syntax tree">AST</abbr>.
- * @return {!TSyntacticCodeUnit} An array-like object representing an <abbr
- *     title="abstract syntax tree">AST</abbr> with its null, Boolean, and
- *     String values consolidated.
- */
-// TODO(user) Consolidation of mathematical values found in numeric literals.
-// TODO(user) Unconsolidation.
-// TODO(user) Consolidation of ECMA-262 6th Edition programs.
-// TODO(user) Rewrite in ECMA-262 6th Edition.
-exports['ast_consolidate'] = function(oAbstractSyntaxTree) {
-  'use strict';
-  /*jshint bitwise:true, curly:true, eqeqeq:true, forin:true, immed:true,
-        latedef:true, newcap:true, noarge:true, noempty:true, nonew:true,
-        onevar:true, plusplus:true, regexp:true, undef:true, strict:true,
-        sub:false, trailing:true */
-
-  var _,
-      /**
-       * A record consisting of data about one or more source elements.
-       * @constructor
-       * @nosideeffects
-       */
-      TSourceElementsData = function() {
-        /**
-         * The category of the elements.
-         * @type {number}
-         * @see ESourceElementCategories
-         */
-        this.nCategory = ESourceElementCategories.N_OTHER;
-        /**
-         * The number of occurrences (within the elements) of each primitive
-         * value that could be consolidated.
-         * @type {!Array.<!Object.<string, number>>}
-         */
-        this.aCount = [];
-        this.aCount[EPrimaryExpressionCategories.N_IDENTIFIER_NAMES] = {};
-        this.aCount[EPrimaryExpressionCategories.N_STRING_LITERALS] = {};
-        this.aCount[EPrimaryExpressionCategories.N_NULL_AND_BOOLEAN_LITERALS] =
-            {};
-        /**
-         * Identifier names found within the elements.
-         * @type {!Array.<string>}
-         */
-        this.aIdentifiers = [];
-        /**
-         * Prefixed representation Strings of each primitive value that could be
-         * consolidated within the elements.
-         * @type {!Array.<string>}
-         */
-        this.aPrimitiveValues = [];
-      },
-      /**
-       * A record consisting of data about a primitive value that could be
-       * consolidated.
-       * @constructor
-       * @nosideeffects
-       */
-      TPrimitiveValue = function() {
-        /**
-         * The difference in the number of terminal symbols between the original
-         * source text and the one with the primitive value consolidated. If the
-         * difference is positive, the primitive value is considered worthwhile.
-         * @type {number}
-         */
-        this.nSaving = 0;
-        /**
-         * An identifier name of the variable that will be declared and assigned
-         * the primitive value if the primitive value is consolidated.
-         * @type {string}
-         */
-        this.sName = '';
-      },
-      /**
-       * A record consisting of data on what to consolidate within the range of
-       * source elements that is currently being considered.
-       * @constructor
-       * @nosideeffects
-       */
-      TSolution = function() {
-        /**
-         * An object whose keys are prefixed representation Strings of each
-         * primitive value that could be consolidated within the elements and
-         * whose values are corresponding data about those primitive values.
-         * @type {!Object.<string, {nSaving: number, sName: string}>}
-         * @see TPrimitiveValue
-         */
-        this.oPrimitiveValues = {};
-        /**
-         * The difference in the number of terminal symbols between the original
-         * source text and the one with all the worthwhile primitive values
-         * consolidated.
-         * @type {number}
-         * @see TPrimitiveValue#nSaving
-         */
-        this.nSavings = 0;
-      },
-      /**
-       * The processor of <abbr title="abstract syntax tree">AST</abbr>s found
-       * in UglifyJS.
-       * @namespace
-       * @type {!TProcessor}
-       */
-      oProcessor = (/** @type {!TProcessor} */ require('./process')),
-      /**
-       * A record consisting of a number of constants that represent the
-       * difference in the number of terminal symbols between a source text with
-       * a modified syntactic code unit and the original one.
-       * @namespace
-       * @type {!Object.<string, number>}
-       */
-      oWeights = {
-        /**
-         * The difference in the number of punctuators required by the bracket
-         * notation and the dot notation.
-         * <p><code>'[]'.length - '.'.length</code></p>
-         * @const
-         * @type {number}
-         */
-        N_PROPERTY_ACCESSOR: 1,
-        /**
-         * The number of punctuators required by a variable declaration with an
-         * initialiser.
-         * <p><code>':'.length + ';'.length</code></p>
-         * @const
-         * @type {number}
-         */
-        N_VARIABLE_DECLARATION: 2,
-        /**
-         * The number of terminal symbols required to introduce a variable
-         * statement (excluding its variable declaration list).
-         * <p><code>'var '.length</code></p>
-         * @const
-         * @type {number}
-         */
-        N_VARIABLE_STATEMENT_AFFIXATION: 4,
-        /**
-         * The number of terminal symbols needed to enclose source elements
-         * within a function call with no argument values to a function with an
-         * empty parameter list.
-         * <p><code>'(function(){}());'.length</code></p>
-         * @const
-         * @type {number}
-         */
-        N_CLOSURE: 17
-      },
-      /**
-       * Categories of primary expressions from which primitive values that
-       * could be consolidated are derivable.
-       * @namespace
-       * @enum {number}
-       */
-      EPrimaryExpressionCategories = {
-        /**
-         * Identifier names used as property accessors.
-         * @type {number}
-         */
-        N_IDENTIFIER_NAMES: 0,
-        /**
-         * String literals.
-         * @type {number}
-         */
-        N_STRING_LITERALS: 1,
-        /**
-         * Null and Boolean literals.
-         * @type {number}
-         */
-        N_NULL_AND_BOOLEAN_LITERALS: 2
-      },
-      /**
-       * Prefixes of primitive values that could be consolidated.
-       * The String values of the prefixes must have same number of characters.
-       * The prefixes must not be used in any properties defined in any version
-       * of <a href=
-       * "http://www.ecma-international.org/publications/standards/Ecma-262.htm"
-       * >ECMA-262</a>.
-       * @namespace
-       * @enum {string}
-       */
-      EValuePrefixes = {
-        /**
-         * Identifies String values.
-         * @type {string}
-         */
-        S_STRING: '#S',
-        /**
-         * Identifies null and Boolean values.
-         * @type {string}
-         */
-        S_SYMBOLIC: '#O'
-      },
-      /**
-       * Categories of source elements in terms of their appropriateness of
-       * having their primitive values consolidated.
-       * @namespace
-       * @enum {number}
-       */
-      ESourceElementCategories = {
-        /**
-         * Identifies a source element that includes the <a href=
-         * "http://es5.github.com/#x12.10">{@code with}</a> statement.
-         * @type {number}
-         */
-        N_WITH: 0,
-        /**
-         * Identifies a source element that includes the <a href=
-         * "http://es5.github.com/#x15.1.2.1">{@code eval}</a> identifier name.
-         * @type {number}
-         */
-        N_EVAL: 1,
-        /**
-         * Identifies a source element that must be excluded from the process
-         * unless its whole scope is examined.
-         * @type {number}
-         */
-        N_EXCLUDABLE: 2,
-        /**
-         * Identifies source elements not posing any problems.
-         * @type {number}
-         */
-        N_OTHER: 3
-      },
-      /**
-       * The list of literals (other than the String ones) whose primitive
-       * values can be consolidated.
-       * @const
-       * @type {!Array.<string>}
-       */
-      A_OTHER_SUBSTITUTABLE_LITERALS = [
-        'null',   // The null literal.
-        'false',  // The Boolean literal {@code false}.
-        'true'    // The Boolean literal {@code true}.
-      ];
-
-  (/**
-    * Consolidates all worthwhile primitive values in a syntactic code unit.
-    * @param {!TSyntacticCodeUnit} oSyntacticCodeUnit An array-like object
-    *     representing the branch of the abstract syntax tree representing the
-    *     syntactic code unit along with its scope.
-    * @see TPrimitiveValue#nSaving
-    */
-   function fExamineSyntacticCodeUnit(oSyntacticCodeUnit) {
-     var _,
-         /**
-          * Indicates whether the syntactic code unit represents global code.
-          * @type {boolean}
-          */
-         bIsGlobal = 'toplevel' === oSyntacticCodeUnit[0],
-         /**
-          * Indicates whether the whole scope is being examined.
-          * @type {boolean}
-          */
-         bIsWhollyExaminable = !bIsGlobal,
-         /**
-          * An array-like object representing source elements that constitute a
-          * syntactic code unit.
-          * @type {!TSyntacticCodeUnit}
-          */
-         oSourceElements,
-         /**
-          * A record consisting of data about the source element that is
-          * currently being examined.
-          * @type {!TSourceElementsData}
-          */
-         oSourceElementData,
-         /**
-          * The scope of the syntactic code unit.
-          * @type {!TScope}
-          */
-         oScope,
-         /**
-          * An instance of an object that allows the traversal of an <abbr
-          * title="abstract syntax tree">AST</abbr>.
-          * @type {!TWalker}
-          */
-         oWalker,
-         /**
-          * An object encompassing collections of functions used during the
-          * traversal of an <abbr title="abstract syntax tree">AST</abbr>.
-          * @namespace
-          * @type {!Object.<string, !Object.<string, function(...[*])>>}
-          */
-         oWalkers = {
-           /**
-            * A collection of functions used during the surveyance of source
-            * elements.
-            * @namespace
-            * @type {!Object.<string, function(...[*])>}
-            */
-           oSurveySourceElement: {
-             /**#nocode+*/  // JsDoc Toolkit 2.4.0 hides some of the keys.
-             /**
-              * Classifies the source element as excludable if it does not
-              * contain a {@code with} statement or the {@code eval} identifier
-              * name. Adds the identifier of the function and its formal
-              * parameters to the list of identifier names found.
-              * @param {string} sIdentifier The identifier of the function.
-              * @param {!Array.<string>} aFormalParameterList Formal parameters.
-              * @param {!TSyntacticCodeUnit} oFunctionBody Function code.
-              */
-             'defun': function(
-                 sIdentifier,
-                 aFormalParameterList,
-                 oFunctionBody) {
-               fClassifyAsExcludable();
-               fAddIdentifier(sIdentifier);
-               aFormalParameterList.forEach(fAddIdentifier);
-             },
-             /**
-              * Increments the count of the number of occurrences of the String
-              * value that is equivalent to the sequence of terminal symbols
-              * that constitute the encountered identifier name.
-              * @param {!TSyntacticCodeUnit} oExpression The nonterminal
-              *     MemberExpression.
-              * @param {string} sIdentifierName The identifier name used as the
-              *     property accessor.
-              * @return {!Array} The encountered branch of an <abbr title=
-              *     "abstract syntax tree">AST</abbr> with its nonterminal
-              *     MemberExpression traversed.
-              */
-             'dot': function(oExpression, sIdentifierName) {
-               fCountPrimaryExpression(
-                   EPrimaryExpressionCategories.N_IDENTIFIER_NAMES,
-                   EValuePrefixes.S_STRING + sIdentifierName);
-               return ['dot', oWalker.walk(oExpression), sIdentifierName];
-             },
-             /**
-              * Adds the optional identifier of the function and its formal
-              * parameters to the list of identifier names found.
-              * @param {?string} sIdentifier The optional identifier of the
-              *     function.
-              * @param {!Array.<string>} aFormalParameterList Formal parameters.
-              * @param {!TSyntacticCodeUnit} oFunctionBody Function code.
-              */
-             'function': function(
-                 sIdentifier,
-                 aFormalParameterList,
-                 oFunctionBody) {
-               if ('string' === typeof sIdentifier) {
-                 fAddIdentifier(sIdentifier);
-               }
-               aFormalParameterList.forEach(fAddIdentifier);
-             },
-             /**
-              * Either increments the count of the number of occurrences of the
-              * encountered null or Boolean value or classifies a source element
-              * as containing the {@code eval} identifier name.
-              * @param {string} sIdentifier The identifier encountered.
-              */
-             'name': function(sIdentifier) {
-               if (-1 !== A_OTHER_SUBSTITUTABLE_LITERALS.indexOf(sIdentifier)) {
-                 fCountPrimaryExpression(
-                     EPrimaryExpressionCategories.N_NULL_AND_BOOLEAN_LITERALS,
-                     EValuePrefixes.S_SYMBOLIC + sIdentifier);
-               } else {
-                 if ('eval' === sIdentifier) {
-                   oSourceElementData.nCategory =
-                       ESourceElementCategories.N_EVAL;
-                 }
-                 fAddIdentifier(sIdentifier);
-               }
-             },
-             /**
-              * Classifies the source element as excludable if it does not
-              * contain a {@code with} statement or the {@code eval} identifier
-              * name.
-              * @param {TSyntacticCodeUnit} oExpression The expression whose
-              *     value is to be returned.
-              */
-             'return': function(oExpression) {
-               fClassifyAsExcludable();
-             },
-             /**
-              * Increments the count of the number of occurrences of the
-              * encountered String value.
-              * @param {string} sStringValue The String value of the string
-              *     literal encountered.
-              */
-             'string': function(sStringValue) {
-               if (sStringValue.length > 0) {
-                 fCountPrimaryExpression(
-                     EPrimaryExpressionCategories.N_STRING_LITERALS,
-                     EValuePrefixes.S_STRING + sStringValue);
-               }
-             },
-             /**
-              * Adds the identifier reserved for an exception to the list of
-              * identifier names found.
-              * @param {!TSyntacticCodeUnit} oTry A block of code in which an
-              *     exception can occur.
-              * @param {Array} aCatch The identifier reserved for an exception
-              *     and a block of code to handle the exception.
-              * @param {TSyntacticCodeUnit} oFinally An optional block of code
-              *     to be evaluated regardless of whether an exception occurs.
-              */
-             'try': function(oTry, aCatch, oFinally) {
-               if (Array.isArray(aCatch)) {
-                 fAddIdentifier(aCatch[0]);
-               }
-             },
-             /**
-              * Classifies the source element as excludable if it does not
-              * contain a {@code with} statement or the {@code eval} identifier
-              * name. Adds the identifier of each declared variable to the list
-              * of identifier names found.
-              * @param {!Array.<!Array>} aVariableDeclarationList Variable
-              *     declarations.
-              */
-             'var': function(aVariableDeclarationList) {
-               fClassifyAsExcludable();
-               aVariableDeclarationList.forEach(fAddVariable);
-             },
-             /**
-              * Classifies a source element as containing the {@code with}
-              * statement.
-              * @param {!TSyntacticCodeUnit} oExpression An expression whose
-              *     value is to be converted to a value of type Object and
-              *     become the binding object of a new object environment
-              *     record of a new lexical environment in which the statement
-              *     is to be executed.
-              * @param {!TSyntacticCodeUnit} oStatement The statement to be
-              *     executed in the augmented lexical environment.
-              * @return {!Array} An empty array to stop the traversal.
-              */
-             'with': function(oExpression, oStatement) {
-               oSourceElementData.nCategory = ESourceElementCategories.N_WITH;
-               return [];
-             }
-             /**#nocode-*/  // JsDoc Toolkit 2.4.0 hides some of the keys.
-           },
-           /**
-            * A collection of functions used while looking for nested functions.
-            * @namespace
-            * @type {!Object.<string, function(...[*])>}
-            */
-           oExamineFunctions: {
-             /**#nocode+*/  // JsDoc Toolkit 2.4.0 hides some of the keys.
-             /**
-              * Orders an examination of a nested function declaration.
-              * @this {!TSyntacticCodeUnit} An array-like object representing
-              *     the branch of an <abbr title="abstract syntax tree"
-              *     >AST</abbr> representing the syntactic code unit along with
-              *     its scope.
-              * @return {!Array} An empty array to stop the traversal.
-              */
-             'defun': function() {
-               fExamineSyntacticCodeUnit(this);
-               return [];
-             },
-             /**
-              * Orders an examination of a nested function expression.
-              * @this {!TSyntacticCodeUnit} An array-like object representing
-              *     the branch of an <abbr title="abstract syntax tree"
-              *     >AST</abbr> representing the syntactic code unit along with
-              *     its scope.
-              * @return {!Array} An empty array to stop the traversal.
-              */
-             'function': function() {
-               fExamineSyntacticCodeUnit(this);
-               return [];
-             }
-             /**#nocode-*/  // JsDoc Toolkit 2.4.0 hides some of the keys.
-           }
-         },
-         /**
-          * Records containing data about source elements.
-          * @type {Array.<TSourceElementsData>}
-          */
-         aSourceElementsData = [],
-         /**
-          * The index (in the source text order) of the source element
-          * immediately following a <a href="http://es5.github.com/#x14.1"
-          * >Directive Prologue</a>.
-          * @type {number}
-          */
-         nAfterDirectivePrologue = 0,
-         /**
-          * The index (in the source text order) of the source element that is
-          * currently being considered.
-          * @type {number}
-          */
-         nPosition,
-         /**
-          * The index (in the source text order) of the source element that is
-          * the last element of the range of source elements that is currently
-          * being considered.
-          * @type {(undefined|number)}
-          */
-         nTo,
-         /**
-          * Initiates the traversal of a source element.
-          * @param {!TWalker} oWalker An instance of an object that allows the
-          *     traversal of an abstract syntax tree.
-          * @param {!TSyntacticCodeUnit} oSourceElement A source element from
-          *     which the traversal should commence.
-          * @return {function(): !TSyntacticCodeUnit} A function that is able to
-          *     initiate the traversal from a given source element.
-          */
-         cContext = function(oWalker, oSourceElement) {
-           /**
-            * @return {!TSyntacticCodeUnit} A function that is able to
-            *     initiate the traversal from a given source element.
-            */
-           var fLambda = function() {
-             return oWalker.walk(oSourceElement);
-           };
-
-           return fLambda;
-         },
-         /**
-          * Classifies the source element as excludable if it does not
-          * contain a {@code with} statement or the {@code eval} identifier
-          * name.
-          */
-         fClassifyAsExcludable = function() {
-           if (oSourceElementData.nCategory ===
-               ESourceElementCategories.N_OTHER) {
-             oSourceElementData.nCategory =
-                 ESourceElementCategories.N_EXCLUDABLE;
-           }
-         },
-         /**
-          * Adds an identifier to the list of identifier names found.
-          * @param {string} sIdentifier The identifier to be added.
-          */
-         fAddIdentifier = function(sIdentifier) {
-           if (-1 === oSourceElementData.aIdentifiers.indexOf(sIdentifier)) {
-             oSourceElementData.aIdentifiers.push(sIdentifier);
-           }
-         },
-         /**
-          * Adds the identifier of a variable to the list of identifier names
-          * found.
-          * @param {!Array} aVariableDeclaration A variable declaration.
-          */
-         fAddVariable = function(aVariableDeclaration) {
-           fAddIdentifier(/** @type {string} */ aVariableDeclaration[0]);
-         },
-         /**
-          * Increments the count of the number of occurrences of the prefixed
-          * String representation attributed to the primary expression.
-          * @param {number} nCategory The category of the primary expression.
-          * @param {string} sName The prefixed String representation attributed
-          *     to the primary expression.
-          */
-         fCountPrimaryExpression = function(nCategory, sName) {
-           if (!oSourceElementData.aCount[nCategory].hasOwnProperty(sName)) {
-             oSourceElementData.aCount[nCategory][sName] = 0;
-             if (-1 === oSourceElementData.aPrimitiveValues.indexOf(sName)) {
-               oSourceElementData.aPrimitiveValues.push(sName);
-             }
-           }
-           oSourceElementData.aCount[nCategory][sName] += 1;
-         },
-         /**
-          * Consolidates all worthwhile primitive values in a range of source
-          *     elements.
-          * @param {number} nFrom The index (in the source text order) of the
-          *     source element that is the first element of the range.
-          * @param {number} nTo The index (in the source text order) of the
-          *     source element that is the last element of the range.
-          * @param {boolean} bEnclose Indicates whether the range should be
-          *     enclosed within a function call with no argument values to a
-          *     function with an empty parameter list if any primitive values
-          *     are consolidated.
-          * @see TPrimitiveValue#nSaving
-          */
-         fExamineSourceElements = function(nFrom, nTo, bEnclose) {
-           var _,
-               /**
-                * The index of the last mangled name.
-                * @type {number}
-                */
-               nIndex = oScope.cname,
-               /**
-                * The index of the source element that is currently being
-                * considered.
-                * @type {number}
-                */
-               nPosition,
-               /**
-                * A collection of functions used during the consolidation of
-                * primitive values and identifier names used as property
-                * accessors.
-                * @namespace
-                * @type {!Object.<string, function(...[*])>}
-                */
-               oWalkersTransformers = {
-                 /**
-                  * If the String value that is equivalent to the sequence of
-                  * terminal symbols that constitute the encountered identifier
-                  * name is worthwhile, a syntactic conversion from the dot
-                  * notation to the bracket notation ensues with that sequence
-                  * being substituted by an identifier name to which the value
-                  * is assigned.
-                  * Applies to property accessors that use the dot notation.
-                  * @param {!TSyntacticCodeUnit} oExpression The nonterminal
-                  *     MemberExpression.
-                  * @param {string} sIdentifierName The identifier name used as
-                  *     the property accessor.
-                  * @return {!Array} A syntactic code unit that is equivalent to
-                  *     the one encountered.
-                  * @see TPrimitiveValue#nSaving
-                  */
-                 'dot': function(oExpression, sIdentifierName) {
-                   /**
-                    * The prefixed String value that is equivalent to the
-                    * sequence of terminal symbols that constitute the
-                    * encountered identifier name.
-                    * @type {string}
-                    */
-                   var sPrefixed = EValuePrefixes.S_STRING + sIdentifierName;
-
-                   return oSolutionBest.oPrimitiveValues.hasOwnProperty(
-                       sPrefixed) &&
-                       oSolutionBest.oPrimitiveValues[sPrefixed].nSaving > 0 ?
-                       ['sub',
-                        oWalker.walk(oExpression),
-                        ['name',
-                         oSolutionBest.oPrimitiveValues[sPrefixed].sName]] :
-                       ['dot', oWalker.walk(oExpression), sIdentifierName];
-                 },
-                 /**
-                  * If the encountered identifier is a null or Boolean literal
-                  * and its value is worthwhile, the identifier is substituted
-                  * by an identifier name to which that value is assigned.
-                  * Applies to identifier names.
-                  * @param {string} sIdentifier The identifier encountered.
-                  * @return {!Array} A syntactic code unit that is equivalent to
-                  *     the one encountered.
-                  * @see TPrimitiveValue#nSaving
-                  */
-                 'name': function(sIdentifier) {
-                   /**
-                    * The prefixed representation String of the identifier.
-                    * @type {string}
-                    */
-                   var sPrefixed = EValuePrefixes.S_SYMBOLIC + sIdentifier;
-
-                   return [
-                     'name',
-                     oSolutionBest.oPrimitiveValues.hasOwnProperty(sPrefixed) &&
-                     oSolutionBest.oPrimitiveValues[sPrefixed].nSaving > 0 ?
-                     oSolutionBest.oPrimitiveValues[sPrefixed].sName :
-                     sIdentifier
-                   ];
-                 },
-                 /**
-                  * If the encountered String value is worthwhile, it is
-                  * substituted by an identifier name to which that value is
-                  * assigned.
-                  * Applies to String values.
-                  * @param {string} sStringValue The String value of the string
-                  *     literal encountered.
-                  * @return {!Array} A syntactic code unit that is equivalent to
-                  *     the one encountered.
-                  * @see TPrimitiveValue#nSaving
-                  */
-                 'string': function(sStringValue) {
-                   /**
-                    * The prefixed representation String of the primitive value
-                    * of the literal.
-                    * @type {string}
-                    */
-                   var sPrefixed =
-                       EValuePrefixes.S_STRING + sStringValue;
-
-                   return oSolutionBest.oPrimitiveValues.hasOwnProperty(
-                       sPrefixed) &&
-                       oSolutionBest.oPrimitiveValues[sPrefixed].nSaving > 0 ?
-                       ['name',
-                        oSolutionBest.oPrimitiveValues[sPrefixed].sName] :
-                       ['string', sStringValue];
-                 }
-               },
-               /**
-                * Such data on what to consolidate within the range of source
-                * elements that is currently being considered that lead to the
-                * greatest known reduction of the number of the terminal symbols
-                * in comparison to the original source text.
-                * @type {!TSolution}
-                */
-               oSolutionBest = new TSolution(),
-               /**
-                * Data representing an ongoing attempt to find a better
-                * reduction of the number of the terminal symbols in comparison
-                * to the original source text than the best one that is
-                * currently known.
-                * @type {!TSolution}
-                * @see oSolutionBest
-                */
-               oSolutionCandidate = new TSolution(),
-               /**
-                * A record consisting of data about the range of source elements
-                * that is currently being examined.
-                * @type {!TSourceElementsData}
-                */
-               oSourceElementsData = new TSourceElementsData(),
-               /**
-                * Variable declarations for each primitive value that is to be
-                * consolidated within the elements.
-                * @type {!Array.<!Array>}
-                */
-               aVariableDeclarations = [],
-               /**
-                * Augments a list with a prefixed representation String.
-                * @param {!Array.<string>} aList A list that is to be augmented.
-                * @return {function(string)} A function that augments a list
-                *     with a prefixed representation String.
-                */
-               cAugmentList = function(aList) {
-                 /**
-                  * @param {string} sPrefixed Prefixed representation String of
-                  *     a primitive value that could be consolidated within the
-                  *     elements.
-                  */
-                 var fLambda = function(sPrefixed) {
-                   if (-1 === aList.indexOf(sPrefixed)) {
-                     aList.push(sPrefixed);
-                   }
-                 };
-
-                 return fLambda;
-               },
-               /**
-                * Adds the number of occurrences of a primitive value of a given
-                * category that could be consolidated in the source element with
-                * a given index to the count of occurrences of that primitive
-                * value within the range of source elements that is currently
-                * being considered.
-                * @param {number} nPosition The index (in the source text order)
-                *     of a source element.
-                * @param {number} nCategory The category of the primary
-                *     expression from which the primitive value is derived.
-                * @return {function(string)} A function that performs the
-                *     addition.
-                * @see cAddOccurrencesInCategory
-                */
-               cAddOccurrences = function(nPosition, nCategory) {
-                 /**
-                  * @param {string} sPrefixed The prefixed representation String
-                  *     of a primitive value.
-                  */
-                 var fLambda = function(sPrefixed) {
-                   if (!oSourceElementsData.aCount[nCategory].hasOwnProperty(
-                           sPrefixed)) {
-                     oSourceElementsData.aCount[nCategory][sPrefixed] = 0;
-                   }
-                   oSourceElementsData.aCount[nCategory][sPrefixed] +=
-                       aSourceElementsData[nPosition].aCount[nCategory][
-                           sPrefixed];
-                 };
-
-                 return fLambda;
-               },
-               /**
-                * Adds the number of occurrences of each primitive value of a
-                * given category that could be consolidated in the source
-                * element with a given index to the count of occurrences of that
-                * primitive values within the range of source elements that is
-                * currently being considered.
-                * @param {number} nPosition The index (in the source text order)
-                *     of a source element.
-                * @return {function(number)} A function that performs the
-                *     addition.
-                * @see fAddOccurrences
-                */
-               cAddOccurrencesInCategory = function(nPosition) {
-                 /**
-                  * @param {number} nCategory The category of the primary
-                  *     expression from which the primitive value is derived.
-                  */
-                 var fLambda = function(nCategory) {
-                   Object.keys(
-                       aSourceElementsData[nPosition].aCount[nCategory]
-                   ).forEach(cAddOccurrences(nPosition, nCategory));
-                 };
-
-                 return fLambda;
-               },
-               /**
-                * Adds the number of occurrences of each primitive value that
-                * could be consolidated in the source element with a given index
-                * to the count of occurrences of that primitive values within
-                * the range of source elements that is currently being
-                * considered.
-                * @param {number} nPosition The index (in the source text order)
-                *     of a source element.
-                */
-               fAddOccurrences = function(nPosition) {
-                 Object.keys(aSourceElementsData[nPosition].aCount).forEach(
-                     cAddOccurrencesInCategory(nPosition));
-               },
-               /**
-                * Creates a variable declaration for a primitive value if that
-                * primitive value is to be consolidated within the elements.
-                * @param {string} sPrefixed Prefixed representation String of a
-                *     primitive value that could be consolidated within the
-                *     elements.
-                * @see aVariableDeclarations
-                */
-               cAugmentVariableDeclarations = function(sPrefixed) {
-                 if (oSolutionBest.oPrimitiveValues[sPrefixed].nSaving > 0) {
-                   aVariableDeclarations.push([
-                     oSolutionBest.oPrimitiveValues[sPrefixed].sName,
-                     [0 === sPrefixed.indexOf(EValuePrefixes.S_SYMBOLIC) ?
-                      'name' : 'string',
-                      sPrefixed.substring(EValuePrefixes.S_SYMBOLIC.length)]
-                   ]);
-                 }
-               },
-               /**
-                * Sorts primitive values with regard to the difference in the
-                * number of terminal symbols between the original source text
-                * and the one with those primitive values consolidated.
-                * @param {string} sPrefixed0 The prefixed representation String
-                *     of the first of the two primitive values that are being
-                *     compared.
-                * @param {string} sPrefixed1 The prefixed representation String
-                *     of the second of the two primitive values that are being
-                *     compared.
-                * @return {number}
-                *     <dl>
-                *         <dt>-1</dt>
-                *         <dd>if the first primitive value must be placed before
-                *              the other one,</dd>
-                *         <dt>0</dt>
-                *         <dd>if the first primitive value may be placed before
-                *              the other one,</dd>
-                *         <dt>1</dt>
-                *         <dd>if the first primitive value must not be placed
-                *              before the other one.</dd>
-                *     </dl>
-                * @see TSolution.oPrimitiveValues
-                */
-               cSortPrimitiveValues = function(sPrefixed0, sPrefixed1) {
-                 /**
-                  * The difference between:
-                  * <ol>
-                  * <li>the difference in the number of terminal symbols
-                  *     between the original source text and the one with the
-                  *     first primitive value consolidated, and</li>
-                  * <li>the difference in the number of terminal symbols
-                  *     between the original source text and the one with the
-                  *     second primitive value consolidated.</li>
-                  * </ol>
-                  * @type {number}
-                  */
-                 var nDifference =
-                     oSolutionCandidate.oPrimitiveValues[sPrefixed0].nSaving -
-                     oSolutionCandidate.oPrimitiveValues[sPrefixed1].nSaving;
-
-                 return nDifference > 0 ? -1 : nDifference < 0 ? 1 : 0;
-               },
-               /**
-                * Assigns an identifier name to a primitive value and calculates
-                * whether instances of that primitive value are worth
-                * consolidating.
-                * @param {string} sPrefixed The prefixed representation String
-                *     of a primitive value that is being evaluated.
-                */
-               fEvaluatePrimitiveValue = function(sPrefixed) {
-                 var _,
-                     /**
-                      * The index of the last mangled name.
-                      * @type {number}
-                      */
-                     nIndex,
-                     /**
-                      * The representation String of the primitive value that is
-                      * being evaluated.
-                      * @type {string}
-                      */
-                     sName =
-                         sPrefixed.substring(EValuePrefixes.S_SYMBOLIC.length),
-                     /**
-                      * The number of source characters taken up by the
-                      * representation String of the primitive value that is
-                      * being evaluated.
-                      * @type {number}
-                      */
-                     nLengthOriginal = sName.length,
-                     /**
-                      * The number of source characters taken up by the
-                      * identifier name that could substitute the primitive
-                      * value that is being evaluated.
-                      * substituted.
-                      * @type {number}
-                      */
-                     nLengthSubstitution,
-                     /**
-                      * The number of source characters taken up by by the
-                      * representation String of the primitive value that is
-                      * being evaluated when it is represented by a string
-                      * literal.
-                      * @type {number}
-                      */
-                     nLengthString = oProcessor.make_string(sName).length;
-
-                 oSolutionCandidate.oPrimitiveValues[sPrefixed] =
-                     new TPrimitiveValue();
-                 do {  // Find an identifier unused in this or any nested scope.
-                   nIndex = oScope.cname;
-                   oSolutionCandidate.oPrimitiveValues[sPrefixed].sName =
-                       oScope.next_mangled();
-                 } while (-1 !== oSourceElementsData.aIdentifiers.indexOf(
-                     oSolutionCandidate.oPrimitiveValues[sPrefixed].sName));
-                 nLengthSubstitution = oSolutionCandidate.oPrimitiveValues[
-                     sPrefixed].sName.length;
-                 if (0 === sPrefixed.indexOf(EValuePrefixes.S_SYMBOLIC)) {
-                   // foo:null, or foo:null;
-                   oSolutionCandidate.oPrimitiveValues[sPrefixed].nSaving -=
-                       nLengthSubstitution + nLengthOriginal +
-                       oWeights.N_VARIABLE_DECLARATION;
-                   // null vs foo
-                   oSolutionCandidate.oPrimitiveValues[sPrefixed].nSaving +=
-                       oSourceElementsData.aCount[
-                           EPrimaryExpressionCategories.
-                               N_NULL_AND_BOOLEAN_LITERALS][sPrefixed] *
-                       (nLengthOriginal - nLengthSubstitution);
-                 } else {
-                   // foo:'fromCharCode';
-                   oSolutionCandidate.oPrimitiveValues[sPrefixed].nSaving -=
-                       nLengthSubstitution + nLengthString +
-                       oWeights.N_VARIABLE_DECLARATION;
-                   // .fromCharCode vs [foo]
-                   if (oSourceElementsData.aCount[
-                           EPrimaryExpressionCategories.N_IDENTIFIER_NAMES
-                       ].hasOwnProperty(sPrefixed)) {
-                     oSolutionCandidate.oPrimitiveValues[sPrefixed].nSaving +=
-                         oSourceElementsData.aCount[
-                             EPrimaryExpressionCategories.N_IDENTIFIER_NAMES
-                         ][sPrefixed] *
-                         (nLengthOriginal - nLengthSubstitution -
-                          oWeights.N_PROPERTY_ACCESSOR);
-                   }
-                   // 'fromCharCode' vs foo
-                   if (oSourceElementsData.aCount[
-                           EPrimaryExpressionCategories.N_STRING_LITERALS
-                       ].hasOwnProperty(sPrefixed)) {
-                     oSolutionCandidate.oPrimitiveValues[sPrefixed].nSaving +=
-                         oSourceElementsData.aCount[
-                             EPrimaryExpressionCategories.N_STRING_LITERALS
-                         ][sPrefixed] *
-                         (nLengthString - nLengthSubstitution);
-                   }
-                 }
-                 if (oSolutionCandidate.oPrimitiveValues[sPrefixed].nSaving >
-                     0) {
-                   oSolutionCandidate.nSavings +=
-                       oSolutionCandidate.oPrimitiveValues[sPrefixed].nSaving;
-                 } else {
-                   oScope.cname = nIndex; // Free the identifier name.
-                 }
-               },
-               /**
-                * Adds a variable declaration to an existing variable statement.
-                * @param {!Array} aVariableDeclaration A variable declaration
-                *     with an initialiser.
-                */
-               cAddVariableDeclaration = function(aVariableDeclaration) {
-                 (/** @type {!Array} */ oSourceElements[nFrom][1]).unshift(
-                     aVariableDeclaration);
-               };
-
-           if (nFrom > nTo) {
-             return;
-           }
-           // If the range is a closure, reuse the closure.
-           if (nFrom === nTo &&
-               'stat' === oSourceElements[nFrom][0] &&
-               'call' === oSourceElements[nFrom][1][0] &&
-               'function' === oSourceElements[nFrom][1][1][0]) {
-             fExamineSyntacticCodeUnit(oSourceElements[nFrom][1][1]);
-             return;
-           }
-           // Create a list of all derived primitive values within the range.
-           for (nPosition = nFrom; nPosition <= nTo; nPosition += 1) {
-             aSourceElementsData[nPosition].aPrimitiveValues.forEach(
-                 cAugmentList(oSourceElementsData.aPrimitiveValues));
-           }
-           if (0 === oSourceElementsData.aPrimitiveValues.length) {
-             return;
-           }
-           for (nPosition = nFrom; nPosition <= nTo; nPosition += 1) {
-             // Add the number of occurrences to the total count.
-             fAddOccurrences(nPosition);
-             // Add identifiers of this or any nested scope to the list.
-             aSourceElementsData[nPosition].aIdentifiers.forEach(
-                 cAugmentList(oSourceElementsData.aIdentifiers));
-           }
-           // Distribute identifier names among derived primitive values.
-           do {  // If there was any progress, find a better distribution.
-             oSolutionBest = oSolutionCandidate;
-             if (Object.keys(oSolutionCandidate.oPrimitiveValues).length > 0) {
-               // Sort primitive values descending by their worthwhileness.
-               oSourceElementsData.aPrimitiveValues.sort(cSortPrimitiveValues);
-             }
-             oSolutionCandidate = new TSolution();
-             oSourceElementsData.aPrimitiveValues.forEach(
-                 fEvaluatePrimitiveValue);
-             oScope.cname = nIndex;
-           } while (oSolutionCandidate.nSavings > oSolutionBest.nSavings);
-           // Take the necessity of adding a variable statement into account.
-           if ('var' !== oSourceElements[nFrom][0]) {
-             oSolutionBest.nSavings -= oWeights.N_VARIABLE_STATEMENT_AFFIXATION;
-           }
-           if (bEnclose) {
-             // Take the necessity of forming a closure into account.
-             oSolutionBest.nSavings -= oWeights.N_CLOSURE;
-           }
-           if (oSolutionBest.nSavings > 0) {
-             // Create variable declarations suitable for UglifyJS.
-             Object.keys(oSolutionBest.oPrimitiveValues).forEach(
-                 cAugmentVariableDeclarations);
-             // Rewrite expressions that contain worthwhile primitive values.
-             for (nPosition = nFrom; nPosition <= nTo; nPosition += 1) {
-               oWalker = oProcessor.ast_walker();
-               oSourceElements[nPosition] =
-                   oWalker.with_walkers(
-                       oWalkersTransformers,
-                       cContext(oWalker, oSourceElements[nPosition]));
-             }
-             if ('var' === oSourceElements[nFrom][0]) {  // Reuse the statement.
-               (/** @type {!Array.<!Array>} */ aVariableDeclarations.reverse(
-                   )).forEach(cAddVariableDeclaration);
-             } else {  // Add a variable statement.
-               Array.prototype.splice.call(
-                   oSourceElements,
-                   nFrom,
-                   0,
-                   ['var', aVariableDeclarations]);
-               nTo += 1;
-             }
-             if (bEnclose) {
-               // Add a closure.
-               Array.prototype.splice.call(
-                   oSourceElements,
-                   nFrom,
-                   0,
-                   ['stat', ['call', ['function', null, [], []], []]]);
-               // Copy source elements into the closure.
-               for (nPosition = nTo + 1; nPosition > nFrom; nPosition -= 1) {
-                 Array.prototype.unshift.call(
-                     oSourceElements[nFrom][1][1][3],
-                     oSourceElements[nPosition]);
-               }
-               // Remove source elements outside the closure.
-               Array.prototype.splice.call(
-                   oSourceElements,
-                   nFrom + 1,
-                   nTo - nFrom + 1);
-             }
-           }
-           if (bEnclose) {
-             // Restore the availability of identifier names.
-             oScope.cname = nIndex;
-           }
-         };
-
-     oSourceElements = (/** @type {!TSyntacticCodeUnit} */
-         oSyntacticCodeUnit[bIsGlobal ? 1 : 3]);
-     if (0 === oSourceElements.length) {
-       return;
-     }
-     oScope = bIsGlobal ? oSyntacticCodeUnit.scope : oSourceElements.scope;
-     // Skip a Directive Prologue.
-     while (nAfterDirectivePrologue < oSourceElements.length &&
-            'stat' === oSourceElements[nAfterDirectivePrologue][0] &&
-            'string' === oSourceElements[nAfterDirectivePrologue][1][0]) {
-       nAfterDirectivePrologue += 1;
-       aSourceElementsData.push(null);
-     }
-     if (oSourceElements.length === nAfterDirectivePrologue) {
-       return;
-     }
-     for (nPosition = nAfterDirectivePrologue;
-          nPosition < oSourceElements.length;
-          nPosition += 1) {
-       oSourceElementData = new TSourceElementsData();
-       oWalker = oProcessor.ast_walker();
-       // Classify a source element.
-       // Find its derived primitive values and count their occurrences.
-       // Find all identifiers used (including nested scopes).
-       oWalker.with_walkers(
-           oWalkers.oSurveySourceElement,
-           cContext(oWalker, oSourceElements[nPosition]));
-       // Establish whether the scope is still wholly examinable.
-       bIsWhollyExaminable = bIsWhollyExaminable &&
-           ESourceElementCategories.N_WITH !== oSourceElementData.nCategory &&
-           ESourceElementCategories.N_EVAL !== oSourceElementData.nCategory;
-       aSourceElementsData.push(oSourceElementData);
-     }
-     if (bIsWhollyExaminable) {  // Examine the whole scope.
-       fExamineSourceElements(
-           nAfterDirectivePrologue,
-           oSourceElements.length - 1,
-           false);
-     } else {  // Examine unexcluded ranges of source elements.
-       for (nPosition = oSourceElements.length - 1;
-            nPosition >= nAfterDirectivePrologue;
-            nPosition -= 1) {
-         oSourceElementData = (/** @type {!TSourceElementsData} */
-             aSourceElementsData[nPosition]);
-         if (ESourceElementCategories.N_OTHER ===
-             oSourceElementData.nCategory) {
-           if ('undefined' === typeof nTo) {
-             nTo = nPosition;  // Indicate the end of a range.
-           }
-           // Examine the range if it immediately follows a Directive Prologue.
-           if (nPosition === nAfterDirectivePrologue) {
-             fExamineSourceElements(nPosition, nTo, true);
-           }
-         } else {
-           if ('undefined' !== typeof nTo) {
-             // Examine the range that immediately follows this source element.
-             fExamineSourceElements(nPosition + 1, nTo, true);
-             nTo = void 0;  // Obliterate the range.
-           }
-           // Examine nested functions.
-           oWalker = oProcessor.ast_walker();
-           oWalker.with_walkers(
-               oWalkers.oExamineFunctions,
-               cContext(oWalker, oSourceElements[nPosition]));
-         }
-       }
-     }
-   }(oAbstractSyntaxTree = oProcessor.ast_add_scope(oAbstractSyntaxTree)));
-  return oAbstractSyntaxTree;
-};
-/*jshint sub:false */
-
-
-if (require.main === module) {
-  (function() {
-    'use strict';
-    /*jshint bitwise:true, curly:true, eqeqeq:true, forin:true, immed:true,
-         latedef:true, newcap:true, noarge:true, noempty:true, nonew:true,
-         onevar:true, plusplus:true, regexp:true, undef:true, strict:true,
-         sub:false, trailing:true */
-
-    var _,
-        /**
-         * NodeJS module for unit testing.
-         * @namespace
-         * @type {!TAssert}
-         * @see http://nodejs.org/docs/v0.6.10/api/all.html#assert
-         */
-        oAssert = (/** @type {!TAssert} */ require('assert')),
-        /**
-         * The parser of ECMA-262 found in UglifyJS.
-         * @namespace
-         * @type {!TParser}
-         */
-        oParser = (/** @type {!TParser} */ require('./parse-js')),
-        /**
-         * The processor of <abbr title="abstract syntax tree">AST</abbr>s
-         * found in UglifyJS.
-         * @namespace
-         * @type {!TProcessor}
-         */
-        oProcessor = (/** @type {!TProcessor} */ require('./process')),
-        /**
-         * An instance of an object that allows the traversal of an <abbr
-         * title="abstract syntax tree">AST</abbr>.
-         * @type {!TWalker}
-         */
-        oWalker,
-        /**
-         * A collection of functions for the removal of the scope information
-         * during the traversal of an <abbr title="abstract syntax tree"
-         * >AST</abbr>.
-         * @namespace
-         * @type {!Object.<string, function(...[*])>}
-         */
-        oWalkersPurifiers = {
-          /**#nocode+*/  // JsDoc Toolkit 2.4.0 hides some of the keys.
-          /**
-           * Deletes the scope information from the branch of the abstract
-           * syntax tree representing the encountered function declaration.
-           * @param {string} sIdentifier The identifier of the function.
-           * @param {!Array.<string>} aFormalParameterList Formal parameters.
-           * @param {!TSyntacticCodeUnit} oFunctionBody Function code.
-           */
-          'defun': function(
-              sIdentifier,
-              aFormalParameterList,
-              oFunctionBody) {
-            delete oFunctionBody.scope;
-          },
-          /**
-           * Deletes the scope information from the branch of the abstract
-           * syntax tree representing the encountered function expression.
-           * @param {?string} sIdentifier The optional identifier of the
-           *     function.
-           * @param {!Array.<string>} aFormalParameterList Formal parameters.
-           * @param {!TSyntacticCodeUnit} oFunctionBody Function code.
-           */
-          'function': function(
-              sIdentifier,
-              aFormalParameterList,
-              oFunctionBody) {
-            delete oFunctionBody.scope;
-          }
-          /**#nocode-*/  // JsDoc Toolkit 2.4.0 hides some of the keys.
-        },
-        /**
-         * Initiates the traversal of a source element.
-         * @param {!TWalker} oWalker An instance of an object that allows the
-         *     traversal of an abstract syntax tree.
-         * @param {!TSyntacticCodeUnit} oSourceElement A source element from
-         *     which the traversal should commence.
-         * @return {function(): !TSyntacticCodeUnit} A function that is able to
-         *     initiate the traversal from a given source element.
-         */
-        cContext = function(oWalker, oSourceElement) {
-          /**
-           * @return {!TSyntacticCodeUnit} A function that is able to
-           *     initiate the traversal from a given source element.
-           */
-          var fLambda = function() {
-            return oWalker.walk(oSourceElement);
-          };
-
-          return fLambda;
-        },
-        /**
-         * A record consisting of configuration for the code generation phase.
-         * @type {!Object}
-         */
-        oCodeGenerationOptions = {
-          beautify: true
-        },
-        /**
-         * Tests whether consolidation of an ECMAScript program yields expected
-         * results.
-         * @param {{
-         *       sTitle: string,
-         *       sInput: string,
-         *       sOutput: string
-         *     }} oUnitTest A record consisting of data about a unit test: its
-         *     name, an ECMAScript program, and, if consolidation is to take
-         *     place, the resulting ECMAScript program.
-         */
-        cAssert = function(oUnitTest) {
-          var _,
-              /**
-               * An array-like object representing the <abbr title=
-               * "abstract syntax tree">AST</abbr> obtained after consolidation.
-               * @type {!TSyntacticCodeUnit}
-               */
-              oSyntacticCodeUnitActual =
-                  exports.ast_consolidate(oParser.parse(oUnitTest.sInput)),
-              /**
-               * An array-like object representing the expected <abbr title=
-               * "abstract syntax tree">AST</abbr>.
-               * @type {!TSyntacticCodeUnit}
-               */
-              oSyntacticCodeUnitExpected = oParser.parse(
-                  oUnitTest.hasOwnProperty('sOutput') ?
-                  oUnitTest.sOutput : oUnitTest.sInput);
-
-          delete oSyntacticCodeUnitActual.scope;
-          oWalker = oProcessor.ast_walker();
-          oWalker.with_walkers(
-              oWalkersPurifiers,
-              cContext(oWalker, oSyntacticCodeUnitActual));
-          try {
-            oAssert.deepEqual(
-                oSyntacticCodeUnitActual,
-                oSyntacticCodeUnitExpected);
-          } catch (oException) {
-            console.error(
-                '########## A unit test has failed.\n' +
-                oUnitTest.sTitle + '\n' +
-                '#####  actual code  (' +
-                oProcessor.gen_code(oSyntacticCodeUnitActual).length +
-                ' bytes)\n' +
-                oProcessor.gen_code(
-                    oSyntacticCodeUnitActual,
-                    oCodeGenerationOptions) + '\n' +
-                '##### expected code (' +
-                oProcessor.gen_code(oSyntacticCodeUnitExpected).length +
-                ' bytes)\n' +
-                oProcessor.gen_code(
-                    oSyntacticCodeUnitExpected,
-                    oCodeGenerationOptions));
-          }
-        };
-
-    [
-      // 7.6.1 Reserved Words.
-      {
-        sTitle:
-            'Omission of keywords while choosing an identifier name.',
-        sInput:
-            '(function() {' +
-            '  var a, b, c, d, e, f, g, h, i, j, k, l, m,' +
-            '      n, o, p, q, r, s, t, u, v, w, x, y, z,' +
-            '      A, B, C, D, E, F, G, H, I, J, K, L, M,' +
-            '      N, O, P, Q, R, S, T, U, V, W, X, Y, Z,' +
-            '      $, _,' +
-            '      aa, ab, ac, ad, ae, af, ag, ah, ai, aj, ak, al, am,' +
-            '      an, ao, ap, aq, ar, as, at, au, av, aw, ax, ay, az,' +
-            '      aA, aB, aC, aD, aE, aF, aG, aH, aI, aJ, aK, aL, aM,' +
-            '      aN, aO, aP, aQ, aR, aS, aT, aU, aV, aW, aX, aY, aZ,' +
-            '      a$, a_,' +
-            '      ba, bb, bc, bd, be, bf, bg, bh, bi, bj, bk, bl, bm,' +
-            '      bn, bo, bp, bq, br, bs, bt, bu, bv, bw, bx, by, bz,' +
-            '      bA, bB, bC, bD, bE, bF, bG, bH, bI, bJ, bK, bL, bM,' +
-            '      bN, bO, bP, bQ, bR, bS, bT, bU, bV, bW, bX, bY, bZ,' +
-            '      b$, b_,' +
-            '      ca, cb, cc, cd, ce, cf, cg, ch, ci, cj, ck, cl, cm,' +
-            '      cn, co, cp, cq, cr, cs, ct, cu, cv, cw, cx, cy, cz,' +
-            '      cA, cB, cC, cD, cE, cF, cG, cH, cI, cJ, cK, cL, cM,' +
-            '      cN, cO, cP, cQ, cR, cS, cT, cU, cV, cW, cX, cY, cZ,' +
-            '      c$, c_,' +
-            '      da, db, dc, dd, de, df, dg, dh, di, dj, dk, dl, dm,' +
-            '      dn, dq, dr, ds, dt, du, dv, dw, dx, dy, dz,' +
-            '      dA, dB, dC, dD, dE, dF, dG, dH, dI, dJ, dK, dL, dM,' +
-            '      dN, dO, dP, dQ, dR, dS, dT, dU, dV, dW, dX, dY, dZ,' +
-            '      d$, d_;' +
-            '  void ["abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",' +
-            '        "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"];' +
-            '}());',
-        sOutput:
-            '(function() {' +
-            '  var dp =' +
-            '      "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",' +
-            '      a, b, c, d, e, f, g, h, i, j, k, l, m,' +
-            '      n, o, p, q, r, s, t, u, v, w, x, y, z,' +
-            '      A, B, C, D, E, F, G, H, I, J, K, L, M,' +
-            '      N, O, P, Q, R, S, T, U, V, W, X, Y, Z,' +
-            '      $, _,' +
-            '      aa, ab, ac, ad, ae, af, ag, ah, ai, aj, ak, al, am,' +
-            '      an, ao, ap, aq, ar, as, at, au, av, aw, ax, ay, az,' +
-            '      aA, aB, aC, aD, aE, aF, aG, aH, aI, aJ, aK, aL, aM,' +
-            '      aN, aO, aP, aQ, aR, aS, aT, aU, aV, aW, aX, aY, aZ,' +
-            '      a$, a_,' +
-            '      ba, bb, bc, bd, be, bf, bg, bh, bi, bj, bk, bl, bm,' +
-            '      bn, bo, bp, bq, br, bs, bt, bu, bv, bw, bx, by, bz,' +
-            '      bA, bB, bC, bD, bE, bF, bG, bH, bI, bJ, bK, bL, bM,' +
-            '      bN, bO, bP, bQ, bR, bS, bT, bU, bV, bW, bX, bY, bZ,' +
-            '      b$, b_,' +
-            '      ca, cb, cc, cd, ce, cf, cg, ch, ci, cj, ck, cl, cm,' +
-            '      cn, co, cp, cq, cr, cs, ct, cu, cv, cw, cx, cy, cz,' +
-            '      cA, cB, cC, cD, cE, cF, cG, cH, cI, cJ, cK, cL, cM,' +
-            '      cN, cO, cP, cQ, cR, cS, cT, cU, cV, cW, cX, cY, cZ,' +
-            '      c$, c_,' +
-            '      da, db, dc, dd, de, df, dg, dh, di, dj, dk, dl, dm,' +
-            '      dn, dq, dr, ds, dt, du, dv, dw, dx, dy, dz,' +
-            '      dA, dB, dC, dD, dE, dF, dG, dH, dI, dJ, dK, dL, dM,' +
-            '      dN, dO, dP, dQ, dR, dS, dT, dU, dV, dW, dX, dY, dZ,' +
-            '      d$, d_;' +
-            '  void [dp, dp];' +
-            '}());'
-      },
-      // 7.8.1 Null Literals.
-      {
-        sTitle:
-            'Evaluation with regard to the null value.',
-        sInput:
-            '/*jshint evil:true */' +
-            '(function() {' +
-            '  var foo;' +
-            '  void [null, null, null];' +
-            '}());' +
-            'eval("");' +
-            '(function() {' +
-            '  var foo;' +
-            '  void [null, null];' +
-            '}());',
-        sOutput:
-            '/*jshint evil:true */' +
-            '(function() {' +
-            '  var a = null, foo;' +
-            '  void [a, a, a];' +
-            '}());' +
-            'eval("");' +
-            '(function() {' +
-            '  var foo;' +
-            '  void [null, null];' +
-            '}());'
-      },
-      // 7.8.2 Boolean Literals.
-      {
-        sTitle:
-            'Evaluation with regard to the false value.',
-        sInput:
-            '/*jshint evil:true */' +
-            '(function() {' +
-            '  var foo;' +
-            '  void [false, false, false];' +
-            '}());' +
-            'eval("");' +
-            '(function() {' +
-            '  var foo;' +
-            '  void [false, false];' +
-            '}());',
-        sOutput:
-            '/*jshint evil:true */' +
-            '(function() {' +
-            '  var a = false, foo;' +
-            '  void [a, a, a];' +
-            '}());' +
-            'eval("");' +
-            '(function() {' +
-            '  var foo;' +
-            '  void [false, false];' +
-            '}());'
-      },
-      {
-        sTitle:
-            'Evaluation with regard to the true value.',
-        sInput:
-            '/*jshint evil:true */' +
-            '(function() {' +
-            '  var foo;' +
-            '  void [true, true, true];' +
-            '}());' +
-            'eval("");' +
-            '(function() {' +
-            '  var foo;' +
-            '  void [true, true];' +
-            '}());',
-        sOutput:
-            '/*jshint evil:true */' +
-            '(function() {' +
-            '  var a = true, foo;' +
-            '  void [a, a, a];' +
-            '}());' +
-            'eval("");' +
-            '(function() {' +
-            '  var foo;' +
-            '  void [true, true];' +
-            '}());'
-      },
-      // 7.8.4 String Literals.
-      {
-        sTitle:
-            'Evaluation with regard to the String value of a string literal.',
-        sInput:
-            '(function() {' +
-            '  var foo;' +
-            '  void ["abcd", "abcd", "abc", "abc"];' +
-            '}());',
-        sOutput:
-            '(function() {' +
-            '  var a = "abcd", foo;' +
-            '  void [a, a, "abc", "abc"];' +
-            '}());'
-      },
-      // 7.8.5 Regular Expression Literals.
-      {
-        sTitle:
-            'Preservation of the pattern of a regular expression literal.',
-        sInput:
-            'void [/abcdefghijklmnopqrstuvwxyz/, /abcdefghijklmnopqrstuvwxyz/];'
-      },
-      {
-        sTitle:
-            'Preservation of the flags of a regular expression literal.',
-        sInput:
-            'void [/(?:)/gim, /(?:)/gim, /(?:)/gim, /(?:)/gim, /(?:)/gim,' +
-            '      /(?:)/gim, /(?:)/gim, /(?:)/gim, /(?:)/gim, /(?:)/gim,' +
-            '      /(?:)/gim, /(?:)/gim, /(?:)/gim, /(?:)/gim, /(?:)/gim];'
-      },
-      // 10.2 Lexical Environments.
-      {
-        sTitle:
-            'Preservation of identifier names in the same scope.',
-        sInput:
-            '/*jshint shadow:true */' +
-            'var a;' +
-            'function b(i) {' +
-            '}' +
-            'for (var c; 0 === Math.random(););' +
-            'for (var d in {});' +
-            'void ["abcdefghijklmnopqrstuvwxyz"];' +
-            'void [b(a), b(c), b(d)];' +
-            'void [typeof e];' +
-            'i: for (; 0 === Math.random();) {' +
-            '  if (42 === (new Date()).getMinutes()) {' +
-            '    continue i;' +
-            '  } else {' +
-            '    break i;' +
-            '  }' +
-            '}' +
-            'try {' +
-            '} catch (f) {' +
-            '} finally {' +
-            '}' +
-            '(function g(h) {' +
-            '}());' +
-            'void [{' +
-            '  i: 42,' +
-            '  "j": 42,' +
-            '  \'k\': 42' +
-            '}];' +
-            'void ["abcdefghijklmnopqrstuvwxyz"];',
-        sOutput:
-            '/*jshint shadow:true */' +
-            'var a;' +
-            'function b(i) {' +
-            '}' +
-            'for (var c; 0 === Math.random(););' +
-            'for (var d in {});' +
-            '(function() {' +
-            '  var i = "abcdefghijklmnopqrstuvwxyz";' +
-            '  void [i];' +
-            '  void [b(a), b(c), b(d)];' +
-            '  void [typeof e];' +
-            '  i: for (; 0 === Math.random();) {' +
-            '    if (42 === (new Date()).getMinutes()) {' +
-            '      continue i;' +
-            '    } else {' +
-            '      break i;' +
-            '    }' +
-            '  }' +
-            '  try {' +
-            '  } catch (f) {' +
-            '  } finally {' +
-            '  }' +
-            '  (function g(h) {' +
-            '  }());' +
-            '  void [{' +
-            '    i: 42,' +
-            '    "j": 42,' +
-            '    \'k\': 42' +
-            '  }];' +
-            '  void [i];' +
-            '}());'
-      },
-      {
-        sTitle:
-            'Preservation of identifier names in nested function code.',
-        sInput:
-            '(function() {' +
-            '  void ["abcdefghijklmnopqrstuvwxyz"];' +
-            '  (function() {' +
-            '    var a;' +
-            '    for (var b; 0 === Math.random(););' +
-            '    for (var c in {});' +
-            '    void [typeof d];' +
-            '    h: for (; 0 === Math.random();) {' +
-            '      if (42 === (new Date()).getMinutes()) {' +
-            '        continue h;' +
-            '      } else {' +
-            '        break h;' +
-            '      }' +
-            '    }' +
-            '    try {' +
-            '    } catch (e) {' +
-            '    } finally {' +
-            '    }' +
-            '    (function f(g) {' +
-            '    }());' +
-            '    void [{' +
-            '      h: 42,' +
-            '      "i": 42,' +
-            '      \'j\': 42' +
-            '    }];' +
-            '  }());' +
-            '  void ["abcdefghijklmnopqrstuvwxyz"];' +
-            '}());',
-        sOutput:
-            '(function() {' +
-            '  var h = "abcdefghijklmnopqrstuvwxyz";' +
-            '  void [h];' +
-            '  (function() {' +
-            '    var a;' +
-            '    for (var b; 0 === Math.random(););' +
-            '    for (var c in {});' +
-            '    void [typeof d];' +
-            '    h: for (; 0 === Math.random();) {' +
-            '      if (42 === (new Date()).getMinutes()) {' +
-            '        continue h;' +
-            '      } else {' +
-            '        break h;' +
-            '      }' +
-            '    }' +
-            '    try {' +
-            '    } catch (e) {' +
-            '    } finally {' +
-            '    }' +
-            '    (function f(g) {' +
-            '    }());' +
-            '    void [{' +
-            '      h: 42,' +
-            '      "i": 42,' +
-            '      \'j\': 42' +
-            '    }];' +
-            '  }());' +
-            '  void [h];' +
-            '}());'
-      },
-      {
-        sTitle:
-            'Consolidation of a closure with other source elements.',
-        sInput:
-            '(function(foo) {' +
-            '}("abcdefghijklmnopqrstuvwxyz"));' +
-            'void ["abcdefghijklmnopqrstuvwxyz"];',
-        sOutput:
-            '(function() {' +
-            '  var a = "abcdefghijklmnopqrstuvwxyz";' +
-            '  (function(foo) {' +
-            '  })(a);' +
-            '  void [a];' +
-            '}());'
-      },
-      {
-        sTitle:
-            'Consolidation of function code instead of a sole closure.',
-        sInput:
-            '(function(foo, bar) {' +
-            '  void ["abcdefghijklmnopqrstuvwxyz",' +
-            '        "abcdefghijklmnopqrstuvwxyz"];' +
-            '}("abcdefghijklmnopqrstuvwxyz", "abcdefghijklmnopqrstuvwxyz"));',
-        sOutput:
-            '(function(foo, bar) {' +
-            '  var a = "abcdefghijklmnopqrstuvwxyz";' +
-            '  void [a, a];' +
-            '}("abcdefghijklmnopqrstuvwxyz", "abcdefghijklmnopqrstuvwxyz"));'
-      },
-      // 11.1.5 Object Initialiser.
-      {
-        sTitle:
-            'Preservation of property names of an object initialiser.',
-        sInput:
-            'var foo = {' +
-            '  abcdefghijklmnopqrstuvwxyz: 42,' +
-            '  "zyxwvutsrqponmlkjihgfedcba": 42,' +
-            '  \'mlkjihgfedcbanopqrstuvwxyz\': 42' +
-            '};' +
-            'void [' +
-            '  foo.abcdefghijklmnopqrstuvwxyz,' +
-            '  "zyxwvutsrqponmlkjihgfedcba",' +
-            '  \'mlkjihgfedcbanopqrstuvwxyz\'' +
-            '];'
-      },
-      {
-        sTitle:
-            'Evaluation with regard to String values derived from identifier ' +
-            'names used as property accessors.',
-        sInput:
-            '(function() {' +
-            '  var foo;' +
-            '  void [' +
-            '    Math.abcdefghij,' +
-            '    Math.abcdefghij,' +
-            '    Math.abcdefghi,' +
-            '    Math.abcdefghi' +
-            '  ];' +
-            '}());',
-        sOutput:
-            '(function() {' +
-            '  var a = "abcdefghij", foo;' +
-            '  void [' +
-            '    Math[a],' +
-            '    Math[a],' +
-            '    Math.abcdefghi,' +
-            '    Math.abcdefghi' +
-            '  ];' +
-            '}());'
-      },
-      // 11.2.1 Property Accessors.
-      {
-        sTitle:
-            'Preservation of identifiers in the nonterminal MemberExpression.',
-        sInput:
-            'void [' +
-            '  Math.E,' +
-            '  Math.LN10,' +
-            '  Math.LN2,' +
-            '  Math.LOG2E,' +
-            '  Math.LOG10E,' +
-            '  Math.PI,' +
-            '  Math.SQRT1_2,' +
-            '  Math.SQRT2,' +
-            '  Math.abs,' +
-            '  Math.acos' +
-            '];'
-      },
-      // 12.2 Variable Statement.
-      {
-        sTitle:
-            'Preservation of the identifier of a variable that is being ' +
-            'declared in a variable statement.',
-        sInput:
-            '(function() {' +
-            '  var abcdefghijklmnopqrstuvwxyz;' +
-            '  void [abcdefghijklmnopqrstuvwxyz];' +
-            '}());'
-      },
-      {
-        sTitle:
-            'Exclusion of a variable statement in global code.',
-        sInput:
-            'void ["abcdefghijklmnopqrstuvwxyz"];' +
-            'var foo = "abcdefghijklmnopqrstuvwxyz",' +
-            '    bar = "abcdefghijklmnopqrstuvwxyz";' +
-            'void ["abcdefghijklmnopqrstuvwxyz"];'
-      },
-      {
-        sTitle:
-            'Exclusion of a variable statement in function code that ' +
-            'contains a with statement.',
-        sInput:
-            '(function() {' +
-            '  with ({});' +
-            '  void ["abcdefghijklmnopqrstuvwxyz"];' +
-            '  var foo;' +
-            '  void ["abcdefghijklmnopqrstuvwxyz"];' +
-            '}());'
-      },
-      {
-        sTitle:
-            'Exclusion of a variable statement in function code that ' +
-            'contains a direct call to the eval function.',
-        sInput:
-            '/*jshint evil:true */' +
-            'void [' +
-            '  function() {' +
-            '    eval("");' +
-            '    void ["abcdefghijklmnopqrstuvwxyz"];' +
-            '    var foo;' +
-            '    void ["abcdefghijklmnopqrstuvwxyz"];' +
-            '  }' +
-            '];'
-      },
-      {
-        sTitle:
-            'Consolidation within a variable statement in global code.',
-        sInput:
-            'var foo = function() {' +
-            '  void ["abcdefghijklmnopqrstuvwxyz",' +
-            '        "abcdefghijklmnopqrstuvwxyz"];' +
-            '};',
-        sOutput:
-            'var foo = function() {' +
-            '  var a = "abcdefghijklmnopqrstuvwxyz";' +
-            '  void [a, a];' +
-            '};'
-      },
-      {
-        sTitle:
-            'Consolidation within a variable statement excluded in function ' +
-            'code due to the presence of a with statement.',
-        sInput:
-            '(function() {' +
-            '  with ({});' +
-            '  var foo = function() {' +
-            '    void ["abcdefghijklmnopqrstuvwxyz",' +
-            '          "abcdefghijklmnopqrstuvwxyz"];' +
-            '  };' +
-            '}());',
-        sOutput:
-            '(function() {' +
-            '  with ({});' +
-            '  var foo = function() {' +
-            '    var a = "abcdefghijklmnopqrstuvwxyz";' +
-            '    void [a, a];' +
-            '  };' +
-            '}());'
-      },
-      {
-        sTitle:
-            'Consolidation within a variable statement excluded in function ' +
-            'code due to the presence of a direct call to the eval function.',
-        sInput:
-            '/*jshint evil:true */' +
-            '(function() {' +
-            '  eval("");' +
-            '  var foo = function() {' +
-            '    void ["abcdefghijklmnopqrstuvwxyz",' +
-            '          "abcdefghijklmnopqrstuvwxyz"];' +
-            '  };' +
-            '}());',
-        sOutput:
-            '/*jshint evil:true */' +
-            '(function() {' +
-            '  eval("");' +
-            '  var foo = function() {' +
-            '    var a = "abcdefghijklmnopqrstuvwxyz";' +
-            '    void [a, a];' +
-            '  };' +
-            '}());'
-      },
-      {
-        sTitle:
-            'Inclusion of a variable statement in function code that ' +
-            'contains no with statement and no direct call to the eval ' +
-            'function.',
-        sInput:
-            '(function() {' +
-            '  void ["abcdefghijklmnopqrstuvwxyz"];' +
-            '  var foo;' +
-            '  void ["abcdefghijklmnopqrstuvwxyz"];' +
-            '}());',
-        sOutput:
-            '(function() {' +
-            '  var a = "abcdefghijklmnopqrstuvwxyz";' +
-            '  void [a];' +
-            '  var foo;' +
-            '  void [a];' +
-            '}());'
-      },
-      {
-        sTitle:
-            'Ignorance with regard to a variable statement in global code.',
-        sInput:
-            'var foo = "abcdefghijklmnopqrstuvwxyz";' +
-            'void ["abcdefghijklmnopqrstuvwxyz",' +
-            '      "abcdefghijklmnopqrstuvwxyz"];',
-        sOutput:
-            'var foo = "abcdefghijklmnopqrstuvwxyz";' +
-            '(function() {' +
-            '  var a = "abcdefghijklmnopqrstuvwxyz";' +
-            '  void [a, a];' +
-            '}());'
-      },
-      // 12.4 Expression Statement.
-      {
-        sTitle:
-            'Preservation of identifiers in an expression statement.',
-        sInput:
-            'void [typeof abcdefghijklmnopqrstuvwxyz,' +
-            '      typeof abcdefghijklmnopqrstuvwxyz];'
-      },
-      // 12.6.3 The {@code for} Statement.
-      {
-        sTitle:
-            'Preservation of identifiers in the variable declaration list of ' +
-            'a for statement.',
-        sInput:
-            'for (var abcdefghijklmnopqrstuvwxyz; 0 === Math.random(););' +
-            'for (var abcdefghijklmnopqrstuvwxyz; 0 === Math.random(););'
-      },
-      // 12.6.4 The {@code for-in} Statement.
-      {
-        sTitle:
-            'Preservation of identifiers in the variable declaration list of ' +
-            'a for-in statement.',
-        sInput:
-            'for (var abcdefghijklmnopqrstuvwxyz in {});' +
-            'for (var abcdefghijklmnopqrstuvwxyz in {});'
-      },
-      // 12.7 The {@code continue} Statement.
-      {
-        sTitle:
-            'Preservation of the identifier in a continue statement.',
-        sInput:
-            'abcdefghijklmnopqrstuvwxyz: for (; 0 === Math.random();) {' +
-            '  continue abcdefghijklmnopqrstuvwxyz;' +
-            '}' +
-            'abcdefghijklmnopqrstuvwxyz: for (; 0 === Math.random();) {' +
-            '  continue abcdefghijklmnopqrstuvwxyz;' +
-            '}'
-      },
-      // 12.8 The {@code break} Statement.
-      {
-        sTitle:
-            'Preservation of the identifier in a break statement.',
-        sInput:
-            'abcdefghijklmnopqrstuvwxyz: for (; 0 === Math.random();) {' +
-            '  break abcdefghijklmnopqrstuvwxyz;' +
-            '}' +
-            'abcdefghijklmnopqrstuvwxyz: for (; 0 === Math.random();) {' +
-            '  break abcdefghijklmnopqrstuvwxyz;' +
-            '}'
-      },
-      // 12.9 The {@code return} Statement.
-      {
-        sTitle:
-            'Exclusion of a return statement in function code that contains ' +
-            'a with statement.',
-        sInput:
-            '(function() {' +
-            '  with ({});' +
-            '  void ["abcdefghijklmnopqrstuvwxyz"];' +
-            '  if (0 === Math.random()) {' +
-            '    return;' +
-            '  } else {' +
-            '  }' +
-            '  void ["abcdefghijklmnopqrstuvwxyz"];' +
-            '}());'
-      },
-      {
-        sTitle:
-            'Exclusion of a return statement in function code that contains ' +
-            'a direct call to the eval function.',
-        sInput:
-            '/*jshint evil:true */' +
-            '(function() {' +
-            '  eval("");' +
-            '  void ["abcdefghijklmnopqrstuvwxyz"];' +
-            '  if (0 === Math.random()) {' +
-            '    return;' +
-            '  } else {' +
-            '  }' +
-            '  void ["abcdefghijklmnopqrstuvwxyz"];' +
-            '}());'
-      },
-      {
-        sTitle:
-            'Consolidation within a return statement excluded in function ' +
-            'code due to the presence of a with statement.',
-        sInput:
-            '(function() {' +
-            '  with ({});' +
-            '  return function() {' +
-            '    void ["abcdefghijklmnopqrstuvwxyz",' +
-            '          "abcdefghijklmnopqrstuvwxyz"];' +
-            '  };' +
-            '}());',
-        sOutput:
-            '(function() {' +
-            '  with ({});' +
-            '  return function() {' +
-            '    var a = "abcdefghijklmnopqrstuvwxyz";' +
-            '    void [a, a];' +
-            '  };' +
-            '}());'
-      },
-      {
-        sTitle:
-            'Consolidation within a return statement excluded in function ' +
-            'code due to the presence of a direct call to the eval function.',
-        sInput:
-            '/*jshint evil:true */' +
-            '(function() {' +
-            '  eval("");' +
-            '  return function() {' +
-            '    void ["abcdefghijklmnopqrstuvwxyz",' +
-            '          "abcdefghijklmnopqrstuvwxyz"];' +
-            '  };' +
-            '}());',
-        sOutput:
-            '/*jshint evil:true */' +
-            '(function() {' +
-            '  eval("");' +
-            '  return function() {' +
-            '    var a = "abcdefghijklmnopqrstuvwxyz";' +
-            '    void [a, a];' +
-            '  };' +
-            '}());'
-      },
-      {
-        sTitle:
-            'Inclusion of a return statement in function code that contains ' +
-            'no with statement and no direct call to the eval function.',
-        sInput:
-            '(function() {' +
-            '  void ["abcdefghijklmnopqrstuvwxyz"];' +
-            '  if (0 === Math.random()) {' +
-            '    return;' +
-            '  } else {' +
-            '  }' +
-            '  void ["abcdefghijklmnopqrstuvwxyz"];' +
-            '}());',
-        sOutput:
-            '(function() {' +
-            '  var a = "abcdefghijklmnopqrstuvwxyz";' +
-            '  void [a];' +
-            '  if (0 === Math.random()) {' +
-            '    return;' +
-            '  } else {' +
-            '  }' +
-            '  void [a];' +
-            '}());'
-      },
-      // 12.10 The {@code with} Statement.
-      {
-        sTitle:
-            'Preservation of the statement in a with statement.',
-        sInput:
-            'with ({}) {' +
-            '  void ["abcdefghijklmnopqrstuvwxyz",' +
-            '        "abcdefghijklmnopqrstuvwxyz"];' +
-            '}'
-      },
-      {
-        sTitle:
-            'Exclusion of a with statement in the same syntactic code unit.',
-        sInput:
-            'void ["abcdefghijklmnopqrstuvwxyz"];' +
-            'with ({' +
-            '  foo: "abcdefghijklmnopqrstuvwxyz",' +
-            '  bar: "abcdefghijklmnopqrstuvwxyz"' +
-            '}) {' +
-            '  void ["abcdefghijklmnopqrstuvwxyz",' +
-            '        "abcdefghijklmnopqrstuvwxyz"];' +
-            '}' +
-            'void ["abcdefghijklmnopqrstuvwxyz"];'
-      },
-      {
-        sTitle:
-            'Exclusion of a with statement in nested function code.',
-        sInput:
-            'void ["abcdefghijklmnopqrstuvwxyz"];' +
-            '(function() {' +
-            '  with ({' +
-            '    foo: "abcdefghijklmnopqrstuvwxyz",' +
-            '    bar: "abcdefghijklmnopqrstuvwxyz"' +
-            '  }) {' +
-            '    void ["abcdefghijklmnopqrstuvwxyz",' +
-            '          "abcdefghijklmnopqrstuvwxyz"];' +
-            '  }' +
-            '}());' +
-            'void ["abcdefghijklmnopqrstuvwxyz"];'
-      },
-      // 12.12 Labelled Statements.
-      {
-        sTitle:
-            'Preservation of the label of a labelled statement.',
-        sInput:
-            'abcdefghijklmnopqrstuvwxyz: for (; 0 === Math.random(););' +
-            'abcdefghijklmnopqrstuvwxyz: for (; 0 === Math.random(););'
-      },
-      // 12.14 The {@code try} Statement.
-      {
-        sTitle:
-            'Preservation of the identifier in the catch clause of a try' +
-            'statement.',
-        sInput:
-            'try {' +
-            '} catch (abcdefghijklmnopqrstuvwxyz) {' +
-            '} finally {' +
-            '}' +
-            'try {' +
-            '} catch (abcdefghijklmnopqrstuvwxyz) {' +
-            '} finally {' +
-            '}'
-      },
-      // 13 Function Definition.
-      {
-        sTitle:
-            'Preservation of the identifier of a function declaration.',
-        sInput:
-            'function abcdefghijklmnopqrstuvwxyz() {' +
-            '}' +
-            'void [abcdefghijklmnopqrstuvwxyz];'
-      },
-      {
-        sTitle:
-            'Preservation of the identifier of a function expression.',
-        sInput:
-            'void [' +
-            '  function abcdefghijklmnopqrstuvwxyz() {' +
-            '  },' +
-            '  function abcdefghijklmnopqrstuvwxyz() {' +
-            '  }' +
-            '];'
-      },
-      {
-        sTitle:
-            'Preservation of a formal parameter of a function declaration.',
-        sInput:
-            'function foo(abcdefghijklmnopqrstuvwxyz) {' +
-            '}' +
-            'function bar(abcdefghijklmnopqrstuvwxyz) {' +
-            '}'
-      },
-      {
-        sTitle:
-            'Preservation of a formal parameter in a function expression.',
-        sInput:
-            'void [' +
-            '  function(abcdefghijklmnopqrstuvwxyz) {' +
-            '  },' +
-            '  function(abcdefghijklmnopqrstuvwxyz) {' +
-            '  }' +
-            '];'
-      },
-      {
-        sTitle:
-            'Exclusion of a function declaration.',
-        sInput:
-            'void ["abcdefghijklmnopqrstuvwxyz"];' +
-            'function foo() {' +
-            '}' +
-            'void ["abcdefghijklmnopqrstuvwxyz"];'
-      },
-      {
-        sTitle:
-            'Consolidation within a function declaration.',
-        sInput:
-            'function foo() {' +
-            '  void ["abcdefghijklmnopqrstuvwxyz",' +
-            '        "abcdefghijklmnopqrstuvwxyz"];' +
-            '}',
-        sOutput:
-            'function foo() {' +
-            '  var a = "abcdefghijklmnopqrstuvwxyz";' +
-            '  void [a, a];' +
-            '}'
-      },
-      // 14 Program.
-      {
-        sTitle:
-            'Preservation of a program without source elements.',
-        sInput:
-            ''
-      },
-      // 14.1 Directive Prologues and the Use Strict Directive.
-      {
-        sTitle:
-            'Preservation of a Directive Prologue in global code.',
-        sInput:
-            '"abcdefghijklmnopqrstuvwxyz";' +
-            '\'zyxwvutsrqponmlkjihgfedcba\';'
-      },
-      {
-        sTitle:
-            'Preservation of a Directive Prologue in a function declaration.',
-        sInput:
-            'function foo() {' +
-            '  "abcdefghijklmnopqrstuvwxyz";' +
-            '  \'zyxwvutsrqponmlkjihgfedcba\';' +
-            '}'
-      },
-      {
-        sTitle:
-            'Preservation of a Directive Prologue in a function expression.',
-        sInput:
-            'void [' +
-            '  function() {' +
-            '    "abcdefghijklmnopqrstuvwxyz";' +
-            '    \'zyxwvutsrqponmlkjihgfedcba\';' +
-            '  }' +
-            '];'
-      },
-      {
-        sTitle:
-            'Ignorance with regard to a Directive Prologue in global code.',
-        sInput:
-            '"abcdefghijklmnopqrstuvwxyz";' +
-            'void ["abcdefghijklmnopqrstuvwxyz",' +
-            '      "abcdefghijklmnopqrstuvwxyz"];',
-        sOutput:
-            '"abcdefghijklmnopqrstuvwxyz";' +
-            '(function() {' +
-            '  var a = "abcdefghijklmnopqrstuvwxyz";' +
-            '  void [a, a];' +
-            '}());'
-      },
-      {
-        sTitle:
-            'Ignorance with regard to a Directive Prologue in a function' +
-            'declaration.',
-        sInput:
-            'function foo() {' +
-            '  "abcdefghijklmnopqrstuvwxyz";' +
-            '  void ["abcdefghijklmnopqrstuvwxyz",' +
-            '        "abcdefghijklmnopqrstuvwxyz"];' +
-            '}',
-        sOutput:
-            'function foo() {' +
-            '  "abcdefghijklmnopqrstuvwxyz";' +
-            '  var a = "abcdefghijklmnopqrstuvwxyz";' +
-            '  void [a, a];' +
-            '}'
-      },
-      {
-        sTitle:
-            'Ignorance with regard to a Directive Prologue in a function' +
-            'expression.',
-        sInput:
-            '(function() {' +
-            '  "abcdefghijklmnopqrstuvwxyz";' +
-            '  void ["abcdefghijklmnopqrstuvwxyz",' +
-            '        "abcdefghijklmnopqrstuvwxyz"];' +
-            '}());',
-        sOutput:
-            '(function() {' +
-            '  "abcdefghijklmnopqrstuvwxyz";' +
-            '  var a = "abcdefghijklmnopqrstuvwxyz";' +
-            '  void [a, a];' +
-            '}());'
-      },
-      // 15.1 The Global Object.
-      {
-        sTitle:
-            'Preservation of a property of the global object.',
-        sInput:
-            'void [undefined, undefined, undefined, undefined, undefined];'
-      },
-      // 15.1.2.1.1 Direct Call to Eval.
-      {
-        sTitle:
-            'Exclusion of a direct call to the eval function in the same ' +
-            'syntactic code unit.',
-        sInput:
-            '/*jshint evil:true */' +
-            'void ["abcdefghijklmnopqrstuvwxyz"];' +
-            'eval("");' +
-            'void ["abcdefghijklmnopqrstuvwxyz"];'
-      },
-      {
-        sTitle:
-            'Exclusion of a direct call to the eval function in nested ' +
-            'function code.',
-        sInput:
-            '/*jshint evil:true */' +
-            'void ["abcdefghijklmnopqrstuvwxyz"];' +
-            '(function() {' +
-            '  eval("");' +
-            '}());' +
-            'void ["abcdefghijklmnopqrstuvwxyz"];'
-      },
-      {
-        sTitle:
-            'Consolidation within a direct call to the eval function.',
-        sInput:
-            '/*jshint evil:true */' +
-            'eval(function() {' +
-            '  void ["abcdefghijklmnopqrstuvwxyz",' +
-            '        "abcdefghijklmnopqrstuvwxyz"];' +
-            '}());',
-        sOutput:
-            '/*jshint evil:true */' +
-            'eval(function() {' +
-            '  var a = "abcdefghijklmnopqrstuvwxyz";' +
-            '  void [a, a];' +
-            '}());'
-      },
-      // Consolidation proper.
-      {
-        sTitle:
-            'No consolidation if it does not result in a reduction of the ' +
-            'number of source characters.',
-        sInput:
-            '(function() {' +
-            '  var foo;' +
-            '  void ["ab", "ab", "abc", "abc"];' +
-            '}());'
-      },
-      {
-        sTitle:
-            'Identification of a range of source elements at the beginning ' +
-            'of global code.',
-        sInput:
-            '/*jshint evil:true */' +
-            '"abcdefghijklmnopqrstuvwxyz";' +
-            'void ["abcdefghijklmnopqrstuvwxyz",' +
-            '      "abcdefghijklmnopqrstuvwxyz"];' +
-            'eval("");',
-        sOutput:
-            '/*jshint evil:true */' +
-            '"abcdefghijklmnopqrstuvwxyz";' +
-            '(function() {' +
-            '  var a = "abcdefghijklmnopqrstuvwxyz";' +
-            '  void [a, a];' +
-            '}());' +
-            'eval("");'
-      },
-      {
-        sTitle:
-            'Identification of a range of source elements in the middle of ' +
-            'global code.',
-        sInput:
-            '/*jshint evil:true */' +
-            '"abcdefghijklmnopqrstuvwxyz";' +
-            'eval("");' +
-            'void ["abcdefghijklmnopqrstuvwxyz",' +
-            '      "abcdefghijklmnopqrstuvwxyz"];' +
-            'eval("");',
-        sOutput:
-            '/*jshint evil:true */' +
-            '"abcdefghijklmnopqrstuvwxyz";' +
-            'eval("");' +
-            '(function() {' +
-            '  var a = "abcdefghijklmnopqrstuvwxyz";' +
-            '  void [a, a];' +
-            '}());' +
-            'eval("");'
-      },
-      {
-        sTitle:
-            'Identification of a range of source elements at the end of ' +
-            'global code.',
-        sInput:
-            '/*jshint evil:true */' +
-            '"abcdefghijklmnopqrstuvwxyz";' +
-            'eval("");' +
-            'void ["abcdefghijklmnopqrstuvwxyz",' +
-            '      "abcdefghijklmnopqrstuvwxyz"];',
-        sOutput:
-            '/*jshint evil:true */' +
-            '"abcdefghijklmnopqrstuvwxyz";' +
-            'eval("");' +
-            '(function() {' +
-            '  var a = "abcdefghijklmnopqrstuvwxyz";' +
-            '  void [a, a];' +
-            '}());'
-      },
-      {
-        sTitle:
-            'Identification of a range of source elements at the beginning ' +
-            'of function code.',
-        sInput:
-            '/*jshint evil:true */' +
-            '(function() {' +
-            '  "abcdefghijklmnopqrstuvwxyz";' +
-            '  void ["abcdefghijklmnopqrstuvwxyz",' +
-            '        "abcdefghijklmnopqrstuvwxyz"];' +
-            '  eval("");' +
-            '}());',
-        sOutput:
-            '/*jshint evil:true */' +
-            '(function() {' +
-            '  "abcdefghijklmnopqrstuvwxyz";' +
-            '  (function() {' +
-            '    var a = "abcdefghijklmnopqrstuvwxyz";' +
-            '    void [a, a];' +
-            '  }());' +
-            '  eval("");' +
-            '}());'
-      },
-      {
-        sTitle:
-            'Identification of a range of source elements in the middle of ' +
-            'function code.',
-        sInput:
-            '/*jshint evil:true */' +
-            '(function() {' +
-            '  "abcdefghijklmnopqrstuvwxyz";' +
-            '  eval("");' +
-            '  void ["abcdefghijklmnopqrstuvwxyz",' +
-            '        "abcdefghijklmnopqrstuvwxyz"];' +
-            '  eval("");' +
-            '}());',
-        sOutput:
-            '/*jshint evil:true */' +
-            '(function() {' +
-            '  "abcdefghijklmnopqrstuvwxyz";' +
-            '  eval("");' +
-            '  (function() {' +
-            '    var a = "abcdefghijklmnopqrstuvwxyz";' +
-            '    void [a, a];' +
-            '  }());' +
-            '  eval("");' +
-            '}());'
-      },
-      {
-        sTitle:
-            'Identification of a range of source elements at the end of ' +
-            'function code.',
-        sInput:
-            '/*jshint evil:true */' +
-            '(function() {' +
-            '  "abcdefghijklmnopqrstuvwxyz";' +
-            '  eval("");' +
-            '  void ["abcdefghijklmnopqrstuvwxyz",' +
-            '        "abcdefghijklmnopqrstuvwxyz"];' +
-            '}());',
-        sOutput:
-            '/*jshint evil:true */' +
-            '(function() {' +
-            '  "abcdefghijklmnopqrstuvwxyz";' +
-            '  eval("");' +
-            '  (function() {' +
-            '    var a = "abcdefghijklmnopqrstuvwxyz";' +
-            '    void [a, a];' +
-            '  }());' +
-            '}());'
-      },
-      {
-        sTitle:
-            'Evaluation with regard to String values of String literals and ' +
-            'String values derived from identifier names used as property' +
-            'accessors.',
-        sInput:
-            '(function() {' +
-            '  var foo;' +
-            '  void ["abcdefg", Math.abcdefg, "abcdef", Math.abcdef];' +
-            '}());',
-        sOutput:
-            '(function() {' +
-            '  var a = "abcdefg", foo;' +
-            '  void [a, Math[a], "abcdef", Math.abcdef];' +
-            '}());'
-      },
-      {
-        sTitle:
-            'Evaluation with regard to the necessity of adding a variable ' +
-            'statement.',
-        sInput:
-            '/*jshint evil:true */' +
-            '(function() {' +
-            '  void ["abcdefgh", "abcdefgh"];' +
-            '}());' +
-            'eval("");' +
-            '(function() {' +
-            '  void ["abcdefg", "abcdefg"];' +
-            '}());' +
-            'eval("");' +
-            '(function() {' +
-            '  var foo;' +
-            '  void ["abcd", "abcd"];' +
-            '}());',
-        sOutput:
-            '/*jshint evil:true */' +
-            '(function() {' +
-            '  var a = "abcdefgh";' +
-            '  void [a, a];' +
-            '}());' +
-            'eval("");' +
-            '(function() {' +
-            '  void ["abcdefg", "abcdefg"];' +
-            '}());' +
-            'eval("");' +
-            '(function() {' +
-            '  var a = "abcd", foo;' +
-            '  void [a, a];' +
-            '}());'
-      },
-      {
-        sTitle:
-            'Evaluation with regard to the necessity of enclosing source ' +
-            'elements.',
-        sInput:
-            '/*jshint evil:true */' +
-            'void ["abcdefghijklmnopqrstuvwxy", "abcdefghijklmnopqrstuvwxy"];' +
-            'eval("");' +
-            'void ["abcdefghijklmnopqrstuvwx", "abcdefghijklmnopqrstuvwx"];' +
-            'eval("");' +
-            '(function() {' +
-            '  void ["abcdefgh", "abcdefgh"];' +
-            '}());' +
-            '(function() {' +
-            '  void ["abcdefghijklmnopqrstuvwxy",' +
-            '        "abcdefghijklmnopqrstuvwxy"];' +
-            '  eval("");' +
-            '  void ["abcdefghijklmnopqrstuvwx",' +
-            '        "abcdefghijklmnopqrstuvwx"];' +
-            '  eval("");' +
-            '  (function() {' +
-            '    void ["abcdefgh", "abcdefgh"];' +
-            '  }());' +
-            '}());',
-        sOutput:
-            '/*jshint evil:true */' +
-            '(function() {' +
-            '  var a = "abcdefghijklmnopqrstuvwxy";' +
-            '  void [a, a];' +
-            '}());' +
-            'eval("");' +
-            'void ["abcdefghijklmnopqrstuvwx", "abcdefghijklmnopqrstuvwx"];' +
-            'eval("");' +
-            '(function() {' +
-            '  var a = "abcdefgh";' +
-            '  void [a, a];' +
-            '}());' +
-            '(function() {' +
-            '  (function() {' +
-            '    var a = "abcdefghijklmnopqrstuvwxy";' +
-            '    void [a, a];' +
-            '  }());' +
-            '  eval("");' +
-            '  void ["abcdefghijklmnopqrstuvwx", "abcdefghijklmnopqrstuvwx"];' +
-            '  eval("");' +
-            '  (function() {' +
-            '    var a = "abcdefgh";' +
-            '    void [a, a];' +
-            '  }());' +
-            '}());'
-      },
-      {
-        sTitle:
-            'Employment of a closure while consolidating in global code.',
-        sInput:
-            'void ["abcdefghijklmnopqrstuvwxyz",' +
-            '      "abcdefghijklmnopqrstuvwxyz"];',
-        sOutput:
-            '(function() {' +
-            '  var a = "abcdefghijklmnopqrstuvwxyz";' +
-            '  void [a, a];' +
-            '}());'
-      },
-      {
-        sTitle:
-            'Assignment of a shorter identifier to a value whose ' +
-            'consolidation results in a greater reduction of the number of ' +
-            'source characters.',
-        sInput:
-            '(function() {' +
-            '  var b, c, d, e, f, g, h, i, j, k, l, m,' +
-            '      n, o, p, q, r, s, t, u, v, w, x, y, z,' +
-            '      A, B, C, D, E, F, G, H, I, J, K, L, M,' +
-            '      N, O, P, Q, R, S, T, U, V, W, X, Y, Z,' +
-            '      $, _;' +
-            '  void ["abcde", "abcde", "edcba", "edcba", "edcba"];' +
-            '}());',
-        sOutput:
-            '(function() {' +
-            '  var a = "edcba",' +
-            '      b, c, d, e, f, g, h, i, j, k, l, m,' +
-            '      n, o, p, q, r, s, t, u, v, w, x, y, z,' +
-            '      A, B, C, D, E, F, G, H, I, J, K, L, M,' +
-            '      N, O, P, Q, R, S, T, U, V, W, X, Y, Z,' +
-            '      $, _;' +
-            '  void ["abcde", "abcde", a, a, a];' +
-            '}());'
-      }
-    ].forEach(cAssert);
-  }());
-}
-
-/* Local Variables:      */
-/* mode: js              */
-/* coding: utf-8         */
-/* indent-tabs-mode: nil */
-/* tab-width: 2          */
-/* End:                  */
-/* vim: set ft=javascript fenc=utf-8 et ts=2 sts=2 sw=2: */
-/* :mode=javascript:noTabs=true:tabSize=2:indentSize=2:deepIndent=true: */
-

+ 0 - 75
utils/node_modules/uglify-js/lib/object-ast.js

@@ -1,75 +0,0 @@
-var jsp = require("./parse-js"),
-    pro = require("./process");
-
-var BY_TYPE = {};
-
-function HOP(obj, prop) {
-        return Object.prototype.hasOwnProperty.call(obj, prop);
-};
-
-function AST_Node(parent) {
-        this.parent = parent;
-};
-
-AST_Node.prototype.init = function(){};
-
-function DEFINE_NODE_CLASS(type, props, methods) {
-        var base = methods && methods.BASE || AST_Node;
-        if (!base) base = AST_Node;
-        function D(parent, data) {
-                base.apply(this, arguments);
-                if (props) props.forEach(function(name, i){
-                        this["_" + name] = data[i];
-                });
-                this.init();
-        };
-        var P = D.prototype = new AST_Node;
-        P.node_type = function(){ return type };
-        if (props) props.forEach(function(name){
-                var propname = "_" + name;
-                P["set_" + name] = function(val) {
-                        this[propname] = val;
-                        return this;
-                };
-                P["get_" + name] = function() {
-                        return this[propname];
-                };
-        });
-        if (type != null) BY_TYPE[type] = D;
-        if (methods) for (var i in methods) if (HOP(methods, i)) {
-                P[i] = methods[i];
-        }
-        return D;
-};
-
-var AST_String_Node = DEFINE_NODE_CLASS("string", ["value"]);
-var AST_Number_Node = DEFINE_NODE_CLASS("num", ["value"]);
-var AST_Name_Node = DEFINE_NODE_CLASS("name", ["value"]);
-
-var AST_Statlist_Node = DEFINE_NODE_CLASS(null, ["body"]);
-var AST_Root_Node = DEFINE_NODE_CLASS("toplevel", null, { BASE: AST_Statlist_Node });
-var AST_Block_Node = DEFINE_NODE_CLASS("block", null, { BASE: AST_Statlist_Node });
-var AST_Splice_Node = DEFINE_NODE_CLASS("splice", null, { BASE: AST_Statlist_Node });
-
-var AST_Var_Node = DEFINE_NODE_CLASS("var", ["definitions"]);
-var AST_Const_Node = DEFINE_NODE_CLASS("const", ["definitions"]);
-
-var AST_Try_Node = DEFINE_NODE_CLASS("try", ["body", "catch", "finally"]);
-var AST_Throw_Node = DEFINE_NODE_CLASS("throw", ["exception"]);
-
-var AST_New_Node = DEFINE_NODE_CLASS("new", ["constructor", "arguments"]);
-
-var AST_Switch_Node = DEFINE_NODE_CLASS("switch", ["expression", "branches"]);
-var AST_Switch_Branch_Node = DEFINE_NODE_CLASS(null, ["expression", "body"]);
-
-var AST_Break_Node = DEFINE_NODE_CLASS("break", ["label"]);
-var AST_Continue_Node = DEFINE_NODE_CLASS("continue", ["label"]);
-var AST_Assign_Node = DEFINE_NODE_CLASS("assign", ["operator", "lvalue", "rvalue"]);
-var AST_Dot_Node = DEFINE_NODE_CLASS("dot", ["expression", "name"]);
-var AST_Call_Node = DEFINE_NODE_CLASS("call", ["function", "arguments"]);
-
-var AST_Lambda_Node = DEFINE_NODE_CLASS(null, ["name", "arguments", "body"])
-var AST_Function_Node = DEFINE_NODE_CLASS("function", null, AST_Lambda_Node);
-var AST_Defun_Node = DEFINE_NODE_CLASS("defun", null, AST_Lambda_Node);
-
-var AST_If_Node = DEFINE_NODE_CLASS("if", ["condition", "then", "else"]);

文件差异内容过多而无法显示
+ 0 - 203
utils/node_modules/uglify-js/lib/parse-js.js


+ 0 - 2011
utils/node_modules/uglify-js/lib/process.js

@@ -1,2011 +0,0 @@
-/***********************************************************************
-
-  A JavaScript tokenizer / parser / beautifier / compressor.
-
-  This version is suitable for Node.js.  With minimal changes (the
-  exports stuff) it should work on any JS platform.
-
-  This file implements some AST processors.  They work on data built
-  by parse-js.
-
-  Exported functions:
-
-    - ast_mangle(ast, options) -- mangles the variable/function names
-      in the AST.  Returns an AST.
-
-    - ast_squeeze(ast) -- employs various optimizations to make the
-      final generated code even smaller.  Returns an AST.
-
-    - gen_code(ast, options) -- generates JS code from the AST.  Pass
-      true (or an object, see the code for some options) as second
-      argument to get "pretty" (indented) code.
-
-  -------------------------------- (C) ---------------------------------
-
-                           Author: Mihai Bazon
-                         <[email protected]>
-                       http://mihai.bazon.net/blog
-
-  Distributed under the BSD license:
-
-    Copyright 2010 (c) Mihai Bazon <[email protected]>
-
-    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.
-
- ***********************************************************************/
-
-var jsp = require("./parse-js"),
-    slice = jsp.slice,
-    member = jsp.member,
-    PRECEDENCE = jsp.PRECEDENCE,
-    OPERATORS = jsp.OPERATORS;
-
-/* -----[ helper for AST traversal ]----- */
-
-function ast_walker() {
-        function _vardefs(defs) {
-                return [ this[0], MAP(defs, function(def){
-                        var a = [ def[0] ];
-                        if (def.length > 1)
-                                a[1] = walk(def[1]);
-                        return a;
-                }) ];
-        };
-        function _block(statements) {
-                var out = [ this[0] ];
-                if (statements != null)
-                        out.push(MAP(statements, walk));
-                return out;
-        };
-        var walkers = {
-                "string": function(str) {
-                        return [ this[0], str ];
-                },
-                "num": function(num) {
-                        return [ this[0], num ];
-                },
-                "name": function(name) {
-                        return [ this[0], name ];
-                },
-                "toplevel": function(statements) {
-                        return [ this[0], MAP(statements, walk) ];
-                },
-                "block": _block,
-                "splice": _block,
-                "var": _vardefs,
-                "const": _vardefs,
-                "try": function(t, c, f) {
-                        return [
-                                this[0],
-                                MAP(t, walk),
-                                c != null ? [ c[0], MAP(c[1], walk) ] : null,
-                                f != null ? MAP(f, walk) : null
-                        ];
-                },
-                "throw": function(expr) {
-                        return [ this[0], walk(expr) ];
-                },
-                "new": function(ctor, args) {
-                        return [ this[0], walk(ctor), MAP(args, walk) ];
-                },
-                "switch": function(expr, body) {
-                        return [ this[0], walk(expr), MAP(body, function(branch){
-                                return [ branch[0] ? walk(branch[0]) : null,
-                                         MAP(branch[1], walk) ];
-                        }) ];
-                },
-                "break": function(label) {
-                        return [ this[0], label ];
-                },
-                "continue": function(label) {
-                        return [ this[0], label ];
-                },
-                "conditional": function(cond, t, e) {
-                        return [ this[0], walk(cond), walk(t), walk(e) ];
-                },
-                "assign": function(op, lvalue, rvalue) {
-                        return [ this[0], op, walk(lvalue), walk(rvalue) ];
-                },
-                "dot": function(expr) {
-                        return [ this[0], walk(expr) ].concat(slice(arguments, 1));
-                },
-                "call": function(expr, args) {
-                        return [ this[0], walk(expr), MAP(args, walk) ];
-                },
-                "function": function(name, args, body) {
-                        return [ this[0], name, args.slice(), MAP(body, walk) ];
-                },
-                "debugger": function() {
-                        return [ this[0] ];
-                },
-                "defun": function(name, args, body) {
-                        return [ this[0], name, args.slice(), MAP(body, walk) ];
-                },
-                "if": function(conditional, t, e) {
-                        return [ this[0], walk(conditional), walk(t), walk(e) ];
-                },
-                "for": function(init, cond, step, block) {
-                        return [ this[0], walk(init), walk(cond), walk(step), walk(block) ];
-                },
-                "for-in": function(vvar, key, hash, block) {
-                        return [ this[0], walk(vvar), walk(key), walk(hash), walk(block) ];
-                },
-                "while": function(cond, block) {
-                        return [ this[0], walk(cond), walk(block) ];
-                },
-                "do": function(cond, block) {
-                        return [ this[0], walk(cond), walk(block) ];
-                },
-                "return": function(expr) {
-                        return [ this[0], walk(expr) ];
-                },
-                "binary": function(op, left, right) {
-                        return [ this[0], op, walk(left), walk(right) ];
-                },
-                "unary-prefix": function(op, expr) {
-                        return [ this[0], op, walk(expr) ];
-                },
-                "unary-postfix": function(op, expr) {
-                        return [ this[0], op, walk(expr) ];
-                },
-                "sub": function(expr, subscript) {
-                        return [ this[0], walk(expr), walk(subscript) ];
-                },
-                "object": function(props) {
-                        return [ this[0], MAP(props, function(p){
-                                return p.length == 2
-                                        ? [ p[0], walk(p[1]) ]
-                                        : [ p[0], walk(p[1]), p[2] ]; // get/set-ter
-                        }) ];
-                },
-                "regexp": function(rx, mods) {
-                        return [ this[0], rx, mods ];
-                },
-                "array": function(elements) {
-                        return [ this[0], MAP(elements, walk) ];
-                },
-                "stat": function(stat) {
-                        return [ this[0], walk(stat) ];
-                },
-                "seq": function() {
-                        return [ this[0] ].concat(MAP(slice(arguments), walk));
-                },
-                "label": function(name, block) {
-                        return [ this[0], name, walk(block) ];
-                },
-                "with": function(expr, block) {
-                        return [ this[0], walk(expr), walk(block) ];
-                },
-                "atom": function(name) {
-                        return [ this[0], name ];
-                }
-        };
-
-        var user = {};
-        var stack = [];
-        function walk(ast) {
-                if (ast == null)
-                        return null;
-                try {
-                        stack.push(ast);
-                        var type = ast[0];
-                        var gen = user[type];
-                        if (gen) {
-                                var ret = gen.apply(ast, ast.slice(1));
-                                if (ret != null)
-                                        return ret;
-                        }
-                        gen = walkers[type];
-                        return gen.apply(ast, ast.slice(1));
-                } finally {
-                        stack.pop();
-                }
-        };
-
-        function dive(ast) {
-                if (ast == null)
-                        return null;
-                try {
-                        stack.push(ast);
-                        return walkers[ast[0]].apply(ast, ast.slice(1));
-                } finally {
-                        stack.pop();
-                }
-        };
-
-        function with_walkers(walkers, cont){
-                var save = {}, i;
-                for (i in walkers) if (HOP(walkers, i)) {
-                        save[i] = user[i];
-                        user[i] = walkers[i];
-                }
-                var ret = cont();
-                for (i in save) if (HOP(save, i)) {
-                        if (!save[i]) delete user[i];
-                        else user[i] = save[i];
-                }
-                return ret;
-        };
-
-        return {
-                walk: walk,
-                dive: dive,
-                with_walkers: with_walkers,
-                parent: function() {
-                        return stack[stack.length - 2]; // last one is current node
-                },
-                stack: function() {
-                        return stack;
-                }
-        };
-};
-
-/* -----[ Scope and mangling ]----- */
-
-function Scope(parent) {
-        this.names = {};        // names defined in this scope
-        this.mangled = {};      // mangled names (orig.name => mangled)
-        this.rev_mangled = {};  // reverse lookup (mangled => orig.name)
-        this.cname = -1;        // current mangled name
-        this.refs = {};         // names referenced from this scope
-        this.uses_with = false; // will become TRUE if with() is detected in this or any subscopes
-        this.uses_eval = false; // will become TRUE if eval() is detected in this or any subscopes
-        this.parent = parent;   // parent scope
-        this.children = [];     // sub-scopes
-        if (parent) {
-                this.level = parent.level + 1;
-                parent.children.push(this);
-        } else {
-                this.level = 0;
-        }
-};
-
-var base54 = (function(){
-        var DIGITS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_0123456789";
-        return function(num) {
-                var ret = "", base = 54;
-                do {
-                        ret += DIGITS.charAt(num % base);
-                        num = Math.floor(num / base);
-                        base = 64;
-                } while (num > 0);
-                return ret;
-        };
-})();
-
-Scope.prototype = {
-        has: function(name) {
-                for (var s = this; s; s = s.parent)
-                        if (HOP(s.names, name))
-                                return s;
-        },
-        has_mangled: function(mname) {
-                for (var s = this; s; s = s.parent)
-                        if (HOP(s.rev_mangled, mname))
-                                return s;
-        },
-        toJSON: function() {
-                return {
-                        names: this.names,
-                        uses_eval: this.uses_eval,
-                        uses_with: this.uses_with
-                };
-        },
-
-        next_mangled: function() {
-                // we must be careful that the new mangled name:
-                //
-                // 1. doesn't shadow a mangled name from a parent
-                //    scope, unless we don't reference the original
-                //    name from this scope OR from any sub-scopes!
-                //    This will get slow.
-                //
-                // 2. doesn't shadow an original name from a parent
-                //    scope, in the event that the name is not mangled
-                //    in the parent scope and we reference that name
-                //    here OR IN ANY SUBSCOPES!
-                //
-                // 3. doesn't shadow a name that is referenced but not
-                //    defined (possibly global defined elsewhere).
-                for (;;) {
-                        var m = base54(++this.cname), prior;
-
-                        // case 1.
-                        prior = this.has_mangled(m);
-                        if (prior && this.refs[prior.rev_mangled[m]] === prior)
-                                continue;
-
-                        // case 2.
-                        prior = this.has(m);
-                        if (prior && prior !== this && this.refs[m] === prior && !prior.has_mangled(m))
-                                continue;
-
-                        // case 3.
-                        if (HOP(this.refs, m) && this.refs[m] == null)
-                                continue;
-
-                        // I got "do" once. :-/
-                        if (!is_identifier(m))
-                                continue;
-
-                        return m;
-                }
-        },
-        set_mangle: function(name, m) {
-                this.rev_mangled[m] = name;
-                return this.mangled[name] = m;
-        },
-        get_mangled: function(name, newMangle) {
-                if (this.uses_eval || this.uses_with) return name; // no mangle if eval or with is in use
-                var s = this.has(name);
-                if (!s) return name; // not in visible scope, no mangle
-                if (HOP(s.mangled, name)) return s.mangled[name]; // already mangled in this scope
-                if (!newMangle) return name;                      // not found and no mangling requested
-                return s.set_mangle(name, s.next_mangled());
-        },
-        references: function(name) {
-                return name && !this.parent || this.uses_with || this.uses_eval || this.refs[name];
-        },
-        define: function(name, type) {
-                if (name != null) {
-                        if (type == "var" || !HOP(this.names, name))
-                                this.names[name] = type || "var";
-                        return name;
-                }
-        }
-};
-
-function ast_add_scope(ast) {
-
-        var current_scope = null;
-        var w = ast_walker(), walk = w.walk;
-        var having_eval = [];
-
-        function with_new_scope(cont) {
-                current_scope = new Scope(current_scope);
-                current_scope.labels = new Scope();
-                var ret = current_scope.body = cont();
-                ret.scope = current_scope;
-                current_scope = current_scope.parent;
-                return ret;
-        };
-
-        function define(name, type) {
-                return current_scope.define(name, type);
-        };
-
-        function reference(name) {
-                current_scope.refs[name] = true;
-        };
-
-        function _lambda(name, args, body) {
-                var is_defun = this[0] == "defun";
-                return [ this[0], is_defun ? define(name, "defun") : name, args, with_new_scope(function(){
-                        if (!is_defun) define(name, "lambda");
-                        MAP(args, function(name){ define(name, "arg") });
-                        return MAP(body, walk);
-                })];
-        };
-
-        function _vardefs(type) {
-                return function(defs) {
-                        MAP(defs, function(d){
-                                define(d[0], type);
-                                if (d[1]) reference(d[0]);
-                        });
-                };
-        };
-
-        function _breacont(label) {
-                if (label)
-                        current_scope.labels.refs[label] = true;
-        };
-
-        return with_new_scope(function(){
-                // process AST
-                var ret = w.with_walkers({
-                        "function": _lambda,
-                        "defun": _lambda,
-                        "label": function(name, stat) { current_scope.labels.define(name) },
-                        "break": _breacont,
-                        "continue": _breacont,
-                        "with": function(expr, block) {
-                                for (var s = current_scope; s; s = s.parent)
-                                        s.uses_with = true;
-                        },
-                        "var": _vardefs("var"),
-                        "const": _vardefs("const"),
-                        "try": function(t, c, f) {
-                                if (c != null) return [
-                                        this[0],
-                                        MAP(t, walk),
-                                        [ define(c[0], "catch"), MAP(c[1], walk) ],
-                                        f != null ? MAP(f, walk) : null
-                                ];
-                        },
-                        "name": function(name) {
-                                if (name == "eval")
-                                        having_eval.push(current_scope);
-                                reference(name);
-                        }
-                }, function(){
-                        return walk(ast);
-                });
-
-                // the reason why we need an additional pass here is
-                // that names can be used prior to their definition.
-
-                // scopes where eval was detected and their parents
-                // are marked with uses_eval, unless they define the
-                // "eval" name.
-                MAP(having_eval, function(scope){
-                        if (!scope.has("eval")) while (scope) {
-                                scope.uses_eval = true;
-                                scope = scope.parent;
-                        }
-                });
-
-                // for referenced names it might be useful to know
-                // their origin scope.  current_scope here is the
-                // toplevel one.
-                function fixrefs(scope, i) {
-                        // do children first; order shouldn't matter
-                        for (i = scope.children.length; --i >= 0;)
-                                fixrefs(scope.children[i]);
-                        for (i in scope.refs) if (HOP(scope.refs, i)) {
-                                // find origin scope and propagate the reference to origin
-                                for (var origin = scope.has(i), s = scope; s; s = s.parent) {
-                                        s.refs[i] = origin;
-                                        if (s === origin) break;
-                                }
-                        }
-                };
-                fixrefs(current_scope);
-
-                return ret;
-        });
-
-};
-
-/* -----[ mangle names ]----- */
-
-function ast_mangle(ast, options) {
-        var w = ast_walker(), walk = w.walk, scope;
-        options = options || {};
-
-        function get_mangled(name, newMangle) {
-                if (!options.toplevel && !scope.parent) return name; // don't mangle toplevel
-                if (options.except && member(name, options.except))
-                        return name;
-                return scope.get_mangled(name, newMangle);
-        };
-
-        function get_define(name) {
-                if (options.defines) {
-                        // we always lookup a defined symbol for the current scope FIRST, so declared
-                        // vars trump a DEFINE symbol, but if no such var is found, then match a DEFINE value
-                        if (!scope.has(name)) {
-                                if (HOP(options.defines, name)) {
-                                        return options.defines[name];
-                                }
-                        }
-                        return null;
-                }
-        };
-
-        function _lambda(name, args, body) {
-                if (!options.no_functions) {
-                        var is_defun = this[0] == "defun", extra;
-                        if (name) {
-                                if (is_defun) name = get_mangled(name);
-                                else if (body.scope.references(name)) {
-                                        extra = {};
-                                        if (!(scope.uses_eval || scope.uses_with))
-                                                name = extra[name] = scope.next_mangled();
-                                        else
-                                                extra[name] = name;
-                                }
-                                else name = null;
-                        }
-                }
-                body = with_scope(body.scope, function(){
-                        args = MAP(args, function(name){ return get_mangled(name) });
-                        return MAP(body, walk);
-                }, extra);
-                return [ this[0], name, args, body ];
-        };
-
-        function with_scope(s, cont, extra) {
-                var _scope = scope;
-                scope = s;
-                if (extra) for (var i in extra) if (HOP(extra, i)) {
-                        s.set_mangle(i, extra[i]);
-                }
-                for (var i in s.names) if (HOP(s.names, i)) {
-                        get_mangled(i, true);
-                }
-                var ret = cont();
-                ret.scope = s;
-                scope = _scope;
-                return ret;
-        };
-
-        function _vardefs(defs) {
-                return [ this[0], MAP(defs, function(d){
-                        return [ get_mangled(d[0]), walk(d[1]) ];
-                }) ];
-        };
-
-        function _breacont(label) {
-                if (label) return [ this[0], scope.labels.get_mangled(label) ];
-        };
-
-        return w.with_walkers({
-                "function": _lambda,
-                "defun": function() {
-                        // move function declarations to the top when
-                        // they are not in some block.
-                        var ast = _lambda.apply(this, arguments);
-                        switch (w.parent()[0]) {
-                            case "toplevel":
-                            case "function":
-                            case "defun":
-                                return MAP.at_top(ast);
-                        }
-                        return ast;
-                },
-                "label": function(label, stat) {
-                        if (scope.labels.refs[label]) return [
-                                this[0],
-                                scope.labels.get_mangled(label, true),
-                                walk(stat)
-                        ];
-                        return walk(stat);
-                },
-                "break": _breacont,
-                "continue": _breacont,
-                "var": _vardefs,
-                "const": _vardefs,
-                "name": function(name) {
-                        return get_define(name) || [ this[0], get_mangled(name) ];
-                },
-                "try": function(t, c, f) {
-                        return [ this[0],
-                                 MAP(t, walk),
-                                 c != null ? [ get_mangled(c[0]), MAP(c[1], walk) ] : null,
-                                 f != null ? MAP(f, walk) : null ];
-                },
-                "toplevel": function(body) {
-                        var self = this;
-                        return with_scope(self.scope, function(){
-                                return [ self[0], MAP(body, walk) ];
-                        });
-                }
-        }, function() {
-                return walk(ast_add_scope(ast));
-        });
-};
-
-/* -----[
-   - compress foo["bar"] into foo.bar,
-   - remove block brackets {} where possible
-   - join consecutive var declarations
-   - various optimizations for IFs:
-     - if (cond) foo(); else bar();  ==>  cond?foo():bar();
-     - if (cond) foo();  ==>  cond&&foo();
-     - if (foo) return bar(); else return baz();  ==> return foo?bar():baz(); // also for throw
-     - if (foo) return bar(); else something();  ==> {if(foo)return bar();something()}
-   ]----- */
-
-var warn = function(){};
-
-function best_of(ast1, ast2) {
-        return gen_code(ast1).length > gen_code(ast2[0] == "stat" ? ast2[1] : ast2).length ? ast2 : ast1;
-};
-
-function last_stat(b) {
-        if (b[0] == "block" && b[1] && b[1].length > 0)
-                return b[1][b[1].length - 1];
-        return b;
-}
-
-function aborts(t) {
-        if (t) switch (last_stat(t)[0]) {
-            case "return":
-            case "break":
-            case "continue":
-            case "throw":
-                return true;
-        }
-};
-
-function boolean_expr(expr) {
-        return ( (expr[0] == "unary-prefix"
-                  && member(expr[1], [ "!", "delete" ])) ||
-
-                 (expr[0] == "binary"
-                  && member(expr[1], [ "in", "instanceof", "==", "!=", "===", "!==", "<", "<=", ">=", ">" ])) ||
-
-                 (expr[0] == "binary"
-                  && member(expr[1], [ "&&", "||" ])
-                  && boolean_expr(expr[2])
-                  && boolean_expr(expr[3])) ||
-
-                 (expr[0] == "conditional"
-                  && boolean_expr(expr[2])
-                  && boolean_expr(expr[3])) ||
-
-                 (expr[0] == "assign"
-                  && expr[1] === true
-                  && boolean_expr(expr[3])) ||
-
-                 (expr[0] == "seq"
-                  && boolean_expr(expr[expr.length - 1]))
-               );
-};
-
-function empty(b) {
-        return !b || (b[0] == "block" && (!b[1] || b[1].length == 0));
-};
-
-function is_string(node) {
-        return (node[0] == "string" ||
-                node[0] == "unary-prefix" && node[1] == "typeof" ||
-                node[0] == "binary" && node[1] == "+" &&
-                (is_string(node[2]) || is_string(node[3])));
-};
-
-var when_constant = (function(){
-
-        var $NOT_CONSTANT = {};
-
-        // this can only evaluate constant expressions.  If it finds anything
-        // not constant, it throws $NOT_CONSTANT.
-        function evaluate(expr) {
-                switch (expr[0]) {
-                    case "string":
-                    case "num":
-                        return expr[1];
-                    case "name":
-                    case "atom":
-                        switch (expr[1]) {
-                            case "true": return true;
-                            case "false": return false;
-                            case "null": return null;
-                        }
-                        break;
-                    case "unary-prefix":
-                        switch (expr[1]) {
-                            case "!": return !evaluate(expr[2]);
-                            case "typeof": return typeof evaluate(expr[2]);
-                            case "~": return ~evaluate(expr[2]);
-                            case "-": return -evaluate(expr[2]);
-                            case "+": return +evaluate(expr[2]);
-                        }
-                        break;
-                    case "binary":
-                        var left = expr[2], right = expr[3];
-                        switch (expr[1]) {
-                            case "&&"         : return evaluate(left) &&         evaluate(right);
-                            case "||"         : return evaluate(left) ||         evaluate(right);
-                            case "|"          : return evaluate(left) |          evaluate(right);
-                            case "&"          : return evaluate(left) &          evaluate(right);
-                            case "^"          : return evaluate(left) ^          evaluate(right);
-                            case "+"          : return evaluate(left) +          evaluate(right);
-                            case "*"          : return evaluate(left) *          evaluate(right);
-                            case "/"          : return evaluate(left) /          evaluate(right);
-                            case "%"          : return evaluate(left) %          evaluate(right);
-                            case "-"          : return evaluate(left) -          evaluate(right);
-                            case "<<"         : return evaluate(left) <<         evaluate(right);
-                            case ">>"         : return evaluate(left) >>         evaluate(right);
-                            case ">>>"        : return evaluate(left) >>>        evaluate(right);
-                            case "=="         : return evaluate(left) ==         evaluate(right);
-                            case "==="        : return evaluate(left) ===        evaluate(right);
-                            case "!="         : return evaluate(left) !=         evaluate(right);
-                            case "!=="        : return evaluate(left) !==        evaluate(right);
-                            case "<"          : return evaluate(left) <          evaluate(right);
-                            case "<="         : return evaluate(left) <=         evaluate(right);
-                            case ">"          : return evaluate(left) >          evaluate(right);
-                            case ">="         : return evaluate(left) >=         evaluate(right);
-                            case "in"         : return evaluate(left) in         evaluate(right);
-                            case "instanceof" : return evaluate(left) instanceof evaluate(right);
-                        }
-                }
-                throw $NOT_CONSTANT;
-        };
-
-        return function(expr, yes, no) {
-                try {
-                        var val = evaluate(expr), ast;
-                        switch (typeof val) {
-                            case "string": ast =  [ "string", val ]; break;
-                            case "number": ast =  [ "num", val ]; break;
-                            case "boolean": ast =  [ "name", String(val) ]; break;
-                            default:
-                                if (val === null) { ast = [ "atom", "null" ]; break; }
-                                throw new Error("Can't handle constant of type: " + (typeof val));
-                        }
-                        return yes.call(expr, ast, val);
-                } catch(ex) {
-                        if (ex === $NOT_CONSTANT) {
-                                if (expr[0] == "binary"
-                                    && (expr[1] == "===" || expr[1] == "!==")
-                                    && ((is_string(expr[2]) && is_string(expr[3]))
-                                        || (boolean_expr(expr[2]) && boolean_expr(expr[3])))) {
-                                        expr[1] = expr[1].substr(0, 2);
-                                }
-                                else if (no && expr[0] == "binary"
-                                         && (expr[1] == "||" || expr[1] == "&&")) {
-                                    // the whole expression is not constant but the lval may be...
-                                    try {
-                                        var lval = evaluate(expr[2]);
-                                        expr = ((expr[1] == "&&" && (lval ? expr[3] : lval))    ||
-                                                (expr[1] == "||" && (lval ? lval    : expr[3])) ||
-                                                expr);
-                                    } catch(ex2) {
-                                        // IGNORE... lval is not constant
-                                    }
-                                }
-                                return no ? no.call(expr, expr) : null;
-                        }
-                        else throw ex;
-                }
-        };
-
-})();
-
-function warn_unreachable(ast) {
-        if (!empty(ast))
-                warn("Dropping unreachable code: " + gen_code(ast, true));
-};
-
-function prepare_ifs(ast) {
-        var w = ast_walker(), walk = w.walk;
-        // In this first pass, we rewrite ifs which abort with no else with an
-        // if-else.  For example:
-        //
-        // if (x) {
-        //     blah();
-        //     return y;
-        // }
-        // foobar();
-        //
-        // is rewritten into:
-        //
-        // if (x) {
-        //     blah();
-        //     return y;
-        // } else {
-        //     foobar();
-        // }
-        function redo_if(statements) {
-                statements = MAP(statements, walk);
-
-                for (var i = 0; i < statements.length; ++i) {
-                        var fi = statements[i];
-                        if (fi[0] != "if") continue;
-
-                        if (fi[3] && walk(fi[3])) continue;
-
-                        var t = walk(fi[2]);
-                        if (!aborts(t)) continue;
-
-                        var conditional = walk(fi[1]);
-
-                        var e_body = redo_if(statements.slice(i + 1));
-                        var e = e_body.length == 1 ? e_body[0] : [ "block", e_body ];
-
-                        return statements.slice(0, i).concat([ [
-                                fi[0],          // "if"
-                                conditional,    // conditional
-                                t,              // then
-                                e               // else
-                        ] ]);
-                }
-
-                return statements;
-        };
-
-        function redo_if_lambda(name, args, body) {
-                body = redo_if(body);
-                return [ this[0], name, args, body ];
-        };
-
-        function redo_if_block(statements) {
-                return [ this[0], statements != null ? redo_if(statements) : null ];
-        };
-
-        return w.with_walkers({
-                "defun": redo_if_lambda,
-                "function": redo_if_lambda,
-                "block": redo_if_block,
-                "splice": redo_if_block,
-                "toplevel": function(statements) {
-                        return [ this[0], redo_if(statements) ];
-                },
-                "try": function(t, c, f) {
-                        return [
-                                this[0],
-                                redo_if(t),
-                                c != null ? [ c[0], redo_if(c[1]) ] : null,
-                                f != null ? redo_if(f) : null
-                        ];
-                }
-        }, function() {
-                return walk(ast);
-        });
-};
-
-function for_side_effects(ast, handler) {
-        var w = ast_walker(), walk = w.walk;
-        var $stop = {}, $restart = {};
-        function stop() { throw $stop };
-        function restart() { throw $restart };
-        function found(){ return handler.call(this, this, w, stop, restart) };
-        function unary(op) {
-                if (op == "++" || op == "--")
-                        return found.apply(this, arguments);
-        };
-        return w.with_walkers({
-                "try": found,
-                "throw": found,
-                "return": found,
-                "new": found,
-                "switch": found,
-                "break": found,
-                "continue": found,
-                "assign": found,
-                "call": found,
-                "if": found,
-                "for": found,
-                "for-in": found,
-                "while": found,
-                "do": found,
-                "return": found,
-                "unary-prefix": unary,
-                "unary-postfix": unary,
-                "defun": found
-        }, function(){
-                while (true) try {
-                        walk(ast);
-                        break;
-                } catch(ex) {
-                        if (ex === $stop) break;
-                        if (ex === $restart) continue;
-                        throw ex;
-                }
-        });
-};
-
-function ast_lift_variables(ast) {
-        var w = ast_walker(), walk = w.walk, scope;
-        function do_body(body, env) {
-                var _scope = scope;
-                scope = env;
-                body = MAP(body, walk);
-                var hash = {}, names = MAP(env.names, function(type, name){
-                        if (type != "var") return MAP.skip;
-                        if (!env.references(name)) return MAP.skip;
-                        hash[name] = true;
-                        return [ name ];
-                });
-                if (names.length > 0) {
-                        // looking for assignments to any of these variables.
-                        // we can save considerable space by moving the definitions
-                        // in the var declaration.
-                        for_side_effects([ "block", body ], function(ast, walker, stop, restart) {
-                                if (ast[0] == "assign"
-                                    && ast[1] === true
-                                    && ast[2][0] == "name"
-                                    && HOP(hash, ast[2][1])) {
-                                        // insert the definition into the var declaration
-                                        for (var i = names.length; --i >= 0;) {
-                                                if (names[i][0] == ast[2][1]) {
-                                                        if (names[i][1]) // this name already defined, we must stop
-                                                                stop();
-                                                        names[i][1] = ast[3]; // definition
-                                                        names.push(names.splice(i, 1)[0]);
-                                                        break;
-                                                }
-                                        }
-                                        // remove this assignment from the AST.
-                                        var p = walker.parent();
-                                        if (p[0] == "seq") {
-                                                var a = p[2];
-                                                a.unshift(0, p.length);
-                                                p.splice.apply(p, a);
-                                        }
-                                        else if (p[0] == "stat") {
-                                                p.splice(0, p.length, "block"); // empty statement
-                                        }
-                                        else {
-                                                stop();
-                                        }
-                                        restart();
-                                }
-                                stop();
-                        });
-                        body.unshift([ "var", names ]);
-                }
-                scope = _scope;
-                return body;
-        };
-        function _vardefs(defs) {
-                var ret = null;
-                for (var i = defs.length; --i >= 0;) {
-                        var d = defs[i];
-                        if (!d[1]) continue;
-                        d = [ "assign", true, [ "name", d[0] ], d[1] ];
-                        if (ret == null) ret = d;
-                        else ret = [ "seq", d, ret ];
-                }
-                if (ret == null) {
-                        if (w.parent()[0] == "for-in")
-                                return [ "name", defs[0][0] ];
-                        return MAP.skip;
-                }
-                return [ "stat", ret ];
-        };
-        function _toplevel(body) {
-                return [ this[0], do_body(body, this.scope) ];
-        };
-        return w.with_walkers({
-                "function": function(name, args, body){
-                        for (var i = args.length; --i >= 0 && !body.scope.references(args[i]);)
-                                args.pop();
-                        if (!body.scope.references(name)) name = null;
-                        return [ this[0], name, args, do_body(body, body.scope) ];
-                },
-                "defun": function(name, args, body){
-                        if (!scope.references(name)) return MAP.skip;
-                        for (var i = args.length; --i >= 0 && !body.scope.references(args[i]);)
-                                args.pop();
-                        return [ this[0], name, args, do_body(body, body.scope) ];
-                },
-                "var": _vardefs,
-                "toplevel": _toplevel
-        }, function(){
-                return walk(ast_add_scope(ast));
-        });
-};
-
-function ast_squeeze(ast, options) {
-        options = defaults(options, {
-                make_seqs   : true,
-                dead_code   : true,
-                no_warnings : false,
-                keep_comps  : true
-        });
-
-        var w = ast_walker(), walk = w.walk;
-
-        function negate(c) {
-                var not_c = [ "unary-prefix", "!", c ];
-                switch (c[0]) {
-                    case "unary-prefix":
-                        return c[1] == "!" && boolean_expr(c[2]) ? c[2] : not_c;
-                    case "seq":
-                        c = slice(c);
-                        c[c.length - 1] = negate(c[c.length - 1]);
-                        return c;
-                    case "conditional":
-                        return best_of(not_c, [ "conditional", c[1], negate(c[2]), negate(c[3]) ]);
-                    case "binary":
-                        var op = c[1], left = c[2], right = c[3];
-                        if (!options.keep_comps) switch (op) {
-                            case "<="  : return [ "binary", ">", left, right ];
-                            case "<"   : return [ "binary", ">=", left, right ];
-                            case ">="  : return [ "binary", "<", left, right ];
-                            case ">"   : return [ "binary", "<=", left, right ];
-                        }
-                        switch (op) {
-                            case "=="  : return [ "binary", "!=", left, right ];
-                            case "!="  : return [ "binary", "==", left, right ];
-                            case "===" : return [ "binary", "!==", left, right ];
-                            case "!==" : return [ "binary", "===", left, right ];
-                            case "&&"  : return best_of(not_c, [ "binary", "||", negate(left), negate(right) ]);
-                            case "||"  : return best_of(not_c, [ "binary", "&&", negate(left), negate(right) ]);
-                        }
-                        break;
-                }
-                return not_c;
-        };
-
-        function make_conditional(c, t, e) {
-                var make_real_conditional = function() {
-                        if (c[0] == "unary-prefix" && c[1] == "!") {
-                                return e ? [ "conditional", c[2], e, t ] : [ "binary", "||", c[2], t ];
-                        } else {
-                                return e ? best_of(
-                                        [ "conditional", c, t, e ],
-                                        [ "conditional", negate(c), e, t ]
-                                ) : [ "binary", "&&", c, t ];
-                        }
-                };
-                // shortcut the conditional if the expression has a constant value
-                return when_constant(c, function(ast, val){
-                        warn_unreachable(val ? e : t);
-                        return          (val ? t : e);
-                }, make_real_conditional);
-        };
-
-        function rmblock(block) {
-                if (block != null && block[0] == "block" && block[1]) {
-                        if (block[1].length == 1)
-                                block = block[1][0];
-                        else if (block[1].length == 0)
-                                block = [ "block" ];
-                }
-                return block;
-        };
-
-        function _lambda(name, args, body) {
-                return [ this[0], name, args, tighten(body, "lambda") ];
-        };
-
-        // this function does a few things:
-        // 1. discard useless blocks
-        // 2. join consecutive var declarations
-        // 3. remove obviously dead code
-        // 4. transform consecutive statements using the comma operator
-        // 5. if block_type == "lambda" and it detects constructs like if(foo) return ... - rewrite like if (!foo) { ... }
-        function tighten(statements, block_type) {
-                statements = MAP(statements, walk);
-
-                statements = statements.reduce(function(a, stat){
-                        if (stat[0] == "block") {
-                                if (stat[1]) {
-                                        a.push.apply(a, stat[1]);
-                                }
-                        } else {
-                                a.push(stat);
-                        }
-                        return a;
-                }, []);
-
-                statements = (function(a, prev){
-                        statements.forEach(function(cur){
-                                if (prev && ((cur[0] == "var" && prev[0] == "var") ||
-                                             (cur[0] == "const" && prev[0] == "const"))) {
-                                        prev[1] = prev[1].concat(cur[1]);
-                                } else {
-                                        a.push(cur);
-                                        prev = cur;
-                                }
-                        });
-                        return a;
-                })([]);
-
-                if (options.dead_code) statements = (function(a, has_quit){
-                        statements.forEach(function(st){
-                                if (has_quit) {
-                                        if (st[0] == "function" || st[0] == "defun") {
-                                                a.push(st);
-                                        }
-                                        else if (st[0] == "var" || st[0] == "const") {
-                                                if (!options.no_warnings)
-                                                        warn("Variables declared in unreachable code");
-                                                st[1] = MAP(st[1], function(def){
-                                                        if (def[1] && !options.no_warnings)
-                                                                warn_unreachable([ "assign", true, [ "name", def[0] ], def[1] ]);
-                                                        return [ def[0] ];
-                                                });
-                                                a.push(st);
-                                        }
-                                        else if (!options.no_warnings)
-                                                warn_unreachable(st);
-                                }
-                                else {
-                                        a.push(st);
-                                        if (member(st[0], [ "return", "throw", "break", "continue" ]))
-                                                has_quit = true;
-                                }
-                        });
-                        return a;
-                })([]);
-
-                if (options.make_seqs) statements = (function(a, prev) {
-                        statements.forEach(function(cur){
-                                if (prev && prev[0] == "stat" && cur[0] == "stat") {
-                                        prev[1] = [ "seq", prev[1], cur[1] ];
-                                } else {
-                                        a.push(cur);
-                                        prev = cur;
-                                }
-                        });
-                        if (a.length >= 2
-                            && a[a.length-2][0] == "stat"
-                            && (a[a.length-1][0] == "return" || a[a.length-1][0] == "throw")
-                            && a[a.length-1][1])
-                        {
-                                a.splice(a.length - 2, 2,
-                                         [ a[a.length-1][0],
-                                           [ "seq", a[a.length-2][1], a[a.length-1][1] ]]);
-                        }
-                        return a;
-                })([]);
-
-                // this increases jQuery by 1K.  Probably not such a good idea after all..
-                // part of this is done in prepare_ifs anyway.
-                // if (block_type == "lambda") statements = (function(i, a, stat){
-                //         while (i < statements.length) {
-                //                 stat = statements[i++];
-                //                 if (stat[0] == "if" && !stat[3]) {
-                //                         if (stat[2][0] == "return" && stat[2][1] == null) {
-                //                                 a.push(make_if(negate(stat[1]), [ "block", statements.slice(i) ]));
-                //                                 break;
-                //                         }
-                //                         var last = last_stat(stat[2]);
-                //                         if (last[0] == "return" && last[1] == null) {
-                //                                 a.push(make_if(stat[1], [ "block", stat[2][1].slice(0, -1) ], [ "block", statements.slice(i) ]));
-                //                                 break;
-                //                         }
-                //                 }
-                //                 a.push(stat);
-                //         }
-                //         return a;
-                // })(0, []);
-
-                return statements;
-        };
-
-        function make_if(c, t, e) {
-                return when_constant(c, function(ast, val){
-                        if (val) {
-                                t = walk(t);
-                                warn_unreachable(e);
-                                return t || [ "block" ];
-                        } else {
-                                e = walk(e);
-                                warn_unreachable(t);
-                                return e || [ "block" ];
-                        }
-                }, function() {
-                        return make_real_if(c, t, e);
-                });
-        };
-
-        function abort_else(c, t, e) {
-                var ret = [ [ "if", negate(c), e ] ];
-                if (t[0] == "block") {
-                        if (t[1]) ret = ret.concat(t[1]);
-                } else {
-                        ret.push(t);
-                }
-                return walk([ "block", ret ]);
-        };
-
-        function make_real_if(c, t, e) {
-                c = walk(c);
-                t = walk(t);
-                e = walk(e);
-
-                if (empty(t)) {
-                        c = negate(c);
-                        t = e;
-                        e = null;
-                } else if (empty(e)) {
-                        e = null;
-                } else {
-                        // if we have both else and then, maybe it makes sense to switch them?
-                        (function(){
-                                var a = gen_code(c);
-                                var n = negate(c);
-                                var b = gen_code(n);
-                                if (b.length < a.length) {
-                                        var tmp = t;
-                                        t = e;
-                                        e = tmp;
-                                        c = n;
-                                }
-                        })();
-                }
-                if (empty(e) && empty(t))
-                        return [ "stat", c ];
-                var ret = [ "if", c, t, e ];
-                if (t[0] == "if" && empty(t[3]) && empty(e)) {
-                        ret = best_of(ret, walk([ "if", [ "binary", "&&", c, t[1] ], t[2] ]));
-                }
-                else if (t[0] == "stat") {
-                        if (e) {
-                                if (e[0] == "stat")
-                                        ret = best_of(ret, [ "stat", make_conditional(c, t[1], e[1]) ]);
-                                else if (aborts(e))
-                                        ret = abort_else(c, t, e);
-                        }
-                        else {
-                                ret = best_of(ret, [ "stat", make_conditional(c, t[1]) ]);
-                        }
-                }
-                else if (e && t[0] == e[0] && (t[0] == "return" || t[0] == "throw") && t[1] && e[1]) {
-                        ret = best_of(ret, [ t[0], make_conditional(c, t[1], e[1] ) ]);
-                }
-                else if (e && aborts(t)) {
-                        ret = [ [ "if", c, t ] ];
-                        if (e[0] == "block") {
-                                if (e[1]) ret = ret.concat(e[1]);
-                        }
-                        else {
-                                ret.push(e);
-                        }
-                        ret = walk([ "block", ret ]);
-                }
-                else if (t && aborts(e)) {
-                        ret = abort_else(c, t, e);
-                }
-                return ret;
-        };
-
-        function _do_while(cond, body) {
-                return when_constant(cond, function(cond, val){
-                        if (!val) {
-                                warn_unreachable(body);
-                                return [ "block" ];
-                        } else {
-                                return [ "for", null, null, null, walk(body) ];
-                        }
-                });
-        };
-
-        return w.with_walkers({
-                "sub": function(expr, subscript) {
-                        if (subscript[0] == "string") {
-                                var name = subscript[1];
-                                if (is_identifier(name))
-                                        return [ "dot", walk(expr), name ];
-                                else if (/^[1-9][0-9]*$/.test(name) || name === "0")
-                                        return [ "sub", walk(expr), [ "num", parseInt(name, 10) ] ];
-                        }
-                },
-                "if": make_if,
-                "toplevel": function(body) {
-                        return [ "toplevel", tighten(body) ];
-                },
-                "switch": function(expr, body) {
-                        var last = body.length - 1;
-                        return [ "switch", walk(expr), MAP(body, function(branch, i){
-                                var block = tighten(branch[1]);
-                                if (i == last && block.length > 0) {
-                                        var node = block[block.length - 1];
-                                        if (node[0] == "break" && !node[1])
-                                                block.pop();
-                                }
-                                return [ branch[0] ? walk(branch[0]) : null, block ];
-                        }) ];
-                },
-                "function": _lambda,
-                "defun": _lambda,
-                "block": function(body) {
-                        if (body) return rmblock([ "block", tighten(body) ]);
-                },
-                "binary": function(op, left, right) {
-                        return when_constant([ "binary", op, walk(left), walk(right) ], function yes(c){
-                                return best_of(walk(c), this);
-                        }, function no() {
-                                return function(){
-                                        if(op != "==" && op != "!=") return;
-                                        var l = walk(left), r = walk(right);
-                                        if(l && l[0] == "unary-prefix" && l[1] == "!" && l[2][0] == "num")
-                                                left = ['num', +!l[2][1]];
-                                        else if (r && r[0] == "unary-prefix" && r[1] == "!" && r[2][0] == "num")
-                                                right = ['num', +!r[2][1]];
-                                        return ["binary", op, left, right];
-                                }() || this;
-                        });
-                },
-                "conditional": function(c, t, e) {
-                        return make_conditional(walk(c), walk(t), walk(e));
-                },
-                "try": function(t, c, f) {
-                        return [
-                                "try",
-                                tighten(t),
-                                c != null ? [ c[0], tighten(c[1]) ] : null,
-                                f != null ? tighten(f) : null
-                        ];
-                },
-                "unary-prefix": function(op, expr) {
-                        expr = walk(expr);
-                        var ret = [ "unary-prefix", op, expr ];
-                        if (op == "!")
-                                ret = best_of(ret, negate(expr));
-                        return when_constant(ret, function(ast, val){
-                                return walk(ast); // it's either true or false, so minifies to !0 or !1
-                        }, function() { return ret });
-                },
-                "name": function(name) {
-                        switch (name) {
-                            case "true": return [ "unary-prefix", "!", [ "num", 0 ]];
-                            case "false": return [ "unary-prefix", "!", [ "num", 1 ]];
-                        }
-                },
-                "while": _do_while,
-                "assign": function(op, lvalue, rvalue) {
-                        lvalue = walk(lvalue);
-                        rvalue = walk(rvalue);
-                        var okOps = [ '+', '-', '/', '*', '%', '>>', '<<', '>>>', '|', '^', '&' ];
-                        if (op === true && lvalue[0] === "name" && rvalue[0] === "binary" &&
-                            ~okOps.indexOf(rvalue[1]) && rvalue[2][0] === "name" &&
-                            rvalue[2][1] === lvalue[1]) {
-                                return [ this[0], rvalue[1], lvalue, rvalue[3] ]
-                        }
-                        return [ this[0], op, lvalue, rvalue ];
-                }
-        }, function() {
-                for (var i = 0; i < 2; ++i) {
-                        ast = prepare_ifs(ast);
-                        ast = walk(ast);
-                }
-                return ast;
-        });
-};
-
-/* -----[ re-generate code from the AST ]----- */
-
-var DOT_CALL_NO_PARENS = jsp.array_to_hash([
-        "name",
-        "array",
-        "object",
-        "string",
-        "dot",
-        "sub",
-        "call",
-        "regexp",
-        "defun"
-]);
-
-function make_string(str, ascii_only) {
-        var dq = 0, sq = 0;
-        str = str.replace(/[\\\b\f\n\r\t\x22\x27\u2028\u2029\0]/g, function(s){
-                switch (s) {
-                    case "\\": return "\\\\";
-                    case "\b": return "\\b";
-                    case "\f": return "\\f";
-                    case "\n": return "\\n";
-                    case "\r": return "\\r";
-                    case "\u2028": return "\\u2028";
-                    case "\u2029": return "\\u2029";
-                    case '"': ++dq; return '"';
-                    case "'": ++sq; return "'";
-                    case "\0": return "\\0";
-                }
-                return s;
-        });
-        if (ascii_only) str = to_ascii(str);
-        if (dq > sq) return "'" + str.replace(/\x27/g, "\\'") + "'";
-        else return '"' + str.replace(/\x22/g, '\\"') + '"';
-};
-
-function to_ascii(str) {
-        return str.replace(/[\u0080-\uffff]/g, function(ch) {
-                var code = ch.charCodeAt(0).toString(16);
-                while (code.length < 4) code = "0" + code;
-                return "\\u" + code;
-        });
-};
-
-var SPLICE_NEEDS_BRACKETS = jsp.array_to_hash([ "if", "while", "do", "for", "for-in", "with" ]);
-
-function gen_code(ast, options) {
-        options = defaults(options, {
-                indent_start : 0,
-                indent_level : 4,
-                quote_keys   : false,
-                space_colon  : false,
-                beautify     : false,
-                ascii_only   : false,
-                inline_script: false
-        });
-        var beautify = !!options.beautify;
-        var indentation = 0,
-            newline = beautify ? "\n" : "",
-            space = beautify ? " " : "";
-
-        function encode_string(str) {
-                var ret = make_string(str, options.ascii_only);
-                if (options.inline_script)
-                        ret = ret.replace(/<\x2fscript([>\/\t\n\f\r ])/gi, "<\\/script$1");
-                return ret;
-        };
-
-        function make_name(name) {
-                name = name.toString();
-                if (options.ascii_only)
-                        name = to_ascii(name);
-                return name;
-        };
-
-        function indent(line) {
-                if (line == null)
-                        line = "";
-                if (beautify)
-                        line = repeat_string(" ", options.indent_start + indentation * options.indent_level) + line;
-                return line;
-        };
-
-        function with_indent(cont, incr) {
-                if (incr == null) incr = 1;
-                indentation += incr;
-                try { return cont.apply(null, slice(arguments, 1)); }
-                finally { indentation -= incr; }
-        };
-
-        function add_spaces(a) {
-                if (beautify)
-                        return a.join(" ");
-                var b = [];
-                for (var i = 0; i < a.length; ++i) {
-                        var next = a[i + 1];
-                        b.push(a[i]);
-                        if (next &&
-                            ((/[a-z0-9_\x24]$/i.test(a[i].toString()) && /^[a-z0-9_\x24]/i.test(next.toString())) ||
-                             (/[\+\-]$/.test(a[i].toString()) && /^[\+\-]/.test(next.toString())))) {
-                                b.push(" ");
-                        }
-                }
-                return b.join("");
-        };
-
-        function add_commas(a) {
-                return a.join("," + space);
-        };
-
-        function parenthesize(expr) {
-                var gen = make(expr);
-                for (var i = 1; i < arguments.length; ++i) {
-                        var el = arguments[i];
-                        if ((el instanceof Function && el(expr)) || expr[0] == el)
-                                return "(" + gen + ")";
-                }
-                return gen;
-        };
-
-        function best_of(a) {
-                if (a.length == 1) {
-                        return a[0];
-                }
-                if (a.length == 2) {
-                        var b = a[1];
-                        a = a[0];
-                        return a.length <= b.length ? a : b;
-                }
-                return best_of([ a[0], best_of(a.slice(1)) ]);
-        };
-
-        function needs_parens(expr) {
-                if (expr[0] == "function" || expr[0] == "object") {
-                        // dot/call on a literal function requires the
-                        // function literal itself to be parenthesized
-                        // only if it's the first "thing" in a
-                        // statement.  This means that the parent is
-                        // "stat", but it could also be a "seq" and
-                        // we're the first in this "seq" and the
-                        // parent is "stat", and so on.  Messy stuff,
-                        // but it worths the trouble.
-                        var a = slice(w.stack()), self = a.pop(), p = a.pop();
-                        while (p) {
-                                if (p[0] == "stat") return true;
-                                if (((p[0] == "seq" || p[0] == "call" || p[0] == "dot" || p[0] == "sub" || p[0] == "conditional") && p[1] === self) ||
-                                    ((p[0] == "binary" || p[0] == "assign" || p[0] == "unary-postfix") && p[2] === self)) {
-                                        self = p;
-                                        p = a.pop();
-                                } else {
-                                        return false;
-                                }
-                        }
-                }
-                return !HOP(DOT_CALL_NO_PARENS, expr[0]);
-        };
-
-        function make_num(num) {
-                var str = num.toString(10), a = [ str.replace(/^0\./, ".") ], m;
-                if (Math.floor(num) === num) {
-                        if (num >= 0) {
-                                a.push("0x" + num.toString(16).toLowerCase(), // probably pointless
-                                       "0" + num.toString(8)); // same.
-                        } else {
-                                a.push("-0x" + (-num).toString(16).toLowerCase(), // probably pointless
-                                       "-0" + (-num).toString(8)); // same.
-                        }
-                        if ((m = /^(.*?)(0+)$/.exec(num))) {
-                                a.push(m[1] + "e" + m[2].length);
-                        }
-                } else if ((m = /^0?\.(0+)(.*)$/.exec(num))) {
-                        a.push(m[2] + "e-" + (m[1].length + m[2].length),
-                               str.substr(str.indexOf(".")));
-                }
-                return best_of(a);
-        };
-
-        var w = ast_walker();
-        var make = w.walk;
-        return w.with_walkers({
-                "string": encode_string,
-                "num": make_num,
-                "name": make_name,
-                "debugger": function(){ return "debugger" },
-                "toplevel": function(statements) {
-                        return make_block_statements(statements)
-                                .join(newline + newline);
-                },
-                "splice": function(statements) {
-                        var parent = w.parent();
-                        if (HOP(SPLICE_NEEDS_BRACKETS, parent)) {
-                                // we need block brackets in this case
-                                return make_block.apply(this, arguments);
-                        } else {
-                                return MAP(make_block_statements(statements, true),
-                                           function(line, i) {
-                                                   // the first line is already indented
-                                                   return i > 0 ? indent(line) : line;
-                                           }).join(newline);
-                        }
-                },
-                "block": make_block,
-                "var": function(defs) {
-                        return "var " + add_commas(MAP(defs, make_1vardef)) + ";";
-                },
-                "const": function(defs) {
-                        return "const " + add_commas(MAP(defs, make_1vardef)) + ";";
-                },
-                "try": function(tr, ca, fi) {
-                        var out = [ "try", make_block(tr) ];
-                        if (ca) out.push("catch", "(" + ca[0] + ")", make_block(ca[1]));
-                        if (fi) out.push("finally", make_block(fi));
-                        return add_spaces(out);
-                },
-                "throw": function(expr) {
-                        return add_spaces([ "throw", make(expr) ]) + ";";
-                },
-                "new": function(ctor, args) {
-                        args = args.length > 0 ? "(" + add_commas(MAP(args, function(expr){
-                                return parenthesize(expr, "seq");
-                        })) + ")" : "";
-                        return add_spaces([ "new", parenthesize(ctor, "seq", "binary", "conditional", "assign", function(expr){
-                                var w = ast_walker(), has_call = {};
-                                try {
-                                        w.with_walkers({
-                                                "call": function() { throw has_call },
-                                                "function": function() { return this }
-                                        }, function(){
-                                                w.walk(expr);
-                                        });
-                                } catch(ex) {
-                                        if (ex === has_call)
-                                                return true;
-                                        throw ex;
-                                }
-                        }) + args ]);
-                },
-                "switch": function(expr, body) {
-                        return add_spaces([ "switch", "(" + make(expr) + ")", make_switch_block(body) ]);
-                },
-                "break": function(label) {
-                        var out = "break";
-                        if (label != null)
-                                out += " " + make_name(label);
-                        return out + ";";
-                },
-                "continue": function(label) {
-                        var out = "continue";
-                        if (label != null)
-                                out += " " + make_name(label);
-                        return out + ";";
-                },
-                "conditional": function(co, th, el) {
-                        return add_spaces([ parenthesize(co, "assign", "seq", "conditional"), "?",
-                                            parenthesize(th, "seq"), ":",
-                                            parenthesize(el, "seq") ]);
-                },
-                "assign": function(op, lvalue, rvalue) {
-                        if (op && op !== true) op += "=";
-                        else op = "=";
-                        return add_spaces([ make(lvalue), op, parenthesize(rvalue, "seq") ]);
-                },
-                "dot": function(expr) {
-                        var out = make(expr), i = 1;
-                        if (expr[0] == "num") {
-                                if (!/\./.test(expr[1]))
-                                        out += ".";
-                        } else if (expr[0] != "function" && needs_parens(expr))
-                                out = "(" + out + ")";
-                        while (i < arguments.length)
-                                out += "." + make_name(arguments[i++]);
-                        return out;
-                },
-                "call": function(func, args) {
-                        var f = make(func);
-                        if (f.charAt(0) != "(" && needs_parens(func))
-                                f = "(" + f + ")";
-                        return f + "(" + add_commas(MAP(args, function(expr){
-                                return parenthesize(expr, "seq");
-                        })) + ")";
-                },
-                "function": make_function,
-                "defun": make_function,
-                "if": function(co, th, el) {
-                        var out = [ "if", "(" + make(co) + ")", el ? make_then(th) : make(th) ];
-                        if (el) {
-                                out.push("else", make(el));
-                        }
-                        return add_spaces(out);
-                },
-                "for": function(init, cond, step, block) {
-                        var out = [ "for" ];
-                        init = (init != null ? make(init) : "").replace(/;*\s*$/, ";" + space);
-                        cond = (cond != null ? make(cond) : "").replace(/;*\s*$/, ";" + space);
-                        step = (step != null ? make(step) : "").replace(/;*\s*$/, "");
-                        var args = init + cond + step;
-                        if (args == "; ; ") args = ";;";
-                        out.push("(" + args + ")", make(block));
-                        return add_spaces(out);
-                },
-                "for-in": function(vvar, key, hash, block) {
-                        return add_spaces([ "for", "(" +
-                                            (vvar ? make(vvar).replace(/;+$/, "") : make(key)),
-                                            "in",
-                                            make(hash) + ")", make(block) ]);
-                },
-                "while": function(condition, block) {
-                        return add_spaces([ "while", "(" + make(condition) + ")", make(block) ]);
-                },
-                "do": function(condition, block) {
-                        return add_spaces([ "do", make(block), "while", "(" + make(condition) + ")" ]) + ";";
-                },
-                "return": function(expr) {
-                        var out = [ "return" ];
-                        if (expr != null) out.push(make(expr));
-                        return add_spaces(out) + ";";
-                },
-                "binary": function(operator, lvalue, rvalue) {
-                        var left = make(lvalue), right = make(rvalue);
-                        // XXX: I'm pretty sure other cases will bite here.
-                        //      we need to be smarter.
-                        //      adding parens all the time is the safest bet.
-                        if (member(lvalue[0], [ "assign", "conditional", "seq" ]) ||
-                            lvalue[0] == "binary" && PRECEDENCE[operator] > PRECEDENCE[lvalue[1]] ||
-                            lvalue[0] == "function" && needs_parens(this)) {
-                                left = "(" + left + ")";
-                        }
-                        if (member(rvalue[0], [ "assign", "conditional", "seq" ]) ||
-                            rvalue[0] == "binary" && PRECEDENCE[operator] >= PRECEDENCE[rvalue[1]] &&
-                            !(rvalue[1] == operator && member(operator, [ "&&", "||", "*" ]))) {
-                                right = "(" + right + ")";
-                        }
-                        else if (!beautify && options.inline_script && (operator == "<" || operator == "<<")
-                                 && rvalue[0] == "regexp" && /^script/i.test(rvalue[1])) {
-                                right = " " + right;
-                        }
-                        return add_spaces([ left, operator, right ]);
-                },
-                "unary-prefix": function(operator, expr) {
-                        var val = make(expr);
-                        if (!(expr[0] == "num" || (expr[0] == "unary-prefix" && !HOP(OPERATORS, operator + expr[1])) || !needs_parens(expr)))
-                                val = "(" + val + ")";
-                        return operator + (jsp.is_alphanumeric_char(operator.charAt(0)) ? " " : "") + val;
-                },
-                "unary-postfix": function(operator, expr) {
-                        var val = make(expr);
-                        if (!(expr[0] == "num" || (expr[0] == "unary-postfix" && !HOP(OPERATORS, operator + expr[1])) || !needs_parens(expr)))
-                                val = "(" + val + ")";
-                        return val + operator;
-                },
-                "sub": function(expr, subscript) {
-                        var hash = make(expr);
-                        if (needs_parens(expr))
-                                hash = "(" + hash + ")";
-                        return hash + "[" + make(subscript) + "]";
-                },
-                "object": function(props) {
-                        var obj_needs_parens = needs_parens(this);
-                        if (props.length == 0)
-                                return obj_needs_parens ? "({})" : "{}";
-                        var out = "{" + newline + with_indent(function(){
-                                return MAP(props, function(p){
-                                        if (p.length == 3) {
-                                                // getter/setter.  The name is in p[0], the arg.list in p[1][2], the
-                                                // body in p[1][3] and type ("get" / "set") in p[2].
-                                                return indent(make_function(p[0], p[1][2], p[1][3], p[2], true));
-                                        }
-                                        var key = p[0], val = parenthesize(p[1], "seq");
-                                        if (options.quote_keys) {
-                                                key = encode_string(key);
-                                        } else if ((typeof key == "number" || !beautify && +key + "" == key)
-                                                   && parseFloat(key) >= 0) {
-                                                key = make_num(+key);
-                                        } else if (!is_identifier(key)) {
-                                                key = encode_string(key);
-                                        }
-                                        return indent(add_spaces(beautify && options.space_colon
-                                                                 ? [ key, ":", val ]
-                                                                 : [ key + ":", val ]));
-                                }).join("," + newline);
-                        }) + newline + indent("}");
-                        return obj_needs_parens ? "(" + out + ")" : out;
-                },
-                "regexp": function(rx, mods) {
-                        return "/" + rx + "/" + mods;
-                },
-                "array": function(elements) {
-                        if (elements.length == 0) return "[]";
-                        return add_spaces([ "[", add_commas(MAP(elements, function(el, i){
-                                if (!beautify && el[0] == "atom" && el[1] == "undefined") return i === elements.length - 1 ? "," : "";
-                                return parenthesize(el, "seq");
-                        })), "]" ]);
-                },
-                "stat": function(stmt) {
-                        return make(stmt).replace(/;*\s*$/, ";");
-                },
-                "seq": function() {
-                        return add_commas(MAP(slice(arguments), make));
-                },
-                "label": function(name, block) {
-                        return add_spaces([ make_name(name), ":", make(block) ]);
-                },
-                "with": function(expr, block) {
-                        return add_spaces([ "with", "(" + make(expr) + ")", make(block) ]);
-                },
-                "atom": function(name) {
-                        return make_name(name);
-                }
-        }, function(){ return make(ast) });
-
-        // The squeezer replaces "block"-s that contain only a single
-        // statement with the statement itself; technically, the AST
-        // is correct, but this can create problems when we output an
-        // IF having an ELSE clause where the THEN clause ends in an
-        // IF *without* an ELSE block (then the outer ELSE would refer
-        // to the inner IF).  This function checks for this case and
-        // adds the block brackets if needed.
-        function make_then(th) {
-                if (th == null) return ";";
-                if (th[0] == "do") {
-                        // https://github.com/mishoo/UglifyJS/issues/#issue/57
-                        // IE croaks with "syntax error" on code like this:
-                        //     if (foo) do ... while(cond); else ...
-                        // we need block brackets around do/while
-                        return make_block([ th ]);
-                }
-                var b = th;
-                while (true) {
-                        var type = b[0];
-                        if (type == "if") {
-                                if (!b[3])
-                                        // no else, we must add the block
-                                        return make([ "block", [ th ]]);
-                                b = b[3];
-                        }
-                        else if (type == "while" || type == "do") b = b[2];
-                        else if (type == "for" || type == "for-in") b = b[4];
-                        else break;
-                }
-                return make(th);
-        };
-
-        function make_function(name, args, body, keyword, no_parens) {
-                var out = keyword || "function";
-                if (name) {
-                        out += " " + make_name(name);
-                }
-                out += "(" + add_commas(MAP(args, make_name)) + ")";
-                out = add_spaces([ out, make_block(body) ]);
-                return (!no_parens && needs_parens(this)) ? "(" + out + ")" : out;
-        };
-
-        function must_has_semicolon(node) {
-                switch (node[0]) {
-                    case "with":
-                    case "while":
-                        return empty(node[2]); // `with' or `while' with empty body?
-                    case "for":
-                    case "for-in":
-                        return empty(node[4]); // `for' with empty body?
-                    case "if":
-                        if (empty(node[2]) && !node[3]) return true; // `if' with empty `then' and no `else'
-                        if (node[3]) {
-                                if (empty(node[3])) return true; // `else' present but empty
-                                return must_has_semicolon(node[3]); // dive into the `else' branch
-                        }
-                        return must_has_semicolon(node[2]); // dive into the `then' branch
-                }
-        };
-
-        function make_block_statements(statements, noindent) {
-                for (var a = [], last = statements.length - 1, i = 0; i <= last; ++i) {
-                        var stat = statements[i];
-                        var code = make(stat);
-                        if (code != ";") {
-                                if (!beautify && i == last && !must_has_semicolon(stat)) {
-                                        code = code.replace(/;+\s*$/, "");
-                                }
-                                a.push(code);
-                        }
-                }
-                return noindent ? a : MAP(a, indent);
-        };
-
-        function make_switch_block(body) {
-                var n = body.length;
-                if (n == 0) return "{}";
-                return "{" + newline + MAP(body, function(branch, i){
-                        var has_body = branch[1].length > 0, code = with_indent(function(){
-                                return indent(branch[0]
-                                              ? add_spaces([ "case", make(branch[0]) + ":" ])
-                                              : "default:");
-                        }, 0.5) + (has_body ? newline + with_indent(function(){
-                                return make_block_statements(branch[1]).join(newline);
-                        }) : "");
-                        if (!beautify && has_body && i < n - 1)
-                                code += ";";
-                        return code;
-                }).join(newline) + newline + indent("}");
-        };
-
-        function make_block(statements) {
-                if (!statements) return ";";
-                if (statements.length == 0) return "{}";
-                return "{" + newline + with_indent(function(){
-                        return make_block_statements(statements).join(newline);
-                }) + newline + indent("}");
-        };
-
-        function make_1vardef(def) {
-                var name = def[0], val = def[1];
-                if (val != null)
-                        name = add_spaces([ make_name(name), "=", parenthesize(val, "seq") ]);
-                return name;
-        };
-
-};
-
-function split_lines(code, max_line_length) {
-        var splits = [ 0 ];
-        jsp.parse(function(){
-                var next_token = jsp.tokenizer(code);
-                var last_split = 0;
-                var prev_token;
-                function current_length(tok) {
-                        return tok.pos - last_split;
-                };
-                function split_here(tok) {
-                        last_split = tok.pos;
-                        splits.push(last_split);
-                };
-                function custom(){
-                        var tok = next_token.apply(this, arguments);
-                        out: {
-                                if (prev_token) {
-                                        if (prev_token.type == "keyword") break out;
-                                }
-                                if (current_length(tok) > max_line_length) {
-                                        switch (tok.type) {
-                                            case "keyword":
-                                            case "atom":
-                                            case "name":
-                                            case "punc":
-                                                split_here(tok);
-                                                break out;
-                                        }
-                                }
-                        }
-                        prev_token = tok;
-                        return tok;
-                };
-                custom.context = function() {
-                        return next_token.context.apply(this, arguments);
-                };
-                return custom;
-        }());
-        return splits.map(function(pos, i){
-                return code.substring(pos, splits[i + 1] || code.length);
-        }).join("\n");
-};
-
-/* -----[ Utilities ]----- */
-
-function repeat_string(str, i) {
-        if (i <= 0) return "";
-        if (i == 1) return str;
-        var d = repeat_string(str, i >> 1);
-        d += d;
-        if (i & 1) d += str;
-        return d;
-};
-
-function defaults(args, defs) {
-        var ret = {};
-        if (args === true)
-                args = {};
-        for (var i in defs) if (HOP(defs, i)) {
-                ret[i] = (args && HOP(args, i)) ? args[i] : defs[i];
-        }
-        return ret;
-};
-
-function is_identifier(name) {
-        return /^[a-z_$][a-z0-9_$]*$/i.test(name)
-                && name != "this"
-                && !HOP(jsp.KEYWORDS_ATOM, name)
-                && !HOP(jsp.RESERVED_WORDS, name)
-                && !HOP(jsp.KEYWORDS, name);
-};
-
-function HOP(obj, prop) {
-        return Object.prototype.hasOwnProperty.call(obj, prop);
-};
-
-// some utilities
-
-var MAP;
-
-(function(){
-        MAP = function(a, f, o) {
-                var ret = [], top = [], i;
-                function doit() {
-                        var val = f.call(o, a[i], i);
-                        if (val instanceof AtTop) {
-                                val = val.v;
-                                if (val instanceof Splice) {
-                                        top.push.apply(top, val.v);
-                                } else {
-                                        top.push(val);
-                                }
-                        }
-                        else if (val != skip) {
-                                if (val instanceof Splice) {
-                                        ret.push.apply(ret, val.v);
-                                } else {
-                                        ret.push(val);
-                                }
-                        }
-                };
-                if (a instanceof Array) for (i = 0; i < a.length; ++i) doit();
-                else for (i in a) if (HOP(a, i)) doit();
-                return top.concat(ret);
-        };
-        MAP.at_top = function(val) { return new AtTop(val) };
-        MAP.splice = function(val) { return new Splice(val) };
-        var skip = MAP.skip = {};
-        function AtTop(val) { this.v = val };
-        function Splice(val) { this.v = val };
-})();
-
-/* -----[ Exports ]----- */
-
-exports.ast_walker = ast_walker;
-exports.ast_mangle = ast_mangle;
-exports.ast_squeeze = ast_squeeze;
-exports.ast_lift_variables = ast_lift_variables;
-exports.gen_code = gen_code;
-exports.ast_add_scope = ast_add_scope;
-exports.set_logger = function(logger) { warn = logger };
-exports.make_string = make_string;
-exports.split_lines = split_lines;
-exports.MAP = MAP;
-
-// keep this last!
-exports.ast_squeeze_more = require("./squeeze-more").ast_squeeze_more;

+ 0 - 73
utils/node_modules/uglify-js/lib/squeeze-more.js

@@ -1,73 +0,0 @@
-var jsp = require("./parse-js"),
-    pro = require("./process"),
-    slice = jsp.slice,
-    member = jsp.member,
-    curry = jsp.curry,
-    MAP = pro.MAP,
-    PRECEDENCE = jsp.PRECEDENCE,
-    OPERATORS = jsp.OPERATORS;
-
-function ast_squeeze_more(ast) {
-        var w = pro.ast_walker(), walk = w.walk, scope;
-        function with_scope(s, cont) {
-                var save = scope, ret;
-                scope = s;
-                ret = cont();
-                scope = save;
-                return ret;
-        };
-        function _lambda(name, args, body) {
-                return [ this[0], name, args, with_scope(body.scope, curry(MAP, body, walk)) ];
-        };
-        return w.with_walkers({
-                "toplevel": function(body) {
-                        return [ this[0], with_scope(this.scope, curry(MAP, body, walk)) ];
-                },
-                "function": _lambda,
-                "defun": _lambda,
-                "new": function(ctor, args) {
-                        if (ctor[0] == "name") {
-                                if (ctor[1] == "Array" && !scope.has("Array")) {
-                                        if (args.length != 1) {
-                                                return [ "array", args ];
-                                        } else {
-                                                return walk([ "call", [ "name", "Array" ], args ]);
-                                        }
-                                } else if (ctor[1] == "Object" && !scope.has("Object")) {
-                                        if (!args.length) {
-                                                return [ "object", [] ];
-                                        } else {
-                                                return walk([ "call", [ "name", "Object" ], args ]);
-                                        }
-                                } else if ((ctor[1] == "RegExp" || ctor[1] == "Function" || ctor[1] == "Error") && !scope.has(ctor[1])) {
-                                        return walk([ "call", [ "name", ctor[1] ], args]);
-                                }
-                        }
-                },
-                "call": function(expr, args) {
-                        if (expr[0] == "dot" && expr[1][0] == "string" && args.length == 1
-                            && (args[0][1] > 0 && expr[2] == "substring" || expr[2] == "substr")) {
-                                return [ "call", [ "dot", expr[1], "slice"], args];
-                        }
-                        if (expr[0] == "dot" && expr[2] == "toString" && args.length == 0) {
-                                // foo.toString()  ==>  foo+""
-                                return [ "binary", "+", expr[1], [ "string", "" ]];
-                        }
-                        if (expr[0] == "name") {
-                                if (expr[1] == "Array" && args.length != 1 && !scope.has("Array")) {
-                                        return [ "array", args ];
-                                }
-                                if (expr[1] == "Object" && !args.length && !scope.has("Object")) {
-                                        return [ "object", [] ];
-                                }
-                                if (expr[1] == "String" && !scope.has("String")) {
-                                        return [ "binary", "+", args[0], [ "string", "" ]];
-                                }
-                        }
-                }
-        }, function() {
-                return walk(pro.ast_add_scope(ast));
-        });
-};
-
-exports.ast_squeeze_more = ast_squeeze_more;

+ 0 - 24
utils/node_modules/uglify-js/package.json

@@ -1,24 +0,0 @@
-{
-        "name"    : "uglify-js",
-
-        "description" : "JavaScript parser and compressor/beautifier toolkit",
-
-        "author"  : {
-                "name"  : "Mihai Bazon",
-                "email" : "[email protected]",
-                "url"   : "http://mihai.bazon.net/blog"
-        },
-
-        "version" : "1.2.6",
-
-        "main"    : "./uglify-js.js",
-
-        "bin"     : {
-                "uglifyjs" : "./bin/uglifyjs"
-        },
-
-        "repository": {
-                "type": "git",
-                "url": "[email protected]:mishoo/UglifyJS.git"
-        }
-}

+ 0 - 24
utils/node_modules/uglify-js/package.json~

@@ -1,24 +0,0 @@
-{
-        "name"    : "uglify-js",
-
-        "description" : "JavaScript parser and compressor/beautifier toolkit",
-
-        "author"  : {
-                "name"  : "Mihai Bazon",
-                "email" : "[email protected]",
-                "url"   : "http://mihai.bazon.net/blog"
-        },
-
-        "version" : "1.2.3",
-
-        "main"    : "./uglify-js.js",
-
-        "bin"     : {
-                "uglifyjs" : "./bin/uglifyjs"
-        },
-
-        "repository": {
-                "type": "git",
-                "url": "[email protected]:mishoo/UglifyJS.git"
-        }
-}

+ 0 - 28
utils/node_modules/uglify-js/test/beautify.js

@@ -1,28 +0,0 @@
-#! /usr/bin/env node
-
-global.sys = require("sys");
-var fs = require("fs");
-
-var jsp = require("../lib/parse-js");
-var pro = require("../lib/process");
-
-var filename = process.argv[2];
-fs.readFile(filename, "utf8", function(err, text){
-        try {
-                var ast = time_it("parse", function(){ return jsp.parse(text); });
-                ast = time_it("mangle", function(){ return pro.ast_mangle(ast); });
-                ast = time_it("squeeze", function(){ return pro.ast_squeeze(ast); });
-                var gen = time_it("generate", function(){ return pro.gen_code(ast, false); });
-                sys.puts(gen);
-        } catch(ex) {
-                sys.debug(ex.stack);
-                sys.debug(sys.inspect(ex));
-                sys.debug(JSON.stringify(ex));
-        }
-});
-
-function time_it(name, cont) {
-        var t1 = new Date().getTime();
-        try { return cont(); }
-        finally { sys.debug("// " + name + ": " + ((new Date().getTime() - t1) / 1000).toFixed(3) + " sec."); }
-};

+ 0 - 403
utils/node_modules/uglify-js/test/testparser.js

@@ -1,403 +0,0 @@
-#! /usr/bin/env node
-
-var parseJS = require("../lib/parse-js");
-var sys = require("sys");
-
-// write debug in a very straightforward manner
-var debug = function(){
-        sys.log(Array.prototype.slice.call(arguments).join(', '));
-};
-
-ParserTestSuite(function(i, input, desc){
-	try {
-		parseJS.parse(input);
-		debug("ok " + i + ": " + desc);
-	} catch(e){
-		debug("FAIL " + i + " " + desc + " (" + e + ")");
-	}
-});
-
-function ParserTestSuite(callback){
-	var inps = [
-		["var abc;", "Regular variable statement w/o assignment"],
-		["var abc = 5;", "Regular variable statement with assignment"],
-		["/* */;", "Multiline comment"],
-		['/** **/;', 'Double star multiline comment'],
-		["var f = function(){;};", "Function expression in var assignment"],
-		['hi; // moo\n;', 'single line comment'],
-		['var varwithfunction;', 'Dont match keywords as substrings'], // difference between `var withsomevar` and `"str"` (local search and lits)
-		['a + b;', 'addition'],
-		["'a';", 'single string literal'],
-		["'a\\n';", 'single string literal with escaped return'],
-		['"a";', 'double string literal'],
-		['"a\\n";', 'double string literal with escaped return'],
-		['"var";', 'string is a keyword'],
-		['"variable";', 'string starts with a keyword'],
-		['"somevariable";', 'string contains a keyword'],
-		['"somevar";', 'string ends with a keyword'],
-		['500;', 'int literal'],
-		['500.;', 'float literal w/o decimals'],
-		['500.432;', 'float literal with decimals'],
-		['.432432;', 'float literal w/o int'],
-		['(a,b,c);', 'parens and comma'],
-		['[1,2,abc];', 'array literal'],
-		['var o = {a:1};', 'object literal unquoted key'],
-		['var o = {"b":2};', 'object literal quoted key'], // opening curly may not be at the start of a statement...
-		['var o = {c:c};', 'object literal keyname is identifier'],
-		['var o = {a:1,"b":2,c:c};', 'object literal combinations'],
-		['var x;\nvar y;', 'two lines'],
-		['var x;\nfunction n(){; }', 'function def'],
-		['var x;\nfunction n(abc){; }', 'function def with arg'],
-		['var x;\nfunction n(abc, def){ ;}', 'function def with args'],
-		['function n(){ "hello"; }', 'function def with body'],
-		['/a/;', 'regex literal'],
-		['/a/b;', 'regex literal with flag'],
-		['/a/ / /b/;', 'regex div regex'],
-		['a/b/c;', 'triple division looks like regex'],
-		['+function(){/regex/;};', 'regex at start of function body'],
-		// http://code.google.com/p/es-lab/source/browse/trunk/tests/parser/parsertests.js?r=86
-		// http://code.google.com/p/es-lab/source/browse/trunk/tests/parser/parsertests.js?r=430
-
-		// first tests for the lexer, should also parse as program (when you append a semi)
-
-		// comments
-		['//foo!@#^&$1234\nbar;', 'single line comment'],
-		['/* abcd!@#@$* { } && null*/;', 'single line multi line comment'],
-		['/*foo\nbar*/;','multi line comment'],
-		['/*x*x*/;','multi line comment with *'],
-		['/**/;','empty comment'],
-		// identifiers
-		["x;",'1 identifier'],
-		["_x;",'2 identifier'],
-		["xyz;",'3 identifier'],
-		["$x;",'4 identifier'],
-		["x$;",'5 identifier'],
-		["_;",'6 identifier'],
-		["x5;",'7 identifier'],
-		["x_y;",'8 identifier'],
-		["x+5;",'9 identifier'],
-		["xyz123;",'10 identifier'],
-		["x1y1z1;",'11 identifier'],
-		["foo\\u00D8bar;",'12 identifier unicode escape'],
-		//["foo�bar;",'13 identifier unicode embedded (might fail)'],
-		// numbers
-		["5;", '1 number'],
-		["5.5;", '2 number'],
-		["0;", '3 number'],
-		["0.0;", '4 number'],
-		["0.001;", '5 number'],
-		["1.e2;", '6 number'],
-		["1.e-2;", '7 number'],
-		["1.E2;", '8 number'],
-		["1.E-2;", '9 number'],
-		[".5;", '10 number'],
-		[".5e3;", '11 number'],
-		[".5e-3;", '12 number'],
-		["0.5e3;", '13 number'],
-		["55;", '14 number'],
-		["123;", '15 number'],
-		["55.55;", '16 number'],
-		["55.55e10;", '17 number'],
-		["123.456;", '18 number'],
-		["1+e;", '20 number'],
-		["0x01;", '22 number'],
-		["0XCAFE;", '23 number'],
-		["0x12345678;", '24 number'],
-		["0x1234ABCD;", '25 number'],
-		["0x0001;", '26 number'],
-		// strings
-		["\"foo\";", '1 string'],
-		["\'foo\';", '2 string'],
-		["\"x\";", '3 string'],
-		["\'\';", '4 string'],
-		["\"foo\\tbar\";", '5 string'],
-		["\"!@#$%^&*()_+{}[]\";", '6 string'],
-		["\"/*test*/\";", '7 string'],
-		["\"//test\";", '8 string'],
-		["\"\\\\\";", '9 string'],
-		["\"\\u0001\";", '10 string'],
-		["\"\\uFEFF\";", '11 string'],
-		["\"\\u10002\";", '12 string'],
-		["\"\\x55\";", '13 string'],
-		["\"\\x55a\";", '14 string'],
-		["\"a\\\\nb\";", '15 string'],
-		['";"', '16 string: semi in a string'],
-		['"a\\\nb";', '17 string: line terminator escape'],
-		// literals
-		["null;", "null"],
-		["true;", "true"],
-		["false;", "false"],
-		// regex
-		["/a/;", "1 regex"],
-		["/abc/;", "2 regex"],
-		["/abc[a-z]*def/g;", "3 regex"],
-		["/\\b/;", "4 regex"],
-		["/[a-zA-Z]/;", "5 regex"],
-
-		// program tests (for as far as they havent been covered above)
-
-		// regexp
-		["/foo(.*)/g;", "another regexp"],
-		// arrays
-		["[];", "1 array"],
-		["[   ];", "2 array"],
-		["[1];", "3 array"],
-		["[1,2];", "4 array"],
-		["[1,2,,];", "5 array"],
-		["[1,2,3];", "6 array"],
-		["[1,2,3,,,];", "7 array"],
-		// objects
-		["{};", "1 object"],
-		["({x:5});", "2 object"],
-		["({x:5,y:6});", "3 object"],
-		["({x:5,});", "4 object"],
-		["({if:5});", "5 object"],
-		["({ get x() {42;} });", "6 object"],
-		["({ set y(a) {1;} });", "7 object"],
-		// member expression
-		["o.m;", "1 member expression"],
-		["o['m'];", "2 member expression"],
-		["o['n']['m'];", "3 member expression"],
-		["o.n.m;", "4 member expression"],
-		["o.if;", "5 member expression"],
-		// call and invoke expressions
-		["f();", "1 call/invoke expression"],
-		["f(x);", "2 call/invoke expression"],
-		["f(x,y);", "3 call/invoke expression"],
-		["o.m();", "4 call/invoke expression"],
-		["o['m'];", "5 call/invoke expression"],
-		["o.m(x);", "6 call/invoke expression"],
-		["o['m'](x);", "7 call/invoke expression"],
-		["o.m(x,y);", "8 call/invoke expression"],
-		["o['m'](x,y);", "9 call/invoke expression"],
-		["f(x)(y);", "10 call/invoke expression"],
-		["f().x;", "11 call/invoke expression"],
-
-		// eval
-		["eval('x');", "1 eval"],
-		["(eval)('x');", "2 eval"],
-		["(1,eval)('x');", "3 eval"],
-		["eval(x,y);", "4 eval"],
-		// new expression
-		["new f();", "1 new expression"],
-		["new o;", "2 new expression"],
-		["new o.m;", "3 new expression"],
-		["new o.m(x);", "4 new expression"],
-		["new o.m(x,y);", "5 new expression"],
-		// prefix/postfix
-		["++x;", "1 pre/postfix"],
-		["x++;", "2 pre/postfix"],
-		["--x;", "3 pre/postfix"],
-		["x--;", "4 pre/postfix"],
-		["x ++;", "5 pre/postfix"],
-		["x /* comment */ ++;", "6 pre/postfix"],
-		["++ /* comment */ x;", "7 pre/postfix"],
-		// unary operators
-		["delete x;", "1 unary operator"],
-		["void x;", "2 unary operator"],
-		["+ x;", "3 unary operator"],
-		["-x;", "4 unary operator"],
-		["~x;", "5 unary operator"],
-		["!x;", "6 unary operator"],
-		// meh
-		["new Date++;", "new date ++"],
-		["+x++;", " + x ++"],
-		// expression expressions
-		["1 * 2;", "1 expression expressions"],
-		["1 / 2;", "2 expression expressions"],
-		["1 % 2;", "3 expression expressions"],
-		["1 + 2;", "4 expression expressions"],
-		["1 - 2;", "5 expression expressions"],
-		["1 << 2;", "6 expression expressions"],
-		["1 >>> 2;", "7 expression expressions"],
-		["1 >> 2;", "8 expression expressions"],
-		["1 * 2 + 3;", "9 expression expressions"],
-		["(1+2)*3;", "10 expression expressions"],
-		["1*(2+3);", "11 expression expressions"],
-		["x<y;", "12 expression expressions"],
-		["x>y;", "13 expression expressions"],
-		["x<=y;", "14 expression expressions"],
-		["x>=y;", "15 expression expressions"],
-		["x instanceof y;", "16 expression expressions"],
-		["x in y;", "17 expression expressions"],
-		["x&y;", "18 expression expressions"],
-		["x^y;", "19 expression expressions"],
-		["x|y;", "20 expression expressions"],
-		["x+y<z;", "21 expression expressions"],
-		["x<y+z;", "22 expression expressions"],
-		["x+y+z;", "23 expression expressions"],
-		["x+y<z;", "24 expression expressions"],
-		["x<y+z;", "25 expression expressions"],
-		["x&y|z;", "26 expression expressions"],
-		["x&&y;", "27 expression expressions"],
-		["x||y;", "28 expression expressions"],
-		["x&&y||z;", "29 expression expressions"],
-		["x||y&&z;", "30 expression expressions"],
-		["x<y?z:w;", "31 expression expressions"],
-		// assignment
-		["x >>>= y;", "1 assignment"],
-		["x <<= y;", "2 assignment"],
-		["x = y;", "3 assignment"],
-		["x += y;", "4 assignment"],
-		["x /= y;", "5 assignment"],
-		// comma
-		["x, y;", "comma"],
-		// block
-		["{};", "1 block"],
-		["{x;};", "2 block"],
-		["{x;y;};", "3 block"],
-		// vars
-		["var x;", "1 var"],
-		["var x,y;", "2 var"],
-		["var x=1,y=2;", "3 var"],
-		["var x,y=2;", "4 var"],
-		// empty
-		[";", "1 empty"],
-		["\n;", "2 empty"],
-		// expression statement
-		["x;", "1 expression statement"],
-		["5;", "2 expression statement"],
-		["1+2;", "3 expression statement"],
-		// if
-		["if (c) x; else y;", "1 if statement"],
-		["if (c) x;", "2 if statement"],
-		["if (c) {} else {};", "3 if statement"],
-		["if (c1) if (c2) s1; else s2;", "4 if statement"],
-		// while
-		["do s; while (e);", "1 while statement"],
-		["do { s; } while (e);", "2 while statement"],
-		["while (e) s;", "3 while statement"],
-		["while (e) { s; };", "4 while statement"],
-		// for
-		["for (;;) ;", "1 for statement"],
-		["for (;c;x++) x;", "2 for statement"],
-		["for (i;i<len;++i){};", "3 for statement"],
-		["for (var i=0;i<len;++i) {};", "4 for statement"],
-		["for (var i=0,j=0;;){};", "5 for statement"],
-		//["for (x in b; c; u) {};", "6 for statement"],
-		["for ((x in b); c; u) {};", "7 for statement"],
-		["for (x in a);", "8 for statement"],
-		["for (var x in a){};", "9 for statement"],
-		["for (var x=5 in a) {};", "10 for statement"],
-		["for (var x = a in b in c) {};", "11 for statement"],
-		["for (var x=function(){a+b;}; a<b; ++i) some;", "11 for statement, testing for parsingForHeader reset with the function"],
-		["for (var x=function(){for (x=0; x<15; ++x) alert(foo); }; a<b; ++i) some;", "11 for statement, testing for parsingForHeader reset with the function"],
-		// flow statements
-		["while(1){ continue; }", "1 flow statement"],
-		["label: while(1){ continue label; }", "2 flow statement"],
-		["while(1){ break; }", "3 flow statement"],
-		["somewhere: while(1){ break somewhere; }", "4 flow statement"],
-		["while(1){ continue /* comment */ ; }", "5 flow statement"],
-		["while(1){ continue \n; }", "6 flow statement"],
-		["(function(){ return; })()", "7 flow statement"],
-		["(function(){ return 0; })()", "8 flow statement"],
-		["(function(){ return 0 + \n 1; })()", "9 flow statement"],
-		// with
-		["with (e) s;", "with statement"],
-		// switch
-		["switch (e) { case x: s; };", "1 switch statement"],
-		["switch (e) { case x: s1;s2; default: s3; case y: s4; };", "2 switch statement"],
-		["switch (e) { default: s1; case x: s2; case y: s3; };", "3 switch statement"],
-		["switch (e) { default: s; };", "4 switch statement"],
-		["switch (e) { case x: s1; case y: s2; };", "5 switch statement"],
-		// labels
-		["foo : x;", " flow statement"],
-		// throw
-		["throw x;", "1 throw statement"],
-		["throw x\n;", "2 throw statement"],
-		// try catch finally
-		["try { s1; } catch (e) { s2; };", "1 trycatchfinally statement"],
-		["try { s1; } finally { s2; };", "2 trycatchfinally statement"],
-		["try { s1; } catch (e) { s2; } finally { s3; };", "3 trycatchfinally statement"],
-		// debugger
-		["debugger;", "debuger statement"],
-		// function decl
-		["function f(x) { e; return x; };", "1 function declaration"],
-		["function f() { x; y; };", "2 function declaration"],
-		["function f(x,y) { var z; return x; };", "3 function declaration"],
-		// function exp
-		["(function f(x) { return x; });", "1 function expression"],
-		["(function empty() {;});", "2 function expression"],
-		["(function empty() {;});", "3 function expression"],
-		["(function (x) {; });", "4 function expression"],
-		// program
-		["var x; function f(){;}; null;", "1 program"],
-		[";;", "2 program"],
-		["{ x; y; z; }", "3 program"],
-		["function f(){ function g(){;}};", "4 program"],
-		["x;\n/*foo*/\n	;", "5 program"],
-
-		// asi
-		["foo: while(1){ continue \n foo; }", "1 asi"],
-		["foo: while(1){ break \n foo; }", "2 asi"],
-		["(function(){ return\nfoo; })()", "3 asi"],
-		["var x; { 1 \n 2 } 3", "4 asi"],
-		["ab 	 /* hi */\ncd", "5 asi"],
-		["ab/*\n*/cd", "6 asi (multi line multilinecomment counts as eol)"],
-		["foo: while(1){ continue /* wtf \n busta */ foo; }", "7 asi illegal with multi line comment"],
-		["function f() { s }", "8 asi"],
-		["function f() { return }", "9 asi"],
-
-		// use strict
-                // XXX: some of these should actually fail?
-                //      no support for "use strict" yet...
-		['"use strict"; \'bla\'\n; foo;', "1 directive"],
-		['(function() { "use strict"; \'bla\';\n foo; });', "2 directive"],
-		['"use\\n strict";', "3 directive"],
-		['foo; "use strict";', "4 directive"],
-
-		// tests from http://es5conform.codeplex.com/
-
-		['"use strict"; var o = { eval: 42};', "8.7.2-3-1-s: the use of eval as property name is allowed"],
-		['({foo:0,foo:1});', 'Duplicate property name allowed in not strict mode'],
-		['function foo(a,a){}', 'Duplicate parameter name allowed in not strict mode'],
-		['(function foo(eval){})', 'Eval allowed as parameter name in non strict mode'],
-		['(function foo(arguments){})', 'Arguments allowed as parameter name in non strict mode'],
-
-		// empty programs
-
-		['', '1 Empty program'],
-		['// test', '2 Empty program'],
-		['//test\n', '3 Empty program'],
-		['\n// test', '4 Empty program'],
-		['\n// test\n', '5 Empty program'],
-		['/* */', '6 Empty program'],
-		['/*\ns,fd\n*/', '7 Empty program'],
-		['/*\ns,fd\n*/\n', '8 Empty program'],
-		['  	', '9 Empty program'],
-		['  /*\nsmeh*/	\n   ', '10 Empty program'],
-
-		// trailing whitespace
-
-		['a  ', '1 Trailing whitespace'],
-		['a /* something */', '2 Trailing whitespace'],
-		['a\n	// hah', '3 Trailing whitespace'],
-		['/abc/de//f', '4 Trailing whitespace'],
-		['/abc/de/*f*/\n	', '5 Trailing whitespace'],
-
-		// things the parser tripped over at one point or the other (prevents regression bugs)
-		['for (x;function(){ a\nb };z) x;', 'for header with function body forcing ASI'],
-		['c=function(){return;return};', 'resetting noAsi after literal'],
-		['d\nd()', 'asi exception causing token overflow'],
-		['for(;;){x=function(){}}', 'function expression in a for header'],
-		['for(var k;;){}', 'parser failing due to ASI accepting the incorrect "for" rule'],
-		['({get foo(){ }})', 'getter with empty function body'],
-		['\nreturnr', 'eol causes return statement to ignore local search requirement'],
-		[' / /', '1 whitespace before regex causes regex to fail?'],
-		['/ // / /', '2 whitespace before regex causes regex to fail?'],
-		['/ / / / /', '3 whitespace before regex causes regex to fail?'],
-
-		['\n\t// Used for trimming whitespace\n\ttrimLeft = /^\\s+/;\n\ttrimRight = /\\s+$/;\t\n','turned out this didnt crash (the test below did), but whatever.'],
-		['/[\\/]/;', 'escaped forward slash inside class group (would choke on fwd slash)'],
-		['/[/]/;', 'also broke but is valid in es5 (not es3)'],
-		['({get:5});','get property name thats not a getter'],
-		['({set:5});','set property name thats not a setter'],
-		['l !== "px" && (d.style(h, c, (k || 1) + l), j = (k || 1) / f.cur() * j, d.style(h, c, j + l)), i[1] && (k = (i[1] === "-=" ? -1 : 1) * k + j), f.custom(j, k, l)', 'this choked regex/div at some point'],
-		['(/\'/g, \'\\\\\\\'\') + "\'";', 'the sequence of escaped characters confused the tokenizer'],
-                ['if (true) /=a/.test("a");', 'regexp starting with "=" in not obvious context (not implied by preceding token)']
-	];
-
-	for (var i=0; i<inps.length; ++i) {
-		callback(i, inps[i][0], inps[i][1]);
-	};
-};

+ 0 - 1
utils/node_modules/uglify-js/test/unit/compress/expected/array1.js

@@ -1 +0,0 @@
-[],Array(1),[1,2,3]

+ 0 - 1
utils/node_modules/uglify-js/test/unit/compress/expected/array2.js

@@ -1 +0,0 @@
-(function(){var a=function(){};return new a(1,2,3,4)})()

+ 0 - 1
utils/node_modules/uglify-js/test/unit/compress/expected/array3.js

@@ -1 +0,0 @@
-(function(){function a(){}return new a(1,2,3,4)})()

+ 0 - 1
utils/node_modules/uglify-js/test/unit/compress/expected/array4.js

@@ -1 +0,0 @@
-(function(){function a(){}(function(){return new a(1,2,3)})()})()

+ 0 - 1
utils/node_modules/uglify-js/test/unit/compress/expected/assignment.js

@@ -1 +0,0 @@
-a=1,b=a,c=1,d=b,e=d,longname=2;if(longname+1){x=3;if(x)var z=7}z=1,y=1,x=1,g+=1,h=g,++i,j=i,i++,j=i+17

+ 0 - 1
utils/node_modules/uglify-js/test/unit/compress/expected/concatstring.js

@@ -1 +0,0 @@
-var a=a+"a"+"b"+1+c,b=a+"c"+"ds"+123+c,c=a+"c"+123+d+"ds"+c

+ 0 - 1
utils/node_modules/uglify-js/test/unit/compress/expected/const.js

@@ -1 +0,0 @@
-var a=13,b=1/3

+ 0 - 1
utils/node_modules/uglify-js/test/unit/compress/expected/empty-blocks.js

@@ -1 +0,0 @@
-function bar(){return--x}function foo(){while(bar());}function mak(){for(;;);}var x=5

+ 0 - 1
utils/node_modules/uglify-js/test/unit/compress/expected/forstatement.js

@@ -1 +0,0 @@
-a=func(),b=z;for(a++;i<10;i++)alert(i);var z=1;g=2;for(;i<10;i++)alert(i);var a=2;for(var i=1;i<10;i++)alert(i)

+ 0 - 1
utils/node_modules/uglify-js/test/unit/compress/expected/if.js

@@ -1 +0,0 @@
-var a=1;a==1?a=2:a=17

+ 0 - 1
utils/node_modules/uglify-js/test/unit/compress/expected/ifreturn.js

@@ -1 +0,0 @@
-function a(a){return a==1?2:17}

+ 0 - 1
utils/node_modules/uglify-js/test/unit/compress/expected/ifreturn2.js

@@ -1 +0,0 @@
-function x(a){return typeof a=="object"?a:a===42?0:a*2}function y(a){return typeof a=="object"?a:null}

+ 0 - 1
utils/node_modules/uglify-js/test/unit/compress/expected/issue10.js

@@ -1 +0,0 @@
-function f(){var a;return(a="a")?a:a}f()

+ 0 - 1
utils/node_modules/uglify-js/test/unit/compress/expected/issue11.js

@@ -1 +0,0 @@
-new(A,B),new(A||B),new(X?A:B)

+ 0 - 1
utils/node_modules/uglify-js/test/unit/compress/expected/issue13.js

@@ -1 +0,0 @@
-var a=/^(?:(\w+):)?(?:\/\/(?:(?:([^:@\/]*):?([^:@\/]*))?@)?([^:\/?#])(?::(\d))?)?(..?$|(?:[^?#\/]\/))([^?#]*)(?:\?([^#]))?(?:#(.))?/

+ 0 - 1
utils/node_modules/uglify-js/test/unit/compress/expected/issue14.js

@@ -1 +0,0 @@
-var a={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"}

+ 0 - 1
utils/node_modules/uglify-js/test/unit/compress/expected/issue16.js

@@ -1 +0,0 @@
-var a=3250441966

+ 0 - 1
utils/node_modules/uglify-js/test/unit/compress/expected/issue17.js

@@ -1 +0,0 @@
-var a=function(b){b(),a()}

+ 0 - 1
utils/node_modules/uglify-js/test/unit/compress/expected/issue20.js

@@ -1 +0,0 @@
-1

+ 0 - 1
utils/node_modules/uglify-js/test/unit/compress/expected/issue21.js

@@ -1 +0,0 @@
-var a=0;switch(a){case 0:a++}

+ 0 - 1
utils/node_modules/uglify-js/test/unit/compress/expected/issue25.js

@@ -1 +0,0 @@
-a:break a;console.log(1)

+ 0 - 1
utils/node_modules/uglify-js/test/unit/compress/expected/issue27.js

@@ -1 +0,0 @@
-(a?b:c)?d:e

+ 0 - 1
utils/node_modules/uglify-js/test/unit/compress/expected/issue278.js

@@ -1 +0,0 @@
-if(!x)debugger

+ 0 - 1
utils/node_modules/uglify-js/test/unit/compress/expected/issue28.js

@@ -1 +0,0 @@
-o={".5":.5},o={.5:.5},o={.5:.5}

+ 0 - 1
utils/node_modules/uglify-js/test/unit/compress/expected/issue29.js

@@ -1 +0,0 @@
-result=function(){return 1}()

+ 0 - 1
utils/node_modules/uglify-js/test/unit/compress/expected/issue30.js

@@ -1 +0,0 @@
-var a=8,b=4,c=4

+ 0 - 1
utils/node_modules/uglify-js/test/unit/compress/expected/issue34.js

@@ -1 +0,0 @@
-var a={};a["this"]=1,a.that=2

+ 0 - 1
utils/node_modules/uglify-js/test/unit/compress/expected/issue4.js

@@ -1 +0,0 @@
-var a=2e3,b=.002,c=2e-5

+ 0 - 1
utils/node_modules/uglify-js/test/unit/compress/expected/issue48.js

@@ -1 +0,0 @@
-var s,i;s="",i=0

+ 0 - 1
utils/node_modules/uglify-js/test/unit/compress/expected/issue50.js

@@ -1 +0,0 @@
-function bar(a){try{foo()}catch(b){alert("Exception caught (foo not defined)")}alert(a)}bar(10)

+ 0 - 1
utils/node_modules/uglify-js/test/unit/compress/expected/issue53.js

@@ -1 +0,0 @@
-x=(y,z)

+ 0 - 1
utils/node_modules/uglify-js/test/unit/compress/expected/issue54.1.js

@@ -1 +0,0 @@
-foo+"",a.toString(16),b.toString.call(c)

+ 0 - 1
utils/node_modules/uglify-js/test/unit/compress/expected/issue68.js

@@ -1 +0,0 @@
-function f(){function b(){}if(a)return;b()}

+ 0 - 1
utils/node_modules/uglify-js/test/unit/compress/expected/issue69.js

@@ -1 +0,0 @@
-[(a,b)]

+ 0 - 1
utils/node_modules/uglify-js/test/unit/compress/expected/issue9.js

@@ -1 +0,0 @@
-var a={a:1,b:2}

+ 0 - 1
utils/node_modules/uglify-js/test/unit/compress/expected/mangle.js

@@ -1 +0,0 @@
-(function(){var a=function b(a,b,c){return b}})()

+ 0 - 1
utils/node_modules/uglify-js/test/unit/compress/expected/null_string.js

@@ -1 +0,0 @@
-var nullString="\0"

+ 0 - 1
utils/node_modules/uglify-js/test/unit/compress/expected/strict-equals.js

@@ -1 +0,0 @@
-typeof a=="string",b+""!=c+"",d<e==f<g

+ 0 - 1
utils/node_modules/uglify-js/test/unit/compress/expected/var.js

@@ -1 +0,0 @@
-var a=1,b=2

+ 0 - 1
utils/node_modules/uglify-js/test/unit/compress/expected/whitespace.js

@@ -1 +0,0 @@
-function id(a){return a}

+ 0 - 1
utils/node_modules/uglify-js/test/unit/compress/expected/with.js

@@ -1 +0,0 @@
-with({});

+ 0 - 3
utils/node_modules/uglify-js/test/unit/compress/test/array1.js

@@ -1,3 +0,0 @@
-new Array();
-new Array(1);
-new Array(1, 2, 3);

+ 0 - 4
utils/node_modules/uglify-js/test/unit/compress/test/array2.js

@@ -1,4 +0,0 @@
-(function(){
-        var Array = function(){};
-        return new Array(1, 2, 3, 4);
-})();

+ 0 - 4
utils/node_modules/uglify-js/test/unit/compress/test/array3.js

@@ -1,4 +0,0 @@
-(function(){
-        return new Array(1, 2, 3, 4);
-        function Array() {};
-})();

+ 0 - 6
utils/node_modules/uglify-js/test/unit/compress/test/array4.js

@@ -1,6 +0,0 @@
-(function(){
-        (function(){
-                return new Array(1, 2, 3);
-        })();
-        function Array(){};
-})();

+ 0 - 20
utils/node_modules/uglify-js/test/unit/compress/test/assignment.js

@@ -1,20 +0,0 @@
-a=1;
-b=a;
-c=1;
-d=b;
-e=d;
-longname=2;
-if (longname+1) {
-    x=3;
-    if (x) var z = 7;
-}
-z=1,y=1,x=1
-
-g+=1;
-h=g;
-
-++i;
-j=i;
-
-i++;
-j=i+17;

+ 0 - 3
utils/node_modules/uglify-js/test/unit/compress/test/concatstring.js

@@ -1,3 +0,0 @@
-var a = a + "a" + "b" + 1 + c;
-var b = a + "c" + "ds" + 123 + c;
-var c = a + "c" + 123 + d + "ds" + c;

+ 0 - 5
utils/node_modules/uglify-js/test/unit/compress/test/const.js

@@ -1,5 +0,0 @@
-// test that the calculation is fold to 13
-var a = 1 + 2 * 6;
-
-// test that it isn't replaced with 0.3333 because that is more characters
-var b = 1/3;

+ 0 - 4
utils/node_modules/uglify-js/test/unit/compress/test/empty-blocks.js

@@ -1,4 +0,0 @@
-var x = 5;
-function bar() { return --x; }
-function foo() { while (bar()); }
-function mak() { for(;;); }

+ 0 - 10
utils/node_modules/uglify-js/test/unit/compress/test/forstatement.js

@@ -1,10 +0,0 @@
-a=func();
-b=z;
-for (a++; i < 10; i++) { alert(i); }
-
-var z=1;
-g=2;
-for (; i < 10; i++) { alert(i); }
-
-var a = 2;
-for (var i = 1; i < 10; i++) { alert(i); }

+ 0 - 6
utils/node_modules/uglify-js/test/unit/compress/test/if.js

@@ -1,6 +0,0 @@
-var a = 1;
-if (a == 1) {
-	a = 2;
-} else {
-	a = 17;
-}

+ 0 - 9
utils/node_modules/uglify-js/test/unit/compress/test/ifreturn.js

@@ -1,9 +0,0 @@
-function a(b) {
-	if (b == 1) {
-		return 2;
-	} else {
-		return 17;
-	}
-
-	return 3;
-}

+ 0 - 16
utils/node_modules/uglify-js/test/unit/compress/test/ifreturn2.js

@@ -1,16 +0,0 @@
-function x(a) {
-    if (typeof a === 'object')
-        return a;
-
-    if (a === 42)
-        return 0;
-
-    return a * 2;
-}
-
-function y(a) {
-    if (typeof a === 'object')
-        return a;
-
-    return null;
-};

+ 0 - 1
utils/node_modules/uglify-js/test/unit/compress/test/issue10.js

@@ -1 +0,0 @@
-function f() { var a; if (a = 'a') { return a; } else { return a; } }; f();

+ 0 - 3
utils/node_modules/uglify-js/test/unit/compress/test/issue11.js

@@ -1,3 +0,0 @@
-new (A, B)
-new (A || B)
-new (X ? A : B)

+ 0 - 1
utils/node_modules/uglify-js/test/unit/compress/test/issue13.js

@@ -1 +0,0 @@
-var a = /^(?:(\w+):)?(?:\/\/(?:(?:([^:@\/]*):?([^:@\/]*))?@)?([^:\/?#])(?::(\d))?)?(..?$|(?:[^?#\/]\/))([^?#]*)(?:\?([^#]))?(?:#(.))?/;

+ 0 - 1
utils/node_modules/uglify-js/test/unit/compress/test/issue14.js

@@ -1 +0,0 @@
-var a = {'\b': '\\b', '\t': '\\t', '\n': '\\n', '\f': '\\f', '\r': '\\r', '"' : '\\"', '\\': '\\\\'};

+ 0 - 1
utils/node_modules/uglify-js/test/unit/compress/test/issue16.js

@@ -1 +0,0 @@
-var a = 0xC1BDCEEE;

+ 0 - 4
utils/node_modules/uglify-js/test/unit/compress/test/issue17.js

@@ -1,4 +0,0 @@
-var a = function(b) {
-    b();
-    a()
-}

+ 0 - 1
utils/node_modules/uglify-js/test/unit/compress/test/issue20.js

@@ -1 +0,0 @@
-{a: 1}

+ 0 - 6
utils/node_modules/uglify-js/test/unit/compress/test/issue21.js

@@ -1,6 +0,0 @@
-var a = 0;
-switch(a) {
-    case 0:
-        a++;
-        break;
-}

+ 0 - 7
utils/node_modules/uglify-js/test/unit/compress/test/issue25.js

@@ -1,7 +0,0 @@
-label1 : {
-    label2 : {
-        break label2;
-        console.log(2);
-    }
-    console.log(1);
-}

+ 0 - 1
utils/node_modules/uglify-js/test/unit/compress/test/issue27.js

@@ -1 +0,0 @@
-(a ? b : c) ? d : e

+ 0 - 1
utils/node_modules/uglify-js/test/unit/compress/test/issue278.js

@@ -1 +0,0 @@
-if (!x) debugger;

部分文件因为文件数量过多而无法显示